use of org.alfresco.repo.node.db.traitextender.NodeServiceTrait in project alfresco-repository by Alfresco.
the class VirtualNodeServiceExtension method getParentAssocs.
@Override
public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern) {
NodeServiceTrait theTrait = getTrait();
Reference reference = Reference.fromNodeRef(nodeRef);
if (reference != null) {
Reference parent = reference.execute(new GetParentReferenceMethod());
if (parent == null) {
return theTrait.getParentAssocs(reference.execute(new GetActualNodeRefMethod(environment)), typeQNamePattern, qnamePattern);
} else {
if (typeQNamePattern.isMatch(ContentModel.ASSOC_CONTAINS)) {
Reference parentsParent = parent.execute(new GetParentReferenceMethod());
NodeRef parentNodeRef = parent.toNodeRef();
if (parentsParent == null) {
parentNodeRef = parent.execute(new GetActualNodeRefMethod(environment));
}
NodeRef referenceNodeRef = reference.toNodeRef();
Map<QName, Serializable> properties = smartStore.getProperties(reference);
Serializable name = properties.get(ContentModel.PROP_NAME);
QName assocChildName = QName.createQNameWithValidLocalName(VirtualContentModel.VIRTUAL_CONTENT_MODEL_1_0_URI, name.toString());
if (qnamePattern.isMatch(assocChildName)) {
ChildAssociationRef assoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parentNodeRef, assocChildName, referenceNodeRef);
return Arrays.asList(assoc);
} else {
return Collections.emptyList();
}
} else {
return Collections.emptyList();
}
}
} else {
return theTrait.getParentAssocs(nodeRef, typeQNamePattern, qnamePattern);
}
}
use of org.alfresco.repo.node.db.traitextender.NodeServiceTrait in project alfresco-repository by Alfresco.
the class VirtualNodeServiceExtension method getChildAssocs.
@Override
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef, Set<QName> childNodeTypeQNames) {
NodeServiceTrait theTrait = getTrait();
boolean canVirtualize = canVirtualizeAssocNodeRef(nodeRef);
if (canVirtualize) {
Reference reference = smartStore.virtualize(nodeRef);
List<ChildAssociationRef> virtualAssociations = smartStore.getChildAssocs(reference, childNodeTypeQNames);
List<ChildAssociationRef> associations = new LinkedList<>(virtualAssociations);
if (smartStore.canMaterialize(reference)) {
NodeRef materialReference = smartStore.materialize(reference);
List<ChildAssociationRef> actualAssociations = theTrait.getChildAssocs(materialReference, childNodeTypeQNames);
associations.addAll(actualAssociations);
}
return associations;
} else {
return theTrait.getChildAssocs(nodeRef, childNodeTypeQNames);
}
}
use of org.alfresco.repo.node.db.traitextender.NodeServiceTrait in project alfresco-repository by Alfresco.
the class VirtualNodeServiceExtension method getAspects.
@Override
public Set<QName> getAspects(NodeRef nodeRef) {
NodeServiceTrait theTrait = getTrait();
Reference reference = Reference.fromNodeRef(nodeRef);
if (reference != null) {
GetAspectsMethod method = new GetAspectsMethod(theTrait, environment);
return reference.execute(method);
} else {
return theTrait.getAspects(nodeRef);
}
}
use of org.alfresco.repo.node.db.traitextender.NodeServiceTrait in project alfresco-repository by Alfresco.
the class VirtualNodeServiceExtension method getChildAssocs.
@Override
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern, boolean preload) {
NodeServiceTrait theTrait = getTrait();
boolean canVirtualize = canVirtualizeAssocNodeRef(nodeRef);
if (canVirtualize) {
Reference reference = smartStore.virtualize(nodeRef);
List<ChildAssociationRef> virtualAssociations = smartStore.getChildAssocs(reference, typeQNamePattern, qnamePattern, Integer.MAX_VALUE, preload);
List<ChildAssociationRef> associations = new LinkedList<>(virtualAssociations);
if (smartStore.canMaterialize(reference)) {
NodeRef materialReference = smartStore.materialize(reference);
List<ChildAssociationRef> actualAssociations = theTrait.getChildAssocs(materialReference, typeQNamePattern, qnamePattern, preload);
associations.addAll(actualAssociations);
}
return associations;
} else {
return theTrait.getChildAssocs(nodeRef, typeQNamePattern, qnamePattern, preload);
}
}
use of org.alfresco.repo.node.db.traitextender.NodeServiceTrait in project alfresco-repository by Alfresco.
the class VirtualNodeServiceExtension method getChildAssocs.
@Override
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef) {
NodeServiceTrait theTrait = getTrait();
boolean canVirtualize = canVirtualizeAssocNodeRef(nodeRef);
if (canVirtualize) {
Reference reference = smartStore.virtualize(nodeRef);
List<ChildAssociationRef> virtualAssociations = smartStore.getChildAssocs(reference, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, Integer.MAX_VALUE, false);
List<ChildAssociationRef> associations = new LinkedList<>(virtualAssociations);
if (smartStore.canMaterialize(reference)) {
NodeRef materialReference = smartStore.materialize(reference);
List<ChildAssociationRef> actualAssociations = theTrait.getChildAssocs(materialReference, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, Integer.MAX_VALUE, false);
associations.addAll(actualAssociations);
}
return associations;
} else {
return theTrait.getChildAssocs(nodeRef);
}
}
Aggregations