Examples of sourceAttributes()


Examples of com.webobjects.eoaccess.EORelationship.sourceAttributes()

    String toJoinKey = ERXStringUtilities.firstPropertyKeyInKeyPath(relationshipPath);
    String toDestKey = ERXStringUtilities.keyPathWithoutFirstProperty(relationshipPath);
    EORelationship toJoinRelationship = entity.anyRelationshipNamed(toJoinKey);
    EOEntity joinEntity = toJoinRelationship.destinationEntity();
    EREntityStore joinStore = context._entityStoreForEntity(joinEntity);
    String sourceAttribute = toJoinRelationship.sourceAttributes().get(0).name();
    String destinationAttribute = toJoinRelationship.destinationAttributes().get(0).name();

    ERXFetchSpecification fs = new ERXFetchSpecification(joinEntity.name(), ERXQ.equals(destinationAttribute,
        row.valueForKey(sourceAttribute)), null);
    NSArray<NSMutableDictionary<String, Object>> fetchedObjects = joinStore.fetch(joinEntity.attributesToFetch(),
View Full Code Here

Examples of com.webobjects.eoaccess.EORelationship.sourceAttributes()

    if (fetchedObjects.isEmpty()) {
      return NSArray.EmptyArray;
    }

    EORelationship destRelationship = joinEntity.anyRelationshipNamed(toDestKey);
    sourceAttribute = destRelationship.sourceAttributes().get(0).name();
    destinationAttribute = destRelationship.destinationAttributes().get(0).name();
    NSArray<Object> destValues = (NSArray<Object>) fetchedObjects.valueForKey(sourceAttribute);
    EOEntity destEntity = relationship.destinationEntity();

    fs = new ERXFetchSpecification(destEntity.name(), ERXQ.in(destinationAttribute, destValues), null);
View Full Code Here

Examples of com.webobjects.eoaccess.EORelationship.sourceAttributes()

            NSArray primaryKeys = eoentity.primaryKeyAttributes();
            for(Enumeration relationships = eoentity.relationships().objectEnumerator(); relationships.hasMoreElements(); ) {
                EORelationship relationship = (EORelationship)relationships.nextElement();
                if(!relationship.isToMany()) {
                    if(relationship.isMandatory()) {
                        for(Enumeration attributes = relationship.sourceAttributes().objectEnumerator(); attributes.hasMoreElements(); ) {
                            EOAttribute attribute = (EOAttribute)attributes.nextElement();
                            if(attribute.allowsNull()) {
                                handleMandatoryRelationshipError(eoentity, relationship, attribute);
                            }
                        }
View Full Code Here

Examples of com.webobjects.eoaccess.EORelationship.sourceAttributes()

                            if(attribute.allowsNull()) {
                                handleMandatoryRelationshipError(eoentity, relationship, attribute);
                            }
                        }
                    } else {
                        for(Enumeration attributes = relationship.sourceAttributes().objectEnumerator(); attributes.hasMoreElements(); ) {
                            EOAttribute attribute = (EOAttribute)attributes.nextElement();
                            if(!attribute.allowsNull() && !primaryKeys.containsObject(attribute)) {
                                handleOptionalRelationshipError(eoentity, relationship, attribute);
                            }
                        }
View Full Code Here

Examples of com.webobjects.eoaccess.EORelationship.sourceAttributes()

      // it's a plain attribute value comparison
      return new Comparison(rels, entity.attributeNamed(last), operator, value);
    } else {
      // it's a relationship value comparison, let's represent it as attribute comparison
      EORelationship lastRel = entity.relationshipNamed(last);
      EOAttribute srcAtt = asOne(lastRel.sourceAttributes());
      EOAttribute dstAtt = asOne(lastRel.destinationAttributes());
     
      rels.add(lastRel);
      if (value != null) {
        value = ((NSKeyValueCoding) value).valueForKey(dstAtt.name());
View Full Code Here

Examples of com.webobjects.eoaccess.EORelationship.sourceAttributes()

        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();) {
            EOEnterpriseObject target = (EOEnterpriseObject) e.nextElement();
View Full Code Here

Examples of com.webobjects.eoaccess.EORelationship.sourceAttributes()

        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();) {
            EOEnterpriseObject target = (EOEnterpriseObject) e.nextElement();
            Object value = (context.snapshotForGlobalID(ec.globalIDForObject(target))).valueForKey(name);
View Full Code Here

Examples of com.webobjects.eoaccess.EORelationship.sourceAttributes()

    this.qualifier = qualifier;
    this.entityName = entityName;
    if(relationshipName != null) {
      this.relationshipName = relationshipName;
      EORelationship rel = ERXEOAccessUtilities.entityNamed(null, entityName).relationshipNamed(relationshipName);
      attributeName = rel.sourceAttributes().lastObject().name();
      destinationAttName = rel.destinationAttributes().lastObject().name();
    }
  }

  /**
 
View Full Code Here

Examples of com.webobjects.eoaccess.EORelationship.sourceAttributes()

            } else { // The exists clause is applied to the base table.
                destTableAlias = EXISTS_ALIAS + expression.aliasesByRelationshipPath().count(); // Probably "t1"
            }

            String srcEntityForeignKey = null;
            NSArray<EOAttribute> sourceAttributes = relationship.sourceAttributes();
            if (sourceAttributes != null && sourceAttributes.count() > 0) {
                EOAttribute fk = sourceAttributes.lastObject();
                srcEntityForeignKey = expression.sqlStringForAttribute(fk);
            } else {
              // (AR) could not find relationship from source object into "exists" clause, use primary key then instead
View Full Code Here

Examples of com.webobjects.eoaccess.EORelationship.sourceAttributes()

              for (Enumeration attributeEnumerator = relationship.destinationEntity().primaryKeyAttributes().objectEnumerator(); attributeEnumerator.hasMoreElements(); ) {
                EOAttribute attribute = (EOAttribute)attributeEnumerator.nextElement();
                columnNameDictionary.setObjectForKey(attribute.columnName(), relationship.destinationEntity().externalName() + "." + attribute.columnName());
              }
              // Then deal with our end of things
              for (Enumeration attributeEnumerator = relationship.sourceAttributes().objectEnumerator(); attributeEnumerator.hasMoreElements(); ) {
                EOAttribute attribute = (EOAttribute)attributeEnumerator.nextElement();
                if( (! this.isSinglePrimaryKeyAttribute(attribute)) && (columnNameDictionary.objectForKey(tableName + "." + attribute.columnName()) != null) ) {
                  columnNameDictionary.setObjectForKey(attribute.columnName(), tableName + "." + attribute.columnName());
                  EOSQLExpression expression = this._expressionForString("create index " + tableName + " " + attribute.columnName());
                  if(expression != null) primaryKeyConstraintExpressions.addObject( expression );
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.