mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Update to web repository web service to add association filter. Module management tool can now install AMP from a given directory.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5018 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -32,6 +32,7 @@ import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
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.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -50,6 +51,7 @@ public class AssociatedQuerySession extends AbstractQuerySession
|
||||
.getLog(AssociatedQuerySession.class);
|
||||
|
||||
private Reference node;
|
||||
private Association association;
|
||||
|
||||
/**
|
||||
* Constructs a AssociatedQuerySession
|
||||
@@ -59,11 +61,12 @@ public class AssociatedQuerySession extends AbstractQuerySession
|
||||
* @param node
|
||||
* The node to retrieve the associations
|
||||
*/
|
||||
public AssociatedQuerySession(int batchSize, Reference node)
|
||||
public AssociatedQuerySession(int batchSize, Reference node, Association association)
|
||||
{
|
||||
super(batchSize);
|
||||
|
||||
this.node = node;
|
||||
this.association = association;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,10 +85,29 @@ public class AssociatedQuerySession extends AbstractQuerySession
|
||||
logger.debug("Before getNextResultsBatch: " + toString());
|
||||
|
||||
// create the node ref and get the children from the repository
|
||||
NodeRef nodeRef = Utils.convertToNodeRef(this.node, nodeService,
|
||||
searchService, namespaceService);
|
||||
List<AssociationRef> assocs = nodeService.getTargetAssocs(nodeRef,
|
||||
RegexQNamePattern.MATCH_ALL);
|
||||
NodeRef nodeRef = Utils.convertToNodeRef(this.node, nodeService, searchService, namespaceService);
|
||||
List<AssociationRef> assocs = null;
|
||||
if (association != null)
|
||||
{
|
||||
assocs = nodeService.getTargetAssocs(nodeRef, RegexQNamePattern.MATCH_ALL);
|
||||
}
|
||||
else
|
||||
{
|
||||
QNamePattern name = RegexQNamePattern.MATCH_ALL;
|
||||
String assocType = association.getAssociationType();
|
||||
if (assocType != null)
|
||||
{
|
||||
name = QName.createQName(assocType);
|
||||
}
|
||||
if ("source".equals(association.getDirection()) == true)
|
||||
{
|
||||
assocs = nodeService.getSourceAssocs(nodeRef, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
assocs = nodeService.getTargetAssocs(nodeRef, name);
|
||||
}
|
||||
}
|
||||
|
||||
int totalRows = assocs.size();
|
||||
int lastRow = calculateLastRowIndex(totalRows);
|
||||
|
@@ -345,7 +345,7 @@ public class RepositoryWebService extends AbstractWebService implements
|
||||
* @see org.alfresco.repo.webservice.repository.RepositoryServiceSoapPort#queryAssociated(org.alfresco.repo.webservice.types.Reference,
|
||||
* org.alfresco.repo.webservice.repository.Association[])
|
||||
*/
|
||||
public QueryResult queryAssociated(Reference node, Association[] association)
|
||||
public QueryResult queryAssociated(Reference node, Association association)
|
||||
throws RemoteException, RepositoryFault
|
||||
{
|
||||
UserTransaction tx = null;
|
||||
@@ -356,7 +356,7 @@ public class RepositoryWebService extends AbstractWebService implements
|
||||
tx.begin();
|
||||
|
||||
// setup a query session and get the first batch of results
|
||||
QuerySession querySession = new AssociatedQuerySession(Utils.getBatchSize(MessageContext.getCurrentContext()), node);
|
||||
QuerySession querySession = new AssociatedQuerySession(Utils.getBatchSize(MessageContext.getCurrentContext()), node, association);
|
||||
QueryResult queryResult = querySession
|
||||
.getNextResultsBatch(this.searchService, this.nodeService,
|
||||
this.namespaceService, this.dictionaryService);
|
||||
|
Reference in New Issue
Block a user