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) {
VersionServiceTrait theTrait = getTrait();
Reference reference = Reference.fromNodeRef(nodeRef);
if (reference == null) {
return theTrait.restore(nodeRef, parentNodeRef, assocTypeQName, assocQName);
} else {
NodeRef materialNode = smartStore.materialize(reference);
return theTrait.restore(materialNode, parentNodeRef, assocTypeQName, assocQName);
}
}
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, boolean deep) {
VersionServiceTrait theTrait = getTrait();
Reference reference = Reference.fromNodeRef(nodeRef);
if (reference == null) {
theTrait.revert(nodeRef, deep);
} else {
NodeRef materialNode = smartStore.materialize(reference);
theTrait.revert(materialNode, deep);
}
}
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, boolean deep) {
VersionServiceTrait theTrait = getTrait();
Reference reference = Reference.fromNodeRef(nodeRef);
if (reference == null) {
theTrait.revert(nodeRef, version, deep);
} else {
NodeRef materialNode = smartStore.materialize(reference);
Version actualVersion = VirtualVersionServiceExtension.this.materializeVersionIfReference(version);
theTrait.revert(materialNode, actualVersion, deep);
}
}
use of org.alfresco.repo.version.traitextender.VersionServiceTrait in project alfresco-repository by Alfresco.
the class VirtualVersionServiceExtension method isAVersion.
@Override
public boolean isAVersion(NodeRef nodeRef) {
VersionServiceTrait theTrait = getTrait();
Reference reference = Reference.fromNodeRef(nodeRef);
if (reference == null) {
return theTrait.isAVersion(nodeRef);
} else {
NodeRef materialNode = smartStore.materialize(reference);
return theTrait.isAVersion(materialNode);
}
}
use of org.alfresco.repo.version.traitextender.VersionServiceTrait in project alfresco-repository by Alfresco.
the class VirtualVersionServiceExtension method createVersion.
@Override
public Collection<Version> createVersion(Collection<NodeRef> nodeRefs, Map<String, Serializable> versionProperties) throws ReservedVersionNameException, AspectMissingException {
VersionServiceTrait theTrait = getTrait();
Collection<NodeRef> materialNodeRefs = new LinkedList<>();
Map<NodeRef, Reference> materializedNodeRefs = new HashMap<>();
for (NodeRef nodeRef : nodeRefs) {
Reference reference = Reference.fromNodeRef(nodeRef);
if (reference == null) {
materialNodeRefs.add(nodeRef);
} else {
NodeRef materialNode = smartStore.materializeIfPossible(nodeRef);
materialNodeRefs.add(materialNode);
materializedNodeRefs.put(materialNode, reference);
}
}
Collection<Version> versions = theTrait.createVersion(materialNodeRefs, versionProperties);
Collection<Version> virtualizedVersions = new LinkedList<>();
for (Version version : versions) {
NodeRef versionedNodeRef = version.getVersionedNodeRef();
Reference reference = materializedNodeRefs.get(versionedNodeRef);
if (reference != null) {
Version virtualizedVersion = virtualizeVersion(reference, version);
virtualizedVersions.add(virtualizedVersion);
} else {
virtualizedVersions.add(version);
}
}
return virtualizedVersions;
}
Aggregations