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

public interface Persistent extends KeyValuePair<String,String>, Serializable
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 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

    Fields
    Modifier and Type
    Field
    Description
    static final String[][]
    Empty String array which can be used by classes which don't want to define keys.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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).
    This method must return the persistent fields of this persistent object.
    Returns the key (className:OID) of this KeyValuePair.
    String[][]
    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
    Getter method for the persistent object's OID.
    default Store
    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.
    Returns the value (String representation) of this KeyValuePair.
    boolean
    With this method you check if this persistent object is filled with persistent data or not.
    void
    Overwrite this method to check object validity.
    void
    setFilled(boolean f)
    This method can change the filled status of this persistent object.
    void
    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

      static final String[][] 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(forRemoval=true, since="11.0") default Store getStore()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Will always return the store for the systems database. Use Store.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

      List<Field> dbFields()
      This method must return the persistent fields of this persistent object.
      Returns:
      A List containing the persistent fields of this persistent object. The List must contain the fields as java.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 the Store.delete(Class, String, Object[]) and Store.delete(String, String, Object[]) methods do NOT call beforeDelete().
    • afterDelete

      void afterDelete()
      This method is called after the persistent object has been deleted. Note that the Store.delete(Class, String, Object[]) and Store.delete(String, String, Object[]) methods do NOT call afterDelete().
    • 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. See isFilled() 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 the Store to fill it.
      Returns:
      true if the object is filled with values, or false if the object is empty (only OID is set).
    • getKey

      String getKey()
      Returns the key (className:OID) of this KeyValuePair.
      Specified by:
      getKey in interface KeyValuePair<String,String>
    • getValue

      String getValue()
      Returns the value (String representation) of this KeyValuePair.
      Specified by:
      getValue in interface KeyValuePair<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 to 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.
    • 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 fields name and birthdate, the second key field group has just one field ssn.