Package com.onpositive.commons.ui.tableeditor

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


              fValue = Boolean.TRUE;
            }
            if (fValue.equals("false")) {
              fValue = Boolean.FALSE;
            }
            result[a] = new Filter(fName, Filter.EQUAL, fValue);
            // TODO FIX ME
          }
        }
        return result;
      } else if (keyKindDetails != null) {
        String[] split = value.split(",");
        Filter[] result = new Filter[split.length];
        if (split.length <= keyKindDetails.length) {
          for (int a = 0; a < split.length; a++) {
            String name = keyKindDetails[a];

            String vl = split[a].trim();
            Object fValue = vl;
            if (fValue.equals("true")) {
              fValue = Boolean.TRUE;
            }
            if (fValue.equals("false")) {
              fValue = Boolean.FALSE;
            }
            if (fValue.equals("<null>")) {
              fValue = null;
            }
            // TODO FIX ME
            result[a] = new Filter(name, Filter.EQUAL, fValue);
          }
          return result;
        }
      }
      return null;
View Full Code Here


            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);
            }
View Full Code Here

        if (filtName.equals(Entity.KEY_RESERVED_PROPERTY)) {
          filtName = "ONPOSITIVE_FILTER_FOR_PRIMARY_KEY";
        }

        if (cText != null && cText.trim().equals("<null>")) {
          filters.add(new Filter(filtName, operator, null));
          continue l2;
        }
        if (cText != null && cText.trim().length() != 0) {
          HashSet<Object> hashSet = values.get(f.name);
          if (hashSet != null) {
            for (Object o : hashSet) {
              if (c.getObjectText(o).equals(cText)) {
                filters.add(new Filter(filtName, operator, o));
                continue l2;
              }
            }
          }
          if (f.getType() == String.class) {
            filters.add(new Filter(filtName, operator, cText.trim()));
          } else if (Number.class.isAssignableFrom(f.getType())) {
            if (f.getType() == Long.class) {
              try {
                filters.add(new Filter(filtName, operator, Long
                    .parseLong(cText.trim())));
              } catch (NumberFormatException e) {
                try {
                  filters.add(new Filter(filtName, operator,
                      Double.parseDouble(cText.trim())));
                } catch (NumberFormatException e1) {
                  // just ignoring such filter
                }
              }
            } else if (f.getType() == Double.class) {
              try {
                filters.add(new Filter(filtName, operator,
                    Double.parseDouble(cText.trim())));
              } catch (NumberFormatException e) {
                // just ignoring such filter
              }
            }
          } else if (f.getType() == Key.class) {
            try {
              Key parseKey = new KeyParser().parseKey(cText
                  .trim());
              filters.add(new Filter(filtName, operator, parseKey));
            } catch (Exception e) {
              String s = cText.trim();

              if (c.name.equals(Entity.KEY_RESERVED_PROPERTY)) {
                String[] details = c.getKeyKindDetails();
                if (details != null && details.length != 0) {
                  String[] splitted = s.split(",");
                  for (int i = 0; i < details.length; i++) {
                    String ff = details[i];
                    String fv = "";
                    if (i < splitted.length) {
                      fv = splitted[i];
                      filters.add(new Filter(ff,
                          Filter.EQUAL, fv));
                    }

                  }
                }
              } else {
                filters.add(new Filter(filtName,
                    Filter.COMPLEX_FILTER,
                    new Request.ComplexFilter(s, c)));
              }
            }
          } else if (f.getType() == Date.class) {
            try {
              Date parse = dt.parse(cText);

              filters.add(new Filter(filtName, operator, parse));

            } catch (Exception e) {
              Display.getDefault().syncExec(new Runnable() {

                public void run() {
View Full Code Here

      Request r = new Request();
      Sort s = new Sort("", false);

      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);
View Full Code Here

            + 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);
        }
View Full Code Here

            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);
            }
View Full Code Here

TOP

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

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.