Search in sources :

Example 6 with VersionServiceTrait

use of org.alfresco.repo.version.traitextender.VersionServiceTrait in project alfresco-repository by Alfresco.

the class VirtualVersionServiceExtension method revert.

@Override
public void revert(NodeRef nodeRef) {
    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null) {
        theTrait.revert(nodeRef);
    } else {
        NodeRef materialNode = smartStore.materialize(reference);
        theTrait.revert(materialNode);
    }
}
Also used : VersionServiceTrait(org.alfresco.repo.version.traitextender.VersionServiceTrait) NodeRef(org.alfresco.service.cmr.repository.NodeRef) Reference(org.alfresco.repo.virtual.ref.Reference)

Example 7 with VersionServiceTrait

use of org.alfresco.repo.version.traitextender.VersionServiceTrait in project alfresco-repository by Alfresco.

the class VirtualVersionServiceExtension method createVersion.

@Override
public Collection<Version> createVersion(NodeRef nodeRef, Map<String, Serializable> versionProperties, boolean versionChildren) throws ReservedVersionNameException, AspectMissingException {
    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null) {
        return theTrait.createVersion(nodeRef, versionProperties, versionChildren);
    } else {
        NodeRef materialNode = smartStore.materializeIfPossible(nodeRef);
        Collection<Version> actualVersions = theTrait.createVersion(materialNode, versionProperties, versionChildren);
        return virtualizeVersions(reference, actualVersions);
    }
}
Also used : VersionServiceTrait(org.alfresco.repo.version.traitextender.VersionServiceTrait) NodeRef(org.alfresco.service.cmr.repository.NodeRef) Version(org.alfresco.service.cmr.version.Version) Reference(org.alfresco.repo.virtual.ref.Reference)

Example 8 with VersionServiceTrait

use of org.alfresco.repo.version.traitextender.VersionServiceTrait in project alfresco-repository by Alfresco.

the class VirtualVersionServiceExtension method restore.

@Override
public NodeRef restore(NodeRef nodeRef, NodeRef parentNodeRef, QName assocTypeQName, QName assocQName, boolean deep) {
    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null) {
        return theTrait.restore(nodeRef, parentNodeRef, assocTypeQName, assocQName, deep);
    } else {
        NodeRef materialNode = smartStore.materialize(reference);
        return theTrait.restore(materialNode, parentNodeRef, assocTypeQName, assocQName, deep);
    }
}
Also used : VersionServiceTrait(org.alfresco.repo.version.traitextender.VersionServiceTrait) NodeRef(org.alfresco.service.cmr.repository.NodeRef) Reference(org.alfresco.repo.virtual.ref.Reference)

Example 9 with VersionServiceTrait

use of org.alfresco.repo.version.traitextender.VersionServiceTrait in project alfresco-repository by Alfresco.

the class VirtualVersionServiceExtension method createVersion.

@Override
public Version createVersion(NodeRef nodeRef, Map<String, Serializable> versionProperties) throws ReservedVersionNameException, AspectMissingException {
    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null) {
        return theTrait.createVersion(nodeRef, versionProperties);
    } else {
        NodeRef materialNode = smartStore.materializeIfPossible(nodeRef);
        Version actualVersion = theTrait.createVersion(materialNode, versionProperties);
        return virtualizeVersion(reference, actualVersion);
    }
}
Also used : VersionServiceTrait(org.alfresco.repo.version.traitextender.VersionServiceTrait) NodeRef(org.alfresco.service.cmr.repository.NodeRef) Version(org.alfresco.service.cmr.version.Version) Reference(org.alfresco.repo.virtual.ref.Reference)

Example 10 with VersionServiceTrait

use of org.alfresco.repo.version.traitextender.VersionServiceTrait in project alfresco-repository by Alfresco.

the class VirtualVersionServiceExtension method getCurrentVersion.

@Override
public Version getCurrentVersion(NodeRef nodeRef) {
    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null) {
        return theTrait.getCurrentVersion(nodeRef);
    } else {
        NodeRef materialNode = smartStore.materialize(reference);
        Reference versionedReference = Reference.fromNodeRef(nodeRef);
        Version actualVersion = theTrait.getCurrentVersion(materialNode);
        return virtualizeVersion(versionedReference, actualVersion);
    }
}
Also used : VersionServiceTrait(org.alfresco.repo.version.traitextender.VersionServiceTrait) NodeRef(org.alfresco.service.cmr.repository.NodeRef) Version(org.alfresco.service.cmr.version.Version) Reference(org.alfresco.repo.virtual.ref.Reference)

Aggregations

VersionServiceTrait (org.alfresco.repo.version.traitextender.VersionServiceTrait)16 Reference (org.alfresco.repo.virtual.ref.Reference)16 NodeRef (org.alfresco.service.cmr.repository.NodeRef)16 Version (org.alfresco.service.cmr.version.Version)7 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 VersionHistory (org.alfresco.service.cmr.version.VersionHistory)1