Package com.webobjects.eoaccess

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


            Enumeration relationshipsEnum = entity.relationships().objectEnumerator();
            while (relationshipsEnum.hasMoreElements()) {
              EORelationship relationship = (EORelationship) relationshipsEnum.nextElement();
              EOEntity destinationEntity = relationship.destinationEntity();
              if (destinationEntity != null && !destinationEntity.model().equals(model)) {
                EOModel destinationModel = destinationEntity.model();
                _buildDependenciesForModel(destinationModel, LATEST_VERSION, versions, migrations);
              }
            }
          }
          _buildDependenciesForModel(model, LATEST_VERSION, versions, migrations);
View Full Code Here


    // proof way that would be nice to get the model
    // Note you can't use:
    // EOAdaptor.adaptorWithModel(e.entity().model()).expressionFactory();
    // 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);
View Full Code Here

            String destEntityForeignKey = "." + expression.sqlStringForSchemaObjectName(parentChildJoin.destinationAttribute().columnName());
           
            EOQualifier qual = EOQualifierSQLGeneration.Support._schemaBasedQualifierWithRootEntity(subqualifier, destEntity);
            EOFetchSpecification fetchSpecification = new EOFetchSpecification(destEntity.name(), qual, null, false, true, null);

            EODatabaseContext context = EODatabaseContext.registeredDatabaseContextForModel(destEntity.model(), EOObjectStoreCoordinator.defaultCoordinator());
            EOSQLExpressionFactory factory = context.database().adaptor().expressionFactory();

            EOSQLExpression subExpression = factory.expressionForEntity(destEntity);
            subExpression.setUseAliases(true);
            subExpression.prepareSelectExpressionWithAttributes(destEntity.primaryKeyAttributes(), false, fetchSpecification);
View Full Code Here

        constraintName = _NSStringUtilities.concat(tableName, "_", relationship.name(), "_FK");
      }
      String sourceKeyList = sourceColumns.componentsJoinedByString(", ");
      String destinationKeyList = destinationColumns.componentsJoinedByString(", ");

      EOModel sourceModel = entity.model();
      EOModel destModel = relationship.destinationEntity().model();
      if (sourceModel != destModel && !sourceModel.connectionDictionary().equals(destModel.connectionDictionary())) {
        throw new IllegalArgumentException("prepareConstraintStatementForRelationship unable to create a constraint for " + relationship.name() + " because the source and destination entities reside in different databases");
      }
      else {
View Full Code Here

    NSMutableArray<EOEntity> foreignKeyEntities = entities.mutableClone();
    for (EOEntity entity : entities) {
      for (EORelationship relationship : entity.relationships()) {
        if (!relationship.isToMany()) {
          EOEntity destinationEntity = relationship.destinationEntity();
          if (destinationEntity.model() != entity.model()) {
            foreignKeyEntities.addObject(destinationEntity);
          }
        }
      }
    }
View Full Code Here

   *
   * @return the EOSQLExpression which the EOFetchSpecification would use
   */
  public EOSQLExpression sqlExpressionForFetchSpecification(EOEditingContext ec, EOFetchSpecification spec, long start, long end, NSArray<EOAttribute> attributes) {
    EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, spec.entityName());
    EOModel model = entity.model();
    EODatabaseContext dbc = EOUtilities.databaseContextForModelNamed(ec, model.name());
    EOAdaptor adaptor = dbc.adaptorContext().adaptor();
    EOSQLExpressionFactory sqlFactory = adaptor.expressionFactory();
    spec = (EOFetchSpecification) spec.clone();

View Full Code Here

   * @return the number of rows
   */
  public int rowCountForFetchSpecification(EOEditingContext ec, EOFetchSpecification spec) {
    int rowCount = -1;
    EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, spec.entityName());
    EOModel model = entity.model();
    NSArray result = null;
    String sql;
    if (spec.hints() == null || spec.hints().isEmpty() || spec.hints().valueForKey(EODatabaseContext.CustomQueryExpressionHintKey) == null) {
      // no hints
      if (spec.fetchLimit() > 0 || spec.sortOrderings() != null) {
View Full Code Here

      dbUpdaterModel = _dbUpdaterModelCache;
    }
    else {
      EOModelGroup modelGroup = model.modelGroup();
      EOEntity prototypeEntity = modelGroup.entityNamed(ERXModelGroup.prototypeEntityNameForModel(model));
      boolean isWonderPrototype = (prototypeEntity != null && prototypeEntity.model().name().equals("erprototypes"));

      dbUpdaterModel = new EOModel();
      dbUpdaterModel.setConnectionDictionary(model.connectionDictionary());
      dbUpdaterModel.setAdaptorName(model.adaptorName());
View Full Code Here

    return _modelStats.objectForKey(modelName);
  }

  public SEEntityStats entityStatsForEntityNamed(String entityName) {
    EOEntity entity = _modelGroup.entityNamed(entityName);
    EOModel model = entity.model();
    SEModelStats modelStats = modelStatsForModelNamed(model.name());
    SEEntityStats entityStats = modelStats.entityStatsForEntityNamed(entityName);
    return entityStats;
  }
View Full Code Here

                return;
            }

            //if entity caches objects, clear out the cache
            if( entity.cachesObjects() ) {
                EODatabaseContext databaseContext = EOUtilities.databaseContextForModelNamed(sharedEC, entity.model().name());
                EODatabase database = databaseContext.database();
                database.invalidateResultCacheForEntityNamed(entityName);
            }

            NSArray fetchSpecNames = entity.sharedObjectFetchSpecificationNames();
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.