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:
Roy Wetherall
2007-02-02 14:47:14 +00:00
parent 57839a8644
commit 7e64c93d6b
8 changed files with 40 additions and 111 deletions

View File

@@ -10,14 +10,14 @@ package org.alfresco.repo.webservice.repository;
public class Association implements java.io.Serializable { public class Association implements java.io.Serializable {
private java.lang.String associationType; private java.lang.String associationType;
private org.alfresco.repo.webservice.repository.AssociationDirectionEnum direction; private java.lang.String direction;
public Association() { public Association() {
} }
public Association( public Association(
java.lang.String associationType, java.lang.String associationType,
org.alfresco.repo.webservice.repository.AssociationDirectionEnum direction) { java.lang.String direction) {
this.associationType = associationType; this.associationType = associationType;
this.direction = direction; this.direction = direction;
} }
@@ -48,7 +48,7 @@ public class Association implements java.io.Serializable {
* *
* @return direction * @return direction
*/ */
public org.alfresco.repo.webservice.repository.AssociationDirectionEnum getDirection() { public java.lang.String getDirection() {
return direction; return direction;
} }
@@ -58,7 +58,7 @@ public class Association implements java.io.Serializable {
* *
* @param direction * @param direction
*/ */
public void setDirection(org.alfresco.repo.webservice.repository.AssociationDirectionEnum direction) { public void setDirection(java.lang.String direction) {
this.direction = direction; this.direction = direction;
} }
@@ -111,13 +111,13 @@ public class Association implements java.io.Serializable {
elemField.setFieldName("associationType"); elemField.setFieldName("associationType");
elemField.setXmlName(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/repository/1.0", "associationType")); elemField.setXmlName(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/repository/1.0", "associationType"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(false); elemField.setNillable(true);
typeDesc.addFieldDesc(elemField); typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc(); elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("direction"); elemField.setFieldName("direction");
elemField.setXmlName(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/repository/1.0", "direction")); elemField.setXmlName(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/repository/1.0", "direction"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/repository/1.0", "AssociationDirectionEnum")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(false); elemField.setNillable(true);
typeDesc.addFieldDesc(elemField); typeDesc.addFieldDesc(elemField);
} }

View File

@@ -1,70 +0,0 @@
/**
* AssociationDirectionEnum.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package org.alfresco.repo.webservice.repository;
public class AssociationDirectionEnum implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected AssociationDirectionEnum(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _source = "source";
public static final java.lang.String _target = "target";
public static final AssociationDirectionEnum source = new AssociationDirectionEnum(_source);
public static final AssociationDirectionEnum target = new AssociationDirectionEnum(_target);
public java.lang.String getValue() { return _value_;}
public static AssociationDirectionEnum fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
AssociationDirectionEnum enumeration = (AssociationDirectionEnum)
_table_.get(value);
if (enumeration==null) throw new java.lang.IllegalArgumentException();
return enumeration;
}
public static AssociationDirectionEnum fromString(java.lang.String value)
throws java.lang.IllegalArgumentException {
return fromValue(value);
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_;}
public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumSerializer(
_javaType, _xmlType);
}
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumDeserializer(
_javaType, _xmlType);
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(AssociationDirectionEnum.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/repository/1.0", "AssociationDirectionEnum"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
}

View File

@@ -39,7 +39,7 @@ public interface RepositoryServiceSoapPort extends java.rmi.Remote {
* Executes a query to retrieve associated resources of the specified * Executes a query to retrieve associated resources of the specified
* resource. * resource.
*/ */
public org.alfresco.repo.webservice.repository.QueryResult queryAssociated(org.alfresco.repo.webservice.types.Reference node, org.alfresco.repo.webservice.repository.Association[] association) throws java.rmi.RemoteException, org.alfresco.repo.webservice.repository.RepositoryFault; public org.alfresco.repo.webservice.repository.QueryResult queryAssociated(org.alfresco.repo.webservice.types.Reference node, org.alfresco.repo.webservice.repository.Association association) throws java.rmi.RemoteException, org.alfresco.repo.webservice.repository.RepositoryFault;
/** /**
* Fetches the next batch of query results. * Fetches the next batch of query results.

View File

@@ -201,14 +201,6 @@
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle="" encodingStyle=""
/> />
<typeMapping
xmlns:ns="http://www.alfresco.org/ws/service/repository/1.0"
qname="ns:AssociationDirectionEnum"
type="java:org.alfresco.repo.webservice.repository.AssociationDirectionEnum"
serializer="org.apache.axis.encoding.ser.EnumSerializerFactory"
deserializer="org.apache.axis.encoding.ser.EnumDeserializerFactory"
encodingStyle=""
/>
<typeMapping <typeMapping
xmlns:ns="http://www.alfresco.org/ws/model/content/1.0" xmlns:ns="http://www.alfresco.org/ws/model/content/1.0"
qname="ns:>ResultSetRow>node" qname="ns:>ResultSetRow>node"

View File

@@ -32,6 +32,7 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.QNamePattern;
import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.namespace.RegexQNamePattern;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -50,6 +51,7 @@ public class AssociatedQuerySession extends AbstractQuerySession
.getLog(AssociatedQuerySession.class); .getLog(AssociatedQuerySession.class);
private Reference node; private Reference node;
private Association association;
/** /**
* Constructs a AssociatedQuerySession * Constructs a AssociatedQuerySession
@@ -59,11 +61,12 @@ public class AssociatedQuerySession extends AbstractQuerySession
* @param node * @param node
* The node to retrieve the associations * The node to retrieve the associations
*/ */
public AssociatedQuerySession(int batchSize, Reference node) public AssociatedQuerySession(int batchSize, Reference node, Association association)
{ {
super(batchSize); super(batchSize);
this.node = node; this.node = node;
this.association = association;
} }
/** /**
@@ -82,10 +85,29 @@ public class AssociatedQuerySession extends AbstractQuerySession
logger.debug("Before getNextResultsBatch: " + toString()); logger.debug("Before getNextResultsBatch: " + toString());
// create the node ref and get the children from the repository // create the node ref and get the children from the repository
NodeRef nodeRef = Utils.convertToNodeRef(this.node, nodeService, NodeRef nodeRef = Utils.convertToNodeRef(this.node, nodeService, searchService, namespaceService);
searchService, namespaceService); List<AssociationRef> assocs = null;
List<AssociationRef> assocs = nodeService.getTargetAssocs(nodeRef, if (association != null)
RegexQNamePattern.MATCH_ALL); {
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 totalRows = assocs.size();
int lastRow = calculateLastRowIndex(totalRows); int lastRow = calculateLastRowIndex(totalRows);

View File

@@ -345,7 +345,7 @@ public class RepositoryWebService extends AbstractWebService implements
* @see org.alfresco.repo.webservice.repository.RepositoryServiceSoapPort#queryAssociated(org.alfresco.repo.webservice.types.Reference, * @see org.alfresco.repo.webservice.repository.RepositoryServiceSoapPort#queryAssociated(org.alfresco.repo.webservice.types.Reference,
* org.alfresco.repo.webservice.repository.Association[]) * org.alfresco.repo.webservice.repository.Association[])
*/ */
public QueryResult queryAssociated(Reference node, Association[] association) public QueryResult queryAssociated(Reference node, Association association)
throws RemoteException, RepositoryFault throws RemoteException, RepositoryFault
{ {
UserTransaction tx = null; UserTransaction tx = null;
@@ -356,7 +356,7 @@ public class RepositoryWebService extends AbstractWebService implements
tx.begin(); tx.begin();
// setup a query session and get the first batch of results // 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 QueryResult queryResult = querySession
.getNextResultsBatch(this.searchService, this.nodeService, .getNextResultsBatch(this.searchService, this.nodeService,
this.namespaceService, this.dictionaryService); this.namespaceService, this.dictionaryService);

View File

@@ -613,14 +613,6 @@
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle="" encodingStyle=""
/> />
<typeMapping
xmlns:ns="http://www.alfresco.org/ws/service/repository/1.0"
qname="ns:AssociationDirectionEnum"
type="java:org.alfresco.repo.webservice.repository.AssociationDirectionEnum"
serializer="org.apache.axis.encoding.ser.EnumSerializerFactory"
deserializer="org.apache.axis.encoding.ser.EnumDeserializerFactory"
encodingStyle=""
/>
<typeMapping <typeMapping
xmlns:ns="http://www.alfresco.org/ws/model/content/1.0" xmlns:ns="http://www.alfresco.org/ws/model/content/1.0"
qname="ns:>ResultSetRow>node" qname="ns:>ResultSetRow>node"

View File

@@ -105,7 +105,7 @@
<complexType> <complexType>
<sequence> <sequence>
<element name="node" type="cms:Reference"/> <element name="node" type="cms:Reference"/>
<element name="association" type="rep:Association" maxOccurs="unbounded" minOccurs="0"/> <element name="association" type="rep:Association" nillable="true"/>
</sequence> </sequence>
</complexType> </complexType>
</element> </element>
@@ -203,19 +203,12 @@
<complexType name="Association"> <complexType name="Association">
<sequence> <sequence>
<element name="associationType" type="cms:Name"/> <element name="associationType" type="cms:Name" nillable="true"/>
<element name="direction" type="rep:AssociationDirectionEnum"/> <element name="direction" type="xsd:string" nillable="true"/>
</sequence> </sequence>
</complexType> </complexType>
<element name="Association" type="rep:Association"/> <element name="Association" type="rep:Association"/>
<xsd:simpleType name="AssociationDirectionEnum">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="source"/>
<xsd:enumeration value="target"/>
</xsd:restriction>
</xsd:simpleType>
<complexType name="RepositoryFault"> <complexType name="RepositoryFault">
<sequence> <sequence>
<element name="errorCode" type="xsd:int"/> <element name="errorCode" type="xsd:int"/>