Package com.webobjects.eoaccess

Examples of com.webobjects.eoaccess.EORelationship


  NSArray myattributes = attributes().immutableClone();
  for ( Enumeration e = myattributes.objectEnumerator(); e.hasMoreElements();) {
      GSVAttribute attribute = (GSVAttribute)e.nextElement();
      //NSLog.debug.appendln("checking attribute"+eoentity.name()+"."+attribute.name());
      EOAttribute a = eoentity.attributeNamed(attribute.name());
      EORelationship p = eoentity.relationshipNamed(attribute.name());
     
      if (a == null) {
    NSLog.out.appendln("attribute "+attribute.name() + " does not exist in entity " + name() + " (anymore?), deleted from Valididy model");
    removeAttribute(attribute);
      } else if (p != null) {
View Full Code Here


        String restrictedChoiceKey=(String)d2wContext().valueForKey("restrictedChoiceKey");
        if( restrictedChoiceKey!=null && restrictedChoiceKey.length()>0 )
            return valueForKeyPath(restrictedChoiceKey);
        String fetchSpecName=(String)d2wContext().valueForKey("restrictingFetchSpecification");
        if(fetchSpecName != null) {
            EORelationship relationship = ERXUtilities.relationshipWithObjectAndKeyPath(object(), (String)d2wContext().valueForKey("propertyKey"));
            if(relationship != null)
                return EOUtilities.objectsWithFetchSpecificationAndBindings(object().editingContext(), relationship.destinationEntity().name(),fetchSpecName,null);
        }
        return null;
    }
View Full Code Here

        super(context);
    }

    public Format valueFormatter() {
        Format f = null;
        EORelationship rel = (EORelationship) valueForKeyPath("d2wContext.smartRelationship");
        EOEntity destEnt = rel.destinationEntity();
        EOAttribute searchAttr = destEnt.attributeNamed(keyWhenRelationship());
        if(searchAttr != null) {
            String className = searchAttr.className();
            if(className.equals("java.lang.Number"))
                f = new NSNumberFormatter("0");
View Full Code Here

            return valueForKeyPath(restrictedChoiceKey);
        String fetchSpecName=(String)d2wContext().valueForKey("restrictingFetchSpecification");
        if(fetchSpecName != null) {
            EOEditingContext ec = ERXEC.newEditingContext();
            EOEntity entity = d2wContext().entity();
            EORelationship relationship = entity.relationshipNamed((String)d2wContext().valueForKey("propertyKey"));
            return EOUtilities.objectsWithFetchSpecificationAndBindings(ec, relationship.destinationEntity().name(),fetchSpecName,null);
        }
        return null;
    }
View Full Code Here

        }
        String fetchSpecName = (String) d2wContext().valueForKey("restrictingFetchSpecification");
        if (fetchSpecName != null) {
            EOEditingContext ec = ERXEC.newEditingContext();
            EOEntity entity = d2wContext().entity();
            EORelationship relationship = entity.relationshipNamed((String) d2wContext().valueForKey("propertyKey"));
            ec.lock();
            try {
                return EOUtilities.objectsWithFetchSpecificationAndBindings(ec,
                        relationship.destinationEntity().name(), fetchSpecName, null);
            } finally {
                ec.unlock();
            }
        }
        return null;
View Full Code Here

        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

          else {
            Utility.modelCopyAttribute(source, copy, attribute);
          }
        }
        else {
          EORelationship relationship = (EORelationship) property;
          Utility.modelCopyRelationship(copiedObjects, source, copy, relationship);
        }
      }
      return copy;
    }
View Full Code Here

        @SuppressWarnings("unchecked")
        NSDictionary<String, Object> userInfo = attribute.userInfo();
        copyType = Utility.copyType(attribute, userInfo);
      }
      else {
        EORelationship relationship = (EORelationship) property;
        NSDictionary<String, Object> userInfo = relationship.userInfo();
        copyType = Utility.copyType(relationship, userInfo);
      }
      return copyType;
    }
View Full Code Here

       
        NSArray<String> k;
        EOEntity rightEntity;
        EOEntity leftEntity;
        String relationshipKey = null;
        EORelationship r;
       
        if (leftAlias.equals("t0")) {
            leftEntity = entity();
        } else {
            k = aliasesByRelationshipPath().allKeysForObject(leftAlias);
            relationshipKey = k.count()>0? (String)k.lastObject() : "";
            leftEntity = entityForKeyPath(relationshipKey);
        }
       
        if (rightAlias.equals("t0")) {
            rightEntity = entity();
        } else {
            k = aliasesByRelationshipPath().allKeysForObject(rightAlias);
            relationshipKey = k.count()>0? (String)k.lastObject() : "";
            rightEntity = entityForKeyPath(relationshipKey);
        }
        if (relationshipKey == null) {
          throw new IllegalStateException("Could not determine relationship for join.");
        }
        int dotIndex = relationshipKey.indexOf( "." );
        relationshipKey = dotIndex == -1
            ? relationshipKey
            : relationshipKey.substring( relationshipKey.lastIndexOf( "." ) + 1 );
        r = rightEntity.anyRelationshipNamed( relationshipKey );
        // fix from Michael Müller for the case Foo.fooBars.bar has a Bar.foo relationship (instead of Bar.foos)
        if( r == null || r.destinationEntity() != leftEntity ) {
            r = leftEntity.anyRelationshipNamed( relationshipKey );
        }
        //timc 2006-02-26 IMPORTANT or quotes are ignored and mixed case field names won't work
        String rightTable;
        String leftTable;
        if(enableIdentifierQuoting()) {
            rightTable = rightEntity.valueForSQLExpression(this);
            leftTable = leftEntity.valueForSQLExpression(this);
        } else {
            rightTable = rightEntity.externalName();
            leftTable = leftEntity.externalName();
        }
        JoinClause jc = new JoinClause();
       
        jc.setTable1(leftTable, leftAlias);
       
        switch (semantic) {
            case EORelationship.LeftOuterJoin:
                jc.op = " LEFT OUTER JOIN ";
                break;
            case EORelationship.RightOuterJoin:
                jc.op = " RIGHT OUTER JOIN ";
                break;
            case EORelationship.FullOuterJoin:
                jc.op = " FULL OUTER JOIN ";
                break;
            case EORelationship.InnerJoin:
                jc.op = " INNER JOIN ";
                break;
        }
       
        jc.table2 = rightTable + " " + rightAlias;
        NSArray<EOJoin> joins = r.joins();
        int joinsCount = joins.count();
        NSMutableArray<String> joinStrings = new NSMutableArray<String>(joinsCount);
        for( int i = 0; i < joinsCount; i++ ) {
            EOJoin currentJoin = joins.objectAtIndex(i);
            String left;
View Full Code Here

        NSArray<String> keys = NSArray.componentsSeparatedByString(keyPath, ".");
        EOEntity ent = entity();
       
        for (int i = 0; i < keys.count(); i++) {
            String k = keys.objectAtIndex(i);
            EORelationship rel = ent.anyRelationshipNamed(k);
            if (rel == null) {
                // it may be an attribute
                if (ent.anyAttributeNamed(k) != null) {
                    break;
                }
                throw new IllegalArgumentException("relationship " + keyPath + " generated null");
            }
            ent = rel.destinationEntity();
        }
        return ent;
    }
View Full Code Here

TOP

Related Classes of com.webobjects.eoaccess.EORelationship

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.