Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSArray$_MinOperator


    if (!canGetValueForBinding("listItemIDKeyPath")) {
      throw new IllegalArgumentException("You must specify 'listItemIDKeyPath' if you specify 'list'.");
    }
    String listItemIDKeyPath = (String) valueForBinding("listItemIDKeyPath");
    Object listItemIDArrayObj = request.formValues().objectForKey(_sortOrderKeyName + "[]");
    NSArray listItemIDArray;
    if (listItemIDArrayObj instanceof NSArray) {
      listItemIDArray = (NSArray) listItemIDArrayObj;
    }
    else if (listItemIDArrayObj instanceof String) {
      String listItemIDStr = (String) listItemIDArrayObj;
      listItemIDArray = new NSArray(listItemIDStr);
    }
    else {
      throw new IllegalArgumentException("Unknown list item ID array " + listItemIDArrayObj);
    }

    NSArray list = (NSArray) valueForBinding("list");
    boolean mutableList = (list instanceof NSMutableArray);
    NSMutableArray reorderedList;
    if (mutableList) {
      reorderedList = (NSMutableArray) list;
    }
    else {
      reorderedList = new NSMutableArray();
    }

    int startIndex = 0;
    // If we're starting at an index > 0, add the initial objects
    if (canGetValueForBinding("startIndex")) {
      Number startIndexNumber = (Number) valueForBinding("startIndex");
      startIndex = startIndexNumber.intValue();
      if (!mutableList) {
        for (int i = 0; i < startIndex; i++) {
          reorderedList.addObject(list.objectAtIndex(i));
        }
      }
    }

    // Add the reordered objects
    int listItemIDCount = listItemIDArray.count();
    for (int listItemIDIndex = 0; listItemIDIndex < listItemIDCount; listItemIDIndex++) {
      String itemID = (String) listItemIDArray.objectAtIndex(listItemIDIndex);
      NSRange itemPageRange;
      if (mutableList) {
        itemPageRange = new NSRange(startIndex + listItemIDIndex, listItemIDCount - listItemIDIndex);
      }
      else {
        itemPageRange = new NSRange(startIndex, listItemIDCount);
      }
      NSArray itemPageArray = list.subarrayWithRange(itemPageRange);
      EOQualifier itemIDQualifier = new EOKeyValueQualifier(listItemIDKeyPath, EOQualifier.QualifierOperatorEqual, itemID);
      NSArray matchingItems = EOQualifier.filteredArrayWithQualifier(itemPageArray, itemIDQualifier);
      if (matchingItems.count() == 0) {
        throw new NoSuchElementException("There was no item that matched the ID '" + itemID + "' in " + list + ".");
      }
      else if (matchingItems.count() > 1) {
        throw new IllegalStateException("There was more than one item that matched the ID '" + itemID + "' in " + list + ".");
      }
      Object replacingItem = matchingItems.objectAtIndex(0);
      if (mutableList) {
        int replacedItemIndex = itemPageRange.location();
        Object replacedItem = reorderedList.objectAtIndex(replacedItemIndex);
        if (replacedItem != replacingItem) {
          int replacingItemIndex = replacedItemIndex + itemPageArray.indexOfObject(replacingItem);
View Full Code Here


        else if (_selectedValue != null)
        {
            selectedValue = _selectedValue.valueInComponent(parent);
        }
       
        NSArray list = (NSArray) _list.valueInComponent(parent);
       
        Object previousGroup = null;
        boolean didOpenOptionGroup = false;
        boolean shouldEscapeHTML = _escapeHTML != null ? _escapeHTML.booleanValueInComponent(parent) : true;
       
        for(int i = 0; i < list.count(); i++)
        {
             Object listItem = list.objectAtIndex(i);
             _item.setValue(listItem, parent);
            
             Object currentGroup = group.valueInComponent(parent);
             if ( ! currentGroup.equals(previousGroup))
             {
View Full Code Here

                            result.addObject(c);
                        } else {
                            tmp.addObject(currentValue);
                        }
                    } else {
                        NSArray current = (NSArray)e.nextElement();
                        ERD2WContainer c=new ERD2WContainer();
                        c.name = (String)current.objectAtIndex(0);
                        c.keys = current.mutableClone();
                        c.keys.removeObjectAtIndex(0);
                        result.addObject(c);
                    }
                }
            }
View Full Code Here

     * @return a dictionary of D2W-related keys to describe the D2W state of the context.
     */
    public static synchronized NSMutableDictionary informationForContext(WOContext context) {
        NSMutableDictionary info = new NSMutableDictionary();
        D2WContext d2wContext = null;
        NSArray componentStack = ERXWOContext._componentPath(context);
        // Try to get the information for the D2WPage closest to the end of the component stack, i.e., more specific
        // info., that is especially helpful for finding problems in embedded page configurations.
        WOComponent component = null;
        for (Enumeration componentsEnum = componentStack.reverseObjectEnumerator(); componentsEnum.hasMoreElements();) {
            WOComponent c = (WOComponent)componentsEnum.nextElement();
            if (c instanceof D2WPage) {
                component = c;
                break;
            }
        }
        if (null == component) { // Fall back to the highest level page.
            component = context.page();
        }

        try {
            d2wContext = (D2WContext)component.valueForKey("d2wContext");
        } catch (NSKeyValueCoding.UnknownKeyException uke) {
            if (log.isInfoEnabled()) {
                log.info("Could not retrieve D2WContext from component context; it is probably not a D2W component.");
            }
        }

        if (d2wContext != null) {
            NSMutableDictionary d2wInfo = informationForD2WContext(d2wContext);
            if (component instanceof ERD2WPage) {
                ERD2WPage currentPage = (ERD2WPage)component;
                String subTask = (String)d2wContext.valueForKey("subTask");
                if ("tab".equals(subTask) || "wizard".equals("subTask")) {
                    NSArray sections = currentPage.sectionsForCurrentTab();
                    d2wInfo.setObjectForKey(sections != null ? sections : "null", "D2W-SectionsContentsForCurrentTab");
                    d2wInfo.removeObjectForKey("D2W-TabSectionsContents");
                }
            }
            info.addEntriesFromDictionary(d2wInfo);
View Full Code Here

            if ("tab".equals(subTask) || "wizard".equals("subTask")) {
                String tabKey = (String)d2wContext.valueForKey("tabKey");
                info.setObjectForKey(tabKey != null ? tabKey : "null", "D2W-TabKey");

                NSArray tabSections = (NSArray)d2wContext.valueForKey("tabSectionsContents");
                info.setObjectForKey(tabSections != null ? tabSections : "null", "D2W-TabSectionsContents");
            } else {
                NSArray displayPropertyKeys = (NSArray)d2wContext.valueForKey("displayPropertyKeys");
                info.setObjectForKey(displayPropertyKeys != null ? displayPropertyKeys : "null", "D2W-DisplayPropertyKeys");
            }

            String componentName = (String)d2wContext.valueForKey("componentName");
            info.setObjectForKey(componentName != null ? componentName : "null", "D2W-ComponentName");
View Full Code Here

        pkSpec.setRefreshesRefetchedObjects(refreshesCache);
        pkSpec.setFetchesRawRows(true);
        pkSpec.setRawRowKeyPaths(entity.primaryKeyAttributeNames());
        pkSpec.setHints( new NSDictionary( expression, EODatabaseContext.CustomQueryExpressionHintKey ) );

        NSArray pkDicts = ec.objectsWithFetchSpecification(pkSpec);
        NSMutableArray pks = new NSMutableArray();
        String pkAtttributeName = entity.primaryKeyAttributes().lastObject().name();

        for ( Enumeration rowEnumerator = pkDicts.objectEnumerator(); rowEnumerator.hasMoreElements(); ) {
            NSDictionary row = (NSDictionary) rowEnumerator.nextElement();
            pks.addObject( row.objectForKey( pkAtttributeName ));
        }

        EOFetchSpecification spec = new EOFetchSpecification(entityName, null, sortOrderings);
View Full Code Here

     */
    protected static String processedQueryString(String query, EOSQLExpression expression, ERXSQLBinding... bindings) {
        int currentOffset = 0;
        int bindingCount = 0;
        StringBuilder processedQueryBuffer = new StringBuilder();
        NSArray positions = varPositionsForQuery( query );

        if( positions.count() != bindings.length ) {
            throw new RuntimeException("Binding placeholders count (" + positions.count() + ") does not match binding wrappers count (" + bindings.length + ").");
        }

        for ( Enumeration positionEnumerator = positions.objectEnumerator(); positionEnumerator.hasMoreElements(); ) {
            Integer position = (Integer) positionEnumerator.nextElement();
            if( position > currentOffset ) {
                processedQueryBuffer.append( query.substring( currentOffset, position ) );
            }
            ERXSQLBinding binding = bindings[bindingCount];
View Full Code Here

    public int index, d2wPropertyKeyIndex, col;

    private NSMutableArray _compareList;
    public NSArray compareList() {
        if (_compareList == null) {
            NSArray list = displayGroup().displayedObjects();
            _compareList = new NSMutableArray();
            if (list != null && list.count() > 0) {
                _compareList.addObject(list.objectAtIndex(0));
                Object o=comparisonObject();
                if (o!=null) _compareList.addObject(o);
                _compareList.addObjectsFromArray(list);
            }
        }
View Full Code Here

  public static NSArray<Day> daysBetween(NSTimestamp start, NSTimestamp end) {
    if (start == null && end == null) {
      throw new IllegalArgumentException("Both start and end dates cannot be null");
    }
    if (start == null) {
      return new NSArray(new Day(end));
    }
    if (end == null) {
      return new NSArray(new Day(start));
    }

    if (DateUtils.isOnTheSameDay(start, end)) {
      return new NSArray(new Day(start));
    }

    if (end.before(start)) {
      NSTimestamp temp = start;
      start = end;
View Full Code Here

   * @return an array of changed EOs (if not trackAllChanges, this will only
   *         ever return at most one)
   */
  @SuppressWarnings("unchecked")
  protected NSArray<T> relevantChanges(EOEditingContext editingContext, NSDictionary dict, String key) {
    NSArray allObjects = (NSArray) dict.objectForKey(key);
    NSMutableArray<T> changedObjects = new NSMutableArray<T>();
    for (Enumeration enumeration = allObjects.objectEnumerator(); enumeration.hasMoreElements();) {
      EOEnterpriseObject eo = (EOEnterpriseObject) enumeration.nextElement();
      String changedEntityName = eo.entityName();
      if (isRelevant(editingContext, changedEntityName)) {
        changedObjects.addObject((T) eo);
        if (!_trackAllChanges) {
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSArray$_MinOperator

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.