Class DefaultAmetysObject<F extends DefaultAmetysObjectFactory>
java.lang.Object
org.ametys.plugins.repository.AbstractAmetysObject
org.ametys.plugins.repository.jcr.SimpleAmetysObject<F>
org.ametys.plugins.repository.jcr.DefaultAmetysObject<F>
- Type Parameters:
F- the actual type of factory.
- All Implemented Interfaces:
ACLAmetysObject,AmetysObject,JCRAmetysObject,MetadataAwareAmetysObject,ModifiableMetadataAwareAmetysObject,ModifiableACLAmetysObject,ModifiableAmetysObject,RemovableAmetysObject,DataAndVersionAwareAmetysObject,ModifiableDataAwareVersionableAmetysObject,VersionableAmetysObject,VersionAwareAmetysObject
- Direct Known Subclasses:
Cart,DefaultContent,DefaultLockableAmetysObject,JCRCalendarResource,JCRPost,JCRProjectMember,JCRResource,JCRTask,Query
public class DefaultAmetysObject<F extends DefaultAmetysObjectFactory>
extends SimpleAmetysObject<F>
implements ModifiableDataAwareVersionableAmetysObject, ModifiableACLAmetysObject
Default implementation of a
JCRAmetysObject, which is also a VersionableAmetysObject.-
Field Summary
FieldsModifier and TypeFieldDescriptionProperties that are auto-created or protected, which mustn't be copied when copying a node. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAmetysObject(javax.jcr.Node node, String parentPath, F factory) Creates anDefaultAmetysObject. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAllowedGroups(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 objectvoidAdd a label on this object.voidPersists the current version of thisAmetysObjectprotected voidcopyNode(javax.jcr.Node parentDest, javax.jcr.Node src) Copy the source node in parent nodevoiddisallowInheritance(boolean disallow) Allow or disallow inheritance of permissionsString[]List all labels that exist on this object, whatever the revision.String[]List all revisions of this object.javax.jcr.NodeReturns the JCR node backing thisAmetysObjectin the default JCR workspaceprotected javax.jcr.version.VersionReturns the JCR base version of the node.String[]Get the labels for this object, in the current revision (a single revision can hold several labels).String[]Get the labels for this object fot the given revision (a single revision can hold several labels).javax.jcr.NodegetNode()Gives access to the underlying JCR node.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 objectGet the revision of this object, if any.Get the creation time of the current revision, if any.getRevisionTimestamp(String revision) Get the creation time of the given revision.Returns an unversionedModifiableModelLessDataHolder.protected javax.jcr.version.VersionHistoryReturns the JCRVersionHistoryof the base node.booleanReturns true if the inheritance is disallow for this ametys objectvoidremoveAllowedGroups(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 objectvoidremoveLabel(String label) Remove a label from this object.
If the label doesn't exist, it is silently ignored.voidrestoreFromLabel(String label) Restore data from the specified label.protected voidrestoreFromNode(javax.jcr.Node node) Restore from a nodevoidrestoreFromRevision(String revision) Restore data from the specified revision.voidswitchToLabel(String label) Switch to the revision corresponding to the specified label.
All subsequent method calls on thisAmetysObjectwill concern that version.voidswitchToRevision(String revision) Switch to the revision corresponding to the specified revision.
All subsequent method calls on thisAmetysObjectwill concern that version.Methods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChangesMethods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCodeMethods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChanges
-
Field Details
-
PROTECTED_PROPERTIES
Properties that are auto-created or protected, which mustn't be copied when copying a node.
-
-
Constructor Details
-
DefaultAmetysObject
Creates anDefaultAmetysObject.- Parameters:
node- the node backing thisAmetysObjectparentPath- the parentPath in the Ametys hierarchyfactory- the DefaultAmetysObjectFactory which created the AmetysObject
-
-
Method Details
-
getNode
Description copied from interface:JCRAmetysObjectGives access to the underlying JCR node.- Specified by:
getNodein interfaceJCRAmetysObject- Overrides:
getNodein classSimpleAmetysObject<F extends DefaultAmetysObjectFactory>- Returns:
- the JCR node backing this AmetysObject.
-
getBaseNode
Returns the JCR node backing thisAmetysObjectin the default JCR workspace- Returns:
- the JCR node backing this
AmetysObjectin the default JCR workspace
-
getVersionHistory
Returns the JCRVersionHistoryof the base node.- Returns:
- the JCR
VersionHistoryof the base node. - Throws:
javax.jcr.RepositoryException- if something wrong occurs retrieving the VersionHistory.
-
getBaseVersion
Returns the JCR base version of the node.- Returns:
- the JCR base version of the node.
- Throws:
javax.jcr.RepositoryException- if something wrong occurs retrieving the base version.
-
checkpoint
Description copied from interface:VersionableAmetysObjectPersists the current version of thisAmetysObject- Specified by:
checkpointin interfaceVersionableAmetysObject- Throws:
AmetysRepositoryException- if a problem occurs
-
switchToLabel
public void switchToLabel(String label) throws UnknownAmetysObjectException, AmetysRepositoryException Description copied from interface:VersionAwareAmetysObjectSwitch to the revision corresponding to the specified label.
All subsequent method calls on thisAmetysObjectwill concern that version.- Specified by:
switchToLabelin interfaceVersionAwareAmetysObject- Parameters:
label- the label to switch to, or null to specify the current version- Throws:
UnknownAmetysObjectException- if the label does not correspond to any revisionAmetysRepositoryException- if a problem occurs
-
switchToRevision
public void switchToRevision(String revision) throws UnknownAmetysObjectException, AmetysRepositoryException Description copied from interface:VersionAwareAmetysObjectSwitch to the revision corresponding to the specified revision.
All subsequent method calls on thisAmetysObjectwill concern that version.- Specified by:
switchToRevisionin interfaceVersionAwareAmetysObject- Parameters:
revision- the revision, or null to specify the current version- Throws:
UnknownAmetysObjectException- if the revision does not existAmetysRepositoryException- if a problem occurs
-
restoreFromLabel
public void restoreFromLabel(String label) throws UnknownAmetysObjectException, AmetysRepositoryException Description copied from interface:VersionableAmetysObjectRestore data from the specified label.- Specified by:
restoreFromLabelin interfaceVersionableAmetysObject- Parameters:
label- the label- Throws:
UnknownAmetysObjectException- if the label does not correspond to any revisionAmetysRepositoryException- if a problem occurs
-
restoreFromRevision
public void restoreFromRevision(String revision) throws UnknownAmetysObjectException, AmetysRepositoryException Description copied from interface:VersionableAmetysObjectRestore data from the specified revision.- Specified by:
restoreFromRevisionin interfaceVersionableAmetysObject- Parameters:
revision- the revision- Throws:
UnknownAmetysObjectException- if the revision does not existAmetysRepositoryException- if a problem occurs
-
restoreFromNode
Restore from a node- Parameters:
node- The node to restore- Throws:
javax.jcr.RepositoryException- If error occurs
-
copyNode
protected void copyNode(javax.jcr.Node parentDest, javax.jcr.Node src) throws javax.jcr.RepositoryException Copy the source node in parent node- Parameters:
parentDest- The dest nodesrc- The source node to copy- Throws:
javax.jcr.RepositoryException- If error occurs
-
addLabel
Description copied from interface:VersionableAmetysObjectAdd a label on this object.- Specified by:
addLabelin interfaceVersionableAmetysObject- Parameters:
label- the label to add.moveIfPresent- what to do if the content already has this label : move it to the current revision iftrue, keep it unchanged iffalse.- Throws:
AmetysRepositoryException- if some problem arises.
-
removeLabel
Description copied from interface:VersionableAmetysObjectRemove a label from this object.
If the label doesn't exist, it is silently ignored.- Specified by:
removeLabelin interfaceVersionableAmetysObject- Parameters:
label- the label to remove- Throws:
AmetysRepositoryException- if some problem arises.
-
getAllLabels
Description copied from interface:VersionAwareAmetysObjectList all labels that exist on this object, whatever the revision.- Specified by:
getAllLabelsin interfaceVersionAwareAmetysObject- Returns:
- the list of all labels (can be empty, but not
null). - Throws:
AmetysRepositoryException- if the labels cannot be known.
-
getLabels
Description copied from interface:VersionAwareAmetysObjectGet the labels for this object, in the current revision (a single revision can hold several labels).- Specified by:
getLabelsin interfaceVersionAwareAmetysObject- Returns:
- the list of labels for this revision (can be empty, but not
null). - Throws:
AmetysRepositoryException- if the labels cannot be known.
-
getLabels
public String[] getLabels(String revision) throws UnknownAmetysObjectException, AmetysRepositoryException Description copied from interface:VersionAwareAmetysObjectGet the labels for this object fot the given revision (a single revision can hold several labels).- Specified by:
getLabelsin interfaceVersionAwareAmetysObject- Parameters:
revision- the revision- Returns:
- the list of labels for this revision (can be empty, but not
null). - Throws:
UnknownAmetysObjectException- if the given revision does not exist for this object.AmetysRepositoryException- if the labels cannot be known.
-
getRevision
Description copied from interface:VersionAwareAmetysObjectGet the revision of this object, if any.- Specified by:
getRevisionin interfaceVersionAwareAmetysObject- Returns:
- the revision or null if this is the latest.
- Throws:
AmetysRepositoryException- if the revision cannot be known.
-
getRevisionTimestamp
Description copied from interface:VersionAwareAmetysObjectGet the creation time of the current revision, if any.- Specified by:
getRevisionTimestampin interfaceVersionAwareAmetysObject- Returns:
- the revision creation time, or null if there's no current revision.
- Throws:
AmetysRepositoryException- if an error occurs
-
getRevisionTimestamp
public Date getRevisionTimestamp(String revision) throws UnknownAmetysObjectException, AmetysRepositoryException Description copied from interface:VersionAwareAmetysObjectGet the creation time of the given revision.- Specified by:
getRevisionTimestampin interfaceVersionAwareAmetysObject- Parameters:
revision- the revision.- Returns:
- the revision creation date.
- Throws:
UnknownAmetysObjectException- if the given revision does not exist for this object.AmetysRepositoryException- if an error occurs
-
getAllRevisions
Description copied from interface:VersionAwareAmetysObjectList all revisions of this object. Revisions are ordered in chronological order.- Specified by:
getAllRevisionsin interfaceVersionAwareAmetysObject- Returns:
- the list of revisions (can be empty, but not
null) - Throws:
AmetysRepositoryException- if the revisions cannot be known.
-
getUnversionedDataHolder
Description copied from interface:ModifiableDataAwareVersionableAmetysObjectReturns an unversionedModifiableModelLessDataHolder.- Specified by:
getUnversionedDataHolderin interfaceDataAndVersionAwareAmetysObject- Specified by:
getUnversionedDataHolderin interfaceModifiableDataAwareVersionableAmetysObject- Returns:
- an unversioned
ModifiableModelLessDataHolder.
-
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, getProfilesForGroupsSet<String>>> (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, getProfilesForUsersSet<String>>> (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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Description copied from interface:ModifiableACLAmetysObjectAllow or disallow inheritance of permissions- Specified by:
disallowInheritancein interfaceModifiableACLAmetysObject- Parameters:
disallow- true to disallow inheritance
-