Class AmetysObjectCollection<F extends AmetysObjectCollectionFactory,A extends AmetysObject>
java.lang.Object
org.ametys.plugins.repository.AbstractAmetysObject
org.ametys.plugins.repository.jcr.SimpleAmetysObject<F>
org.ametys.plugins.repository.collection.AmetysObjectCollection<F,A>
- Type Parameters:
F
- the type of the actual factory.A
- the type of the compositeAmetysObject
.
- All Implemented Interfaces:
Iterable<A>
,ACLAmetysObject
,AmetysObject
,JCRAmetysObject
,MetadataAwareAmetysObject
,ModifiableMetadataAwareAmetysObject
,ModifiableACLAmetysObject
,ModifiableAmetysObject
,ModifiableTraversableAmetysObject
,RemovableAmetysObject
,TraversableAmetysObject
public class AmetysObjectCollection<F extends AmetysObjectCollectionFactory,A extends AmetysObject>
extends SimpleAmetysObject<F>
implements ModifiableTraversableAmetysObject, Iterable<A>, ModifiableACLAmetysObject
An
The collection stored its contents in the JCR Repository in a hash tree for optimizing performances.
Please note that this implementation does not keep the insertion order of elements.
AmetysObject
representing a collection of other AmetysObject
s.The collection stored its contents in the JCR Repository in a hash tree for optimizing performances.
Please note that this implementation does not keep the insertion order of elements.
-
Constructor Summary
ConstructorDescriptionAmetysObjectCollection
(javax.jcr.Node node, String parentPath, F factory) Creates anAmetysObjectCollection
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllowedGroups
(Set<GroupIdentity> groups, String profileId) Associates some groups with an allowed profile on this ametys objectvoid
addAllowedProfilesForAnonymous
(Set<String> profileIds) Adds allowed profiles an anonymous user has on this ametys objectvoid
addAllowedProfilesForAnyConnectedUser
(Set<String> profileIds) Adds allowed profiles any connected user has on this ametys objectvoid
addAllowedUsers
(Set<UserIdentity> users, String profileId) Associates some users with an allowed profile on this ametys objectvoid
addDeniedGroups
(Set<GroupIdentity> groups, String profileId) Associates some groups with an allowed profile on this ametys objectvoid
addDeniedProfilesForAnonymous
(Set<String> profileIds) Adds denied profiles an anonymous user has on this ametys objectvoid
addDeniedProfilesForAnyConnectedUser
(Set<String> profileIds) Adds denied profiles any connected user has on this ametys objectvoid
addDeniedUsers
(Set<UserIdentity> users, String profileId) Associates some users with a denied profile on this ametys objectcreateChild
(String name, String type) Creates a child below current object.void
disallowInheritance
(boolean disallow) Allow or disallow inheritance of permissionsRetrieves a given child from its relative path.Retrieves children of the current object.Returns the parent object in the Ametys hierarchy.Gets the allowed profiles any connected user has on the given objectgetProfilesForGroups
(Set<GroupIdentity> groups) Gets the groups that have allowed profiles assigned on the given objectGets the users that have allowed profiles assigned on the given objectboolean
Tests if this Object has at least one child with the given name.boolean
Returns true if the inheritance is disallow for this ametys objectiterator()
void
removeAllowedGroups
(Set<GroupIdentity> groups) Removes the association between some groups and all allowed profiles on this ametys objectvoid
removeAllowedGroups
(Set<GroupIdentity> groups, String profileId) Removes the association between some groups and an allowed profile on this ametys objectvoid
removeAllowedProfilesForAnonymous
(Set<String> profileIds) Removes allowed profiles an anonymous user has on this ametys objectvoid
removeAllowedProfilesForAnyConnectedUser
(Set<String> profileIds) Removes allowed profiles any connected user has on this ametys objectvoid
removeAllowedUsers
(Set<UserIdentity> users) Removes the association between some users and all allowed profiles on this ametys objectvoid
removeAllowedUsers
(Set<UserIdentity> users, String profileId) Removes the association between some users and an allowed profile on this ametys objectvoid
removeDeniedGroups
(Set<GroupIdentity> groups) Removes the association between some groups and all allowed profiles on this ametys objectvoid
removeDeniedGroups
(Set<GroupIdentity> groups, String profileId) Removes the association between some groups and an allowed profile on this ametys objectvoid
removeDeniedProfilesForAnonymous
(Set<String> profileIds) Removes denied profiles an anonymous user has on this ametys objectvoid
removeDeniedProfilesForAnyConnectedUser
(Set<String> profileIds) Removes denied profiles any connected user has on this ametys objectvoid
removeDeniedUsers
(Set<UserIdentity> users) Removes the association between some users and all denied profiles on this ametys objectvoid
removeDeniedUsers
(Set<UserIdentity> users, String profileId) Removes the association between some users and an denied profile on this ametys objectMethods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getNode, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
Methods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParentPath, getPath, hashCode
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChanges
Methods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChildAt, getChildPosition
-
Constructor Details
-
AmetysObjectCollection
Creates anAmetysObjectCollection
.- Parameters:
node
- the node backing this AmetysObject.parentPath
- the parentPath in the Ametys hierarchy.factory
- theAmetysObjectCollectionFactory
which created the AmetysObject.
-
-
Method Details
-
getChildren
Description copied from interface:TraversableAmetysObject
Retrieves children of the current object.- Specified by:
getChildren
in interfaceTraversableAmetysObject
- Returns:
- the children or an empty
AmetysObjectIterable
. - Throws:
AmetysRepositoryException
- if an error occurs.
-
iterator
- Specified by:
iterator
in interfaceIterable<F extends AmetysObjectCollectionFactory>
-
hasChild
Description copied from interface:TraversableAmetysObject
Tests if this Object has at least one child with the given name.- Specified by:
hasChild
in interfaceTraversableAmetysObject
- Parameters:
name
- the name to test. Cannot benull
nor empty nor begin with a'/'
and it cannot contain'/'
.- Returns:
true
if the named child exists,false
otherwise.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getChild
Description copied from interface:TraversableAmetysObject
Retrieves a given child from its relative path. The path cannot benull
, empty nor begin with a'/'
.- Specified by:
getChild
in interfaceTraversableAmetysObject
- Parameters:
path
- the path of the child which can contains a position with.[n]
if same name sibling is allowed.- Returns:
- the child found.
- Throws:
AmetysRepositoryException
- if an error occurs.UnknownAmetysObjectException
- if the object does not exist.
-
createChild
public A createChild(String name, String type) throws AmetysRepositoryException, RepositoryIntegrityViolationException Description copied from interface:ModifiableTraversableAmetysObject
Creates a child below current object.- Specified by:
createChild
in interfaceModifiableTraversableAmetysObject
- Parameters:
name
- the name of the child, position ([n]
) are not supported for same name sibling, the child will be added at the end of the children list.type
- the type of the object.- Returns:
- the new object created.
- Throws:
AmetysRepositoryException
- if an error occurs.RepositoryIntegrityViolationException
- if an object with the same name already exists and same name siblings is not allowed.
-
getParent
Description copied from interface:AmetysObject
Returns the parent object in the Ametys hierarchy.- Specified by:
getParent
in interfaceAmetysObject
- Overrides:
getParent
in classSimpleAmetysObject<F extends AmetysObjectCollectionFactory>
- Returns:
- the parent object or
null
if current object is the root. - Throws:
AmetysRepositoryException
- if an error occurs.
-
getProfilesForAnonymousAndAnyConnectedUser
public Map<ProfileAssignmentStorage.AnonymousOrAnyConnectedKeys,Set<String>> getProfilesForAnonymousAndAnyConnectedUser()Description copied from interface:ACLAmetysObject
Gets the allowed profiles any connected user has on the given object- Specified by:
getProfilesForAnonymousAndAnyConnectedUser
in interfaceACLAmetysObject
- Returns:
- a map containing allowed/denied profiles that anonymous and any connected user has on the given object
-
getProfilesForGroups
public Map<GroupIdentity,Map<ProfileAssignmentStorage.UserOrGroup, getProfilesForGroupsSet<String>>> (Set<GroupIdentity> groups) Description copied from interface:ACLAmetysObject
Gets the groups that have allowed profiles assigned on the given object- Specified by:
getProfilesForGroups
in interfaceACLAmetysObject
- Parameters:
groups
- The group to get profiles for. Can be null to get profiles for all groups that have rights- Returns:
- The map of allowed/denied groups with their assigned profiles
-
getProfilesForUsers
public Map<UserIdentity,Map<ProfileAssignmentStorage.UserOrGroup, getProfilesForUsersSet<String>>> (UserIdentity user) Description copied from interface:ACLAmetysObject
Gets the users that have allowed profiles assigned on the given object- Specified by:
getProfilesForUsers
in interfaceACLAmetysObject
- Parameters:
user
- The user to get profiles for. Can be null to get profiles for all users that have rights- Returns:
- The map of allowed users with their assigned allowed/denied profiles
-
addAllowedProfilesForAnyConnectedUser
Description copied from interface:ModifiableACLAmetysObject
Adds allowed profiles any connected user has on this ametys object- Specified by:
addAllowedProfilesForAnyConnectedUser
in interfaceModifiableACLAmetysObject
- Parameters:
profileIds
- The profiles to add
-
removeAllowedProfilesForAnyConnectedUser
Description copied from interface:ModifiableACLAmetysObject
Removes allowed profiles any connected user has on this ametys object- Specified by:
removeAllowedProfilesForAnyConnectedUser
in interfaceModifiableACLAmetysObject
- Parameters:
profileIds
- The profiles to remove
-
addDeniedProfilesForAnyConnectedUser
Description copied from interface:ModifiableACLAmetysObject
Adds denied profiles any connected user has on this ametys object- Specified by:
addDeniedProfilesForAnyConnectedUser
in interfaceModifiableACLAmetysObject
- Parameters:
profileIds
- The profiles to add
-
removeDeniedProfilesForAnyConnectedUser
Description copied from interface:ModifiableACLAmetysObject
Removes denied profiles any connected user has on this ametys object- Specified by:
removeDeniedProfilesForAnyConnectedUser
in interfaceModifiableACLAmetysObject
- Parameters:
profileIds
- The profiles to remove
-
addAllowedProfilesForAnonymous
Description copied from interface:ModifiableACLAmetysObject
Adds allowed profiles an anonymous user has on this ametys object- Specified by:
addAllowedProfilesForAnonymous
in interfaceModifiableACLAmetysObject
- Parameters:
profileIds
- The profiles to add
-
removeAllowedProfilesForAnonymous
Description copied from interface:ModifiableACLAmetysObject
Removes allowed profiles an anonymous user has on this ametys object- Specified by:
removeAllowedProfilesForAnonymous
in interfaceModifiableACLAmetysObject
- Parameters:
profileIds
- The profiles to remove
-
addDeniedProfilesForAnonymous
Description copied from interface:ModifiableACLAmetysObject
Adds denied profiles an anonymous user has on this ametys object- Specified by:
addDeniedProfilesForAnonymous
in interfaceModifiableACLAmetysObject
- Parameters:
profileIds
- The profiles to add
-
removeDeniedProfilesForAnonymous
Description copied from interface:ModifiableACLAmetysObject
Removes denied profiles an anonymous user has on this ametys object- Specified by:
removeDeniedProfilesForAnonymous
in interfaceModifiableACLAmetysObject
- Parameters:
profileIds
- The profiles to remove
-
addAllowedUsers
Description copied from interface:ModifiableACLAmetysObject
Associates some users with an allowed profile on this ametys object- Specified by:
addAllowedUsers
in interfaceModifiableACLAmetysObject
- Parameters:
users
- The users to addprofileId
- The id of the profile
-
removeAllowedUsers
Description copied from interface:ModifiableACLAmetysObject
Removes the association between some users and an allowed profile on this ametys object- Specified by:
removeAllowedUsers
in interfaceModifiableACLAmetysObject
- Parameters:
users
- The users to removeprofileId
- The id of the profile
-
removeAllowedUsers
Description copied from interface:ModifiableACLAmetysObject
Removes the association between some users and all allowed profiles on this ametys object- Specified by:
removeAllowedUsers
in interfaceModifiableACLAmetysObject
- Parameters:
users
- The users to remove
-
addAllowedGroups
Description copied from interface:ModifiableACLAmetysObject
Associates some groups with an allowed profile on this ametys object- Specified by:
addAllowedGroups
in interfaceModifiableACLAmetysObject
- Parameters:
groups
- The groups to addprofileId
- The id of the profile
-
removeAllowedGroups
Description copied from interface:ModifiableACLAmetysObject
Removes the association between some groups and an allowed profile on this ametys object- Specified by:
removeAllowedGroups
in interfaceModifiableACLAmetysObject
- Parameters:
groups
- The groups to removeprofileId
- The id of the profile
-
removeAllowedGroups
Description copied from interface:ModifiableACLAmetysObject
Removes the association between some groups and all allowed profiles on this ametys object- Specified by:
removeAllowedGroups
in interfaceModifiableACLAmetysObject
- Parameters:
groups
- The groups to remove
-
addDeniedUsers
Description copied from interface:ModifiableACLAmetysObject
Associates some users with a denied profile on this ametys object- Specified by:
addDeniedUsers
in interfaceModifiableACLAmetysObject
- Parameters:
users
- The users to addprofileId
- The id of the profile
-
removeDeniedUsers
Description copied from interface:ModifiableACLAmetysObject
Removes the association between some users and an denied profile on this ametys object- Specified by:
removeDeniedUsers
in interfaceModifiableACLAmetysObject
- Parameters:
users
- The users to removeprofileId
- The id of the profile
-
removeDeniedUsers
Description copied from interface:ModifiableACLAmetysObject
Removes the association between some users and all denied profiles on this ametys object- Specified by:
removeDeniedUsers
in interfaceModifiableACLAmetysObject
- Parameters:
users
- The users to remove
-
addDeniedGroups
Description copied from interface:ModifiableACLAmetysObject
Associates some groups with an allowed profile on this ametys object- Specified by:
addDeniedGroups
in interfaceModifiableACLAmetysObject
- Parameters:
groups
- The groups to addprofileId
- The id of the profile
-
removeDeniedGroups
Description copied from interface:ModifiableACLAmetysObject
Removes the association between some groups and an allowed profile on this ametys object- Specified by:
removeDeniedGroups
in interfaceModifiableACLAmetysObject
- Parameters:
groups
- The groups to removeprofileId
- The id of the profile
-
removeDeniedGroups
Description copied from interface:ModifiableACLAmetysObject
Removes the association between some groups and all allowed profiles on this ametys object- Specified by:
removeDeniedGroups
in interfaceModifiableACLAmetysObject
- Parameters:
groups
- The groups to remove
-
isInheritanceDisallowed
Description copied from interface:ACLAmetysObject
Returns true if the inheritance is disallow for this ametys object- Specified by:
isInheritanceDisallowed
in interfaceACLAmetysObject
- Returns:
- true if the inheritance is disallow for this ametys object
-
disallowInheritance
Description copied from interface:ModifiableACLAmetysObject
Allow or disallow inheritance of permissions- Specified by:
disallowInheritance
in interfaceModifiableACLAmetysObject
- Parameters:
disallow
- true to disallow inheritance
-