Examples of relationshipNamed()


Examples of com.webobjects.eoaccess.EOEntity.relationshipNamed()

        String relationshipKey = (String) a.objectAtIndex(1);
        if (masterObject != null
                && !ERXStringUtilities.stringIsNullOrEmpty(relationshipKey)) {
            EOEntity masterEntity = EOUtilities.entityForObject(
                    masterObject.editingContext(), masterObject);
            EORelationship rel = masterEntity.relationshipNamed(relationshipKey);
            // set currentRelationship key to allow unique ID creation
            // (wonder-140)
            d2wContext().takeValueForKey(rel, "currentRelationship");
        }
        setMasterObjectAndRelationshipKey(masterObject, relationshipKey);
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.relationshipNamed()

      // To-Many relationships
      for (String relationshipName : destination.toManyRelationshipKeys()) {
        @SuppressWarnings("unchecked")
        NSArray<ERXEnterpriseObject> relatedObjects = (NSArray<ERXEnterpriseObject>) destination.valueForKey(relationshipName);
        if (relatedObjects.count() > 0) {
          entity.relationshipNamed(relationshipName);
          ERXCopyable.copyLogger.debug("Removing objects in to-many relationship " + relationshipName);
          for (ERXEnterpriseObject relatedObject : relatedObjects) {
            destination.removeObjectFromBothSidesOfRelationshipWithKey(relatedObject, relationshipName);
            if (relatedObject.isNewObject()) {
              editingContext.deleteObject(relatedObject);
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.relationshipNamed()

      if (eos.count() > 0) {
        EOEnterpriseObject eo = (EOEnterpriseObject)eos.lastObject();
        String entityName = eo.entityName();
        EOEditingContext ec = eo.editingContext();
        EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, entityName);
        EORelationship relationship = entity.relationshipNamed(relKey);
        if(relationship.sourceAttributes().count() == 1) {
          EOAttribute attribute = relationship.sourceAttributes().lastObject();
          EODatabaseContext context = EOUtilities.databaseContextForModelNamed(ec, entity.model().name());
          String name = attribute.name();
          for (Enumeration e = eos.objectEnumerator(); e.hasMoreElements();) {
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.relationshipNamed()

      * @param editingContext the editingContext to fetch in
      * @param skipFaultedRelationships if true, skip any object whose relationship has already been faulted
      */
     public static void batchFetchRelationship(EODatabaseContext databaseContext, String entityName, String relationshipName, NSArray objects, EOEditingContext editingContext, boolean skipFaultedRelationships) {
       EOEntity entity = ERXEOAccessUtilities.entityNamed(editingContext, entityName);
       EORelationship relationship = entity.relationshipNamed(relationshipName);
       ERXEOAccessUtilities.batchFetchRelationship(databaseContext, relationship, objects, editingContext, skipFaultedRelationships);
     }
    
   /**
    * Batch fetch a relationship, optionally skipping any relationship that has
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.relationshipNamed()

                } else {
                    for (Enumeration e1 = config.notificationKeys.objectEnumerator(); e1.hasMoreElements();) {
                        String key = (String) e1.nextElement();
                        EOEnterpriseObject target = (EOEnterpriseObject) eo.valueForKey(key);
                        EOEntity entity = ERXEOAccessUtilities.entityForEo(eo);
                        String inverse = entity.relationshipNamed(key).anyInverseRelationship().name();
                        if (typeKey.equals(EOEditingContext.UpdatedKey)) {
                            handleUpdate(ec, target, inverse, eo);
                        } else if (typeKey.equals(EOEditingContext.InsertedKey)) {
                            handleAdd(ec, target, inverse, eo);
                        } else if (typeKey.equals(EOEditingContext.DeletedKey)) {
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.relationshipNamed()

            EOEnterpriseObject eo = (EOEnterpriseObject) sourceObjects.objectAtIndex(0);
            EOEditingContext ec = eo.editingContext();
            EOEntity entity = EOUtilities.entityForObject(ec, eo);

            EORelationship relationship = entity.relationshipNamed(path);

            if (relationship == null) return;

            batchFetchRelationshipOnSourceObjects(relationship, sourceObjects, skipFaultedSourceObjects);
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.relationshipNamed()

            EORelationship targetRelationship=null;
            for (int i=0; i<toManyKeys.count()-1;i++) {
                targetRelationship= targetEntity.anyRelationshipNamed(toManyKeys.objectAtIndex(i));
                targetEntity=targetRelationship.destinationEntity();
            }
            targetRelationship=targetEntity.relationshipNamed(toManyKeys.lastObject());
            targetEntity=targetRelationship.destinationEntity();

            if (targetRelationship.joins()==null || targetRelationship.joins().isEmpty()) {
                // we have a flattened many to many
                String definitionKeyPath=targetRelationship.definition();                       
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.relationshipNamed()

            if (targetRelationship.joins()==null || targetRelationship.joins().isEmpty()) {
                // we have a flattened many to many
                String definitionKeyPath=targetRelationship.definition();                       
                NSArray<String> definitionKeys=NSArray.componentsSeparatedByString(definitionKeyPath,".");
                EOEntity lastStopEntity=targetRelationship.entity();
                EORelationship firstHopRelationship= lastStopEntity.relationshipNamed(definitionKeys.objectAtIndex(0));
                EOEntity endOfFirstHopEntity= firstHopRelationship.destinationEntity();
                EOJoin join= firstHopRelationship.joins().objectAtIndex(0); // assumes 1 join
                EOAttribute sourceAttribute=join.sourceAttribute();
                EOAttribute targetAttribute=join.destinationAttribute();
                EORelationship secondHopRelationship=endOfFirstHopEntity.relationshipNamed(definitionKeys.objectAtIndex(1));
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.relationshipNamed()

                EORelationship firstHopRelationship= lastStopEntity.relationshipNamed(definitionKeys.objectAtIndex(0));
                EOEntity endOfFirstHopEntity= firstHopRelationship.destinationEntity();
                EOJoin join= firstHopRelationship.joins().objectAtIndex(0); // assumes 1 join
                EOAttribute sourceAttribute=join.sourceAttribute();
                EOAttribute targetAttribute=join.destinationAttribute();
                EORelationship secondHopRelationship=endOfFirstHopEntity.relationshipNamed(definitionKeys.objectAtIndex(1));
                join= secondHopRelationship.joins().objectAtIndex(0); // assumes 1 join
                EOAttribute secondHopSourceAttribute=join.sourceAttribute();

                NSMutableArray<String> lastStopPKeyPath = toManyKeys.mutableClone();
                lastStopPKeyPath.removeLastObject();
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.relationshipNamed()

            String entityName = (String) e.nextElement();
            NSArray objects = (NSArray) objectsByEntity.objectForKey(entityName);
            EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, entityName);
            for (Enumeration keyPaths = prefetchingKeypaths.objectEnumerator(); keyPaths.hasMoreElements();) {
              String keypath = (String) keyPaths.nextElement();
              EORelationship relationship = entity.relationshipNamed(keypath);
              EODatabaseContext dbc = ERXEOAccessUtilities.databaseContextForEntityNamed((EOObjectStoreCoordinator) ec.rootObjectStore(), entityName);
              dbc.lock();
              try {
                dbc.batchFetchRelationship(relationship, objects, ec);
              } finally {
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.