Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSArray


    @Override
    public WOActionResults defaultAction() {
        //testIndexing();
        NSDictionary dict = new NSDictionary("TestValue", "TestKey");
        NSArray keys = new NSArray(new String[]{"test1", "test2"});
        _EOMutableKnownKeyDictionary vals;
        _EOMutableKnownKeyDictionary.Initializer initializer = new _EOMutableKnownKeyDictionary.Initializer(keys);
        vals = new _EOMutableKnownKeyDictionary(initializer);
        log.info(vals);
        vals.setObjectForKey("t1", "test1");
View Full Code Here


  /**
   * @return dictionary of columns() keyed on KEY_PATH of column
   */
  public NSMutableDictionary columnsByKeypath() {
    if (columnsByKeypath == null) {
      NSArray columns = columns();
      columnsByKeypath = new NSMutableDictionary(columns.count());
      for (int i = 0; i < columns.count(); i++) {
        columnsByKeypath.setObjectForKey(columns.objectAtIndex(i), ((NSKeyValueCoding) columns.objectAtIndex(i)).valueForKey(KEY_PATH));
      }
    }

    return columnsByKeypath;
  }
View Full Code Here

  /**
   * @return dictionary of sortOrders() keyed on KEY_PATH of column
   */
  public NSMutableDictionary sortOrdersByKeypath() {
    if (sortOrdersByKeypath == null) {
      NSArray sortOrders = sortOrders();
      sortOrdersByKeypath = new NSMutableDictionary(sortOrders.count());
      for (int i = 0; i < sortOrders.count(); i++) {
        sortOrdersByKeypath.setObjectForKey(sortOrders.objectAtIndex(i), ((NSKeyValueCoding) sortOrders.objectAtIndex(i)).valueForKey(KEY_PATH));
      }
    }
    return sortOrdersByKeypath;
  }
View Full Code Here

   * @return dictionary of formatters for columns() keyed on KEY_PATH of
   *         column
   */
  public NSMutableDictionary formattersByKeypath() {
    if (formattersByKeypath == null) {
      NSArray columns = columns();
      formattersByKeypath = new NSMutableDictionary(columns.count());
      for (int i = 0; i < columns.count(); i++) {
        NSDictionary column = (NSDictionary) columns.objectAtIndex(i);
        String className = (String) column.valueForKey(FORMATTER_CLASS);
        if (className != null) {
          try {
            Format formatter = (Format) Class.forName(className).newInstance();
            String pattern = (String) column.valueForKey(FORMAT_PATTERN);
View Full Code Here

      sortOrderings = fetchSpecification.sortOrderings();
    }

    if (entity.restrictingQualifier() != null) {
      if (qualifier != null) {
        qualifier = new EOAndQualifier(new NSArray(new EOQualifier[] { qualifier, entity.restrictingQualifier() }));
      } else {
        qualifier = entity.restrictingQualifier();
      }
    }

    NSMutableArray<EORelationship> mergeRelationships = new NSMutableArray<EORelationship>();
    if (qualifier != null && context != null) {
      NSArray<EOKeyValueQualifier> keyValueQualifiers = ERXQ.extractKeyValueQualifiers(qualifier);
      for (EOKeyValueQualifier keyValueQualifier : keyValueQualifiers) {
        String qualifierKey = keyValueQualifier.key();
        String relationshipName = qualifierKey;
        if (relationshipName.contains(".")) {
          relationshipName = ERXStringUtilities.firstPropertyKeyInKeyPath(relationshipName);
        }
        EORelationship mergeRelationship = entity.relationshipNamed(relationshipName);
        if (mergeRelationship != null) {
          mergeRelationships.add(mergeRelationship);
          qualifier = ERXQ.replaceQualifierWithQualifier(qualifier, keyValueQualifier,
              ERXQ.has(qualifierKey, new NSArray(keyValueQualifier.value())));
        } else if (qualifierKey.equals(entity.primaryKeyAttributeNames().get(0))
            && keyValueQualifier.selector().name().equals("doesContain") && !(keyValueQualifier.value() instanceof NSArray)) {
          // fix wrong schemaBasedQualifier
          qualifier= ERXQ.replaceQualifierWithQualifier(qualifier, keyValueQualifier,
              ERXQ.is(qualifierKey, keyValueQualifier.value()));
View Full Code Here

  protected void _fillInOpenNodes(Object node, NSMutableArray nodes, boolean showNode) {
    if (showNode) {
      nodes.addObject(node);
    }
    if (treeModel().isExpanded(node)) {
      NSArray childrenTreeNodes = treeModel().childrenTreeNodes(node);
      if (childrenTreeNodes != null) {
        int childTreeNodeCount = childrenTreeNodes.count();
        for (int childTreeNodeNum = 0; childTreeNodeNum < childTreeNodeCount; childTreeNodeNum++) {
          Object childNode = childrenTreeNodes.objectAtIndex(childTreeNodeNum);
          _fillInOpenNodes(childNode, nodes, true);
        }
      }
    }
  }
View Full Code Here

        relationshipDisplayGroup.setDataSource(relationshipDataSource);

        if(isSortedRelationship()){
            EOSortOrdering indexOrdering = EOSortOrdering.sortOrderingWithKey(indexKey(),
                                                                              EOSortOrdering.CompareAscending);
            relationshipDisplayGroup.setSortOrderings(new NSArray(indexOrdering));
        }

       
        relationshipDisplayGroup.fetch();
        setPropertyKey(displayKey());
View Full Code Here

        if (_localEoToAddToRelationship != null) {
            // we create a join
            EOEnterpriseObject joinEO=ERXEOControlUtilities.createAndInsertObject(editingContext(), entity().name());

            NSArray sortedObjects=relationshipDisplayGroup.displayedObjects();
            if(isSortedRelationship()){
                Number lastIndex = null;
                if (sortedObjects!=null && sortedObjects.count()>0) {
                    EOEnterpriseObject lastObject=(EOEnterpriseObject)relationshipDisplayGroup.displayedObjects().lastObject();
                    lastIndex=(Number)lastObject.valueForKey(indexKey());
                }
                int newIndex = lastIndex!=null ? lastIndex.intValue()+1 : 0;
                joinEO.takeValueForKey(ERXConstant.integerForInt(newIndex),indexKey());               
View Full Code Here

    public void updateEOsOrdering(){
        if(isSortedRelationship()){
            //If the session uses javascript then we need to update the EOs according
            //to what has been changed by the javascript in the WOBrowser
            NSArray hiddenFieldValues = NSArray.componentsSeparatedByString(sortedObjects, ",");
            if(log.isDebugEnabled()) log.debug("hiddenFieldValues = "+hiddenFieldValues);
            if(hiddenFieldValues != null){
                int i = 0;
                for(Enumeration e = hiddenFieldValues.objectEnumerator(); e.hasMoreElements();){
                    String objectForHashCode = (String)e.nextElement();
                    if(log.isDebugEnabled()) log.debug("objectForHashCode = "+objectForHashCode);
                    EOEnterpriseObject eo = objectForHashCode(objectForHashCode);
                    if(eo!=null){
                        eo.takeValueForKey(ERXConstant.integerForInt(i), indexKey());
View Full Code Here

    }

    private EORelationship _destinationRelationship;
    public EORelationship destinationRelationship() {
        if (_destinationRelationship==null) {
            NSArray joinRelationships = ERDSortedManyToManyAssignment.joinRelationshipsForJoinEntity(entity());

            String originEntityName=object().entityName();
            //General case
            for (Enumeration e=joinRelationships.objectEnumerator(); e.hasMoreElements();) {
                EORelationship r=(EORelationship)e.nextElement();
                if (!originEntityName.equals(r.destinationEntity().name())) {
                    _destinationRelationship=r;
                    break;
                }
            }
            // In the case we have a self join relationship we have to be more clever
            if(_destinationRelationship==null){
                EOEntity originEntity = EOModelGroup.defaultGroup().entityNamed(originEntityName);
                EORelationship originRelationship = originEntity.relationshipNamed(relationshipKey());
                EORelationship inverseOriginRelationship = originRelationship.inverseRelationship();
                for (Enumeration e=joinRelationships.objectEnumerator(); e.hasMoreElements();) {
                    EORelationship r=(EORelationship)e.nextElement();
                    if (r!=inverseOriginRelationship) {
                        _destinationRelationship=r;
                        break;
                    }
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSArray

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.