F
- the actual type of factory.public class DefaultAmetysObject<F extends DefaultAmetysObjectFactory> extends SimpleAmetysObject<F> implements ModifiableMetadataAwareVersionableAmetysObject, ModifiableACLAmetysObject
JCRAmetysObject
, which is also a VersionableAmetysObject
.Modifier and Type | Field and Description |
---|---|
private Node |
_baseNode |
private Node |
_currentNode |
private VersionHistory |
_versionHistory |
private Version |
_versionNode |
protected static List<String> |
PROTECTED_PROPERTIES
Properties that are auto-created or protected, which mustn't be copied when copying a node.
|
Constructor and Description |
---|
DefaultAmetysObject(Node node,
String parentPath,
F factory)
Creates an
DefaultAmetysObject . |
Modifier and Type | Method and Description |
---|---|
void |
addAllowedGroups(Set<GroupIdentity> groups,
String profileId)
Associates some groups with an allowed profile on this ametys object
|
void |
addAllowedProfilesForAnonymous(Set<String> profileIds)
Adds allowed profiles an anonymous user has on this ametys object
|
void |
addAllowedProfilesForAnyConnectedUser(Set<String> profileIds)
Adds allowed profiles any connected user has on this ametys object
|
void |
addAllowedUsers(Set<UserIdentity> users,
String profileId)
Associates some users with an allowed profile on this ametys object
|
void |
addDeniedGroups(Set<GroupIdentity> groups,
String profileId)
Associates some groups with an allowed profile on this ametys object
|
void |
addDeniedProfilesForAnonymous(Set<String> profileIds)
Adds denied profiles an anonymous user has on this ametys object
|
void |
addDeniedProfilesForAnyConnectedUser(Set<String> profileIds)
Adds denied profiles any connected user has on this ametys object
|
void |
addDeniedUsers(Set<UserIdentity> users,
String profileId)
Associates some users with a denied profile on this ametys object
|
void |
addLabel(String label,
boolean moveIfPresent)
Add a label on this object.
|
void |
checkpoint()
Persists the current version of this
AmetysObject |
protected void |
copyNode(Node parentDest,
Node src)
Copy the source node in parent node
|
String[] |
getAllLabels()
List all labels that exist on this object, whatever the revision.
|
Set<GroupIdentity> |
getAllowedGroups(String profileId)
Gets the groups that have the given allowed profile on this ametys object
|
Set<String> |
getAllowedProfilesForAnonymous()
Gets the allowed profiles an anonymous user has on this ametys object
|
Set<String> |
getAllowedProfilesForAnyConnectedUser()
Gets the allowed profiles any connected user has on this ametys object
|
Map<GroupIdentity,Set<String>> |
getAllowedProfilesForGroups()
Gets the groups that have allowed profiles assigned on this ametys object
|
Set<String> |
getAllowedProfilesForUser(UserIdentity user)
Gets the allowed profiles assigned on this ametys object for this user
|
Map<UserIdentity,Set<String>> |
getAllowedProfilesForUsers()
Gets the users that have allowed profiles assigned on this ametys object
|
Set<UserIdentity> |
getAllowedUsers(String profileId)
Gets the users that have the given allowed profile on this ametys object
|
String[] |
getAllRevisions()
List all revisions of this object.
|
Node |
getBaseNode()
Returns the JCR node backing this
AmetysObject in the default JCR workspace |
protected Version |
getBaseVersion()
Returns the JCR base version of the node.
|
Set<GroupIdentity> |
getDeniedGroups(String profileId)
Gets the groups that have the given allowed profile on this ametys object
|
Set<String> |
getDeniedProfilesForAnonymous()
Gets the denied profiles an anonymous user has on this ametys object
|
Set<String> |
getDeniedProfilesForAnyConnectedUser()
Gets the denied profiles any connected user has on this ametys object
|
Map<GroupIdentity,Set<String>> |
getDeniedProfilesForGroups()
Gets the groups that have allowed profiles assigned on this ametys object
|
Set<String> |
getDeniedProfilesForUser(UserIdentity user)
Gets the denied profiles assigned on this ametys object for this user
|
Map<UserIdentity,Set<String>> |
getDeniedProfilesForUsers()
Gets the users that have denied profiles assigned on this ametys object
|
Set<UserIdentity> |
getDeniedUsers(String profileId)
Gets the users that have the given denied profile on this ametys object
|
String[] |
getLabels()
Get the labels for this object, in the current revision (a single revision can hold several labels).
|
String[] |
getLabels(String revision)
Get the labels for this object fot the given revision (a single revision can hold several labels).
|
Node |
getNode()
Gives access to the underlying JCR node.
|
String |
getRevision()
Get the revision of this object, if any.
|
Date |
getRevisionTimestamp()
Get the creation time of the current revision, if any.
|
Date |
getRevisionTimestamp(String revision)
Get the creation time of the given revision.
|
ModifiableCompositeMetadata |
getUnversionedMetadataHolder()
Returns an unversioned
ModifiableCompositeMetadata . |
protected VersionHistory |
getVersionHistory()
Returns the JCR
VersionHistory of the base node. |
void |
removeAllowedGroups(Set<GroupIdentity> groups)
Removes the association between some groups and all allowed profiles on this ametys object
|
void |
removeAllowedGroups(Set<GroupIdentity> groups,
String profileId)
Removes the association between some groups and an allowed profile on this ametys object
|
void |
removeAllowedProfilesForAnonymous(Set<String> profileIds)
Removes allowed profiles an anonymous user has on this ametys object
|
void |
removeAllowedProfilesForAnyConnectedUser(Set<String> profileIds)
Removes allowed profiles any connected user has on this ametys object
|
void |
removeAllowedUsers(Set<UserIdentity> users)
Removes the association between some users and all allowed profiles on this ametys object
|
void |
removeAllowedUsers(Set<UserIdentity> users,
String profileId)
Removes the association between some users and an allowed profile on this ametys object
|
void |
removeDeniedGroups(Set<GroupIdentity> groups)
Removes the association between some groups and all allowed profiles on this ametys object
|
void |
removeDeniedGroups(Set<GroupIdentity> groups,
String profileId)
Removes the association between some groups and an allowed profile on this ametys object
|
void |
removeDeniedProfilesForAnonymous(Set<String> profileIds)
Removes denied profiles an anonymous user has on this ametys object
|
void |
removeDeniedProfilesForAnyConnectedUser(Set<String> profileIds)
Removes denied profiles any connected user has on this ametys object
|
void |
removeDeniedUsers(Set<UserIdentity> users)
Removes the association between some users and all denied profiles on this ametys object
|
void |
removeDeniedUsers(Set<UserIdentity> users,
String profileId)
Removes the association between some users and an denied profile on this ametys object
|
void |
removeLabel(String label)
Remove a label from this object.
If the label doesn't exist, it is silently ignored. |
void |
restoreFromLabel(String label)
Restore data from the specified label.
|
protected void |
restoreFromNode(Node node)
Restore from a node
|
void |
restoreFromRevision(String revision)
Restore data from the specified revision.
|
void |
switchToLabel(String label)
Switch to the revision corresponding to the specified label.
All subsequent method calls on this AmetysObject will concern that version. |
void |
switchToRevision(String revision)
Switch to the revision corresponding to the specified revision.
All subsequent method calls on this AmetysObject will concern that version. |
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
equals, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getMetadataHolder
needsSave, rename, revertChanges, saveChanges
equals, getId, getName, getParent, getParentPath, getPath, hashCode
protected static final List<String> PROTECTED_PROPERTIES
private Version _versionNode
private Node _currentNode
private VersionHistory _versionHistory
public DefaultAmetysObject(Node node, String parentPath, F factory)
DefaultAmetysObject
.node
- the node backing this AmetysObject
parentPath
- the parentPath in the Ametys hierarchyfactory
- the DefaultAmetysObjectFactory which created the AmetysObjectpublic Node getNode()
JCRAmetysObject
getNode
in interface JCRAmetysObject
getNode
in class SimpleAmetysObject<F extends DefaultAmetysObjectFactory>
public Node getBaseNode()
AmetysObject
in the default JCR workspaceAmetysObject
in the default JCR workspaceprotected VersionHistory getVersionHistory() throws RepositoryException
VersionHistory
of the base node.VersionHistory
of the base node.RepositoryException
- if something wrong occurs retrieving the VersionHistory.protected Version getBaseVersion() throws RepositoryException
RepositoryException
- if something wrong occurs retrieving the base version.public void checkpoint() throws AmetysRepositoryException
VersionableAmetysObject
AmetysObject
checkpoint
in interface VersionableAmetysObject
AmetysRepositoryException
- if a problem occurspublic void switchToLabel(String label) throws UnknownAmetysObjectException, AmetysRepositoryException
VersionAwareAmetysObject
AmetysObject
will concern that version.switchToLabel
in interface VersionAwareAmetysObject
label
- the label to switch to, or null to specify the current versionUnknownAmetysObjectException
- if the label does not correspond to any revisionAmetysRepositoryException
- if a problem occurspublic void switchToRevision(String revision) throws UnknownAmetysObjectException, AmetysRepositoryException
VersionAwareAmetysObject
AmetysObject
will concern that version.switchToRevision
in interface VersionAwareAmetysObject
revision
- the revision, or null to specify the current versionUnknownAmetysObjectException
- if the revision does not existAmetysRepositoryException
- if a problem occurspublic void restoreFromLabel(String label) throws UnknownAmetysObjectException, AmetysRepositoryException
VersionableAmetysObject
restoreFromLabel
in interface VersionableAmetysObject
label
- the labelUnknownAmetysObjectException
- if the label does not correspond to any revisionAmetysRepositoryException
- if a problem occurspublic void restoreFromRevision(String revision) throws UnknownAmetysObjectException, AmetysRepositoryException
VersionableAmetysObject
restoreFromRevision
in interface VersionableAmetysObject
revision
- the revisionUnknownAmetysObjectException
- if the revision does not existAmetysRepositoryException
- if a problem occursprotected void restoreFromNode(Node node) throws RepositoryException
node
- The node to restoreRepositoryException
- If error occursprotected void copyNode(Node parentDest, Node src) throws RepositoryException
parentDest
- The dest nodesrc
- The source node to copyRepositoryException
- If error occurspublic void addLabel(String label, boolean moveIfPresent) throws AmetysRepositoryException
VersionableAmetysObject
addLabel
in interface VersionableAmetysObject
label
- the label to add.moveIfPresent
- what to do if the content already has this label : move it to the current revision if true
, keep it unchanged if false
.AmetysRepositoryException
- if some problem arises.public void removeLabel(String label) throws AmetysRepositoryException
VersionableAmetysObject
removeLabel
in interface VersionableAmetysObject
label
- the label to removeAmetysRepositoryException
- if some problem arises.public String[] getAllLabels() throws AmetysRepositoryException
VersionAwareAmetysObject
getAllLabels
in interface VersionAwareAmetysObject
null
).AmetysRepositoryException
- if the labels cannot be known.public String[] getLabels() throws AmetysRepositoryException
VersionAwareAmetysObject
getLabels
in interface VersionAwareAmetysObject
null
).AmetysRepositoryException
- if the labels cannot be known.public String[] getLabels(String revision) throws UnknownAmetysObjectException, AmetysRepositoryException
VersionAwareAmetysObject
getLabels
in interface VersionAwareAmetysObject
revision
- the revisionnull
).UnknownAmetysObjectException
- if the given revision does not exist for this object.AmetysRepositoryException
- if the labels cannot be known.public String getRevision() throws AmetysRepositoryException
VersionAwareAmetysObject
getRevision
in interface VersionAwareAmetysObject
AmetysRepositoryException
- if the revision cannot be known.public Date getRevisionTimestamp() throws AmetysRepositoryException
VersionAwareAmetysObject
getRevisionTimestamp
in interface VersionAwareAmetysObject
AmetysRepositoryException
- if an error occurspublic Date getRevisionTimestamp(String revision) throws UnknownAmetysObjectException, AmetysRepositoryException
VersionAwareAmetysObject
getRevisionTimestamp
in interface VersionAwareAmetysObject
revision
- the revision.UnknownAmetysObjectException
- if the given revision does not exist for this object.AmetysRepositoryException
- if an error occurspublic String[] getAllRevisions() throws AmetysRepositoryException
VersionAwareAmetysObject
getAllRevisions
in interface VersionAwareAmetysObject
null
)AmetysRepositoryException
- if the revisions cannot be known.public ModifiableCompositeMetadata getUnversionedMetadataHolder()
ModifiableMetadataAwareVersionableAmetysObject
ModifiableCompositeMetadata
.getUnversionedMetadataHolder
in interface MetadataAndVersionAwareAmetysObject
getUnversionedMetadataHolder
in interface ModifiableMetadataAwareVersionableAmetysObject
ModifiableCompositeMetadata
.public Set<String> getAllowedProfilesForAnyConnectedUser()
ACLAmetysObject
getAllowedProfilesForAnyConnectedUser
in interface ACLAmetysObject
public void addAllowedProfilesForAnyConnectedUser(Set<String> profileIds)
ModifiableACLAmetysObject
addAllowedProfilesForAnyConnectedUser
in interface ModifiableACLAmetysObject
profileIds
- The profiles to addpublic void removeAllowedProfilesForAnyConnectedUser(Set<String> profileIds)
ModifiableACLAmetysObject
removeAllowedProfilesForAnyConnectedUser
in interface ModifiableACLAmetysObject
profileIds
- The profiles to removepublic Set<String> getDeniedProfilesForAnyConnectedUser()
ACLAmetysObject
getDeniedProfilesForAnyConnectedUser
in interface ACLAmetysObject
public void addDeniedProfilesForAnyConnectedUser(Set<String> profileIds)
ModifiableACLAmetysObject
addDeniedProfilesForAnyConnectedUser
in interface ModifiableACLAmetysObject
profileIds
- The profiles to addpublic void removeDeniedProfilesForAnyConnectedUser(Set<String> profileIds)
ModifiableACLAmetysObject
removeDeniedProfilesForAnyConnectedUser
in interface ModifiableACLAmetysObject
profileIds
- The profiles to removepublic Set<String> getAllowedProfilesForAnonymous()
ACLAmetysObject
getAllowedProfilesForAnonymous
in interface ACLAmetysObject
public void addAllowedProfilesForAnonymous(Set<String> profileIds)
ModifiableACLAmetysObject
addAllowedProfilesForAnonymous
in interface ModifiableACLAmetysObject
profileIds
- The profiles to addpublic void removeAllowedProfilesForAnonymous(Set<String> profileIds)
ModifiableACLAmetysObject
removeAllowedProfilesForAnonymous
in interface ModifiableACLAmetysObject
profileIds
- The profiles to removepublic Set<String> getDeniedProfilesForAnonymous()
ACLAmetysObject
getDeniedProfilesForAnonymous
in interface ACLAmetysObject
public void addDeniedProfilesForAnonymous(Set<String> profileIds)
ModifiableACLAmetysObject
addDeniedProfilesForAnonymous
in interface ModifiableACLAmetysObject
profileIds
- The profiles to addpublic void removeDeniedProfilesForAnonymous(Set<String> profileIds)
ModifiableACLAmetysObject
removeDeniedProfilesForAnonymous
in interface ModifiableACLAmetysObject
profileIds
- The profiles to removepublic Set<String> getAllowedProfilesForUser(UserIdentity user)
ACLAmetysObject
getAllowedProfilesForUser
in interface ACLAmetysObject
user
- The user identitypublic Map<UserIdentity,Set<String>> getAllowedProfilesForUsers()
ACLAmetysObject
getAllowedProfilesForUsers
in interface ACLAmetysObject
public Set<UserIdentity> getAllowedUsers(String profileId)
ACLAmetysObject
getAllowedUsers
in interface ACLAmetysObject
profileId
- The id of the profilepublic void addAllowedUsers(Set<UserIdentity> users, String profileId)
ModifiableACLAmetysObject
addAllowedUsers
in interface ModifiableACLAmetysObject
users
- The users to addprofileId
- The id of the profilepublic void removeAllowedUsers(Set<UserIdentity> users, String profileId)
ModifiableACLAmetysObject
removeAllowedUsers
in interface ModifiableACLAmetysObject
users
- The users to removeprofileId
- The id of the profilepublic void removeAllowedUsers(Set<UserIdentity> users)
ModifiableACLAmetysObject
removeAllowedUsers
in interface ModifiableACLAmetysObject
users
- The users to removepublic Map<GroupIdentity,Set<String>> getAllowedProfilesForGroups()
ACLAmetysObject
getAllowedProfilesForGroups
in interface ACLAmetysObject
public Set<GroupIdentity> getAllowedGroups(String profileId)
ACLAmetysObject
getAllowedGroups
in interface ACLAmetysObject
profileId
- The id of the profilepublic void addAllowedGroups(Set<GroupIdentity> groups, String profileId)
ModifiableACLAmetysObject
addAllowedGroups
in interface ModifiableACLAmetysObject
groups
- The groups to addprofileId
- The id of the profilepublic void removeAllowedGroups(Set<GroupIdentity> groups, String profileId)
ModifiableACLAmetysObject
removeAllowedGroups
in interface ModifiableACLAmetysObject
groups
- The groups to removeprofileId
- The id of the profilepublic void removeAllowedGroups(Set<GroupIdentity> groups)
ModifiableACLAmetysObject
removeAllowedGroups
in interface ModifiableACLAmetysObject
groups
- The groups to removepublic Set<String> getDeniedProfilesForUser(UserIdentity user)
ACLAmetysObject
getDeniedProfilesForUser
in interface ACLAmetysObject
user
- The user identitypublic Map<UserIdentity,Set<String>> getDeniedProfilesForUsers()
ACLAmetysObject
getDeniedProfilesForUsers
in interface ACLAmetysObject
public Set<UserIdentity> getDeniedUsers(String profileId)
ACLAmetysObject
getDeniedUsers
in interface ACLAmetysObject
profileId
- The id of the profilepublic void addDeniedUsers(Set<UserIdentity> users, String profileId)
ModifiableACLAmetysObject
addDeniedUsers
in interface ModifiableACLAmetysObject
users
- The users to addprofileId
- The id of the profilepublic void removeDeniedUsers(Set<UserIdentity> users, String profileId)
ModifiableACLAmetysObject
removeDeniedUsers
in interface ModifiableACLAmetysObject
users
- The users to removeprofileId
- The id of the profilepublic void removeDeniedUsers(Set<UserIdentity> users)
ModifiableACLAmetysObject
removeDeniedUsers
in interface ModifiableACLAmetysObject
users
- The users to removepublic Map<GroupIdentity,Set<String>> getDeniedProfilesForGroups()
ACLAmetysObject
getDeniedProfilesForGroups
in interface ACLAmetysObject
public Set<GroupIdentity> getDeniedGroups(String profileId)
ACLAmetysObject
getDeniedGroups
in interface ACLAmetysObject
profileId
- The id of the profilepublic void addDeniedGroups(Set<GroupIdentity> groups, String profileId)
ModifiableACLAmetysObject
addDeniedGroups
in interface ModifiableACLAmetysObject
groups
- The groups to addprofileId
- The id of the profilepublic void removeDeniedGroups(Set<GroupIdentity> groups, String profileId)
ModifiableACLAmetysObject
removeDeniedGroups
in interface ModifiableACLAmetysObject
groups
- The groups to removeprofileId
- The id of the profilepublic void removeDeniedGroups(Set<GroupIdentity> groups)
ModifiableACLAmetysObject
removeDeniedGroups
in interface ModifiableACLAmetysObject
groups
- The groups to remove