Package com.webobjects.eocontrol

Examples of com.webobjects.eocontrol.EOSortOrdering


    // Utility
    ///////////
    protected EOSortOrdering _primarySortOrdering() {
        NSArray anArray = displayGroup().sortOrderings();
        if ((anArray!=null) && (anArray.count() > 0)) {
            EOSortOrdering anOrdering = (EOSortOrdering)anArray.objectAtIndex(0);
            return anOrdering;
        }
        return null;
    }
View Full Code Here


        }
        return _selectedKey;
    }

    protected boolean _isCurrentKeyPrimary() {
        EOSortOrdering anOrdering = _primarySortOrdering();
        if ((anOrdering!=null && _selectedKey != null) && anOrdering.key().equals(selectedKey())) {
            return true;
        }
        return false;
    }
View Full Code Here

        }
        return false;
    }

    protected NSSelector _primaryKeySortOrderingSelector() {
        EOSortOrdering anOrdering = _primarySortOrdering();
        NSSelector anOrderingSelector = null;
        if (anOrdering!=null) anOrderingSelector = anOrdering.selector();
        return anOrderingSelector;
    }
View Full Code Here

        return anOrderingSelector;
    }

    protected void _removeSortOrderingWithKey(String aKey) {
        int anIndex = 0;
        EOSortOrdering aSortOrdering = null;
        WODisplayGroup aDisplayGroup = displayGroup();
        NSArray<EOSortOrdering> sortOrderings = aDisplayGroup.sortOrderings();
        if (sortOrderings!=null) {
            NSMutableArray<EOSortOrdering> aSortOrderingArray = sortOrderings.mutableClone();
            Enumeration anEnumerator = aSortOrderingArray.objectEnumerator();
            while (anEnumerator.hasMoreElements()) {
                aSortOrdering = (EOSortOrdering) anEnumerator.nextElement();
                if (aKey.equals(aSortOrdering.key())) {
                    aSortOrderingArray.removeObjectAtIndex(anIndex);
                    break;
                }
                anIndex++;
            }
View Full Code Here

        if (sortOrderings!=null) {
            aSortOrderingArray = new NSMutableArray<EOSortOrdering>(sortOrderings);
        } else {
            aSortOrderingArray = new NSMutableArray<EOSortOrdering>();
        }
        EOSortOrdering aNewSortOrdering = EOSortOrdering.sortOrderingWithKey(aKey, aSelector);
        aSortOrderingArray.insertObjectAtIndex(aNewSortOrdering, 0);
        if (aSortOrderingArray.count() > 3) {
            // ** limits sorting to 3 levels
            aSortOrderingArray.removeLastObject();
        }
View Full Code Here

            if (_dictionary == null) {
                _dictionary = NSDictionary.EmptyDictionary;
                _keyList = NSArray.EmptyArray;
            } else {
                _keyList = _dictionary.allKeys();
                _keyList = EOSortOrdering.sortedArrayUsingKeyOrderArray(_keyList, new NSArray<EOSortOrdering>(new EOSortOrdering("toString", EOSortOrdering.CompareAscending)));
            }
        }
        return _dictionary;
    }
View Full Code Here

   * @author David Avendasora
   */
  public ERXSortOrderings prefix(NSArray<EOSortOrdering> sortOrderings) {
    ERXSortOrderings prefixedSortOrderings = new ERXSortOrderings();
    for (EOSortOrdering sortOrdering : sortOrderings) {
      EOSortOrdering prefixedSortOrdering = prefix(sortOrdering);
      prefixedSortOrderings.addObject(prefixedSortOrdering);
    }
    return prefixedSortOrderings;
  }
View Full Code Here

    NSArray<String> sortOrderingDefinition = (NSArray<String>) d2wContext.valueForKey("defaultSortOrdering");
    if (sortOrderingDefinition != null) {
      for (int i = 0; i < sortOrderingDefinition.count();) {
        String sortKey = sortOrderingDefinition.objectAtIndex(i++);
        String sortSelectorKey = sortOrderingDefinition.objectAtIndex(i++);
        EOSortOrdering sortOrdering = new EOSortOrdering(sortKey, ERXArrayUtilities.sortSelectorWithKey(sortSelectorKey));
        validatedSortOrderings.addObject(sortOrdering);
      }
      if (log.isDebugEnabled()) {
        log.debug("Found sort Orderings in rules " + validatedSortOrderings);
      }
View Full Code Here

 
  /** @return The display group */
  public ERXDisplayGroup<TaskInfo> dg() {
    if ( _dg == null ) {
      // Show most recent first.
      EOSortOrdering pkOrder = new EOSortOrdering("id", EOSortOrdering.CompareDescending);
      ERXFetchSpecification<TaskInfo> fs = new ERXFetchSpecification<TaskInfo>(TaskInfo.ENTITY_NAME, null, new ERXSortOrderings(pkOrder));
     
      EOEditingContext ec = ERXEC.newEditingContext();
      EODatabaseDataSource ds = new EODatabaseDataSource(ec, TaskInfo.ENTITY_NAME);
      ds.setFetchSpecification(fs);
View Full Code Here

      //EOQualifier q3 = new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorLessThan, Long.valueOf(82));
      EOQualifier q3 = new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorLessThanOrEqualTo, Long.valueOf(802));
      EOQualifier qualifier = new EOAndQualifier(new NSArray<EOQualifier>(new EOQualifier[]{q1, q2, q3}));
      EOFetchSpecification fs = new EOFetchSpecification("LuceneAsset", qualifier, null);
      fs.setFetchLimit(5);
      fs.setSortOrderings(new NSArray(new EOSortOrdering("userCount", EOSortOrdering.CompareAscending)));
      Query query = ERLuceneAdaptorChannel.queryForQualifier(new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorLessThanOrEqualTo, 802), EOUtilities.entityNamed(ec, "LuceneAsset"));
      fs.setHints(new NSDictionary(query, ERLuceneAdaptor.QUERY_HINTS));
      NSArray<EOEnterpriseObject> result = ec.objectsWithFetchSpecification(fs);
      log.info(result.count() + ": " + result.valueForKey("userCount"));
      for (EOEnterpriseObject eo : result) {
View Full Code Here

TOP

Related Classes of com.webobjects.eocontrol.EOSortOrdering

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.