Class VirtualVersionServiceExtension
- All Implemented Interfaces:
VersionServiceExtension,VersionService
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.alfresco.service.cmr.version.VersionService
VERSION_STORE_PROTOCOL -
Constructor Summary
Constructors -
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.voidsetSmartStore(VirtualStore smartStore) Methods inherited from class org.alfresco.traitextender.SpringBeanExtension
register, setExtensionPointMethods inherited from class org.alfresco.traitextender.SingletonExtension
acceptsTrait, acceptsTraitClass, getTrait
-
Constructor Details
-
VirtualVersionServiceExtension
public VirtualVersionServiceExtension()
-
-
Method Details
-
setSmartStore
-
getVersionStoreReference
Description copied from interface:VersionServiceGets the reference to the version store- Specified by:
getVersionStoreReferencein interfaceVersionService- Returns:
- reference to the version store
-
isAVersion
Description copied from interface:VersionServiceIs the nodeRef a version node?- Specified by:
isAVersionin interfaceVersionService- Returns:
- true, if the nodeRef is a version node, false otherwise
-
isVersioned
Description copied from interface:VersionServiceIs the nodeRef versioned?- Specified by:
isVersionedin interfaceVersionService- Returns:
- true, if the nodeRef is versioned, false otherwise
-
createVersion
public Version createVersion(NodeRef nodeRef, Map<String, Serializable> versionProperties) throws ReservedVersionNameException, AspectMissingExceptionDescription copied from interface:VersionServiceCreates 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.
- Specified by:
createVersionin interfaceVersionService- 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
public Collection<Version> createVersion(NodeRef nodeRef, Map<String, Serializable> versionProperties, boolean versionChildren) throws ReservedVersionNameException, AspectMissingExceptionDescription copied from interface:VersionServiceCreates 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.
- Specified by:
createVersionin interfaceVersionService- 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
public Collection<Version> createVersion(Collection<NodeRef> nodeRefs, Map<String, Serializable> versionProperties) throws ReservedVersionNameException, AspectMissingExceptionDescription copied from interface:VersionServiceCreates new versions based on the list of node references provided.- Specified by:
createVersionin interfaceVersionService- 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
Description copied from interface:VersionServiceGets 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.
- Specified by:
getVersionHistoryin interfaceVersionService- Parameters:
nodeRef- a node reference- Returns:
- the version history information
- Throws:
AspectMissingException- thrown if the version aspect is missing
-
getCurrentVersion
Description copied from interface:VersionServiceGets the version object for the current version of the node reference passed.Returns
nullif the node is not versionable or has not been versioned.- Specified by:
getCurrentVersionin interfaceVersionService- Parameters:
nodeRef- the node reference of the 'live' node- Returns:
- the version object for the current version
-
revert
Description copied from interface:VersionServiceRevert 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.
- Specified by:
revertin interfaceVersionService- Parameters:
nodeRef- the node reference- See Also:
-
revert
Description copied from interface:VersionServiceRevert the state of the node to the current version.The node will be reverted to the current version.
- Specified by:
revertin interfaceVersionService- Parameters:
nodeRef- the node referencedeep- true if a deep revert is to be performed, false otherwise- See Also:
-
revert
Description copied from interface:VersionServiceRevert the state of the node to the specified version.A deep revert will take place by default.
- Specified by:
revertin interfaceVersionService- Parameters:
nodeRef- the node referenceversion- the version to revert to- See Also:
-
revert
Description copied from interface:VersionServiceRevert 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.
- Specified by:
revertin interfaceVersionService- Parameters:
nodeRef- the node referenceversion- the version to revert todeep- true is a deep revert is to be performed, false otherwise.
-
restore
public NodeRef restore(NodeRef nodeRef, NodeRef parentNodeRef, QName assocTypeQName, QName assocQName) Description copied from interface:VersionServiceBy default a deep restore is performed.- Specified by:
restorein interfaceVersionService- 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
public NodeRef restore(NodeRef nodeRef, NodeRef parentNodeRef, QName assocTypeQName, QName assocQName, boolean deep) Description copied from interface:VersionServiceRestores 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.
- Specified by:
restorein interfaceVersionService- 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
Description copied from interface:VersionServiceDelete 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.
- Specified by:
deleteVersionHistoryin interfaceVersionService- Parameters:
nodeRef- the node reference- Throws:
AspectMissingException- thrown if the version aspect is missing
-
deleteVersion
Description copied from interface:VersionServiceDelete 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.
- Specified by:
deleteVersionin interfaceVersionService- Parameters:
nodeRef- the node referenceversion- the version to delete
-
ensureVersioningEnabled
Description copied from interface:VersionServiceEnsures 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.- Specified by:
ensureVersioningEnabledin interfaceVersionService- Parameters:
nodeRef- the node referenceversionProperties- the version properties to apply if versioning isn't currently enabled for the node
-
registerVersionLabelPolicy
public void registerVersionLabelPolicy(QName typeQName, VersionServicePolicies.CalculateVersionLabelPolicy policy) Description copied from interface:VersionServiceRegister a version label policy- Specified by:
registerVersionLabelPolicyin interfaceVersionService- Parameters:
typeQName- the QName of the type to registerpolicy- the policy to register for the specified type
-