Package com.groiss.store
Class PersistentObject
java.lang.Object
com.groiss.store.PersistentObject
- All Implemented Interfaces:
KeyValuePair<String,
,String> Persistent
,Serializable
,Cloneable
- Direct Known Subclasses:
BasicEvent
,ExportablePersistentObject
,Lock
,Partner
,ProcessInstanceView
,ProcessRelation
This is a default implementation of the
This abstract class also implements the
Persistent
interface. All methods apart from Persistent.getTableName()
are implemented with default behaviour.This abstract class also implements the
KeyValuePair
interface. So persistent objects become key value pairs, where the object's
OID is the key and the object's String
representation is the
value.- See Also:
-
Field Summary
Fields inherited from interface com.groiss.store.Persistent
emptyKeys
-
Constructor 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).clone()
dbFields()
Returns the persistent fields of this object in aList
containingjava.lang.reflect.Field
objects.boolean
Compares two persistent objects and returnstrue
if they are equal (i.e., they must have the same OID and the same class).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.getValue()
Returns the value (String
representation) of thisKeyValuePair
.int
hashCode()
Returns a hash code for this persistent object.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 ids, etc.void
onDelete()
Deprecated, for removal: This API element is subject to removal in a future version.void
onInsert()
Deprecated, for removal: This API element is subject to removal in a future version.UsebeforeInsert()
instead.void
onRead()
Deprecated, for removal: This API element is subject to removal in a future version.UseafterRead()
instead.void
onUpdate()
Deprecated, for removal: This API element is subject to removal in a future version.UsebeforeUpdate()
instead.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.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.groiss.store.Persistent
getStore, getTableName
-
Field Details
-
oid
protected long oid -
filled
protected boolean filled
-
-
Constructor Details
-
PersistentObject
public PersistentObject()
-
-
Method Details
-
getOid
public long getOid()Description copied from interface:Persistent
Getter method for the persistent object's OID.- Specified by:
getOid
in interfacePersistent
- Returns:
- The OID of the persistent object.
-
setOid
public void setOid(long oid) Description copied from interface:Persistent
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.- Specified by:
setOid
in interfacePersistent
- Parameters:
oid
- The new OID for the object.
-
setOid
public void setOid()Description copied from interface:Persistent
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.- Specified by:
setOid
in interfacePersistent
-
setFilled
public void setFilled(boolean f) Description copied from interface:Persistent
This method can change the filled status of this persistent object. SeePersistent.isFilled()
for more details.- Specified by:
setFilled
in interfacePersistent
- Parameters:
f
- The new value for the filled status.
-
isFilled
public boolean isFilled()Description copied from interface:Persistent
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.- Specified by:
isFilled
in interfacePersistent
- Returns:
true
if the object is filled with values, orfalse
if the object is empty (only OID is set).
-
dbFields
Returns the persistent fields of this object in aList
containingjava.lang.reflect.Field
objects.- Specified by:
dbFields
in interfacePersistent
- Returns:
- A
List
containing the persistent fields of this persistent object. TheList
must contain the fields asjava.lang.reflect.Field
objects.
-
onInsert
Deprecated, for removal: This API element is subject to removal in a future version.UsebeforeInsert()
instead. -
onUpdate
Deprecated, for removal: This API element is subject to removal in a future version.UsebeforeUpdate()
instead. -
onDelete
Deprecated, for removal: This API element is subject to removal in a future version.UsebeforeDelete()
instead. -
onRead
Deprecated, for removal: This API element is subject to removal in a future version.UseafterRead()
instead. -
beforeInsert
public void beforeInsert()Description copied from interface:Persistent
This method is called before the persistent object is inserted into the store.- Specified by:
beforeInsert
in interfacePersistent
- See Also:
-
afterInsert
public void afterInsert()Description copied from interface:Persistent
This method is called after the persistent object has been inserted into the store.- Specified by:
afterInsert
in interfacePersistent
- See Also:
-
beforeUpdate
public void beforeUpdate()Description copied from interface:Persistent
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).- Specified by:
beforeUpdate
in interfacePersistent
- See Also:
-
afterUpdate
public void afterUpdate()Description copied from interface:Persistent
This method is called after the persistent object has been updated in the store.- Specified by:
afterUpdate
in interfacePersistent
- See Also:
-
beforeDelete
public void beforeDelete()Description copied from interface:Persistent
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 callPersistent.beforeDelete()
.- Specified by:
beforeDelete
in interfacePersistent
- See Also:
-
afterDelete
public void afterDelete()Description copied from interface:Persistent
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 callPersistent.afterDelete()
.- Specified by:
afterDelete
in interfacePersistent
- See Also:
-
afterRead
public void afterRead()Description copied from interface:Persistent
This method is called after the persistent object has been read.- Specified by:
afterRead
in interfacePersistent
- See Also:
-
equals
Compares two persistent objects and returnstrue
if they are equal (i.e., they must have the same OID and the same class). -
hashCode
public int hashCode()Returns a hash code for this persistent object. Equal objects must have equal hash codes, so the object's OID is used as hash code. -
getKey
Returns the key (className:OID) of thisKeyValuePair
.- Specified by:
getKey
in interfaceKeyValuePair<String,
String> - Specified by:
getKey
in interfacePersistent
-
getValue
Returns the value (String
representation) of thisKeyValuePair
.- Specified by:
getValue
in interfaceKeyValuePair<String,
String> - Specified by:
getValue
in interfacePersistent
-
getLocalObjectName
Get the object name in localized form. Subclasses should override this method!- Specified by:
getLocalObjectName
in interfacePersistent
- Returns:
- the name of the objects in localized form
-
getLocalClassName
- Specified by:
getLocalClassName
in interfacePersistent
- Returns:
- the name of the class in localized form. Subclasses should override this method!
-
toListString
Returns a special string representation of the object.- Specified by:
toListString
in interfacePersistent
- Returns:
- a string representation of this Object suitable for usage in lists
-
isValid
public void isValid()Overwrite this method to check ids, etc. It is called before inserts and updates are performed. The method should throw an ApplicationException or RunTimeException when the object is considered invalid.- Specified by:
isValid
in interfacePersistent
-
clone
-
getKeys
Description copied from interface:Persistent
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
Persistent.emptyKeys
to do so.- Specified by:
getKeys
in interfacePersistent
- 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
.
-
beforeDelete()
instead.