Project Wonder 5.0

er.extensions.eof
Class ERXGenericRecord

java.lang.Object
  extended by com.webobjects.eocontrol.EOCustomObject
      extended by com.webobjects.eocontrol.EOGenericRecord
          extended by er.extensions.eof.ERXGenericRecord
All Implemented Interfaces:
com.webobjects.eocontrol._EOPrivateMemento, com.webobjects.eocontrol.EODeferredFaulting, com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOFaulting, com.webobjects.eocontrol.EOKeyValueCoding, com.webobjects.eocontrol.EOKeyValueCoding._BestBindingCreation._ForwardingBindingCheck, com.webobjects.eocontrol.EOKeyValueCoding._KeyBindingCreation, com.webobjects.eocontrol.EOKeyValueCodingAdditions, com.webobjects.eocontrol.EORelationshipManipulation, com.webobjects.eocontrol.EOValidation, com.webobjects.foundation.NSKeyValueCoding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation.Callback, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCodingAdditions, com.webobjects.foundation.NSValidation, ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject, ERXEnterpriseObject, ERXGeneratesPrimaryKeyInterface, ERXGuardedObjectInterface, ERXKey.ValueCoding, ERXNonNullObjectInterface, java.io.Serializable
Direct Known Subclasses:
_Bug, _Comment, _Component, _Difficulty, _ERAttachment, _ERAttachmentData, _ERCAuditBlob, _ERCAuditTrail, _ERCAuditTrailEntry, _ERCHelpText, _ERCLogEntry, _ERCMailMessage, _ERCMessageAttachment, _ERCPreference, _ERCStatic, _ERIAttribute, _ERIAttributeGroup, _ERIAttributeType, _ERIDirectory, _ERIFile, _ERIFileContent, _ERIValidationRule, _ERTag, _Framework, _People, _Priority, _Release, _RequirementSubType, _RequirementType, _TestItem, _TestItemState, ERCStampedEnterpriseObject, ERXPartialGenericRecord

public class ERXGenericRecord
extends com.webobjects.eocontrol.EOGenericRecord
implements ERXGuardedObjectInterface, ERXGeneratesPrimaryKeyInterface, ERXEnterpriseObject, ERXKey.ValueCoding, ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject, ERXNonNullObjectInterface

This class contains a bunch of extensions to the regular EOGenericRecord class. Of notable interest is:

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.
If you *do* call addToBars(), you need to use includeObjectIntoPropertyWithKey() in this method.
This feature should greatly help readability and reduce the number errors you make when you forget to update an inverse relationship. To turn this feature on, you must set the system default er.extensions.ERXEnterpriseObject.updateInverseRelationships=true.

See Also:
Serialized Form

Nested Class Summary
static class ERXGenericRecord.ERXGenericRecordClazz<T extends com.webobjects.eocontrol.EOEnterpriseObject>
          Clazz object implementation for ERXGenericRecord.
static class ERXGenericRecord.InverseRelationshipUpdater
          Provides automatic inverse relationship updating for ERXGenericRecord and ERXCustomObject.
static class ERXGenericRecord.LocalizedBinding
          Special binding for localized key support.
static class ERXGenericRecord.TouchingBinding
          Special binding that touches the target of a relationship.
 
Nested classes/interfaces inherited from class com.webobjects.eocontrol.EOGenericRecord
com.webobjects.eocontrol.EOGenericRecord._DictionaryBinding, com.webobjects.eocontrol.EOGenericRecord._LazyDictionaryBinding
 
Nested classes/interfaces inherited from class com.webobjects.eocontrol.EOCustomObject
com.webobjects.eocontrol.EOCustomObject._BooleanFieldBinding, com.webobjects.eocontrol.EOCustomObject._FieldBinding, com.webobjects.eocontrol.EOCustomObject._LazyFieldBinding, com.webobjects.eocontrol.EOCustomObject._NumberFieldBinding
 
Nested classes/interfaces inherited from interface er.extensions.eof.ERXEnterpriseObject
ERXEnterpriseObject.Observer, ERXEnterpriseObject.Processor
 
Nested classes/interfaces inherited from interface com.webobjects.eocontrol.EOKeyValueCodingAdditions
com.webobjects.eocontrol.EOKeyValueCodingAdditions.DefaultImplementation, com.webobjects.eocontrol.EOKeyValueCodingAdditions.Utility
 
Nested classes/interfaces inherited from interface com.webobjects.eocontrol.EOKeyValueCoding
com.webobjects.eocontrol.EOKeyValueCoding._BestBindingCreation, com.webobjects.eocontrol.EOKeyValueCoding._KeyBindingCreation, com.webobjects.eocontrol.EOKeyValueCoding._StoredForwardingBinding
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.Null, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSValidation
com.webobjects.foundation.NSValidation._MethodBinding, com.webobjects.foundation.NSValidation._ValidationBinding, com.webobjects.foundation.NSValidation.ValidationException
 
Nested classes/interfaces inherited from interface com.webobjects.eocontrol._EOPrivateMemento
com.webobjects.eocontrol._EOPrivateMemento.DefaultImplementation
 
Field Summary
protected  java.lang.String _primaryKey
           
 com.webobjects.eocontrol.EOGlobalID _touchSource
          Which GID touched us
protected  java.lang.String insertionStackTrace
           
 
Fields inherited from class com.webobjects.eocontrol.EOGenericRecord
_CLASS
 
Fields inherited from interface er.extensions.eof.ERXEnterpriseObject
applyRestrictingQualifierOnInsert, DidDeleteProcessor, DidInsertProcessor, DidRevertProcessor, DidUpdateProcessor, FlushCachesProcessor, insertionTrackingLog, KEY_MARKER, log, logMod, tranLogDidDelete, tranLogDidInsert, tranLogDidRevert, tranLogDidUpdate, tranLogMightDelete, tranLogWillDelete, tranLogWillInsert, tranLogWillRevert, tranLogWillUpdate, validation, validationException, WillDeleteProcessor, WillInsertProcessor, WillRevertProcessor, WillUpdateProcessor
 
Fields inherited from interface com.webobjects.eocontrol.EOEnterpriseObject
_CLASS
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
_KeyPathSeparatorChar, KeyPathSeparator
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
Constructor Summary
ERXGenericRecord()
           
ERXGenericRecord(com.webobjects.eocontrol.EOClassDescription classDescription)
           
 
Method Summary
 com.webobjects.foundation.NSKeyValueCoding._KeyBinding _otherStorageBinding(java.lang.String key)
           
 void _setPrimaryKeyDictionary(com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Object> pkDict)
          Sets the primary key dictionary for this EO (key = attribute name, value = pk value).
 boolean _setUpdateInverseRelationships(boolean newValue)
          Toggles whether or not inverse relationships should be updates.
 void _setValueForPrimaryKey(java.lang.Object value, java.lang.String pkAttributeName)
          Sets the value for the primary key attribute with the given name.
protected  boolean _updateInverseRelationships()
           
protected  java.lang.Object _validateValueForKey(java.lang.Object value, java.lang.String key)
           
 void addObjectsToBothSidesOfRelationshipWithKey(com.webobjects.foundation.NSArray objects, java.lang.String key)
          Adds a collection of objects to a given relationship by calling addObjectToBothSidesOfRelationshipWithKey for all objects in the collection.
 void addObjectToBothSidesOfRelationshipWithKey(com.webobjects.eocontrol.EORelationshipManipulation eo, java.lang.String key)
          Adds a check to make sure that both the object being added and this object are in the same editing context.
protected  boolean applyRestrictingQualifierOnInsert()
           
 void awakeFromClientUpdate(com.webobjects.eocontrol.EOEditingContext editingContext)
          Checks the editing context delegate before calling super's implementation.
 void awakeFromFetch(com.webobjects.eocontrol.EOEditingContext editingContext)
          Checks the editing context delegate before calling super's implementation.
 void awakeFromInsertion(com.webobjects.eocontrol.EOEditingContext editingContext)
          Checks the editing context delegate before calling super's implementation.
 void batchCheckConsistency()
          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.
 java.lang.String batchFaultingRelationshipName()
          The key that touched us
 com.webobjects.eocontrol.EOGlobalID batchFaultingSourceGlobalID()
          The source EO that touched us
 long batchFaultingTimeStamp()
          The fetch time for this object
 boolean canDelete()
          Implementation of ERXGuardedObjectInterface.
 boolean canUpdate()
          Implementation of ERXGuardedObjectInterface.
 com.webobjects.foundation.NSDictionary changesFromCommittedSnapshot()
          Computes the current set of changes that this object has from the currently committed snapshot.
 void checkConsistency()
          Debugging method that will be called on an object before it is saved to the database if the property key: ERDebuggingEnabled is enabled.
static void checkMatchingEditingContexts(com.webobjects.eocontrol.EOEnterpriseObject source, java.lang.String relationshipName, com.webobjects.eocontrol.EOEnterpriseObject destination)
          Checks that the editing contexts in source and destination matches and throws an exception if they do not.
 void clearProperties()
           
 com.webobjects.foundation.NSDictionary committedSnapshot()
          This method exists because EOEditingContext.committedSnapshotForObject() gives unexpected results for newly inserted objects if EOEditingContext.processRecentChanges() has been called.
 java.lang.Object committedSnapshotValueForKey(java.lang.String key)
          Determines what the value of the given key is in the committed snapshot
 void delete()
          Implementation of ERXGuardedObjectInterface.
 java.lang.String description()
          Cover method to return toString.
 void didCopyFromChildInEditingContext(ERXGenericRecord originalEO, com.webobjects.eocontrol.EOEditingContext childEditingContext)
          Called when this EO is saved from a child editing context into a parent editing context.
 void didDelete(com.webobjects.eocontrol.EOEditingContext ec)
          Called on the object after is has been deleted.
 void didInsert()
          Called on the object after is has successfully been inserted into the database.
 void didRevert(com.webobjects.eocontrol.EOEditingContext ec)
          Called on the object after it has been reverted.
 void didUpdate()
          Called on the object after is has successfully been updated in the database.
 java.lang.String encryptedPrimaryKey()
          Takes the primary key of the object and encrypts it with the blowfish cipher using ERXCrypto.
 com.webobjects.eoaccess.EOEntity entity()
          Returns the entity for the current object.
 void excludeObjectFromPropertyWithKey(java.lang.Object o, java.lang.String key)
          Overridden to support two-way relationship setting.
 void flushCaches()
          This is called when an object has had changes merged into it by the editing context.
 java.lang.Object foreignKeyForRelationshipWithKey(java.lang.String rel)
          Returns the foreign key for a given relationship.
 org.apache.log4j.Logger getClassLog()
          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.
 boolean hasKeyChangedFromCommittedSnapshot(java.lang.String key)
          Returns whether or not the given key has changed when compared to the committed snapshot.
 boolean hasKeyChangedFromCommittedSnapshotFromValue(java.lang.String key, java.lang.Object oldValue)
          Returns whether or not the given key has changed from the given committed value.
 boolean hasKeyChangedFromCommittedSnapshotFromValueToNewValue(java.lang.String key, java.lang.Object oldValue, java.lang.Object newValue)
          Returns whether or not the given key has changed from the given previous value to the new value since the committed value.
 boolean hasKeyChangedFromCommittedSnapshotToValue(java.lang.String key, java.lang.Object newValue)
          Returns whether or not the given key has changed to the new value since the committed value.
 void includeObjectIntoPropertyWithKey(java.lang.Object o, java.lang.String key)
          Overridden to support two-way relationship setting.
protected  void init(com.webobjects.eocontrol.EOEditingContext ec)
          used for initialization stuff instead of awakeFromInsertion.
 boolean isDeletedEO()
          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.
 boolean isNewEO()
          Deprecated. use ERXGenericRecord#isNewObject
 boolean isNewObject()
          Determines if this object is a new object and hasn't been saved to the database yet.
 java.lang.Boolean isNonNull()
           
 boolean isUpdatedObject()
          Returns true if this EO has been modified in this editing context.
 boolean isValidatedWhenNested()
          Returns whether or not this object is validated when it is committed in a nested editing context.
 com.webobjects.foundation.NSArray<java.lang.String> localesForKey(java.lang.String key)
          Returns all available ERXLanguages for the given key
 com.webobjects.eocontrol.EOEnterpriseObject localInstanceIn(com.webobjects.eocontrol.EOEditingContext ec)
          Returns this EO in the supplied editing context.
 com.webobjects.eocontrol.EOEnterpriseObject localInstanceOf(com.webobjects.eocontrol.EOEnterpriseObject eo)
          Returns an EO in the same editing context as the caller.
 com.webobjects.foundation.NSArray localInstancesOf(com.webobjects.foundation.NSArray eos)
          Returns an array of EOs in the same editing context as the caller.
static boolean localizationShouldFallbackToDefaultLanguage()
           
 void mightDelete()
          Called as part of the augmented transaction process.
 boolean parentObjectStoreIsObjectStoreCoordinator()
          Simple method that will return if the parent object store of this object's editing context is an instance of EOObjectStoreCoordinator.
 com.webobjects.eocontrol.EOKeyGlobalID permanentGlobalID()
          Calls permanentGlobalID(boolean) passing true for generateIfMissing.
 com.webobjects.eocontrol.EOKeyGlobalID permanentGlobalID(boolean generateIfMissing)
          This method allows you to compute what the permanent EOGlobalID will be for an object before it has been saved to the database.
 java.lang.String primaryKey()
          Primary key of the object as a String.
 com.webobjects.foundation.NSArray<java.lang.String> primaryKeyAttributeNames()
          Returns the names of all primary key attributes.
 com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Object> primaryKeyDictionary(boolean inTransaction)
          Implementation of the interface ERXGeneratesPrimaryKeyInterface.
 java.lang.String primaryKeyInTransaction()
          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.
 java.lang.Object rawPrimaryKey()
          Gives the raw primary key of the object.
 java.lang.Object rawPrimaryKeyInTransaction()
          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.
 ERXEnterpriseObject refetchObjectFromDB()
          Calls the method refetchObjectFromDBinEditingContext(EOEditingContext ec) and passes the object's Editing Context as Editing Context parameter.
 ERXEnterpriseObject refetchObjectFromDBinEditingContext(com.webobjects.eocontrol.EOEditingContext ec)
          Method that will make sure to fetch an eo from the Database and place it in the editingContext provided as an argument
 void removeObjectsFromBothSidesOfRelationshipWithKey(com.webobjects.foundation.NSArray objects, java.lang.String key)
          Removes a collection of objects to a given relationship by calling removeObjectFromBothSidesOfRelationshipWithKey for all objects in the collection.
 void removeObjectsFromPropertyWithKey(com.webobjects.foundation.NSArray objects, java.lang.String key)
          Removes a collection of objects to a given relationship by calling removeObjectFromPropertyWithKey for all objects in the collection.
 ERXEnterpriseObject self()
          self is usefull for directtoweb purposes
 void setBatchFaultingTimestamp(long timestamp)
          Touches this EO from a fetch.
 void setValidatedWhenNested(boolean validatedWhenNested)
          If false, when this object is committed into a nested editingContext and it exists in the parent editing context, validation will be skipped.
static boolean shouldTrimSpaces()
           
 void takeStoredValueForKey(java.lang.Object value, java.lang.String key)
           
<T> void
takeValueForKey(java.lang.Object value, ERXKey<T> key)
          Type-safe KVC setter (final for now)
 void takeValueForKey(java.lang.Object value, java.lang.String key)
          Overridden to support two-way relationship setting.
 java.lang.String toLongString()
          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.
 java.lang.String toString()
          Overrides the EOGenericRecord's implementation to provide a slightly less verbose output.
 void touchFromBatchFaultingSource(ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject toucher, java.lang.String key)
          Touches this EO with the given source and the given key.
 void trimSpaces()
          This method will trim the leading and trailing white space from any attributes that are mapped to a String object.
 void updateFromSnapshot(com.webobjects.foundation.NSDictionary snapshot)
          This method explicitly turns off inverse relationship updating, because it's only called during undo and revert inside of EOF.
 void validateForInsert()
          Calls up validateForInsert() on the class description if it supports it.
 void validateForSave()
          This method performs a few checks before invoking super's implementation.
 void validateForUpdate()
          Calls up validateForUpdate() on the class description if it supports it.
 java.lang.Object validateValueForKey(java.lang.Object value, java.lang.String key)
          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.
<T> T
valueForKey(ERXKey<T> key)
          Type-safe KVC getter (final for now)
 void willDelete()
          Called as part of the augmented transaction process.
 void willInsert()
          Called as part of the augmented transaction process.
 java.lang.Object willReadRelationship(java.lang.Object aObject)
           
 void willRevert()
          Called on the object before it will be reverted.
 void willUpdate()
          Called as part of the augmented transaction process.
 
Methods inherited from class com.webobjects.eocontrol.EOGenericRecord
__setClassDescription, _keyGetBindingForKey, _keySetBindingForKey, _storedKeyGetBindingForKey, _storedKeySetBindingForKey, classDescription, usesDeferredFaultCreation
 
Methods inherited from class com.webobjects.eocontrol.EOCustomObject
__classDescription, __clearPendingChanges, __editingContext, __globalID, __hasAuxillaryObservers, __hasPendingChanges, __hasPendingUpdate, __isInitialized, __isPendingDeletion, __isPendingInsertion, __isShared, __lastSnapshot, __originalSnapshot, __retainCount, __setAuxillaryObservers, __setEditingContext, __setGlobalID, __setInitialized, __setLastSnapshot, __setOriginalSnapshot, __setPendingDeletion, __setPendingInsertion, __setPendingUpdate, __setRetainCount, __setShared, _createKeyGetBindingForKey, _createKeySetBindingForKey, _createStoredKeyGetBindingForKey, _createStoredKeySetBindingForKey, _fieldKeyBinding, _forwardingBindingNeededForClass, _methodKeyGetBinding, _methodKeySetBinding, addObjectToPropertyWithKey, allPropertyKeys, attributeKeys, canAccessFieldsDirectly, changesFromSnapshot, classDescriptionForDestinationKey, clearFault, deleteRuleForRelationshipKey, editingContext, entityName, eoDescription, eoShallowDescription, equals, faultHandler, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hashCode, inverseForRelationshipKey, invokeRemoteMethod, isFault, isToManyKey, opaqueState, ownsDestinationObjectsForRelationshipKey, prepareValuesForClient, propagateDeleteWithEditingContext, readResolve, reapplyChangesFromDictionary, removeObjectFromBothSidesOfRelationshipWithKey, removeObjectFromPropertyWithKey, shouldUseStoredAccessors, snapshot, storedValueForKey, takeValueForKeyPath, takeValuesFromDictionary, takeValuesFromDictionaryWithMapping, toManyRelationshipKeys, toOneRelationshipKeys, turnIntoFault, unableToSetNullForKey, userPresentableDescription, validateClientUpdate, validateForDelete, validateTakeValueForKeyPath, valueForKey, valueForKeyPath, valuesForKeys, valuesForKeysWithMapping, willChange, willRead
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.webobjects.eocontrol.EOEnterpriseObject
allPropertyKeys, attributeKeys, changesFromSnapshot, classDescription, classDescriptionForDestinationKey, deleteRuleForRelationshipKey, editingContext, entityName, eoDescription, eoShallowDescription, inverseForRelationshipKey, invokeRemoteMethod, isToManyKey, opaqueState, ownsDestinationObjectsForRelationshipKey, prepareValuesForClient, propagateDeleteWithEditingContext, reapplyChangesFromDictionary, snapshot, toManyRelationshipKeys, toOneRelationshipKeys, userPresentableDescription, willChange
 
Methods inherited from interface com.webobjects.eocontrol.EOKeyValueCodingAdditions
takeValuesFromDictionary, takeValuesFromDictionaryWithMapping, valuesForKeys, valuesForKeysWithMapping
 
Methods inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
takeValueForKeyPath, valueForKeyPath
 
Methods inherited from interface com.webobjects.eocontrol.EOKeyValueCoding
storedValueForKey
 
Methods inherited from interface com.webobjects.foundation.NSKeyValueCoding
valueForKey
 
Methods inherited from interface com.webobjects.foundation.NSKeyValueCoding.ErrorHandling
handleQueryWithUnboundKey, handleTakeValueForUnboundKey, unableToSetNullForKey
 
Methods inherited from interface com.webobjects.eocontrol.EORelationshipManipulation
addObjectToPropertyWithKey, removeObjectFromBothSidesOfRelationshipWithKey, removeObjectFromPropertyWithKey
 
Methods inherited from interface com.webobjects.eocontrol.EOValidation
validateClientUpdate, validateForDelete
 
Methods inherited from interface com.webobjects.foundation.NSValidation
validateTakeValueForKeyPath
 
Methods inherited from interface com.webobjects.eocontrol.EOFaulting
clearFault, faultHandler, isFault, turnIntoFault, willRead
 

Field Detail

insertionStackTrace

protected java.lang.String insertionStackTrace

_primaryKey

protected java.lang.String _primaryKey

_touchSource

public com.webobjects.eocontrol.EOGlobalID _touchSource
Which GID touched us

Constructor Detail

ERXGenericRecord

public ERXGenericRecord(com.webobjects.eocontrol.EOClassDescription classDescription)

ERXGenericRecord

public ERXGenericRecord()
Method Detail

shouldTrimSpaces

public static boolean shouldTrimSpaces()

localizationShouldFallbackToDefaultLanguage

public static boolean localizationShouldFallbackToDefaultLanguage()

localesForKey

public com.webobjects.foundation.NSArray<java.lang.String> localesForKey(java.lang.String key)
Returns all available ERXLanguages for the given key

Parameters:
key -
Returns:
NSArray of language/locale keys

valueForKey

public final <T> T valueForKey(ERXKey<T> key)
Type-safe KVC getter (final for now)

Specified by:
valueForKey in interface ERXKey.ValueCoding
Type Parameters:
T -
Parameters:
key -

takeValueForKey

public final <T> void takeValueForKey(java.lang.Object value,
                                      ERXKey<T> key)
Type-safe KVC setter (final for now)

Specified by:
takeValueForKey in interface ERXKey.ValueCoding
Type Parameters:
T -
Parameters:
value -
key -

_otherStorageBinding

public com.webobjects.foundation.NSKeyValueCoding._KeyBinding _otherStorageBinding(java.lang.String key)
Specified by:
_otherStorageBinding in interface com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation.Callback
Overrides:
_otherStorageBinding in class com.webobjects.eocontrol.EOGenericRecord

getClassLog

public org.apache.log4j.Logger getClassLog()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
getClassLog in interface ERXEnterpriseObject
Returns:
an Logger for this objects class

self

public ERXEnterpriseObject self()
Description copied from interface: ERXEnterpriseObject
self is usefull for directtoweb purposes

Specified by:
self in interface ERXEnterpriseObject

canDelete

public 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.

Specified by:
canDelete in interface ERXGuardedObjectInterface
Returns:
true

canUpdate

public 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.

Specified by:
canUpdate in interface ERXGuardedObjectInterface
Returns:
true

delete

public 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.

Specified by:
delete in interface ERXGuardedObjectInterface

didCopyFromChildInEditingContext

public void didCopyFromChildInEditingContext(ERXGenericRecord originalEO,
                                             com.webobjects.eocontrol.EOEditingContext childEditingContext)
Called when this EO is saved from a child editing context into a parent editing context.

Parameters:
originalEO - the original EO in the child editing context
childEditingContext - the child editing context

mightDelete

public void mightDelete()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
mightDelete in interface ERXEnterpriseObject

willDelete

public void willDelete()
                throws com.webobjects.foundation.NSValidation.ValidationException
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
willDelete in interface ERXEnterpriseObject
Throws:
NSValidation.ValidationException - to stop the object from being deleted.

willInsert

public void willInsert()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
willInsert in interface ERXEnterpriseObject

willUpdate

public void willUpdate()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
willUpdate in interface ERXEnterpriseObject

_updateInverseRelationships

protected boolean _updateInverseRelationships()

_setUpdateInverseRelationships

public boolean _setUpdateInverseRelationships(boolean newValue)
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
_setUpdateInverseRelationships in interface ERXEnterpriseObject
Parameters:
newValue - whether or not inverse relationships should be updated
Returns:
the previous setting of the updateInverseRelationships setting

willReadRelationship

public java.lang.Object willReadRelationship(java.lang.Object aObject)
Specified by:
willReadRelationship in interface com.webobjects.eocontrol.EODeferredFaulting
Overrides:
willReadRelationship in class com.webobjects.eocontrol.EOCustomObject

flushCaches

public void flushCaches()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
flushCaches in interface ERXEnterpriseObject

didDelete

public void didDelete(com.webobjects.eocontrol.EOEditingContext ec)
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
didDelete in interface ERXEnterpriseObject
Parameters:
ec - editing context that used to be associated with the object.

didUpdate

public void didUpdate()
Description copied from interface: ERXEnterpriseObject
Called on the object after is has successfully been updated in the database.

Specified by:
didUpdate in interface ERXEnterpriseObject

didInsert

public void didInsert()
Description copied from interface: ERXEnterpriseObject
Called on the object after is has successfully been inserted into the database.

Specified by:
didInsert in interface ERXEnterpriseObject

willRevert

public void willRevert()
Description copied from interface: ERXEnterpriseObject
Called on the object before it will be reverted. Default implementation does nothing other than log.

Specified by:
willRevert in interface ERXEnterpriseObject

didRevert

public void didRevert(com.webobjects.eocontrol.EOEditingContext ec)
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
didRevert in interface ERXEnterpriseObject
Parameters:
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.

addObjectsToBothSidesOfRelationshipWithKey

public void addObjectsToBothSidesOfRelationshipWithKey(com.webobjects.foundation.NSArray objects,
                                                       java.lang.String key)
Description copied from interface: ERXEnterpriseObject
Adds a collection of objects to a given relationship by calling addObjectToBothSidesOfRelationshipWithKey for all objects in the collection.

Specified by:
addObjectsToBothSidesOfRelationshipWithKey in interface ERXEnterpriseObject
Parameters:
objects - objects to add to both sides of the given relationship
key - relationship key

removeObjectsFromBothSidesOfRelationshipWithKey

public void removeObjectsFromBothSidesOfRelationshipWithKey(com.webobjects.foundation.NSArray objects,
                                                            java.lang.String key)
Description copied from interface: ERXEnterpriseObject
Removes a collection of objects to a given relationship by calling removeObjectFromBothSidesOfRelationshipWithKey for all objects in the collection.

Specified by:
removeObjectsFromBothSidesOfRelationshipWithKey in interface ERXEnterpriseObject
Parameters:
objects - objects to be removed from both sides of the given relationship
key - relationship key

removeObjectsFromPropertyWithKey

public void removeObjectsFromPropertyWithKey(com.webobjects.foundation.NSArray objects,
                                             java.lang.String key)
Description copied from interface: ERXEnterpriseObject
Removes a collection of objects to a given relationship by calling removeObjectFromPropertyWithKey for all objects in the collection.

Specified by:
removeObjectsFromPropertyWithKey in interface ERXEnterpriseObject
Parameters:
objects - objects to be removed from both sides of the given relationship
key - relationship key

awakeFromClientUpdate

public void awakeFromClientUpdate(com.webobjects.eocontrol.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.

Specified by:
awakeFromClientUpdate in interface com.webobjects.eocontrol.EOEnterpriseObject
Overrides:
awakeFromClientUpdate in class com.webobjects.eocontrol.EOCustomObject
Parameters:
editingContext - to be checked to make sure it has the correct type of delegate set.

awakeFromInsertion

public void awakeFromInsertion(com.webobjects.eocontrol.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.

Specified by:
awakeFromInsertion in interface com.webobjects.eocontrol.EOEnterpriseObject
Overrides:
awakeFromInsertion in class com.webobjects.eocontrol.EOCustomObject
Parameters:
editingContext - to be checked to make sure it has the correct type of delegate set.

applyRestrictingQualifierOnInsert

protected boolean applyRestrictingQualifierOnInsert()

clearProperties

public void clearProperties()
Specified by:
clearProperties in interface com.webobjects.eocontrol.EOEnterpriseObject
Overrides:
clearProperties in class com.webobjects.eocontrol.EOCustomObject

init

protected void init(com.webobjects.eocontrol.EOEditingContext ec)
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.

Parameters:
ec - the EOEditingContext in which this new EO is inserted

awakeFromFetch

public void awakeFromFetch(com.webobjects.eocontrol.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.

Specified by:
awakeFromFetch in interface com.webobjects.eocontrol.EOEnterpriseObject
Overrides:
awakeFromFetch in class com.webobjects.eocontrol.EOCustomObject
Parameters:
editingContext - to be checked to make sure it has the correct type of delegate set.

addObjectToBothSidesOfRelationshipWithKey

public void addObjectToBothSidesOfRelationshipWithKey(com.webobjects.eocontrol.EORelationshipManipulation eo,
                                                      java.lang.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.

Specified by:
addObjectToBothSidesOfRelationshipWithKey in interface com.webobjects.eocontrol.EORelationshipManipulation
Overrides:
addObjectToBothSidesOfRelationshipWithKey in class com.webobjects.eocontrol.EOCustomObject
Parameters:
eo - enterprise object to be added to the relationship
key - relationship to add the object to.

primaryKey

public java.lang.String primaryKey()
Description copied from interface: ERXEnterpriseObject
Primary key of the object as a String.

Specified by:
primaryKey in interface ERXEnterpriseObject
Returns:
primary key for the given object as a String

rawPrimaryKeyInTransaction

public java.lang.Object rawPrimaryKeyInTransaction()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
rawPrimaryKeyInTransaction in interface ERXEnterpriseObject
Returns:
the primary key of this object.

primaryKeyInTransaction

public java.lang.String primaryKeyInTransaction()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
primaryKeyInTransaction in interface ERXEnterpriseObject
Returns:
string representation of the primary key of this object.

rawPrimaryKey

public java.lang.Object rawPrimaryKey()
Description copied from interface: ERXEnterpriseObject
Gives the raw primary key of the object. This could be anything from an NSData to a BigDecimal.

Specified by:
rawPrimaryKey in interface ERXEnterpriseObject
Returns:
the raw primary key of this object.

encryptedPrimaryKey

public java.lang.String encryptedPrimaryKey()
Description copied from interface: ERXEnterpriseObject
Takes the primary key of the object and encrypts it with the blowfish cipher using ERXCrypto.

Specified by:
encryptedPrimaryKey in interface ERXEnterpriseObject
Returns:
blowfish encrypted primary key

foreignKeyForRelationshipWithKey

public java.lang.Object foreignKeyForRelationshipWithKey(java.lang.String rel)
Description copied from interface: ERXEnterpriseObject
Returns the foreign key for a given relationship.

Specified by:
foreignKeyForRelationshipWithKey in interface ERXEnterpriseObject
Parameters:
rel - relationship key
Returns:
foreign key for a given relationship.

primaryKeyAttributeNames

public com.webobjects.foundation.NSArray<java.lang.String> primaryKeyAttributeNames()
Description copied from interface: ERXEnterpriseObject
Returns the names of all primary key attributes.

Specified by:
primaryKeyAttributeNames in interface ERXEnterpriseObject

entity

public com.webobjects.eoaccess.EOEntity entity()
Returns the entity for the current object. Defers to ERXEOAccessUtilities.entityNamed() for the actual work.

Returns:
EOEntity for the current object

primaryKeyDictionary

public com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Object> 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'.

Specified by:
primaryKeyDictionary in interface ERXGeneratesPrimaryKeyInterface
Parameters:
inTransaction - boolean flag to tell the object if it is currently in the middle of a transaction.
Returns:
primary key dictionary for the current object, if the object does not have a primary key assigned yet and is not in the middle of a transaction then a new primary key dictionary is created, cached and returned.

_setValueForPrimaryKey

public void _setValueForPrimaryKey(java.lang.Object value,
                                   java.lang.String pkAttributeName)
Sets the value for the primary key attribute with the given name. This should only be called on uncommitted objects.

Parameters:
value - the pk value
pkAttributeName - the pk attribute name

_setPrimaryKeyDictionary

public void _setPrimaryKeyDictionary(com.webobjects.foundation.NSDictionary<java.lang.String,java.lang.Object> pkDict)
Sets the primary key dictionary for this EO (key = attribute name, value = pk value). This should only be called on uncommitted objects.

Parameters:
pkDict - the new primary key dictionary

committedSnapshotValueForKey

public java.lang.Object committedSnapshotValueForKey(java.lang.String key)
Description copied from interface: ERXEnterpriseObject
Determines what the value of the given key is in the committed snapshot

Specified by:
committedSnapshotValueForKey in interface ERXEnterpriseObject
Parameters:
key - to be checked in committed snapshot
Returns:
the committed snapshot value for the given key

committedSnapshot

public com.webobjects.foundation.NSDictionary committedSnapshot()
This method exists because EOEditingContext.committedSnapshotForObject() gives unexpected results for newly inserted objects if EOEditingContext.processRecentChanges() has been called. This method always returns a dictionary whose values are all NSKeyValueCoding.NullValue in the case of a newly inserted object.

Returns:
the committed snapshot

localInstanceOf

public com.webobjects.eocontrol.EOEnterpriseObject localInstanceOf(com.webobjects.eocontrol.EOEnterpriseObject eo)
Description copied from interface: ERXEnterpriseObject
Returns an EO in the same editing context as the caller.

Specified by:
localInstanceOf in interface ERXEnterpriseObject
Returns:
an EO in the same editing context as the caller.

localInstanceIn

public com.webobjects.eocontrol.EOEnterpriseObject localInstanceIn(com.webobjects.eocontrol.EOEditingContext ec)
Description copied from interface: ERXEnterpriseObject
Returns this EO in the supplied editing context.

Specified by:
localInstanceIn in interface ERXEnterpriseObject
Returns:
this EO in the supplied editing context.

localInstancesOf

public com.webobjects.foundation.NSArray localInstancesOf(com.webobjects.foundation.NSArray eos)
Description copied from interface: ERXEnterpriseObject
Returns an array of EOs in the same editing context as the caller.

Specified by:
localInstancesOf in interface ERXEnterpriseObject
Returns:
array of EOs in the same editing context as the caller.

changesFromCommittedSnapshot

public com.webobjects.foundation.NSDictionary changesFromCommittedSnapshot()
Description copied from interface: ERXEnterpriseObject
Computes the current set of changes that this object has from the currently committed snapshot.

Specified by:
changesFromCommittedSnapshot in interface ERXEnterpriseObject
Returns:
a dictionary holding the changed values from the currently committed snapshot.

hasKeyChangedFromCommittedSnapshot

public boolean hasKeyChangedFromCommittedSnapshot(java.lang.String key)
Returns whether or not the given key has changed when compared to the committed snapshot.

Parameters:
key - The key that you wish to check has changed from the committed snapshot
Returns:
true if it has changed

hasKeyChangedFromCommittedSnapshotFromValue

public boolean hasKeyChangedFromCommittedSnapshotFromValue(java.lang.String key,
                                                           java.lang.Object oldValue)
Returns whether or not the given key has changed from the given committed value.

Parameters:
key - The key that you wish to check has changed from the committed snapshot
oldValue - The value you wish to see if the key has changed from EG. Has 'status' changed from STATUS.PENDING_STATUS
Returns:
true if the specified key value has changed from the specified value

hasKeyChangedFromCommittedSnapshotFromValueToNewValue

public boolean hasKeyChangedFromCommittedSnapshotFromValueToNewValue(java.lang.String key,
                                                                     java.lang.Object oldValue,
                                                                     java.lang.Object newValue)
Returns whether or not the given key has changed from the given previous value to the new value since the committed value.

Parameters:
key - The key that you wish to check has changed from the committed snapshot
oldValue - The value you wish to see if the key has changed from
newValue - The value you wish to see if the key has changed to EG. Has 'status' changed from STATUS.PENDING_STATUS to STATUS.CONFIRMED_STATUS
Returns:
true if the specified key value has changed from the specified value

hasKeyChangedFromCommittedSnapshotToValue

public boolean hasKeyChangedFromCommittedSnapshotToValue(java.lang.String key,
                                                         java.lang.Object newValue)
Returns whether or not the given key has changed to the new value since the committed value.

Parameters:
key - The key that you wish to check has changed from the committed snapshot
newValue - The value you wish to see if the key has changed to EG. Has 'status' changed to STATUS.CANCELLED_STATUS
Returns:
true if the specified key value has changed to the specified value

parentObjectStoreIsObjectStoreCoordinator

public boolean parentObjectStoreIsObjectStoreCoordinator()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
parentObjectStoreIsObjectStoreCoordinator in interface ERXEnterpriseObject
Returns:
if the parent object store of this object's editing context is an EOObjectStoreCoordinator.

refetchObjectFromDB

public ERXEnterpriseObject refetchObjectFromDB()
Calls the method refetchObjectFromDBinEditingContext(EOEditingContext ec) and passes the object's Editing Context as Editing Context parameter.

Returns:
the newly fetched object from the DB.

refetchObjectFromDBinEditingContext

public ERXEnterpriseObject refetchObjectFromDBinEditingContext(com.webobjects.eocontrol.EOEditingContext ec)
Description copied from interface: ERXEnterpriseObject
Method that will make sure to fetch an eo from the Database and place it in the editingContext provided as an argument

Specified by:
refetchObjectFromDBinEditingContext in interface ERXEnterpriseObject
Parameters:
ec - the editing context in which the result will be placed
Returns:
fresh instance of an EO fetched from the DB and placed in the editing context argument

permanentGlobalID

public com.webobjects.eocontrol.EOKeyGlobalID permanentGlobalID(boolean generateIfMissing)
This method allows you to compute what the permanent EOGlobalID will be for an object before it has been saved to the database. It functions by calling into primaryKeyDictionary() to allocate the primary key if necessary. Then we build an EOKeyGlobalID from it. If the object already has a permanent global ID, we use that. If you pass false for generateIfMissing and this object has a temporary global ID, null will be returned.


permanentGlobalID

public com.webobjects.eocontrol.EOKeyGlobalID permanentGlobalID()
Calls permanentGlobalID(boolean) passing true for generateIfMissing.

See Also:
permanentGlobalID(boolean)

toString

public java.lang.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: EOGenericRecord's implementation is preserved in the method toLongString. To restore the original verbose logging in your subclasses override this method and return toLongString.

Overrides:
toString in class com.webobjects.eocontrol.EOCustomObject
Returns:
much less verbose description of an enterprise object.

description

public java.lang.String description()
Description copied from interface: ERXEnterpriseObject
Cover method to return toString.

Specified by:
description in interface ERXEnterpriseObject
Returns:
the results of calling toString.

toLongString

public java.lang.String toLongString()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
toLongString in interface ERXEnterpriseObject
Returns:
super's implementation of toString.

trimSpaces

public void trimSpaces()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
trimSpaces in interface ERXEnterpriseObject

isDeletedEO

public boolean isDeletedEO()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
isDeletedEO in interface ERXEnterpriseObject
Returns:
if the object is a deleted object

isNewEO

public boolean isNewEO()
Deprecated. use ERXGenericRecord#isNewObject


isNewObject

public boolean isNewObject()
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
isNewObject in interface ERXEnterpriseObject
Returns:
if the object is a new enterprise object.

isUpdatedObject

public boolean isUpdatedObject()
Returns true if this EO has been modified in this editing context. In EOF terms, this means that the EO's snapshot in this EC is not .equals the original database snapshot for the EO.

Returns:
true if this EO's snapshot does not match the original snapshot

setValidatedWhenNested

public void setValidatedWhenNested(boolean validatedWhenNested)
If false, when this object is committed into a nested editingContext and it exists in the parent editing context, validation will be skipped. This supports nested UI workflows where you want to create a new to-one relationship for an object that isn't fully configured by localInstancing it into a nested editing context. In that scenario, the localInstance'd EO would attempt to validate when the nested editing context is committed, throwing a validation exception that should be deferred to the parent editing context. This defaults to true, which maintains the current behavior.

Parameters:
validatedWhenNested -

isValidatedWhenNested

public boolean isValidatedWhenNested()
Returns whether or not this object is validated when it is committed in a nested editing context.

Returns:
whether or not this object is validated when it is committed in a nested editing context.

validateValueForKey

public java.lang.Object validateValueForKey(java.lang.Object value,
                                            java.lang.String key)
                                     throws com.webobjects.foundation.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.

Specified by:
validateValueForKey in interface com.webobjects.foundation.NSValidation
Overrides:
validateValueForKey in class com.webobjects.eocontrol.EOCustomObject
Parameters:
value - to be validated for a given attribute or relationship
key - corresponding to an attribute or relationship
Returns:
the validated value
Throws:
NSValidation.ValidationException - if the value fails validation

_validateValueForKey

protected java.lang.Object _validateValueForKey(java.lang.Object value,
                                                java.lang.String key)
                                         throws com.webobjects.foundation.NSValidation.ValidationException
Throws:
com.webobjects.foundation.NSValidation.ValidationException

validateForSave

public void validateForSave()
                     throws com.webobjects.foundation.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.

Specified by:
validateForSave in interface com.webobjects.eocontrol.EOValidation
Overrides:
validateForSave in class com.webobjects.eocontrol.EOCustomObject
Throws:
NSValidation.ValidationException - if the object does not pass validation for saving to the database.

validateForInsert

public void validateForInsert()
                       throws com.webobjects.foundation.NSValidation.ValidationException
Calls up validateForInsert() on the class description if it supports it.

Specified by:
validateForInsert in interface com.webobjects.eocontrol.EOValidation
Overrides:
validateForInsert in class com.webobjects.eocontrol.EOCustomObject
Throws:
NSValidation.ValidationException - if the object does not pass validation for saving to the database.

validateForUpdate

public void validateForUpdate()
                       throws com.webobjects.foundation.NSValidation.ValidationException
Calls up validateForUpdate() on the class description if it supports it.

Specified by:
validateForUpdate in interface com.webobjects.eocontrol.EOValidation
Overrides:
validateForUpdate in class com.webobjects.eocontrol.EOCustomObject
Throws:
NSValidation.ValidationException - if the object does not pass validation for saving to the database.

checkConsistency

public void checkConsistency()
                      throws com.webobjects.foundation.NSValidation.ValidationException
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
checkConsistency in interface ERXEnterpriseObject
Throws:
NSValidation.ValidationException - if the object is not consistent

batchCheckConsistency

public void batchCheckConsistency()
                           throws com.webobjects.foundation.NSValidation.ValidationException
Description copied from interface: ERXEnterpriseObject
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.

Specified by:
batchCheckConsistency in interface ERXEnterpriseObject
Throws:
NSValidation.ValidationException - if the object fails consistency

includeObjectIntoPropertyWithKey

public void includeObjectIntoPropertyWithKey(java.lang.Object o,
                                             java.lang.String key)
Overridden to support two-way relationship setting.

Overrides:
includeObjectIntoPropertyWithKey in class com.webobjects.eocontrol.EOCustomObject

excludeObjectFromPropertyWithKey

public void excludeObjectFromPropertyWithKey(java.lang.Object o,
                                             java.lang.String key)
Overridden to support two-way relationship setting.

Overrides:
excludeObjectFromPropertyWithKey in class com.webobjects.eocontrol.EOCustomObject

takeValueForKey

public void takeValueForKey(java.lang.Object value,
                            java.lang.String key)
Overridden to support two-way relationship setting.

Specified by:
takeValueForKey in interface com.webobjects.foundation.NSKeyValueCoding
Overrides:
takeValueForKey in class com.webobjects.eocontrol.EOCustomObject

takeStoredValueForKey

public void takeStoredValueForKey(java.lang.Object value,
                                  java.lang.String key)
Specified by:
takeStoredValueForKey in interface com.webobjects.eocontrol.EOKeyValueCoding
Overrides:
takeStoredValueForKey in class com.webobjects.eocontrol.EOCustomObject

updateFromSnapshot

public void updateFromSnapshot(com.webobjects.foundation.NSDictionary snapshot)
This method explicitly turns off inverse relationship updating, because it's only called during undo and revert inside of EOF. If you are calling this method, it's presumed that you understand the consequences of your actions :)

Specified by:
updateFromSnapshot in interface com.webobjects.eocontrol.EOEnterpriseObject
Overrides:
updateFromSnapshot in class com.webobjects.eocontrol.EOCustomObject

checkMatchingEditingContexts

public static void checkMatchingEditingContexts(com.webobjects.eocontrol.EOEnterpriseObject source,
                                                java.lang.String relationshipName,
                                                com.webobjects.eocontrol.EOEnterpriseObject destination)
Checks that the editing contexts in source and destination matches and throws an exception if they do not.

Parameters:
source - the source object
relationshipName - the name of the relationship that is being updated
destination - the destination object
Throws:
java.lang.RuntimeException - if the editing contexts do not match

batchFaultingTimeStamp

public long batchFaultingTimeStamp()
The fetch time for this object

Specified by:
batchFaultingTimeStamp in interface ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject
Returns:
fetch time

batchFaultingSourceGlobalID

public com.webobjects.eocontrol.EOGlobalID batchFaultingSourceGlobalID()
The source EO that touched us

Specified by:
batchFaultingSourceGlobalID in interface ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject
Returns:
gid of the source

batchFaultingRelationshipName

public java.lang.String batchFaultingRelationshipName()
The key that touched us

Specified by:
batchFaultingRelationshipName in interface ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject
Returns:
relationship name

touchFromBatchFaultingSource

public void touchFromBatchFaultingSource(ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject toucher,
                                         java.lang.String key)
Touches this EO with the given source and the given key. Stores GID and timestamp.

Specified by:
touchFromBatchFaultingSource in interface ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject
Parameters:
toucher -
key -

setBatchFaultingTimestamp

public void setBatchFaultingTimestamp(long timestamp)
Touches this EO from a fetch. Note that this is the last fetch, not when the object has been initialized.

Specified by:
setBatchFaultingTimestamp in interface ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject
Parameters:
timestamp -

isNonNull

public final java.lang.Boolean isNonNull()
Specified by:
isNonNull in interface ERXNonNullObjectInterface

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.