use of org.alfresco.repo.virtual.ref.Reference 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.virtual.ref.Reference 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.virtual.ref.Reference 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.virtual.ref.Reference 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;
}
use of org.alfresco.repo.virtual.ref.Reference in project alfresco-repository by Alfresco.
the class VirtualVersionServiceExtension method deleteVersionHistory.
@Override
public void deleteVersionHistory(NodeRef nodeRef) throws AspectMissingException {
VersionServiceTrait theTrait = getTrait();
Reference reference = Reference.fromNodeRef(nodeRef);
if (reference == null) {
theTrait.deleteVersionHistory(nodeRef);
} else {
NodeRef materialNode = smartStore.materialize(reference);
theTrait.deleteVersionHistory(materialNode);
}
}
Aggregations