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
AnAmetysObjectrepresenting a collection of otherAmetysObjects.
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.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) AmetysObjectCollectionFactory_factory
-
Constructor Summary
Constructors Constructor Description AmetysObjectCollection(Node node, String parentPath, F factory)Creates anAmetysObjectCollection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private String_getPath(String childName)voidaddAllowedGroups(Set<GroupIdentity> groups, String profileId)Associates some groups with an allowed profile on this ametys objectvoidaddAllowedProfilesForAnonymous(Set<String> profileIds)Adds allowed profiles an anonymous user has on this ametys objectvoidaddAllowedProfilesForAnyConnectedUser(Set<String> profileIds)Adds allowed profiles any connected user has on this ametys objectvoidaddAllowedUsers(Set<UserIdentity> users, String profileId)Associates some users with an allowed profile on this ametys objectvoidaddDeniedGroups(Set<GroupIdentity> groups, String profileId)Associates some groups with an allowed profile on this ametys objectvoidaddDeniedProfilesForAnonymous(Set<String> profileIds)Adds denied profiles an anonymous user has on this ametys objectvoidaddDeniedProfilesForAnyConnectedUser(Set<String> profileIds)Adds denied profiles any connected user has on this ametys objectvoidaddDeniedUsers(Set<UserIdentity> users, String profileId)Associates some users with a denied profile on this ametys objectAcreateChild(String name, String type)Creates a child below current object.voiddisallowInheritance(boolean disallow)Allow or disallow inheritance of permissionsAgetChild(String path)Retrieves a given child from its relative path.AmetysObjectIterable<A>getChildren()Retrieves children of the current object.AmetysObjectgetParent()Returns the parent object in the Ametys hierarchy.Map<ProfileAssignmentStorage.AnonymousOrAnyConnectedKeys,Set<String>>getProfilesForAnonymousAndAnyConnectedUser()Gets the allowed profiles any connected user has on the given objectMap<GroupIdentity,Map<ProfileAssignmentStorage.UserOrGroup,Set<String>>>getProfilesForGroups(Set<GroupIdentity> groups)Gets the groups that have allowed profiles assigned on the given objectMap<UserIdentity,Map<ProfileAssignmentStorage.UserOrGroup,Set<String>>>getProfilesForUsers(UserIdentity user)Gets the users that have allowed profiles assigned on the given objectbooleanhasChild(String name)Tests if this Object has at least one child with the given name.booleanisInheritanceDisallowed()Returns true if the inheritance is disallow for this ametys objectIterator<A>iterator()voidremoveAllowedGroups(Set<GroupIdentity> groups)Removes the association between some groups and all allowed profiles on this ametys objectvoidremoveAllowedGroups(Set<GroupIdentity> groups, String profileId)Removes the association between some groups and an allowed profile on this ametys objectvoidremoveAllowedProfilesForAnonymous(Set<String> profileIds)Removes allowed profiles an anonymous user has on this ametys objectvoidremoveAllowedProfilesForAnyConnectedUser(Set<String> profileIds)Removes allowed profiles any connected user has on this ametys objectvoidremoveAllowedUsers(Set<UserIdentity> users)Removes the association between some users and all allowed profiles on this ametys objectvoidremoveAllowedUsers(Set<UserIdentity> users, String profileId)Removes the association between some users and an allowed profile on this ametys objectvoidremoveDeniedGroups(Set<GroupIdentity> groups)Removes the association between some groups and all allowed profiles on this ametys objectvoidremoveDeniedGroups(Set<GroupIdentity> groups, String profileId)Removes the association between some groups and an allowed profile on this ametys objectvoidremoveDeniedProfilesForAnonymous(Set<String> profileIds)Removes denied profiles an anonymous user has on this ametys objectvoidremoveDeniedProfilesForAnyConnectedUser(Set<String> profileIds)Removes denied profiles any connected user has on this ametys objectvoidremoveDeniedUsers(Set<UserIdentity> users)Removes the association between some users and all denied profiles on this ametys objectvoidremoveDeniedUsers(Set<UserIdentity> users, String profileId)Removes the association between some users and an denied profile on this ametys object-
Methods 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
-
-
-
-
Field Detail
-
_factory
AmetysObjectCollectionFactory _factory
-
-
Constructor Detail
-
AmetysObjectCollection
public AmetysObjectCollection(Node node, String parentPath, F factory)
Creates anAmetysObjectCollection.- Parameters:
node- the node backing this AmetysObject.parentPath- the parentPath in the Ametys hierarchy.factory- theAmetysObjectCollectionFactorywhich created the AmetysObject.
-
-
Method Detail
-
getChildren
public AmetysObjectIterable<A> getChildren() throws AmetysRepositoryException
Description copied from interface:TraversableAmetysObjectRetrieves children of the current object.- Specified by:
getChildrenin interfaceTraversableAmetysObject- Returns:
- the children or an empty
AmetysObjectIterable. - Throws:
AmetysRepositoryException- if an error occurs.
-
iterator
public Iterator<A> iterator()
- Specified by:
iteratorin interfaceIterable<F extends AmetysObjectCollectionFactory>
-
hasChild
public boolean hasChild(String name) throws AmetysRepositoryException
Description copied from interface:TraversableAmetysObjectTests if this Object has at least one child with the given name.- Specified by:
hasChildin interfaceTraversableAmetysObject- Parameters:
name- the name to test. Cannot benullnor empty nor begin with a'/'and it cannot contain'/'.- Returns:
trueif the named child exists,falseotherwise.- Throws:
AmetysRepositoryException- if an error occurs.
-
getChild
public A getChild(String path) throws AmetysRepositoryException, UnknownAmetysObjectException
Description copied from interface:TraversableAmetysObjectRetrieves a given child from its relative path. The path cannot benull, empty nor begin with a'/'.- Specified by:
getChildin 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:ModifiableTraversableAmetysObjectCreates a child below current object.- Specified by:
createChildin 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
public AmetysObject getParent() throws AmetysRepositoryException
Description copied from interface:AmetysObjectReturns the parent object in the Ametys hierarchy.- Specified by:
getParentin interfaceAmetysObject- Overrides:
getParentin classSimpleAmetysObject<F extends AmetysObjectCollectionFactory>- Returns:
- the parent object or
nullif current object is the root. - Throws:
AmetysRepositoryException- if an error occurs.
-
getProfilesForAnonymousAndAnyConnectedUser
public Map<ProfileAssignmentStorage.AnonymousOrAnyConnectedKeys,Set<String>> getProfilesForAnonymousAndAnyConnectedUser()
Description copied from interface:ACLAmetysObjectGets the allowed profiles any connected user has on the given object- Specified by:
getProfilesForAnonymousAndAnyConnectedUserin 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,Set<String>>> getProfilesForGroups(Set<GroupIdentity> groups)
Description copied from interface:ACLAmetysObjectGets the groups that have allowed profiles assigned on the given object- Specified by:
getProfilesForGroupsin 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,Set<String>>> getProfilesForUsers(UserIdentity user)
Description copied from interface:ACLAmetysObjectGets the users that have allowed profiles assigned on the given object- Specified by:
getProfilesForUsersin 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
public void addAllowedProfilesForAnyConnectedUser(Set<String> profileIds)
Description copied from interface:ModifiableACLAmetysObjectAdds allowed profiles any connected user has on this ametys object- Specified by:
addAllowedProfilesForAnyConnectedUserin interfaceModifiableACLAmetysObject- Parameters:
profileIds- The profiles to add
-
removeAllowedProfilesForAnyConnectedUser
public void removeAllowedProfilesForAnyConnectedUser(Set<String> profileIds)
Description copied from interface:ModifiableACLAmetysObjectRemoves allowed profiles any connected user has on this ametys object- Specified by:
removeAllowedProfilesForAnyConnectedUserin interfaceModifiableACLAmetysObject- Parameters:
profileIds- The profiles to remove
-
addDeniedProfilesForAnyConnectedUser
public void addDeniedProfilesForAnyConnectedUser(Set<String> profileIds)
Description copied from interface:ModifiableACLAmetysObjectAdds denied profiles any connected user has on this ametys object- Specified by:
addDeniedProfilesForAnyConnectedUserin interfaceModifiableACLAmetysObject- Parameters:
profileIds- The profiles to add
-
removeDeniedProfilesForAnyConnectedUser
public void removeDeniedProfilesForAnyConnectedUser(Set<String> profileIds)
Description copied from interface:ModifiableACLAmetysObjectRemoves denied profiles any connected user has on this ametys object- Specified by:
removeDeniedProfilesForAnyConnectedUserin interfaceModifiableACLAmetysObject- Parameters:
profileIds- The profiles to remove
-
addAllowedProfilesForAnonymous
public void addAllowedProfilesForAnonymous(Set<String> profileIds)
Description copied from interface:ModifiableACLAmetysObjectAdds allowed profiles an anonymous user has on this ametys object- Specified by:
addAllowedProfilesForAnonymousin interfaceModifiableACLAmetysObject- Parameters:
profileIds- The profiles to add
-
removeAllowedProfilesForAnonymous
public void removeAllowedProfilesForAnonymous(Set<String> profileIds)
Description copied from interface:ModifiableACLAmetysObjectRemoves allowed profiles an anonymous user has on this ametys object- Specified by:
removeAllowedProfilesForAnonymousin interfaceModifiableACLAmetysObject- Parameters:
profileIds- The profiles to remove
-
addDeniedProfilesForAnonymous
public void addDeniedProfilesForAnonymous(Set<String> profileIds)
Description copied from interface:ModifiableACLAmetysObjectAdds denied profiles an anonymous user has on this ametys object- Specified by:
addDeniedProfilesForAnonymousin interfaceModifiableACLAmetysObject- Parameters:
profileIds- The profiles to add
-
removeDeniedProfilesForAnonymous
public void removeDeniedProfilesForAnonymous(Set<String> profileIds)
Description copied from interface:ModifiableACLAmetysObjectRemoves denied profiles an anonymous user has on this ametys object- Specified by:
removeDeniedProfilesForAnonymousin interfaceModifiableACLAmetysObject- Parameters:
profileIds- The profiles to remove
-
addAllowedUsers
public void addAllowedUsers(Set<UserIdentity> users, String profileId)
Description copied from interface:ModifiableACLAmetysObjectAssociates some users with an allowed profile on this ametys object- Specified by:
addAllowedUsersin interfaceModifiableACLAmetysObject- Parameters:
users- The users to addprofileId- The id of the profile
-
removeAllowedUsers
public void removeAllowedUsers(Set<UserIdentity> users, String profileId)
Description copied from interface:ModifiableACLAmetysObjectRemoves the association between some users and an allowed profile on this ametys object- Specified by:
removeAllowedUsersin interfaceModifiableACLAmetysObject- Parameters:
users- The users to removeprofileId- The id of the profile
-
removeAllowedUsers
public void removeAllowedUsers(Set<UserIdentity> users)
Description copied from interface:ModifiableACLAmetysObjectRemoves the association between some users and all allowed profiles on this ametys object- Specified by:
removeAllowedUsersin interfaceModifiableACLAmetysObject- Parameters:
users- The users to remove
-
addAllowedGroups
public void addAllowedGroups(Set<GroupIdentity> groups, String profileId)
Description copied from interface:ModifiableACLAmetysObjectAssociates some groups with an allowed profile on this ametys object- Specified by:
addAllowedGroupsin interfaceModifiableACLAmetysObject- Parameters:
groups- The groups to addprofileId- The id of the profile
-
removeAllowedGroups
public void removeAllowedGroups(Set<GroupIdentity> groups, String profileId)
Description copied from interface:ModifiableACLAmetysObjectRemoves the association between some groups and an allowed profile on this ametys object- Specified by:
removeAllowedGroupsin interfaceModifiableACLAmetysObject- Parameters:
groups- The groups to removeprofileId- The id of the profile
-
removeAllowedGroups
public void removeAllowedGroups(Set<GroupIdentity> groups)
Description copied from interface:ModifiableACLAmetysObjectRemoves the association between some groups and all allowed profiles on this ametys object- Specified by:
removeAllowedGroupsin interfaceModifiableACLAmetysObject- Parameters:
groups- The groups to remove
-
addDeniedUsers
public void addDeniedUsers(Set<UserIdentity> users, String profileId)
Description copied from interface:ModifiableACLAmetysObjectAssociates some users with a denied profile on this ametys object- Specified by:
addDeniedUsersin interfaceModifiableACLAmetysObject- Parameters:
users- The users to addprofileId- The id of the profile
-
removeDeniedUsers
public void removeDeniedUsers(Set<UserIdentity> users, String profileId)
Description copied from interface:ModifiableACLAmetysObjectRemoves the association between some users and an denied profile on this ametys object- Specified by:
removeDeniedUsersin interfaceModifiableACLAmetysObject- Parameters:
users- The users to removeprofileId- The id of the profile
-
removeDeniedUsers
public void removeDeniedUsers(Set<UserIdentity> users)
Description copied from interface:ModifiableACLAmetysObjectRemoves the association between some users and all denied profiles on this ametys object- Specified by:
removeDeniedUsersin interfaceModifiableACLAmetysObject- Parameters:
users- The users to remove
-
addDeniedGroups
public void addDeniedGroups(Set<GroupIdentity> groups, String profileId)
Description copied from interface:ModifiableACLAmetysObjectAssociates some groups with an allowed profile on this ametys object- Specified by:
addDeniedGroupsin interfaceModifiableACLAmetysObject- Parameters:
groups- The groups to addprofileId- The id of the profile
-
removeDeniedGroups
public void removeDeniedGroups(Set<GroupIdentity> groups, String profileId)
Description copied from interface:ModifiableACLAmetysObjectRemoves the association between some groups and an allowed profile on this ametys object- Specified by:
removeDeniedGroupsin interfaceModifiableACLAmetysObject- Parameters:
groups- The groups to removeprofileId- The id of the profile
-
removeDeniedGroups
public void removeDeniedGroups(Set<GroupIdentity> groups)
Description copied from interface:ModifiableACLAmetysObjectRemoves the association between some groups and all allowed profiles on this ametys object- Specified by:
removeDeniedGroupsin interfaceModifiableACLAmetysObject- Parameters:
groups- The groups to remove
-
isInheritanceDisallowed
public boolean isInheritanceDisallowed()
Description copied from interface:ACLAmetysObjectReturns true if the inheritance is disallow for this ametys object- Specified by:
isInheritanceDisallowedin interfaceACLAmetysObject- Returns:
- true if the inheritance is disallow for this ametys object
-
disallowInheritance
public void disallowInheritance(boolean disallow)
Description copied from interface:ModifiableACLAmetysObjectAllow or disallow inheritance of permissions- Specified by:
disallowInheritancein interfaceModifiableACLAmetysObject- Parameters:
disallow- true to disallow inheritance
-
-