001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    /**
018     * Represents a set of resources of one type that all share the same
019     * permissions. This means that if a user can access one resource in a resource
020     * block, they can access all of them.
021     *
022     * <p>
023     * Resource blocks can only contain sets of resources that are all the same type
024     * and in the same group. The first constraint is necessary because bitwise
025     * action IDs do not always represent the same action between resource types.
026     * For instance, the EDIT action could have the bitwise value 2 for bookmark
027     * entries, and the value 16 for blog entries. Consequently, even if two
028     * resources of different types share the same permissions on the bitwise level,
029     * a user does not necessarily have permission to perform the same actions on
030     * both.
031     * </p>
032     *
033     * <p>
034     * The second constraint is required because users can have different roles in
035     * different groups. If resources from different groups were contained in the
036     * same resource block, it would be impossible to check permissions properly
037     * when loading resources from multiple groups simultaneously. A user could have
038     * access to a certain resource block in one group, but not in another.
039     * </p>
040     *
041     * <p>
042     * The type of resource a resource block contains is specified by the
043     * <code>name</code> attribute, which must be the fully qualified class name of
044     * a model (such as a blog entry).
045     * </p>
046     *
047     * <p>
048     * The <code>permissionsHash</code> attribute holds a hashed representation of
049     * the permissions shared by all the resources contained in the block. When the
050     * permissions on an individual resource are changed, a new permissions hash is
051     * calculated for it, and the database is checked to determine if a resource
052     * block already exists with that hash. If one exists, the resource is moved
053     * into that block; otherwise a new block is created.
054     * </p>
055     *
056     * <p>
057     * The <code>referenceCount</code> attribute stores the number of resources in
058     * the resource block, meaning those resources whose
059     * <code>resourceBlockId</code> is set to the primary key of this resource
060     * block. If <code>referenceCount</code> reaches zero, the resource block is no
061     * longer needed and may be safely deleted. To ensure that this reference count
062     * remains accurate, resources must always call {@link
063     * com.liferay.portal.service.impl.ResourceLocalServiceImpl#deleteResource} when
064     * a resource is deleted.
065     * </p>
066     *
067     * @author Connor McKay
068     */
069    public class ResourceBlockImpl extends ResourceBlockBaseImpl {
070    
071            public ResourceBlockImpl() {
072            }
073    
074    }