Class RecordableVersionServiceImpl

  • All Implemented Interfaces:
    RecordableVersionModel, RecordableVersionService, org.alfresco.repo.version.Version2Model, org.alfresco.repo.version.VersionBaseModel, org.alfresco.repo.version.VersionModel, org.alfresco.service.cmr.version.VersionService, org.alfresco.traitextender.Extensible

    public class RecordableVersionServiceImpl
    extends org.alfresco.repo.version.Version2ServiceImpl
    implements RecordableVersionModel, RecordableVersionService
    Recordable version service implementation
    Since:
    2.3
    Author:
    Roy Wetherall
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String KEY_FILE_PLAN  
      static String KEY_RECORDABLE_VERSION
      key used to indicate a recordable version
      protected static String PROP_RECORDED_VERSION_DESTROYED  
      protected static String PROP_VERSION_RECORD
      version record property
      • 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, versionComparatorDesc
      • Fields inherited from class org.alfresco.repo.version.common.AbstractVersionServiceImpl

        dictionaryService, nodeService, policyComponent
      • Fields inherited from interface org.alfresco.repo.version.Version2Model

        ASPECT_LOCALNAME_VERSION, ASPECT_VERSION, ASPECT_VERSION_STORE_ROOT, ASSOC_ROOT_VERSION, ASSOC_SUCCESSOR, CHILD_QNAME_VERSION_HISTORIES, CHILD_QNAME_VERSIONED_ASSOCS, CHILD_QNAME_VERSIONS, NAMESPACE_URI, PROP_ASSOC_DBID, PROP_FROZEN_ACCESSED, PROP_FROZEN_CREATED, PROP_FROZEN_CREATOR, PROP_FROZEN_MODIFIED, PROP_FROZEN_MODIFIER, PROP_FROZEN_NODE_DBID, PROP_FROZEN_NODE_REF, PROP_METADATA_PREFIX, PROP_QNAME_ASSOC_DBID, PROP_QNAME_FROZEN_ACCESSED, PROP_QNAME_FROZEN_CREATED, PROP_QNAME_FROZEN_CREATOR, PROP_QNAME_FROZEN_MODIFIED, PROP_QNAME_FROZEN_MODIFIER, PROP_QNAME_FROZEN_NODE_DBID, PROP_QNAME_FROZEN_NODE_REF, PROP_QNAME_TRANSLATION_VERSIONS, PROP_QNAME_VERSION_DESCRIPTION, PROP_QNAME_VERSION_LABEL, PROP_QNAME_VERSION_NUMBER, PROP_QNAME_VERSIONED_NODE_ID, PROP_VERSION_DESCRIPTION, PROP_VERSION_TYPE, STORE_ID, TYPE_QNAME_VERSION_HISTORY, TYPE_QNAME_VERSIONED_ASSOC
      • 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_DESCRIPTION, PROP_VERSION_LABEL, PROP_VERSION_NUMBER, PROP_VERSION_TYPE, PROP_VERSIONED_NODE_ID, STORE_PROTOCOL, TYPE_VERSION_HISTORY, TYPE_VERSIONED_ASSOC
      • Fields inherited from interface org.alfresco.repo.version.VersionModel

        ASPECT_VERSION_STORE_ROOT, ASSOC_ROOT_VERSION, ASSOC_SUCCESSOR, CHILD_QNAME_VERSION_HISTORIES, CHILD_QNAME_VERSION_META_DATA, CHILD_QNAME_VERSIONED_ASSOCS, CHILD_QNAME_VERSIONED_ATTRIBUTES, CHILD_QNAME_VERSIONED_CHILD_ASSOCS, CHILD_QNAME_VERSIONS, CHILD_VERSION_META_DATA, CHILD_VERSIONED_ATTRIBUTES, CHILD_VERSIONED_CHILD_ASSOCS, NAMESPACE_URI, PROP_ASSOC_QNAME, PROP_ASSOC_TYPE_QNAME, PROP_FROZEN_ASPECTS, PROP_FROZEN_NODE_ID, PROP_FROZEN_NODE_STORE_ID, PROP_FROZEN_NODE_STORE_PROTOCOL, PROP_FROZEN_NODE_TYPE, PROP_IS_MULTI_VALUE, PROP_IS_PRIMARY, PROP_META_DATA_NAME, PROP_META_DATA_VALUE, PROP_MULTI_VALUE, PROP_NTH_SIBLING, PROP_QNAME, PROP_QNAME_ASSOC_QNAME, PROP_QNAME_ASSOC_TYPE_QNAME, PROP_QNAME_FROZEN_ASPECTS, PROP_QNAME_FROZEN_NODE_ID, PROP_QNAME_FROZEN_NODE_STORE_ID, PROP_QNAME_FROZEN_NODE_STORE_PROTOCOL, PROP_QNAME_FROZEN_NODE_TYPE, PROP_QNAME_IS_MULTI_VALUE, PROP_QNAME_IS_PRIMARY, PROP_QNAME_META_DATA_NAME, PROP_QNAME_META_DATA_VALUE, PROP_QNAME_MULTI_VALUE, PROP_QNAME_NTH_SIBLING, PROP_QNAME_QNAME, PROP_QNAME_TRANSLATION_VERSIONS, PROP_QNAME_VALUE, PROP_QNAME_VERSION_LABEL, PROP_QNAME_VERSION_NUMBER, PROP_QNAME_VERSIONED_NODE_ID, PROP_VALUE, STORE_ID, TYPE_QNAME_VERSION, TYPE_QNAME_VERSION_HISTORY, TYPE_QNAME_VERSION_META_DATA_VALUE, TYPE_QNAME_VERSIONED_ASSOC, TYPE_QNAME_VERSIONED_CHILD_ASSOC, TYPE_QNAME_VERSIONED_PROPERTY, TYPE_VERSION, TYPE_VERSION_META_DATA_VALUE, TYPE_VERSIONED_CHILD_ASSOC, TYPE_VERSIONED_PROPERTY
      • Fields inherited from interface org.alfresco.service.cmr.version.VersionService

        VERSION_STORE_PROTOCOL
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.alfresco.service.cmr.repository.NodeRef convertNodeRef​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Convert the incomming node ref (with the version store protocol specified) to the internal representation with the workspace protocol.
      org.alfresco.service.cmr.repository.StoreRef convertStoreRef​(org.alfresco.service.cmr.repository.StoreRef storeRef)
      Create Version Store Ref
      protected org.alfresco.service.cmr.repository.NodeRef createNewRecordedVersion​(org.alfresco.service.namespace.QName sourceTypeRef, org.alfresco.service.cmr.repository.NodeRef versionHistoryRef, Map<org.alfresco.service.namespace.QName,​Serializable> standardVersionProperties, Map<String,​Serializable> versionProperties, int versionNumber, org.alfresco.repo.policy.PolicyScope nodeDetails)
      Creates a new recorded version
      protected org.alfresco.service.cmr.repository.NodeRef createNewVersion​(org.alfresco.service.namespace.QName sourceTypeRef, org.alfresco.service.cmr.repository.NodeRef versionHistoryRef, Map<org.alfresco.service.namespace.QName,​Serializable> standardVersionProperties, Map<String,​Serializable> versionProperties, int versionNumber, org.alfresco.repo.policy.PolicyScope nodeDetails)  
      org.alfresco.service.cmr.repository.NodeRef createRecordFromLatestVersion​(org.alfresco.service.cmr.repository.NodeRef filePlan, org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Creates a record from the latest frozen version, marking it as recorded.
      org.alfresco.service.cmr.repository.NodeRef createRecordFromLatestVersion​(org.alfresco.service.cmr.repository.NodeRef filePlan, org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean isEnableAutoVersionOnRecordCreation)
      Creates a record from the latest version, marking it as recorded.
      void createSnapshotVersion​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Create a snapshot version of current node
      protected org.alfresco.service.cmr.version.Version createVersion​(org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<String,​Serializable> origVersionProperties, int versionNumber)  
      void destroyRecordedVersion​(org.alfresco.service.cmr.version.Version version)
      Marks a recorded version as destroyed.
      org.alfresco.service.cmr.version.Version getRecordedVersion​(org.alfresco.service.cmr.repository.NodeRef versionRecord)
      Gets the version that relates to the version record
      protected org.alfresco.service.cmr.version.Version getVersion​(org.alfresco.service.cmr.repository.NodeRef versionRef)  
      org.alfresco.service.cmr.repository.NodeRef getVersionRecord​(org.alfresco.service.cmr.version.Version version)
      If the version is a recorded version, gets the related version record.
      boolean isCurrentVersionDirty​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Check if current version of the node is modified compared with versioned version
      boolean isCurrentVersionRecorded​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Indicates whether the current version of a node is recorded or not.
      boolean isEnableAutoVersionOnRecordCreation()
      Flag that indicate to create new version on record creation if current node is modified
      boolean isRecordedVersion​(org.alfresco.service.cmr.version.Version version)
      Indicates whether a version is recorded or not.
      boolean isRecordedVersionDestroyed​(org.alfresco.service.cmr.version.Version version)
      Indicates whether a record version is destroyed or not.
      void revert​(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.cmr.version.Version version, boolean deep)  
      void setAuthenticationUtil​(AuthenticationUtil authenticationUtil)  
      void setCmObjectType​(CmObjectType cmObjectType)  
      void setEnableAutoVersionOnRecordCreation​(boolean isEnableAutoVersionOnRecordCreation)  
      void setExtendedPermissionService​(ExtendedPermissionService extendedPermissionService)  
      void setExtendedSecurityService​(ExtendedSecurityService extendedSecurityService)  
      void setFilePlanService​(FilePlanService filePlanService)  
      void setModelSecurityService​(ModelSecurityService modelSecurityService)  
      void setRecordService​(RecordService recordService)  
      void setRelationshipService​(RelationshipService relationshipService)  
      • Methods inherited from class org.alfresco.repo.version.Version2ServiceImpl

        buildVersionHistory, createVersion, createVersion, createVersionHistory, deleteVersion, deleteVersionHistory, getAllVersions, getCurrentVersion, getStandardVersionProperties, getTrait, getVersionHistory, getVersionHistoryNodeRef, getVersionStoreReference, initialise, isAVersion, isVersioned, restore, restore, revert, revert, revert, setPermissionService
      • Methods inherited from class org.alfresco.repo.version.VersionServiceImpl

        createVersion, defaultOnCreateVersion, ensureVersioningEnabled, getRootNode, getVersionMetaData, registerVersionLabelPolicy, setDbNodeService, setPolicyBehaviourFilter, setSearcher, setVersionComparatorClass
      • Methods inherited from class org.alfresco.repo.version.common.AbstractVersionServiceImpl

        getRevertAspectAction, getRevertAssocAction, invokeAfterCreateVersion, invokeAfterVersionRevert, invokeBeforeCreateVersion, invokeCalculateVersionLabel, invokeOnCreateVersion, setDictionaryService, setNodeService, setPolicyComponent
      • Methods inherited from interface org.alfresco.service.cmr.version.VersionService

        createVersion, ensureVersioningEnabled, registerVersionLabelPolicy
    • Constructor Detail

      • RecordableVersionServiceImpl

        public RecordableVersionServiceImpl()
    • Method Detail

      • setFilePlanService

        public void setFilePlanService​(FilePlanService filePlanService)
        Parameters:
        filePlanService - file plan service
      • setAuthenticationUtil

        public void setAuthenticationUtil​(AuthenticationUtil authenticationUtil)
        Parameters:
        authenticationUtil - authentication util helper
      • setRelationshipService

        public void setRelationshipService​(RelationshipService relationshipService)
        Parameters:
        relationshipService - relationship service
      • setRecordService

        public void setRecordService​(RecordService recordService)
        Parameters:
        recordService - record service
      • setModelSecurityService

        public void setModelSecurityService​(ModelSecurityService modelSecurityService)
        Parameters:
        modelSecurityService - model security service
      • setCmObjectType

        public void setCmObjectType​(CmObjectType cmObjectType)
        Parameters:
        cmObjectType - the cmObjectType to set
      • setExtendedPermissionService

        public void setExtendedPermissionService​(ExtendedPermissionService extendedPermissionService)
        Parameters:
        extendedPermissionService - extended permission service
      • setExtendedSecurityService

        public void setExtendedSecurityService​(ExtendedSecurityService extendedSecurityService)
        Parameters:
        extendedSecurityService - extended security service
      • setEnableAutoVersionOnRecordCreation

        public void setEnableAutoVersionOnRecordCreation​(boolean isEnableAutoVersionOnRecordCreation)
        Parameters:
        isEnableAutoVersionOnRecordCreation -
      • isEnableAutoVersionOnRecordCreation

        public boolean isEnableAutoVersionOnRecordCreation()
        Description copied from interface: RecordableVersionService
        Flag that indicate to create new version on record creation if current node is modified
        Specified by:
        isEnableAutoVersionOnRecordCreation in interface RecordableVersionService
        Returns:
        boolean true to auto-version on record creation, false to use latest versioned version
      • createVersion

        protected org.alfresco.service.cmr.version.Version createVersion​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                                                         Map<String,​Serializable> origVersionProperties,
                                                                         int versionNumber)
                                                                  throws org.alfresco.service.cmr.version.ReservedVersionNameException
        Overrides:
        createVersion in class org.alfresco.repo.version.Version2ServiceImpl
        Throws:
        org.alfresco.service.cmr.version.ReservedVersionNameException
        See Also:
        Version2ServiceImpl.createVersion(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, int)
      • createNewVersion

        protected org.alfresco.service.cmr.repository.NodeRef createNewVersion​(org.alfresco.service.namespace.QName sourceTypeRef,
                                                                               org.alfresco.service.cmr.repository.NodeRef versionHistoryRef,
                                                                               Map<org.alfresco.service.namespace.QName,​Serializable> standardVersionProperties,
                                                                               Map<String,​Serializable> versionProperties,
                                                                               int versionNumber,
                                                                               org.alfresco.repo.policy.PolicyScope nodeDetails)
        Overrides:
        createNewVersion in class org.alfresco.repo.version.Version2ServiceImpl
        See Also:
        Version2ServiceImpl.createNewVersion(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map, int, org.alfresco.repo.policy.PolicyScope)
      • createNewRecordedVersion

        protected org.alfresco.service.cmr.repository.NodeRef createNewRecordedVersion​(org.alfresco.service.namespace.QName sourceTypeRef,
                                                                                       org.alfresco.service.cmr.repository.NodeRef versionHistoryRef,
                                                                                       Map<org.alfresco.service.namespace.QName,​Serializable> standardVersionProperties,
                                                                                       Map<String,​Serializable> versionProperties,
                                                                                       int versionNumber,
                                                                                       org.alfresco.repo.policy.PolicyScope nodeDetails)
        Creates a new recorded version
        Parameters:
        sourceTypeRef - source type name
        versionHistoryRef - version history reference
        standardVersionProperties - standard version properties
        versionProperties - version properties
        versionNumber - version number
        nodeDetails - policy scope
        Returns:
        NodeRef record version
      • getVersion

        protected org.alfresco.service.cmr.version.Version getVersion​(org.alfresco.service.cmr.repository.NodeRef versionRef)
        Overrides:
        getVersion in class org.alfresco.repo.version.Version2ServiceImpl
        See Also:
        Version2ServiceImpl.getVersion(org.alfresco.service.cmr.repository.NodeRef)
      • revert

        public void revert​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                           org.alfresco.service.cmr.version.Version version,
                           boolean deep)
        Specified by:
        revert in interface org.alfresco.service.cmr.version.VersionService
        Overrides:
        revert in class org.alfresco.repo.version.Version2ServiceImpl
        See Also:
        Version2ServiceImpl.revert(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.version.Version, boolean)
      • convertStoreRef

        public org.alfresco.service.cmr.repository.StoreRef convertStoreRef​(org.alfresco.service.cmr.repository.StoreRef storeRef)
        Create Version Store Ref
        Parameters:
        storeRef - store ref
        Returns:
        store ref for version store
      • convertNodeRef

        public org.alfresco.service.cmr.repository.NodeRef convertNodeRef​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Convert the incomming node ref (with the version store protocol specified) to the internal representation with the workspace protocol.
        Parameters:
        nodeRef - the incomming verison protocol node reference
        Returns:
        the internal version node reference
      • createRecordFromLatestVersion

        public org.alfresco.service.cmr.repository.NodeRef createRecordFromLatestVersion​(org.alfresco.service.cmr.repository.NodeRef filePlan,
                                                                                         org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                                                                         boolean isEnableAutoVersionOnRecordCreation)
        Description copied from interface: RecordableVersionService
        Creates a record from the latest version, marking it as recorded.

        Does not create a record if the node is not versionable or the latest version is already recorded.

        Specified by:
        createRecordFromLatestVersion in interface RecordableVersionService
        Parameters:
        filePlan - parent node reference
        nodeRef - node reference
        isEnableAutoVersionOnRecordCreation - true, create new record version from latest version, false creates a record from the latest frozen version
        Returns:
        NodeRef node reference to the created record.
        See Also:
        RecordableVersionService.createRecordFromLatestVersion(NodeRef, NodeRef, boolean autoVersion)
      • isCurrentVersionDirty

        public boolean isCurrentVersionDirty​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Check if current version of the node is modified compared with versioned version
        Parameters:
        nodeRef - internal node reference
        Returns:
        boolean true if nodeRef is modified, otherwise false