예제 #1
0
@SuppressWarnings("all")
public abstract class _PDBPresentation extends ERXGenericRecord {
  public static final String ENTITY_NAME = "PDBPresentation";

  // Attribute Keys
  public static final ERXKey<String> AUTHOR = new ERXKey<String>("author");
  public static final ERXKey<NSTimestamp> DATE_CREATED = new ERXKey<NSTimestamp>("dateCreated");
  public static final ERXKey<NSTimestamp> DATE_MODIFIED = new ERXKey<NSTimestamp>("dateModified");
  public static final ERXKey<String> IDENTIFIER = new ERXKey<String>("identifier");
  public static final ERXKey<org.pachyderm.apollo.core.CXLocalizedValue> LOCALIZED_DESCRIPTION =
      new ERXKey<org.pachyderm.apollo.core.CXLocalizedValue>("localizedDescription");
  public static final ERXKey<String> METADATA = new ERXKey<String>("metadata");
  public static final ERXKey<Integer> PK = new ERXKey<Integer>("pk");
  public static final ERXKey<String> TITLE = new ERXKey<String>("title");

  // Relationship Keys
  public static final ERXKey<org.pachyderm.foundation.eof.PDBScreen> EVERY_SCREEN =
      new ERXKey<org.pachyderm.foundation.eof.PDBScreen>("everyScreen");
  public static final ERXKey<org.pachyderm.foundation.eof.PDBScreen> PRIME_SCREEN =
      new ERXKey<org.pachyderm.foundation.eof.PDBScreen>("primeScreen");

  // Attributes
  public static final String AUTHOR_KEY = AUTHOR.key();
  public static final String DATE_CREATED_KEY = DATE_CREATED.key();
  public static final String DATE_MODIFIED_KEY = DATE_MODIFIED.key();
  public static final String IDENTIFIER_KEY = IDENTIFIER.key();
  public static final String LOCALIZED_DESCRIPTION_KEY = LOCALIZED_DESCRIPTION.key();
  public static final String METADATA_KEY = METADATA.key();
  public static final String PK_KEY = PK.key();
  public static final String TITLE_KEY = TITLE.key();

  // Relationships
  public static final String EVERY_SCREEN_KEY = EVERY_SCREEN.key();
  public static final String PRIME_SCREEN_KEY = PRIME_SCREEN.key();

  private static final Logger log = LoggerFactory.getLogger(_PDBPresentation.class);

  public PDBPresentation localInstanceIn(EOEditingContext editingContext) {
    PDBPresentation localInstance =
        (PDBPresentation) EOUtilities.localInstanceOfObject(editingContext, this);
    if (localInstance == null) {
      throw new IllegalStateException(
          "You attempted to localInstance " + this + ", which has not yet committed.");
    }
    return localInstance;
  }

  public String author() {
    return (String) storedValueForKey(_PDBPresentation.AUTHOR_KEY);
  }

  public void setAuthor(String value) {
    log.debug("updating author from {} to {}", author(), value);
    takeStoredValueForKey(value, _PDBPresentation.AUTHOR_KEY);
  }

  public NSTimestamp dateCreated() {
    return (NSTimestamp) storedValueForKey(_PDBPresentation.DATE_CREATED_KEY);
  }

  public void setDateCreated(NSTimestamp value) {
    log.debug("updating dateCreated from {} to {}", dateCreated(), value);
    takeStoredValueForKey(value, _PDBPresentation.DATE_CREATED_KEY);
  }

  public NSTimestamp dateModified() {
    return (NSTimestamp) storedValueForKey(_PDBPresentation.DATE_MODIFIED_KEY);
  }

  public void setDateModified(NSTimestamp value) {
    log.debug("updating dateModified from {} to {}", dateModified(), value);
    takeStoredValueForKey(value, _PDBPresentation.DATE_MODIFIED_KEY);
  }

  public String identifier() {
    return (String) storedValueForKey(_PDBPresentation.IDENTIFIER_KEY);
  }

  public void setIdentifier(String value) {
    log.debug("updating identifier from {} to {}", identifier(), value);
    takeStoredValueForKey(value, _PDBPresentation.IDENTIFIER_KEY);
  }

  public org.pachyderm.apollo.core.CXLocalizedValue localizedDescription() {
    return (org.pachyderm.apollo.core.CXLocalizedValue)
        storedValueForKey(_PDBPresentation.LOCALIZED_DESCRIPTION_KEY);
  }

  public void setLocalizedDescription(org.pachyderm.apollo.core.CXLocalizedValue value) {
    log.debug("updating localizedDescription from {} to {}", localizedDescription(), value);
    takeStoredValueForKey(value, _PDBPresentation.LOCALIZED_DESCRIPTION_KEY);
  }

  public String metadata() {
    return (String) storedValueForKey(_PDBPresentation.METADATA_KEY);
  }

  public void setMetadata(String value) {
    log.debug("updating metadata from {} to {}", metadata(), value);
    takeStoredValueForKey(value, _PDBPresentation.METADATA_KEY);
  }

  public Integer pk() {
    return (Integer) storedValueForKey(_PDBPresentation.PK_KEY);
  }

  public void setPk(Integer value) {
    log.debug("updating pk from {} to {}", pk(), value);
    takeStoredValueForKey(value, _PDBPresentation.PK_KEY);
  }

  public String title() {
    return (String) storedValueForKey(_PDBPresentation.TITLE_KEY);
  }

  public void setTitle(String value) {
    log.debug("updating title from {} to {}", title(), value);
    takeStoredValueForKey(value, _PDBPresentation.TITLE_KEY);
  }

  public org.pachyderm.foundation.eof.PDBScreen primeScreen() {
    return (org.pachyderm.foundation.eof.PDBScreen)
        storedValueForKey(_PDBPresentation.PRIME_SCREEN_KEY);
  }

  public void setPrimeScreen(org.pachyderm.foundation.eof.PDBScreen value) {
    takeStoredValueForKey(value, _PDBPresentation.PRIME_SCREEN_KEY);
  }

  public void setPrimeScreenRelationship(org.pachyderm.foundation.eof.PDBScreen value) {
    log.debug("updating primeScreen from {} to {}", primeScreen(), value);
    if (er.extensions.eof.ERXGenericRecord.InverseRelationshipUpdater
        .updateInverseRelationships()) {
      setPrimeScreen(value);
    } else if (value == null) {
      org.pachyderm.foundation.eof.PDBScreen oldValue = primeScreen();
      if (oldValue != null) {
        removeObjectFromBothSidesOfRelationshipWithKey(oldValue, _PDBPresentation.PRIME_SCREEN_KEY);
      }
    } else {
      addObjectToBothSidesOfRelationshipWithKey(value, _PDBPresentation.PRIME_SCREEN_KEY);
    }
  }

  public NSArray<org.pachyderm.foundation.eof.PDBScreen> everyScreen() {
    return (NSArray<org.pachyderm.foundation.eof.PDBScreen>)
        storedValueForKey(_PDBPresentation.EVERY_SCREEN_KEY);
  }

  public NSArray<org.pachyderm.foundation.eof.PDBScreen> everyScreen(EOQualifier qualifier) {
    return everyScreen(qualifier, null, false);
  }

  public NSArray<org.pachyderm.foundation.eof.PDBScreen> everyScreen(
      EOQualifier qualifier, boolean fetch) {
    return everyScreen(qualifier, null, fetch);
  }

  public NSArray<org.pachyderm.foundation.eof.PDBScreen> everyScreen(
      EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings, boolean fetch) {
    NSArray<org.pachyderm.foundation.eof.PDBScreen> results;
    if (fetch) {
      EOQualifier fullQualifier;
      EOQualifier inverseQualifier =
          ERXQ.equals(org.pachyderm.foundation.eof.PDBScreen.PRESENTATION_KEY, this);

      if (qualifier == null) {
        fullQualifier = inverseQualifier;
      } else {
        fullQualifier = ERXQ.and(qualifier, inverseQualifier);
      }

      results =
          org.pachyderm.foundation.eof.PDBScreen.fetchPDBScreens(
              editingContext(), fullQualifier, sortOrderings);
    } else {
      results = everyScreen();
      if (qualifier != null) {
        results =
            (NSArray<org.pachyderm.foundation.eof.PDBScreen>)
                EOQualifier.filteredArrayWithQualifier(results, qualifier);
      }
      if (sortOrderings != null) {
        results =
            (NSArray<org.pachyderm.foundation.eof.PDBScreen>)
                EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings);
      }
    }
    return results;
  }

  public void addToEveryScreen(org.pachyderm.foundation.eof.PDBScreen object) {
    includeObjectIntoPropertyWithKey(object, _PDBPresentation.EVERY_SCREEN_KEY);
  }

  public void removeFromEveryScreen(org.pachyderm.foundation.eof.PDBScreen object) {
    excludeObjectFromPropertyWithKey(object, _PDBPresentation.EVERY_SCREEN_KEY);
  }

  public void addToEveryScreenRelationship(org.pachyderm.foundation.eof.PDBScreen object) {
    log.debug("adding {} to everyScreen relationship", object);
    if (er.extensions.eof.ERXGenericRecord.InverseRelationshipUpdater
        .updateInverseRelationships()) {
      addToEveryScreen(object);
    } else {
      addObjectToBothSidesOfRelationshipWithKey(object, _PDBPresentation.EVERY_SCREEN_KEY);
    }
  }

  public void removeFromEveryScreenRelationship(org.pachyderm.foundation.eof.PDBScreen object) {
    log.debug("removing {} from everyScreen relationship", object);
    if (er.extensions.eof.ERXGenericRecord.InverseRelationshipUpdater
        .updateInverseRelationships()) {
      removeFromEveryScreen(object);
    } else {
      removeObjectFromBothSidesOfRelationshipWithKey(object, _PDBPresentation.EVERY_SCREEN_KEY);
    }
  }

  public org.pachyderm.foundation.eof.PDBScreen createEveryScreenRelationship() {
    EOEnterpriseObject eo =
        EOUtilities.createAndInsertInstance(
            editingContext(), org.pachyderm.foundation.eof.PDBScreen.ENTITY_NAME);
    addObjectToBothSidesOfRelationshipWithKey(eo, _PDBPresentation.EVERY_SCREEN_KEY);
    return (org.pachyderm.foundation.eof.PDBScreen) eo;
  }

  public void deleteEveryScreenRelationship(org.pachyderm.foundation.eof.PDBScreen object) {
    removeObjectFromBothSidesOfRelationshipWithKey(object, _PDBPresentation.EVERY_SCREEN_KEY);
    editingContext().deleteObject(object);
  }

  public void deleteAllEveryScreenRelationships() {
    Enumeration<org.pachyderm.foundation.eof.PDBScreen> objects =
        everyScreen().immutableClone().objectEnumerator();
    while (objects.hasMoreElements()) {
      deleteEveryScreenRelationship(objects.nextElement());
    }
  }

  public static PDBPresentation createPDBPresentation(
      EOEditingContext editingContext,
      String identifier,
      Integer pk,
      org.pachyderm.foundation.eof.PDBScreen primeScreen) {
    PDBPresentation eo =
        (PDBPresentation)
            EOUtilities.createAndInsertInstance(editingContext, _PDBPresentation.ENTITY_NAME);
    eo.setIdentifier(identifier);
    eo.setPk(pk);
    eo.setPrimeScreenRelationship(primeScreen);
    return eo;
  }

  public static ERXFetchSpecification<PDBPresentation> fetchSpec() {
    return new ERXFetchSpecification<PDBPresentation>(
        _PDBPresentation.ENTITY_NAME, null, null, false, true, null);
  }

  public static NSArray<PDBPresentation> fetchAllPDBPresentations(EOEditingContext editingContext) {
    return _PDBPresentation.fetchAllPDBPresentations(editingContext, null);
  }

  public static NSArray<PDBPresentation> fetchAllPDBPresentations(
      EOEditingContext editingContext, NSArray<EOSortOrdering> sortOrderings) {
    return _PDBPresentation.fetchPDBPresentations(editingContext, null, sortOrderings);
  }

  public static NSArray<PDBPresentation> fetchPDBPresentations(
      EOEditingContext editingContext,
      EOQualifier qualifier,
      NSArray<EOSortOrdering> sortOrderings) {
    ERXFetchSpecification<PDBPresentation> fetchSpec =
        new ERXFetchSpecification<PDBPresentation>(
            _PDBPresentation.ENTITY_NAME, qualifier, sortOrderings);
    NSArray<PDBPresentation> eoObjects = fetchSpec.fetchObjects(editingContext);
    return eoObjects;
  }

  public static PDBPresentation fetchPDBPresentation(
      EOEditingContext editingContext, String keyName, Object value) {
    return _PDBPresentation.fetchPDBPresentation(editingContext, ERXQ.equals(keyName, value));
  }

  public static PDBPresentation fetchPDBPresentation(
      EOEditingContext editingContext, EOQualifier qualifier) {
    NSArray<PDBPresentation> eoObjects =
        _PDBPresentation.fetchPDBPresentations(editingContext, qualifier, null);
    PDBPresentation eoObject;
    int count = eoObjects.count();
    if (count == 0) {
      eoObject = null;
    } else if (count == 1) {
      eoObject = eoObjects.objectAtIndex(0);
    } else {
      throw new IllegalStateException(
          "There was more than one PDBPresentation that matched the qualifier '"
              + qualifier
              + "'.");
    }
    return eoObject;
  }

  public static PDBPresentation fetchRequiredPDBPresentation(
      EOEditingContext editingContext, String keyName, Object value) {
    return _PDBPresentation.fetchRequiredPDBPresentation(
        editingContext, ERXQ.equals(keyName, value));
  }

  public static PDBPresentation fetchRequiredPDBPresentation(
      EOEditingContext editingContext, EOQualifier qualifier) {
    PDBPresentation eoObject = _PDBPresentation.fetchPDBPresentation(editingContext, qualifier);
    if (eoObject == null) {
      throw new NoSuchElementException(
          "There was no PDBPresentation that matched the qualifier '" + qualifier + "'.");
    }
    return eoObject;
  }

  public static PDBPresentation localInstanceIn(
      EOEditingContext editingContext, PDBPresentation eo) {
    PDBPresentation localInstance =
        (eo == null) ? null : ERXEOControlUtilities.localInstanceOfObject(editingContext, eo);
    if (localInstance == null && eo != null) {
      throw new IllegalStateException(
          "You attempted to localInstance " + eo + ", which has not yet committed.");
    }
    return localInstance;
  }

  public static NSArray<org.pachyderm.foundation.eof.PDBPresentation> fetchAllPresentations(
      EOEditingContext editingContext, NSDictionary<String, Object> bindings) {
    EOFetchSpecification fetchSpec =
        EOFetchSpecification.fetchSpecificationNamed(
            "allPresentations", _PDBPresentation.ENTITY_NAME);
    fetchSpec = fetchSpec.fetchSpecificationWithQualifierBindings(bindings);
    return (NSArray<org.pachyderm.foundation.eof.PDBPresentation>)
        editingContext.objectsWithFetchSpecification(fetchSpec);
  }

  public static NSArray<org.pachyderm.foundation.eof.PDBPresentation> fetchAllPresentations(
      EOEditingContext editingContext) {
    EOFetchSpecification fetchSpec =
        EOFetchSpecification.fetchSpecificationNamed(
            "allPresentations", _PDBPresentation.ENTITY_NAME);
    return (NSArray<org.pachyderm.foundation.eof.PDBPresentation>)
        editingContext.objectsWithFetchSpecification(fetchSpec);
  }

  public static NSArray<org.pachyderm.foundation.eof.PDBPresentation>
      fetchPresentationNamesAndIdentities(
          EOEditingContext editingContext, NSDictionary<String, Object> bindings) {
    EOFetchSpecification fetchSpec =
        EOFetchSpecification.fetchSpecificationNamed(
            "presentationNamesAndIdentities", _PDBPresentation.ENTITY_NAME);
    fetchSpec = fetchSpec.fetchSpecificationWithQualifierBindings(bindings);
    return (NSArray<org.pachyderm.foundation.eof.PDBPresentation>)
        editingContext.objectsWithFetchSpecification(fetchSpec);
  }

  public static NSArray<org.pachyderm.foundation.eof.PDBPresentation>
      fetchPresentationNamesAndIdentities(EOEditingContext editingContext, String authorBinding) {
    EOFetchSpecification fetchSpec =
        EOFetchSpecification.fetchSpecificationNamed(
            "presentationNamesAndIdentities", _PDBPresentation.ENTITY_NAME);
    NSMutableDictionary<String, Object> bindings = new NSMutableDictionary<String, Object>();
    bindings.takeValueForKey(authorBinding, "author");
    fetchSpec = fetchSpec.fetchSpecificationWithQualifierBindings(bindings);
    return (NSArray<org.pachyderm.foundation.eof.PDBPresentation>)
        editingContext.objectsWithFetchSpecification(fetchSpec);
  }
}
예제 #2
0
파일: _Employee.java 프로젝트: anjo/wonder
@SuppressWarnings("all")
public abstract class _Employee extends ERXGenericRecord {
  public static final String ENTITY_NAME = "Employee";

  // Attribute Keys
  public static final ERXKey<Boolean> ADMIN = new ERXKey<Boolean>("admin");
  public static final ERXKey<Integer> EXEMPTIONS = new ERXKey<Integer>("exemptions");
  public static final ERXKey<String> FIRST_NAME = new ERXKey<String>("firstName");
  public static final ERXKey<NSTimestamp> HIRE_DATE = new ERXKey<NSTimestamp>("hireDate");
  public static final ERXKey<Boolean> INSURED = new ERXKey<Boolean>("insured");
  public static final ERXKey<String> LAST_NAME = new ERXKey<String>("lastName");
  public static final ERXKey<java.math.BigDecimal> SALARY =
      new ERXKey<java.math.BigDecimal>("salary");
  public static final ERXKey<er.uber.model.EmployeeStatus> STATUS =
      new ERXKey<er.uber.model.EmployeeStatus>("status");
  // Relationship Keys
  public static final ERXKey<er.uber.model.Company> COMPANY =
      new ERXKey<er.uber.model.Company>("company");
  public static final ERXKey<er.attachment.model.ERAttachment> PHOTO =
      new ERXKey<er.attachment.model.ERAttachment>("photo");

  // Attributes
  public static final String ADMIN_KEY = ADMIN.key();
  public static final String EXEMPTIONS_KEY = EXEMPTIONS.key();
  public static final String FIRST_NAME_KEY = FIRST_NAME.key();
  public static final String HIRE_DATE_KEY = HIRE_DATE.key();
  public static final String INSURED_KEY = INSURED.key();
  public static final String LAST_NAME_KEY = LAST_NAME.key();
  public static final String SALARY_KEY = SALARY.key();
  public static final String STATUS_KEY = STATUS.key();
  // Relationships
  public static final String COMPANY_KEY = COMPANY.key();
  public static final String PHOTO_KEY = PHOTO.key();

  private static Logger LOG = Logger.getLogger(_Employee.class);

  public Employee localInstanceIn(EOEditingContext editingContext) {
    Employee localInstance = (Employee) EOUtilities.localInstanceOfObject(editingContext, this);
    if (localInstance == null) {
      throw new IllegalStateException(
          "You attempted to localInstance " + this + ", which has not yet committed.");
    }
    return localInstance;
  }

  public Boolean admin() {
    return (Boolean) storedValueForKey("admin");
  }

  public void setAdmin(Boolean value) {
    if (_Employee.LOG.isDebugEnabled()) {
      _Employee.LOG.debug("updating admin from " + admin() + " to " + value);
    }
    takeStoredValueForKey(value, "admin");
  }

  public Integer exemptions() {
    return (Integer) storedValueForKey("exemptions");
  }

  public void setExemptions(Integer value) {
    if (_Employee.LOG.isDebugEnabled()) {
      _Employee.LOG.debug("updating exemptions from " + exemptions() + " to " + value);
    }
    takeStoredValueForKey(value, "exemptions");
  }

  public String firstName() {
    return (String) storedValueForKey("firstName");
  }

  public void setFirstName(String value) {
    if (_Employee.LOG.isDebugEnabled()) {
      _Employee.LOG.debug("updating firstName from " + firstName() + " to " + value);
    }
    takeStoredValueForKey(value, "firstName");
  }

  public NSTimestamp hireDate() {
    return (NSTimestamp) storedValueForKey("hireDate");
  }

  public void setHireDate(NSTimestamp value) {
    if (_Employee.LOG.isDebugEnabled()) {
      _Employee.LOG.debug("updating hireDate from " + hireDate() + " to " + value);
    }
    takeStoredValueForKey(value, "hireDate");
  }

  public Boolean insured() {
    return (Boolean) storedValueForKey("insured");
  }

  public void setInsured(Boolean value) {
    if (_Employee.LOG.isDebugEnabled()) {
      _Employee.LOG.debug("updating insured from " + insured() + " to " + value);
    }
    takeStoredValueForKey(value, "insured");
  }

  public String lastName() {
    return (String) storedValueForKey("lastName");
  }

  public void setLastName(String value) {
    if (_Employee.LOG.isDebugEnabled()) {
      _Employee.LOG.debug("updating lastName from " + lastName() + " to " + value);
    }
    takeStoredValueForKey(value, "lastName");
  }

  public java.math.BigDecimal salary() {
    return (java.math.BigDecimal) storedValueForKey("salary");
  }

  public void setSalary(java.math.BigDecimal value) {
    if (_Employee.LOG.isDebugEnabled()) {
      _Employee.LOG.debug("updating salary from " + salary() + " to " + value);
    }
    takeStoredValueForKey(value, "salary");
  }

  public er.uber.model.EmployeeStatus status() {
    return (er.uber.model.EmployeeStatus) storedValueForKey("status");
  }

  public void setStatus(er.uber.model.EmployeeStatus value) {
    if (_Employee.LOG.isDebugEnabled()) {
      _Employee.LOG.debug("updating status from " + status() + " to " + value);
    }
    takeStoredValueForKey(value, "status");
  }

  public er.uber.model.Company company() {
    return (er.uber.model.Company) storedValueForKey("company");
  }

  public void setCompany(er.uber.model.Company value) {
    takeStoredValueForKey(value, "company");
  }

  public void setCompanyRelationship(er.uber.model.Company value) {
    if (_Employee.LOG.isDebugEnabled()) {
      _Employee.LOG.debug("updating company from " + company() + " to " + value);
    }
    if (er.extensions.eof.ERXGenericRecord.InverseRelationshipUpdater
        .updateInverseRelationships()) {
      setCompany(value);
    } else if (value == null) {
      er.uber.model.Company oldValue = company();
      if (oldValue != null) {
        removeObjectFromBothSidesOfRelationshipWithKey(oldValue, "company");
      }
    } else {
      addObjectToBothSidesOfRelationshipWithKey(value, "company");
    }
  }

  public er.attachment.model.ERAttachment photo() {
    return (er.attachment.model.ERAttachment) storedValueForKey("photo");
  }

  public void setPhoto(er.attachment.model.ERAttachment value) {
    takeStoredValueForKey(value, "photo");
  }

  public void setPhotoRelationship(er.attachment.model.ERAttachment value) {
    if (_Employee.LOG.isDebugEnabled()) {
      _Employee.LOG.debug("updating photo from " + photo() + " to " + value);
    }
    if (er.extensions.eof.ERXGenericRecord.InverseRelationshipUpdater
        .updateInverseRelationships()) {
      setPhoto(value);
    } else if (value == null) {
      er.attachment.model.ERAttachment oldValue = photo();
      if (oldValue != null) {
        removeObjectFromBothSidesOfRelationshipWithKey(oldValue, "photo");
      }
    } else {
      addObjectToBothSidesOfRelationshipWithKey(value, "photo");
    }
  }

  public static Employee createEmployee(
      EOEditingContext editingContext,
      Boolean admin,
      String firstName,
      NSTimestamp hireDate,
      Boolean insured,
      String lastName,
      er.uber.model.EmployeeStatus status,
      er.uber.model.Company company) {
    Employee eo =
        (Employee) EOUtilities.createAndInsertInstance(editingContext, _Employee.ENTITY_NAME);
    eo.setAdmin(admin);
    eo.setFirstName(firstName);
    eo.setHireDate(hireDate);
    eo.setInsured(insured);
    eo.setLastName(lastName);
    eo.setStatus(status);
    eo.setCompanyRelationship(company);
    return eo;
  }

  public static NSArray<Employee> fetchAllEmployees(EOEditingContext editingContext) {
    return _Employee.fetchAllEmployees(editingContext, null);
  }

  public static NSArray<Employee> fetchAllEmployees(
      EOEditingContext editingContext, NSArray<EOSortOrdering> sortOrderings) {
    return _Employee.fetchEmployees(editingContext, null, sortOrderings);
  }

  public static NSArray<Employee> fetchEmployees(
      EOEditingContext editingContext,
      EOQualifier qualifier,
      NSArray<EOSortOrdering> sortOrderings) {
    EOFetchSpecification fetchSpec =
        new EOFetchSpecification(_Employee.ENTITY_NAME, qualifier, sortOrderings);
    fetchSpec.setIsDeep(true);
    NSArray<Employee> eoObjects =
        (NSArray<Employee>) editingContext.objectsWithFetchSpecification(fetchSpec);
    return eoObjects;
  }

  public static Employee fetchEmployee(
      EOEditingContext editingContext, String keyName, Object value) {
    return _Employee.fetchEmployee(
        editingContext,
        new EOKeyValueQualifier(keyName, EOQualifier.QualifierOperatorEqual, value));
  }

  public static Employee fetchEmployee(EOEditingContext editingContext, EOQualifier qualifier) {
    NSArray<Employee> eoObjects = _Employee.fetchEmployees(editingContext, qualifier, null);
    Employee eoObject;
    int count = eoObjects.count();
    if (count == 0) {
      eoObject = null;
    } else if (count == 1) {
      eoObject = (Employee) eoObjects.objectAtIndex(0);
    } else {
      throw new IllegalStateException(
          "There was more than one Employee that matched the qualifier '" + qualifier + "'.");
    }
    return eoObject;
  }

  public static Employee fetchRequiredEmployee(
      EOEditingContext editingContext, String keyName, Object value) {
    return _Employee.fetchRequiredEmployee(
        editingContext,
        new EOKeyValueQualifier(keyName, EOQualifier.QualifierOperatorEqual, value));
  }

  public static Employee fetchRequiredEmployee(
      EOEditingContext editingContext, EOQualifier qualifier) {
    Employee eoObject = _Employee.fetchEmployee(editingContext, qualifier);
    if (eoObject == null) {
      throw new NoSuchElementException(
          "There was no Employee that matched the qualifier '" + qualifier + "'.");
    }
    return eoObject;
  }

  public static Employee localInstanceIn(EOEditingContext editingContext, Employee eo) {
    Employee localInstance =
        (eo == null) ? null : (Employee) EOUtilities.localInstanceOfObject(editingContext, eo);
    if (localInstance == null && eo != null) {
      throw new IllegalStateException(
          "You attempted to localInstance " + eo + ", which has not yet committed.");
    }
    return localInstance;
  }
}
예제 #3
0
@SuppressWarnings("all")
public abstract class _ERCMailOpen extends ERXGenericRecord {
  public static final String ENTITY_NAME = "ERCMailOpen";

  // Attributes
  public static final ERXKey<NSTimestamp> DATE_OPENED = new ERXKey<NSTimestamp>("dateOpened");
  public static final String DATE_OPENED_KEY = DATE_OPENED.key();

  // Relationships
  public static final ERXKey<er.corebl.model.ERCMailMessage> MAIL_MESSAGE =
      new ERXKey<er.corebl.model.ERCMailMessage>("mailMessage");
  public static final String MAIL_MESSAGE_KEY = MAIL_MESSAGE.key();
  public static final ERXKey<er.corebl.model.ERCUserAgent> USER_AGENT =
      new ERXKey<er.corebl.model.ERCUserAgent>("userAgent");
  public static final String USER_AGENT_KEY = USER_AGENT.key();

  public static class _ERCMailOpenClazz<T extends er.corebl.model.ERCMailOpen>
      extends ERXGenericRecord.ERXGenericRecordClazz<T> {
    /* more clazz methods here */
  }

  private static final Logger LOG = Logger.getLogger(_ERCMailOpen.class);

  public er.corebl.model.ERCMailOpen.ERCMailOpenClazz clazz() {
    return er.corebl.model.ERCMailOpen.clazz;
  }

  public NSTimestamp dateOpened() {
    return (NSTimestamp) storedValueForKey(_ERCMailOpen.DATE_OPENED_KEY);
  }

  public void setDateOpened(NSTimestamp value) {
    if (_ERCMailOpen.LOG.isDebugEnabled()) {
      _ERCMailOpen.LOG.debug("updating dateOpened from " + dateOpened() + " to " + value);
    }
    takeStoredValueForKey(value, _ERCMailOpen.DATE_OPENED_KEY);
  }

  public er.corebl.model.ERCMailMessage mailMessage() {
    return (er.corebl.model.ERCMailMessage) storedValueForKey(_ERCMailOpen.MAIL_MESSAGE_KEY);
  }

  public void setMailMessage(er.corebl.model.ERCMailMessage value) {
    takeStoredValueForKey(value, _ERCMailOpen.MAIL_MESSAGE_KEY);
  }

  public void setMailMessageRelationship(er.corebl.model.ERCMailMessage value) {
    if (_ERCMailOpen.LOG.isDebugEnabled()) {
      _ERCMailOpen.LOG.debug("updating mailMessage from " + mailMessage() + " to " + value);
    }
    if (er.extensions.eof.ERXGenericRecord.InverseRelationshipUpdater
        .updateInverseRelationships()) {
      setMailMessage(value);
    } else if (value == null) {
      er.corebl.model.ERCMailMessage oldValue = mailMessage();
      if (oldValue != null) {
        removeObjectFromBothSidesOfRelationshipWithKey(oldValue, _ERCMailOpen.MAIL_MESSAGE_KEY);
      }
    } else {
      addObjectToBothSidesOfRelationshipWithKey(value, _ERCMailOpen.MAIL_MESSAGE_KEY);
    }
  }

  public er.corebl.model.ERCUserAgent userAgent() {
    return (er.corebl.model.ERCUserAgent) storedValueForKey(_ERCMailOpen.USER_AGENT_KEY);
  }

  public void setUserAgent(er.corebl.model.ERCUserAgent value) {
    takeStoredValueForKey(value, _ERCMailOpen.USER_AGENT_KEY);
  }

  public void setUserAgentRelationship(er.corebl.model.ERCUserAgent value) {
    if (_ERCMailOpen.LOG.isDebugEnabled()) {
      _ERCMailOpen.LOG.debug("updating userAgent from " + userAgent() + " to " + value);
    }
    if (er.extensions.eof.ERXGenericRecord.InverseRelationshipUpdater
        .updateInverseRelationships()) {
      setUserAgent(value);
    } else if (value == null) {
      er.corebl.model.ERCUserAgent oldValue = userAgent();
      if (oldValue != null) {
        removeObjectFromBothSidesOfRelationshipWithKey(oldValue, _ERCMailOpen.USER_AGENT_KEY);
      }
    } else {
      addObjectToBothSidesOfRelationshipWithKey(value, _ERCMailOpen.USER_AGENT_KEY);
    }
  }
}