WebObjects 5.4.1

com.webobjects.eoaccess
Class EOEntity

java.lang.Object
  extended by com.webobjects.eoaccess.EOEntity
All Implemented Interfaces:
EOPropertyListEncoding, EOSQLExpression.SQLValue

public class EOEntity
extends Object
implements EOPropertyListEncoding, EOSQLExpression.SQLValue

An EOEntity describes a table in a database and associates a name internal to the Enterprise Objects Framework with an external name by which the table is known to the database. An EOEntity maintains a group of attributes and relationships, which are collectively called properties. These are represented by the EOAttribute and EORelationship classes, respectively.

You usually define entities in an EOModel using the EOModeler application. EOEntity objects are primarily used by the Enterprise Objects Framework for mapping tables in the database to Enterprise Objects in the application. You are not likely to interact with them directly unless you are specifically working with models.

An EOEntity is associated with a specific class whose instances are used to represent records (rows) from the database in applications using layers at or above the database layer of the Enterprise Objects Framework. If an EOEntity doesn't have a specific class associated with it, instances of EOGenericRecord are created.

An EOEntity may be marked as read-only, in which case any changes to rows or objects for that entity made by the database level objects are denied.

You can define an external query for an EOEntity to be used when a selection is attempted with an unrestricted qualifier (one that would select all rows in the entity's table). An external query is sent unaltered to the database server and so can use database-specific features such as stored procedures; external queries are thus useful for hiding records or invoking database-specific features. You can also assign stored procedures to be invoked upon particular database operations through the use of EOEntity's setStoredProcedure method.

Like the other major modeling classes, EOEntity provides a user dictionary for the application to store any application-specific information related to the entity.

Creating an Entity

An EOEntity requires at least the following to be usable:

Note that if an entity has no Enterprise Object class name, the database-level objects use EOGenericRecord.

See Also:
setStoredProcedure(EOStoredProcedure storedProcedure, String operation), EOAttribute, EORelationship, EOGenericRecord

Field Summary
static String DeleteProcedureOperation
          A stored procedure to delete a row.
static String FetchAllProcedureOperation
          A stored procedure to fetch all records.
static String FetchWithPrimaryKeyProcedureOperation
          A stored procedure to fetch by primary key.
static String InsertProcedureOperation
          A stored procedure to insert a row.
static String NextPrimaryKeyProcedureOperation
          A stored procedure to generate a new primary key.
 
Constructor Summary
EOEntity()
          Creates and returns a new EOEntity.
EOEntity(NSDictionary plist, Object owner)
          Creates and returns a new EOEntity initialized from the property list plist belonging to the EOModel owner.
 
Method Summary
 void addAttribute(EOAttribute attribute)
          Adds attribute to the receiver and sets the receiver as the attribute's entity.
 void addFetchSpecification(EOFetchSpecification fetchSpec, String name)
          Adds the fetch specification fetchSpec to the receiver and associates name with it.
 void addIndex(EOEntityIndex index)
          Adds index to the receiver and sets the receiver as the index's entity.\
 void addRelationship(EORelationship relationship)
          Adds relationship to the receiver and sets the receiver as the relationship's entity.
 void addSharedObjectFetchSpecificationByName(String name)
          Adds the fetch specification identified by name to the set of fetch specifications used to load objects into a shared editing context.
 void addSubEntity(EOEntity child)
          Adds the EOEntity child as a sub-entity of the receiver.
 EOAttribute anyAttributeNamed(String name)
          Returns the user-created attribute identified by name.
 EORelationship anyRelationshipNamed(String relationshipName)
          Returns the user-created relationship identified by relationshipName.
 EOAttribute attributeNamed(String attributeName)
          Returns the attribute named attributeName, or null if no such attribute exists in the receiver.
 NSArray<EOAttribute> attributes()
          Returns an array containing all of the receiver's attributes, or an empty array if the receiver has no attributes.
 NSArray<EOAttribute> attributesToFetch()
          Returns an array of the EOAttributes that need to be fetched so that they can be included in the row snapshot.
 NSArray<EOAttribute> attributesUsedForLocking()
          Returns an array containing those attributes used for locking, that is, those properties whose values must match a snapshot any time a row is updated.
 void awakeWithPropertyList(NSDictionary pl)
          EOEntity's implementation of this method does nothing.
 void beautifyName()
          Makes the receiver's name conform to a standard convention.
 boolean cachesObjects()
          Returns true if all of the objects from the receiver are to be cached in memory and queries are to be evaluated in memory using this cache rather than in the database.
 EOClassDescription classDescriptionForInstances()
          Returns the EOClassDescription associated with the receiver.
 String className()
          Returns the name of the Enterprise Object class associated with the receiver.
 String classNameWithoutPackage()
          Return the name of the Enterprise Object class associated with the receiver without the package information.
 String classPackageName()
          Return the package of the Enterprise Object class associated with the receive.
 NSArray<EOProperty> classProperties()
          Returns an array containing the properties that are bound to the receiver's class (so that values corresponding to those properties are passed to instances of that class).
 NSArray classPropertyNames()
          Returns an array containing the names of those properties that are bound to the receiver's class (so that values corresponding to those properties are passed to instances of that class).
 String clientClassName()
          Returns the name of the client-side Enterprise Object class associated with the receiver.
 NSArray<EOProperty> clientClassProperties()
          Returns an array containing the properties that are bound to the client-side class corresponding to the receiver.
 NSArray clientClassPropertyNames()
          Returns an array containing the names of the properties that are bound to the client-side class corresponding to the entity.
 void encodeIntoPropertyList(NSMutableDictionary result)
          Encodes the receiver as a property list.
 NSArray<EOModel> externalModelsReferenced()
          Examines each of the receiver's relationships and returns a list of all external models referenced by the receiver, or an empty arrray if no external models are referenced.
 String externalName()
          Returns the name of the receiver as understood by the database server, that is, the receiver's external name.
static String externalNameForInternalName(String internalName, String separatorString, boolean allCaps)
          Used by the Enterprise Objects Framework to convert an internal object name, internalName to a database schema name that conforms to a standard convention, separating name elements with separatorString and capitalizing or lowercasing the external name based on the Boolean parameter allCaps.
 String externalQuery()
          Returns a query statement that is used by an EOAdaptorChannel to select rows for the entity when a qualifier is empty, or null if the entity has no external query.
 EOFetchSpecification fetchSpecificationNamed(String fetchSpecName)
          Returns the fetch specification identified by fetchSpecName.
 NSArray<String> fetchSpecificationNames()
          Returns an alphabetically sorted array of the names of the receiver's fetch specifications.
 EOGlobalID globalIDForRow(NSDictionary row)
          Constructs a unique global identifier for the receiver from the keys and values in the dictionary row, which represents a database row.
 boolean hasExternalName()
          Checks if an entity is not abstract and has a valid external name.
 boolean hasRealAttributes()
          Checks to see if the enity has real attributes.
 boolean hasSimplePrimaryKey()
          Check if the entity use a simple primary key (Number)
 NSArray<EOEntityIndex> indexes()
          /** Returns an array containing all of the receiver's indexs, or an empty array if the receiver has no indexes.
 EOEntityIndex indexNamed(String indexName)
          Returns the index identified by indexName, or null if the receiver has no such index.
 boolean isAbstractEntity()
          Returns true if the receiver is an abstract entity, false otherwise.
 boolean isPrimaryKeyValidInObject(NSKeyValueCoding object)
          Returns true if every key attribute is present in object and has a value that is not null.
 boolean isQualifierForPrimaryKey(EOQualifier qualifier)
          Returns true if qualifier describes the primary key and nothing but the primary key, false otherwise.
 boolean isReadOnly()
          Returns true if the receiver can not be modified, false if it can.
 boolean isSubEntityOf(EOEntity entity)
          Checks if the receiving entity is a subentity of entity.
 boolean isValidAttributeUsedForLocking(EOAttribute anAttribute)
          Returns true if anAttribute can be used for locking, false otherwise.
 boolean isValidClassProperty(Object aProp)
          Returns true if the property aProp is a valid class property of the receiver, false otherwise.
 boolean isValidPrimaryKeyAttribute(EOAttribute anAttribute)
          Returns false if anAttribute isn't an EOAttribute, doesn't belong to the entity or is derived.
 int maxNumberOfInstancesToBatchFetch()
          Returns the maximum number of to-one faults from the receiver to fire at one time.
 EOModel model()
          Returns the EOModel that contains the receiver.
 String name()
          Returns the receiver's name.
static String nameForExternalName(String externalName, String separatorString, boolean initialCaps)
          Used by the Enterprise Objects Framework to convert a database schema name externalName to an internal object name that conforms to a standard convention, using the capitalization rule initialCaps and removing the character separatorString that separates name elements in the external name.
 EOEntity parentEntity()
          Returns the parent entity for the receiver, that is, the entity from which the receiver inherits.
 NSArray<String> primaryKeyAttributeNames()
          Returns an array containing the names of the EOAttributes that make up the receiver's primary key.
 NSArray<EOAttribute> primaryKeyAttributes()
          Returns an array of those EOAttributes that make up the receiver's primary key.
 NSDictionary<String,Object> primaryKeyForGlobalID(EOGlobalID gid)
          Returns the primary key for the object identified by gid, or null if gid is not an instance of EOKeyGlobalID.
 NSDictionary primaryKeyForRow(NSDictionary row)
          Returns the primary key for row, or null if the primary key can't be computed.
 String primaryKeyRootName()
          Returns the external name (that is, the name understood by the database) of the receiver's root (parent) entity.
 EOProperty propertyNamed(String propertyName)
          Returns the property identified by propertyName, or null if the receiver has no such property.
 EOQualifier qualifierForPrimaryKey(NSDictionary<String,Object> row)
          Returns a qualifier for the receiver that can be used to fetch an instance of the receiver with the primary key extracted from row.
 boolean referencesProperty(Object property)
          Returns true if any of the receiver's attributes or relationships reference property, false otherwise.
 EORelationship relationshipNamed(String relationshipName)
          Returns the relationship identified by relationshipName, or null if the receiver has no such relationship.
 NSArray<EORelationship> relationships()
          Returns an array containing all of the receiver's relationships or null if the receiver has none.
 void removeAttribute(EOAttribute attribute)
          If attribute exists, removes it from the receiver.
 void removeFetchSpecificationNamed(String name)
          Removes the fetch specification identifed by name from the receiver.
 void removeIndex(EOEntityIndex index)
          If index exists, removes it from the receiver.
 void removeRelationship(EORelationship relationship)
          If relationship exists, removes it from the receiver.
 void removeSharedObjectFetchSpecificationByName(String name)
          Removes the fetch specification identified by name from the set of fetch specifications used to load objects into a shared editing context.
 void removeSubEntity(EOEntity child)
          Removes the EOEntity child from the list of sub-entities that inherit from the receiver.
 EOQualifier restrictingQualifier()
          Returns the qualifier used to restrict all queries made against the receiver.
 EOQualifier schemaBasedQualifier(EOQualifier qualifier)
          Returns an SQL qualifier based on qualifier that is suitable for evaluation by a database (as opposed to in-memory evaluation).
 boolean setAttributesUsedForLocking(NSArray<EOAttribute> attributes)
          If all of the the EOAttributes in attributes can be used by an EODatabaseChannel to lock Enterprise Objects for updates, sets attributes as the receiver's attributes used for locking and returns true.
 void setCachesObjects(boolean flag)
          Based on the Boolean value flag, sets whether the receiver's Enterprise Objects are cached the first time the associated database table is queried.
 void setClassName(String name)
          Assigns name as the name of the Enterprise Object class associated with the receiver if name is not null.
 boolean setClassProperties(NSArray<EOProperty> attributes)
          If all of the the EOAttributes in attributes are valid class properties of the receiver, sets attributes as the receiver's class properties and returns true.
 void setExternalName(String string)
          Sets the name of the receiver as understood by the database server (that is, the receiver's external name) to string.
 void setExternalQuery(String string)
          Assigns string as the query statement used for selecting rows from the entity when there is no qualifier.
 void setIsAbstractEntity(boolean flag)
          Based on the Boolean flag, sets whether the receiver is an abstract entity, false otherwise.
 void setMaxNumberOfInstancesToBatchFetch(int size)
          Sets the maximum number of faults from the entity to trigger at one time to size.
 void setName(String name)
          Sets the receiver's name to name.
 boolean setPrimaryKeyAttributes(NSArray<EOAttribute> attributes)
          If all of the the EOAttributes in attributes are valid primary keys of the receiver, sets attributes as the receiver's primary keys and returns true.
 void setReadOnly(boolean flag)
          Sets whether the receiver is read-only based on the Boolean value flag.
 void setRestrictingQualifier(EOQualifier qualifier)
          Assigns qualifier as the qualifier used to restrict all queries made against the receiver.
 void setSharedObjectFetchSpecificationsByName(NSArray<String> names)
          Sets the names of the fetch specifications used to load objects into a shared editing context to names.
 void setStoredProcedure(EOStoredProcedure storedProcedure, String operation)
          Sets storedProcedure as a stored procedure for the receiver and associates with it the name operation, which must be one of the following:

FetchAllProcedureOperation FetchWithPrimaryKeyProcedureOperation InsertProcedureOperation DeleteProcedureOperation NextPrimaryKeyProcedureOperation
This information is used when changes from the object graph have been transformed into EODatabaseOperations that are being used to construct EOAdaptorOperations.
 void setUserInfo(NSDictionary<String,Object> dictionary)
          Sets the dictionary of auxiliary user data to dictionary.
 NSArray<String> sharedObjectFetchSpecificationNames()
          Returns an array of strings, which are the names of the fetch specifications used to load objects into a shared editing context.
 EOStoredProcedure storedProcedureForOperation(String operation)
          Returns the stored procedure identified by the name operation, if one has been set.
 NSArray<EOEntity> subEntities()
          Returns a list of those entities that inherit from the receiver, or an empty array if no entities inherit from the receiver.
 String toString()
          Returns a string representation of all the receiver's properties.
 NSDictionary<String,Object> userInfo()
          Returns a dictionary of user data.
 String valueForSQLExpression(EOSQLExpression context)
          Returns an SQL query string based on the receiver's external name and an EOSQLExpression object context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FetchAllProcedureOperation

public static final String FetchAllProcedureOperation
A stored procedure to fetch all records.

See Also:
Constant Field Values

FetchWithPrimaryKeyProcedureOperation

public static final String FetchWithPrimaryKeyProcedureOperation
A stored procedure to fetch by primary key.

See Also:
Constant Field Values

InsertProcedureOperation

public static final String InsertProcedureOperation
A stored procedure to insert a row.

See Also:
Constant Field Values

DeleteProcedureOperation

public static final String DeleteProcedureOperation
A stored procedure to delete a row.

See Also:
Constant Field Values

NextPrimaryKeyProcedureOperation

public static final String NextPrimaryKeyProcedureOperation
A stored procedure to generate a new primary key.

See Also:
Constant Field Values
Constructor Detail

EOEntity

public EOEntity()
Creates and returns a new EOEntity.


EOEntity

public EOEntity(NSDictionary plist,
                Object owner)
Creates and returns a new EOEntity initialized from the property list plist belonging to the EOModel owner. plist is dictionary containing only property list data types (that is, NSDictionary, NSArray, NSData, and String). This constructor is used by EOModeler when it reads in an EOModel from a file.

Parameters:
plist - A dictionary of property list values from which to initialize the new EOEntity object.
owner - The EOModel to which the newly created entity belongs.
See Also:
EOPropertyListEncoding#encodeIntoPropertyList(NSMutableDictionary propertyList), EOPropertyListEncoding#awakeWithPropertyList(NSDictionary propertyList)
Method Detail

name

public String name()
Returns the receiver's name.

Returns:
The entity's name.

toString

public String toString()
Returns a string representation of all the receiver's properties.

Overrides:
toString in class Object
Returns:
The entity's property list as a string.

model

public EOModel model()
Returns the EOModel that contains the receiver.

Returns:
The model that contains the entity.
See Also:
EOModel#addEntity(EOEntity anEntity)

externalName

public String externalName()
Returns the name of the receiver as understood by the database server, that is, the receiver's external name.

Returns:
The entity's external name.

externalQuery

public String externalQuery()
Returns a query statement that is used by an EOAdaptorChannel to select rows for the entity when a qualifier is empty, or null if the entity has no external query. An empty qualifier is one that specifies only the entity and would thus fetch all Enterprise Objects for that entity.

External queries are useful for hiding records or invoking database-specific features such as stored procedures when an application attempts to select all records for an entity. You can also use the EOStoredProcedure class to work with stored procedures.

Returns:
A query statement to use when a qualifier is empty, or null.
See Also:
setExternalQuery(String name), EOStoredProcedure

restrictingQualifier

public EOQualifier restrictingQualifier()
Returns the qualifier used to restrict all queries made against the receiver. Restricting qualifiers are useful when there is not a one-to-one mapping between an entity and a particular database table, or when you always want to filter the data that's returned for a particular entity.

For example, if you are using the "single table" inheritance model in which parent and child data are contained in the same table, you would use a restricting qualifier to fetch objects of the appropriate type. To give a non-inheritance example, for an Employees table you might create a "Sales" entity that has a restricting qualifier that only fetches employees who are in the Sales department.

Returns:
The qualifier used to restrict all queries made against the receiver.
See Also:
setRestrictingQualifier(EOQualifier aQualifier)

isReadOnly

public boolean isReadOnly()
Returns true if the receiver can not be modified, false if it can. If an entity is read-only, then Enterprise Objects fetched for that entity are also read-only (that is, can not be inserted, deleted, or updated).

Returns:
true if the entity can't be modified.

cachesObjects

public boolean cachesObjects()
Returns true if all of the objects from the receiver are to be cached in memory and queries are to be evaluated in memory using this cache rather than in the database. This method should only be used for fairly small tables of read-only objects, since the first access to the entity will trigger fetching the entire table. You should generally restrict this method to read-only entities to avoid cached data becoming out of sync with database data. Also, you shouldn't use this method if the application will be making any queries against the entity that can't be evaluated in memory.
To clear the cache, use the EODatabase method invalidateResultCachedForEntityNamed(String name).

Returns:
true if all of the objects from the receiver are to be cached in memory.
See Also:
setCachesObjects(boolean flag), invalidateResultCachedForEntityNamed(String name)

sharedObjectFetchSpecificationNames

public NSArray<String> sharedObjectFetchSpecificationNames()
Returns an array of strings, which are the names of the fetch specifications used to load objects into a shared editing context. Returns an empty array if there are no shared object fetch specifications.

Returns:
An array of fetch specification names, or an empty array.

classNameWithoutPackage

public String classNameWithoutPackage()
Return the name of the Enterprise Object class associated with the receiver without the package information.

Returns:
See Also:
className()

classPackageName

public String classPackageName()
Return the package of the Enterprise Object class associated with the receive.

Returns:
See Also:
className()

className

public String className()
Returns the name of the Enterprise Object class associated with the receiver. When a row is fetched for the entity by a database-level object, it is returned as an instance of this class. This class might not be present in the runtime system, and in fact, the application may have to load it on demand. If the application doesn't load a class, EOGenericRecord is used. An Enterprise Object class other than EOGenericRecord can be mapped to only one entity.

Returns:
The name of the receiver's Enterprise Object class.

qualifierForPrimaryKey

public EOQualifier qualifierForPrimaryKey(NSDictionary<String,Object> row)
Returns a qualifier for the receiver that can be used to fetch an instance of the receiver with the primary key extracted from row. Throws an exception if the value of the primary key obtained from row is either null or NSKeyValueCoding.NullValue.

Parameters:
row - A primary key dictionary for a row in the database.
Returns:
A qualifier that can be used to fetch an instance of the receiver based on the primary key from row.
Throws:
IllegalArgumentException - if the primary key is null or NSKeyValueCoding.NullValue.
See Also:
isQualifierForPrimaryKey(EOQualifier aQualifier), restrictingQualifier()

isQualifierForPrimaryKey

public boolean isQualifierForPrimaryKey(EOQualifier qualifier)
Returns true if qualifier describes the primary key and nothing but the primary key, false otherwise. Throws a runtime exception if an error in encountered during evaluation; the error text indicates the nature of the exception.

Parameters:
qualifier - An EOQualifier object.
Returns:
true if qualifier describes only the primary key.

attributeNamed

public EOAttribute attributeNamed(String attributeName)
Returns the attribute named attributeName, or null if no such attribute exists in the receiver.

Parameters:
attributeName - The name of an attribute.
Returns:
The named attribute, or null.
See Also:
anyAttributeNamed(String attributeName), attributes(), relationshipNamed(String name)

attributes

public NSArray<EOAttribute> attributes()
Returns an array containing all of the receiver's attributes, or an empty array if the receiver has no attributes. Throws a runtime exception if an error in encountered during evaluation; the error text indicates the nature of the exception.

Returns:
An array of all of the receiver's attributes.
See Also:
anyAttributeNamed(String attributeName), attributeNamed(String attributeName)

indexes

public NSArray<EOEntityIndex> indexes()
/** Returns an array containing all of the receiver's indexs, or an empty array if the receiver has no indexes. Throws a runtime exception if an error in encountered during evaluation; the error text indicates the nature of the exception.

Returns:
An array of all of the receiver's indexes.
See Also:
indexNamed(String indexName)

indexNamed

public EOEntityIndex indexNamed(String indexName)
Returns the index identified by indexName, or null if the receiver has no such index.

Parameters:
indexName - The name of a relationship.
Returns:
The specified index or null.
See Also:
indexes()

relationshipNamed

public EORelationship relationshipNamed(String relationshipName)
Returns the relationship identified by relationshipName, or null if the receiver has no such relationship.

Parameters:
relationshipName - The name of a relationship.
Returns:
The specified relationship or null.
See Also:
anyRelationshipNamed(String relationshipName), attributeNamed(String attributeName), relationships()

propertyNamed

public EOProperty propertyNamed(String propertyName)
Returns the property identified by propertyName, or null if the receiver has no such property.

Parameters:
propertyName - The name of a property.
Returns:
The specified propertyName or null.

anyRelationshipNamed

public EORelationship anyRelationshipNamed(String relationshipName)
Returns the user-created relationship identified by relationshipName. If none exists, this method looks through the "hidden" relationships created by the Enterprise Objects Framework for one with the given name. If none is found, null is returned.

Parameters:
relationshipName - The name of a relationship.
Returns:
The named relationship, or null.
See Also:
relationshipNamed(String name), relationships()

anyAttributeNamed

public EOAttribute anyAttributeNamed(String name)
Returns the user-created attribute identified by name. If no such attribute exists, this method looks through the "hidden" attributes created by the Enterprise Objects Framework for one with the given name. Hidden attributes are used for such things as primary keys on target entities of flattened attributes. Returns null if no attribute with the given name is found.

Parameters:
name - The name of an attribute.
Returns:
The attribute specified by name, or null.
See Also:
attributeNamed(String attributeName), attributes()

fetchSpecificationNames

public NSArray<String> fetchSpecificationNames()
Returns an alphabetically sorted array of the names of the receiver's fetch specifications. Throws a runtime exception if an error is encountered during sorting; the error text indicates the nature of the exception.

Returns:
An alphabetized array of names of the receiver's fetch specifications.
See Also:
addFetchSpecification(EOFetchSpecification fetchSpec, String fetchSpecName), fetchSpecificationNamed(String fetchSpecName), removeFetchSpecificationNamed(String fetchSpecName)

fetchSpecificationNamed

public EOFetchSpecification fetchSpecificationNamed(String fetchSpecName)
Returns the fetch specification identified by fetchSpecName.

Parameters:
fetchSpecName - The name of a fetch specification.
Returns:
The fetch specification identified by fetchSpecName.
See Also:
addFetchSpecification(EOFetchSpecification fetchSpec, String fetchSpecName), fetchSpecificationNames(), removeFetchSpecificationNamed(String fetchSpecName)

relationships

public NSArray<EORelationship> relationships()
Returns an array containing all of the receiver's relationships or null if the receiver has none. Throws a runtime exception if an error is encountered during processing; the error text indicates the nature of the exception.

Returns:
An array of all of the receiver's relationships, or null.
See Also:
attributes()

classProperties

public NSArray<EOProperty> classProperties()
Returns an array containing the properties that are bound to the receiver's class (so that values corresponding to those properties are passed to instances of that class). This set of properties is a subset of the entity's attributes and relationships.

Returns:
An array of the properties that are bound to the receiver's class.
See Also:
classPropertyNames()

classPropertyNames

public NSArray classPropertyNames()
Returns an array containing the names of those properties that are bound to the receiver's class (so that values corresponding to those properties are passed to instances of that class). This set of properties is a subset of the entity's attributes and relationships.

Returns:
An array of the names of those properties that are bound to the receiver's class.
See Also:
classProperties()

clientClassName

public String clientClassName()
Returns the name of the client-side Enterprise Object class associated with the receiver. If no client-side class name has yet been registered for the receiver, this method returns the name of the receiving class (either EOEntity or a subclass of EOEntity).

Equivalent to the EOAccessAdditions method clientClassNameForEntity in the EOJavaClient Framework in WebObjects 4.5.x.

Returns:
The name of the client-side Enterprise Object class for the receiver.

clientClassProperties

public NSArray<EOProperty> clientClassProperties()
Returns an array containing the properties that are bound to the client-side class corresponding to the receiver. If no information about the client-side class's properties is available, this method returns the receiver's class properties. The properties returned by this method are the attributes and relationships that are used by the client. Only these attributes and relationships will be passed to the client.

Equivalent to the EOAccessAdditions method clientClassPropertiesForEntity in the EOJavaClient Framework in WebObjects 4.5.x.

Returns:
An array of the properties that are bound to the client-side class corresponding to the receiver.

clientClassPropertyNames

public NSArray clientClassPropertyNames()
Returns an array containing the names of the properties that are bound to the client-side class corresponding to the entity. If no information about the client-side class's properties is available, this method returns the names of the entity's class properties. The property names returned by this method are the attributes and relationships that are used by the client. Only these attributes and relationships will be passed to the client.

Equivalent to the EOAccessAdditions method clientClassPropertyNamesForEntity in the EOJavaClient Framework in WebObjects 4.5.x.

Returns:
An array of the names of the properties that are bound to the client-side class corresponding to the receiver.

attributesToFetch

public NSArray<EOAttribute> attributesToFetch()
Returns an array of the EOAttributes that need to be fetched so that they can be included in the row snapshot. The set of attributes includes:

Returns:
The array of attributes needed for the row snapshot.

primaryKeyAttributes

public NSArray<EOAttribute> primaryKeyAttributes()
Returns an array of those EOAttributes that make up the receiver's primary key.

Returns:
The array of attributes that make up the receiver's primary key.
See Also:
primaryKeyAttributeNames()

primaryKeyAttributeNames

public NSArray<String> primaryKeyAttributeNames()
Returns an array containing the names of the EOAttributes that make up the receiver's primary key.

Returns:
An array of the names of the attributes that make up the receiver's primary key.
See Also:
primaryKeyAttributes()

attributesUsedForLocking

public NSArray<EOAttribute> attributesUsedForLocking()
Returns an array containing those attributes used for locking, that is, those properties whose values must match a snapshot any time a row is updated. Attributes used for locking are those whose values are compared when a database-level object performs an update. When the database-level classes fetch an Enterprise Object, they cache these attributes' values in a snapshot. Later, when the Enterprise Object is updated, the values of these attributes in the object are checked against those in the snapshot. If they differ, the update fails.

Returns:
An array of the attributes used for locking.
See Also:
EODatabaseContext

primaryKeyForRow

public NSDictionary primaryKeyForRow(NSDictionary row)
Returns the primary key for row, or null if the primary key can't be computed. The primary key is a dictionary whose keys are attribute names and whose values are values for those attributes.

Parameters:
row - The dictionary of keys and values representing a database row.
Returns:
The primary key for row, or null.
See Also:
primaryKeyForGlobalID(EOGlobalID gid)

isValidAttributeUsedForLocking

public boolean isValidAttributeUsedForLocking(EOAttribute anAttribute)
Returns true if anAttribute can be used for locking, false otherwise. In order for an attribute to be valid for locking, it must be an attribute belonging to the receiver and must not be a derived attribute. Used to test the validity of an attribute for locking before passing it to setAttributesUsedForLocking.

Parameters:
anAttribute - An EOAttribute.
Returns:
true if the attribute can be used for locking.
See Also:
attributesUsedForLocking(), setAttributesUsedForLocking(NSArray attributes)

isValidPrimaryKeyAttribute

public boolean isValidPrimaryKeyAttribute(EOAttribute anAttribute)
Returns false if anAttribute isn't an EOAttribute, doesn't belong to the entity or is derived. Otherwise returns true.

Parameters:
anAttribute - the attribute to query
Returns:
false if anAttribute isn't an EOAttribute, doesn't belong to the entity, or is derived.
See Also:
setPrimaryKeyAttributes(NSArray keys)

isPrimaryKeyValidInObject

public boolean isPrimaryKeyValidInObject(NSKeyValueCoding object)
Returns true if every key attribute is present in object and has a value that is not null. Returns false otherwise. This method uses the EOKeyValueCoding interface so the object parameter may be a dictionary instead of an Enterprise Object.

Parameters:
object - The object to query.
Returns:
true if every key attribute in object is valid.
See Also:
primaryKeyForRow(NSDictionary aRow)

isValidClassProperty

public boolean isValidClassProperty(Object aProp)
Returns true if the property aProp is a valid class property of the receiver, false otherwise. To be a valid class property, a property must be an instance of EOAttribute or EORelationship.

Note that this method does not tell you whether aProp is a member of the array returned by the classProperties method. In other words, unlike classProperties, classPropertyNames, and setClassProperties, this method does not interact with the properties bound to the receiver's Enterprise Object class.

Parameters:
aProp - The property to query.
Returns:
true if aProp is a valid class property of the receiver.
See Also:
classProperties(), classPropertyNames(), setClassProperties(NSArray attributes)

userInfo

public NSDictionary<String,Object> userInfo()
Returns a dictionary of user data. The application can use this to store any auxiliary information it needs.

Returns:
A dictionary of arbitrary user data.
See Also:
setUserInfo(NSDictionary dictionary)

subEntities

public NSArray<EOEntity> subEntities()
Returns a list of those entities that inherit from the receiver, or an empty array if no entities inherit from the receiver.

Returns:
An array of the receiver's sub-entities, or an empty array.
See Also:
addSubEntity(EOEntity child), parentEntity(), removeSubEntity(EOEntity child)

parentEntity

public EOEntity parentEntity()
Returns the parent entity for the receiver, that is, the entity from which the receiver inherits.

Returns:
The receiver's parent entity.
See Also:
subEntities()

isAbstractEntity

public boolean isAbstractEntity()
Returns true if the receiver is an abstract entity, false otherwise. An abstract entity is one that has no corresponding Enterprise Objects in the application. Abstract entities are used to model inheritance relationships. For example, you might have a Person abstract entity that acts as the parent of Customer and Employee entities. Customer and Employee would inherit certain characteristics from Person (such as name and address attributes). However, though the application might have Customer and Employee objects, it would never have a Person object.

Returns:
true if the receiver is an abstract entity.
See Also:
setIsAbstractEntity(boolean flag)

maxNumberOfInstancesToBatchFetch

public int maxNumberOfInstancesToBatchFetch()
Returns the maximum number of to-one faults from the receiver to fire at one time.

Returns:
The maximum number of to-one faults to batch fetch.
See Also:
setMaxNumberOfInstancesToBatchFetch(int size)

encodeIntoPropertyList

public void encodeIntoPropertyList(NSMutableDictionary result)
Encodes the receiver as a property list.

Specified by:
encodeIntoPropertyList in interface EOPropertyListEncoding
Parameters:
result - A property list representation of the receiver.

awakeWithPropertyList

public void awakeWithPropertyList(NSDictionary pl)
EOEntity's implementation of this method does nothing.

Specified by:
awakeWithPropertyList in interface EOPropertyListEncoding
Parameters:
pl - The property list representation of an object.

globalIDForRow

public EOGlobalID globalIDForRow(NSDictionary row)
Constructs a unique global identifier for the receiver from the keys and values in the dictionary row, which represents a database row.

Parameters:
row - A dictionary representation of a database row from which to create an EOGlobalID for the receiver.
Returns:
A global identifier for the receiver.
See Also:
primaryKeyForGlobalID(com.webobjects.eocontrol.EOGlobalID globalID)

primaryKeyForGlobalID

public NSDictionary<String,Object> primaryKeyForGlobalID(EOGlobalID gid)
Returns the primary key for the object identified by gid, or null if gid is not an instance of EOKeyGlobalID.

Parameters:
gid - The unique identifier for an Enterprise Object.
Returns:
The primary key for the object identified by gid or null.
See Also:
globalIDForRow(NSDictionary row)

setClassProperties

public boolean setClassProperties(NSArray<EOProperty> attributes)
If all of the the EOAttributes in attributes are valid class properties of the receiver, sets attributes as the receiver's class properties and returns true. Otherwise returns false and leaves the currently-set class properties for the receiver unchanged.

Parameters:
attributes - An array of attributes to set as the receiver's class properties.
Returns:
true if attributes can be set as the receiver's class properties.
See Also:
isValidClassProperty(Object property)

setPrimaryKeyAttributes

public boolean setPrimaryKeyAttributes(NSArray<EOAttribute> attributes)
If all of the the EOAttributes in attributes are valid primary keys of the receiver, sets attributes as the receiver's primary keys and returns true. Otherwise returns false and leaves the currently-set primary keys for the receiver unchanged.

Primary key attributes should be chosen carefully. Floating-point numbers, for example, can not be reliably compared for equality, and thus are unsuitable for use in primary keys. Integer and string types are the safest choice for primary keys. BigDecimal objects can be used as primary keys, but entail more overhead than integers.

Parameters:
attributes - An array of attributes to be used as primary keys of the receiver.
Returns:
true if attribute can be set as the receiver's primary key attributes.
See Also:
isValidPrimaryKeyAttribute(EOAttribute anAttribute)

setAttributesUsedForLocking

public boolean setAttributesUsedForLocking(NSArray<EOAttribute> attributes)
If all of the the EOAttributes in attributes can be used by an EODatabaseChannel to lock Enterprise Objects for updates, sets attributes as the receiver's attributes used for locking and returns true. Otherwise returns false and leaves the receiver's currently-set attributes used for locking unchanged.

Parameters:
attributes - An array of attributes to be used for locking on the receiver.
Returns:
true if attributes can be set as the receiver's attributes used for locking.
See Also:
isValidAttributeUsedForLocking(EOAttribute anAttribute), EODatabase, EODatabaseContext, EODatabaseChannel

setName

public void setName(String name)
Sets the receiver's name to name.

Parameters:
name - The name to set for the receiver.
See Also:
beautifyName()

setExternalName

public void setExternalName(String string)
Sets the name of the receiver as understood by the database server (that is, the receiver's external name) to string. For example, though the application may know the receiver as "JobTitle", the database may require a form such as "JOB_TTL".

An adaptor uses the external name to communicate with the database; the application should never need to use the external name.

Parameters:
string - The external (database server) name for the receiver.

setExternalQuery

public void setExternalQuery(String string)
Assigns string as the query statement used for selecting rows from the entity when there is no qualifier. External queries are useful for hiding records or invoking database-specific features such as stored procedures when an application attempts to select all records for