Package er.extensions.qualifiers

Examples of er.extensions.qualifiers.ERXQualifierTraversal


   * @return qualifier string
   */
  protected static String identifierForQualifier(EOQualifier qualifier) {
    final StringBuilder sb = new StringBuilder();
    if(qualifier != null) {
      ERXQualifierTraversal traversal = new ERXQualifierTraversal() {

        @Override
        protected void visit(EOQualifierEvaluation q) {
          sb.append(q.getClass().getName());
        }

        @Override
        protected boolean traverseKeyComparisonQualifier(EOKeyComparisonQualifier q) {
          sb.append(q.leftKey()).append(q.selector().name()).append(q.rightKey());
          return super.traverseKeyComparisonQualifier(q);
        }

        @Override
        protected boolean traverseKeyValueQualifier(EOKeyValueQualifier q) {
          Object value = q.value();
          if (value instanceof EOEnterpriseObject) {
            EOEnterpriseObject eo = (EOEnterpriseObject) value;
            value = ERXEOControlUtilities.primaryKeyStringForObject(eo);
          } else if (value instanceof NSArray) {
            NSArray arr = (NSArray) value;
            String s = "";
            for (Object object : arr) {
              if (object instanceof EOEnterpriseObject) {
                EOEnterpriseObject eo = (EOEnterpriseObject) object;
                s += ERXEOControlUtilities.primaryKeyStringForObject(eo);
              } else {
                s += NSPropertyListSerialization.stringFromPropertyList(object);
              }
            }
            value = s;
          }
          sb.append(q.key()).append(q.selector().name()).append(value);
          return super.traverseKeyValueQualifier(q);
        }
      };
      traversal.traverse(qualifier);
    }
    return sb.toString();
  }
View Full Code Here

TOP

Related Classes of er.extensions.qualifiers.ERXQualifierTraversal

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.