Class SecurityPersistenceImpl

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<SecurityPersistenceImpl>, org.tentackle.dbms.ModificationLoggable, org.tentackle.misc.Identifiable, org.tentackle.misc.Immutable, org.tentackle.misc.Modifiable, org.tentackle.misc.SerialNumbered, org.tentackle.misc.Snapshotable<org.tentackle.security.pdo.Security>, org.tentackle.pdo.DomainContextDependable, org.tentackle.pdo.DomainContextProvider, org.tentackle.pdo.PdoMethodCacheProvider<org.tentackle.security.pdo.Security>, org.tentackle.pdo.PdoProvider<org.tentackle.security.pdo.Security>, org.tentackle.pdo.PersistenceDelegate<org.tentackle.security.pdo.Security>, org.tentackle.pdo.PersistentObject<org.tentackle.security.pdo.Security>, org.tentackle.pdo.ProxyDelegate<org.tentackle.security.pdo.Security>, org.tentackle.reflect.EffectiveClassProvider<org.tentackle.security.pdo.Security>, org.tentackle.reflect.Interceptable, org.tentackle.security.pdo.SecurityPersistence, org.tentackle.session.SessionDependable, org.tentackle.session.SessionProvider, org.tentackle.validate.ScopeConfigurator, org.tentackle.validate.Validateable

    @PersistentObjectService(org.tentackle.security.pdo.Security.class)
    public class SecurityPersistenceImpl
    extends AbstractPersistentObject<org.tentackle.security.pdo.Security,​SecurityPersistenceImpl>
    implements org.tentackle.security.pdo.SecurityPersistence
    Security rule persistence implementation.
    Author:
    harald
    See Also:
    Serialized Form
    • Field Detail

      • CN_OBJECTCLASSNAME

        public static final java.lang.String CN_OBJECTCLASSNAME
        database column name for 'objectClassName'.
        See Also:
        Constant Field Values
      • CN_OBJECTCLASSID

        public static final java.lang.String CN_OBJECTCLASSID
        database column name for 'objectClassId'.
        See Also:
        Constant Field Values
      • CN_OBJECTID

        public static final java.lang.String CN_OBJECTID
        database column name for 'objectId'.
        See Also:
        Constant Field Values
      • CN_DOMAINCONTEXTCLASSID

        public static final java.lang.String CN_DOMAINCONTEXTCLASSID
        database column name for 'domainContextClassId'.
        See Also:
        Constant Field Values
      • CN_DOMAINCONTEXTID

        public static final java.lang.String CN_DOMAINCONTEXTID
        database column name for 'domainContextId'.
        See Also:
        Constant Field Values
      • CN_GRANTEECLASSID

        public static final java.lang.String CN_GRANTEECLASSID
        database column name for 'granteeClassId'.
        See Also:
        Constant Field Values
      • CN_GRANTEEID

        public static final java.lang.String CN_GRANTEEID
        database column name for 'granteeId'.
        See Also:
        Constant Field Values
      • CN_PRIORITY

        public static final java.lang.String CN_PRIORITY
        database column name for 'priority'.
        See Also:
        Constant Field Values
      • CN_PERMISSIONS

        public static final java.lang.String CN_PERMISSIONS
        database column name for 'permissions'.
        See Also:
        Constant Field Values
      • CN_ALLOWED

        public static final java.lang.String CN_ALLOWED
        database column name for 'allowed'.
        See Also:
        Constant Field Values
      • CN_MESSAGE

        public static final java.lang.String CN_MESSAGE
        database column name for 'message'.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SecurityPersistenceImpl

        public SecurityPersistenceImpl​(org.tentackle.security.pdo.Security pdo,
                                       org.tentackle.pdo.DomainContext context)
        Creates a security rule.
        Parameters:
        pdo - the security PDO
        context - the domain context
      • SecurityPersistenceImpl

        public SecurityPersistenceImpl​(org.tentackle.security.pdo.Security pdo,
                                       org.tentackle.session.Session session)
        Creates a security rule with a session only.
        Parameters:
        pdo - the security PDO
        session - the session
      • SecurityPersistenceImpl

        public SecurityPersistenceImpl​(org.tentackle.security.pdo.Security pdo)
        Creates a security rule without domain context or session.
        Parameters:
        pdo - the security PDO
      • SecurityPersistenceImpl

        public SecurityPersistenceImpl()
        Creates a security rule without domain context or session.
    • Method Detail

      • getObject

        public org.tentackle.pdo.PersistentDomainObject<?> getObject()
        Gets the object this rule applies to.
        The object is retrieved in its valid context.
        Specified by:
        getObject in interface org.tentackle.security.pdo.SecurityPersistence
        Returns:
        the object, null if none (class rule)
      • setObject

        public void setObject​(org.tentackle.pdo.PersistentDomainObject<?> object)
        Sets the object this rule applies to.
        Setting the null object also clears the objectClass making the rule invalid.
        Specified by:
        setObject in interface org.tentackle.security.pdo.SecurityPersistence
        Parameters:
        object - the object, null to clear
      • getGrantee

        public org.tentackle.pdo.PersistentDomainObject<?> getGrantee()
        Gets the grantee.
        Specified by:
        getGrantee in interface org.tentackle.security.pdo.SecurityPersistence
        Returns:
        the grantee, null if grant class
      • setGrantee

        public void setGrantee​(org.tentackle.pdo.PersistentDomainObject<?> grantee)
        Sets the grantee.
        Specified by:
        setGrantee in interface org.tentackle.security.pdo.SecurityPersistence
        Parameters:
        grantee - the grantee, null to clear (all)
      • getDomainContextObject

        public org.tentackle.pdo.PersistentDomainObject<?> getDomainContextObject()
        Gets the application context's object.
        The object will be loaded in its valid context.
        Specified by:
        getDomainContextObject in interface org.tentackle.security.pdo.SecurityPersistence
        Returns:
        the context object, null if no context (all)
      • setDomainContextObject

        public void setDomainContextObject​(org.tentackle.pdo.PersistentDomainObject<?> contextObject)
        Sets the application context's object.
        Specified by:
        setDomainContextObject in interface org.tentackle.security.pdo.SecurityPersistence
        Parameters:
        contextObject - the context object, null to clear (all)
      • toString

        public java.lang.String toString()
        for debugging only
        Overrides:
        toString in class org.tentackle.dbms.AbstractDbObject<SecurityPersistenceImpl>
      • assertRemoteSecurityManagerInitialized

        public void assertRemoteSecurityManagerInitialized()
        Specified by:
        assertRemoteSecurityManagerInitialized in interface org.tentackle.security.pdo.SecurityPersistence
      • getObjectClass

        public java.lang.Class<?> getObjectClass()
        Specified by:
        getObjectClass in interface org.tentackle.security.pdo.SecurityPersistence
      • getCache

        public org.tentackle.pdo.PdoCache<org.tentackle.security.pdo.Security> getCache()
        Description copied from class: AbstractPersistentObject
        Gets the cache. The default implementation returns null. Must be overridden to enable optimization features with RMI servers.
        Specified by:
        getCache in interface org.tentackle.pdo.PersistentObject<org.tentackle.security.pdo.Security>
        Overrides:
        getCache in class AbstractPersistentObject<org.tentackle.security.pdo.Security,​SecurityPersistenceImpl>
        Returns:
        the cache, null if uncached
      • isCountingModification

        public boolean isCountingModification​(char modType)
        Overrides:
        isCountingModification in class org.tentackle.dbms.AbstractDbObject<SecurityPersistenceImpl>
      • isReadAllowed

        public boolean isReadAllowed()
        Description copied from class: AbstractPersistentObject
        Determines whether the application is allowed to read this PDO.
        Makes no sense to publish in PersistentObject because PDOs without read permissions are not read from the database at all.
        Overrides:
        isReadAllowed in class AbstractPersistentObject<org.tentackle.security.pdo.Security,​SecurityPersistenceImpl>
        Returns:
        true if allowed
      • expireCache

        public boolean expireCache​(long maxSerial)
        Description copied from class: AbstractPersistentObject
        Expires the cache according to the serial numbers.
        If objects of this class are cached, the cache must be expired on updates, etc... Furthermore, if there is a cache, isCountingModification() MUST return true, in order for countModification() to invalidate the cache for the local JVM. Classes with a cache must override this method! The implementation with the PdoCache should look like this:
            cache.expire(maxSerial);
         
        while "cache" has been declared by the wurblet PdoCache.
        Overrides:
        expireCache in class AbstractPersistentObject<org.tentackle.security.pdo.Security,​SecurityPersistenceImpl>
        Parameters:
        maxSerial - is the new tableSerial this object will get
        Returns:
        true if cache invalidated, false if there is no cache
        See Also:
        PdoCache
      • selectCachedOnly

        public org.tentackle.security.pdo.Security selectCachedOnly​(long id)
        Description copied from class: AbstractPersistentObject
        Gets the object via cache only.
        If there is no cache (i.e. the method is not overridden), the default implementation just loads from the db.
        Specified by:
        selectCachedOnly in interface org.tentackle.pdo.PersistentObject<org.tentackle.security.pdo.Security>
        Overrides:
        selectCachedOnly in class AbstractPersistentObject<org.tentackle.security.pdo.Security,​SecurityPersistenceImpl>
        Parameters:
        id - the uniue object ID
        Returns:
        the object, null if no such object
        See Also:
        AbstractDbObject.selectObject(long)
      • selectCached

        public org.tentackle.security.pdo.Security selectCached​(long id)
        Description copied from class: AbstractPersistentObject
        Gets the object via cache.
        If there is no cache (i.e. the method is not overridden), the default implementation just loads from the db.
        Specified by:
        selectCached in interface org.tentackle.pdo.PersistentObject<org.tentackle.security.pdo.Security>
        Overrides:
        selectCached in class AbstractPersistentObject<org.tentackle.security.pdo.Security,​SecurityPersistenceImpl>
        Parameters:
        id - the uniue object ID
        Returns:
        the object, null if no such object
        See Also:
        AbstractDbObject.selectObject(long)
      • selectAllCached

        public java.util.List<org.tentackle.security.pdo.Security> selectAllCached()
        Description copied from class: AbstractPersistentObject
        Gets all objects in context via cache. If there is no cache (i.e. the method is not overridden), the default implementation gets it from the db.
        Specified by:
        selectAllCached in interface org.tentackle.pdo.PersistentObject<org.tentackle.security.pdo.Security>
        Overrides:
        selectAllCached in class AbstractPersistentObject<org.tentackle.security.pdo.Security,​SecurityPersistenceImpl>
        Returns:
        the list, never null
        See Also:
        AbstractPersistentObject.selectAll()
      • selectByGrantee

        public java.util.List<org.tentackle.security.pdo.Security> selectByGrantee​(int granteeClassId,
                                                                                   long granteeId)
        Specified by:
        selectByGrantee in interface org.tentackle.security.pdo.SecurityPersistence
      • selectByObject

        public org.tentackle.misc.TrackedList<org.tentackle.security.pdo.Security> selectByObject​(int objectClassId,
                                                                                                  long objectId)
        Specified by:
        selectByObject in interface org.tentackle.security.pdo.SecurityPersistence
      • selectByObjectClass

        public org.tentackle.misc.TrackedList<org.tentackle.security.pdo.Security> selectByObjectClass​(java.lang.String objectClassName)
        Specified by:
        selectByObjectClass in interface org.tentackle.security.pdo.SecurityPersistence
      • selectByDomainContext

        public org.tentackle.misc.TrackedList<org.tentackle.security.pdo.Security> selectByDomainContext​(int domainContextClassId,
                                                                                                         long domainContextId)
        Specified by:
        selectByDomainContext in interface org.tentackle.security.pdo.SecurityPersistence
      • deleteByGrantee

        public int deleteByGrantee​(int granteeClassId,
                                   long granteeId)
        Specified by:
        deleteByGrantee in interface org.tentackle.security.pdo.SecurityPersistence
      • deleteByObject

        public int deleteByObject​(int objectClassId,
                                  long objectId)
        Specified by:
        deleteByObject in interface org.tentackle.security.pdo.SecurityPersistence
      • deleteByObjectClass

        public int deleteByObjectClass​(java.lang.String objectClassName)
        Specified by:
        deleteByObjectClass in interface org.tentackle.security.pdo.SecurityPersistence
      • deleteByDomainContext

        public int deleteByDomainContext​(int domainContextClassId,
                                         long domainContextId)
        Specified by:
        deleteByDomainContext in interface org.tentackle.security.pdo.SecurityPersistence
      • isTracked

        public boolean isTracked()
        Specified by:
        isTracked in interface org.tentackle.pdo.PersistentObject<org.tentackle.security.pdo.Security>
        Overrides:
        isTracked in class org.tentackle.dbms.AbstractDbObject<SecurityPersistenceImpl>
      • orderBy

        public java.lang.String orderBy()
        Description copied from class: AbstractPersistentObject
        Gets the natural ordering to be added in WHERE-clauses following "ORDER BY ". The wurblets will use it if --sort option set. Example:
          return CN_ID + "," + CN_PRINTED + " DESC";
         
        For a single field with sort ascending returning the fieldname is sufficient. The default is null, i.e. no order-by-clause will be added.
        Overrides:
        orderBy in class AbstractPersistentObject<org.tentackle.security.pdo.Security,​SecurityPersistenceImpl>
        Returns:
        the order by appendix string, null if no order by
      • getFields

        public void getFields​(org.tentackle.dbms.ResultSetWrapper rs)
        Overrides:
        getFields in class org.tentackle.dbms.AbstractDbObject<SecurityPersistenceImpl>
      • setFields

        public int setFields​(org.tentackle.dbms.PreparedStatementWrapper st)
        Overrides:
        setFields in class org.tentackle.dbms.AbstractDbObject<SecurityPersistenceImpl>
      • createInsertSql

        public java.lang.String createInsertSql()
        Overrides:
        createInsertSql in class org.tentackle.dbms.AbstractDbObject<SecurityPersistenceImpl>
      • createUpdateSql

        public java.lang.String createUpdateSql()
        Overrides:
        createUpdateSql in class org.tentackle.dbms.AbstractDbObject<SecurityPersistenceImpl>
      • getObjectClassName

        public java.lang.String getObjectClassName()
        Specified by:
        getObjectClassName in interface org.tentackle.security.pdo.SecurityPersistence
      • setObjectClassName

        public void setObjectClassName​(java.lang.String objectClassName)
        Specified by:
        setObjectClassName in interface org.tentackle.security.pdo.SecurityPersistence
      • getObjectClassId

        public int getObjectClassId()
        Specified by:
        getObjectClassId in interface org.tentackle.security.pdo.SecurityPersistence
      • setObjectClassId

        public void setObjectClassId​(int objectClassId)
        Specified by:
        setObjectClassId in interface org.tentackle.security.pdo.SecurityPersistence
      • getObjectId

        public long getObjectId()
        Specified by:
        getObjectId in interface org.tentackle.security.pdo.SecurityPersistence
      • setObjectId

        public void setObjectId​(long objectId)
        Specified by:
        setObjectId in interface org.tentackle.security.pdo.SecurityPersistence
      • getDomainContextClassId

        public int getDomainContextClassId()
        Specified by:
        getDomainContextClassId in interface org.tentackle.security.pdo.SecurityPersistence
      • setDomainContextClassId

        public void setDomainContextClassId​(int domainContextClassId)
        Specified by:
        setDomainContextClassId in interface org.tentackle.security.pdo.SecurityPersistence
      • getDomainContextId

        public long getDomainContextId()
        Specified by:
        getDomainContextId in interface org.tentackle.security.pdo.SecurityPersistence
      • setDomainContextId

        public void setDomainContextId​(long domainContextId)
        Specified by:
        setDomainContextId in interface org.tentackle.security.pdo.SecurityPersistence
      • getGranteeClassId

        public int getGranteeClassId()
        Specified by:
        getGranteeClassId in interface org.tentackle.security.pdo.SecurityPersistence
      • setGranteeClassId

        public void setGranteeClassId​(int granteeClassId)
        Specified by:
        setGranteeClassId in interface org.tentackle.security.pdo.SecurityPersistence
      • getGranteeId

        public long getGranteeId()
        Specified by:
        getGranteeId in interface org.tentackle.security.pdo.SecurityPersistence
      • setGranteeId

        public void setGranteeId​(long granteeId)
        Specified by:
        setGranteeId in interface org.tentackle.security.pdo.SecurityPersistence
      • getPriority

        public int getPriority()
        Specified by:
        getPriority in interface org.tentackle.security.pdo.SecurityPersistence
      • setPriority

        public void setPriority​(int priority)
        Specified by:
        setPriority in interface org.tentackle.security.pdo.SecurityPersistence
      • getPermissions

        public java.lang.String getPermissions()
        Specified by:
        getPermissions in interface org.tentackle.security.pdo.SecurityPersistence
      • setPermissions

        public void setPermissions​(java.lang.String permissions)
        Specified by:
        setPermissions in interface org.tentackle.security.pdo.SecurityPersistence
      • isAllowed

        public boolean isAllowed()
        Specified by:
        isAllowed in interface org.tentackle.security.pdo.SecurityPersistence
      • setAllowed

        public void setAllowed​(boolean allowed)
        Specified by:
        setAllowed in interface org.tentackle.security.pdo.SecurityPersistence
      • getMessage

        public java.lang.String getMessage()
        Specified by:
        getMessage in interface org.tentackle.security.pdo.SecurityPersistence
      • setMessage

        public void setMessage​(java.lang.String message)
        Specified by:
        setMessage in interface org.tentackle.security.pdo.SecurityPersistence
      • revertAttributesToSnapshot

        protected void revertAttributesToSnapshot​(SecurityPersistenceImpl snapshot)
        Copies all attributes from a snapshot back to this object.
        Parameters:
        snapshot - the snapshot object