Enum Class PersistentAspect

java.lang.Object
java.lang.Enum<PersistentAspect>
com.groiss.store.PersistentAspect
All Implemented Interfaces:
Serializable, Comparable<PersistentAspect>, Constable

public enum PersistentAspect extends Enum<PersistentAspect>
Allows to change certain aspects of the behavior of the Store and OrgData operations on Persistent objects.

Can be set on a thread/transaction level or on individual object level.

Deviations from standard behavior are reset at the end of the transaction.

  • Enum Constant Details

    • NO_OPTLOCKING

      public static final PersistentAspect NO_OPTLOCKING
      Avoid checking of transaction id in update. Via Store for OptimisticLocking.

      In former times used on Thread Level;

      • on: ThreadContext.setAttribute(StoreEJB.IGNORE_TRANSACTION_ID,true);
      • off: ThreadContext.removeAttribute(StoreEJB.IGNORE_TRANSACTION_ID);
    • NO_DEFERREDCHECK

      public static final PersistentAspect NO_DEFERREDCHECK
      Avoid checking of deferred updates during update and delete. Done via Store for HasDeferredChange.

      In former times used on Thread Level:

      • on: ThreadContext.setAttribute(LoggedObject.NO_CHECK_DEFERRED, Boolean.TRUE);
      • off: ThreadContext.removeAttribute(LoggedObject.NO_CHECK_DEFERRED);
    • NO_VALIDATION

      public static final PersistentAspect NO_VALIDATION
      Avoid checking of validation constraints during insert and update. PersistentObject.beforeInsert and beforeUpdate methods check this to avoid calling of PersistentObject.isValid(). Other Persistent classes (which do not extend PersistentObject) have to implement a corresponding behavior themselves.

      In former times used on Thread Level:

      • on: ThreadContext.setAttribute(SQLObject.DO_BLIND, Boolean.TRUE);
      • off: ThreadContext.removeAttribute(SQLObject.DO_BLIND);
    • NO_PERMISSIONCHECK

      public static final PersistentAspect NO_PERMISSIONCHECK
      Avoid checking of permissions during insert, update and delete via OrgData. OrgData.insert/update/delete methods check this to avoid calling of OrgData.mayXXX(). Contrast with ALL_PERMISSIONS.

      In former times used on object level:

      • LoggedObject.insert/update/deleteNocheck(p);
    • NO_LOG

      public static final PersistentAspect NO_LOG
      Avoid writing of Log Information insert and update and delete via OrgData. OrgData.insert/update/delete methods check this to avoid calling of OrgData.makeLog()

      In former times used on object level:

      • LoggedObject.insert/update/deleteNocheck(p);
    • NO_OBJECTEXTENSIONCLEANUP

      public static final PersistentAspect NO_OBJECTEXTENSIONCLEANUP
      Avoid deleting of attached object extensions when their referencing persistent is deleted.
    • ALL_PERMISSIONS

      public static final PersistentAspect ALL_PERMISSIONS
      Automatically grant all permissions on all objects. Be sure to use this feature responsibly and as sparingly as possible. Contrast with NO_PERMISSIONCHECK.

      Is honored solely at thread level. Setting this on individual objects has no effect whatsoever.

    • NO_CHANGE_SYSTEMFIELDS

      public static final PersistentAspect NO_CHANGE_SYSTEMFIELDS
      Don't change standard fields (createdBy, changedBy, createdAt, changedAt) when a DMSObject is inserted or updated.

      In former times used on object level:

      • com.dec.avw.core.Form.disableAutoUpdate() to set and
      • com.dec.avw.core.Form.enableAutoUpdate() to remove the aspect
  • Field Details

    • logger

      public static final org.slf4j.Logger logger
  • Method Details

    • values

      public static PersistentAspect[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PersistentAspect valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • get

      public static Set<PersistentAspect> get()
      Get the set of currently set PersistentAspects at the thread level.
      Returns:
      a Set of currently active PersistentAspects
    • set

      public static void set(Set<PersistentAspect> aspects)
      Set the PersistentAspects at the thread level. Currently set object aspect are NOT changed.
      Parameters:
      aspects - the Set of PersistentAspects to activate
    • isSet

      public static boolean isSet(PersistentAspect aspect)
      Checks if a PersistentAspect is active at the thread level.
      Parameters:
      aspect - the PersistentAspect to check
      Returns:
      true, if the PersistentAspect is set
    • add

      public static SilentCloseable add(PersistentAspect... aspects)
      Add the PersistentAspects at thread level. Currently set object aspect are NOT changed.
      Parameters:
      aspects - the PersistentAspects to add
      Returns:
      a SilentCloseable to use in a try(with resource) block
    • remove

      public static SilentCloseable remove(PersistentAspect... aspects)
      Remove the PersistentAspects at thread level. Currently set object aspect are NOT changed.
      Parameters:
      aspects - the PersistentAspects to remove
      Returns:
      a SilentCloseable to use in a try(with resource) block
    • clear

      public static void clear()
      Clears all PersistentAspects. Automatically called at end of transaction.
    • get

      public static Set<PersistentAspect> get(Persistent p)
      Get the set of currently set PersistentAspects for an object. Thread level PersistentAspects are accounted for.
      Parameters:
      p - the Persistent for which to get the PersistentAspects
      Returns:
      an EnumSet of currently active PersistentAspects for this Persistent
    • getForObject

      public static Set<PersistentAspect> getForObject(Persistent p)
      Get the set of currently set PersistentAspects for an object. Thread level PersistentAspects are NOT accounted for.
      Parameters:
      p - the Persistent for which to get the PersistentAspects
      Returns:
      an EnumSet of currently active PersistentAspects for this Persistent
    • set

      public static void set(Persistent p, Set<PersistentAspect> aspects)
      Set the PersistentAspects for an object.

      The oid of the object must have been set before.

      Parameters:
      p - the Persistent for which to set the PersistentAspects
      aspects - the EnumSet of PersistentAspects to activate
    • isSet

      public static boolean isSet(Persistent p, PersistentAspect aspect)
      Checks if a PersistentAspect is active for an object. Thread level PersistentAspects are accounted for.
      Parameters:
      aspect - the PersistentAspect to check
      p - the Persistent to check for
      Returns:
      true, if the PersistentAspect is set for the object
    • isSetForObject

      public static boolean isSetForObject(Persistent p, PersistentAspect aspect)
      Checks if a PersistentAspect is active for an object. Thread level PersistentAspects are NOT accounted for.
      Parameters:
      aspect - the PersistentAspect to check
      p - the Persistent to check for
      Returns:
      true, if the PersistentAspect is set for the object
    • add

      public static SilentCloseable add(Persistent p, PersistentAspect... aspects)
      Add the PersistentAspects for an object.

      The oid of the object must have been set before.

      Parameters:
      p - the Persistent for which to add the PersistentAspects
      aspects - the PersistentAspects to add
      Returns:
      a SilentCloseable to use in a try(with resource) block
    • remove

      public static SilentCloseable remove(Persistent p, PersistentAspect... aspects)
      Remove the PersistentAspects from an object.
      Parameters:
      p - the Persistent from which to remove the PersistentAspects
      aspects - the PersistentAspects to remove
      Returns:
      a SilentCloseable to use in a try(with resource) block
    • clear

      public static void clear(Persistent p)
      Clears all PersistentAspects of an object.
      Parameters:
      p - the object to clear all persistent aspects for