コード例 #1
0
  /**
   * Ensures we don't have references to EOs before using this in the background thread.
   *
   * @param fs
   * @return a clone of the fetchSpecification with the EOQualifier converted to a schema-based
   *     qualifier or the same {@link EOFetchSpecification} if there is no qualifier.
   */
  private EOFetchSpecification schemaBasedFetchSpecification(
      EOFetchSpecification fetchSpecification) {

    EOQualifier q = fetchSpecification.qualifier();
    if (q != null) {

      // Clone the fetchSpec
      fetchSpecification = (EOFetchSpecification) fetchSpecification.clone();

      EOEditingContext ec = ERXEC.newEditingContext();
      ec.lock();
      try {
        EOEntity entity =
            ERXEOAccessUtilities.entityMatchingString(ec, fetchSpecification.entityName());
        // Convert the qualifier to a schema-based qualifier
        q = entity.schemaBasedQualifier(q);
        fetchSpecification.setQualifier(q);
      } finally {
        ec.unlock();
      }
    } // ~ if (q != null)
    return fetchSpecification;
  }