Search in sources :

Example 1 with VersionServiceTrait

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

the class VirtualVersionServiceExtension method ensureVersioningEnabled.

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

Example 2 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, Version version) {
    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null) {
        theTrait.revert(nodeRef, version);
    } else {
        NodeRef materialNode = smartStore.materialize(reference);
        Version actualVersion = VirtualVersionServiceExtension.this.materializeVersionIfReference(version);
        theTrait.revert(materialNode, 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 3 with VersionServiceTrait

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

the class VirtualVersionServiceExtension method isVersioned.

@Override
public boolean isVersioned(NodeRef nodeRef) {
    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null) {
        return theTrait.isVersioned(nodeRef);
    } else {
        NodeRef materialNode = smartStore.materialize(reference);
        return theTrait.isVersioned(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 4 with VersionServiceTrait

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

the class VirtualVersionServiceExtension method deleteVersion.

@Override
public void deleteVersion(NodeRef nodeRef, Version version) {
    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null) {
        theTrait.deleteVersion(nodeRef, version);
    } else {
        NodeRef materialNode = smartStore.materialize(reference);
        Version actualVersion = materializeVersionIfReference(version);
        theTrait.deleteVersion(materialNode, 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 5 with VersionServiceTrait

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

the class VirtualVersionServiceExtension method getVersionHistory.

@Override
public VersionHistory getVersionHistory(NodeRef nodeRef) throws AspectMissingException {
    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null) {
        return theTrait.getVersionHistory(nodeRef);
    } else {
        NodeRef materialNode = smartStore.materialize(reference);
        VersionHistory actualVersionHistory = theTrait.getVersionHistory(materialNode);
        if (actualVersionHistory == null) {
            return null;
        } else {
            Reference versionedReference = Reference.fromNodeRef(nodeRef);
            return new VirtualVersionHistory(versionedReference, actualVersionHistory);
        }
    }
}
Also used : VersionServiceTrait(org.alfresco.repo.version.traitextender.VersionServiceTrait) NodeRef(org.alfresco.service.cmr.repository.NodeRef) Reference(org.alfresco.repo.virtual.ref.Reference) VersionHistory(org.alfresco.service.cmr.version.VersionHistory)

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