// DO NOT EDIT. Make changes to Person.java instead. package er.example.erxpartials.model; import com.webobjects.eoaccess.*; import com.webobjects.eocontrol.*; import com.webobjects.foundation.*; import java.math.*; import java.util.*; import org.apache.log4j.Logger; import er.extensions.eof.*; import er.extensions.foundation.*; @SuppressWarnings("all") public abstract class _Person extends er.extensions.partials.ERXPartialGenericRecord { public static final String ENTITY_NAME = "Person"; // Attribute Keys public static final ERXKey<String> FIRST_NAME = new ERXKey<String>("firstName"); public static final ERXKey<String> LAST_NAME = new ERXKey<String>("lastName"); // Relationship Keys public static final ERXKey<er.example.erxpartials.model.GenderType> GENDER_TYPE = new ERXKey<er.example.erxpartials.model.GenderType>("genderType"); // Attributes public static final String FIRST_NAME_KEY = FIRST_NAME.key(); public static final String LAST_NAME_KEY = LAST_NAME.key(); // Relationships public static final String GENDER_TYPE_KEY = GENDER_TYPE.key(); private static Logger LOG = Logger.getLogger(_Person.class); public Person localInstanceIn(EOEditingContext editingContext) { Person localInstance = (Person)EOUtilities.localInstanceOfObject(editingContext, this); if (localInstance == null) { throw new IllegalStateException("You attempted to localInstance " + this + ", which has not yet committed."); } return localInstance; } public String firstName() { return (String) storedValueForKey(_Person.FIRST_NAME_KEY); } public void setFirstName(String value) { if (_Person.LOG.isDebugEnabled()) { _Person.LOG.debug( "updating firstName from " + firstName() + " to " + value); } takeStoredValueForKey(value, _Person.FIRST_NAME_KEY); } public String lastName() { return (String) storedValueForKey(_Person.LAST_NAME_KEY); } public void setLastName(String value) { if (_Person.LOG.isDebugEnabled()) { _Person.LOG.debug( "updating lastName from " + lastName() + " to " + value); } takeStoredValueForKey(value, _Person.LAST_NAME_KEY); } public er.example.erxpartials.model.GenderType genderType() { return (er.example.erxpartials.model.GenderType)storedValueForKey(_Person.GENDER_TYPE_KEY); } public void setGenderType(er.example.erxpartials.model.GenderType value) { takeStoredValueForKey(value, _Person.GENDER_TYPE_KEY); } public void setGenderTypeRelationship(er.example.erxpartials.model.GenderType value) { if (_Person.LOG.isDebugEnabled()) { _Person.LOG.debug("updating genderType from " + genderType() + " to " + value); } if (er.extensions.eof.ERXGenericRecord.InverseRelationshipUpdater.updateInverseRelationships()) { setGenderType(value); } else if (value == null) { er.example.erxpartials.model.GenderType oldValue = genderType(); if (oldValue != null) { removeObjectFromBothSidesOfRelationshipWithKey(oldValue, _Person.GENDER_TYPE_KEY); } } else { addObjectToBothSidesOfRelationshipWithKey(value, _Person.GENDER_TYPE_KEY); } } public static Person createPerson(EOEditingContext editingContext, String firstName , String lastName , er.example.erxpartials.model.GenderType genderType) { Person eo = (Person) EOUtilities.createAndInsertInstance(editingContext, _Person.ENTITY_NAME); eo.setFirstName(firstName); eo.setLastName(lastName); eo.setGenderTypeRelationship(genderType); return eo; } public static ERXFetchSpecification<Person> fetchSpec() { return new ERXFetchSpecification<Person>(_Person.ENTITY_NAME, null, null, false, true, null); } public static NSArray<Person> fetchAllPersons(EOEditingContext editingContext) { return _Person.fetchAllPersons(editingContext, null); } public static NSArray<Person> fetchAllPersons(EOEditingContext editingContext, NSArray<EOSortOrdering> sortOrderings) { return _Person.fetchPersons(editingContext, null, sortOrderings); } public static NSArray<Person> fetchPersons(EOEditingContext editingContext, EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings) { ERXFetchSpecification<Person> fetchSpec = new ERXFetchSpecification<Person>(_Person.ENTITY_NAME, qualifier, sortOrderings); fetchSpec.setIsDeep(true); NSArray<Person> eoObjects = fetchSpec.fetchObjects(editingContext); return eoObjects; } public static Person fetchPerson(EOEditingContext editingContext, String keyName, Object value) { return _Person.fetchPerson(editingContext, new EOKeyValueQualifier(keyName, EOQualifier.QualifierOperatorEqual, value)); } public static Person fetchPerson(EOEditingContext editingContext, EOQualifier qualifier) { NSArray<Person> eoObjects = _Person.fetchPersons(editingContext, qualifier, null); Person 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 Person that matched the qualifier '" + qualifier + "'."); } return eoObject; } public static Person fetchRequiredPerson(EOEditingContext editingContext, String keyName, Object value) { return _Person.fetchRequiredPerson(editingContext, new EOKeyValueQualifier(keyName, EOQualifier.QualifierOperatorEqual, value)); } public static Person fetchRequiredPerson(EOEditingContext editingContext, EOQualifier qualifier) { Person eoObject = _Person.fetchPerson(editingContext, qualifier); if (eoObject == null) { throw new NoSuchElementException("There was no Person that matched the qualifier '" + qualifier + "'."); } return eoObject; } public static Person localInstanceIn(EOEditingContext editingContext, Person eo) { Person 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; } }