public interface Persistent extends KeyValuePair<String,String>, Serializable
PersistentObject
, which provides a default
implementation, and override some methods if necessary.
OrgData
or Store
(get
instances of them from the ServiceLocator
).
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.Modifier and Type | Field and Description |
---|---|
static String[][] |
emptyKeys
Empty String array which can be used by classes which don't want to define keys.
|
Modifier and Type | Method and Description |
---|---|
void |
afterDelete()
This method is called after the persistent object has been deleted.
|
void |
afterInsert()
This method is called after the persistent object has been inserted into
the store.
|
void |
afterRead()
This method is called after the persistent object has been read.
|
void |
afterUpdate()
This method is called after the persistent object has been updated in the
store.
|
void |
beforeDelete()
This method is called before the persistent object is deleted.
|
void |
beforeInsert()
This method is called before the persistent object is inserted into
the store.
|
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).
|
List<Field> |
dbFields()
This method must return the persistent fields of this persistent object.
|
String |
getKey()
Returns the key (className:OID) of this
KeyValuePair . |
String[][] |
getKeys()
A class may return key field groups in order to identify already existing objects
of that class.
|
String |
getLocalClassName() |
String |
getLocalObjectName()
Get the object name in localized form.
|
long |
getOid()
Getter method for the persistent object's OID.
|
Store |
getStore()
This method must return the
Store object that is responsible for
storing this persistent object. |
String |
getTableName()
This method must return the table name of the database table in which
this persistent object is stored.
|
String |
getValue()
Returns the value (
String representation) of this
KeyValuePair . |
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.
|
void |
setStore(Store s)
With this method you can change the
Store of this persistent object. |
String |
toListString()
Returns a special string representation of the object.
|
static final String[][] emptyKeys
long getOid()
void setOid()
void setOid(long oid)
oid
- The new OID for the object.Store getStore()
Store
object that is responsible for
storing this persistent object.Store
of this persistent object.void setStore(Store s)
Store
of this persistent object.
Usually objects are stored in the system's database and you will never need
to set the Store
manually.s
- The new Store
that will be set for this persistent object.String getTableName()
List<Field> dbFields()
List
containing the persistent fields of this
persistent object. The List
must contain the fields
as java.lang.reflect.Field
objects.void beforeInsert()
void afterInsert()
void beforeUpdate()
void afterUpdate()
void beforeDelete()
Store.delete(Class, String, Object[])
and
Store.delete(String, String, Object[])
methods do NOT call beforeDelete()
.void afterDelete()
Store.delete(Class, String, Object[])
and
Store.delete(String, String, Object[])
methods do NOT call afterDelete()
.void afterRead()
void setFilled(boolean f)
isFilled()
for more details.f
- The new value for the filled status.boolean isFilled()
Store
to fill it.true
if the object is filled with values, or
false
if the object is empty (only OID is set).String getKey()
KeyValuePair
.getKey
in interface KeyValuePair<String,String>
String getValue()
String
representation) of this
KeyValuePair
.getValue
in interface KeyValuePair<String,String>
String getLocalObjectName()
String getLocalClassName()
String toListString()
void isValid()
beforeInsert()
resp. beforeUpdate()
were made.
The call can be avoided using PersistentAspect.NO_VALIDATION
The method should throw an ApplicationException or RunTimeException when the object is considered to be invalid.String[][] getKeys()
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.
{{"name", "birthdate"},{"ssn"}}
for a
class defining two key field groups. The first one contains the fields name
and
birthdate
, the second key field group has just one field ssn
.@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.