Package ome.util
Class PermDetails
- java.lang.Object
-
- ome.util.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 aPermissions
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 classDetails
getDetails()
Value (i.e.GraphHolder
getGraphHolder()
retrieves theGraphHolder
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 fromValidation.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 theValidation
object.
-
-
-
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.
-
setId
public void setId(java.lang.Long id)
Description copied from interface:IObject
usually unneeded. Ids are managed by the backend.
-
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 onDetails
, 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 existingDetails
instance, useDetails.copy(Details)
orDetails.shallowCopy(Details)
- Specified by:
getDetails
in interfaceIObject
-
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.
-
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 interfaceIObject
- Throws:
ApiUsageException
-
isValid
public boolean isValid()
Description copied from interface:IObject
calls the class-specific validator for this instance and returns the value fromValidation.isValid()
-
validate
public Validation validate()
Description copied from interface:IObject
calls the class-specific validator for this instance and returns theValidation
object.
-
retrieve
public java.lang.Object retrieve(java.lang.String field)
Description copied from interface:IObject
retrieves a value from this instance. Values forfield
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 toIObject.putAt(String, Object)
-
putAt
public void putAt(java.lang.String field, java.lang.Object value)
Description copied from interface:IObject
stores a value in this instance. Values forfield
which match a field of this instance will be delegated to the accessors. Otherwise, values will be stored in a lazy-loaded map.
-
fields
public java.util.Set<?> fields()
Description copied from interface:IObject
returns a Set of field names that belong to this class
-
getGraphHolder
public GraphHolder getGraphHolder()
Description copied from interface:IObject
retrieves theGraphHolder
for this entity. If the GraphHolder has not been actively set, a new one will be instatiated.- Specified by:
getGraphHolder
in interfaceIObject
- Returns:
- Non-null GraphHolder
-
acceptFilter
public boolean acceptFilter(Filter filter)
- Specified by:
acceptFilter
in interfaceFilterable
-
-