Package ome.util

Class PermDetails

  • All Implemented Interfaces:
    java.io.Serializable, IObject, Filterable

    public class PermDetails
    extends java.lang.Object
    implements IObject
    wrapper class which can be used in HQL queries to properly load the full context for a permissions object. Rather than writing a query of the form: select d.details.permissions from Dataset d which returns a Permissions object with none of the extended restrictions (canRead, canAnnotate, etc) properly loaded, use: select new ome.util.PermDetails(d) from Dataset d The return value for each will be the same.
    See Also:
    HHH-3868, trac-12474, Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      PermDetails​(IObject context)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean acceptFilter​(Filter filter)  
      java.util.Set<?> fields()
      returns a Set of field names that belong to this class
      Details getDetails()
      Value (i.e.
      GraphHolder getGraphHolder()
      retrieves the GraphHolder for this entity.
      java.lang.Long getId()
      primary key of this object.
      IObject getInternalContext()
      In order to properly test the permissions for this object, it must be possible to get the internal context.
      boolean isLoaded()
      transient field (not stored in the DB) which specifies whether this object has been loaded from the DB or is only a wrapper around the ID.
      boolean isValid()
      calls the class-specific validator for this instance and returns the value from Validation.isValid()
      void putAt​(java.lang.String field, java.lang.Object value)
      stores a value in this instance.
      java.lang.Object retrieve​(java.lang.String field)
      retrieves a value from this instance.
      void setId​(java.lang.Long id)
      usually unneeded.
      void unload()
      set the loaded field to false, and set all non-ID fields to null.
      Validation validate()
      calls the class-specific validator for this instance and returns the Validation object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PermDetails

        public PermDetails​(IObject context)
    • Method Detail

      • getInternalContext

        public IObject getInternalContext()
        In order to properly test the permissions for this object, it must be possible to get the internal context. This is for use by the security system only.
      • getId

        public java.lang.Long getId()
        Description copied from interface: IObject
        primary key of this object. Before the session is flushed, this value may be null.
        Specified by:
        getId in interface IObject
        Returns:
        Long primary key. May be null.
      • setId

        public void setId​(java.lang.Long id)
        Description copied from interface: IObject
        usually unneeded. Ids are managed by the backend.
        Specified by:
        setId in interface IObject
        Parameters:
        id - Long value for this id.
      • getDetails

        public Details getDetails()
        Description copied from interface: IObject
        Value (i.e. not entity) which is available on all rows in the database. Low-level "details" such as security, ownership, auditing are managed here. When setting values on Details, it is important to realize that most of the values are managed by the backend and may be replaced. For example, a user does not have permission to change the owner of an object, not even when owned by that user. To replace all of the values from an existing Details instance, use Details.copy(Details) or Details.shallowCopy(Details)
        Specified by:
        getDetails in interface IObject
      • isLoaded

        public boolean isLoaded()
        Description copied from interface: IObject
        transient field (not stored in the DB) which specifies whether this object has been loaded from the DB or is only a wrapper around the ID.
        Specified by:
        isLoaded in interface IObject
      • unload

        public void unload()
                    throws ApiUsageException
        Description copied from interface: IObject
        set the loaded field to false, and set all non-ID fields to null. Subsequent calls to all accessors other than getId/setId will throw an ApiUsageException
        Specified by:
        unload in interface IObject
        Throws:
        ApiUsageException
      • isValid

        public boolean isValid()
        Description copied from interface: IObject
        calls the class-specific validator for this instance and returns the value from Validation.isValid()
        Specified by:
        isValid in interface IObject
      • validate

        public Validation validate()
        Description copied from interface: IObject
        calls the class-specific validator for this instance and returns the Validation object.
        Specified by:
        validate in interface IObject
        Returns:
        Validation collecting parameter.
      • retrieve

        public java.lang.Object retrieve​(java.lang.String field)
        Description copied from interface: IObject
        retrieves a value from this instance. Values for field which match a field of this instance will be delegated to the accessors. Otherwise, values will be retrieved from a lazy-loaded map filled by calls to IObject.putAt(String, Object)
        Specified by:
        retrieve in interface IObject
      • putAt

        public void putAt​(java.lang.String field,
                          java.lang.Object value)
        Description copied from interface: IObject
        stores a value in this instance. Values for field which match a field of this instance will be delegated to the accessors. Otherwise, values will be stored in a lazy-loaded map.
        Specified by:
        putAt in interface IObject
        Parameters:
        field - Field name
        value - Any object to be stored.
      • fields

        public java.util.Set<?> fields()
        Description copied from interface: IObject
        returns a Set of field names that belong to this class
        Specified by:
        fields in interface IObject
      • getGraphHolder

        public GraphHolder getGraphHolder()
        Description copied from interface: IObject
        retrieves the GraphHolder for this entity. If the GraphHolder has not been actively set, a new one will be instatiated.
        Specified by:
        getGraphHolder in interface IObject
        Returns:
        Non-null GraphHolder