Package com.onpositive.commons.ui.tableeditor

Examples of com.onpositive.commons.ui.tableeditor.Query


          eqFilters.add(a);
        } else {
          otherFilters.add(a);
        }
      }
      Query simpleQuery = new Query(
          eqFilters.toArray(new Filter[eqFilters.size()]), new Sort(
              "", true), limit, 0);
      ArrayList<IComplexQueryRequest> s = new ArrayList<IComplexQueryRequest>();
      SimpleRequest simpleRequest = new SimpleRequest(kind, simpleQuery,
          limit);
View Full Code Here


      if (f.kind == Filter.COMPLEX_FILTER) {
        final ComplexFilter filter = (ComplexFilter) f.value;
        final Filter[] parseValue = filter.field.parseValue(filter);
        if (parseValue != null) {
          return new ReificationRequest(new SimpleRequest(
              filter.field.keyKind, new Query(parseValue,
                  new Sort("", false), limit, 0), limit),
              limit) {

            protected IComplexQueryRequest toQuery(Object object) {
              Entity e = (Entity) object;
              Key key = e.getKey();
              return new SimpleRequest(kind, new Query(
                  new Filter[] { new Filter(
                      filter.field.name, Filter.EQUAL,
                      key) }, new Sort("", true), 100,
                  100), 100);
            }

            public void filter(HashSet<Object> r) {
              waitWhileNotDone();
              HashSet<Object> toREtain = new HashSet<Object>();
              for (Object o : r) {
                Entity e = (Entity) o;
                String fName = filter.field.name;

                Object property = e.getProperty(fName);
                if (fName.equals(Entity.KEY_RESERVED_PROPERTY)) {
                  property = e.getKey();
                }

                if (property instanceof Collection) {
                  Collection c = (Collection) property;
                  for (Object o1 : c) {
                    if (matching.contains(property)) {
                      toREtain.add(o1);
                      break;
                    }
                  }
                } else {
                  if (matching.contains(property)) {
                    toREtain.add(o);
                  }
                }
              }
              r.retainAll(toREtain);
            }
          };
        }
        return null;
      }
      return new SimpleRequest(kind, new Query(new Filter[] { f },
          new Sort("", false), limit, 0), limit);
    }
View Full Code Here

            }
          }
          if (filters.size() > 0) {
            ArrayList<Key> keys = new ArrayList<Key>();
            Query c = new Query(filters.toArray(new Filter[filters
                .size()]), new Sort("", false), 100, 0);
            c.keysOnly = true;
            BaseDataFacade createFacade = field
                .createFacade(field.keyKind);
            Entity[] query2 = createFacade.query(c, monitor);
View Full Code Here

      callback.failed(e);
    }
  }

  public Query getDefaultQuery() {
    return new Query(new Filter[0], new Sort("", false), 1000, 0);
  }
View Full Code Here

  public String getKind() {
    return kind;
  }

  public void refresh() {
    Query currentQuery = getCurrentQuery();
    ApiProxy.setEnvironmentForCurrentThread(new FakeEnvironment(getAppId()));
    updateFilters(currentQuery);
    if (refreshCallback != null) {
      query(currentQuery, refreshCallback);
    }
View Full Code Here

      for (int i = 0; i < entities.length; i++) {
        if (entities[i].getKey() != null) {
          Filter f = new Filter("ONPOSITIVE_FILTER_FOR_PARENT_KEY",
              Filter.EQUAL, entities[i].getKey());// "ONPOSITIVE_FILTER_FOR_PARENT_KEY"

          Query q = new Query(new Filter[] { f }, s, 4, 0);
          Request.ViewRequestPart vrp = new Request.ViewRequestPart(
              kind, q, 4, namespace);
          r.addPart(vrp);
        }
      }
View Full Code Here

        if (parameters == null || writer == null || currFacade == null) {
          return Status.CANCEL_STATUS;
        }
        SimpleRequest req = null;
        if (parameters.filterColumns && parameters.selectedEntitiesOf) {
          Query query = currFacade.getCurrentQuery();
          int limit = currFacade.getLimit();
          String kind = currFacade.getKind();
          req = new SimpleRequest(kind, query, limit);
        }
View Full Code Here

        cFacade.setLimit(currentSize - 1);
        monitor.setTaskName("Status: Requests sended - "
            + numberOfRequests + "; Entities imported - "
            + numberOfEntities + "; Current buffer size - "
            + (currentSize) + "");
        Query newQuery = null;
        if (offset != null) {
          Filter filt = new Filter(PRIMARY_KEY, Filter.GREATER,
              offset);
          newQuery = new Query(new Filter[] { filt }, sort, 1000, 0);
        } else {
          newQuery = new Query(new Filter[0], sort, 1000, 0);
        }
        monitor.subTask("\nExtracting data from data storage...");
        cFacade.query(newQuery, cb, new NullProgressMonitor(), true);
        numberOfRequests++;
        if (cb.hasError) {
View Full Code Here

    }
    return;
  }

  public void refresh() {
    Query currentQuery = getCurrentQuery();
    updateFilters(currentQuery);
    if (refreshCallback != null) {
      query(currentQuery, refreshCallback);
    }
  }
View Full Code Here

      if (f.kind == Filter.COMPLEX_FILTER) {
        final ComplexFilter filter = (ComplexFilter) f.value;
        final Filter[] parseValue = filter.field.parseValue(filter);
        if (parseValue != null) {
          return new ReificationRequest(new SimpleRequest(
              filter.field.keyKind, new Query(parseValue,
                  new Sort("", false), limit, 0), limit),
              limit) {

            protected IComplexQueryRequest toQuery(Object object) {
              Entity e = (Entity) object;
              Key key = e.getKey();
              return new SimpleRequest(kind, new Query(
                  new Filter[] { new Filter(
                      filter.field.name, Filter.EQUAL,
                      key) }, new Sort("", true), 100,
                  100), 100);
            }

            public void filter(HashSet<Object> r) {
              waitWhileNotDone();
              HashSet<Object> toREtain = new HashSet<Object>();
              for (Object o : r) {
                Entity e = (Entity) o;
                Object property = e
                    .getProperty(filter.field.name);
                if (property instanceof Collection) {
                  Collection c = (Collection) property;
                  for (Object o1 : c) {
                    if (matching.contains(property)) {
                      toREtain.add(o1);
                      break;
                    }
                  }
                } else {
                  if (matching.contains(property)) {
                    toREtain.add(o);
                  }
                }
              }
              r.retainAll(toREtain);
            }
          };
        }
        return null;
      }
      return new SimpleRequest(kind, new Query(new Filter[] { f },
          new Sort("", false), limit, 0), limit);
    }
View Full Code Here

TOP

Related Classes of com.onpositive.commons.ui.tableeditor.Query

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.