示例#1
0
  public NSArray<edu.umich.marketplace.eof.Advert> adverts(
      EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings, boolean fetch) {
    NSArray<edu.umich.marketplace.eof.Advert> results;
    if (fetch) {
      EOQualifier fullQualifier;
      EOQualifier inverseQualifier =
          new EOKeyValueQualifier(
              edu.umich.marketplace.eof.Advert.CATEGORY_KEY,
              EOQualifier.QualifierOperatorEqual,
              this);

      if (qualifier == null) {
        fullQualifier = inverseQualifier;
      } else {
        NSMutableArray qualifiers = new NSMutableArray();
        qualifiers.addObject(qualifier);
        qualifiers.addObject(inverseQualifier);
        fullQualifier = new EOAndQualifier(qualifiers);
      }

      results =
          edu.umich.marketplace.eof.Advert.fetchAdverts(
              editingContext(), fullQualifier, sortOrderings);
    } else {
      results = adverts();
      if (qualifier != null) {
        results =
            (NSArray<edu.umich.marketplace.eof.Advert>)
                EOQualifier.filteredArrayWithQualifier(results, qualifier);
      }
      if (sortOrderings != null) {
        results =
            (NSArray<edu.umich.marketplace.eof.Advert>)
                EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings);
      }
    }
    return results;
  }
  public NSArray<er.sync.eo.ERSyncPrincipal> principals(
      EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings, boolean fetch) {
    NSArray<er.sync.eo.ERSyncPrincipal> results;
    if (fetch) {
      EOQualifier fullQualifier;
      EOQualifier inverseQualifier =
          new EOKeyValueQualifier(
              er.sync.eo.ERSyncPrincipal.DEVICE_TYPE_KEY, EOQualifier.QualifierOperatorEqual, this);

      if (qualifier == null) {
        fullQualifier = inverseQualifier;
      } else {
        NSMutableArray qualifiers = new NSMutableArray();
        qualifiers.addObject(qualifier);
        qualifiers.addObject(inverseQualifier);
        fullQualifier = new EOAndQualifier(qualifiers);
      }

      results =
          er.sync.eo.ERSyncPrincipal.fetchERSyncPrincipals(
              editingContext(), fullQualifier, sortOrderings);
    } else {
      results = principals();
      if (qualifier != null) {
        results =
            (NSArray<er.sync.eo.ERSyncPrincipal>)
                EOQualifier.filteredArrayWithQualifier(results, qualifier);
      }
      if (sortOrderings != null) {
        results =
            (NSArray<er.sync.eo.ERSyncPrincipal>)
                EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings);
      }
    }
    return results;
  }