Examples of globalIDForObject()


Examples of com.webobjects.eocontrol.EOEditingContext.globalIDForObject()

            final EOEditingContext firstContext = firstEO.editingContext();
            final EOEditingContext secondContext = secondEO.editingContext();
           
            if (firstContext != null && secondContext != null) {
                final EOGlobalID firstGID = firstContext.globalIDForObject(firstEO);
                final EOGlobalID secondGID = secondContext.globalIDForObject(secondEO);
               
                result = firstGID.equals(secondGID);
            }
        }
       
View Full Code Here

Examples of com.webobjects.eocontrol.EOEditingContext.globalIDForObject()

     * @param eo enterprise object to refault
     */
    public static void refaultObject(EOEnterpriseObject eo) {
        if (eo != null && !eo.isFault()) {
            EOEditingContext ec = eo.editingContext();
            NSArray<EOGlobalID> gids = new NSArray<EOGlobalID>(ec.globalIDForObject(eo));
            ec.invalidateObjectsWithGlobalIDs(gids);
        }
    }

  /**
 
View Full Code Here

Examples of com.webobjects.eocontrol.EOEditingContext.globalIDForObject()

    public static void clearSnapshotForRelationshipNamedInDatabase(EOEnterpriseObject eo, String relationshipName, EODatabase database) {
        EOEditingContext ec = eo.editingContext();
        EOObjectStoreCoordinator osc = (EOObjectStoreCoordinator) ec.rootObjectStore();
        osc.lock();
        try {
          EOGlobalID gid = ec.globalIDForObject(eo);
          database.recordSnapshotForSourceGlobalID(null, gid, relationshipName);
          Object o = eo.storedValueForKey(relationshipName);
          boolean needRefresh = false;
          if(o instanceof EOFaulting) {
            EOFaulting toManyArray = (EOFaulting)o;
View Full Code Here

Examples of com.webobjects.eocontrol.EOEditingContext.globalIDForObject()

      throw new IllegalArgumentException("The attribute named '" + relationshipName
          + "' in the entity named '" + object.entityName() +"' is not a toMany relationship!");
    }

    // --- (3) Case of a fault and a snapshot exists to provide a count
    final EOGlobalID gid = ec.globalIDForObject(object);
    String modelName = entity.model().name();
    final EODatabaseContext dbc = EOUtilities.databaseContextForModelNamed(ec, modelName);

    NSArray toManySnapshot = ERXEOAccessUtilities.executeDatabaseContextOperation(dbc, 2,
        new DatabaseContextOperation<NSArray>() {
View Full Code Here

Examples of com.webobjects.eocontrol.EOEditingContext.globalIDForObject()

        EOEditingContext ec = obj.editingContext();
        if (ec == null) {
            //you don't have an EC! Bad EO. We can do nothing.
            return null;
        }
        EOGlobalID gid = ec.globalIDForObject(obj);
        if (gid.isTemporary()) {
            //no pk yet assigned
            return null;
        }
        EOKeyGlobalID kGid = (EOKeyGlobalID) gid;
View Full Code Here

Examples of com.webobjects.eocontrol.EOEditingContext.globalIDForObject()

        int c = eos != null ? eos.count() : 0;
        NSMutableArray ids = new NSMutableArray(c);
        for (int i = 0; i < c; i++) {
            EOEnterpriseObject eo = (EOEnterpriseObject)eos.objectAtIndex(i);
            EOEditingContext ec = eo.editingContext();
            EOGlobalID gid = ec.globalIDForObject(eo);
            ids.addObject(gid);
        }
        return ids;
    }
   
View Full Code Here

Examples of com.webobjects.eocontrol.EOEditingContext.globalIDForObject()

          EOAttribute attribute = relationship.sourceAttributes().lastObject();
          EODatabaseContext context = EOUtilities.databaseContextForModelNamed(ec, entity.model().name());
          String name = attribute.name();
          for (Enumeration e = eos.objectEnumerator(); e.hasMoreElements();) {
            EOEnterpriseObject target = (EOEnterpriseObject) e.nextElement();
            Object value = (context.snapshotForGlobalID(ec.globalIDForObject(target))).valueForKey(name);
            result.addObject(value);
          }
        } else {
          throw new IllegalArgumentException("Has more than one relationship attribute: " + relKey);
        }
View Full Code Here

Examples of com.webobjects.eocontrol.EOEditingContext.globalIDForObject()

        EOEditingContext editingContext = attachment.editingContext();

        editingContext.lock();

        try {
            EOGlobalID attachmentID = editingContext.globalIDForObject(attachment);
            ERAttachmentQueueEntry<T> entry = new ERAttachmentQueueEntry<T>(attachment._pendingUploadFile(), attachmentID);

            enqueue(entry);
        } finally {
            editingContext.unlock();
View Full Code Here

Examples of com.webobjects.eocontrol.EOEditingContext.globalIDForObject()

    public void testCreateEO() {
        EOEditingContext editingContext = ERXEC.newEditingContext(_osc);
        editingContext.lock();
        try {
            Company c = (Company) ERXRestFormat.json().parse("{\"type\":\"Company\",\"name\":\"Company\",\"revenue\":100}").createObjectWithFilter(null, ERXKeyFilter.filterWithAll(), new ERXRestContext(editingContext));
            assertTrue(editingContext.globalIDForObject(c).isTemporary());
            assertEquals("Company", c.name());
            assertEquals(100.0, c.revenue().doubleValue());
            assertEquals(0, c.employees().count());
        }
        finally {
View Full Code Here

Examples of com.webobjects.eocontrol.EOEditingContext.globalIDForObject()

    public void testCreateEOAndRelatedEO() {
        EOEditingContext editingContext = ERXEC.newEditingContext(_osc);
        editingContext.lock();
        try {
            Company c = (Company) ERXRestFormat.json().parse("{\"type\":\"Company\",\"name\":\"Company\",\"revenue\":100,\"employees\":[{\"type\":\"Person\",\"age\":10,\"name\":\"Mike\",\"salary\":null}]}").createObjectWithFilter(null, ERXKeyFilter.filterWithAllRecursive(), new ERXRestContext(editingContext));
            assertTrue(editingContext.globalIDForObject(c).isTemporary());
            assertEquals("Company", c.name());
            assertEquals(100.0, c.revenue().doubleValue());
            NSArray<Person> employees = c.employees();
            assertEquals(1, employees.count());
            Person p = employees.objectAtIndex(0);
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.