Examples of addObjectToBothSidesOfRelationshipWithKey()


Examples of com.webobjects.eocontrol.EOEnterpriseObject.addObjectToBothSidesOfRelationshipWithKey()

            EOEntity entity = ERXEOAccessUtilities.destinationEntityForKeyPath(ERXEOAccessUtilities.entityForEo(eo), relationshipName);
            for(Enumeration e = selectedObjects.objectEnumerator(); e.hasMoreElements(); ) {
                EOEnterpriseObject selectedObject = (EOEnterpriseObject)e.nextElement();
                if(!pickedObjects.containsObject(selectedObject)) {
                    EOEnterpriseObject relatedObject = ERXEOControlUtilities.createAndInsertObject(ec, entity.name());
                    relatedObject.addObjectToBothSidesOfRelationshipWithKey(selectedObject, pickRelationshipName);
                    eo.addObjectToBothSidesOfRelationshipWithKey(relatedObject, relationshipName);
                }
            }
        } finally {
            ec.unlock();
View Full Code Here

Examples of com.webobjects.eocontrol.EOEnterpriseObject.addObjectToBothSidesOfRelationshipWithKey()

            EOEnterpriseObject newEO = ERXEOControlUtilities.createAndInsertObject(localContext, entityNameForNewInstances);
            // If the object already exists, then hookup the relationship, if not do it after the object is saved.
            if (!((ERXEnterpriseObject)object).isNewObject()) {
                EOEnterpriseObject localEO = EOUtilities.localInstanceOfObject(localContext, object);
                if (localEO != null)
                    localEO.addObjectToBothSidesOfRelationshipWithKey(newEO, key);
            }
            if (preRelationshipKeys != null) {
                for(Enumeration e = preRelationshipKeys.allKeys().objectEnumerator(); e.hasMoreElements();) {
                    String relationshipKey = (String)e.nextElement();
                    String objectKeyPath = (String)preRelationshipKeys.objectForKey(relationshipKey);
View Full Code Here

Examples of com.webobjects.eocontrol.EOEnterpriseObject.addObjectToBothSidesOfRelationshipWithKey()

            if (preRelationshipKeys != null) {
                for(Enumeration e = preRelationshipKeys.allKeys().objectEnumerator(); e.hasMoreElements();) {
                    String relationshipKey = (String)e.nextElement();
                    String objectKeyPath = (String)preRelationshipKeys.objectForKey(relationshipKey);
                    EOEnterpriseObject localObject = EOUtilities.localInstanceOfObject(localContext, (EOEnterpriseObject)object.valueForKeyPath(objectKeyPath));
                    localObject.addObjectToBothSidesOfRelationshipWithKey(newEO, relationshipKey);
                }
            }
            localContext.hasChanges(); // Make sure the EC survives.
            return newEO;
        }
View Full Code Here

Examples of com.webobjects.eocontrol.EOEnterpriseObject.addObjectToBothSidesOfRelationshipWithKey()

    EOEnterpriseObject relatedObject = EOUtilities.createAndInsertInstance(newEc, relatedObjectClassDescription.entityName());
    EOEnterpriseObject localObj = EOUtilities.localInstanceOfObject(relatedObject.editingContext(), masterObject());
    if (localObj instanceof ERXGenericRecord) {
      ((ERXGenericRecord)localObj).setValidatedWhenNested(false);
    }
    localObj.addObjectToBothSidesOfRelationshipWithKey(relatedObject, relationshipKey());
    setSelectedObject(relatedObject);
    setInlineTaskSafely("create");
    return null;
  }
 
View Full Code Here

Examples of com.webobjects.eocontrol.EOEnterpriseObject.addObjectToBothSidesOfRelationshipWithKey()

                                                                      String destinationEntityName,
                                                                      NSDictionary objectInfo) {
        EOEnterpriseObject newEO = createAndInsertObject(editingContext, destinationEntityName, objectInfo);
        EOEnterpriseObject eoBis = editingContext != source.editingContext() ?
            EOUtilities.localInstanceOfObject(editingContext,source) : source;
        eoBis.addObjectToBothSidesOfRelationshipWithKey(newEO, relationshipName);
        return newEO;
    }

    /**
     * Adds an object to another objects relationship. Has
View Full Code Here

Examples of com.webobjects.eocontrol.EOEnterpriseObject.addObjectToBothSidesOfRelationshipWithKey()

        Object currentValue = NSKeyValueCoding.Utility.valueForKey(realSourceObject, realRelationshipKey);
        if (ObjectUtils.notEqual(value, currentValue)) {
            if(realSourceObject instanceof EOEnterpriseObject) {
                EOEnterpriseObject eo = (EOEnterpriseObject)realSourceObject;
                if(value instanceof EOEnterpriseObject) {
                    eo.addObjectToBothSidesOfRelationshipWithKey((EOEnterpriseObject)value, realRelationshipKey);
                } else {
                    Object oldValue = eo.valueForKey(realRelationshipKey);
                    if(oldValue instanceof EOEnterpriseObject) {
                        eo.removeObjectFromBothSidesOfRelationshipWithKey((EOEnterpriseObject)oldValue, realRelationshipKey);
                    } else {
View Full Code Here

Examples of com.webobjects.eocontrol.EOEnterpriseObject.addObjectToBothSidesOfRelationshipWithKey()

            if (isDictionary) {
                _dictionary.setObjectForKey(anEO, masterKey);
            }
            else if (_eo.valueForKey(masterKey) != anEO) {
                _eo.addObjectToBothSidesOfRelationshipWithKey((EOEnterpriseObject) anEO, masterKey);
            }

        }
        else { // remove
View Full Code Here

Examples of com.webobjects.eocontrol.EOEnterpriseObject.addObjectToBothSidesOfRelationshipWithKey()

    EOEnterpriseObject relatedObject = EOUtilities.createAndInsertInstance(newEc, destinationEntityName());
    EOEnterpriseObject localObj = ERXEOControlUtilities.localInstanceOfObject(relatedObject.editingContext(), object());
    if (localObj instanceof ERXGenericRecord) {
      ((ERXGenericRecord)localObj).setValidatedWhenNested(false);
    }
    localObj.addObjectToBothSidesOfRelationshipWithKey(relatedObject, propertyKey());
   
    epi.setNextPage(context().page());
    epi.setObject(relatedObject);
   
    // Null out the current searchValue so when we come back, it regenerates
View Full Code Here

Examples of com.webobjects.eocontrol.EOEnterpriseObject.addObjectToBothSidesOfRelationshipWithKey()

      int iters = 10;

      for (int idx = 0; idx < iters; idx++) {
        ec.lock();
        EOEnterpriseObject eo = EOUtilities.createAndInsertInstance(ec, "Employee");
        eo.addObjectToBothSidesOfRelationshipWithKey(company, "company");
        eo.takeValueForKey(Boolean.TRUE, "manager");
        eo.takeValueForKey("Bob" + idx, "name");
        eo.takeValueForKey(lastName, "state");
        ec.unlock();
      }
View Full Code Here

Examples of er.erxtest.model.Employee.addObjectToBothSidesOfRelationshipWithKey()

        Company nestC = c.localInstanceIn(nested);
        Employee e = (Employee) EOUtilities.createAndInsertInstance(nested, Employee.ENTITY_NAME);
        e.setFirstName("First");
        e.setLastName("Last");
        e.setManager(Boolean.FALSE);
        e.addObjectToBothSidesOfRelationshipWithKey(nestC, Employee.COMPANY_KEY);
        nested.saveChanges();
        ec.saveChanges();
        System.gc();
        c.delete();
        ec.saveChanges();
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.