Package com.webobjects.eocontrol

Examples of com.webobjects.eocontrol.EOFetchSpecification


    // belongs into ERXEC, but I'm reluctant to have this morphing done
    // every time a fetch occurs as it affects mainly sort ordering
    // from the display group
    if (dataSource() instanceof EODatabaseDataSource) {
      EODatabaseDataSource ds = (EODatabaseDataSource) dataSource();
      EOFetchSpecification old = ds.fetchSpecification();
      EOFetchSpecification fs = ERXEOAccessUtilities.localizeFetchSpecification(ds.editingContext(), old);
      ds.setFetchSpecification(fs);
      try {
        result = super.fetch();
      } finally {
        ds.setFetchSpecification(old);
View Full Code Here


           
            EOJoin parentChildJoin = ERXArrayUtilities.firstObject(relationship.joins());
            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);
View Full Code Here

   *
   * @return the fetch specification
   */
  protected EOFetchSpecification fetchSpecification() {
    EODatabaseDataSource ds = (EODatabaseDataSource) dataSource();
    EOFetchSpecification spec = (EOFetchSpecification) ds.fetchSpecificationForFetch().clone();
    spec.setSortOrderings(ERXArrayUtilities.arrayByAddingObjectsFromArrayWithoutDuplicates(sortOrderings(), spec.sortOrderings()));
    EOQualifier dgQualifier = qualifier();
    EOQualifier qualifier = spec.qualifier();
    if (dgQualifier != null) {
      if (qualifier != null) {
        qualifier = new ERXAndQualifier(dgQualifier, qualifier);
      } else {
        qualifier = dgQualifier;
      }
      spec.setQualifier(qualifier);
    }
    return spec;
  }
View Full Code Here

   * @param end end index of the range
   * @return array of object in the given range
   */
  protected NSArray<T> objectsInRange(int start, int end) {
    EOEditingContext ec = dataSource().editingContext();
    EOFetchSpecification spec = (EOFetchSpecification)fetchSpecification().clone();
    if (_prefetchingRelationshipKeyPaths != null && _prefetchingRelationshipKeyPaths.count() > 0) {
      spec.setPrefetchingRelationshipKeyPaths(_prefetchingRelationshipKeyPaths);
    }
   
    NSArray result = ERXEOControlUtilities.objectsInRange(ec, spec, start, end, _rawRowsForCustomQueries);
    // WAS: fetch the primary keys, turn them into faults, then batch-fetch all
    // the non-resident objects
View Full Code Here

              qualifiers.addObject(qualifier);
            }
          }
          if (qualifiers.count() > 0) {
            EOQualifier qualifier = qualifiers.count() > 1 ? new EOOrQualifier(qualifiers) : qualifiers.lastObject();
            EOFetchSpecification fetchSpec = new EOFetchSpecification(entityName, qualifier, null);
            fetchSpec.setRefreshesRefetchedObjects(refreshesRefetchedObjects);
            NSArray<EOEnterpriseObject> details = ec.objectsWithFetchSpecification(fetchSpec);
            result.addObjectsFromArray(details);
          }
        }
    }
View Full Code Here

        }
        finally {
          channel.cancelFetch();
        }
        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();
          }
View Full Code Here

    }
    int version;
    try {
      EOModel dbUpdaterModel = dbUpdaterModelWithModel(model, adaptor);
      EOEntity dbUpdaterEntity = dbUpdaterModel.entityNamed(migrationTableName(adaptor));
      EOFetchSpecification fetchSpec = new EOFetchSpecification(migrationTableName(adaptor), new EOKeyValueQualifier("modelName", EOQualifier.QualifierOperatorEqual, model.name()), null);
      try {
        channel.selectAttributes(new NSArray<EOAttribute>(dbUpdaterEntity.attributeNamed("version")), fetchSpec, false, dbUpdaterEntity);
        NSDictionary nextRow = channel.fetchRow();
        if (nextRow == null) {
          version = initialVersionForModel(model);
View Full Code Here

                /* For EOs that are completely shared the below for loop results in *2* fetches
                for 1 fs (fetchAll) when the entity is caching the code below works around this with only 1 fetch. */
                if (entity.sharedObjectFetchSpecificationNames().count() == 1 &&
                    entity.sharedObjectFetchSpecificationNames().lastObject().equals("FetchAll")) {
                    try {
                        EOFetchSpecification fs = entity.fetchSpecificationNamed("FetchAll");
                        dsec.bindObjectsWithFetchSpecification(fs, "FetchAll");
                    } catch (Exception e1) {
                        log.error("Exception occurred for entity named: " + entity.name() + " in Model: " + aModel.name() + e1);
                        throw new RuntimeException(e.toString());
                    }
                } else {
                    for (Enumeration ee = entity.sharedObjectFetchSpecificationNames().objectEnumerator(); ee.hasMoreElements();) {
                        String fsn = (String)ee.nextElement();
                        EOFetchSpecification fs = entity.fetchSpecificationNamed(fsn);
                        if (fs != null) {
                            log.debug("Loading "+entity.name()+" - "+fsn);
                            dsec.bindObjectsWithFetchSpecification(fs, fsn);
                        }
                    }                   
View Full Code Here

            int count =  (fetchSpecNames != null) ? fetchSpecNames.count() : 0;

            if ( count > 0 ) { //same check as ERXEOAccessUtilities.entityWithNamedIsShared(), but avoids duplicate work
                for (int index = 0 ; index < count ; ++index) {
                    String oneFetchSpecName = (String)fetchSpecNames.objectAtIndex(index);
                    EOFetchSpecification fs = entity.fetchSpecificationNamed(oneFetchSpecName);
                    if (fs != null) {
                        fs.setRefreshesRefetchedObjects(true);
                        sharedEC.bindObjectsWithFetchSpecification(fs, oneFetchSpecName);
                    }
                }

                //notify the entity class, if it wants to know
View Full Code Here

                                     EOEditingContext ec,
                                     ERXFuzzyMatchCleaner cleaner,
                                     NSArray sortOrderings ){
        String eoKey = "eo";
        NSMutableArray<NSMutableDictionary<String, Object>> results = new NSMutableArray<NSMutableDictionary<String, Object>>();
        EOFetchSpecification fs = new EOFetchSpecification( entityName, null, null );
        fs.setFetchesRawRows( true );
        NSArray<String> pks = EOUtilities.entityNamed( ec, entityName ).primaryKeyAttributeNames();
        NSMutableArray<String> keyPaths = new NSMutableArray<String>(pks);
        keyPaths.addObject( propertyKey );
        if( synonymsKey != null )
            keyPaths.addObject( synonymsKey );
        //we use only the strictly necessary keys.
        fs.setRawRowKeyPaths( keyPaths );
        NSArray<NSDictionary<String, Object>> rawRows = ec.objectsWithFetchSpecification( fs );
        if(name == null)
            name = "";
        name = name.toUpperCase();
        String cleanedName = cleaner.cleanStringForFuzzyMatching(name);
View Full Code Here

TOP

Related Classes of com.webobjects.eocontrol.EOFetchSpecification

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.