Package com.groiss.store
Interface Persistent
- All Superinterfaces:
KeyValuePair<String,
,String> Serializable
- All Known Subinterfaces:
Agent
,BatchJob
,ClassifierAssignment
,DMSDocForm
,DMSFolder
,DMSFolderForm
,DMSForm
,DMSLink
,DMSNote
,DMSObject
,DMSWebLink
,Exportable
,Function
,Keyword
,LogEntry
,MailQueueItem
,OrgClass
,OrgTree
,OrgUnit
,Permission
,PermissionList
,PersistentVersion
,Report
,Right
,Role
,TimerEntry
,User
,UserRole
,View
- All Known Implementing Classes:
BasicEvent
,CheckedPersistent
,DirectoryServer
,EvaluationResult
,ExportablePersistentObject
,Lock
,Partner
,PersistentObject
,ProcessInstanceView
,ProcessRelation
,Recipient
Objects implementing this interface can be stored with the persistence
mechanism of @enterprise. Usually you will not implement this interface
directly. It's better to extend the abstract class
Persistent objects can be stored with the methods provided by
PersistentObject
, which provides a default
implementation, and override some methods if necessary.
Persistent objects can be stored with the methods provided by
OrgData
or Store
(get
instances of them from OrgData.getInstance()
or Store.getInstance()
).
The difference between them is that OrgData
checks user rights, creates log entries if necessary, etc.
So, in most cases it is a good idea to use OrgData
methods.-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is called after the persistent object has been deleted.void
This method is called after the persistent object has been inserted into the store.void
This method is called after the persistent object has been read.void
This method is called after the persistent object has been updated in the store.void
This method is called before the persistent object is deleted.void
This method is called before the persistent object is inserted into the store.void
This method is called before the persistent object is updated in the store (the existing object in the store will be overwritten with the values of this object).dbFields()
This method must return the persistent fields of this persistent object.getKey()
Returns the key (className:OID) of thisKeyValuePair
.String[][]
getKeys()
A class may return key field groups in order to identify already existing objects of that class.Get the object name in localized form.long
getOid()
Getter method for the persistent object's OID.default Store
getStore()
Deprecated, for removal: This API element is subject to removal in a future version.This method must return the table name of the database table in which this persistent object is stored.getValue()
Returns the value (String
representation) of thisKeyValuePair
.boolean
isFilled()
With this method you check if this persistent object is filled with persistent data or not.void
isValid()
Overwrite this method to check object validity.void
setFilled
(boolean f) This method can change the filled status of this persistent object.void
setOid()
Setter method for the persistent object's OID.void
setOid
(long oid) Setter method for the persistent object's OID.Returns a special string representation of the object.
-
Field Details
-
emptyKeys
Empty String array which can be used by classes which don't want to define keys.
-
-
Method Details
-
getOid
long getOid()Getter method for the persistent object's OID.- Returns:
- The OID of the persistent object.
-
setOid
void setOid()Setter method for the persistent object's OID. Usually you will never need to set the OID of an object directly, because OIDs are assigned automatically when the object is inserted into the database. Sometimes it may be necessary to set the OID earlier in order to reference the object. -
setOid
void setOid(long oid) Setter method for the persistent object's OID. Usually you will never need to set the OID of an object directly, because OIDs are assigned automatically.- Parameters:
oid
- The new OID for the object.
-
getStore
Deprecated, for removal: This API element is subject to removal in a future version.Will always return the store for the systems database. UseStore.getInstance()
instead.- Returns:
- The
Store
of this persistent object.
-
getTableName
String getTableName()This method must return the table name of the database table in which this persistent object is stored.- Returns:
- The table name of the database table in which this persistent object is stored.
-
dbFields
This method must return the persistent fields of this persistent object.- Returns:
- A
List
containing the persistent fields of this persistent object. TheList
must contain the fields asjava.lang.reflect.Field
objects.
-
beforeInsert
void beforeInsert()This method is called before the persistent object is inserted into the store. -
afterInsert
void afterInsert()This method is called after the persistent object has been inserted into the store. -
beforeUpdate
void beforeUpdate()This method is called before the persistent object is updated in the store (the existing object in the store will be overwritten with the values of this object). -
afterUpdate
void afterUpdate()This method is called after the persistent object has been updated in the store. -
beforeDelete
void beforeDelete()This method is called before the persistent object is deleted. Note that theStore.delete(Class, String, Object[])
andStore.delete(String, String, Object[])
methods do NOT callbeforeDelete()
. -
afterDelete
void afterDelete()This method is called after the persistent object has been deleted. Note that theStore.delete(Class, String, Object[])
andStore.delete(String, String, Object[])
methods do NOT callafterDelete()
. -
afterRead
void afterRead()This method is called after the persistent object has been read. -
setFilled
void setFilled(boolean f) This method can change the filled status of this persistent object. SeeisFilled()
for more details.- Parameters:
f
- The new value for the filled status.
-
isFilled
boolean isFilled()With this method you check if this persistent object is filled with persistent data or not. If it is not filled, you can use theStore
to fill it.- Returns:
true
if the object is filled with values, orfalse
if the object is empty (only OID is set).
-
getKey
String getKey()Returns the key (className:OID) of thisKeyValuePair
.- Specified by:
getKey
in interfaceKeyValuePair<String,
String>
-
getValue
String getValue()Returns the value (String
representation) of thisKeyValuePair
.- Specified by:
getValue
in interfaceKeyValuePair<String,
String>
-
getLocalObjectName
String getLocalObjectName()Get the object name in localized form.- Returns:
- the name of the objects in localized form
-
getLocalClassName
String getLocalClassName()- Returns:
- the name of the class in localized form.
-
toListString
String toListString()Returns a special string representation of the object.- Returns:
- a string representation of this Object suitable for usage in lists
-
isValid
void isValid()Overwrite this method to check object validity. It is called before the database insert resp. update operations are to be performed, but after the calls tobeforeInsert()
resp.beforeUpdate()
were made. The call can be avoided usingPersistentAspect.NO_VALIDATION
The method should throw an ApplicationException or RunTimeException when the object is considered to be invalid. -
getKeys
String[][] getKeys()A class may return key field groups in order to identify already existing objects of that class. A key field group must uniquely identify an object. Multiple such key field groups can be defined. Each of the key field groups must be unique for an object to be unique (thus, group1 matches OR group2 matches etc.).The first key field group is occasionally treated in a special manner as the primary business key. E.g. the export import functionality checks for object existence according to just the first key field group.
If no key field groups can be provided by the implementing class an empty result must be returned - use
emptyKeys
to do so.- Returns:
- An array of arrays containing object field names of those fields which
constitute key field groups for uniquely identifying objects of classes implementing this
interface. An example would be
{{"name", "birthdate"},{"ssn"}}
for a class defining two key field groups. The first one contains the fieldsname
andbirthdate
, the second key field group has just one fieldssn
.
-