Package com.webobjects.eoaccess

Examples of com.webobjects.eoaccess.EOEntity


  public EOQualifier qualifierForRelationshipWithKey(String aKey) {
    willRead();

    if (aKey != null) {
      String anEntityName = entityName();
      EOEntity anEntity = EOModelGroup.defaultGroup().entityNamed(
          anEntityName);
      EORelationship aRelationship = anEntity.relationshipNamed(aKey);

      if (aRelationship != null) {
        EOEditingContext anEditingContext = editingContext();
        EOGlobalID aGlobalID = anEditingContext.globalIDForObject(this);
        String aModelName = anEntity.model().name();
        EODatabaseContext aDatabaseContext = EOUtilities
            .databaseContextForModelNamed(anEditingContext,
                aModelName);
        aDatabaseContext.lock();
        NSDictionary aRow = aDatabaseContext
View Full Code Here


      findModelProcessor("org.objectstyle.wolips.eomodeler.EOModelProcessor", false);
    }
    if (entityNames == null || entityNames.size() == 0) {
      Enumeration entitiesEnum = _model.entities().objectEnumerator();
      while (entitiesEnum.hasMoreElements()) {
        EOEntity entity = (EOEntity) entitiesEnum.nextElement();
        if (!isPrototype(entity)) {// &&
          // entityUsesSeparateTable(entity))
          // {
          _entities.addObject(entity);
        }
      }
    } else {
      Iterator entityNamesIter = entityNames.iterator();
      while (entityNamesIter.hasNext()) {
        String entityName = (String) entityNamesIter.next();
        EOEntity entity = _model.entityNamed(entityName);
        if (entity != null) {
          _entities.addObject(entity);
        }
      }
    }
View Full Code Here

    EOModel prototypesModel = null;
    Enumeration modelsEnum = modelGroup.models().objectEnumerator();
    while (modelsEnum.hasMoreElements()) {
      EOModel model = (EOModel) modelsEnum.nextElement();
      EOEntity eoAdaptorPrototypesEntity = _modelGroup.entityNamed("EO" + model.adaptorName() + "Prototypes");
      if (eoAdaptorPrototypesEntity != null) {
        prototypesModel = eoAdaptorPrototypesEntity.model();
        // System.out.println("EOFSQLGenerator.EOFSQLGenerator:
        // removing " + eoAdaptorPrototypesEntity.name() + " from "
        // + prototypesModel.name());
        prototypesModel.removeEntity(eoAdaptorPrototypesEntity);
        removedPrototypeEntities.takeValueForKey(eoAdaptorPrototypesEntity, eoAdaptorPrototypesEntity.name());
      }
    }

    EOEntity eoPrototypesEntity = _modelGroup.entityNamed("EOPrototypes");
    if (eoPrototypesEntity != null) {
      prototypesModel = eoPrototypesEntity.model();
      prototypesModel.removeEntity(eoPrototypesEntity);
      // System.out.println("EOFSQLGenerator.EOFSQLGenerator: removing
      // " + eoPrototypesEntity.name() + " from " +
      // prototypesModel.name());
      removedPrototypeEntities.takeValueForKey(eoPrototypesEntity, eoPrototypesEntity.name());
    }

    EOEntity prototypesEntity = _modelGroup.entityNamed(prototypeEntityName);
    if (prototypesEntity == null) {
      prototypesEntity = (EOEntity) removedPrototypeEntities.valueForKey(prototypeEntityName);
    } else {
      prototypesModel = prototypesEntity.model();
      prototypesModel.removeEntity(prototypesEntity);
    }
    if (prototypesEntity != null && prototypesModel != null) {
      // System.out.println("EOFSQLGenerator.EOFSQLGenerator: setting
      // " + prototypesEntity.name() + " to EOPrototypes in " +
      // prototypesModel.name());
      prototypesEntity.setName(replacementPrototypeName);
      prototypesModel.addEntity(prototypesEntity);
    }

    Enumeration resetModelsEnum = _modelGroup.models().objectEnumerator();
    while (resetModelsEnum.hasMoreElements()) {
View Full Code Here

  }

  protected void localizeEntities() {
    Enumeration entitiesEnum = new NSArray(_entities).objectEnumerator();
    while (entitiesEnum.hasMoreElements()) {
      EOEntity entity = (EOEntity) entitiesEnum.nextElement();
      createLocalizedAttributes(entity);
    }
  }
View Full Code Here

  }

  protected void fixAllowsNullOnSingleTableInheritance() {
    Enumeration entitiesEnum = new NSArray(_entities).objectEnumerator();
    while (entitiesEnum.hasMoreElements()) {
      EOEntity entity = (EOEntity) entitiesEnum.nextElement();
      if (isSingleTableInheritance(entity)) {
        Enumeration attributeEnum = entity.attributes().objectEnumerator();
        while (attributeEnum.hasMoreElements()) {
          EOAttribute attribute = (EOAttribute) attributeEnum.nextElement();
          if (!isInherited(attribute)) {
            attribute.setAllowsNull(true);
          }
View Full Code Here

  }

  protected void ensureSingleTableInheritanceParentEntitiesAreIncluded() {
    Enumeration entitiesEnum = new NSArray(_entities).objectEnumerator();
    while (entitiesEnum.hasMoreElements()) {
      EOEntity entity = (EOEntity) entitiesEnum.nextElement();
      ensureSingleTableInheritanceParentEntitiesAreIncluded(entity);
    }
  }
View Full Code Here

  }

  protected void ensureSingleTableInheritanceChildEntitiesAreIncluded() {
    Enumeration entitiesEnum = _model.entities().objectEnumerator();
    while (entitiesEnum.hasMoreElements()) {
      EOEntity entity = (EOEntity) entitiesEnum.nextElement();
      if (isSingleTableInheritance(entity)) {
        EOEntity parentEntity = entity.parentEntity();
        if (_entities.containsObject(parentEntity) && !_entities.containsObject(entity)) {
          _entities.addObject(entity);
        }
      }
    }
View Full Code Here

    }
  }

  protected void ensureSingleTableInheritanceParentEntitiesAreIncluded(EOEntity entity) {
    if (isSingleTableInheritance(entity)) {
      EOEntity parentEntity = entity.parentEntity();
      if (!_entities.containsObject(parentEntity)) {
        _entities.addObject(parentEntity);
        ensureSingleTableInheritanceParentEntitiesAreIncluded(entity);
      }
    }
View Full Code Here

    boolean isPrototype = (entityName.startsWith("EO") && entityName.endsWith("Prototypes"));
    return isPrototype;
  }

  protected boolean isSingleTableInheritance(EOEntity entity) {
    EOEntity parentEntity = entity.parentEntity();
    return parentEntity != null && entity.externalName() != null && entity.externalName().equalsIgnoreCase(parentEntity.externalName());
  }
View Full Code Here

    }
  }

  protected boolean isInherited(EOAttribute attribute) {
    boolean inherited = false;
    EOEntity parentEntity = attribute.entity().parentEntity();
    while (!inherited && parentEntity != null) {
      inherited = (parentEntity.attributeNamed(attribute.name()) != null);
      parentEntity = parentEntity.parentEntity();
    }
    return inherited;
  }
View Full Code Here

TOP

Related Classes of com.webobjects.eoaccess.EOEntity

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.