- All Implemented Interfaces:
- BaseModel<ResourceBlock>, ClassedModel, PermissionedModel, PersistedModel, ResourceBlock, ResourceBlockModel, Serializable, Cloneable, Comparable<ResourceBlock>
public class ResourceBlockImpl
- extends ResourceBlockBaseImpl
Represents a set of resources of one type that all share the same
permissions. This means that if a user can access one resource in a resource
block, they can access all of them.
Resource blocks can only contain sets of resources that are all the same type
and in the same group. The first constraint is necessary because bitwise
action IDs do not always represent the same action between resource types.
For instance, the EDIT action could have the bitwise value 2 for bookmark
entries, and the value 16 for blog entries. Consequently, even if two
resources of different types share the same permissions on the bitwise level,
a user does not necessarily have permission to perform the same actions on
The second constraint is required because users can have different roles in
different groups. If resources from different groups were contained in the
same resource block, it would be impossible to check permissions properly
when loading resources from multiple groups simultaneously. A user could have
access to a certain resource block in one group, but not in another.
The type of resource a resource block contains is specified by the
name attribute, which must be the fully qualified class name of
a model (such as a blog entry).
permissionsHash attribute holds a hashed representation of
the permissions shared by all the resources contained in the block. When the
permissions on an individual resource are changed, a new permissions hash is
calculated for it, and the database is checked to determine if a resource
block already exists with that hash. If one exists, the resource is moved
into that block; otherwise a new block is created.
referenceCount attribute stores the number of resources in
the resource block, meaning those resources whose
resourceBlockId is set to the primary key of this resource
referenceCount reaches zero, the resource block is no
longer needed and may be safely deleted. To ensure that this reference count
remains accurate, resources must always call
ResourceLocalServiceImpl.deleteResource(com.liferay.portal.model.AuditedModel, int) when
a resource is deleted.
- See Also:
- Serialized Form
|Fields inherited from class com.liferay.portal.model.impl.ResourceBlockModelImpl
COLUMN_BITMASK_ENABLED, COMPANYID_COLUMN_BITMASK, DATA_SOURCE, ENTITY_CACHE_ENABLED, FINDER_CACHE_ENABLED, GROUPID_COLUMN_BITMASK, LOCK_EXPIRATION_TIME, NAME_COLUMN_BITMASK, ORDER_BY_JPQL, ORDER_BY_SQL, PERMISSIONSHASH_COLUMN_BITMASK, RESOURCEBLOCKID_COLUMN_BITMASK, SESSION_FACTORY, TABLE_COLUMNS, TABLE_NAME, TABLE_SQL_CREATE, TABLE_SQL_DROP, TX_MANAGER
|Methods inherited from class com.liferay.portal.model.impl.ResourceBlockModelImpl
clone, compareTo, equals, getColumnBitmask, getCompanyId, getExpandoBridge, getGroupId, getModelAttributes, getModelClass, getModelClassName, getName, getOriginalCompanyId, getOriginalGroupId, getOriginalName, getOriginalPermissionsHash, getPermissionsHash, getPrimaryKey, getPrimaryKeyObj, getReferenceCount, getResourceBlockId, hashCode, resetOriginalValues, setCompanyId, setExpandoBridgeAttributes, setGroupId, setModelAttributes, setName, setPermissionsHash, setPrimaryKey, setPrimaryKeyObj, setReferenceCount, setResourceBlockId, toCacheModel, toEscapedModel, toModel, toModels, toString, toXmlString
|Methods inherited from interface com.liferay.portal.model.ResourceBlockModel
clone, compareTo, getCompanyId, getExpandoBridge, getGroupId, getName, getPermissionsHash, getPrimaryKey, getPrimaryKeyObj, getReferenceCount, getResourceBlockId, hashCode, isCachedModel, isEscapedModel, isNew, setCachedModel, setCompanyId, setExpandoBridgeAttributes, setExpandoBridgeAttributes, setExpandoBridgeAttributes, setGroupId, setName, setNew, setPermissionsHash, setPrimaryKey, setPrimaryKeyObj, setReferenceCount, setResourceBlockId, toCacheModel, toEscapedModel, toString, toUnescapedModel, toXmlString