Class DefaultTraversableAmetysObject<F extends DefaultTraversableAmetysObjectFactory>
- java.lang.Object
-
- org.ametys.plugins.repository.AbstractAmetysObject
-
- org.ametys.plugins.repository.jcr.SimpleAmetysObject<F>
-
- org.ametys.plugins.repository.jcr.DefaultTraversableAmetysObject<F>
-
- Type Parameters:
F
- the actual type of factory.
- All Implemented Interfaces:
ACLAmetysObject
,AmetysObject
,JCRAmetysObject
,JCRTraversableAmetysObject
,MetadataAwareAmetysObject
,ModifiableMetadataAwareAmetysObject
,ModifiableACLAmetysObject
,ModifiableAmetysObject
,ModifiableTraversableAmetysObject
,RemovableAmetysObject
,TraversableAmetysObject
- Direct Known Subclasses:
AbstractSurveyElement
,DefaultLink
,DefaultPage
,DefaultZone
,JCRCalendar
,JCRCalendarEvent
,JCRCategory
,JCRResourcesCollection
,JCRSubscribersList
,JCRTag
,JCRTasksList
,JCRThread
,JCRWorkflow
,JCRWorkflowProcess
,Project
,QueryContainer
,RootAmetysObject
,Site
,Sitemap
,Thesaurus
,VersionComponentAmetysObject
,VersionsAmetysObject
public class DefaultTraversableAmetysObject<F extends DefaultTraversableAmetysObjectFactory> extends SimpleAmetysObject<F> implements JCRTraversableAmetysObject, ModifiableACLAmetysObject
Default implementation of aTraversableAmetysObject
, backed by a JCR node.
This implementation heavily relies on itsDefaultTraversableAmetysObjectFactory
counterpart.
-
-
Field Summary
Fields Modifier and Type Field Description private DefaultTraversableAmetysObjectFactory
_traversableFactory
-
Constructor Summary
Constructors Constructor Description DefaultTraversableAmetysObject(Node node, String parentPath, F factory)
Creates a DefaultTraversableAmetysObject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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 object<A extends AmetysObject>
AcreateChild(String name, String type)
Creates a child below current object.void
disallowInheritance(boolean disallow)
Allow or disallow inheritance of permissionsSet<GroupIdentity>
getAllowedGroups(String profileId)
Gets the groups that have the given allowed profile on this ametys objectSet<String>
getAllowedProfilesForAnonymous()
Gets the allowed profiles an anonymous user has on this ametys objectSet<String>
getAllowedProfilesForAnyConnectedUser()
Gets the allowed profiles any connected user has on this ametys objectMap<GroupIdentity,Set<String>>
getAllowedProfilesForGroups()
Gets the groups that have allowed profiles assigned on this ametys objectSet<String>
getAllowedProfilesForUser(UserIdentity user)
Gets the allowed profiles assigned on this ametys object for this userMap<UserIdentity,Set<String>>
getAllowedProfilesForUsers()
Gets the users that have allowed profiles assigned on this ametys objectSet<UserIdentity>
getAllowedUsers(String profileId)
Gets the users that have the given allowed profile on this ametys object<A extends AmetysObject>
AgetChild(String path)
Retrieves a given child from its relative path.<A extends AmetysObject>
AmetysObjectIterable<A>getChildren()
Retrieves children of the current object.Set<GroupIdentity>
getDeniedGroups(String profileId)
Gets the groups that have the given allowed profile on this ametys objectSet<String>
getDeniedProfilesForAnonymous()
Gets the denied profiles an anonymous user has on this ametys objectSet<String>
getDeniedProfilesForAnyConnectedUser()
Gets the denied profiles any connected user has on this ametys objectMap<GroupIdentity,Set<String>>
getDeniedProfilesForGroups()
Gets the groups that have allowed profiles assigned on this ametys objectSet<String>
getDeniedProfilesForUser(UserIdentity user)
Gets the denied profiles assigned on this ametys object for this userMap<UserIdentity,Set<String>>
getDeniedProfilesForUsers()
Gets the users that have denied profiles assigned on this ametys objectSet<UserIdentity>
getDeniedUsers(String profileId)
Gets the users that have the given denied profile on this ametys objectboolean
hasChild(String name)
Tests if this Object has at least one child with the given name.boolean
isInheritanceDisallowed()
Returns true if the inheritance is disallow for this ametys objectvoid
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 object-
Methods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getNode, getParent, 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, getParent, getParentPath, getPath, hashCode
-
Methods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNode
-
Methods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChanges
-
Methods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolder
-
Methods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
remove
-
Methods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChildAt, getChildPosition
-
-
-
-
Field Detail
-
_traversableFactory
private DefaultTraversableAmetysObjectFactory _traversableFactory
-
-
Constructor Detail
-
DefaultTraversableAmetysObject
public DefaultTraversableAmetysObject(Node node, String parentPath, F factory)
Creates a DefaultTraversableAmetysObject.- Parameters:
node
- the node backing thisAmetysObject
.parentPath
- the parent path in the Ametys hierarchy.factory
- theDefaultTraversableAmetysObjectFactory
which creates the AmetysObject.
-
-
Method Detail
-
hasChild
public boolean hasChild(String name) throws AmetysRepositoryException
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.
-
createChild
public <A extends AmetysObject> 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
- Type Parameters:
A
- the actual type ofAmetysObject
.- 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.
-
getChild
public <A extends AmetysObject> A getChild(String path) throws AmetysRepositoryException, UnknownAmetysObjectException
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
- Type Parameters:
A
- the actual type ofAmetysObject
.- 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.
-
getChildren
public <A extends AmetysObject> AmetysObjectIterable<A> getChildren() throws AmetysRepositoryException
Description copied from interface:TraversableAmetysObject
Retrieves children of the current object.- Specified by:
getChildren
in interfaceTraversableAmetysObject
- Type Parameters:
A
- the actual type ofAmetysObject
s.- Returns:
- the children or an empty
AmetysObjectIterable
. - Throws:
AmetysRepositoryException
- if an error occurs.
-
getAllowedProfilesForAnyConnectedUser
public Set<String> getAllowedProfilesForAnyConnectedUser()
Description copied from interface:ACLAmetysObject
Gets the allowed profiles any connected user has on this ametys object- Specified by:
getAllowedProfilesForAnyConnectedUser
in interfaceACLAmetysObject
- Returns:
- the allowed profiles any connected user has on this ametys object
-
addAllowedProfilesForAnyConnectedUser
public void addAllowedProfilesForAnyConnectedUser(Set<String> profileIds)
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
public void removeAllowedProfilesForAnyConnectedUser(Set<String> profileIds)
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
-
getDeniedProfilesForAnyConnectedUser
public Set<String> getDeniedProfilesForAnyConnectedUser()
Description copied from interface:ACLAmetysObject
Gets the denied profiles any connected user has on this ametys object- Specified by:
getDeniedProfilesForAnyConnectedUser
in interfaceACLAmetysObject
- Returns:
- the denied profiles any connected user has on this ametys object
-
addDeniedProfilesForAnyConnectedUser
public void addDeniedProfilesForAnyConnectedUser(Set<String> profileIds)
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
public void removeDeniedProfilesForAnyConnectedUser(Set<String> profileIds)
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
-
getAllowedProfilesForAnonymous
public Set<String> getAllowedProfilesForAnonymous()
Description copied from interface:ACLAmetysObject
Gets the allowed profiles an anonymous user has on this ametys object- Specified by:
getAllowedProfilesForAnonymous
in interfaceACLAmetysObject
- Returns:
- the allowed profiles an anonymous user has on this ametys object
-
addAllowedProfilesForAnonymous
public void addAllowedProfilesForAnonymous(Set<String> profileIds)
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
public void removeAllowedProfilesForAnonymous(Set<String> profileIds)
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
-
getDeniedProfilesForAnonymous
public Set<String> getDeniedProfilesForAnonymous()
Description copied from interface:ACLAmetysObject
Gets the denied profiles an anonymous user has on this ametys object- Specified by:
getDeniedProfilesForAnonymous
in interfaceACLAmetysObject
- Returns:
- the denied profiles an anonymous user has on this ametys object
-
addDeniedProfilesForAnonymous
public void addDeniedProfilesForAnonymous(Set<String> profileIds)
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
public void removeDeniedProfilesForAnonymous(Set<String> profileIds)
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
-
getAllowedProfilesForUser
public Set<String> getAllowedProfilesForUser(UserIdentity user)
Description copied from interface:ACLAmetysObject
Gets the allowed profiles assigned on this ametys object for this user- Specified by:
getAllowedProfilesForUser
in interfaceACLAmetysObject
- Parameters:
user
- The user identity- Returns:
- The allowed profiles
-
getAllowedProfilesForUsers
public Map<UserIdentity,Set<String>> getAllowedProfilesForUsers()
Description copied from interface:ACLAmetysObject
Gets the users that have allowed profiles assigned on this ametys object- Specified by:
getAllowedProfilesForUsers
in interfaceACLAmetysObject
- Returns:
- The map of allowed users (keys) with their assigned profiles (values)
-
getAllowedUsers
public Set<UserIdentity> getAllowedUsers(String profileId)
Description copied from interface:ACLAmetysObject
Gets the users that have the given allowed profile on this ametys object- Specified by:
getAllowedUsers
in interfaceACLAmetysObject
- Parameters:
profileId
- The id of the profile- Returns:
- The allowed users with that profile on this ametys object
-
addAllowedUsers
public void addAllowedUsers(Set<UserIdentity> users, String profileId)
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
public void removeAllowedUsers(Set<UserIdentity> users, String profileId)
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
public void removeAllowedUsers(Set<UserIdentity> users)
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
-
getAllowedProfilesForGroups
public Map<GroupIdentity,Set<String>> getAllowedProfilesForGroups()
Description copied from interface:ACLAmetysObject
Gets the groups that have allowed profiles assigned on this ametys object- Specified by:
getAllowedProfilesForGroups
in interfaceACLAmetysObject
- Returns:
- The map of allowed groups (keys) with their assigned profiles (values)
-
getAllowedGroups
public Set<GroupIdentity> getAllowedGroups(String profileId)
Description copied from interface:ACLAmetysObject
Gets the groups that have the given allowed profile on this ametys object- Specified by:
getAllowedGroups
in interfaceACLAmetysObject
- Parameters:
profileId
- The id of the profile- Returns:
- The allowed groups with that profile on that object
-
addAllowedGroups
public void addAllowedGroups(Set<GroupIdentity> groups, String profileId)
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
public void removeAllowedGroups(Set<GroupIdentity> groups, String profileId)
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
public void removeAllowedGroups(Set<GroupIdentity> groups)
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
-
getDeniedProfilesForUser
public Set<String> getDeniedProfilesForUser(UserIdentity user)
Description copied from interface:ACLAmetysObject
Gets the denied profiles assigned on this ametys object for this user- Specified by:
getDeniedProfilesForUser
in interfaceACLAmetysObject
- Parameters:
user
- The user identity- Returns:
- The denied profiles
-
getDeniedProfilesForUsers
public Map<UserIdentity,Set<String>> getDeniedProfilesForUsers()
Description copied from interface:ACLAmetysObject
Gets the users that have denied profiles assigned on this ametys object- Specified by:
getDeniedProfilesForUsers
in interfaceACLAmetysObject
- Returns:
- The map of denied users (keys) with their assigned profiles (values)
-
getDeniedUsers
public Set<UserIdentity> getDeniedUsers(String profileId)
Description copied from interface:ACLAmetysObject
Gets the users that have the given denied profile on this ametys object- Specified by:
getDeniedUsers
in interfaceACLAmetysObject
- Parameters:
profileId
- The id of the profile- Returns:
- The denied users with that profile on this ametys object
-
addDeniedUsers
public void addDeniedUsers(Set<UserIdentity> users, String profileId)
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
public void removeDeniedUsers(Set<UserIdentity> users, String profileId)
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
public void removeDeniedUsers(Set<UserIdentity> users)
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
-
getDeniedProfilesForGroups
public Map<GroupIdentity,Set<String>> getDeniedProfilesForGroups()
Description copied from interface:ACLAmetysObject
Gets the groups that have allowed profiles assigned on this ametys object- Specified by:
getDeniedProfilesForGroups
in interfaceACLAmetysObject
- Returns:
- The map of denied groups (keys) with their assigned profiles (values)
-
getDeniedGroups
public Set<GroupIdentity> getDeniedGroups(String profileId)
Description copied from interface:ACLAmetysObject
Gets the groups that have the given allowed profile on this ametys object- Specified by:
getDeniedGroups
in interfaceACLAmetysObject
- Parameters:
profileId
- The id of the profile- Returns:
- The denied groups with that profile on this ametys object
-
addDeniedGroups
public void addDeniedGroups(Set<GroupIdentity> groups, String profileId)
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
public void removeDeniedGroups(Set<GroupIdentity> groups, String profileId)
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
public void removeDeniedGroups(Set<GroupIdentity> groups)
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
public boolean 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
public void disallowInheritance(boolean disallow)
Description copied from interface:ModifiableACLAmetysObject
Allow or disallow inheritance of permissions- Specified by:
disallowInheritance
in interfaceModifiableACLAmetysObject
- Parameters:
disallow
- true to disallow inheritance
-
-