Examples of lastObject()


Examples of com.webobjects.foundation.NSArray.lastObject()

      matchingObjects = EOQualifier.filteredArrayWithQualifier(matchingObjects, fetchObjectsQualifier(key));

      if (matchingObjects.count() > 1) {
      throw new EOUtilities.MoreThanOneException("There was more than one " + _entityName + " with the key '" + key + "'.");
      }
      return matchingObjects.count() == 1 ? (T)matchingObjects.lastObject() : null;
    }
     
    /**
     * Returns a list of all the objects currently in the cache and not yet expired.
     * @param ec editing context to get the objects into
View Full Code Here

Examples of com.webobjects.foundation.NSArray.lastObject()

        dbc.lock();
        try {
          EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, entityName);
          EOAdaptorChannel channel = (EOAdaptorChannel) dbc.adaptorContext().channels().lastObject();
          NSArray result = channel.primaryKeysForNewRowsWithEntity(increasePkBy, entity);
          return (Long) ((NSDictionary) result.lastObject()).allValues().lastObject();
        } finally {
          dbc.unlock();
        }
      } finally {
        ec.unlock();
View Full Code Here

Examples of com.webobjects.foundation.NSArray.lastObject()

          EOQualifier q = new EOKeyValueQualifier("className", EOQualifier.QualifierOperatorEqual, className);
          NSArray candidates = EOQualifier.filteredArrayWithQualifier(entities, q);
          if(candidates.count() > 1) {
            log.warn("More than one entity found: " + candidates);
          }
          EOEntity entity = (EOEntity) candidates.lastObject();
          if(entity != null) {
            String entityName = entity.name();
            // HACK AK: this relies on you having set up your classes correctly,
            // meaning that you have exactly one final class var per EO class, with the correct
            // superclasses set up (so EOBase gets loaded before EOSubclass)
View Full Code Here

Examples of com.webobjects.foundation.NSArray.lastObject()

        NSArray someObjects = anEditingContext.objectsWithFetchSpecification(aFetchSpecification);

        System.out.println("Fetch result for '" + aQualifier + "': " + someObjects.valueForKey("name"));

        if (someObjects != null) {
            EOEnterpriseObject anObject = (EOEnterpriseObject) someObjects.lastObject();
            NSArray someFiles = (NSArray) anObject.valueForKey("files");
            NSArray someDirectories = (NSArray) anObject.valueForKey("directories");

            System.out.println("anObject name: " + anObject.valueForKey("name"));
            System.out.println("someFiles.count: " + someFiles.count());
View Full Code Here

Examples of com.webobjects.foundation.NSArray.lastObject()

          if (throwIfMissing) {
            throw new EOObjectNotAvailableException("There was no '" + entity.name() + "' found with the id '" + primaryKeyValue + "'.");
          }
          return null;
        }
        return (EOEnterpriseObject)eos.lastObject();
    }
   
    /**
     * Returns an {@link com.webobjects.foundation.NSArray NSArray} containing the objects from the resulting rows starting
     * at start and stopping at end using a custom SQL, derived from the SQL
View Full Code Here

Examples of com.webobjects.foundation.NSArray.lastObject()

    public static EOEnterpriseObject sharedObjectMatchingKeyAndValue(String entityName, String key, Object value) {
        NSArray filtered = sharedObjectsMatchingKeyAndValue(entityName, key, value);
        if (filtered.count() > 1)
            log.warn("Found multiple shared objects for entityName: " + entityName + " matching key: "
                     + key + " value: " + value + " matched against: " + filtered);
        return filtered.count() > 0 ? (EOEnterpriseObject)filtered.lastObject() : null;
    }

    /**
     * Finds objects in the shared editing context matching a key
     * and value. This has the benefit of not requiring a database
View Full Code Here

Examples of com.webobjects.foundation.NSArray.lastObject()

     * @param eo object to get the primary key for.
     * @return single object or NSArray
     */
    public static Object primaryKeyObjectForObject(EOEnterpriseObject eo) {
        NSArray arr=primaryKeyArrayForObject(eo);
        if(arr != null && arr.count() == 1) return arr.lastObject();
        return arr;
    }

    /**
     * Gives the primary key array for a given enterprise
View Full Code Here

Examples of com.webobjects.foundation.NSArray.lastObject()

        if (!adaptorChannel.isOpen()) {
          adaptorChannel.openChannel();
        }
        NSArray arr = adaptorChannel.primaryKeysForNewRowsWithEntity(1, entity);
        if (arr != null) {
          primaryKey = (NSDictionary) arr.lastObject();
        } else {
          log.warn("Could not get primary key for entity: " + entityName + " exception");
        }
      } catch (Exception e) {
        log.error("Caught exception when generating primary key for entity: " + entityName + " exception: " + e, e);
View Full Code Here

Examples of com.webobjects.foundation.NSArray.lastObject()

             for (Enumeration enumerator = fetchSpecification.sortOrderings().objectEnumerator(); enumerator.hasMoreElements();) {
                 EOSortOrdering item = (EOSortOrdering) enumerator.nextElement();
                 String key = item.key();
                 NSArray path = NSArray.componentsSeparatedByString(key, ".");
                 EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, fetchSpecification.entityName());
                 String attributeName = (String) path.lastObject();
               String prefix = "";
                 if(path.count() > 1) {
                     for (int i = 0; i < path.count() - 1; i++) {
                         String part = (String) path.objectAtIndex(i);
                         EORelationship rel = entity.anyRelationshipNamed(part);
View Full Code Here

Examples of com.webobjects.foundation.NSArray.lastObject()

        }

        public People userWithUsernamePassword(EOEditingContext ec, String user, String password) {
            NSArray users = loginWithUsernamePassword(ec, user, password);
            if (users.count() == 1)
                return (People) users.lastObject();
            return null;
        }

    private NSArray<People> loginWithUsernamePassword(EOEditingContext ec, String user, String password) {
            EOQualifier q = ERXQ.and(ERXQ.equals(Key.LOGIN, user), ERXQ.equals(Key.PASSWORD, password));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.