public class ResourceBlockImpl extends ResourceBlockBaseImpl
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 both.
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).
The 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.
The 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
block. If 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.kernel.model.AuditedModel, int)
when
a resource is deleted.
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_COLUMNS_MAP, TABLE_NAME, TABLE_SQL_CREATE, TABLE_SQL_DROP, TX_MANAGER
Constructor and Description |
---|
ResourceBlockImpl() |
persist
clone, compareTo, equals, getColumnBitmask, getCompanyId, getExpandoBridge, getGroupId, getModelAttributes, getModelClass, getModelClassName, getMvccVersion, getName, getOriginalCompanyId, getOriginalGroupId, getOriginalName, getOriginalPermissionsHash, getPermissionsHash, getPrimaryKey, getPrimaryKeyObj, getReferenceCount, getResourceBlockId, hashCode, isEntityCacheEnabled, isFinderCacheEnabled, resetOriginalValues, setCompanyId, setExpandoBridgeAttributes, setGroupId, setModelAttributes, setMvccVersion, setName, setPermissionsHash, setPrimaryKey, setPrimaryKeyObj, setReferenceCount, setResourceBlockId, toCacheModel, toEscapedModel, toModel, toModels, toString, toXmlString
getLocale, isCachedModel, isEscapedModel, isNew, setCachedModel, setExpandoBridgeAttributes, setExpandoBridgeAttributes, setNew, toUnescapedModel
clone, compareTo, getCompanyId, getExpandoBridge, getGroupId, getMvccVersion, getName, getPermissionsHash, getPrimaryKey, getPrimaryKeyObj, getReferenceCount, getResourceBlockId, hashCode, isCachedModel, isEscapedModel, isNew, setCachedModel, setCompanyId, setExpandoBridgeAttributes, setExpandoBridgeAttributes, setExpandoBridgeAttributes, setGroupId, setMvccVersion, setName, setNew, setPermissionsHash, setPrimaryKey, setPrimaryKeyObj, setReferenceCount, setResourceBlockId, toCacheModel, toEscapedModel, toString, toUnescapedModel, toXmlString
getModelAttributes, isEntityCacheEnabled, isFinderCacheEnabled, resetOriginalValues, setModelAttributes