use of org.alfresco.repo.virtual.ref.Reference in project alfresco-repository by Alfresco.
the class VirtualCheckOutCheckInServiceExtension method virtualizeVersionIfNeeded.
private NodeRef virtualizeVersionIfNeeded(NodeRef originalNodeRef, NodeRef materialVersion) {
Reference reference = Reference.fromNodeRef(originalNodeRef);
if ((materialVersion != null) && (reference != null) && (Reference.fromNodeRef(materialVersion) == null)) {
Reference parentReference = reference.execute(new GetParentReferenceMethod());
Reference workingCopyReference = NodeProtocol.newReference(materialVersion, parentReference);
return workingCopyReference.toNodeRef(materialVersion.getStoreRef());
} else {
return materialVersion;
}
}
use of org.alfresco.repo.virtual.ref.Reference in project alfresco-repository by Alfresco.
the class VirtualFileFolderServiceExtension method search.
@Override
public List<FileInfo> search(NodeRef contextNodeRef, String namePattern, boolean fileSearch, boolean folderSearch, boolean includeSubFolders) {
if (namePattern == null || namePattern.equals("*")) {
if (canVirtualize(contextNodeRef)) {
Reference reference = smartStore.virtualize(contextNodeRef);
List<Reference> virtualNodes = Collections.emptyList();
if (!includeSubFolders) {
virtualNodes = smartStore.search(reference, namePattern, fileSearch, folderSearch, false);
}
List<FileInfo> searchResult = asFileInfos(virtualNodes, smartStore, environment);
if (mergeActualNode(reference)) {
List<FileInfo> actualSearch = getTrait().search(actualNodeFrom(reference), namePattern, fileSearch, folderSearch, includeSubFolders);
searchResult.addAll(actualSearch);
}
return searchResult;
}
}
return getTrait().search(contextNodeRef, namePattern, fileSearch, folderSearch, includeSubFolders);
}
use of org.alfresco.repo.virtual.ref.Reference in project alfresco-repository by Alfresco.
the class VirtualFileFolderServiceExtension method list.
@Override
public List<FileInfo> list(NodeRef contextNodeRef) {
if (canVirtualize(contextNodeRef)) {
Reference reference = smartStore.virtualize(contextNodeRef);
List<Reference> virtualNodes = smartStore.list(reference);
List<FileInfo> searchResult = asFileInfos(virtualNodes, smartStore, environment);
if (mergeActualNode(reference)) {
List<FileInfo> actualSearch = getTrait().list(actualNodeFrom(reference));
searchResult.addAll(actualSearch);
}
return searchResult;
} else {
return getTrait().list(contextNodeRef);
}
}
use of org.alfresco.repo.virtual.ref.Reference in project alfresco-repository by Alfresco.
the class VirtualPermissionServiceExtension method hasPermission.
public AccessStatus hasPermission(NodeRef nodeRef, PermissionReference perm) {
PermissionServiceTrait theTrait = getTrait();
Reference reference = Reference.fromNodeRef(nodeRef);
if (reference == null) {
return theTrait.hasPermission(nodeRef, perm);
} else {
AccessStatus virtualAccessStatus = smartStore.hasPermission(reference, perm);
if (!AccessStatus.UNDETERMINED.equals(virtualAccessStatus)) {
return virtualAccessStatus;
} else {
NodeRef nodeToAdhereTo = establishPermisisonAdherence(reference);
if (nodeToAdhereTo == null) {
return AccessStatus.UNDETERMINED;
} else {
return theTrait.hasPermission(nodeToAdhereTo, perm);
}
}
}
}
use of org.alfresco.repo.virtual.ref.Reference in project alfresco-repository by Alfresco.
the class VirtualPermissionServiceExtension method hasPermission.
public AccessStatus hasPermission(NodeRef nodeRef, String perm) {
PermissionServiceTrait theTrait = getTrait();
Reference reference = Reference.fromNodeRef(nodeRef);
if (reference == null) {
return theTrait.hasPermission(nodeRef, perm);
} else {
AccessStatus virtualAccessStatus = smartStore.hasPermission(reference, perm);
if (!AccessStatus.UNDETERMINED.equals(virtualAccessStatus)) {
return virtualAccessStatus;
} else {
NodeRef nodeToAdhereTo = establishPermisisonAdherence(reference);
if (nodeToAdhereTo == null) {
return AccessStatus.UNDETERMINED;
} else {
return theTrait.hasPermission(nodeToAdhereTo, perm);
}
}
}
}
Aggregations