
Classes | |
| class | ERXCustomObjectClazz< T extends EOEnterpriseObject > |
Public Member Functions | |
| boolean | _setUpdateInverseRelationships (boolean newValue) |
| void | addObjectsToBothSidesOfRelationshipWithKey (NSArray objects, String key) |
| void | addObjectToBothSidesOfRelationshipWithKey (EORelationshipManipulation eo, String key) |
| void | awakeFromClientUpdate (EOEditingContext editingContext) |
| void | awakeFromFetch (EOEditingContext editingContext) |
| void | awakeFromInsertion (EOEditingContext editingContext) |
| void | batchCheckConsistency () throws NSValidation.ValidationException |
| boolean | canDelete () |
| boolean | canUpdate () |
| NSDictionary | changesFromCommittedSnapshot () |
| void | checkConsistency () throws NSValidation.ValidationException |
| Object | committedSnapshotValueForKey (String key) |
| void | delete () |
| String | description () |
| void | didDelete (EOEditingContext ec) |
| void | didInsert () |
| void | didRevert (EOEditingContext ec) |
| void | didUpdate () |
| String | encryptedPrimaryKey () |
| void | flushCaches () |
| Object | foreignKeyForRelationshipWithKey (String rel) |
| Logger | getClassLog () |
| boolean | isDeletedEO () |
| boolean | isNewEO () |
| boolean | isNewObject () |
| EOEnterpriseObject | localInstanceIn (EOEditingContext ec) |
| EOEnterpriseObject | localInstanceOf (EOEnterpriseObject eo) |
| NSArray | localInstancesOf (NSArray eos) |
| void | mightDelete () |
| boolean | parentObjectStoreIsObjectStoreCoordinator () |
| String | primaryKey () |
| NSArray | primaryKeyAttributeNames () |
| NSDictionary | primaryKeyDictionary (boolean inTransaction) |
| String | primaryKeyInTransaction () |
| Object | rawPrimaryKey () |
| Object | rawPrimaryKeyInTransaction () |
| ERXEnterpriseObject | refetchObjectFromDBinEditingContext (EOEditingContext ec) |
| void | removeObjectsFromBothSidesOfRelationshipWithKey (NSArray objects, String key) |
| void | removeObjectsFromPropertyWithKey (NSArray objects, String key) |
| ERXEnterpriseObject | self () |
| void | takeStoredValueForKey (Object value, String key) |
| void | takeValueForKey (Object value, String key) |
| String | toLongString () |
| String | toString () |
| void | trimSpaces () |
| void | validateForDelete () throws NSValidation.ValidationException |
| void | validateForInsert () throws NSValidation.ValidationException |
| void | validateForSave () throws NSValidation.ValidationException |
| void | validateForUpdate () throws NSValidation.ValidationException |
| Object | validateValueForKey (Object value, String key) throws NSValidation.ValidationException |
| void | willDelete () throws NSValidation.ValidationException |
| void | willInsert () |
| void | willRevert () |
| void | willUpdate () |
Static Public Member Functions | |
| static boolean | shouldTrimSpaces () |
| static boolean | usesDeferredFaultCreation () |
Public Attributes | |
| String | insertionStackTrace = null |
Protected Member Functions | |
| void | excludeObjectFromPropertyWithKey (Object o, String key) |
| void | includeObjectIntoPropertyWithKey (Object o, String key) |
| void | init (EOEditingContext ec) |
Protected Attributes | |
| String | _primaryKey = null |
| boolean | wasInitialized |
Private Member Functions | |
| boolean | _checkEditingContextDelegate (EOEditingContext editingContext) |
Private Attributes | |
| NSDictionary | _primaryKeyDictionary |
| boolean | _updateInverseRelationships = ERXGenericRecord.InverseRelationshipUpdater.updateInverseRelationships() |
Static Private Attributes | |
| static final NSMutableDictionary< Class, Logger > | classLogs = new NSMutableDictionary<Class, Logger>() |
willUpdate and didDelete and a bunch of handy utility methods like committedSnapshotValueForKey . At the moment it is required that those wishing to take advantage of templatized and localized validation exceptions need to subclass this class. Hopefully in the future we can get rid of this requirement. Also, this class supports auto-updating of inverse relationships. You can simply call eo.setFoo(other), eo.takeValueForKey(other), eo.addObjectToBothSidesOfRelationshipWithKey(other, "foo") or eo.addToFoos(other) and the inverse relationship will get updated for you automagically, so that you don't need to call other.addToBars(eo) or other.setBar(eo). Doing so doesn't hurt, though. Giving a null value of removing the object from a to-many will result in the inverse relationship getting cleared. er.extensions.ERXEnterpriseObject.updateInverseRelationships=true. | boolean _checkEditingContextDelegate | ( | EOEditingContext | editingContext | ) | [private] |
By default, and this should change in the future, all editing contexts that are created and use ERXEnterpriseObjects or subclasses need to have a delegate set of instance ERXEditingContextDelegate. These delegates provide the augmentation to the regular transaction mechanism, all of the will* methods plus the flushCaching method. To change the default behaviour set the property: er.extensions.ERXRaiseOnMissingEditingContextDelegate to false in your WebObjects.properties file. This method is called when an object is fetched, updated or inserted.
| editingContext | to check for the correct delegate. |
| boolean _setUpdateInverseRelationships | ( | boolean | newValue | ) | [virtual] |
Toggles whether or not inverse relationships should be updates. This is called by ERXGenericRecord.InverseRelationshipUpdater to prevent infinite loops and should not be called by anything else unless you know exactly what you are doing.
| newValue | whether or not inverse relationships should be updated |
Implements ERXEnterpriseObject.
| void addObjectsToBothSidesOfRelationshipWithKey | ( | NSArray | objects, | |
| String | key | |||
| ) | [virtual] |
Adds a collection of objects to a given relationship by calling addObjectToBothSidesOfRelationshipWithKey for all objects in the collection.
| objects | objects to add to both sides of the given relationship | |
| key | relationship key |
Implements ERXEnterpriseObject.
| void addObjectToBothSidesOfRelationshipWithKey | ( | EORelationshipManipulation | eo, | |
| String | key | |||
| ) |
Adds a check to make sure that both the object being added and this object are in the same editing context. If not then a runtime exception is thrown instead of getting the somewhat cryptic NSInternalInconsistency excpetion that is thrown when you attempt to save changes to the database.
| eo | enterprise object to be added to the relationship | |
| key | relationship to add the object to. |
| void awakeFromClientUpdate | ( | EOEditingContext | editingContext | ) |
Checks the editing context delegate before calling super's implementation. See the method _checkEditingContextDelegate for an explanation as to what this check does.
| editingContext | to be checked to make sure it has the correct type of delegate set. |
| void awakeFromFetch | ( | EOEditingContext | editingContext | ) |
Checks the editing context delegate before calling super's implementation. See the method _checkEditingContextDelegate for an explanation as to what this check does.
| editingContext | to be checked to make sure it has the correct type of delegate set. |
| void awakeFromInsertion | ( | EOEditingContext | editingContext | ) |
Checks the editing context delegate before calling super's implementation. See the method _checkEditingContextDelegate for an explanation as to what this check does.
| editingContext | to be checked to make sure it has the correct type of delegate set. |
| void batchCheckConsistency | ( | ) | throws NSValidation.ValidationException [virtual] |
This method is very similar to the checkConsistency method except that this method is only called from an outside process, usually a batch process, to verify that the data this object holds is consistent. JUnit tests are great for testing that all of the methods of a single object function correctly, batch checking of consistency is a good way of checking that all of the data in a given database is consistent. Hopefully in the future we will add a batch check consistency application to demonstrate the use of this method.
| NSValidation.ValidationException | if the object fails consistency |
Implements ERXEnterpriseObject.
| boolean canDelete | ( | ) |
Implementation of ERXGuardedObjectInterface. This is checked before the object is deleted in the willDelete method which is in turn called by ERXEditingContextDelegate. The default implementation returns true.
Implements ERXGuardedObjectInterface.
| boolean canUpdate | ( | ) |
Implementation of ERXGuardedObjectInterface. This is checked before the object is deleted in the willUpdate method which is in turn called by ERXEditingContextDelegate. The default implementation returns true.
Implements ERXGuardedObjectInterface.
| NSDictionary changesFromCommittedSnapshot | ( | ) | [virtual] |
Computes the current set of changes that this object has from the currently committed snapshot.
Implements ERXEnterpriseObject.
| void checkConsistency | ( | ) | throws NSValidation.ValidationException [virtual] |
Debugging method that will be called on an object before it is saved to the database if the property key: ERDebuggingEnabled is enabled. This allows for adding in a bunch of expensive validation checks that should only be enabled in development and testing environments.
| NSValidation.ValidationException | if the object is not consistent |
Implements ERXEnterpriseObject.
| Object committedSnapshotValueForKey | ( | String | key | ) | [virtual] |
Determines what the value of the given key is in the committed snapshot
| key | to be checked in committed snapshot |
Implements ERXEnterpriseObject.
| void delete | ( | ) |
Implementation of ERXGuardedObjectInterface. This is used to work around a bug in EOF that doesn't refresh the relationship in the parent editingContext for the object.
Implements ERXGuardedObjectInterface.
| String description | ( | ) | [virtual] |
Cover method to return toString.
Implements ERXEnterpriseObject.
| void didDelete | ( | EOEditingContext | ec | ) | [virtual] |
Called on the object after is has been deleted. The editing context is passed to the object since by this point the editingContext of the object is null. You should check if the ec is a child context when doing something here that can't be undone.
| ec | editing context that used to be associated with the object. |
Implements ERXEnterpriseObject.
| void didInsert | ( | ) | [virtual] |
Called on the object after is has successfully been inserted into the database.
Implements ERXEnterpriseObject.
| void didRevert | ( | EOEditingContext | ec | ) | [virtual] |
Called on the object after it has been reverted. The editing context is passed to the object because if the object was in the insertedObjects list before the revert, the object has had its editingContext nulled.
Default implementation calls flushCaches.
| ec | editing context that is either currently associated with the object if the object was marked as changed or deleted before the revert, otherwise the editing context that was associated with the object before the revert. |
Implements ERXEnterpriseObject.
| void didUpdate | ( | ) | [virtual] |
Called on the object after is has successfully been updated in the database.
Implements ERXEnterpriseObject.
| String encryptedPrimaryKey | ( | ) | [virtual] |
Takes the primary key of the object and encrypts it with the blowfish cipher using ERXCrypto.
Implements ERXEnterpriseObject.
| void excludeObjectFromPropertyWithKey | ( | Object | o, | |
| String | key | |||
| ) | [protected] |
Overridden to support two-way relationship setting.
| void flushCaches | ( | ) | [virtual] |
This is called when an object has had changes merged into it by the editing context. This is called by ERXDefaultEditingContextDelegate after it merges changes. Any caches that an object keeps based on any of it's values it should flush. The default implementation of this method does nothing.
Implements ERXEnterpriseObject.
| Object foreignKeyForRelationshipWithKey | ( | String | rel | ) | [virtual] |
Returns the foreign key for a given relationship.
| rel | relationship key |
Implements ERXEnterpriseObject.
| Logger getClassLog | ( | ) | [virtual] |
This methods checks if we already have created an Logger for this class If not, one will be created, stored and returned on next request. This method eliminates individual static variables for Logger's in all subclasses. We use an NSDictionary here because static fields are class specific and thus something like lazy initialization would not work in this case.
Implements ERXEnterpriseObject.
| void includeObjectIntoPropertyWithKey | ( | Object | o, | |
| String | key | |||
| ) | [protected] |
Overridden to support two-way relationship setting.
| void init | ( | EOEditingContext | ec | ) | [protected] |
used for initialization stuff instead of awakeFromInsertion. awakeFromInsertions is buggy because if an EO is deleted and then its EOEditingContext is reverted using 'revert' for example then EOF will -insert- this EO again in its EOEditingContext which in turn calls awakeFromInsertion again.
| ec | the EOEditingContext in which this new EO is inserted |
| boolean isDeletedEO | ( | ) | [virtual] |
Determines if this object is a deleted object by checking to see if it is included in the deletedObjects array of the editing context or - if it's editing context is null - it already has a global id.
Implements ERXEnterpriseObject.
| boolean isNewEO | ( | ) |
| boolean isNewObject | ( | ) | [virtual] |
Determines if this object is a new object and hasn't been saved to the database yet. This method just calls the method ERExtensions.isNewObject passing in this object as the current parameter. Note that an object that has been successfully deleted will also look as if it is a new object because it will have a null editing context.
Implements ERXEnterpriseObject.
| EOEnterpriseObject localInstanceIn | ( | EOEditingContext | ec | ) | [virtual] |
Returns this EO in the supplied editing context.
Implements ERXEnterpriseObject.
| EOEnterpriseObject localInstanceOf | ( | EOEnterpriseObject | eo | ) | [virtual] |
Returns an EO in the same editing context as the caller.
Implements ERXEnterpriseObject.
| NSArray localInstancesOf | ( | NSArray | eos | ) | [virtual] |
Returns an array of EOs in the same editing context as the caller.
Implements ERXEnterpriseObject.
| void mightDelete | ( | ) | [virtual] |
Called as part of the augmented transaction process. This method is called when deleteObject() is called on the editing context. The benefit over willDelete() is that in this method, the relationships are still intact. Mostly, at least, as it's also called when the deletes cascade.
Implements ERXEnterpriseObject.
| boolean parentObjectStoreIsObjectStoreCoordinator | ( | ) | [virtual] |
Simple method that will return if the parent object store of this object's editing context is an instance of EOObjectStoreCoordinator. The reason this is important is because if this condition evaluates to true then when changes are saved in this editing context they will be propagated to the database.
Implements ERXEnterpriseObject.
| String primaryKey | ( | ) | [virtual] |
Primary key of the object as a String.
Implements ERXEnterpriseObject.
| NSArray primaryKeyAttributeNames | ( | ) | [virtual] |
Returns the names of all primary key attributes.
Implements ERXEnterpriseObject.
| NSDictionary primaryKeyDictionary | ( | boolean | inTransaction | ) |
Implementation of the interface ERXGeneratesPrimaryKeyInterface. This implementation operates in the following fashion. If it is called passing in 'false' and it has not yet been saved to the database, meaning this object does not yet have a primary key assigned, then it will have the adaptor channel generate a primary key for it. Then when the object is saved to the database it will use the previously generated primary key instead of having the adaptor channel generate another primary key. If 'true' is passed in then this method will either return the previously generated primaryKey dictionary or null if it does not have one. Typically you should only call this method with the 'false' parameter seeing as unless you are doing something really funky you won't be dealing with this object when it is in the middle of a transaction. The delegate ERXDatabaseContextDelegate is the only class that should be calling this method and passing in 'true'.
| inTransaction | boolean flag to tell the object if it is currently in the middle of a transaction. |
Implements ERXGeneratesPrimaryKeyInterface.
| String primaryKeyInTransaction | ( | ) | [virtual] |
Calling this method will return the primary key of the given enterprise object or if one has not been assigned to it yet, then it will have the adaptor channel generate one for it, cache it and then use that primary key when it is saved to the database. This method returns the string representation of the primary key. If you just want the primary key of the object or null if it doesn't have one yet, use the method primaryKey.
Implements ERXEnterpriseObject.
| Object rawPrimaryKey | ( | ) | [virtual] |
Gives the raw primary key of the object. This could be anything from an NSData to a BigDecimal.
Implements ERXEnterpriseObject.
| Object rawPrimaryKeyInTransaction | ( | ) | [virtual] |
Calling this method will return the primary key of the given enterprise object or if one has not been assigned to it yet, then it will have the adaptor channel generate one for it, cache it and then use that primary key when it is saved to the database. If you just want the primary key of the object or null if it doesn't have one yet, use the method rawPrimaryKey.
Implements ERXEnterpriseObject.
| ERXEnterpriseObject refetchObjectFromDBinEditingContext | ( | EOEditingContext | ec | ) | [virtual] |
Method that will make sure to fetch an eo from the Database and place it in the editingContext provided as an argument
| ec | the editing context in which the result will be placed |
Implements ERXEnterpriseObject.
| void removeObjectsFromBothSidesOfRelationshipWithKey | ( | NSArray | objects, | |
| String | key | |||
| ) | [virtual] |
Removes a collection of objects to a given relationship by calling removeObjectFromBothSidesOfRelationshipWithKey for all objects in the collection.
| objects | objects to be removed from both sides of the given relationship | |
| key | relationship key |
Implements ERXEnterpriseObject.
| void removeObjectsFromPropertyWithKey | ( | NSArray | objects, | |
| String | key | |||
| ) | [virtual] |
Removes a collection of objects to a given relationship by calling removeObjectFromPropertyWithKey for all objects in the collection.
| objects | objects to be removed from both sides of the given relationship | |
| key | relationship key |
Implements ERXEnterpriseObject.
| ERXEnterpriseObject self | ( | ) | [virtual] |
self is usefull for directtoweb purposes
Implements ERXEnterpriseObject.
| static boolean shouldTrimSpaces | ( | ) | [static] |
| void takeStoredValueForKey | ( | Object | value, | |
| String | key | |||
| ) |
| void takeValueForKey | ( | Object | value, | |
| String | key | |||
| ) |
| String toLongString | ( | ) | [virtual] |
Returns the super classes implementation of toString which prints out the current key-value pairs for all of the attributes and relationships for the current object. Very verbose.
toString. Implements ERXEnterpriseObject.
| String toString | ( | ) |
Overrides the EOGenericRecord's implementation to provide a slightly less verbose output. A typical output for an object mapped to the class com.foo.User with a primary key of 50 would look like: <com.foo.User pk:"50"> EOGenericRecord's implementation is preserved in the method toLongString. To restore the original verbose logging in your subclasses override this method and return toLongString.
| void trimSpaces | ( | ) | [virtual] |
This method will trim the leading and trailing white space from any attributes that are mapped to a String object. This method is called before the object is saved to the database. Override this method to do nothing if you wish to preserve your leading and trailing white space.
Implements ERXEnterpriseObject.
| static boolean usesDeferredFaultCreation | ( | ) | [static] |
| void validateForDelete | ( | ) | throws NSValidation.ValidationException |
Calls up validateForUpdate() on the class description if it supports it.
| NSValidation.ValidationException | if the object does not pass validation for saving to the database. |
| void validateForInsert | ( | ) | throws NSValidation.ValidationException |
Calls up validateForInsert() on the class description if it supports it.
| NSValidation.ValidationException | if the object does not pass validation for saving to the database. |
| void validateForSave | ( | ) | throws NSValidation.ValidationException |
This method performs a few checks before invoking super's implementation. If the property key: ERDebuggingEnabled is set to true then the method checkConsistency will be called on this object.
| NSValidation.ValidationException | if the object does not pass validation for saving to the database. |
| void validateForUpdate | ( | ) | throws NSValidation.ValidationException |
Calls up validateForUpdate() on the class description if it supports it.
| NSValidation.ValidationException | if the object does not pass validation for saving to the database. |
| Object validateValueForKey | ( | Object | value, | |
| String | key | |||
| ) | throws NSValidation.ValidationException |
Overrides the default validation mechanisms to provide a few checks before invoking super's implementation, which incidently just invokes validateValueForKey on the object's class description. The class description for this object should be an ERXEntityClassDescription or subclass. It is that class that provides the hooks to convert model throw validation exceptions into ERXValidationException objects.
| value | to be validated for a given attribute or relationship | |
| key | corresponding to an attribute or relationship |
| NSValidation.ValidationException | if the value fails validation |
| void willDelete | ( | ) | throws NSValidation.ValidationException [virtual] |
Called as part of the augmented transaction process. This method is called after saveChanges is called on the editing context, but before the object is actually deleted from the database. This method is also called before validateForDelete is called on this object. This method is called by the editing context delegate ERXDefaultEditingContextDelegate.
| NSValidation.ValidationException | to stop the object from being deleted. |
Implements ERXEnterpriseObject.
| void willInsert | ( | ) | [virtual] |
Called as part of the augmented transaction process. This method is called after saveChanges is called on the editing context, but before the object is actually inserted into the database. This method is also called before validateForInsert is called on this object. This method is called by the editing context delegate ERXDefaultEditingContextDelegate.
Implements ERXEnterpriseObject.
| void willRevert | ( | ) | [virtual] |
Called on the object before it will be reverted.
Default implementation does nothing other than log.
Implements ERXEnterpriseObject.
| void willUpdate | ( | ) | [virtual] |
Called as part of the augmented transaction process. This method is called after saveChanges is called on the editing context, but before the object is actually updated in the database. This method is also called before validateForSave is called on this object. This method is called by the editing context delegate ERXDefaultEditingContextDelegate.
Implements ERXEnterpriseObject.
String _primaryKey = null [protected] |
NSDictionary _primaryKeyDictionary [private] |
caches the primary key dictionary for the given object
boolean _updateInverseRelationships = ERXGenericRecord.InverseRelationshipUpdater.updateInverseRelationships() [private] |
final NSMutableDictionary<Class, Logger> classLogs = new NSMutableDictionary<Class, Logger>() [static, private] |
holds all subclass related Logger's
boolean wasInitialized [protected] |
1.5.8