mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged API-STRIKES-BACK (5.2.0) to HEAD (5.2)
126200 jvonka: Node Associations - follow-on to r126104 to provide initial impl for both peer & child assocs - experimental -> pending detailed review & discussion (and tests) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127569 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -20,6 +20,7 @@ package org.alfresco.rest.api.nodes;
|
||||
|
||||
import org.activiti.engine.history.HistoricActivityInstance;
|
||||
import org.alfresco.repo.web.scripts.admin.NodeBrowserPost;
|
||||
import org.alfresco.rest.antlr.WhereClauseParser;
|
||||
import org.alfresco.rest.api.Nodes;
|
||||
import org.alfresco.rest.api.model.Assoc;
|
||||
import org.alfresco.rest.api.model.Comment;
|
||||
@@ -35,7 +36,10 @@ import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResou
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.rest.framework.resource.parameters.where.Query;
|
||||
import org.alfresco.rest.framework.resource.parameters.where.QueryHelper;
|
||||
import org.alfresco.rest.framework.webscripts.WithResponse;
|
||||
import org.alfresco.rest.workflow.api.impl.MapBasedQueryWalker;
|
||||
import org.alfresco.rest.workflow.api.model.Activity;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
@@ -45,6 +49,7 @@ import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.ResultSetRow;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.QNamePattern;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
@@ -63,33 +68,8 @@ import java.util.Map;
|
||||
* @author janv
|
||||
*/
|
||||
@RelationshipResource(name = "sources", entityResource = NodesEntityResource.class, title = "Node Sources")
|
||||
public class NodeSourcesRelation implements RelationshipResourceAction.Read<Node>, InitializingBean
|
||||
public class NodeSourcesRelation extends AbstractNodeRelation implements RelationshipResourceAction.Read<Node>
|
||||
{
|
||||
private ServiceRegistry sr;
|
||||
private NodeService nodeService;
|
||||
private NamespaceService namespaceService;
|
||||
private Nodes nodes;
|
||||
|
||||
public void setNodes(Nodes nodes)
|
||||
{
|
||||
this.nodes = nodes;
|
||||
}
|
||||
|
||||
public void setServiceRegistry(ServiceRegistry sr)
|
||||
{
|
||||
this.sr = sr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet()
|
||||
{
|
||||
PropertyCheck.mandatory(this, "serviceRegistry", sr);
|
||||
ParameterCheck.mandatory("nodes", this.nodes);
|
||||
|
||||
this.nodeService = sr.getNodeService();
|
||||
this.namespaceService = sr.getNamespaceService();
|
||||
}
|
||||
|
||||
/**
|
||||
* List sources
|
||||
*
|
||||
@@ -101,8 +81,9 @@ public class NodeSourcesRelation implements RelationshipResourceAction.Read<Node
|
||||
{
|
||||
NodeRef targetNodeRef = nodes.validateOrLookupNode(targetNodeId, null);
|
||||
|
||||
// TODO option to filter by assocType ... ?
|
||||
List<AssociationRef> assocRefs = nodeService.getSourceAssocs(targetNodeRef, RegexQNamePattern.MATCH_ALL);
|
||||
QNamePattern assocTypeQNameParam = getAssocTypeFromWhereElseAll(parameters);
|
||||
|
||||
List<AssociationRef> assocRefs = nodeService.getSourceAssocs(targetNodeRef, assocTypeQNameParam);
|
||||
|
||||
Map<QName, String> qnameMap = new HashMap<>(3);
|
||||
|
||||
|
Reference in New Issue
Block a user