|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.version.common.AbstractVersionServiceImpl
org.alfresco.repo.version.VersionServiceImpl
org.alfresco.repo.version.Version2ServiceImpl
public class Version2ServiceImpl
Version2 Service - implements version2Store (a lighter implementation of the lightWeightVersionStore)
Field Summary | |
---|---|
protected boolean |
useDeprecatedV1
|
Fields inherited from class org.alfresco.repo.version.VersionServiceImpl |
---|
dbNodeService, MSGID_ERR_NO_BRANCHES, MSGID_ERR_NOT_FOUND, MSGID_ERR_ONE_PRECEEDING, MSGID_ERR_RESTORE_EXISTS, MSGID_ERR_RESTORE_NO_VERSION, MSGID_ERR_REVERT_MISMATCH, policyBehaviourFilter, searcher |
Fields inherited from class org.alfresco.repo.version.common.AbstractVersionServiceImpl |
---|
dictionaryService, nodeService, policyComponent |
Fields inherited from interface org.alfresco.service.cmr.version.VersionService |
---|
VERSION_STORE_PROTOCOL |
Fields inherited from interface org.alfresco.repo.version.VersionBaseModel |
---|
ASPECT_LOCALNAME_VERSION_STORE_ROOT, ASSOC_LOCALNAME_ROOT_VERSION, CHILD_VERSION_HISTORIES, CHILD_VERSIONED_ASSOCS, CHILD_VERSIONS, PROP_CREATED_DATE, PROP_CREATOR, PROP_DESCRIPTION, PROP_TRANSLATION_VERSIONS, PROP_VERSION_LABEL, PROP_VERSION_NUMBER, PROP_VERSIONED_NODE_ID, STORE_PROTOCOL, TYPE_VERSION_HISTORY, TYPE_VERSIONED_ASSOC |
Constructor Summary | |
---|---|
Version2ServiceImpl()
|
Method Summary | |
---|---|
protected VersionHistory |
buildVersionHistory(org.alfresco.service.cmr.repository.NodeRef versionHistoryRef,
org.alfresco.service.cmr.repository.NodeRef nodeRef)
Builds a version history object from the version history reference. |
protected org.alfresco.service.cmr.repository.NodeRef |
createNewVersion(org.alfresco.service.namespace.QName sourceTypeRef,
org.alfresco.service.cmr.repository.NodeRef versionHistoryRef,
java.util.Map standardVersionProperties,
java.util.Map versionProperties,
int versionNumber,
PolicyScope nodeDetails)
Creates a new version node, setting the properties both calculated and specified. |
java.util.Collection |
createVersion(java.util.Collection nodeRefs,
java.util.Map versionProperties)
Note: we can't control the order of the list, so if we have children and parents in the list and the parents get versioned before the children and the children are not already versioned then the parents child references will be pointing to the node ref, rather than the verison history. |
Version |
createVersion(org.alfresco.service.cmr.repository.NodeRef nodeRef,
java.util.Map versionProperties)
Creates a new version based on the referenced node. |
protected Version |
createVersion(org.alfresco.service.cmr.repository.NodeRef nodeRef,
java.util.Map origVersionProperties,
int versionNumber)
Creates a new version of the passed node assigning the version properties accordingly. |
protected org.alfresco.service.cmr.repository.NodeRef |
createVersionHistory(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Creates a new version history node, applying the root version aspect is required |
void |
deleteVersion(org.alfresco.service.cmr.repository.NodeRef nodeRef,
Version version)
Delete a specific version associated with a node reference. |
void |
deleteVersionHistory(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Delete the version history associated with a node reference. |
protected java.util.List |
getAllVersions(org.alfresco.service.cmr.repository.NodeRef versionHistoryRef)
Gets all versions in version history |
Version |
getCurrentVersion(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Gets the version object for the current version of the node reference passed. |
protected java.util.Map |
getStandardVersionProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef,
long nodeDbId,
java.util.Set nodeAspects,
int versionNumber,
java.lang.String versionLabel,
java.lang.String versionDescription)
Get a map containing the standard list of version properties populated. |
protected Version |
getVersion(org.alfresco.service.cmr.repository.NodeRef versionRef)
Constructs the a version object to contain the version information from the version node ref. |
VersionHistory |
getVersionHistory(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Gets the version history information for a node. |
protected org.alfresco.service.cmr.repository.NodeRef |
getVersionHistoryNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Gets a reference to the version history node for a given 'real' node. |
org.alfresco.service.cmr.repository.StoreRef |
getVersionStoreReference()
Gets the reference to the version store |
void |
initialise()
Initialise method |
org.alfresco.service.cmr.repository.NodeRef |
restore(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.cmr.repository.NodeRef parentNodeRef,
org.alfresco.service.namespace.QName assocTypeQName,
org.alfresco.service.namespace.QName assocQName)
By default a deep restore is performed. |
org.alfresco.service.cmr.repository.NodeRef |
restore(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.cmr.repository.NodeRef parentNodeRef,
org.alfresco.service.namespace.QName assocTypeQName,
org.alfresco.service.namespace.QName assocQName,
boolean deep)
Restores a node not currently present in the store, but that has a version history. |
void |
revert(org.alfresco.service.cmr.repository.NodeRef nodeRef)
The node reference will be reverted to the current version. |
void |
revert(org.alfresco.service.cmr.repository.NodeRef nodeRef,
boolean deep)
The node reference will be reverted to the current version. |
void |
revert(org.alfresco.service.cmr.repository.NodeRef nodeRef,
Version version)
A deep revert will take place by default. |
void |
revert(org.alfresco.service.cmr.repository.NodeRef nodeRef,
Version version,
boolean deep)
Revert the state of the node to the specified version. |
void |
setOnlyUseDeprecatedV1(boolean useDeprecatedV1)
|
void |
setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
|
void |
setVersionMigrator(VersionMigrator versionMigrator)
|
Methods inherited from class org.alfresco.repo.version.VersionServiceImpl |
---|
createVersion, defaultOnCreateVersion, ensureVersioningEnabled, getRootNode, getVersionMetaData, initialiseWithoutBind, registerVersionLabelPolicy, setDbNodeService, setPolicyBehaviourFilter, setSearcher |
Methods inherited from class org.alfresco.repo.version.common.AbstractVersionServiceImpl |
---|
invokeAfterCreateVersion, invokeBeforeCreateVersion, invokeCalculateVersionLabel, invokeOnCreateVersion, setDictionaryService, setNodeService, setPolicyComponent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.alfresco.service.cmr.version.VersionService |
---|
createVersion, ensureVersioningEnabled, registerVersionLabelPolicy |
Field Detail |
---|
protected boolean useDeprecatedV1
Constructor Detail |
---|
public Version2ServiceImpl()
Method Detail |
---|
public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
public void setVersionMigrator(VersionMigrator versionMigrator)
public void setOnlyUseDeprecatedV1(boolean useDeprecatedV1)
public void initialise()
initialise
in class VersionServiceImpl
public org.alfresco.service.cmr.repository.StoreRef getVersionStoreReference()
VersionServiceImpl
getVersionStoreReference
in interface VersionService
getVersionStoreReference
in class VersionServiceImpl
public Version createVersion(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map versionProperties) throws ReservedVersionNameException, AspectMissingException
VersionService
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.
createVersion
in interface VersionService
createVersion
in class VersionServiceImpl
nodeRef
- a node referenceversionProperties
- the version properties that are stored with the newly created
version, or null if there are no relevant properties
ReservedVersionNameException
- thrown if a reserved property name is used int he version properties
provided
AspectMissingException
- thrown if the version aspect is missingVersionCounterService#nextVersionNumber(StoreRef)
public java.util.Collection createVersion(java.util.Collection nodeRefs, java.util.Map versionProperties) throws ReservedVersionNameException, AspectMissingException
VersionServiceImpl
createVersion
in interface VersionService
createVersion
in class VersionServiceImpl
nodeRefs
- a list of node referencesversionProperties
- version property values
ReservedVersionNameException
- thrown if a reserved property name is used in the version properties
provided
AspectMissingException
- thrown if the version aspect is missingprotected Version createVersion(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map origVersionProperties, int versionNumber) throws ReservedVersionNameException
VersionServiceImpl
createVersion
in class VersionServiceImpl
nodeRef
- a node referenceversionNumber
- the version number
ReservedVersionNameException
- thrown if there is a name clash in the version propertiesprotected org.alfresco.service.cmr.repository.NodeRef createVersionHistory(org.alfresco.service.cmr.repository.NodeRef nodeRef)
nodeRef
- the node ref
public VersionHistory getVersionHistory(org.alfresco.service.cmr.repository.NodeRef nodeRef)
VersionService
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.
getVersionHistory
in interface VersionService
getVersionHistory
in class VersionServiceImpl
nodeRef
- a node reference
VersionService.getVersionHistory(NodeRef)
public Version getCurrentVersion(org.alfresco.service.cmr.repository.NodeRef nodeRef)
VersionService
Returns null if the node is not versionable or has not been versioned.
getCurrentVersion
in interface VersionService
getCurrentVersion
in class VersionServiceImpl
nodeRef
- the node reference
VersionService.getCurrentVersion(NodeRef)
protected java.util.Map getStandardVersionProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, long nodeDbId, java.util.Set nodeAspects, int versionNumber, java.lang.String versionLabel, java.lang.String versionDescription)
nodeRef
- the node reference
protected org.alfresco.service.cmr.repository.NodeRef createNewVersion(org.alfresco.service.namespace.QName sourceTypeRef, org.alfresco.service.cmr.repository.NodeRef versionHistoryRef, java.util.Map standardVersionProperties, java.util.Map versionProperties, int versionNumber, PolicyScope nodeDetails)
versionableNodeRef
- the reference to the node being versionedversionHistoryRef
- version history node referencepreceedingNodeRef
- the version node preceeding this in the version history
, null if noneversionProperties
- version propertiesversionNumber
- the version number
protected java.util.List getAllVersions(org.alfresco.service.cmr.repository.NodeRef versionHistoryRef)
versionHistoryRef
- the version history nodeRef
protected VersionHistory buildVersionHistory(org.alfresco.service.cmr.repository.NodeRef versionHistoryRef, org.alfresco.service.cmr.repository.NodeRef nodeRef)
The node ref is passed to enable the version history to be scoped to the appropriate branch in the version history.
buildVersionHistory
in class VersionServiceImpl
versionHistoryRef
- the node ref for the version historynodeRef
- the node reference
protected Version getVersion(org.alfresco.service.cmr.repository.NodeRef versionRef)
getVersion
in class VersionServiceImpl
versionRef
- the version reference
protected org.alfresco.service.cmr.repository.NodeRef getVersionHistoryNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)
getVersionHistoryNodeRef
in class VersionServiceImpl
nodeRef
- a node reference
public void revert(org.alfresco.service.cmr.repository.NodeRef nodeRef)
VersionService
A deep revert will be performed.
revert
in interface VersionService
revert
in class VersionServiceImpl
nodeRef
- the node referenceorg.alfresco.cms.version.VersionService#revert(NodeRef)
public void revert(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean deep)
VersionService
revert
in interface VersionService
revert
in class VersionServiceImpl
nodeRef
- the node referencedeep
- true if a deep revert is to be performed, flase otherwiseVersionService.revert(org.alfresco.service.cmr.repository.NodeRef, boolean)
public void revert(org.alfresco.service.cmr.repository.NodeRef nodeRef, Version version)
VersionService
revert
in interface VersionService
revert
in class VersionServiceImpl
nodeRef
- the node referenceversion
- the version to revert toVersionService.revert(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.version.Version)
public void revert(org.alfresco.service.cmr.repository.NodeRef nodeRef, Version version, boolean deep)
VersionService
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.
revert
in interface VersionService
revert
in class VersionServiceImpl
nodeRef
- the node referenceversion
- the version to revert todeep
- true is a deep revert is to be performed, false otherwise.VersionService.revert(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.version.Version, boolean)
public org.alfresco.service.cmr.repository.NodeRef restore(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.cmr.repository.NodeRef parentNodeRef, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)
VersionService
restore
in interface VersionService
restore
in class VersionServiceImpl
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
VersionService.restore(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName)
public org.alfresco.service.cmr.repository.NodeRef restore(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.cmr.repository.NodeRef parentNodeRef, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, boolean deep)
VersionService
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.
restore
in interface VersionService
restore
in class VersionServiceImpl
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
VersionService.restore(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName, boolean)
public void deleteVersionHistory(org.alfresco.service.cmr.repository.NodeRef nodeRef) throws AspectMissingException
VersionService
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.
deleteVersionHistory
in interface VersionService
deleteVersionHistory
in class VersionServiceImpl
nodeRef
- the node reference
AspectMissingException
- thrown if the version aspect is missingorg.alfresco.cms.version.VersionService#deleteVersionHistory(NodeRef)
public void deleteVersion(org.alfresco.service.cmr.repository.NodeRef nodeRef, Version version)
VersionService
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.
deleteVersion
in interface VersionService
deleteVersion
in class VersionServiceImpl
nodeRef
- the node referenceversion
- the version to delete
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |