Package com.webobjects.eoaccess

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


                         EORelationship rel = entity.anyRelationshipNamed(part);
                         entity = rel.destinationEntity();
                         prefix += part + ".";
                     }
                 }
                     if(entity.attributeNamed(attributeName) == null) {
                       EOClassDescription cd = entity.classDescriptionForInstances();
                         if(cd instanceof ERXEntityClassDescription) {
                           String localizedKey = ((ERXEntityClassDescription)cd).localizedKey(attributeName);
                           if(localizedKey != null) {
                                 item = new EOSortOrdering(prefix + localizedKey, item.selector());
View Full Code Here


    EOEntity sourceEntity = EOModelGroup.defaultGroup().entityNamed(sourceEntityName);
    if(sourceEntity.isAbstractEntity())
      log.warn("If you programatically add relationships to an abstract entity, make sure you also add it to child entities");
    EOEntity destinationEntity = EOModelGroup.defaultGroup().entityNamed(destinationEntityName);
    EOAttribute sourceAttribute = sourceEntity.attributeNamed(sourceAttributeName);
    EOAttribute destinationAttribute = destinationEntity.attributeNamed(destinationAttributeName);
    EOJoin join = new EOJoin(sourceAttribute, destinationAttribute);
    EORelationship relationship = new EORelationship();

    relationship.setName(relationshipName);
    sourceEntity.addRelationship(relationship);
View Full Code Here

     */
    public void addPreferenceRelationshipToActorEntity(String entityName, String attributeNameToJoin) {
        EOEntity actor = EOModelGroup.defaultGroup().entityNamed(entityName);
        EOEntity preference = EOModelGroup.defaultGroup().entityNamed("ERCPreference");

        EOJoin preferencesJoin = new EOJoin(actor.attributeNamed(attributeNameToJoin), preference.attributeNamed("userID"));
        EORelationship preferencesRelationship = new EORelationship();

        preferencesRelationship.setName("preferences");
        actor.addRelationship(preferencesRelationship);
        preferencesRelationship.addJoin(preferencesJoin);
View Full Code Here

        preferencesRelationship.addJoin(preferencesJoin);
        preferencesRelationship.setToMany(true);
        preferencesRelationship.setJoinSemantic(EORelationship.InnerJoin);
        preferencesRelationship.setDeleteRule(EOEntityClassDescription.DeleteRuleCascade);
       
        EOJoin userJoin = new EOJoin(preference.attributeNamed("userID"), actor.attributeNamed(attributeNameToJoin) );
        EORelationship userRelationship = new EORelationship();
        userRelationship.setName("user");
        preference.addRelationship(userRelationship);
        userRelationship.addJoin(userJoin);
        userRelationship.setToMany(false);
View Full Code Here

    // as this creates a
    //
    EODatabaseContext context = EODatabaseContext.registeredDatabaseContextForModel(entity.model(), EOObjectStoreCoordinator.defaultCoordinator());
    EOSQLExpressionFactory factory = context.database().adaptor().expressionFactory();

    NSArray subAttributes = destinationAttName != null ? new NSArray(entity.attributeNamed(destinationAttName)) : entity.primaryKeyAttributes();

    EOSQLExpression subExpression = factory.expressionForEntity(entity);

    // Arroz: Having this table identifier replacement causes serious
    // problems if you have more than a table being processed in the subquery. Disabling
View Full Code Here

        String externalName = entity.externalName();
        if (externalName != null) {
          // If you have a parent entity and that parent entity shares your table name, then you're single table inheritance
          boolean singleTableInheritance = (parentEntity != null && externalName.equals(parentEntity.externalName()));
          if (singleTableInheritance) {
            EOAttribute parentAttribute = parentEntity.attributeNamed(attribute.name());
            if (parentAttribute == null) {
              // If this attribute is new in the subclass, you have to allow nulls
              shouldAllowNull = true;
            }
          }
View Full Code Here

            boolean validIndex = false;
            localBuf.append("create index " + indexName + " on " + entity.externalName() + "(");
            for (Enumeration<String> attributes = NSArray.componentsSeparatedByString(attributeNames, ",").objectEnumerator(); attributes.hasMoreElements();) {
              String attributeName = attributes.nextElement();
              attributeName = attributeName.trim();
              EOAttribute attribute = entity.attributeNamed(attributeName);
              if (attribute == null) {
                attribute = ERXEOAccessUtilities.attributeWithColumnNameFromEntity(attributeName, entity);
              }
              if (attribute != null && externalTypesToIgnore.indexOfObject(attribute.externalType()) != NSArray.NotFound) {
                continue;
View Full Code Here

            boolean validIndex = false;
            localBuf.append("create index " + indexName + " on " + entity.externalName() + "(");
            for (Enumeration e = NSArray.componentsSeparatedByString(indexValues, ",").objectEnumerator(); e.hasMoreElements();) {
              String attributeName = (String) e.nextElement();
              attributeName = attributeName.trim();
              EOAttribute attribute = entity.attributeNamed(attributeName);

              if (attribute == null) {
                attribute = ERXEOAccessUtilities.attributeWithColumnNameFromEntity(attributeName, entity);
              }
              if (attribute != null && externalTypesToIgnore.indexOfObject(attribute.externalType()) != NSArray.NotFound) {
View Full Code Here

     */
    public EOAttribute attribute() {
        EOAttribute attribute = null;
        if (eoObject() != null) {
            EOEntity entity = EOUtilities.entityForObject(eoObject().editingContext(), eoObject());
            attribute = entity != null ? entity.attributeNamed(propertyKey()) : null;
        }
        return attribute;
    }
   
    /**
 
View Full Code Here

        }
        if (count == 0) {
          EOFetchSpecification fetchSpec = new EOFetchSpecification(migrationTableName(adaptor), new EOKeyValueQualifier("modelName", EOQualifier.QualifierOperatorEqual, model.name()), null);
          NSDictionary nextRow;
          try {
            channel.selectAttributes(new NSArray<EOAttribute>(dbUpdaterEntity.attributeNamed("updateLock")), fetchSpec, false, dbUpdaterEntity);
            nextRow = channel.fetchRow();
          }
          finally {
            channel.cancelFetch();
          }
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.