Package com.webobjects.eocontrol

Examples of com.webobjects.eocontrol.EOQualifier


                aModelName);
        aDatabaseContext.lock();
        NSDictionary aRow = aDatabaseContext
            .snapshotForGlobalID(aGlobalID);
        aDatabaseContext.unlock();
        EOQualifier aQualifier = aRelationship
            .qualifierWithSourceRow(aRow);

        return aQualifier;
      }
    }
View Full Code Here


   * @return a new matching qualifier with the prefix prepended
   */
  public static synchronized EOQualifier prefixQualifierWithKey(EOQualifierEvaluation qualifier, ERXKey prefix) {
    ERXPrefixQualifierTraversal prefixTraversal = new ERXPrefixQualifierTraversal(prefix);
    prefixTraversal.traverse(qualifier, true);
    EOQualifier prefixedQualifier = prefixTraversal._qualifiers.lastObject();
    return prefixedQualifier;
  }
View Full Code Here

    EOGlobalID gid = editingContext.globalIDForObject(this);
    if (gid.isTemporary()) {
      init(editingContext);
      if (applyRestrictingQualifierOnInsert()) {
        EOEntity entity = ERXEOAccessUtilities.entityNamed(editingContext, entityName());
        EOQualifier restrictingQualifier = entity.restrictingQualifier();
        if (restrictingQualifier != null) {
          ERXEOControlUtilities.makeQualifierTrue(restrictingQualifier, this);
        }
      }
    }
View Full Code Here

    return refetchObjectFromDBinEditingContext(editingContext());
  }

  public ERXEnterpriseObject refetchObjectFromDBinEditingContext(EOEditingContext ec) {
    EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, entityName());
    EOQualifier qual = entity.qualifierForPrimaryKey(primaryKeyDictionary(false));
    EOFetchSpecification fetchSpec = new EOFetchSpecification(entityName(), qual, null);
    fetchSpec.setRefreshesRefetchedObjects(true);
    NSArray results = ec.objectsWithFetchSpecification(fetchSpec);
    ERXEnterpriseObject freshObject = null;
    if (results.count() > 0) {
View Full Code Here

     * @param editingContext the editing context to fetch in
     * @param key the key to fetch with
     * @return the fetch objects
     */
    protected NSArray<T> fetchObjectsForKey(EOEditingContext editingContext, Object key) {
    EOQualifier qualifier = fetchObjectsQualifier(key);
    ERXFetchSpecification fetchSpec = new ERXFetchSpecification(_entityName, qualifier, null);
    fetchSpec.setRefreshesRefetchedObjects(true);
    fetchSpec.setIsDeep(true);
    NSArray<T> objects = editingContext.objectsWithFetchSpecification(fetchSpec);
    return objects;
View Full Code Here

     * AND qualifier() (if not null).
     * @param key the key to fetch
     * @return the qualifier to use
     */
    protected EOQualifier fetchObjectsQualifier(Object key) {
    EOQualifier qualifier;
    if (qualifier() == null) {
      qualifier = ERXQ.is(_keyPath, key);
    }
    else {
      qualifier = ERXQ.is(_keyPath, key).and(qualifier());
View Full Code Here

      EORelationship relationship = rootEntity.relationshipNamed(relationshipName);
      EOEntity destinationEntity = relationship.destinationEntity();
      if (relationship.isToManyToOne() && destinationEntity.isAbstractEntity() && fetchSpec.prefetchingRelationshipKeyPaths().containsObject(relationship.name())) {
        EOFetchSpecification newFetchSpec = (EOFetchSpecification) fetchSpec.clone();
        String inverseName = relationship.anyInverseRelationship().definition(); // from destination to intermediate
        EOQualifier singleTableRestrict = destinationEntity._singleTableRestrictingQualifier();
        EOQualifier migratedRestrict = EOQualifierSQLGeneration.Support._qualifierMigratedFromEntityRelationshipPath(singleTableRestrict, destinationEntity, inverseName);
        newFetchSpec.setQualifier(new EOAndQualifier(new NSArray(new Object[]{newFetchSpec.qualifier(),migratedRestrict})));
        fetchSpec = newFetchSpec;
      }
    }
    return fetchSpec;
View Full Code Here

      }
      else {
        itemPageRange = new NSRange(startIndex, listItemIDCount);
      }
      NSArray itemPageArray = list.subarrayWithRange(itemPageRange);
      EOQualifier itemIDQualifier = new EOKeyValueQualifier(listItemIDKeyPath, EOQualifier.QualifierOperatorEqual, itemID);
      NSArray matchingItems = EOQualifier.filteredArrayWithQualifier(itemPageArray, itemIDQualifier);
      if (matchingItems.count() == 0) {
        throw new NoSuchElementException("There was no item that matched the ID '" + itemID + "' in " + list + ".");
      }
      else if (matchingItems.count() > 1) {
View Full Code Here

    }
    else {
      startQualifiers.addObject(new ERXKeyValueQualifier(startDateKey, EOQualifier.QualifierOperatorEqual, null));
      startQualifiers.addObject(new ERXKeyValueQualifier(startDateKey, EOQualifier.QualifierOperatorLessThanOrEqualTo, date));
    }
    EOQualifier startQualifier = new ERXOrQualifier(startQualifiers);

    NSMutableArray<EOQualifier> endQualifiers = new NSMutableArray<EOQualifier>();
    if (exclusive) {
      endQualifiers.addObject(new ERXKeyValueQualifier(endDateKey, EOQualifier.QualifierOperatorGreaterThan, date));
    }
    else {
      endQualifiers.addObject(new ERXKeyValueQualifier(endDateKey, EOQualifier.QualifierOperatorEqual, null));
      endQualifiers.addObject(new ERXKeyValueQualifier(endDateKey, EOQualifier.QualifierOperatorGreaterThanOrEqualTo, date));
    }
    EOQualifier endQualifier = new ERXOrQualifier(endQualifiers);

    EOAndQualifier qualifier = new ERXAndQualifier(new NSArray<EOQualifier>(new EOQualifier[] { startQualifier, endQualifier }));
    return qualifier;

    /*
 
View Full Code Here

    }
    else if (endDate.before(startDate)) {
      throw new IllegalArgumentException("End date must be after start date (start date = " + startDate + ", end date = " + endDate + ")");
    }

    EOQualifier startKeyBeforeStartDate = ERXQ.lessThan(startDateKey, startDate);
    EOQualifier startKeyBeforeEndDate = ERXQ.lessThan(startDateKey, endDate);
    EOQualifier startKeyOnStartDate = ERXQ.equals(startDateKey, startDate);
    EOQualifier startKeyOnEndDate = ERXQ.equals(startDateKey, endDate);
    EOQualifier startKeyAfterStartDate = ERXQ.greaterThan(startDateKey, startDate);
    EOQualifier startKeyAfterEndDate = ERXQ.greaterThan(startDateKey, endDate);

    EOQualifier endKeyBeforeStartDate = ERXQ.lessThan(endDateKey, startDate);
    EOQualifier endKeyBeforeEndDate = ERXQ.lessThan(endDateKey, endDate);
    EOQualifier endKeyOnStartDate = ERXQ.equals(endDateKey, startDate);
    EOQualifier endKeyOnEndDate = ERXQ.equals(endDateKey, endDate);
    EOQualifier endKeyAfterStartDate = ERXQ.greaterThan(endDateKey, startDate);
    EOQualifier endKeyAfterEndDate = ERXQ.greaterThan(endDateKey, endDate);

    // Around Start
    EOQualifier aroundStart = ERXQ.and(startKeyAfterStartDate, startKeyBeforeEndDate);

    // Ends At Start
    EOQualifier endsAtStart = ERXQ.and(startKeyAfterStartDate, startKeyOnEndDate);

    // Surrounding
    EOQualifier surrounding = ERXQ.and(startKeyBeforeStartDate, endKeyAfterEndDate);

    // Directly Overlapping
    EOQualifier directlyOverlapping = ERXQ.and(startKeyOnStartDate, endKeyOnEndDate);

    // In Between
    EOQualifier inBetween = ERXQ.and(startKeyBeforeStartDate, endKeyAfterStartDate, endKeyAfterStartDate, endKeyAfterEndDate);

    // Around End
    EOQualifier aroundEnd = ERXQ.and(endKeyAfterStartDate, endKeyBeforeEndDate);

    // Starts At End
    EOQualifier startsAtEnd = ERXQ.and(endKeyOnStartDate, endKeyBeforeEndDate);

    EOQualifier qualifier;
    if (exclusive) {
      qualifier = ERXQ.or(aroundStart, surrounding, directlyOverlapping, inBetween, aroundEnd);
    }
    else {
      qualifier = ERXQ.or(aroundStart, startKeyOnStartDate, endKeyOnStartDate, endsAtStart, surrounding, directlyOverlapping, inBetween, aroundEnd, endKeyOnEndDate, startsAtEnd, startKeyOnEndDate);
View Full Code Here

TOP

Related Classes of com.webobjects.eocontrol.EOQualifier

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.