public class ERXGenericRecord extends EOGenericRecord implements ERXGuardedObjectInterface, ERXGeneratesPrimaryKeyInterface, ERXEnterpriseObject, ERXKey.ValueCoding, ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject, ERXNonNullObjectInterface
EOGenericRecord
class. Of
notable interest is:
ERXGeneratesPrimaryKeyInterface
,
willUpdate
and didDelete
and a bunch of handy utility methods like
committedSnapshotValueForKey
.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
.
Modifier and Type | Class and Description |
---|---|
static class |
ERXGenericRecord.ERXGenericRecordClazz<T extends 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.
|
EOGenericRecord._DictionaryBinding, EOGenericRecord._LazyDictionaryBinding
EOCustomObject._BooleanFieldBinding, EOCustomObject._FieldBinding, EOCustomObject._LazyFieldBinding, EOCustomObject._NumberFieldBinding
ERXEnterpriseObject.Observer, ERXEnterpriseObject.Processor
EOKeyValueCodingAdditions.DefaultImplementation, EOKeyValueCodingAdditions.Utility
EOKeyValueCoding._BestBindingCreation, EOKeyValueCoding._KeyBindingCreation, EOKeyValueCoding._StoredForwardingBinding
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
NSValidation._MethodBinding, NSValidation._ValidationBinding, NSValidation.ValidationException
_EOPrivateMemento.DefaultImplementation
Modifier and Type | Field and Description |
---|---|
protected String |
_primaryKey |
EOGlobalID |
_touchSource
Which GID touched us
|
protected String |
insertionStackTrace |
_CLASS
__readOnly
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
_CLASS
_KeyPathSeparatorChar, KeyPathSeparator
NullValue
Constructor and Description |
---|
ERXGenericRecord() |
ERXGenericRecord(EOClassDescription classDescription) |
Modifier and Type | Method and Description |
---|---|
NSKeyValueCoding._KeyBinding |
_otherStorageBinding(String key) |
void |
_setPrimaryKeyDictionary(NSDictionary<String,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(Object value,
String pkAttributeName)
Sets the value for the primary key attribute with the given name.
|
protected boolean |
_updateInverseRelationships() |
protected Object |
_validateValueForKey(Object value,
String key) |
void |
addObjectsToBothSidesOfRelationshipWithKey(NSArray<? extends EOEnterpriseObject> objects,
String key)
Adds a collection of objects to a given relationship by calling
addObjectToBothSidesOfRelationshipWithKey for all
objects in the collection. |
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.
|
protected boolean |
applyRestrictingQualifierOnInsert() |
void |
awakeFromClientUpdate(EOEditingContext editingContext)
Checks the editing context delegate before calling super's
implementation.
|
void |
awakeFromFetch(EOEditingContext editingContext)
Checks the editing context delegate before calling super's
implementation.
|
void |
awakeFromInsertion(EOEditingContext editingContext)
Checks the editing context delegate before calling super's
implementation.
|
String |
batchFaultingRelationshipName()
The key that touched us
|
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 . |
NSDictionary<String,Object> |
changesFromCommittedSnapshot()
Computes the current set of changes that this object has from the
currently committed snapshot.
|
static void |
checkMatchingEditingContexts(EOEnterpriseObject source,
String relationshipName,
EOEnterpriseObject destination)
Checks that the editing contexts in source and destination matches and throws an exception if they do not.
|
void |
clearProperties() |
NSDictionary<String,Object> |
committedSnapshot()
This method exists because
EOEditingContext.committedSnapshotForObject()
gives unexpected results for newly inserted objects if
EOEditingContext.processRecentChanges()
has been called. |
<T> T |
committedSnapshotValueForKey(ERXKey<T> key)
Returns the committed snapshot value for given key.
|
Object |
committedSnapshotValueForKey(String key)
Determines what the value of the given key is in the committed
snapshot
|
void |
delete()
Implementation of
ERXGuardedObjectInterface . |
void |
didCopyFromChildInEditingContext(ERXGenericRecord originalEO,
EOEditingContext childEditingContext)
Called when this EO is saved from a child editing context into a parent editing context.
|
void |
didDelete(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(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.
|
String |
encryptedPrimaryKey()
Takes the primary key of the object and encrypts it
with the blowfish cipher using
ERXCrypto . |
EOEntity |
entity()
Returns the entity for the current object.
|
void |
excludeObjectFromPropertyWithKey(Object o,
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.
|
Object |
foreignKeyForRelationshipWithKey(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.
|
Object |
handleQueryWithUnboundKey(String key)
Override so that we can handle the case of in-memory qualifier evaluation against a hidden primary key
attribute (simple or component of compound).
|
<T> boolean |
hasKeyChangedFromCommittedSnapshot(ERXKey<T> key)
Returns whether or not the given key has changed when compared to the committed snapshot.
|
boolean |
hasKeyChangedFromCommittedSnapshot(String key)
Returns whether or not the given key has changed when compared to the committed snapshot.
|
<T> boolean |
hasKeyChangedFromCommittedSnapshotFromValue(ERXKey<T> key,
T oldValue)
Returns whether or not the given key has changed from the given committed value.
|
boolean |
hasKeyChangedFromCommittedSnapshotFromValue(String key,
Object oldValue)
Returns whether or not the given key has changed from the given committed value.
|
<T> boolean |
hasKeyChangedFromCommittedSnapshotFromValueToNewValue(ERXKey<T> key,
T oldValue,
T newValue)
Returns whether or not the given key has changed from the given previous value to the new value since the committed value.
|
boolean |
hasKeyChangedFromCommittedSnapshotFromValueToNewValue(String key,
Object oldValue,
Object newValue)
Returns whether or not the given key has changed from the given previous value to the new value since the committed value.
|
<T> boolean |
hasKeyChangedFromCommittedSnapshotToValue(ERXKey<T> key,
T newValue)
Returns whether or not the given key has changed to the new value since the committed value.
|
boolean |
hasKeyChangedFromCommittedSnapshotToValue(String key,
Object newValue)
Returns whether or not the given key has changed to the new value since the committed value.
|
void |
includeObjectIntoPropertyWithKey(Object o,
String key)
Overridden to support two-way relationship setting.
|
protected void |
init(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 |
isNewObject()
Determines if this object is a new object and
hasn't been saved to the database yet.
|
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.
|
NSArray<String> |
localesForKey(String key)
Returns all available ERXLanguages for the given key
|
EOEnterpriseObject |
localInstanceIn(EOEditingContext ec)
Returns this EO in the supplied editing context.
|
<T extends EOEnterpriseObject> |
localInstanceOf(T eo)
Returns an EO in the same editing context as the caller.
|
<T extends EOEnterpriseObject> |
localInstancesOf(NSArray<T> eos)
Returns an array of EOs in the same editing context as the caller.
|
static boolean |
localizationShouldFallbackToDefaultLanguage() |
protected String |
localizedKey(String key) |
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 . |
EOKeyGlobalID |
permanentGlobalID()
Calls permanentGlobalID(boolean) passing
true for generateIfMissing. |
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.
|
String |
primaryKey()
Primary key of the object as a String.
|
NSArray<String> |
primaryKeyAttributeNames()
Returns the names of all primary key attributes.
|
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.
|
Object |
rawPrimaryKey()
Gives the raw primary key of the object.
|
NSDictionary<String,Object> |
rawPrimaryKeyDictionary(boolean inTransaction)
Implementation of the interface
ERXGeneratesPrimaryKeyInterface . |
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(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(NSArray<? extends EOEnterpriseObject> objects,
String key)
Removes a collection of objects to a given relationship by calling
removeObjectFromBothSidesOfRelationshipWithKey for all
objects in the collection. |
void |
removeObjectsFromPropertyWithKey(NSArray<? extends EOEnterpriseObject> objects,
String key)
Removes a collection of objects to a given relationship by calling
removeObjectFromPropertyWithKey for all
objects in the collection. |
ERXEnterpriseObject |
self()
self is useful for D2W 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.
|
protected boolean |
shouldSkipValidateForSave()
Checks if
validateForSave() should be skipped. |
static boolean |
shouldTrimSpaces() |
void |
takeStoredValueForKey(Object value,
String key) |
<T> void |
takeValueForKey(Object value,
ERXKey<T> key)
Type-safe KVC setter (final for now)
|
void |
takeValueForKey(Object value,
String key)
Overridden to support two-way relationship setting.
|
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.
|
String |
toString()
Overrides the EOGenericRecord's implementation to provide a slightly less
verbose output.
|
void |
touchFromBatchFaultingSource(ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject toucher,
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(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.
|
Object |
validateValueForKey(Object value,
String key)
Overrides the default validation mechanisms to provide a few checks
before invoking super's implementation, which incidentally 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.
|
Object |
willReadRelationship(Object aObject) |
void |
willRevert()
Called on the object before it will be reverted.
|
void |
willUpdate()
Called as part of the augmented transaction process.
|
__setClassDescription, _keyGetBindingForKey, _keySetBindingForKey, _storedKeyGetBindingForKey, _storedKeySetBindingForKey, classDescription, usesDeferredFaultCreation
__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, handleTakeValueForUnboundKey, hashCode, inverseForRelationshipKey, invokeRemoteMethod, isFault, isReadOnly, 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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
allPropertyKeys, attributeKeys, changesFromSnapshot, classDescription, classDescriptionForDestinationKey, deleteRuleForRelationshipKey, editingContext, entityName, eoDescription, eoShallowDescription, inverseForRelationshipKey, invokeRemoteMethod, isReadOnly, isToManyKey, opaqueState, ownsDestinationObjectsForRelationshipKey, prepareValuesForClient, propagateDeleteWithEditingContext, reapplyChangesFromDictionary, snapshot, toManyRelationshipKeys, toOneRelationshipKeys, userPresentableDescription, willChange
takeValuesFromDictionary, takeValuesFromDictionaryWithMapping, valuesForKeys, valuesForKeysWithMapping
takeValueForKeyPath, valueForKeyPath
storedValueForKey
valueForKey
handleTakeValueForUnboundKey, unableToSetNullForKey
addObjectToPropertyWithKey, removeObjectFromBothSidesOfRelationshipWithKey, removeObjectFromPropertyWithKey
validateClientUpdate, validateForDelete
validateTakeValueForKeyPath
clearFault, faultHandler, isFault, turnIntoFault, willRead
protected String insertionStackTrace
protected String _primaryKey
public EOGlobalID _touchSource
public ERXGenericRecord(EOClassDescription classDescription)
public ERXGenericRecord()
public static boolean shouldTrimSpaces()
public static boolean localizationShouldFallbackToDefaultLanguage()
public NSArray<String> localesForKey(String key)
key
- public final <T> T valueForKey(ERXKey<T> key)
valueForKey
in interface ERXKey.ValueCoding
T
- key
- public final <T> void takeValueForKey(Object value, ERXKey<T> key)
takeValueForKey
in interface ERXKey.ValueCoding
T
- value
- key
- public NSKeyValueCoding._KeyBinding _otherStorageBinding(String key)
_otherStorageBinding
in interface NSKeyValueCoding._ReflectionKeyBindingCreation.Callback
_otherStorageBinding
in class EOGenericRecord
public org.apache.log4j.Logger getClassLog()
ERXEnterpriseObject
getClassLog
in interface ERXEnterpriseObject
Logger
for this objects classpublic ERXEnterpriseObject self()
ERXEnterpriseObject
self
in interface ERXEnterpriseObject
public boolean canDelete()
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
.canDelete
in interface ERXGuardedObjectInterface
public boolean canUpdate()
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
.canUpdate
in interface ERXGuardedObjectInterface
public void delete()
ERXGuardedObjectInterface
. This is used to
work around a bug in EOF that doesn't refresh the relationship in the
parent editingContext for the object.delete
in interface ERXGuardedObjectInterface
public void didCopyFromChildInEditingContext(ERXGenericRecord originalEO, EOEditingContext childEditingContext)
originalEO
- the original EO in the child editing contextchildEditingContext
- the child editing contextpublic void mightDelete()
ERXEnterpriseObject
mightDelete
in interface ERXEnterpriseObject
public void willDelete() throws NSValidation.ValidationException
ERXEnterpriseObject
validateForDelete
is called on this
object. This method is called by the editing context
delegate ERXDefaultEditingContextDelegate
.willDelete
in interface ERXEnterpriseObject
NSValidation.ValidationException
- to stop the object
from being deleted.public void willInsert()
ERXEnterpriseObject
validateForInsert
is called on this
object. This method is called by the editing context
delegate ERXDefaultEditingContextDelegate
.willInsert
in interface ERXEnterpriseObject
public void willUpdate()
ERXEnterpriseObject
validateForSave
is called on this
object. This method is called by the editing context
delegate ERXDefaultEditingContextDelegate
.willUpdate
in interface ERXEnterpriseObject
protected boolean _updateInverseRelationships()
public boolean _setUpdateInverseRelationships(boolean newValue)
ERXEnterpriseObject
_setUpdateInverseRelationships
in interface ERXEnterpriseObject
newValue
- whether or not inverse relationships should be updatedpublic Object willReadRelationship(Object aObject)
willReadRelationship
in interface EODeferredFaulting
willReadRelationship
in class EOCustomObject
public void flushCaches()
ERXEnterpriseObject
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.flushCaches
in interface ERXEnterpriseObject
public void didDelete(EOEditingContext ec)
ERXEnterpriseObject
ec
is a child context when doing something here that
can't be undone.didDelete
in interface ERXEnterpriseObject
ec
- editing context that used to be associated
with the object.public void didUpdate()
ERXEnterpriseObject
didUpdate
in interface ERXEnterpriseObject
public void didInsert()
ERXEnterpriseObject
didInsert
in interface ERXEnterpriseObject
public void willRevert()
ERXEnterpriseObject
willRevert
in interface ERXEnterpriseObject
public void didRevert(EOEditingContext ec)
ERXEnterpriseObject
flushCaches
.didRevert
in interface ERXEnterpriseObject
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.public void addObjectsToBothSidesOfRelationshipWithKey(NSArray<? extends EOEnterpriseObject> objects, String key)
ERXEnterpriseObject
addObjectToBothSidesOfRelationshipWithKey
for all
objects in the collection.addObjectsToBothSidesOfRelationshipWithKey
in interface ERXEnterpriseObject
objects
- objects to add to both sides of the given relationshipkey
- relationship keypublic void removeObjectsFromBothSidesOfRelationshipWithKey(NSArray<? extends EOEnterpriseObject> objects, String key)
ERXEnterpriseObject
removeObjectFromBothSidesOfRelationshipWithKey
for all
objects in the collection.removeObjectsFromBothSidesOfRelationshipWithKey
in interface ERXEnterpriseObject
objects
- objects to be removed from both sides of the given relationshipkey
- relationship keypublic void removeObjectsFromPropertyWithKey(NSArray<? extends EOEnterpriseObject> objects, String key)
ERXEnterpriseObject
removeObjectFromPropertyWithKey
for all
objects in the collection.removeObjectsFromPropertyWithKey
in interface ERXEnterpriseObject
objects
- objects to be removed from both sides of the given relationshipkey
- relationship keypublic void awakeFromClientUpdate(EOEditingContext editingContext)
_checkEditingContextDelegate
for an explanation as to what this check does.awakeFromClientUpdate
in interface EOEnterpriseObject
awakeFromClientUpdate
in class EOCustomObject
editingContext
- to be checked to make sure it has the correct type of delegate
set.public void awakeFromInsertion(EOEditingContext editingContext)
_checkEditingContextDelegate
for an explanation as to what this check does.awakeFromInsertion
in interface EOEnterpriseObject
awakeFromInsertion
in class EOCustomObject
editingContext
- to be checked to make sure it has the correct type of delegate
set.protected boolean applyRestrictingQualifierOnInsert()
public void clearProperties()
clearProperties
in interface EOEnterpriseObject
clearProperties
in class EOCustomObject
protected void init(EOEditingContext ec)
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 insertedpublic void awakeFromFetch(EOEditingContext editingContext)
_checkEditingContextDelegate
for an explanation as to what this check does.awakeFromFetch
in interface EOEnterpriseObject
awakeFromFetch
in class EOCustomObject
editingContext
- to be checked to make sure it has the correct type of delegate
set.public void addObjectToBothSidesOfRelationshipWithKey(EORelationshipManipulation eo, String key)
addObjectToBothSidesOfRelationshipWithKey
in interface EORelationshipManipulation
addObjectToBothSidesOfRelationshipWithKey
in class EOCustomObject
eo
- enterprise object to be added to the relationshipkey
- relationship to add the object to.public String primaryKey()
ERXEnterpriseObject
primaryKey
in interface ERXEnterpriseObject
public Object rawPrimaryKeyInTransaction()
ERXEnterpriseObject
rawPrimaryKey
.rawPrimaryKeyInTransaction
in interface ERXEnterpriseObject
public String primaryKeyInTransaction()
ERXEnterpriseObject
primaryKey
.primaryKeyInTransaction
in interface ERXEnterpriseObject
public Object rawPrimaryKey()
ERXEnterpriseObject
rawPrimaryKey
in interface ERXEnterpriseObject
public String encryptedPrimaryKey()
ERXEnterpriseObject
ERXCrypto
.encryptedPrimaryKey
in interface ERXEnterpriseObject
public Object foreignKeyForRelationshipWithKey(String rel)
ERXEnterpriseObject
foreignKeyForRelationshipWithKey
in interface ERXEnterpriseObject
rel
- relationship keypublic NSArray<String> primaryKeyAttributeNames()
ERXEnterpriseObject
primaryKeyAttributeNames
in interface ERXEnterpriseObject
public EOEntity entity()
ERXEOAccessUtilities.entityNamed()
for the actual work.public NSDictionary<String,Object> rawPrimaryKeyDictionary(boolean inTransaction)
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'.rawPrimaryKeyDictionary
in interface ERXGeneratesPrimaryKeyInterface
inTransaction
- boolean flag to tell the object if it is currently in the
middle of a transactionpublic void _setValueForPrimaryKey(Object value, String pkAttributeName)
value
- the pk valuepkAttributeName
- the pk attribute namepublic void _setPrimaryKeyDictionary(NSDictionary<String,Object> pkDict)
pkDict
- the new primary key dictionarypublic Object committedSnapshotValueForKey(String key)
ERXEnterpriseObject
committedSnapshotValueForKey
in interface ERXEnterpriseObject
key
- to be checked in committed snapshotpublic <T> T committedSnapshotValueForKey(ERXKey<T> key)
key
- The key that you wish to get its value from the committed snapshotpublic NSDictionary<String,Object> committedSnapshot()
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.public <T extends EOEnterpriseObject> T localInstanceOf(T eo)
ERXEnterpriseObject
localInstanceOf
in interface ERXEnterpriseObject
eo
- to local instancepublic EOEnterpriseObject localInstanceIn(EOEditingContext ec)
ERXEnterpriseObject
localInstanceIn
in interface ERXEnterpriseObject
ec
- editing context to local instance inpublic <T extends EOEnterpriseObject> NSArray<T> localInstancesOf(NSArray<T> eos)
ERXEnterpriseObject
localInstancesOf
in interface ERXEnterpriseObject
eos
- array of EOs to local instancepublic NSDictionary<String,Object> changesFromCommittedSnapshot()
ERXEnterpriseObject
changesFromCommittedSnapshot
in interface ERXEnterpriseObject
public boolean hasKeyChangedFromCommittedSnapshot(String key)
key
- The key that you wish to check has changed from the committed snapshotpublic <T> boolean hasKeyChangedFromCommittedSnapshot(ERXKey<T> key)
key
- The key that you wish to check has changed from the committed snapshotpublic boolean hasKeyChangedFromCommittedSnapshotFromValue(String key, Object oldValue)
key
- The key that you wish to check has changed from the committed snapshotoldValue
- The value you wish to see if the key has changed from EG. Has 'status' changed from
STATUS.PENDING_STATUSpublic <T> boolean hasKeyChangedFromCommittedSnapshotFromValue(ERXKey<T> key, T oldValue)
key
- The key that you wish to check has changed from the committed snapshotoldValue
- The value you wish to see if the key has changed from EG. Has 'status' changed from
STATUS.PENDING_STATUSpublic boolean hasKeyChangedFromCommittedSnapshotFromValueToNewValue(String key, Object oldValue, Object newValue)
key
- The key that you wish to check has changed from the committed snapshotoldValue
- The value you wish to see if the key has changed fromnewValue
- The value you wish to see if the key has changed to EG. Has 'status' changed from
STATUS.PENDING_STATUS to STATUS.CONFIRMED_STATUSpublic <T> boolean hasKeyChangedFromCommittedSnapshotFromValueToNewValue(ERXKey<T> key, T oldValue, T newValue)
key
- The key that you wish to check has changed from the committed snapshotoldValue
- The value you wish to see if the key has changed fromnewValue
- The value you wish to see if the key has changed to EG. Has 'status' changed from
STATUS.PENDING_STATUS to STATUS.CONFIRMED_STATUSpublic boolean hasKeyChangedFromCommittedSnapshotToValue(String key, Object newValue)
key
- The key that you wish to check has changed from the committed snapshotnewValue
- The value you wish to see if the key has changed to EG. Has 'status' changed to
STATUS.CANCELLED_STATUSpublic <T> boolean hasKeyChangedFromCommittedSnapshotToValue(ERXKey<T> key, T newValue)
key
- The key that you wish to check has changed from the committed snapshotnewValue
- The value you wish to see if the key has changed to EG. Has 'status' changed to
STATUS.CANCELLED_STATUSpublic boolean parentObjectStoreIsObjectStoreCoordinator()
ERXEnterpriseObject
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.parentObjectStoreIsObjectStoreCoordinator
in interface ERXEnterpriseObject
public ERXEnterpriseObject refetchObjectFromDB()
refetchObjectFromDBinEditingContext(EOEditingContext ec)
and
passes the object's Editing Context as Editing Context parameter.public ERXEnterpriseObject refetchObjectFromDBinEditingContext(EOEditingContext ec)
ERXEnterpriseObject
refetchObjectFromDBinEditingContext
in interface ERXEnterpriseObject
ec
- the editing context in which the result will be placedpublic EOKeyGlobalID permanentGlobalID(boolean generateIfMissing)
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.generateIfMissing
- if false
and this object has a
temporary global ID, null
will be returned.null
public EOKeyGlobalID permanentGlobalID()
true
for generateIfMissing.permanentGlobalID(boolean)
public String toString()
toLongString
. To restore the original verbose logging in
your subclasses override this method and return toLongString.toString
in class EOCustomObject
public String toLongString()
ERXEnterpriseObject
toLongString
in interface ERXEnterpriseObject
toString
.public void trimSpaces()
ERXEnterpriseObject
trimSpaces
in interface ERXEnterpriseObject
public boolean isDeletedEO()
ERXEnterpriseObject
isDeletedEO
in interface ERXEnterpriseObject
public boolean isNewObject()
ERXEnterpriseObject
isNewObject
in interface ERXEnterpriseObject
public boolean isUpdatedObject()
true
if this EO's snapshot does not match the original snapshotpublic void setValidatedWhenNested(boolean validatedWhenNested)
validatedWhenNested
- public boolean isValidatedWhenNested()
public Object handleQueryWithUnboundKey(String key)
handleQueryWithUnboundKey
in interface NSKeyValueCoding.ErrorHandling
handleQueryWithUnboundKey
in class EOCustomObject
EOCustomObject.handleQueryWithUnboundKey(java.lang.String)
public Object validateValueForKey(Object value, String key) throws NSValidation.ValidationException
ERXEntityClassDescription
or subclass. It is that class that
provides the hooks to convert model thrown validation exceptions into
ERXValidationException
objects.
The order of validation processed is, if applicable:
User.validateName()
)ERXEntityClassDescription
)validateValueForKey
in interface NSValidation
validateValueForKey
in class EOCustomObject
value
- to be validated for a given attribute or relationshipkey
- corresponding to an attribute or relationshipNSValidation.ValidationException
- if the value fails validationprotected Object _validateValueForKey(Object value, String key) throws NSValidation.ValidationException
NSValidation.ValidationException
protected boolean shouldSkipValidateForSave()
validateForSave()
should be skipped. That is the case
when _validatedWhenNested is false
and this EO is localInstanced
from a parent EC.true
if validation should be skippedpublic void validateForSave() throws NSValidation.ValidationException
validateForSave
in interface EOValidation
validateForSave
in class EOCustomObject
NSValidation.ValidationException
- if the object does not pass validation for saving to the
database.public void validateForInsert() throws NSValidation.ValidationException
validateForInsert
in interface EOValidation
validateForInsert
in class EOCustomObject
NSValidation.ValidationException
- if the object does not pass validation for saving to the
database.public void validateForUpdate() throws NSValidation.ValidationException
validateForUpdate
in interface EOValidation
validateForUpdate
in class EOCustomObject
NSValidation.ValidationException
- if the object does not pass validation for saving to the
database.public void includeObjectIntoPropertyWithKey(Object o, String key)
includeObjectIntoPropertyWithKey
in class EOCustomObject
public void excludeObjectFromPropertyWithKey(Object o, String key)
excludeObjectFromPropertyWithKey
in class EOCustomObject
public void takeValueForKey(Object value, String key)
takeValueForKey
in interface NSKeyValueCoding
takeValueForKey
in class EOCustomObject
public void takeStoredValueForKey(Object value, String key)
takeStoredValueForKey
in interface EOKeyValueCoding
takeStoredValueForKey
in class EOCustomObject
public void updateFromSnapshot(NSDictionary snapshot)
updateFromSnapshot
in interface EOEnterpriseObject
updateFromSnapshot
in class EOCustomObject
public static void checkMatchingEditingContexts(EOEnterpriseObject source, String relationshipName, EOEnterpriseObject destination)
source
- the source objectrelationshipName
- the name of the relationship that is being updateddestination
- the destination objectRuntimeException
- if the editing contexts do not matchpublic long batchFaultingTimeStamp()
batchFaultingTimeStamp
in interface ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject
public EOGlobalID batchFaultingSourceGlobalID()
batchFaultingSourceGlobalID
in interface ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject
public String batchFaultingRelationshipName()
batchFaultingRelationshipName
in interface ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject
public void touchFromBatchFaultingSource(ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject toucher, String key)
touchFromBatchFaultingSource
in interface ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject
toucher
- key
- public void setBatchFaultingTimestamp(long timestamp)
setBatchFaultingTimestamp
in interface ERXDatabaseContextDelegate.AutoBatchFaultingEnterpriseObject
timestamp
- public final Boolean isNonNull()
isNonNull
in interface ERXNonNullObjectInterface
Copyright © 2002 – 2024 Project Wonder.