Ejemplo n.º 1
0
  public String getResultado2() throws EntityNotFoundException {
    Query q = new Query("Relationship");
    UserService userService = ServiceLocator.getUserService();
    q.addFilter(
        "user", Query.FilterOperator.EQUAL, ServiceLocator.getUserService().getCurrentUser());

    StringBuffer resultado = new StringBuffer();
    Iterator<Entity> iterator = ServiceLocator.getPersistenceService().queryIterator(q);
    if (!iterator.hasNext()) {
      resultado.append("\nNo records found.");
    } else {
      while (iterator.hasNext()) {
        Entity record = iterator.next();
        resultado.append("\n" + record.getKey());

        List children = (List) record.getProperty("children");
        for (Iterator iterator2 = children.iterator(); iterator2.hasNext(); ) {
          Key k = (Key) iterator2.next();
          Entity child = ServiceLocator.getPersistenceService().load(k);
          resultado.append("\nXXXX" + child.getProperties() + "YYYY");
        }

        // String recordString = printEntity(record);
      }
    }

    return resultado.toString();
  }
Ejemplo n.º 2
0
  public String getResultado() throws EntityNotFoundException {
    Query q = new Query("Person");
    UserService userService = ServiceLocator.getUserService();
    q.addFilter(
        "user", Query.FilterOperator.EQUAL, ServiceLocator.getUserService().getCurrentUser());

    StringBuffer resultado = new StringBuffer();
    Iterator<Entity> iterator = ServiceLocator.getPersistenceService().queryIterator(q);
    if (!iterator.hasNext()) {
      resultado.append("\nNo records found.");
    } else {
      while (iterator.hasNext()) {
        Entity record = iterator.next();

        resultado.append("\n" + record.getProperties());
      }
    }

    return resultado.toString();
  }