Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSMutableSet$Itr


        }
      }
      result = nsArray;
    } else if (obj instanceof Set) {
      Set set = (Set) obj;
      NSMutableSet nsSet = new NSMutableSet();
      Iterator valuesEnum = set.iterator();
      while (valuesEnum.hasNext()) {
        Object value = valuesEnum.next();
        if (value != null) {
          value = toWOCollections(value);
          nsSet.addObject(value);
        }
      }
      result = nsSet;
    } else {
      result = obj;
View Full Code Here


        }
      }
      result = nsArray;
    } else if (obj instanceof Set) {
      Set set = (Set) obj;
      NSMutableSet nsSet = new NSMutableSet();
      Iterator valuesEnum = set.iterator();
      while (valuesEnum.hasNext()) {
        Object value = valuesEnum.next();
        if (value != null) {
          value = toWOCollections(value);
          nsSet.addObject(value);
        }
      }
      result = nsSet;
    } else {
      result = obj;
View Full Code Here

      JSONObject jso = (JSONObject) o;
      String java_class = jso.getString("javaClass");
      if (java_class == null) {
        throw new UnmarshallException("no type hint");
      }
      NSMutableSet abset = null;
      if (java_class.equals("com.webobjects.foundation.NSSet") || java_class.equals("com.webobjects.foundation.NSMutableSet")) {
        abset = new NSMutableSet();
      }
      else {
        throw new UnmarshallException("not a Set");
      }
      JSONObject jsonset = jso.getJSONObject("set");

      if (jsonset == null) {
        throw new UnmarshallException("set missing");
      }

      Iterator i = jsonset.keys();
      String key = null;

      try {
        while (i.hasNext()) {
          key = (String) i.next();
          Object setElement = jsonset.get(key);
          Object unmarshalledObject = ser.unmarshall(state, null, setElement);
          abset.addObject(unmarshalledObject);
        }
      }
      catch (UnmarshallException e) {
        throw new UnmarshallException("key " + i + e.getMessage());
      }
View Full Code Here

            }
            return result;
        }

        protected NSArray indexableObjectsForObjects(String type, NSArray<EOEnterpriseObject> objects) {
            NSMutableSet<EOEnterpriseObject> result = new NSMutableSet();
            for (EOEnterpriseObject eo : objects) {
                NSArray targetObjects = indexableObjectsForObject(type, eo);
                result.addObjectsFromArray(targetObjects);
            }
            return result.allObjects();
        }
View Full Code Here

        private final NSMutableSet<String> _warned = new NSMutableSet();

        protected NSArray indexableObjectsForObject(String type, EOEnterpriseObject object) {
            ERXGenericRecord eo = (ERXGenericRecord) object;
            EOEditingContext ec = eo.editingContext();
            NSMutableSet<EOEnterpriseObject> result = new NSMutableSet();
            String entityName = eo.entityName();
            ConfigurationEntry config = _configuration.entryForKey(entityName);
            if (config != null) {
                if (!config.active) {
                    for (Enumeration e1 = config.notificationKeys.objectEnumerator(); e1.hasMoreElements();) {
                        String key = (String) e1.nextElement();
                        Object value = null;

                        if (type.equals(EOEditingContext.DeletedKey)) {
                            value = ec.committedSnapshotForObject(eo);
                        }

                        EOEntity source = ERXEOAccessUtilities.entityForEo(eo);

                        if (source.classPropertyNames().containsObject(key)) {
                            value = eo.valueForKey(key);
                        } else {
                            if (eo.isNewObject()) {
                                if (!_warned.containsObject(entityName)) {
                                    log.error("We currently don't support unsaved related objects for this entity: " + entityName);
                                    _warned.addObject(entityName);
                                }
                            } else {
                                EORelationship rel = source.anyRelationshipNamed(key);
                                EOKeyGlobalID sourceGlobalID = (EOKeyGlobalID) ec.globalIDForObject(eo);
                                // AK: I wish I could, but when a relationship
                                // is
                                // not a class prop, there's nothing we can do.
                                // value =
                                // ec.arrayFaultWithSourceGlobalID(sourceGlobalID,
                                // rel.name(), ec);
                                EOFetchSpecification fs = new EOFetchSpecification(rel.destinationEntity().name(), null, null);
                                NSMutableArray<EOQualifier> qualifiers = new NSMutableArray(rel.joins().count());
                                NSDictionary pk = source.primaryKeyForGlobalID(sourceGlobalID);
                                for (Iterator iterator = rel.joins().iterator(); iterator.hasNext();) {
                                    EOJoin join = (EOJoin) iterator.next();
                                    Object pkValue = pk.objectForKey(join.sourceAttribute().name());
                                    EOKeyValueQualifier qualifier = new EOKeyValueQualifier(join.destinationAttribute().name(), EOQualifier.QualifierOperatorEqual, pkValue);
                                    qualifiers.addObject(qualifier);
                                }
                                fs.setQualifier(qualifiers.count() == 1 ? qualifiers.lastObject() : new EOAndQualifier(qualifiers));
                                value = ec.objectsWithFetchSpecification(fs);
                            }
                        }
                        if (value != null) {
                            NSArray<EOEnterpriseObject> eos = (value instanceof EOEnterpriseObject ? new NSArray(value) : (NSArray) value);
                            for (EOEnterpriseObject target : eos) {
                                NSArray targetObjects = indexableObjectsForObject(EOEditingContext.UpdatedKey, target);
                                result.addObjectsFromArray(targetObjects);
                            }
                        }
                        if (!result.isEmpty() && log.isDebugEnabled()) {
                            log.debug("re-index: " + eo + "->" + result);
                        }
                    }
                } else {
                    result.addObject(eo);
                }
            }
            return result.allObjects();
        }
View Full Code Here

                // Start the thread
                _queue.start();
            }
        }
       
        _entities = new NSMutableSet();
       
         _configuration.initFromDictionary(indexDef);
        setTransactionHandler(new AutoTransactionHandler());
    }
View Full Code Here

            throw NSForwardException._runtimeExceptionForThrowable(e);
        }
    }

    public NSArray<String> terms(String fieldName) {
        NSMutableSet<String> result = new NSMutableSet();
        TermEnum terms = null;
        try {
            IndexReader reader = indexReader();
            terms = reader.terms(new Term(fieldName, ""));
            while (fieldName.equals(terms.term().field())) {
                result.addObject(terms.term().text());
                if (!terms.next()) {
                    break;
                }
            }
        } catch (IOException e) {
            throw NSForwardException._runtimeExceptionForThrowable(e);
        } finally {
            if (terms != null) {
                try {
                    terms.close();
                } catch (IOException e) {
                    throw NSForwardException._runtimeExceptionForThrowable(e);
                }
            }
        }

        return result.allObjects();
    }
View Full Code Here

    return null;
  }

  public void updateSelectedValues() {
    if (selectedValues.count() > 0) {
      NSMutableSet eos = new NSMutableSet(allObjects());
      for (String key : selectedValues.allKeys()) {
        NSMutableArray<Object> selection = selectedValues.objectForKey(key);
        if (selection.count() > 0) {
          NSMutableSet currentEos = new NSMutableSet();
          for (Object value : selection) {
            currentEos.addObjectsFromArray(values.objectForKey(key).objectForKey(value));
          }
          eos.intersectSet(currentEos);
        }
      }
      displayGroup().setObjectArray(eos.allObjects());
View Full Code Here

            }
        }
    }

    public NSArray canidateRuleSetForRHSInContext(String rhs, D2WContext context) {
        NSMutableSet canidateSet = new NSMutableSet();
        for (Enumeration e = rules().objectEnumerator(); e.hasMoreElements();) {
            Rule r = (Rule)e.nextElement();
            if (r.rhsKeyPath().equals(rhs) && r.canFireInContext(context))
                canidateSet.addObject(r);
        }
        return canidateSet.count() == 0 ? canidateSet.allObjects() :
            EOSortOrdering.sortedArrayUsingKeyOrderArray(canidateSet.allObjects(), ruleSortOrderingKeyArray());
    }
View Full Code Here

       }
       result = gidful;
     }
     else if (obj instanceof NSSet) {
       NSSet eoful = (NSSet)obj;
       NSMutableSet gidful = new NSMutableSet();
       Enumeration objEnum = eoful.objectEnumerator();
       while (objEnum.hasMoreElements()) {
         gidful.addObject(ERXEOControlUtilities.convertEOtoGID(objEnum.nextElement()));
       }
       result = gidful;
     }
     else if (obj instanceof NSDictionary) {
       NSDictionary eoful = (NSDictionary)obj;
       NSMutableDictionary gidful = new NSMutableDictionary();
       Enumeration keyEnum = eoful.keyEnumerator();
       while (keyEnum.hasMoreElements()) {
         Object eofulKey = keyEnum.nextElement();
         Object gidfulKey = ERXEOControlUtilities.convertEOtoGID(eofulKey);
         Object gidfulValue = ERXEOControlUtilities.convertEOtoGID(eoful.objectForKey(eofulKey));
         gidful.setObjectForKey(gidfulValue, gidfulKey);
       }
       result = gidful;
     }
     else {
       result = obj;
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSMutableSet$Itr

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.