Interface ApiAdapter
- All Superinterfaces:
Serializable
Adapter to allow the core runtime to expose multiple APIs to clients.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the API allows deletion of a non-persistent object.booleanWhether the API allows (re-)persistence of a deleted object.booleanWhether the API allows reading a field of a deleted object.booleanWhether the API requires clearing of the fields of an object when it is deleted.default voidMethod to set the pk fields of the object from the provided identity.Convenience method to convert the passed NucleusException into an exception for the API.Convenience method to return a datastore exception appropriate for this API.booleanMethod to return the default setting for cascading attach of a fieldbooleanMethod to return the default setting for cascading delete of a fieldbooleanMethod to return the default setting for cascading detach of a fieldbooleanMethod to return the default setting for cascading persist of a fieldbooleanMethod to return the default setting for cascading refresh of a fieldbooleanMethod to return the default DFG setting for a persistable field.Method to return a set of default properties for the factory (PMF, EMF, etc)Method to return any default location that doesn't need specifying for "mapping-file" in the persistence.xml.booleanWhether we should add in metadata when using persistent properties and a property is not specified.Method to return the ExecutionContext (if any) associated with the passed object.default ObjectgetIdForObject(Object obj) Method to return the object identity for the passed persistable object.getLifeCycleState(int stateType) Returns the LifeCycleState for the state constant.getName()Accessor for the name of the API.default StringgetObjectState(Object pc) Accessor for the object state.default StateManagerAccessor for the state manager for the object.Convenience method to return a user exception appropriate for this API when an unexpected exception occurs.default ObjectMethod to return the object version for the passed persistable object.getXMLMetaDataForClass(AbstractClassMetaData cmd, String prefix, String indent) default booleanAccessor for whether the passed object is deleted.default booleanisDetachable(Object obj) Method to return if the passed object is detachable using this API.default booleanisDetached(Object obj) Accessor for whether the passed object is detached.default booleanAccessor for whether the passed object is dirty.default booleanWhether the provided object is currently managed (has an ExecutionContext).booleanAccessor for whether this member type is default persistent.default booleanAccessor for whether the passed object is new.default booleanisPersistable(Class cls) Utility method to check if the specified class is of a type that can be persisted for this API.default booleanisPersistable(Object obj) Method to return if the passed object is persistable using this API.default booleanisPersistent(Object obj) Accessor for whether the passed object is persistent.default booleanisTransactional(Object obj) Accessor for whether the passed object is transactional.booleanisValidPrimaryKeyClass(Class pkClass, AbstractClassMetaData cmd, ClassLoaderResolver clr, int noOfPkFields, MetaDataManager mmgr) Utility to check if a primary-key class is valid.default voidMethod to make the member of the persistable object dirty.
-
Method Details
-
getName
-
isMemberDefaultPersistent
Accessor for whether this member type is default persistent.- Parameters:
type- Member type- Returns:
- Whether it is by default persistent
-
getXMLMetaDataForClass
-
getDefaultMappingFileLocation
String getDefaultMappingFileLocation()Method to return any default location that doesn't need specifying for "mapping-file" in the persistence.xml. With JPA/Jakarta this is META-INF/orm.xml. With JDO we don't have such a location.- Returns:
- The default location to try for a mapping-file for this API
-
isManaged
Whether the provided object is currently managed (has an ExecutionContext).- Parameters:
pc- The persistable object- Returns:
- Whether it is managed
-
getStateManager
Accessor for the state manager for the object.- Parameters:
pc- The object- Returns:
- The StateManager managing this object
-
getExecutionContext
Method to return the ExecutionContext (if any) associated with the passed object. Supports persistable objects, and PersistenceManager.- Parameters:
pc- The object- Returns:
- The ExecutionContext
-
getLifeCycleState
Returns the LifeCycleState for the state constant.- Parameters:
stateType- the type as integer- Returns:
- the type as LifeCycleState object
-
isPersistent
Accessor for whether the passed object is persistent.- Parameters:
obj- The object- Returns:
- Whether it is persistent
-
isNew
Accessor for whether the passed object is new.- Parameters:
obj- The object- Returns:
- Whether it is new
-
isDirty
Accessor for whether the passed object is dirty.- Parameters:
obj- The object- Returns:
- Whether it is dirty
-
isDeleted
Accessor for whether the passed object is deleted.- Parameters:
obj- The object- Returns:
- Whether it is deleted
-
isDetached
Accessor for whether the passed object is detached.- Parameters:
obj- The object- Returns:
- Whether it is detached
-
isTransactional
Accessor for whether the passed object is transactional.- Parameters:
obj- The object- Returns:
- Whether it is transactional
-
isPersistable
Method to return if the passed object is persistable using this API.- Parameters:
obj- The object- Returns:
- Whether it is persistable
-
isPersistable
Utility method to check if the specified class is of a type that can be persisted for this API.- Parameters:
cls- The class to check- Returns:
- Whether the class is persistable using this API.
-
isDetachable
Method to return if the passed object is detachable using this API.- Parameters:
obj- The object- Returns:
- Whether it is detachable
-
getObjectState
-
makeDirty
-
getIdForObject
-
getVersionForObject
-
isValidPrimaryKeyClass
boolean isValidPrimaryKeyClass(Class pkClass, AbstractClassMetaData cmd, ClassLoaderResolver clr, int noOfPkFields, MetaDataManager mmgr) Utility to check if a primary-key class is valid. Will throw a InvalidPrimaryKeyException if it is invalid, otherwise returning true.- Parameters:
pkClass- The Primary Key classcmd- AbstractClassMetaData for the persistable classclr- the ClassLoaderResolvernoOfPkFields- Number of primary key fieldsmmgr- MetaData manager- Returns:
- Whether it is valid
-
copyKeyFieldsFromIdToObject
default void copyKeyFieldsFromIdToObject(Object pc, Persistable.ObjectIdFieldConsumer fm, Object id) Method to set the pk fields of the object from the provided identity.- Parameters:
pc- The persistable objectfm- ObjectIdFieldConsumerid- The identity
-
allowPersistOfDeletedObject
boolean allowPersistOfDeletedObject()Whether the API allows (re-)persistence of a deleted object.- Returns:
- Whether you can call persist on a deleted object
-
allowDeleteOfNonPersistentObject
boolean allowDeleteOfNonPersistentObject()Whether the API allows deletion of a non-persistent object.- Returns:
- Whether you can call delete on an object not yet persisted
-
allowReadFieldOfDeletedObject
boolean allowReadFieldOfDeletedObject()Whether the API allows reading a field of a deleted object.- Returns:
- Whether you can read after deleting
-
clearLoadedFlagsOnDeleteObject
boolean clearLoadedFlagsOnDeleteObject()Whether the API requires clearing of the fields of an object when it is deleted.- Returns:
- Whether to clear loaded fields at delete
-
getDefaultCascadePersistForField
boolean getDefaultCascadePersistForField()Method to return the default setting for cascading persist of a field- Returns:
- default persist cascade setting.
-
getDefaultCascadeDeleteForField
boolean getDefaultCascadeDeleteForField()Method to return the default setting for cascading delete of a field- Returns:
- default cascade delete setting.
-
getDefaultCascadeAttachForField
boolean getDefaultCascadeAttachForField()Method to return the default setting for cascading attach of a field- Returns:
- default cascade attach setting.
-
getDefaultCascadeDetachForField
boolean getDefaultCascadeDetachForField()Method to return the default setting for cascading detach of a field- Returns:
- default cascade detach setting.
-
getDefaultCascadeRefreshForField
boolean getDefaultCascadeRefreshForField()Method to return the default setting for cascading refresh of a field- Returns:
- default cascade refresh setting.
-
getDefaultDFGForPersistableField
boolean getDefaultDFGForPersistableField()Method to return the default DFG setting for a persistable field.- Returns:
- DFG default for persistable field
-
getDefaultFactoryProperties
-
getDefaultPersistentPropertyWhenNotSpecified
boolean getDefaultPersistentPropertyWhenNotSpecified()Whether we should add in metadata when using persistent properties and a property is not specified. True means we add in metadata when not explicitly specified. False means if a property is not defined then it is not persistent.- Returns:
- Whether to default it (JDO = false, JPA/Jakarta = true)
-
getApiExceptionForNucleusException
Convenience method to convert the passed NucleusException into an exception for the API.- Parameters:
ne- The NucleusException- Returns:
- The Api Exception
-
getUserExceptionForException
Convenience method to return a user exception appropriate for this API when an unexpected exception occurs.- Parameters:
msg- The messagee- The cause (if any)- Returns:
- The API exception
-
getDataStoreExceptionForException
Convenience method to return a datastore exception appropriate for this API.- Parameters:
msg- The messagee- The cause (if any)- Returns:
- The exception
-