Interface VersionService
- All Known Subinterfaces:
VersionServiceExtension,VersionServiceTrait
- All Known Implementing Classes:
Version2ServiceImpl,VersionServiceImpl,VirtualVersionServiceExtension
- Author:
- Roy Wetherall, janv
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe version store protocol label, used in store references -
Method Summary
Modifier and TypeMethodDescriptioncreateVersion(Collection<NodeRef> nodeRefs, Map<String, Serializable> versionProperties) Creates new versions based on the list of node references provided.createVersion(NodeRef nodeRef, Map<String, Serializable> versionProperties) Creates a new version based on the referenced node.createVersion(NodeRef nodeRef, Map<String, Serializable> versionProperties, boolean versionChildren) Creates a new version based on the referenced node.voiddeleteVersion(NodeRef nodeRef, Version version) Delete a specific version associated with a node reference.voiddeleteVersionHistory(NodeRef nodeRef) Delete the version history associated with a node reference.voidensureVersioningEnabled(NodeRef nodeRef, Map<QName, Serializable> versionProperties) Ensures that a node has the versionable aspect applied to it, and has at least an initial entry in the version store.getCurrentVersion(NodeRef nodeRef) Gets the version object for the current version of the node reference passed.getVersionHistory(NodeRef nodeRef) Gets the version history information for a node.Gets the reference to the version storebooleanisAVersion(NodeRef nodeRef) Is the nodeRef a version node?booleanisVersioned(NodeRef nodeRef) Is the nodeRef versioned?voidregisterVersionLabelPolicy(QName typeQName, VersionServicePolicies.CalculateVersionLabelPolicy policy) Register a version label policyBy default a deep restore is performed.restore(NodeRef nodeRef, NodeRef parentNodeRef, QName assocTypeQName, QName assocQName, boolean deep) Restores a node not currently present in the store, but that has a version history.voidRevert the state of the node to the current version.voidRevert the state of the node to the current version.voidRevert the state of the node to the specified version.voidRevert the state of the node to the specified version.
-
Field Details
-
VERSION_STORE_PROTOCOL
The version store protocol label, used in store references- See Also:
-
-
Method Details
-
getVersionStoreReference
Gets the reference to the version store- Returns:
- reference to the version store
-
isAVersion
Is the nodeRef a version node?- Returns:
- true, if the nodeRef is a version node, false otherwise
-
isVersioned
Is the nodeRef versioned?- Returns:
- true, if the nodeRef is versioned, false otherwise
-
createVersion
@Auditable(parameters={"nodeRef","versionProperties"}) Version createVersion(NodeRef nodeRef, Map<String, Serializable> versionProperties) throws ReservedVersionNameException, AspectMissingExceptionCreates a new version based on the referenced node.If the node has not previously been versioned then a version history and initial version will be created.
If the node referenced does not or can not have the version aspect applied to it then an exception will be raised.
The version properties are stored as version meta-data against the newly created version.
- Parameters:
nodeRef- a node referenceversionProperties- the version properties that are stored with the newly created version, or null if there are no relevant properties- Returns:
- the created version object
- Throws:
ReservedVersionNameException- thrown if a reserved property name is used int he version properties providedAspectMissingException- thrown if the version aspect is missing
-
createVersion
@Auditable(parameters={"nodeRef","versionProperties","versionChildren"}) Collection<Version> createVersion(NodeRef nodeRef, Map<String, Serializable> versionProperties, boolean versionChildren) throws ReservedVersionNameException, AspectMissingExceptionCreates a new version based on the referenced node.If the node has not previously been versioned then a version history and initial version will be created.
If the node referenced does not or can not have the version aspect applied to it then an exception will be raised.
The version properties are stored as version meta-data against the newly created version.
- Parameters:
nodeRef- a node referenceversionProperties- the version properties that are stored with the newly created versionversionChildren- if true then the children of the referenced node are also versioned, false otherwise- Returns:
- the created version object(s)
- Throws:
ReservedVersionNameException- thrown if a reserved property name is used int he version properties providedAspectMissingException- thrown if the version aspect is missing
-
createVersion
@Auditable(parameters={"nodeRef","versionProperties"}) Collection<Version> createVersion(Collection<NodeRef> nodeRefs, Map<String, Serializable> versionProperties) throws ReservedVersionNameException, AspectMissingExceptionCreates new versions based on the list of node references provided.- Parameters:
nodeRefs- a list of node referencesversionProperties- version property values- Returns:
- a collection of newly created versions
- Throws:
ReservedVersionNameException- thrown if a reserved property name is used in the version properties providedAspectMissingException- thrown if the version aspect is missing
-
getVersionHistory
@Auditable(parameters="nodeRef") VersionHistory getVersionHistory(NodeRef nodeRef) throws AspectMissingException Gets the version history information for a node.If the node has not been versioned then null is returned.
If the node referenced does not or can not have the version aspect applied to it then an exception will be raised.
- Parameters:
nodeRef- a node reference- Returns:
- the version history information
- Throws:
AspectMissingException- thrown if the version aspect is missing
-
getCurrentVersion
Gets the version object for the current version of the node reference passed.Returns
nullif the node is not versionable or has not been versioned.- Parameters:
nodeRef- the node reference of the 'live' node- Returns:
- the version object for the current version
- Throws:
IllegalArgumentException- if the nodeRef is not a reference to a 'live' node
-
revert
Revert the state of the node to the current version.The node reference will be reverted to the current version.
A deep revert will be performed.
- Parameters:
nodeRef- the node reference- See Also:
-
revert
Revert the state of the node to the current version.The node will be reverted to the current version.
- Parameters:
nodeRef- the node referencedeep- true if a deep revert is to be performed, false otherwise- See Also:
-
revert
Revert the state of the node to the specified version.A deep revert will take place by default.
- Parameters:
nodeRef- the node referenceversion- the version to revert to- See Also:
-
revert
@Auditable(parameters={"nodeRef","version","deep"}) void revert(NodeRef nodeRef, Version version, boolean deep) Revert the state of the node to the specified version.Any changes made to the node will be lost and the state of the node will reflect that of the version specified.
The version label property on the node reference will remain unchanged.
If the node is further versioned then the new version will be created at the head of the version history graph. A branch will not be created.
If a deep revert is to be performed then any child nodes that are no longer present will be deep restored (if appropriate) otherwise child associations to deleted, versioned nodes will not be restored.
- Parameters:
nodeRef- the node referenceversion- the version to revert todeep- true is a deep revert is to be performed, false otherwise.
-
restore
@Auditable(parameters={"nodeRef","parentNodeRef","assocTypeQName","assocQName"}) NodeRef restore(NodeRef nodeRef, NodeRef parentNodeRef, QName assocTypeQName, QName assocQName) By default a deep restore is performed.- Parameters:
nodeRef- the node reference to a node that no longer exists in the storeparentNodeRef- the new parent of the restored nodeassocTypeQName- the assoc type qnameassocQName- the assoc qname- Returns:
- the newly restored node reference
- See Also:
-
restore
@Auditable(parameters={"nodeRef","parentNodeRef","assocTypeQName","assocQName","deep"}) NodeRef restore(NodeRef nodeRef, NodeRef parentNodeRef, QName assocTypeQName, QName assocQName, boolean deep) Restores a node not currently present in the store, but that has a version history.The restored node will be at the head (most resent version).
Restoration will fail if there is no version history for the specified node id in the specified store.
If the node already exists in the store then an exception will be raised.
Once the node is restored it is reverted to the head version in the appropriate version history tree. If deep is set to true then this will be a deep revert, false otherwise.
- Parameters:
nodeRef- the node reference to a node that no longer exists in the storeparentNodeRef- the new parent of the restored nodeassocTypeQName- the assoc type qnameassocQName- the assoc qnamedeep- true is a deep revert should be performed once the node has been restored, false otherwise- Returns:
- the newly restored node reference
-
deleteVersionHistory
@Auditable(parameters="nodeRef") void deleteVersionHistory(NodeRef nodeRef) throws AspectMissingException Delete the version history associated with a node reference.This operation is permanent, all versions in the version history are deleted and cannot be retrieved.
The current version label for the node reference is reset and any subsequent versions of the node will result in a new version history being created.
- Parameters:
nodeRef- the node reference- Throws:
AspectMissingException- thrown if the version aspect is missing
-
deleteVersion
Delete a specific version associated with a node reference.This operation is permanent, the specific version in the version history is deleted and cannot be retrieved.
If this is the last version, then the current version label for the node reference is reset and any subsequent versions of the node will result in a new version history being created.
- Parameters:
nodeRef- the node referenceversion- the version to delete
-
ensureVersioningEnabled
@Auditable(parameters="nodeRef") void ensureVersioningEnabled(NodeRef nodeRef, Map<QName, Serializable> versionProperties) Ensures that a node has the versionable aspect applied to it, and has at least an initial entry in the version store. If any of these requirements are missing, then they will be fixed.- Parameters:
nodeRef- the node referenceversionProperties- the version properties to apply if versioning isn't currently enabled for the node
-
registerVersionLabelPolicy
void registerVersionLabelPolicy(QName typeQName, VersionServicePolicies.CalculateVersionLabelPolicy policy) Register a version label policy- Parameters:
typeQName- the QName of the type to registerpolicy- the policy to register for the specified type
-