public interface ApiAdapter extends Serializable
Modifier and Type | Method and Description |
---|---|
boolean |
allowDeleteOfNonPersistentObject()
Whether the API allows deletion of a non-persistent object.
|
boolean |
allowPersistOfDeletedObject()
Whether the API allows (re-)persistence of a deleted object.
|
boolean |
allowReadFieldOfDeletedObject()
Whether the API allows reading a field of a deleted object.
|
boolean |
clearLoadedFlagsOnDeleteObject()
Whether the API requires clearing of the fields of an object when it is deleted.
|
void |
copyFieldsFromPersistableObject(Object pc,
int[] fieldNumbers,
Object pc2)
Method to copy field values from the first persistable object across to the second persistable object.
|
RuntimeException |
getApiExceptionForNucleusException(NucleusException ne)
Convenience method to convert the passed NucleusException into an exception for the API.
|
Object |
getCopyOfPersistableObject(Object pc,
ObjectProvider sm,
int[] fieldNumbers)
Method to return a copy of the provided object, managed by the passed StateManager, copying across
the specified fields.
|
RuntimeException |
getDataStoreExceptionForException(String msg,
Exception e)
Convenience method to return a datastore exception appropriate for this API.
|
boolean |
getDefaultCascadeDeleteForField()
Method to return the default setting for cascading delete of a field
|
boolean |
getDefaultCascadePersistForField()
Method to return the default setting for cascading persist of a field
|
boolean |
getDefaultCascadeRefreshForField()
Method to return the default setting for cascading refresh of a field
|
boolean |
getDefaultCascadeUpdateForField()
Method to return the default setting for cascading update of a field
|
Map |
getDefaultFactoryProperties()
Method to return a set of default properties for the factory (PMF, EMF, etc)
|
ExecutionContext |
getExecutionContext(Object pc)
Method to return the ExecutionContext (if any) associated with the passed object.
|
Object |
getIdForObject(Object obj)
Method to return the object identity for the passed persistable object.
|
Class |
getKeyTypeForSingleFieldIdentityType(Class idType)
Accessor for the type of the single field application-identity key given the single field identity type.
|
LifeCycleState |
getLifeCycleState(int stateType)
Returns the LifeCycleState for the state constant.
|
String |
getName()
Accessor for the name of the API.
|
Object |
getNewApplicationIdentityObjectId(ClassLoaderResolver clr,
AbstractClassMetaData acmd,
String value)
Utility to create a new application-identity when you know the metadata for the target class,
and the toString() output of the identity.
|
Object |
getNewApplicationIdentityObjectId(Class cls,
Object key)
Method to return a new object identity for the specified class, and key (possibly toString() output).
|
Object |
getNewApplicationIdentityObjectId(Object pc,
AbstractClassMetaData cmd)
Method to create a new application-identity for the passed object with the supplied MetaData.
|
Object |
getNewSingleFieldIdentity(Class idType,
Class pcType,
Object value)
Utility to create a new SingleFieldIdentity using reflection when you know the
type of the PersistenceCapable, and also which SingleFieldIdentity, and the value of the key.
|
Object |
getObjectId(ObjectProvider sm)
Accessor for the object id from the StateManager for this object.
|
String |
getObjectState(Object obj)
Accessor for the object state.
|
String |
getSingleFieldIdentityClassNameForByte()
Accessor for the class name to use for identities when there is a single Byte/byte field.
|
String |
getSingleFieldIdentityClassNameForChar()
Accessor for the class name to use for identities when there is a single Character/char field.
|
String |
getSingleFieldIdentityClassNameForInt()
Accessor for the class name to use for identities when there is a single Integer/int field.
|
String |
getSingleFieldIdentityClassNameForLong()
Accessor for the class name to use for identities when there is a single Long/long field.
|
String |
getSingleFieldIdentityClassNameForObject()
Accessor for the class name to use for identities when there is a single Object field.
|
String |
getSingleFieldIdentityClassNameForShort()
Accessor for the class name to use for identities when there is a single Short/short field.
|
String |
getSingleFieldIdentityClassNameForString()
Accessor for the class name to use for identities when there is a single String field.
|
Class |
getTargetClassForSingleFieldIdentity(Object id)
Accessor for the target class for the specified single field identity.
|
String |
getTargetClassNameForSingleFieldIdentity(Object id)
Accessor for the target class name for the specified single field identity.
|
Object |
getTargetKeyForSingleFieldIdentity(Object id)
Accessor for the key object for the specified single field identity.
|
RuntimeException |
getUserExceptionForException(String msg,
Exception e)
Convenience method to return a user exception appropriate for this API when an unexpected
exception occurs.
|
Object |
getVersion(ObjectProvider sm)
Accessor for the version from the StateManager for this object.
|
Object |
getVersionForObject(Object obj)
Method to return the object version for the passed persistable object.
|
boolean |
isDatastoreIdentity(Object id)
Accessor for whether the passed identity is a valid datastore-identity for this API.
|
boolean |
isDeleted(Object obj)
Accessor for whether the passed object is deleted.
|
boolean |
isDetachable(Object obj)
Method to return if the passed object is detachable using this API.
|
boolean |
isDetached(Object obj)
Accessor for whether the passed object is detached.
|
boolean |
isDirty(Object obj)
Accessor for whether the passed object is dirty.
|
boolean |
isLoaded(ObjectProvider sm,
int fieldNumber)
Accessor for whether a field is loaded for the object managed by the StateManager
|
boolean |
isManaged(Object pc)
Whether the provided object is currently managed (has an ObjectManager).
|
boolean |
isNew(Object obj)
Accessor for whether the passed object is new.
|
boolean |
isPersistable(Class cls)
Utility method to check if the specified class is of a type that can be persisted for this API.
|
boolean |
isPersistable(Object obj)
Method to return if the passed object is persistable using this API.
|
boolean |
isPersistent(Object obj)
Accessor for whether the passed object is persistent.
|
boolean |
isSingleFieldIdentity(Object id)
Accessor for whether the passed identity is a valid single-field application-identity for this API.
|
boolean |
isSingleFieldIdentityClass(String className)
Accessor for whether the passed class name is a valid single-field application-identity for this API.
|
boolean |
isTransactional(Object obj)
Accessor for whether the passed object is transactional.
|
boolean |
isValidPrimaryKeyClass(Class pkClass,
AbstractClassMetaData cmd,
ClassLoaderResolver clr,
int noOfPkFields,
MetaDataManager mmgr)
Utility to check if a primary-key class is valid.
|
void |
makeDirty(Object obj,
String member)
Method to make the member of the persistable object dirty.
|
String getName()
boolean isManaged(Object pc)
ExecutionContext getExecutionContext(Object pc)
pc
- The objectLifeCycleState getLifeCycleState(int stateType)
stateType
- the type as integerboolean isPersistent(Object obj)
obj
- The objectboolean isNew(Object obj)
obj
- The objectboolean isDirty(Object obj)
obj
- The objectboolean isDeleted(Object obj)
obj
- The objectboolean isDetached(Object obj)
obj
- The objectboolean isTransactional(Object obj)
obj
- The objectboolean isPersistable(Object obj)
obj
- The objectboolean isPersistable(Class cls)
cls
- The class to checkboolean isDetachable(Object obj)
obj
- The objectString getObjectState(Object obj)
obj
- Objectvoid makeDirty(Object obj, String member)
obj
- The objectmember
- Name of the memberObject getIdForObject(Object obj)
obj
- The objectObject getVersionForObject(Object obj)
obj
- The objectboolean isValidPrimaryKeyClass(Class pkClass, AbstractClassMetaData cmd, ClassLoaderResolver clr, int noOfPkFields, MetaDataManager mmgr)
pkClass
- The Primary Key classcmd
- AbstractClassMetaData for the PersistenceCapable classclr
- the ClassLoaderResolvernoOfPkFields
- Number of primary key fieldsmmgr
- MetaData managerboolean isSingleFieldIdentity(Object id)
boolean isDatastoreIdentity(Object id)
boolean isSingleFieldIdentityClass(String className)
className
- Name of the classString getSingleFieldIdentityClassNameForLong()
String getSingleFieldIdentityClassNameForInt()
String getSingleFieldIdentityClassNameForShort()
String getSingleFieldIdentityClassNameForByte()
String getSingleFieldIdentityClassNameForChar()
String getSingleFieldIdentityClassNameForString()
String getSingleFieldIdentityClassNameForObject()
Class getTargetClassForSingleFieldIdentity(Object id)
id
- The identityString getTargetClassNameForSingleFieldIdentity(Object id)
id
- The identityObject getTargetKeyForSingleFieldIdentity(Object id)
id
- The identityClass getKeyTypeForSingleFieldIdentityType(Class idType)
idType
- Single field identity typeObject getNewSingleFieldIdentity(Class idType, Class pcType, Object value)
idType
- Type of SingleFieldIdentitypcType
- Type of the PersistenceCapablevalue
- The value for the identity (the Long, or Int, or ... etc).NucleusException
- if invalid input is receivedObject getNewApplicationIdentityObjectId(ClassLoaderResolver clr, AbstractClassMetaData acmd, String value)
clr
- ClassLoader resolveracmd
- MetaData for the target classvalue
- String form of the keyNucleusException
- if invalid input is receivedObject getNewApplicationIdentityObjectId(Object pc, AbstractClassMetaData cmd)
pc
- The persistable objectcmd
- Its metadataObject getNewApplicationIdentityObjectId(Class cls, Object key)
cls
- Persistable classkey
- form of the object idboolean allowPersistOfDeletedObject()
boolean allowDeleteOfNonPersistentObject()
boolean allowReadFieldOfDeletedObject()
boolean clearLoadedFlagsOnDeleteObject()
boolean getDefaultCascadePersistForField()
boolean getDefaultCascadeUpdateForField()
boolean getDefaultCascadeDeleteForField()
boolean getDefaultCascadeRefreshForField()
Map getDefaultFactoryProperties()
Object getObjectId(ObjectProvider sm)
sm
- StateManagerObject getVersion(ObjectProvider sm)
sm
- StateManagerboolean isLoaded(ObjectProvider sm, int fieldNumber)
sm
- StateManagerfieldNumber
- Number of the fieldRuntimeException getApiExceptionForNucleusException(NucleusException ne)
ne
- The NucleusExceptionRuntimeException getUserExceptionForException(String msg, Exception e)
msg
- The messagee
- The cause (if any)RuntimeException getDataStoreExceptionForException(String msg, Exception e)
msg
- The messagee
- The cause (if any)Object getCopyOfPersistableObject(Object pc, ObjectProvider sm, int[] fieldNumbers)
pc
- Persistable objectsm
- The Object ProviderfieldNumbers
- Fields to copyvoid copyFieldsFromPersistableObject(Object pc, int[] fieldNumbers, Object pc2)
pc
- First persistable objectfieldNumbers
- Fields to copypc2
- Second persistable object (to have the values copied into it)Copyright © 2012. All Rights Reserved.