]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-3332, CSPACE-3784, CSPACE-4257 Updated Vocabulary and Authority classes to...
authorPatrick Schmitz <pschmitz@berkeley.edu>
Wed, 27 Jul 2011 20:25:28 +0000 (20:25 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Wed, 27 Jul 2011 20:25:28 +0000 (20:25 +0000)
55 files changed:
services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/res/GetVocabularyItems.res.xml
services/authority/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/authority/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java
services/authority/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
services/client/src/main/java/org/collectionspace/services/client/AuthorityClient.java
services/client/src/main/java/org/collectionspace/services/client/AuthorityClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/AuthorityProxy.java
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java
services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsClient.java
services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsClientImpl.java
services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsProxy.java
services/contact/service/src/main/java/org/collectionspace/services/contact/AuthorityResourceWithContacts.java
services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityClient.java
services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityProxy.java
services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java
services/location/jaxb/src/main/resources/location_common.xsd
services/location/jaxb/src/main/resources/locationauthority_common.xsd
services/location/service/src/main/java/org/collectionspace/services/location/LocationAuthorityResource.java
services/location/service/src/main/java/org/collectionspace/services/location/nuxeo/LocationAuthorityDocumentModelHandler.java
services/location/service/src/main/java/org/collectionspace/services/location/nuxeo/LocationDocumentModelHandler.java
services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java
services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java
services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java
services/organization/jaxb/src/main/resources/organization_common.xsd
services/organization/jaxb/src/main/resources/orgauthority_common.xsd
services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java
services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrgAuthorityDocumentModelHandler.java
services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java
services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java
services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthoritySearchTest.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServicePerfTest.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java
services/person/jaxb/src/main/resources/person_common.xsd
services/person/jaxb/src/main/resources/personauthority_common.xsd
services/person/service/src/main/java/org/collectionspace/services/person/PersonAuthorityResource.java
services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonAuthorityDocumentModelHandler.java
services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java
services/taxonomy/client/src/main/java/org/collectionspace/services/client/TaxonomyAuthorityClient.java
services/taxonomy/client/src/main/java/org/collectionspace/services/client/TaxonomyAuthorityProxy.java
services/taxonomy/client/src/test/java/org/collectionspace/services/client/test/TaxonomyAuthorityServiceTest.java
services/taxonomy/jaxb/src/main/resources/taxon_common.xsd
services/taxonomy/jaxb/src/main/resources/taxonomyauthority_common.xsd
services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/TaxonomyAuthorityResource.java
services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonDocumentModelHandler.java
services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonomyAuthorityDocumentModelHandler.java
services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java
services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java
services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java
services/vocabulary/jaxb/src/main/resources/vocabulary_common.xsd
services/vocabulary/jaxb/src/main/resources/vocabularyitem_common.xsd
services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java
services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyDocumentModelHandler.java
services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyItemDocumentModelHandler.java

index f8c787427fc7e4a4bb6d4dc8914f61563bd92f2c..fe7ab95e3546040bfea8694f393ea904963fbaae 100644 (file)
@@ -1,4 +1,4 @@
-<ns3:vocabularyitems-common-list xmlns:ns3="http://collectionspace.org/services/vocabulary" xmlns:ns2="http://collectionspace.org/services/jaxb">
+<ns3:abstract-common-list xmlns:ns3="http://collectionspace.org/services/vocabulary" xmlns:ns2="http://collectionspace.org/services/jaxb">
     <!-- This test result is dependent on test group vocabulary/vocabulary.xml::TestOrder
          and the vars defined there.  
          Do not use this expected result with any other tests.
@@ -6,26 +6,26 @@
        <pageNum>0</pageNum>
     <itemsInPage>3</itemsInPage>
     <totalItems>3</totalItems>
-    <fieldsReturned>displayName|refName|shortIdentifier|order|uri|csid</fieldsReturned>
-    <vocabularyitem_list_item>
+    <fieldsReturned>csid|uri|updatedAt|displayName|shortIdentifier|refName|order</fieldsReturned>
+    <list-item>
         <displayName>${Item3DupeOrder.displayName}</displayName>
         <shortIdentifier>${Item3DupeOrder.itemID}</shortIdentifier>
         <order>${Item3DupeOrder.order}</order>
         <uri>/vocabularies/${Vocabulary1.CSID}/items/${Item3DupeOrder.CSID}</uri>
         <csid>${Item3DupeOrder.CSID}</csid>
-    </vocabularyitem_list_item>
-    <vocabularyitem_list_item>
+    </list-item>
+    <list-item>
         <displayName>${Item2.displayName}</displayName>
         <shortIdentifier>${Item2.itemID}</shortIdentifier>
         <order>${Item2.order}</order>
         <uri>/vocabularies/${Vocabulary1.CSID}/items/${Item2.CSID}</uri>
         <csid>${Item2.CSID}</csid>
-    </vocabularyitem_list_item>
-    <vocabularyitem_list_item>
+    </list-item>
+    <list-item>
         <displayName>${Item1.displayName}</displayName>
         <shortIdentifier>${Item1.itemID}</shortIdentifier>
         <order>${Item1.order}</order>
         <uri>/vocabularies/${Vocabulary1.CSID}/items/${Item1.CSID}</uri>
         <csid>${Item1.CSID}</csid>
-    </vocabularyitem_list_item>
-</ns3:vocabularyitems-common-list>
+    </list-item>
+</ns3:abstract-common-list>
index f0a80c538256b8633beab68e94c6eb3b214c3478..d1e0b76d2362960a56c5ad5ad71e4d526e5728ff 100644 (file)
@@ -27,7 +27,6 @@ import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.workflow.WorkflowClient;
-import org.collectionspace.services.common.AbstractMultiPartCollectionSpaceResourceImpl;
 import org.collectionspace.services.common.ClientType;
 import org.collectionspace.services.common.ResourceBase;
 import org.collectionspace.services.common.ServiceMain;
@@ -49,12 +48,11 @@ import org.collectionspace.services.common.document.DocumentHandler;
 import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.query.QueryManager;
-import org.collectionspace.services.common.relation.IRelationsManager;
 import org.collectionspace.services.common.repository.RepositoryClient;
-import org.collectionspace.services.common.security.UnauthorizedException;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler;
 import org.collectionspace.services.common.workflow.service.nuxeo.WorkflowDocumentModelHandler;
+import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
 import org.collectionspace.services.relation.RelationResource;
 import org.collectionspace.services.relation.RelationsCommonList;
@@ -87,9 +85,8 @@ import java.util.List;
  */
 @Consumes("application/xml")
 @Produces("application/xml")
-public abstract class AuthorityResource<AuthCommon, AuthCommonList, AuthItemCommonList, AuthItemHandler>
+public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
         extends ResourceBase {
-        //extends AbstractMultiPartCollectionSpaceResourceImpl {
 
        protected Class<AuthCommon> authCommonClass;
        protected Class<?> resourceClass;
@@ -188,7 +185,7 @@ public abstract class AuthorityResource<AuthCommon, AuthCommonList, AuthItemComm
                        String inAuthority, String parentShortIdentifier)
        throws Exception {
                String authorityRefNameBase;
-               AuthorityItemDocumentModelHandler<?,?> docHandler;
+               AuthorityItemDocumentModelHandler<?> docHandler;
                
                if(parentShortIdentifier==null) {
                        authorityRefNameBase = null;
@@ -202,7 +199,7 @@ public abstract class AuthorityResource<AuthCommon, AuthCommonList, AuthItemComm
                        authorityRefNameBase = buildAuthorityRefNameBase(parentCtx, parentShortIdentifier);
                }
 
-               docHandler = (AuthorityItemDocumentModelHandler<?,?>)createDocumentHandler(ctx,
+               docHandler = (AuthorityItemDocumentModelHandler<?>)createDocumentHandler(ctx,
                                ctx.getCommonPartLabel(getItemServiceName()),
                                authCommonClass);       
                docHandler.setInAuthority(inAuthority);
@@ -217,8 +214,8 @@ public abstract class AuthorityResource<AuthCommon, AuthCommonList, AuthItemComm
         String shortIdentifier = null;
         try {
             DocumentWrapper<DocumentModel> wrapDoc = getRepositoryClient(ctx).getDocFromCsid(ctx, authCSID);
-            AuthorityDocumentModelHandler<?,?> handler = 
-               (AuthorityDocumentModelHandler<?,?>)createDocumentHandler(ctx);
+            AuthorityDocumentModelHandler<?> handler = 
+               (AuthorityDocumentModelHandler<?>)createDocumentHandler(ctx);
             shortIdentifier = handler.getShortIdentifier(wrapDoc, authorityCommonSchemaName);
         } catch (Exception e) {
             if (logger.isDebugEnabled()) {
@@ -370,7 +367,7 @@ public abstract class AuthorityResource<AuthCommon, AuthCommonList, AuthItemComm
         */
     @GET
     @Produces("application/xml")
-    public AuthCommonList getAuthorityList(@Context UriInfo ui) {
+    public AbstractCommonList getAuthorityList(@Context UriInfo ui) {
                try {
                        MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
                        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
@@ -381,7 +378,7 @@ public abstract class AuthorityResource<AuthCommon, AuthCommonList, AuthItemComm
                                myFilter.setWhereClause(authorityCommonSchemaName+":refName='" + nameQ + "'");
                        }
                        getRepositoryClient(ctx).getFiltered(ctx, handler);
-                       return (AuthCommonList) handler.getCommonPartList();
+                       return (AbstractCommonList) handler.getCommonPartList();
         } catch (Exception e) {
             throw bigReThrow(e, ServiceMessages.GET_FAILED);
                }
@@ -583,7 +580,7 @@ public abstract class AuthorityResource<AuthCommon, AuthCommonList, AuthItemComm
        @GET
        @Path("{csid}/items")
        @Produces("application/xml")
-       public AuthItemCommonList getAuthorityItemList(
+       public AbstractCommonList getAuthorityItemList(
                        @PathParam("csid") String specifier,
                        @QueryParam(IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
                        @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
@@ -620,7 +617,7 @@ public abstract class AuthorityResource<AuthCommon, AuthCommonList, AuthItemComm
                                                + myFilter.getWhereClause());
                        }
                        getRepositoryClient(ctx).getFiltered(ctx, handler);
-                       return (AuthItemCommonList) handler.getCommonPartList();
+                       return (AbstractCommonList) handler.getCommonPartList();
                } catch (Exception e) {
                        throw bigReThrow(e, ServiceMessages.LIST_FAILED);
                }
index fe26bbf72b4880bb34477da7eb4651c5f31156f8..f4b609d8c12f09dc2bb50d269eda4d50c9f62123 100644 (file)
@@ -25,21 +25,13 @@ package org.collectionspace.services.common.vocabulary.nuxeo;
 
 import java.util.Map;
 
-import javax.management.RuntimeErrorException;
-
-import org.collectionspace.services.client.PoxPayloadIn;
-import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.api.RefName;
 import org.collectionspace.services.common.context.MultipartServiceContext;
-import org.collectionspace.services.common.context.ServiceContext;
-import org.collectionspace.services.common.document.DocumentException;
-import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.service.ObjectPartType;
 import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
 
-import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 
@@ -49,80 +41,18 @@ import org.nuxeo.ecm.core.api.DocumentModel;
  * $LastChangedRevision: $
  * $LastChangedDate: $
  */
-public abstract class AuthorityDocumentModelHandler<AuthCommon, AuthCommonList>
-        extends RemoteDocumentModelHandlerImpl<AuthCommon, AuthCommonList> {
+public abstract class AuthorityDocumentModelHandler<AuthCommon>
+        extends DocHandlerBase<AuthCommon> {
 
        private String authorityCommonSchemaName;
        
-    /**
-     * authority is used to stash JAXB object to use when handle is called
-     * for Action.CREATE, Action.UPDATE or Action.GET
-     */
-    private AuthCommon authority;
-    /**
-     * authorityList is stashed when handle is called
-     * for ACTION.GET_ALL
-     */
-    private AuthCommonList authorityList;
-
-
     public AuthorityDocumentModelHandler(String authorityCommonSchemaName) {
        this.authorityCommonSchemaName = authorityCommonSchemaName;
     }
 
-    /**
-     * getCommonPart get associated authority
-     * @return
-     */
-    @Override
-    public AuthCommon getCommonPart() {
-        return authority;
-    }
-
-    /**
-     * setCommonPart set associated authority
-     * @param authority
-     */
-    @Override
-    public void setCommonPart(AuthCommon authority) {
-        this.authority = authority;
-    }
-
-    /**
-     * getCommonPartList get associated authority (for index/GET_ALL)
-     * @return
-     */
-    @Override
-    public AuthCommonList getCommonPartList() {
-        return authorityList;
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#setCommonPartList(java.lang.Object)
-     */
-    @Override
-    public void setCommonPartList(AuthCommonList authorityList) {
-        this.authorityList = authorityList;
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPart(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public AuthCommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
-            throws Exception {
-        throw new UnsupportedOperationException();
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#fillCommonPart(java.lang.Object, org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public void fillCommonPart(AuthCommon vocabularyObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-        throw new UnsupportedOperationException();
-    }
-
-    /* (non-Javadoc)
+    /*
+     * Non standard injection of CSID into common part, since caller may access through
+     * shortId, and not know the CSID.
      * @see org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl#extractPart(org.nuxeo.ecm.core.api.DocumentModel, java.lang.String, org.collectionspace.services.common.service.ObjectPartType)
      */
     @Override
index df55d4d913396ab54de82fd2d10ed4e5c8fa265b..0420d9242f4937a7173aef1afa3b042e5f0fb0e8 100644 (file)
@@ -41,6 +41,7 @@ import org.collectionspace.services.common.repository.RepositoryClient;
 import org.collectionspace.services.common.repository.RepositoryClientFactory;
 import org.collectionspace.services.common.service.ObjectPartType;
 import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
+import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.relation.RelationResource;
@@ -68,25 +69,13 @@ import java.util.regex.Pattern;
  * $LastChangedRevision: $
  * $LastChangedDate: $
  */
-public abstract class AuthorityItemDocumentModelHandler<AICommon, AICommonList>
-        extends RemoteDocumentModelHandlerImpl<AICommon, AICommonList> {
+public abstract class AuthorityItemDocumentModelHandler<AICommon>
+        extends DocHandlerBase<AICommon> {
 
     private final Logger logger = LoggerFactory.getLogger(AuthorityItemDocumentModelHandler.class);
 
        private String authorityItemCommonSchemaName;
        
-    //private final Logger logger = LoggerFactory.getLogger(AuthorityItemDocumentModelHandler.class);
-    /**
-     * item is used to stash JAXB object to use when handle is called
-     * for Action.CREATE, Action.UPDATE or Action.GET
-     */
-    protected AICommon item;
-    /**
-     * itemList is stashed when handle is called
-     * for ACTION.GET_ALL
-     */
-    protected AICommonList itemList;
-    
     /**
      * inVocabulary is the parent Authority for this context
      */
@@ -175,45 +164,6 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon, AICommonList>
     }
 
 
-    /**
-     * getCommonPart get associated item
-     * @return
-     */
-    @Override
-    public AICommon getCommonPart() {
-        return item;
-    }
-
-    @Override
-    public void setCommonPart(AICommon item) {
-        this.item = item;
-    }
-
-    /**
-     * getCommonPartList get associated item (for index/GET_ALL)
-     * @return
-     */
-    @Override
-    public AICommonList getCommonPartList() {
-        return itemList;
-    }
-
-    @Override
-    public void setCommonPartList(AICommonList itemList) {
-        this.itemList = itemList;
-    }
-
-    @Override
-    public AICommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
-            throws Exception {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void fillCommonPart(AICommon itemObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-        throw new UnsupportedOperationException();
-    }
-    
     /* (non-Javadoc)
      * @see org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl#extractPart(org.nuxeo.ecm.core.api.DocumentModel, java.lang.String, org.collectionspace.services.common.service.ObjectPartType)
      */
index 4fe239ced6b0affaf6e294a2be812d9c7defca61..486f2718cd366704d5fea244e49c51fb3e2a28c8 100644 (file)
@@ -12,8 +12,8 @@ import org.jboss.resteasy.client.ClientResponse;
  * ILT - Authority item list type\r
  * P - Proxy type\r
  */\r
-public interface AuthorityClient<LT extends AbstractCommonList, ILT extends AbstractCommonList, P extends AuthorityProxy<LT, ILT>\r
-       extends CollectionSpacePoxClient<LT, P> {\r
+public interface AuthorityClient<P extends AuthorityProxy\r
+       extends CollectionSpacePoxClient<AbstractCommonList, P> {\r
 \r
     /** The uri path element for items in an authority */\r
     public static String ITEMS = "items";    //used to construct uri's in service paths for authorities.\r
@@ -111,9 +111,9 @@ public interface AuthorityClient<LT extends AbstractCommonList, ILT extends Abst
      *     which will filter list results to return only matched resources.\r
      * @return the client response\r
      */\r
-    public ClientResponse<ILT> readItemList(String inAuthority, String partialTerm, String keywords);\r
+    public ClientResponse<AbstractCommonList> readItemList(String inAuthority, String partialTerm, String keywords);\r
     \r
-    public ClientResponse<ILT> readItemList(String inAuthority, String partialTerm, String keywords, Boolean includeDeleted);\r
+    public ClientResponse<AbstractCommonList> readItemList(String inAuthority, String partialTerm, String keywords, Boolean includeDeleted);\r
     \r
     /**\r
      * Read item list for named vocabulary, filtering by partial term match, or keywords. Only one of\r
@@ -127,10 +127,10 @@ public interface AuthorityClient<LT extends AbstractCommonList, ILT extends Abst
      *     which will filter list results to return only matched resources.\r
      * @return the client response\r
      */\r
-    public ClientResponse<ILT> readItemListForNamedAuthority(String specifier, \r
+    public ClientResponse<AbstractCommonList> readItemListForNamedAuthority(String specifier, \r
                String partialTerm, String keywords);\r
     \r
-    public ClientResponse<ILT> readItemListForNamedAuthority(String specifier, \r
+    public ClientResponse<AbstractCommonList> readItemListForNamedAuthority(String specifier, \r
                String partialTerm, \r
                String keywords,\r
                Boolean includeDeleted);\r
index 02a16d770258ba92de7b68525edc3ac222e253ed..f77bfbf3f844aaa511f6e014ecb9c134b5dd96fd 100644 (file)
@@ -8,13 +8,11 @@ import org.collectionspace.services.common.authorityref.AuthorityRefList;
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
 \r
 /*\r
- * LT - List type\r
- * ILT - Authority item list type\r
  * P - Proxy type\r
  */\r
-public abstract class AuthorityClientImpl<LT extends AbstractCommonList, ILT extends AbstractCommonList, P extends AuthorityProxy<LT, ILT>>\r
-       extends AbstractPoxServiceClientImpl<LT, P>\r
-       implements AuthorityClient<LT, ILT, P> {\r
+public abstract class AuthorityClientImpl<P extends AuthorityProxy>\r
+       extends AbstractCommonListPoxServiceClientImpl<P>\r
+       implements AuthorityClient<P> {\r
 \r
        private static final String INCLUDE_DELETE_TRUE = Boolean.TRUE.toString();\r
        /*\r
@@ -151,13 +149,13 @@ public abstract class AuthorityClientImpl<LT extends AbstractCommonList, ILT ext
      * @return the client response\r
      */\r
     @Override\r
-    public ClientResponse<ILT\r
+    public ClientResponse<AbstractCommonList\r
                readItemList(String inAuthority, String partialTerm, String keywords) {\r
         return getProxy().readItemList(inAuthority, partialTerm, keywords, INCLUDE_DELETE_TRUE);\r
     }\r
 \r
     @Override\r
-    public ClientResponse<ILT\r
+    public ClientResponse<AbstractCommonList\r
                readItemList(String inAuthority, String partialTerm, String keywords, Boolean includeDeleted) {\r
         return getProxy().readItemList(inAuthority, partialTerm, keywords, includeDeleted.toString());\r
     }\r
@@ -176,13 +174,13 @@ public abstract class AuthorityClientImpl<LT extends AbstractCommonList, ILT ext
      */\r
 \r
        @Override\r
-       public ClientResponse<ILT> readItemListForNamedAuthority(\r
+       public ClientResponse<AbstractCommonList> readItemListForNamedAuthority(\r
                        String specifier, String partialTerm, String keywords) {\r
         return getProxy().readItemListForNamedAuthority(specifier, partialTerm, keywords, INCLUDE_DELETE_TRUE);\r
        }\r
 \r
        @Override\r
-       public ClientResponse<ILT> readItemListForNamedAuthority(\r
+       public ClientResponse<AbstractCommonList> readItemListForNamedAuthority(\r
                        String specifier, \r
                        String partialTerm, \r
                        String keywords,\r
index d64d17d122b4087c2052dd35cb16d70a80ce2338..7ffc3fc5b19a3891a6e62c10a48cdcdfaf38e197 100644 (file)
@@ -21,7 +21,7 @@ import org.jboss.resteasy.client.ClientResponse;
  * ILT = Item list type\r
  * LT = List type\r
  */\r
-public interface AuthorityProxy<LT extends AbstractCommonList, ILT extends AbstractCommonList> extends CollectionSpacePoxProxy<LT> {\r
+public interface AuthorityProxy extends CollectionSpaceCommonListPoxProxy {\r
        \r
        /*\r
         * Basic CRUD operations\r
@@ -117,7 +117,7 @@ public interface AuthorityProxy<LT extends AbstractCommonList, ILT extends Abstr
     @GET\r
     @Produces({"application/xml"})\r
     @Path("/{csid}/items/")\r
-    ClientResponse<ILT> readItemList(\r
+    ClientResponse<AbstractCommonList> readItemList(\r
                @PathParam("csid") String vcsid,\r
             @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,\r
             @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,\r
@@ -127,7 +127,7 @@ public interface AuthorityProxy<LT extends AbstractCommonList, ILT extends Abstr
     @GET\r
     @Produces({"application/xml"})\r
     @Path("/urn:cspace:name({specifier})/items/")\r
-    ClientResponse<ILT> readItemListForNamedAuthority(\r
+    ClientResponse<AbstractCommonList> readItemListForNamedAuthority(\r
                @PathParam("specifier") String specifier,\r
             @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,\r
             @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,\r
index eb0fd96d9f91b35d5d0da8d0b54947537caaa66c..8cf60d6eef1c8056f9cff6ea3ce2707fea57ddfa 100644 (file)
               <service:element>shortIdentifier</service:element>
               <service:xpath>shortIdentifier</service:xpath>
             </service:ListResultField>
+            <service:ListResultField>
+              <service:element>refName</service:element>
+              <service:xpath>refName</service:xpath>
+            </service:ListResultField>
             <service:ListResultField>
               <service:element>order</service:element>
               <service:xpath>order</service:xpath>
               <service:element>shortIdentifier</service:element>
               <service:xpath>shortIdentifier</service:xpath>
             </service:ListResultField>
+            <service:ListResultField>
+              <service:element>refName</service:element>
+              <service:xpath>refName</service:xpath>
+            </service:ListResultField>
           </service:ListResultsFields>
         </service:params>
       </service:DocHandlerParams>
               <service:element>shortIdentifier</service:element>
               <service:xpath>shortIdentifier</service:xpath>
             </service:ListResultField>
+            <service:ListResultField>
+              <service:element>refName</service:element>
+              <service:xpath>refName</service:xpath>
+            </service:ListResultField>
           </service:ListResultsFields>
         </service:params>
       </service:DocHandlerParams>
               <service:element>shortIdentifier</service:element>
               <service:xpath>shortIdentifier</service:xpath>
             </service:ListResultField>
+            <service:ListResultField>
+              <service:element>refName</service:element>
+              <service:xpath>refName</service:xpath>
+            </service:ListResultField>
           </service:ListResultsFields>
         </service:params>
       </service:DocHandlerParams>
     </tenant:serviceBindings>
     <!-- end location service meta-data -->
     <!-- begin taxonomyauthority service meta-data -->
-    <tenant:serviceBindings id="Taxonomyauthorities" name="Taxonomyauthorities" version="0.1">
-      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/taxonomyauthorities/*/workflow/</service:uriPath>
-      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/taxonomyauthorities/*/items/*/workflow/</service:uriPath>
+    <tenant:serviceBindings id="Taxonomyauthority" name="Taxonomyauthority" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/taxonomyauthority/*/workflow/</service:uriPath>
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/taxonomyauthority/*/items/*/workflow/</service:uriPath>
       <!-- other URI paths using which this service could be accessed -->
       <!--            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
-                /taxonomyauthorities/*/items/
+                /taxonomyauthority/*/items/
             </service:uriPath>-->
       <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
       <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.taxonomy.nuxeo.TaxonomyAuthorityDocumentModelHandler</service:documentHandler>
               <service:element>shortIdentifier</service:element>
               <service:xpath>shortIdentifier</service:xpath>
             </service:ListResultField>
+            <service:ListResultField>
+              <service:element>refName</service:element>
+              <service:xpath>refName</service:xpath>
+            </service:ListResultField>
           </service:ListResultsFields>
         </service:params>
       </service:DocHandlerParams>
index cbafe1030023bb2ba46ac86a8c930f7c26ef8482..e8d9366f9f480bce6fbb7108342f1c2c48cabf16 100755 (executable)
@@ -186,7 +186,7 @@ public abstract class DocHandlerBase<T> extends RemoteDocumentModelHandlerImpl<T
             DocumentModel docModel = iter.next();\r
             String id = NuxeoUtils.getCsid(docModel);\r
             item.put(fields[0], id);\r
-            String uri = getServiceContextPath() + id;\r
+            String uri = getUri(docModel);\r
             item.put(fields[1], uri);\r
             GregorianCalendar cal = (GregorianCalendar)\r
                                                docModel.getProperty(COLLECTIONSPACE_CORE_SCHEMA,\r
index 7337bdd7d2b577bb8315ae0215ba185aeba87fee..5564f0723c92a5f5834db4efd228c31f4b95a36a 100644 (file)
@@ -11,8 +11,8 @@ import org.jboss.resteasy.client.ClientResponse;
  * ILT - Authority item list type\r
  * P - Proxy type\r
  */\r
-public interface AuthorityWithContactsClient<LT extends AbstractCommonList, ILT extends AbstractCommonList, P extends AuthorityProxy<LT, ILT>>\r
-       extends AuthorityClient<LT, ILT, P> {\r
+public interface AuthorityWithContactsClient<P extends AuthorityProxy>\r
+       extends AuthorityClient<P> {\r
     /**\r
      * Creates the contact.\r
      *\r
index b802db06a52b53495eca86553b67cb8356120c66..092ffb1d4f7dff02657486a7682a0d27235d0153 100644 (file)
@@ -11,9 +11,9 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
  * ILT - Authority item list type\r
  * P - Proxy type\r
  */\r
-public abstract class AuthorityWithContactsClientImpl<LT extends AbstractCommonList, ILT extends AbstractCommonList, P extends AuthorityWithContactsProxy<LT, ILT>>\r
-       extends AuthorityClientImpl<LT, ILT, P>\r
-       implements AuthorityWithContactsClient<LT, ILT, P> {\r
+public abstract class AuthorityWithContactsClientImpl<P extends AuthorityWithContactsProxy>\r
+       extends AuthorityClientImpl<P>\r
+       implements AuthorityWithContactsClient<P> {\r
        \r
        @Override\r
     public ClientResponse<Response> createContact(String parentcsid,\r
index 4ec77fb20bf1a1f2b200e5ff97f2b27c261b20b1..8b57e3ae93f88bf9036d971b94eb411a01932362 100644 (file)
@@ -10,14 +10,13 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.Response;\r
 \r
 import org.collectionspace.services.contact.ContactsCommonList;\r
-import org.collectionspace.services.jaxb.AbstractCommonList;\r
 import org.jboss.resteasy.client.ClientResponse;\r
 \r
 /*\r
  * ILT = Item list type\r
  * LT = List type\r
  */\r
-public interface AuthorityWithContactsProxy<LT extends AbstractCommonList, ILT extends AbstractCommonList> extends AuthorityProxy<LT, ILT> {\r
+public interface AuthorityWithContactsProxy extends AuthorityProxy {\r
     @GET\r
     @Produces({"application/xml"})\r
     @Path("/{parentcsid}/items/{itemcsid}/contacts/")\r
index 7b6813225fb04e0eb74949673e32de8a475d0380..949299df52df8fb5d49fa7c3ac4a31e3ade946af 100644 (file)
@@ -23,8 +23,6 @@
  */
 package org.collectionspace.services.contact;
 
-//import java.util.List;
-
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -33,7 +31,6 @@ import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-//import javax.ws.rs.QueryParam;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MultivaluedMap;
@@ -45,37 +42,15 @@ import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.vocabulary.AuthorityResource;
-//import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
-//import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
-//import org.collectionspace.services.common.vocabulary.AuthorityResource.Specifier;
-//import org.collectionspace.services.common.vocabulary.AuthorityResource.SpecifierForm;
-//import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler;
-//import org.collectionspace.services.common.AbstractMultiPartCollectionSpaceResourceImpl;
-//import org.collectionspace.services.common.ClientType;
-//import org.collectionspace.services.common.ServiceMain;
-//import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
-//import org.collectionspace.services.common.authorityref.AuthorityRefList;
-//import org.collectionspace.services.common.context.MultipartServiceContextImpl;
-//import org.collectionspace.services.common.context.ServiceBindingUtils;
 import org.collectionspace.services.common.context.ServiceContext;
-import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentHandler;
-import org.collectionspace.services.common.document.DocumentNotFoundException;
-//import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.contact.ContactResource;
 import org.collectionspace.services.contact.ContactsCommon;
 import org.collectionspace.services.contact.ContactsCommonList;
 import org.collectionspace.services.contact.ContactJAXBSchema;
 import org.collectionspace.services.contact.nuxeo.ContactDocumentModelHandler;
-//import org.collectionspace.services.common.repository.RepositoryClient;
-import org.collectionspace.services.common.security.UnauthorizedException;
-//import org.collectionspace.services.common.query.IQueryManager;
-//import org.collectionspace.services.common.query.QueryManager;
-//import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
-//import org.jboss.remoting.samples.chat.exceptions.InvalidArgumentException;
 import org.jboss.resteasy.util.HttpResponseCodes;
-//import org.nuxeo.ecm.core.api.DocumentModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -84,8 +59,8 @@ import org.slf4j.LoggerFactory;
  */
 @Consumes("application/xml")
 @Produces("application/xml")
-public abstract class AuthorityResourceWithContacts<AuthCommon, AuthCommonList, AuthItemCommonList, AuthItemHandler> extends //FIXME: REM - Why is this resource in this package instead of somewhere in 'common'?
-     AuthorityResource<AuthCommon, AuthCommonList, AuthItemCommonList, AuthItemHandler> {
+public abstract class AuthorityResourceWithContacts<AuthCommon, AuthItemHandler> extends //FIXME: REM - Why is this resource in this package instead of somewhere in 'common'?
+     AuthorityResource<AuthCommon, AuthItemHandler> {
 
     private ContactResource contactResource = new ContactResource(); // Warning: ContactResource is a singleton.
 
index ba26368707447682bfb994f0ffc1024d5396e5fa..c102107de32e05c44552a256044cbca403b83e04 100644 (file)
  */
 package org.collectionspace.services.client;
 
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.Response;
-
-//import org.collectionspace.services.common.authorityref.AuthorityRefList;
-import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
-import org.collectionspace.services.contact.ContactsCommonList;
-import org.collectionspace.services.location.LocationauthoritiesCommonList;
-import org.collectionspace.services.location.LocationsCommonList;
-import org.collectionspace.services.client.LocationAuthorityProxy;
-
-import org.jboss.resteasy.client.ClientResponse;
-import org.jboss.resteasy.client.ProxyFactory;
-import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
-import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
-import org.jboss.resteasy.spi.ResteasyProviderFactory;
-
 /**
  * The Class LocationAuthorityClient.
  */
-public class LocationAuthorityClient extends AuthorityClientImpl<LocationauthoritiesCommonList, LocationsCommonList, LocationAuthorityProxy> {
+public class LocationAuthorityClient extends AuthorityClientImpl<LocationAuthorityProxy> {
        public static final String SERVICE_NAME = "locationauthorities";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -82,16 +66,4 @@ public class LocationAuthorityClient extends AuthorityClientImpl<Locationauthori
        public Class<LocationAuthorityProxy> getProxyClass() {
                return LocationAuthorityProxy.class;
        }
-    
-    /*
-     * Proxied service calls.
-     */
-    
-    /**
-     * @return list
-     * @see org.collectionspace.services.client.LocationAuthorityProxy#readList()
-     */
-    public ClientResponse<LocationauthoritiesCommonList> readList() {
-        return getProxy().readList();
-    }
 }
index 81168dcb65f7e38d2db0a0ecaa6d8ed5aef80ff1..0eae00b76f7056e05e23ab3914b53eda717ea4bc 100644 (file)
@@ -1,16 +1,8 @@
 package org.collectionspace.services.client;
 
-import org.jboss.resteasy.client.ClientResponse;
 import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
 import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-
-import org.collectionspace.services.client.workflow.WorkflowClient;
-import org.collectionspace.services.location.LocationauthoritiesCommonList;
-import org.collectionspace.services.location.LocationsCommonList;
 
 /**
  * @version $Revision:$
@@ -20,48 +12,5 @@ import org.collectionspace.services.location.LocationsCommonList;
 @Path(LocationAuthorityClient.SERVICE_PATH + "/")
 @Produces("application/xml")
 @Consumes("application/xml")
-public interface LocationAuthorityProxy extends AuthorityProxy<LocationauthoritiesCommonList, LocationsCommonList> {
-
-    // List Locationauthorities
-    @GET
-    ClientResponse<LocationauthoritiesCommonList> readList();
-    
-    /*
-     * List results that must be overridden for the RESTEasy proxy generation to work correctly.
-     */
-    
-    // List Items matching a partial term or keywords.
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    @Path("/{csid}/items/")
-    ClientResponse<LocationsCommonList> readItemList(
-               @PathParam("csid") String vcsid,
-            @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
-            @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
-    
-    // List Items for a named authority matching a partial term or keywords.
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    @Path("/urn:cspace:name({specifier})/items/")
-    ClientResponse<LocationsCommonList> readItemListForNamedAuthority(
-               @PathParam("specifier") String specifier,
-            @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
-            @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
-    
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    ClientResponse<LocationauthoritiesCommonList> readIncludeDeleted(
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);    
-    @Override
-    @GET
-    @Produces({"application/xml"})
-    ClientResponse<LocationauthoritiesCommonList> keywordSearchIncludeDeleted(
-               @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);   
+public interface LocationAuthorityProxy extends AuthorityProxy {
 }
index aa9def8c696edae791c491e6e2a8bf892f9593e9..5083f02eb56509dda71b3dfb23890f216fc34b0b 100644 (file)
@@ -35,15 +35,14 @@ import org.collectionspace.services.client.ContactClientUtils;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.contact.ContactsCommon;
 import org.collectionspace.services.contact.ContactsCommonList;
 import org.collectionspace.services.client.LocationAuthorityClient;
 import org.collectionspace.services.client.LocationAuthorityClientUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.location.LocationauthoritiesCommon;
-import org.collectionspace.services.location.LocationauthoritiesCommonList;
 import org.collectionspace.services.location.LocationsCommon;
-import org.collectionspace.services.location.LocationsCommonList;
 
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -68,6 +67,8 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
     /** The logger. */
     private final String CLASS_NAME = LocationAuthorityServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(LocationAuthorityServiceTest.class);
+    private final String REFNAME = "refName";
+    private final String DISPLAYNAME = "displayName";
 
        @Override
        public String getServicePathComponent() {
@@ -145,15 +146,6 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
        return new LocationAuthorityClient();
     }
     
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-       protected AbstractCommonList getAbstractCommonList(
-                       ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(LocationsCommonList.class);
-    }
-
     @Override
     protected PoxPayloadOut createInstance(String identifier) {
        LocationAuthorityClient client = new LocationAuthorityClient();
@@ -769,9 +761,9 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
 
         // Submit the request to the service and store the response.
         LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<LocationauthoritiesCommonList> res = client.readList();
+        ClientResponse<AbstractCommonList> res = client.readList();
         try {
-               LocationauthoritiesCommonList list = res.getEntity();
+               AbstractCommonList list = res.getEntity();
                int statusCode = res.getStatus();
        
                // Check the status code of the response: does it match
@@ -784,22 +776,8 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
                Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
        
                // Optionally output additional data about list members for debugging.
-               boolean iterateThroughList = false;
-               if (iterateThroughList && logger.isDebugEnabled()) {
-                   List<LocationauthoritiesCommonList.LocationauthorityListItem> items =
-                           list.getLocationauthorityListItem();
-                   int i = 0;
-                   for (LocationauthoritiesCommonList.LocationauthorityListItem item : items) {
-                       String csid = item.getCsid();
-                       logger.debug(testName + ": list-item[" + i + "] csid=" +
-                               csid);
-                       logger.debug(testName + ": list-item[" + i + "] displayName=" +
-                               item.getDisplayName());
-                       logger.debug(testName + ": list-item[" + i + "] URI=" +
-                               item.getUri());
-                       readItemList(csid, null);
-                       i++;
-                   }
+               if(logger.isTraceEnabled()){
+                       AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
                }
            } finally {
                res.releaseConnection();
@@ -845,7 +823,7 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
         
         // Submit the request to the service and store the response.
         LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<LocationsCommonList> res = null;
+        ClientResponse<AbstractCommonList> res = null;
         if(vcsid!= null) {
                res = client.readItemList(vcsid, null, null);
         } else if(shortId!= null) {
@@ -854,7 +832,7 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
                Assert.fail("readItemList passed null csid and name!");
         }
         try {
-               LocationsCommonList list = res.getEntity();
+               AbstractCommonList list = res.getEntity();
                int statusCode = res.getStatus();
        
                // Check the status code of the response: does it match
@@ -866,8 +844,8 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
                        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
                Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
        
-               List<LocationsCommonList.LocationListItem> items =
-                   list.getLocationListItem();
+               List<AbstractCommonList.ListItem> items =
+                   list.getListItem();
                int nItemsReturned = items.size();
                // There will be one item created, associated with a
                // known parent resource, by the createItem test.
@@ -882,24 +860,17 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
                }
                Assert.assertEquals(nItemsReturned, nExpectedItems);
        
-               int i = 0;
-               for (LocationsCommonList.LocationListItem item : items) {
-                       Assert.assertTrue((null != item.getRefName()), "Item refName is null!");
-                       Assert.assertTrue((null != item.getDisplayName()), "Item displayName is null!");
-                       // Optionally output additional data about list members for debugging.
-                       boolean showDetails = true;
-                       if (showDetails && logger.isDebugEnabled()) {
-                       logger.debug("  " + testName + ": list-item[" + i + "] csid=" +
-                               item.getCsid());
-                       logger.debug("  " + testName + ": list-item[" + i + "] refName=" +
-                               item.getRefName());
-                       logger.debug("  " + testName + ": list-item[" + i + "] displayName=" +
-                               item.getDisplayName());
-                       logger.debug("  " + testName + ": list-item[" + i + "] URI=" +
-                               item.getUri());
-                   }
-                   i++;
-               }
+            for (AbstractCommonList.ListItem item : items) {
+               String value = 
+                       AbstractCommonListUtils.ListItemGetElementValue(item, REFNAME);
+                Assert.assertTrue((null != value), "Item refName is null!");
+               value = 
+                       AbstractCommonListUtils.ListItemGetElementValue(item, DISPLAYNAME);
+                Assert.assertTrue((null != value), "Item displayName is null!");
+            }
+            if(logger.isTraceEnabled()){
+               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
+            }
            } finally {
                res.releaseConnection();
            }
index 3131b71024375e6ddc4b6adbf2cd1e28eef26c0e..a6f77b668a62512579c0d80dc9aff428ef5dd060 100644 (file)
         </xs:sequence>
     </xs:complexType>
 
-    <!-- This is the base class for paginated lists -->
-    <xs:complexType name="abstractCommonListItem">
-        <xs:annotation>
-            <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
-            </xs:appinfo>
-        </xs:annotation>
-    </xs:complexType>
-    
-    <!-- Location instances, as in nuxeo repository -->
-    <xs:element name="locations-common-list">
-        <xs:complexType>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonListItem">                    
-                    <xs:sequence>
-                        <xs:element name="location_list_item" maxOccurs="unbounded">
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="displayName" type="xs:string"
-                                        minOccurs="1" />
-                                                                       <xs:element name="shortIdentifier" type="xs:string"
-                                        minOccurs="1" />
-                                    <!-- uri to retrieve location details -->
-                                    <xs:element name="uri" type="xs:anyURI"
-                                        minOccurs="1" />
-                                    <xs:element name="refName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="csid" type="xs:string"
-                                        minOccurs="1" />
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                    </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>
-        </xs:complexType>
-    </xs:element>
-    
 </xs:schema>
 
index 107df3e0cf898e07754822f4c407eacd359a55b2..13278e966315ec38f6c904be17015e21d7c7d836 100644 (file)
         </xs:complexType>
     </xs:element>
     
-    <!-- This is the base class for paginated lists -->
-    <xs:complexType name="abstractCommonList">
-        <xs:annotation>
-            <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
-            </xs:appinfo>
-        </xs:annotation>
-    </xs:complexType>
-    
-    
-    <!-- LocationAuthority instances, as in nuxeo repository -->
-    <xs:element name="locationauthorities-common-list">
-        <xs:complexType>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonList">                    
-                    <xs:sequence>
-                        <xs:element name="locationauthority-list-item" maxOccurs="unbounded">
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="displayName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="refName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="shortIdentifier" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="vocabType" type="xs:string"
-                                        minOccurs="1" />
-                                    <!-- uri to retrieve locationauthority details -->
-                                    <xs:element name="uri" type="xs:anyURI"
-                                        minOccurs="1" />
-                                    <xs:element name="csid" type="xs:string"
-                                        minOccurs="1" />
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                    </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>                    
-        </xs:complexType>
-    </xs:element>
-    
 </xs:schema>
 
index 4192899775f6f0ee3783cef7e0313af14a82037c..fe20ed786dc1cde2efa2c956b405845e68ef50ff 100644 (file)
@@ -37,8 +37,8 @@ import javax.ws.rs.Produces;
 @Consumes("application/xml")
 @Produces("application/xml")
 public class LocationAuthorityResource 
-       extends AuthorityResource<LocationauthoritiesCommon, LocationauthoritiesCommonList, 
-                                                       LocationsCommon, LocationDocumentModelHandler> {
+       extends AuthorityResource<LocationauthoritiesCommon, 
+                                                               LocationDocumentModelHandler> {
 
     private final static String locationAuthorityServiceName = "locationauthorities";
        private final static String LOCATIONAUTHORITIES_COMMON = "locationauthorities_common";
index 5caaf628dc1c8556da3310cdf793c20e4af5af45..62371f6abff8b7738bc95fdca6653132bf35bcfb 100644 (file)
  */
 package org.collectionspace.services.location.nuxeo;
 
-import java.util.Iterator;
-import java.util.List;
-
-import org.collectionspace.services.common.document.DocumentHandler.Action;
-import org.collectionspace.services.common.document.DocumentFilter;
-import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.location.LocationauthoritiesCommon;
-import org.collectionspace.services.location.LocationauthoritiesCommonList;
-import org.collectionspace.services.location.LocationauthoritiesCommonList.LocationauthorityListItem;
-
-import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * LocationAuthorityDocumentModelHandler
@@ -50,7 +33,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedDate: $
  */
 public class LocationAuthorityDocumentModelHandler
-        extends AuthorityDocumentModelHandler<LocationauthoritiesCommon, LocationauthoritiesCommonList> {
+        extends AuthorityDocumentModelHandler<LocationauthoritiesCommon> {
 
     /**
      * Common part schema label
@@ -61,38 +44,6 @@ public class LocationAuthorityDocumentModelHandler
        super(COMMON_PART_LABEL);
     }
        
-    @Override
-    public LocationauthoritiesCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-        LocationauthoritiesCommonList coList = extractPagingInfo(new LocationauthoritiesCommonList(),
-                       wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("displayName|refName|shortIdentifier|vocabType|uri|csid");
-
-        //FIXME: iterating over a long list of documents is not a long term
-        //strategy...need to change to more efficient iterating in future
-        List<LocationauthoritiesCommonList.LocationauthorityListItem> list = coList.getLocationauthorityListItem();
-        String label = getServiceContext().getCommonPartLabel();
-        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-        while(iter.hasNext()){
-            DocumentModel docModel = iter.next();
-            LocationauthorityListItem ilistItem = new LocationauthorityListItem();
-            ilistItem.setDisplayName((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.DISPLAY_NAME));
-            ilistItem.setRefName((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.REF_NAME));
-            ilistItem.setShortIdentifier((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.SHORT_IDENTIFIER));
-            ilistItem.setVocabType((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.VOCAB_TYPE));
-            String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-            ilistItem.setUri(getServiceContextPath() + id);
-            ilistItem.setCsid(id);
-            list.add(ilistItem);
-        }
-
-        return coList;
-    }
-
     /**
      * getQProperty converts the given property to qualified schema property
      * @param prop
index 93f7634ae15284df6ea328db483e169f215e7b1f..2f0c0326874e0d81ebc79c08086f9f46612644d4 100644 (file)
  */
 package org.collectionspace.services.location.nuxeo;
 
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
 import org.collectionspace.services.LocationJAXBSchema;
 import org.collectionspace.services.client.LocationAuthorityClient;
-import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.common.service.ObjectPartType;
-import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler;
-import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.location.LocationsCommon;
-import org.collectionspace.services.location.LocationsCommonList;
-import org.collectionspace.services.location.LocationsCommonList.LocationListItem;
 import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * LocationDocumentModelHandler
@@ -58,10 +41,8 @@ import org.slf4j.LoggerFactory;
  *
  */
 public class LocationDocumentModelHandler
-        extends AuthorityItemDocumentModelHandler<LocationsCommon, LocationsCommonList> {
+        extends AuthorityItemDocumentModelHandler<LocationsCommon> {
 
-    /** The logger. */
-    private final Logger logger = LoggerFactory.getLogger(LocationDocumentModelHandler.class);
     /**
      * Common part schema label
      */
@@ -145,38 +126,6 @@ public class LocationDocumentModelHandler
                        return newStr.toString();
     }
     
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-       public LocationsCommonList extractCommonPartList(
-                       DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-               LocationsCommonList coList = extractPagingInfo(new LocationsCommonList(), wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("displayName|refName|shortIdentifier|uri|csid");
-               List<LocationsCommonList.LocationListItem> list = coList.getLocationListItem();
-               Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-               String commonPartLabel = getServiceContext().getCommonPartLabel(
-                               "locations");
-               while (iter.hasNext()) {
-                       DocumentModel docModel = iter.next();
-                       LocationListItem ilistItem = new LocationListItem();
-                       ilistItem.setDisplayName((String) docModel.getProperty(
-                                       commonPartLabel, AuthorityItemJAXBSchema.DISPLAY_NAME));
-                       ilistItem.setShortIdentifier((String) docModel.getProperty(commonPartLabel,
-                                       AuthorityItemJAXBSchema.SHORT_IDENTIFIER));
-                       ilistItem.setRefName((String) docModel.getProperty(commonPartLabel,
-                                       AuthorityItemJAXBSchema.REF_NAME));
-                       String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-                       ilistItem.setUri("/locationauthorities/" + inAuthority + "/items/"
-                                       + id);
-                       ilistItem.setCsid(id);
-                       list.add(ilistItem);
-               }
-
-               return coList;
-       }
-
     /**
      * getQProperty converts the given property to qualified schema property
      * @param prop
index 8c086c694367bd215ef2ec65051b586e8125d08b..56b375bc318206e59f2cd88a674da7df2f5ce033 100644 (file)
  * https://source.collectionspace.org/collection-space/LICENSE.txt
  */
 package org.collectionspace.services.client;
-import org.jboss.resteasy.client.ClientResponse;
-
-import org.collectionspace.services.organization.OrgauthoritiesCommonList;
-import org.collectionspace.services.organization.OrganizationsCommonList;
 
 /**
  * The Class OrgAuthorityClient.
  */
-public class OrgAuthorityClient extends AuthorityWithContactsClientImpl<OrgauthoritiesCommonList, OrganizationsCommonList, OrgAuthorityProxy> {
+public class OrgAuthorityClient extends AuthorityWithContactsClientImpl<OrgAuthorityProxy> {
        public static final String SERVICE_NAME = "orgauthorities";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -70,17 +66,4 @@ public class OrgAuthorityClient extends AuthorityWithContactsClientImpl<Orgautho
     public String getItemCommonPartName() {
         return getCommonPartName(SERVICE_ITEM_NAME);
     }
-
-    /*
-     * Proxied service call methods
-     */
-    
-    /**
-     * Read list.
-     *
-     * @return the client response
-     */
-    public ClientResponse<OrgauthoritiesCommonList> readList() {
-        return getProxy().readList();
-    }
 }
index 43731b6d7817a2e3802e61d91218183804e37c7a..ddf9e901bf532e16ee5e6b4a1bcacad458a9bb05 100644 (file)
@@ -1,66 +1,13 @@
 package org.collectionspace.services.client;
 
 import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
 import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-
-import org.collectionspace.services.organization.OrgauthoritiesCommonList;
-import org.collectionspace.services.organization.OrganizationsCommonList;
-import org.collectionspace.services.client.workflow.WorkflowClient;
-
-import org.jboss.resteasy.client.ClientResponse;
-
 /**
  * @version $Revision$
  */
 @Path(OrgAuthorityClient.SERVICE_PATH + "/")
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public interface OrgAuthorityProxy extends AuthorityWithContactsProxy<OrgauthoritiesCommonList, OrganizationsCommonList> {
-    // List OrgAuthorities
-    @GET
-    ClientResponse<OrgauthoritiesCommonList> readList();
-       
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    ClientResponse<OrgauthoritiesCommonList> readIncludeDeleted(
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
-
-    @Override
-    @GET
-    @Produces({"application/xml"})
-    ClientResponse<OrgauthoritiesCommonList> keywordSearchIncludeDeleted(
-               @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
-            
-    
-    /*
-     * List results that must be overridden for the RESTEasy proxy generation to work correctly.
-     */
-    
-    // List Items matching a partial term or keywords.
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    @Path("/{csid}/items/")
-    ClientResponse<OrganizationsCommonList> readItemList(
-               @PathParam("csid") String vcsid,
-            @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
-            @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
-    
-    // List Items for a named authority matching a partial term or keywords.
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    @Path("/urn:cspace:name({specifier})/items/")
-    ClientResponse<OrganizationsCommonList> readItemListForNamedAuthority(
-               @PathParam("specifier") String specifier,
-            @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
-            @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
+public interface OrgAuthorityProxy extends AuthorityWithContactsProxy {
 }
index 346bb6425ad0d1c296cc1209d9c3857cebc4147e..dcb5a133681e44d9265a1d786e79a1baaf070511 100644 (file)
@@ -30,16 +30,14 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.OrganizationJAXBSchema;
-import org.collectionspace.services.PersonJAXBSchema;
 import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.ContactClient;
 import org.collectionspace.services.client.ContactClientUtils;
 import org.collectionspace.services.client.PayloadOutputPart;
-import org.collectionspace.services.client.PersonAuthorityClient;
-import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.contact.ContactsCommon;
 import org.collectionspace.services.contact.ContactsCommonList;
 import org.collectionspace.services.client.OrgAuthorityClient;
@@ -48,9 +46,7 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.organization.MainBodyGroup;
 import org.collectionspace.services.organization.MainBodyGroupList;
 import org.collectionspace.services.organization.OrgauthoritiesCommon;
-import org.collectionspace.services.organization.OrgauthoritiesCommonList;
 import org.collectionspace.services.organization.OrganizationsCommon;
-import org.collectionspace.services.organization.OrganizationsCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
 
@@ -72,6 +68,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
     /** The logger. */
     private final String CLASS_NAME = OrgAuthorityServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+    private final String REFNAME = "refName";
+    private final String DISPLAYNAME = "displayName";
 
        @Override
        public String getServicePathComponent() {
@@ -130,15 +128,6 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
        return new OrgAuthorityClient();
     }
     
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-       protected AbstractCommonList getAbstractCommonList(
-                       ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(OrganizationsCommonList.class);
-    }
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
@@ -1095,9 +1084,9 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
 
         // Submit the request to the service and store the response.
         OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<OrgauthoritiesCommonList> res = client.readList();
+        ClientResponse<AbstractCommonList> res = client.readList();
         try {
-               OrgauthoritiesCommonList list = res.getEntity();
+               AbstractCommonList list = res.getEntity();
                int statusCode = res.getStatus();
        
                // Check the status code of the response: does it match
@@ -1110,22 +1099,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
                Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
        
                // Optionally output additional data about list members for debugging.
-               boolean iterateThroughList = false;
-               if (iterateThroughList && logger.isDebugEnabled()) {
-                   List<OrgauthoritiesCommonList.OrgauthorityListItem> items =
-                           list.getOrgauthorityListItem();
-                   int i = 0;
-                   for (OrgauthoritiesCommonList.OrgauthorityListItem item : items) {
-                       String csid = item.getCsid();
-                       logger.debug(testName + ": list-item[" + i + "] csid=" +
-                               csid);
-                       logger.debug(testName + ": list-item[" + i + "] displayName=" +
-                               item.getDisplayName());
-                       logger.debug(testName + ": list-item[" + i + "] URI=" +
-                               item.getUri());
-                       readItemList(csid, null);
-                       i++;
-                   }
+               if(logger.isTraceEnabled()){
+                       AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
                }
            } finally {
                res.releaseConnection();
@@ -1166,7 +1141,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
 
         // Submit the request to the service and store the response.
         OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<OrganizationsCommonList> res = null;
+        ClientResponse<AbstractCommonList> res = null;
         if(vcsid!= null) {
                res = client.readItemList(vcsid, null, null);
         } else if(name!= null) {
@@ -1175,7 +1150,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
                Assert.fail("readItemList passed null csid and name!");
         }
         try {
-               OrganizationsCommonList list = res.getEntity();
+               AbstractCommonList list = res.getEntity();
                int statusCode = res.getStatus();
        
                // Check the status code of the response: does it match
@@ -1187,8 +1162,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
                        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
                Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
        
-               List<OrganizationsCommonList.OrganizationListItem> items =
-                   list.getOrganizationListItem();
+               List<AbstractCommonList.ListItem> items =
+                   list.getListItem();
                int nItemsReturned = items.size();
                // There will be one item created, associated with a
                // known parent resource, by the createItem test.
@@ -1203,24 +1178,17 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
                }
                Assert.assertEquals(nItemsReturned, nExpectedItems);
        
-               int i = 0;
-               for (OrganizationsCommonList.OrganizationListItem item : items) {
-                       Assert.assertTrue((null != item.getRefName()), "Item refName is null!");
-                       Assert.assertTrue((null != item.getDisplayName()), "Item displayName is null!");
-                       // Optionally output additional data about list members for debugging.
-                       boolean showDetails = true;
-                       if (showDetails && logger.isDebugEnabled()) {
-                       logger.debug("  " + testName + ": list-item[" + i + "] csid=" +
-                               item.getCsid());
-                       logger.debug("  " + testName + ": list-item[" + i + "] refName=" +
-                               item.getRefName());
-                       logger.debug("  " + testName + ": list-item[" + i + "] displayName=" +
-                               item.getDisplayName());
-                       logger.debug("  " + testName + ": list-item[" + i + "] URI=" +
-                               item.getUri());
-                   }
-                   i++;
-               }
+            for (AbstractCommonList.ListItem item : items) {
+               String value = 
+                       AbstractCommonListUtils.ListItemGetElementValue(item, REFNAME);
+                Assert.assertTrue((null != value), "Item refName is null!");
+               value = 
+                       AbstractCommonListUtils.ListItemGetElementValue(item, DISPLAYNAME);
+                Assert.assertTrue((null != value), "Item displayName is null!");
+            }
+            if(logger.isTraceEnabled()){
+               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
+            }
            } finally {
                res.releaseConnection();
            }
index 60d3784319ae01f469963f0a28c735d11c837a25..946afd0eb3307141b514741f1a8c242cd8a79ed2 100644 (file)
         </xs:sequence>
     </xs:complexType>
 
-    <!-- This is the base class for paginated lists -->
-    <xs:complexType name="abstractCommonListItem">
-        <xs:annotation>
-            <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
-            </xs:appinfo>
-        </xs:annotation>
-    </xs:complexType>
-
-    <!-- Organization instances, as in nuxeo repository -->
-    <xs:element name="organizations-common-list">
-        <xs:complexType>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonListItem">
-                    <xs:sequence>
-                        <xs:element name="organization_list_item" maxOccurs="unbounded">
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="displayName" type="xs:string"
-                                                minOccurs="1" />
-                                    <xs:element name="shortIdentifier" type="xs:string"
-                                                minOccurs="1" />
-                                    <!-- uri to retrieve organization details -->
-                                    <xs:element name="uri" type="xs:anyURI"
-                                                minOccurs="1" />
-                                    <xs:element name="refName" type="xs:string"
-                                                minOccurs="1" />
-                                    <xs:element name="csid" type="xs:string"
-                                                minOccurs="1" />
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                    </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>
-        </xs:complexType>
-    </xs:element>
-
 </xs:schema>
 
index edc7a21cc3584f416d61ecc2d59df223bb0a541c..5c7ff80705469d2584ca31d5e87b96ac031d66f3 100644 (file)
         </xs:complexType>
     </xs:element>
     
-    <!-- This is the base class for paginated lists -->
-    <xs:complexType name="abstractCommonList">
-        <xs:annotation>
-            <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
-            </xs:appinfo>
-        </xs:annotation>
-    </xs:complexType>
-    
-    <!-- OrgAuthority instances, as in nuxeo repository -->
-    <xs:element name="orgauthorities-common-list">
-        <xs:complexType>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonList">                    
-                    <xs:sequence>
-                        <xs:element name="orgauthority-list-item" maxOccurs="unbounded">
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="displayName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="refName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="shortIdentifier" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="vocabType" type="xs:string"
-                                        minOccurs="1" />
-                                    <!-- uri to retrieve orgauthority details -->
-                                    <xs:element name="uri" type="xs:anyURI"
-                                        minOccurs="1" />
-                                    <xs:element name="csid" type="xs:string"
-                                        minOccurs="1" />
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                    </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>
-        </xs:complexType>
-    </xs:element>
-    
 </xs:schema>
 
index 5376b615053213fe1faa637008b272cf7ad8714f..b1fe8c8fc64de433d6a83ca63c16bc5db9eb09db 100644 (file)
@@ -37,8 +37,7 @@ import javax.ws.rs.Produces;
 @Consumes("application/xml")
 @Produces("application/xml")
 public class OrgAuthorityResource extends
-       AuthorityResourceWithContacts<OrgauthoritiesCommon, OrgauthoritiesCommonList, OrganizationsCommon,
-       OrganizationDocumentModelHandler> {
+       AuthorityResourceWithContacts<OrgauthoritiesCommon, OrganizationDocumentModelHandler> {
 
     private final static String orgAuthorityServiceName = OrgAuthorityClient.SERVICE_NAME;
        private final static String ORGAUTHORITIES_COMMON = "orgauthorities_common";
index 849ccd916793ca2902fb1eb9a59e6e06d93cc442..42a878740753dde1cbb8a8bc626cc75815635f8b 100644 (file)
  */
 package org.collectionspace.services.organization.nuxeo;
 
-import java.util.Iterator;
-import java.util.List;
-
-import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
-import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.organization.OrgauthoritiesCommon;
-import org.collectionspace.services.organization.OrgauthoritiesCommonList;
-import org.collectionspace.services.organization.OrgauthoritiesCommonList.OrgauthorityListItem;
-
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
 
 /**
  * OrgAuthorityDocumentModelHandler
@@ -47,7 +33,7 @@ import org.nuxeo.ecm.core.api.DocumentModelList;
  * $LastChangedDate$
  */
 public class OrgAuthorityDocumentModelHandler
-        extends AuthorityDocumentModelHandler<OrgauthoritiesCommon, OrgauthoritiesCommonList> {
+        extends AuthorityDocumentModelHandler<OrgauthoritiesCommon> {
 
     /**
      * Common part schema label
@@ -58,37 +44,6 @@ public class OrgAuthorityDocumentModelHandler
        super(COMMON_PART_LABEL);
     }
        
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public OrgauthoritiesCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-        OrgauthoritiesCommonList coList = this.extractPagingInfo(new OrgauthoritiesCommonList(), wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("displayName|refName|shortIdentifier|vocabType|uri|csid");
-       List<OrgauthoritiesCommonList.OrgauthorityListItem> list = coList.getOrgauthorityListItem();
-       Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-        String label = getServiceContext().getCommonPartLabel();
-        while(iter.hasNext()){
-            DocumentModel docModel = iter.next();
-            OrgauthorityListItem ilistItem = new OrgauthorityListItem();
-            ilistItem.setDisplayName((String) docModel.getProperty(label,
-                    AuthorityJAXBSchema.DISPLAY_NAME));
-            ilistItem.setRefName((String) docModel.getProperty(label,
-                    AuthorityJAXBSchema.REF_NAME));
-            ilistItem.setShortIdentifier((String) docModel.getProperty(label,
-                    AuthorityJAXBSchema.SHORT_IDENTIFIER));
-            ilistItem.setVocabType((String) docModel.getProperty(label,
-                    AuthorityJAXBSchema.VOCAB_TYPE));
-            String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-            ilistItem.setUri(getServiceContextPath() + id);
-            ilistItem.setCsid(id);
-            list.add(ilistItem);
-        }
-
-        return coList;
-    }
-
     /**
      * getQProperty converts the given property to qualified schema property
      * @param prop
index fa42403fb28249c9954866a73f5c40715b70a710..e95ff1bc335c5704246848db524992bb3927bea8 100644 (file)
  */
 package org.collectionspace.services.organization.nuxeo;
 
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
 import org.collectionspace.services.client.OrgAuthorityClient;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler;
 import org.collectionspace.services.OrganizationJAXBSchema;
 import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.common.service.ObjectPartType;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.organization.OrganizationsCommon;
-import org.collectionspace.services.organization.OrganizationsCommonList;
-import org.collectionspace.services.organization.OrganizationsCommonList.OrganizationListItem;
 import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -49,7 +39,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedDate$
  */
 public class OrganizationDocumentModelHandler
-               extends AuthorityItemDocumentModelHandler<OrganizationsCommon, OrganizationsCommonList> {
+               extends AuthorityItemDocumentModelHandler<OrganizationsCommon> {
 
     /** The logger. */
     private final Logger logger = LoggerFactory.getLogger(OrganizationDocumentModelHandler.class);
@@ -152,36 +142,6 @@ public class OrganizationDocumentModelHandler
                return newStr.toString();
     }
     
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public OrganizationsCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) 
-               throws Exception {
-        OrganizationsCommonList coList = this.extractPagingInfo(new OrganizationsCommonList(), wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("displayName|refName|shortIdentifier|uri|csid");
-        List<OrganizationsCommonList.OrganizationListItem> list = coList.getOrganizationListItem();
-        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-        String commonPartLabel = getServiceContext().getCommonPartLabel("organizations");
-        while(iter.hasNext()){
-            DocumentModel docModel = iter.next();
-            OrganizationListItem ilistItem = new OrganizationListItem();
-            ilistItem.setDisplayName((String)
-                       docModel.getProperty(commonPartLabel,OrganizationJAXBSchema.DISPLAY_NAME ));
-                       ilistItem.setShortIdentifier((String) docModel.getProperty(commonPartLabel,
-                                       OrganizationJAXBSchema.SHORT_IDENTIFIER));
-                       ilistItem.setRefName((String) 
-                                       docModel.getProperty(commonPartLabel, OrganizationJAXBSchema.REF_NAME));
-                       String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-            ilistItem.setUri("/orgauthorities/" + this.inAuthority + "/items/" + id);
-            ilistItem.setCsid(id);
-            list.add(ilistItem);
-        }
-
-        return coList;
-    }
-
     /**
      * getQProperty converts the given property to qualified schema property
      * @param prop
index 6fab0561284cd921f6443e05cf7956658ca97ea5..fe728bfd8362a2e64fad193c4979320ee959ebaa 100644 (file)
  */
 package org.collectionspace.services.client;
 
-//import javax.ws.rs.PathParam;
-import org.jboss.resteasy.client.ClientResponse;
-
-import org.collectionspace.services.person.PersonauthoritiesCommonList;
-import org.collectionspace.services.person.PersonsCommonList;
-import org.collectionspace.services.client.PersonAuthorityProxy;
-
 /**
  * The Class PersonAuthorityClient.
  */
-public class PersonAuthorityClient extends AuthorityWithContactsClientImpl<PersonauthoritiesCommonList, PersonsCommonList, PersonAuthorityProxy> {
+public class PersonAuthorityClient extends AuthorityWithContactsClientImpl<PersonAuthorityProxy> {
        public static final String SERVICE_NAME = "personauthorities";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -78,12 +71,4 @@ public class PersonAuthorityClient extends AuthorityWithContactsClientImpl<Perso
        public Class<PersonAuthorityProxy> getProxyClass() {
                return PersonAuthorityProxy.class;
        }
-    
-    /*
-     * Proxied service call methods
-     */
-       
-    public ClientResponse<PersonauthoritiesCommonList> readList() {
-        return getProxy().readList();
-    }
 }
index e39cdf1e4f86800d2ce6660443d8fe37741893f1..b348057c6359e0a4d1f0c1c17f4b580a879a8016 100644 (file)
@@ -1,17 +1,8 @@
 package org.collectionspace.services.client;
 
 import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
 import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-
-import org.collectionspace.services.person.PersonauthoritiesCommonList;
-import org.collectionspace.services.person.PersonsCommonList;
-import org.collectionspace.services.client.workflow.WorkflowClient;
-
-import org.jboss.resteasy.client.ClientResponse;
 
 /**
  * @version $Revision:$
@@ -19,48 +10,6 @@ import org.jboss.resteasy.client.ClientResponse;
 @Path(PersonAuthorityClient.SERVICE_PATH + "/")
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public interface PersonAuthorityProxy extends AuthorityWithContactsProxy<PersonauthoritiesCommonList, PersonsCommonList> {
-
-    // List Personauthorities
-    @GET
-    ClientResponse<PersonauthoritiesCommonList> readList();
+public interface PersonAuthorityProxy extends AuthorityWithContactsProxy {
 
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    ClientResponse<PersonauthoritiesCommonList> readIncludeDeleted(
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
-            
-    @Override
-    @GET
-    @Produces({"application/xml"})
-    ClientResponse<PersonauthoritiesCommonList> keywordSearchIncludeDeleted(
-               @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
-    
-    /*
-     * List results that must be overridden for the RESTEasy proxy generation to work correctly.
-     */
-    
-    // List Items matching a partial term or keywords.
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    @Path("/{csid}/items/")
-    ClientResponse<PersonsCommonList> readItemList(
-               @PathParam("csid") String vcsid,
-            @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
-            @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
-    
-    // List Items for a named authority matching a partial term or keywords.
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    @Path("/urn:cspace:name({specifier})/items/")
-    ClientResponse<PersonsCommonList> readItemListForNamedAuthority(
-               @PathParam("specifier") String specifier,
-            @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
-            @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
 }
index 9948d5202a6cd57e09d70dd2b2c829ca0b707b02..c6f38395f3ea8ca66c08413ee83f467f86e78e44 100644 (file)
@@ -38,7 +38,6 @@ import org.collectionspace.services.client.PersonAuthorityClient;
 import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.person.PersonsCommonList;
 import org.jboss.resteasy.client.ClientResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -160,7 +159,7 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
     @Override
     protected AbstractCommonList getAbstractCommonList(
                     ClientResponse<AbstractCommonList> response) {
-    return response.getEntity(PersonsCommonList.class);
+    return response.getEntity(AbstractCommonList.class);
     }
 
     private String getPartialTermCommon() {
@@ -496,13 +495,13 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
 
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
-        ClientResponse<PersonsCommonList> res = null;
+        ClientResponse<AbstractCommonList> res = null;
         if (authorityCsid != null) {
                res = client.readItemList(authorityCsid, partialTerm, keywords);
         } else {
             Assert.fail("readItemListByPartialTerm passed null csid!");
         }
-        PersonsCommonList list = null;
+        AbstractCommonList list = null;
         try {
             int statusCode = res.getStatus();
 
@@ -520,7 +519,7 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
             res.releaseConnection();
         }
 
-        List<PersonsCommonList.PersonListItem> items = list.getPersonListItem();
+        List<AbstractCommonList.ListItem> items = list.getListItem();
         int nItemsReturned = items.size();
 
         return nItemsReturned;
index 3fd836440b42c1d134eea0796ebf6640441b5271..e960c858166c4d9a3502ca53ef4d9fc52fc875bd 100644 (file)
@@ -34,7 +34,6 @@ import org.collectionspace.services.client.PersonAuthorityClient;
 import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.person.PersonsCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
 import org.slf4j.Logger;
@@ -117,7 +116,7 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest {
     @Override
        protected AbstractCommonList getAbstractCommonList(
                        ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(PersonsCommonList.class);
+        return response.getEntity(AbstractCommonList.class);
     }
  
     @BeforeClass
@@ -308,13 +307,13 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest {
 
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
-        ClientResponse<PersonsCommonList> res = null;
+        ClientResponse<AbstractCommonList> res = null;
         if (authorityCsid != null) {
                res = client.readItemList(authorityCsid, partialTerm, keywords);
         } else {
             Assert.fail(testName+" passed null csid!");
         }
-        PersonsCommonList list = null;
+        AbstractCommonList list = null;
         try {
             int statusCode = res.getStatus();
             Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
@@ -326,7 +325,7 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest {
             res.releaseConnection();
         }
 
-        List<PersonsCommonList.PersonListItem> items = list.getPersonListItem();
+        List<AbstractCommonList.ListItem> items = list.getListItem();
         return (int)list.getTotalItems();
     }
     // ---------------------------------------------------------------
index 9e02ccb70777bf18c3dd80ef7b4e11ecfa216ccc..fd653102a892e4ae80bdacbb4701bc3253e1a271 100644 (file)
@@ -38,7 +38,7 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 
 import org.collectionspace.services.client.ContactClient;
 import org.collectionspace.services.client.ContactClientUtils;
-import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
+import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.contact.ContactsCommon;
 import org.collectionspace.services.contact.ContactsCommonList;
 
@@ -46,9 +46,7 @@ import org.collectionspace.services.client.PersonAuthorityClient;
 import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.PersonJAXBSchema;
 import org.collectionspace.services.person.PersonauthoritiesCommon;
-import org.collectionspace.services.person.PersonauthoritiesCommonList;
 import org.collectionspace.services.person.PersonsCommon;
-import org.collectionspace.services.person.PersonsCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
 //import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
@@ -70,6 +68,8 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
     /** The logger. */
     private final String CLASS_NAME = PersonAuthorityServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+    private final String REFNAME = "refName";
+    private final String DISPLAYNAME = "displayName";
     
        @Override
        public String getServicePathComponent() {
@@ -145,15 +145,6 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
        return new PersonAuthorityClient();
     }
     
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-       protected AbstractCommonList getAbstractCommonList(
-                       ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(PersonsCommonList.class);
-    }
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
@@ -1316,8 +1307,8 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
 
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
-        PersonauthoritiesCommonList list = null;
-        ClientResponse<PersonauthoritiesCommonList> res = client.readList();
+        AbstractCommonList list = null;
+        ClientResponse<AbstractCommonList> res = client.readList();
         try {
                int statusCode = res.getStatus();
        
@@ -1336,22 +1327,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         }
 
         // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = false;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            List<PersonauthoritiesCommonList.PersonauthorityListItem> items =
-                    list.getPersonauthorityListItem();
-            int i = 0;
-            for (PersonauthoritiesCommonList.PersonauthorityListItem item : items) {
-                String csid = item.getCsid();
-                logger.debug(testName + ": list-item[" + i + "] csid=" +
-                        csid);
-                logger.debug(testName + ": list-item[" + i + "] displayName=" +
-                        item.getDisplayName());
-                logger.debug(testName + ": list-item[" + i + "] URI=" +
-                        item.getUri());
-                readItemList(csid, null, testName);
-                i++;
-            }
+        // Optionally output additional data about list members for debugging.
+        if(logger.isTraceEnabled()){
+               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
         }
     }
 
@@ -1386,7 +1364,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         
        // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
-        ClientResponse<PersonsCommonList> res = null;
+        ClientResponse<AbstractCommonList> res = null;
         if (vcsid!= null) {
                res = client.readItemList(vcsid, null, null);
         } else if (name!= null) {
@@ -1394,7 +1372,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         } else {
                Assert.fail("readItemList passed null csid and name!");
         }
-        PersonsCommonList list = null;
+        AbstractCommonList list = null;
         try {
                int statusCode = res.getStatus();
        
@@ -1412,8 +1390,8 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
                res.releaseConnection();
         }
 
-        List<PersonsCommonList.PersonListItem> items =
-            list.getPersonListItem();
+        List<AbstractCommonList.ListItem> items =
+            list.getListItem();
         int nItemsReturned = items.size();
         // There will be one item created, associated with a
         // known parent resource, by the createItem test.
@@ -1428,23 +1406,16 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         }
         Assert.assertEquals(nItemsReturned, nExpectedItems);
 
-        int i = 0;
-        for (PersonsCommonList.PersonListItem item : items) {
-               Assert.assertTrue((null != item.getRefName()), "Item refName is null!");
-               Assert.assertTrue((null != item.getDisplayName()), "Item displayName is null!");
-               // Optionally output additional data about list members for debugging.
-               boolean showDetails = true;
-               if (showDetails && logger.isDebugEnabled()) {
-                logger.debug("  " + testName + ": list-item[" + i + "] csid=" +
-                        item.getCsid());
-                logger.debug("  " + testName + ": list-item[" + i + "] refName=" +
-                        item.getRefName());
-                logger.debug("  " + testName + ": list-item[" + i + "] displayName=" +
-                        item.getDisplayName());
-                logger.debug("  " + testName + ": list-item[" + i + "] URI=" +
-                        item.getUri());
-            }
-            i++;
+        for (AbstractCommonList.ListItem item : items) {
+               String value = 
+                       AbstractCommonListUtils.ListItemGetElementValue(item, REFNAME);
+            Assert.assertTrue((null != value), "Item refName is null!");
+               value = 
+                       AbstractCommonListUtils.ListItemGetElementValue(item, DISPLAYNAME);
+            Assert.assertTrue((null != value), "Item displayName is null!");
+        }
+        if(logger.isTraceEnabled()){
+               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
         }
     }
 
index 5a932a812d36fd91ad3c4139bf48a625913cfa9b..df0c9c16bded1038d4d0fe35723ed5292d5039dd 100644 (file)
         </xs:sequence>
     </xs:complexType>
     
-    <!-- This is the base class for paginated lists -->
-    <xs:complexType name="abstractCommonListItem">
-        <xs:annotation>
-            <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
-            </xs:appinfo>
-        </xs:annotation>
-    </xs:complexType>
-    
-    <!-- Person instances, as in nuxeo repository -->
-    <xs:element name="persons-common-list">
-        <xs:complexType>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonListItem">                    
-                    <xs:sequence>
-                        <xs:element name="person_list_item" maxOccurs="unbounded">
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="displayName" type="xs:string"
-                                        minOccurs="1" />
-                                                                       <xs:element name="shortIdentifier" type="xs:string"
-                                        minOccurs="1" />
-                                    <!-- uri to retrieve person details -->
-                                    <xs:element name="uri" type="xs:anyURI"
-                                        minOccurs="1" />
-                                    <xs:element name="refName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="csid" type="xs:string"
-                                        minOccurs="1" />
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                    </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>
-        </xs:complexType>
-    </xs:element>
-    
 </xs:schema>
 
index 7e942a0270b765034129dc9dcb198a1337186ed5..375b0821a9a420d186992b89a93f13c148105770 100644 (file)
         </xs:complexType>
     </xs:element>
     
-    <!-- This is the base class for paginated lists -->
-    <xs:complexType name="abstractCommonList">
-        <xs:annotation>
-            <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
-            </xs:appinfo>
-        </xs:annotation>
-    </xs:complexType>
-    
-    
-    <!-- PersonAuthority instances, as in nuxeo repository -->
-    <xs:element name="personauthorities-common-list">
-        <xs:complexType>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonList">                    
-                    <xs:sequence>
-                        <xs:element name="personauthority-list-item" maxOccurs="unbounded">
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="displayName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="refName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="shortIdentifier" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="vocabType" type="xs:string"
-                                        minOccurs="1" />
-                                    <!-- uri to retrieve personauthority details -->
-                                    <xs:element name="uri" type="xs:anyURI"
-                                        minOccurs="1" />
-                                    <xs:element name="csid" type="xs:string"
-                                        minOccurs="1" />
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                    </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>                    
-        </xs:complexType>
-    </xs:element>
-    
 </xs:schema>
 
index 3b32b060e84ff012040600affc7572b1680db857..c8227d917b22889a60bd3d29665d0759753e5801 100644 (file)
@@ -37,8 +37,7 @@ import javax.ws.rs.Produces;
 @Consumes("application/xml")
 @Produces("application/xml")
 public class PersonAuthorityResource extends
-       AuthorityResourceWithContacts<PersonauthoritiesCommon, PersonauthoritiesCommonList, PersonsCommon,
-               PersonDocumentModelHandler> {
+       AuthorityResourceWithContacts<PersonauthoritiesCommon, PersonDocumentModelHandler> {
 
     final Logger logger = LoggerFactory.getLogger(PersonAuthorityResource.class);
 
index be7e699281d749e00c4cb661b53fed80f1efe246..3a15f1bfdf957891bb9cacbca453c5832282d617 100644 (file)
  */
 package org.collectionspace.services.person.nuxeo;
 
-import java.util.Iterator;
-import java.util.List;
-
-import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
-import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.person.PersonauthoritiesCommon;
-import org.collectionspace.services.person.PersonauthoritiesCommonList;
-import org.collectionspace.services.person.PersonauthoritiesCommonList.PersonauthorityListItem;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler;
 
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 /**
  * PersonAuthorityDocumentModelHandler
  *
@@ -47,7 +33,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedDate: $
  */
 public class PersonAuthorityDocumentModelHandler
-               extends AuthorityDocumentModelHandler<PersonauthoritiesCommon, PersonauthoritiesCommonList> {
+               extends AuthorityDocumentModelHandler<PersonauthoritiesCommon> {
 
     /**
      * Common part schema label
@@ -58,38 +44,6 @@ public class PersonAuthorityDocumentModelHandler
        super(COMMON_PART_LABEL);
     }
        
-    @Override
-    public PersonauthoritiesCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-        PersonauthoritiesCommonList coList = extractPagingInfo(new PersonauthoritiesCommonList(),
-                       wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("displayName|refName|shortIdentifier|vocabType|uri|csid");
-
-        //FIXME: iterating over a long list of documents is not a long term
-        //strategy...need to change to more efficient iterating in future
-        List<PersonauthoritiesCommonList.PersonauthorityListItem> list = coList.getPersonauthorityListItem();
-        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-        String label = getServiceContext().getCommonPartLabel();
-        while(iter.hasNext()){
-            DocumentModel docModel = iter.next();
-            PersonauthorityListItem ilistItem = new PersonauthorityListItem();
-            ilistItem.setDisplayName((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.DISPLAY_NAME));
-            ilistItem.setRefName((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.REF_NAME));
-            ilistItem.setShortIdentifier((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.SHORT_IDENTIFIER));
-            ilistItem.setVocabType((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.VOCAB_TYPE));
-            String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-            ilistItem.setUri(getServiceContextPath() + id);
-            ilistItem.setCsid(id);
-            list.add(ilistItem);
-        }
-
-        return coList;
-    }
-
     /**
      * getQProperty converts the given property to qualified schema property
      * @param prop
index f29ee16180d1807989ad989274abf22ff6f739be..a3e076a4759d31bacb4fd1f6412d239885fbd9f2 100644 (file)
@@ -23,7 +23,6 @@
  */
 package org.collectionspace.services.person.nuxeo;
 
-import java.util.Iterator;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -33,17 +32,8 @@ import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumen
 import org.collectionspace.services.PersonJAXBSchema;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.service.ObjectPartType;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.person.PersonsCommon;
-import org.collectionspace.services.person.PersonsCommonList;
-import org.collectionspace.services.person.PersonsCommonList.PersonListItem;
-
 import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
 
 /**
  * PersonDocumentModelHandler
@@ -56,7 +46,7 @@ import org.nuxeo.ecm.core.api.DocumentModelList;
  *
  */
 public class PersonDocumentModelHandler
-       extends AuthorityItemDocumentModelHandler<PersonsCommon, PersonsCommonList> {
+       extends AuthorityItemDocumentModelHandler<PersonsCommon> {
 
     /** The logger. */
     //private final Logger logger = LoggerFactory.getLogger(PersonDocumentModelHandler.class);
@@ -209,38 +199,6 @@ public class PersonDocumentModelHandler
        return unQObjectProperties;
     }
     
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-       public PersonsCommonList extractCommonPartList(
-                       DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-               PersonsCommonList coList = extractPagingInfo(new PersonsCommonList(), wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("displayName|refName|shortIdentifier|uri|csid");
-               List<PersonsCommonList.PersonListItem> list = coList.getPersonListItem();
-               Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-               String commonPartLabel = getServiceContext().getCommonPartLabel(
-                               "persons");
-               while (iter.hasNext()) {
-                       DocumentModel docModel = iter.next();
-                       PersonListItem ilistItem = new PersonListItem();
-                       ilistItem.setDisplayName((String) docModel.getProperty(
-                                       commonPartLabel, PersonJAXBSchema.DISPLAY_NAME));
-                       ilistItem.setShortIdentifier((String) docModel.getProperty(commonPartLabel,
-                                       PersonJAXBSchema.SHORT_IDENTIFIER));
-                       ilistItem.setRefName((String) docModel.getProperty(commonPartLabel,
-                                       PersonJAXBSchema.REF_NAME));
-                       String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-                       ilistItem.setUri("/personauthorities/" + inAuthority + "/items/"
-                                       + id);
-                       ilistItem.setCsid(id);
-                       list.add(ilistItem);
-               }
-
-               return coList;
-       }
-
     /**
      * getQProperty converts the given property to qualified schema property
      * @param prop
index 5f6897b5b75fd5dd6eebefc137ac2f6c379c07bd..90cc6f74e302480757186bd6a159dbfa4153ccbf 100644 (file)
  */
 package org.collectionspace.services.client;
 
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.Response;
-
-//import org.collectionspace.services.common.authorityref.AuthorityRefList;
-import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
-import org.collectionspace.services.taxonomy.TaxonomyauthorityCommonList;
-import org.collectionspace.services.taxonomy.TaxonCommonList;
-import org.collectionspace.services.client.TaxonomyAuthorityProxy;
-
-import org.jboss.resteasy.client.ClientResponse;
-import org.jboss.resteasy.client.ProxyFactory;
-import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
-import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
-import org.jboss.resteasy.spi.ResteasyProviderFactory;
-
 /**
  * The Class TaxonomyAuthorityClient.
  */
-public class TaxonomyAuthorityClient extends AuthorityClientImpl<TaxonomyauthorityCommonList, TaxonCommonList, TaxonomyAuthorityProxy> {
+public class TaxonomyAuthorityClient extends AuthorityClientImpl<TaxonomyAuthorityProxy> {
 
-    public static final String SERVICE_NAME = "taxonomyauthorities";
+    public static final String SERVICE_NAME = "taxonomyauthority";
     public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
     public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
-    public static final String SERVICE_PAYLOAD_NAME = "taxonomyauthority";
+    public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
     //
     // Subitem constants
     //
@@ -73,11 +58,6 @@ public class TaxonomyAuthorityClient extends AuthorityClientImpl<Taxonomyauthori
         return SERVICE_PATH_COMPONENT;
     }
 
-    @Override
-    public String getCommonPartName() {
-        return getCommonPartName(SERVICE_PAYLOAD_NAME);
-    }
-
     @Override
     public String getItemCommonPartName() {
         return getCommonPartName(SERVICE_ITEM_PAYLOAD_NAME);
@@ -87,15 +67,4 @@ public class TaxonomyAuthorityClient extends AuthorityClientImpl<Taxonomyauthori
     public Class<TaxonomyAuthorityProxy> getProxyClass() {
         return TaxonomyAuthorityProxy.class;
     }
-
-    /*
-     * Proxied service calls.
-     */
-    /**
-     * @return list
-     * @see org.collectionspace.services.client.TaxonomyAuthorityProxy#readList()
-     */
-    public ClientResponse<TaxonomyauthorityCommonList> readList() {
-        return getProxy().readList();
-    }
 }
index aa8aadc2a6d25a04263550702439e6b626722ffc..4b94035ea5212fd2db3d072a8249c8368137d55a 100644 (file)
@@ -1,16 +1,8 @@
 package org.collectionspace.services.client;
 
-import org.jboss.resteasy.client.ClientResponse;
 import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
 import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-
-import org.collectionspace.services.client.workflow.WorkflowClient;
-import org.collectionspace.services.taxonomy.TaxonomyauthorityCommonList;
-import org.collectionspace.services.taxonomy.TaxonCommonList;
 
 /**
  * @version $Revision$
@@ -20,48 +12,5 @@ import org.collectionspace.services.taxonomy.TaxonCommonList;
 @Path(TaxonomyAuthorityClient.SERVICE_PATH + "/")
 @Produces("application/xml")
 @Consumes("application/xml")
-public interface TaxonomyAuthorityProxy extends AuthorityProxy<TaxonomyauthorityCommonList, TaxonCommonList> {
-
-    // List Taxonomyauthority
-    @GET
-    ClientResponse<TaxonomyauthorityCommonList> readList();
-    
-    /*
-     * List results that must be overridden for the RESTEasy proxy generation to work correctly.
-     */
-    
-    // List Items matching a partial term or keywords.
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    @Path("/{csid}/items/")
-    ClientResponse<TaxonCommonList> readItemList(
-               @PathParam("csid") String vcsid,
-            @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
-            @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
-    
-    // List Items for a named authority matching a partial term or keywords.
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    @Path("/urn:cspace:name({specifier})/items/")
-    ClientResponse<TaxonCommonList> readItemListForNamedAuthority(
-               @PathParam("specifier") String specifier,
-            @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
-            @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
-    
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    ClientResponse<TaxonomyauthorityCommonList> readIncludeDeleted(
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);    
-    @Override
-    @GET
-    @Produces({"application/xml"})
-    ClientResponse<TaxonomyauthorityCommonList> keywordSearchIncludeDeleted(
-               @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);   
+public interface TaxonomyAuthorityProxy extends AuthorityProxy {
 }
index 6d24897fe61a2cff2c341ae9a92fc05c00498d88..314e5f11a7d9d0bcc2d3654e306bf5e831560590 100644 (file)
@@ -35,14 +35,13 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.TaxonomyAuthorityClient;
 import org.collectionspace.services.client.TaxonomyAuthorityClientUtils;
+import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.taxonomy.TaxonAuthorGroup;
 import org.collectionspace.services.taxonomy.TaxonAuthorGroupList;
 import org.collectionspace.services.taxonomy.TaxonCitationList;
 import org.collectionspace.services.taxonomy.TaxonomyauthorityCommon;
-import org.collectionspace.services.taxonomy.TaxonomyauthorityCommonList;
 import org.collectionspace.services.taxonomy.TaxonCommon;
-import org.collectionspace.services.taxonomy.TaxonCommonList;
 
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -67,6 +66,8 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
     /** The logger. */
     private final String CLASS_NAME = TaxonomyAuthorityServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(TaxonomyAuthorityServiceTest.class);
+    private final String REFNAME = "refName";
+    private final String DISPLAYNAME = "displayName";
 
     @Override
     public String getServicePathComponent() {
@@ -131,15 +132,6 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
         return new TaxonomyAuthorityClient();
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(TaxonCommonList.class);
-    }
-
     @Override
     protected PoxPayloadOut createInstance(String identifier) {
         TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
@@ -775,9 +767,9 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
 
         // Submit the request to the service and store the response.
         TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<TaxonomyauthorityCommonList> res = client.readList();
+        ClientResponse<AbstractCommonList> res = client.readList();
         try {
-            TaxonomyauthorityCommonList list = res.getEntity();
+               AbstractCommonList list = res.getEntity();
             int statusCode = res.getStatus();
 
             // Check the status code of the response: does it match
@@ -790,22 +782,8 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
             Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
 
             // Optionally output additional data about list members for debugging.
-            boolean iterateThroughList = false;
-            if (iterateThroughList && logger.isDebugEnabled()) {
-                List<TaxonomyauthorityCommonList.TaxonomyauthorityListItem> items =
-                        list.getTaxonomyauthorityListItem();
-                int i = 0;
-                for (TaxonomyauthorityCommonList.TaxonomyauthorityListItem item : items) {
-                    String csid = item.getCsid();
-                    logger.debug(testName + ": list-item[" + i + "] csid="
-                            + csid);
-                    logger.debug(testName + ": list-item[" + i + "] displayName="
-                            + item.getDisplayName());
-                    logger.debug(testName + ": list-item[" + i + "] URI="
-                            + item.getUri());
-                    readItemList(csid, null);
-                    i++;
-                }
+            if(logger.isTraceEnabled()){
+               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
             }
         } finally {
             res.releaseConnection();
@@ -851,7 +829,7 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
 
         // Submit the request to the service and store the response.
         TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<TaxonCommonList> res = null;
+        ClientResponse<AbstractCommonList> res = null;
         if (vcsid != null) {
             res = client.readItemList(vcsid, null, null);
         } else if (shortId != null) {
@@ -860,7 +838,7 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
             Assert.fail("readItemList passed null csid and name!");
         }
         try {
-            TaxonCommonList list = res.getEntity();
+               AbstractCommonList list = res.getEntity();
             int statusCode = res.getStatus();
 
             // Check the status code of the response: does it match
@@ -872,8 +850,8 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
                     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
             Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
 
-            List<TaxonCommonList.TaxonListItem> items =
-                    list.getTaxonListItem();
+            List<AbstractCommonList.ListItem> items =
+                    list.getListItem();
             int nItemsReturned = items.size();
             // There will be one item created, associated with a
             // known parent resource, by the createItem test.
@@ -888,23 +866,16 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
             }
             Assert.assertEquals(nItemsReturned, nExpectedItems);
 
-            int i = 0;
-            for (TaxonCommonList.TaxonListItem item : items) {
-                Assert.assertTrue((null != item.getRefName()), "Item refName is null!");
-                Assert.assertTrue((null != item.getDisplayName()), "Item displayName is null!");
-                // Optionally output additional data about list members for debugging.
-                boolean showDetails = true;
-                if (showDetails && logger.isDebugEnabled()) {
-                    logger.debug("  " + testName + ": list-item[" + i + "] csid="
-                            + item.getCsid());
-                    logger.debug("  " + testName + ": list-item[" + i + "] refName="
-                            + item.getRefName());
-                    logger.debug("  " + testName + ": list-item[" + i + "] displayName="
-                            + item.getDisplayName());
-                    logger.debug("  " + testName + ": list-item[" + i + "] URI="
-                            + item.getUri());
-                }
-                i++;
+            for (AbstractCommonList.ListItem item : items) {
+               String value = 
+                       AbstractCommonListUtils.ListItemGetElementValue(item, REFNAME);
+                Assert.assertTrue((null != value), "Item refName is null!");
+               value = 
+                       AbstractCommonListUtils.ListItemGetElementValue(item, DISPLAYNAME);
+                Assert.assertTrue((null != value), "Item displayName is null!");
+            }
+            if(logger.isTraceEnabled()){
+               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
             }
         } finally {
             res.releaseConnection();
index e435812c8c934967fb17a272b0d5b9d9f97f8f38..126d94a1a8aab8eb93d7c51d418e2db03d2eff5c 100644 (file)
         </xs:sequence>
     </xs:complexType>
 
-    <!-- This is the base class for paginated lists -->
-    <xs:complexType name="abstractCommonListItem">
-        <xs:annotation>
-            <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
-            </xs:appinfo>
-        </xs:annotation>
-    </xs:complexType>
-    
-    <!-- Taxonomy instances, as in nuxeo repository -->
-    <xs:element name="taxon-common-list">
-        <xs:complexType>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonListItem">                    
-                    <xs:sequence>
-                        <xs:element name="taxon_list_item" maxOccurs="unbounded">
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="displayName" type="xs:string"
-                                        minOccurs="1" />
-                                                                       <xs:element name="shortIdentifier" type="xs:string"
-                                        minOccurs="1" />
-                                    <!-- uri to retrieve taxon details -->
-                                    <xs:element name="uri" type="xs:anyURI"
-                                        minOccurs="1" />
-                                    <xs:element name="refName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="csid" type="xs:string"
-                                        minOccurs="1" />
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                    </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>
-        </xs:complexType>
-    </xs:element>
-    
 </xs:schema>
 
index 36d8798131140651d416ce3b62181f663898f34f..c2afec0cf33ffcb58c9bbb07947a367117a6e760 100644 (file)
         </xs:complexType>
     </xs:element>
     
-    <!-- This is the base class for paginated lists -->
-    <xs:complexType name="abstractCommonList">
-        <xs:annotation>
-            <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
-            </xs:appinfo>
-        </xs:annotation>
-    </xs:complexType>
-    
-    
-    <!-- TaxonomyAuthority instances, as in nuxeo repository -->
-    <xs:element name="taxonomyauthority-common-list">
-        <xs:complexType>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonList">                    
-                    <xs:sequence>
-                        <xs:element name="taxonomyauthority-list-item" maxOccurs="unbounded">
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="displayName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="refName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="shortIdentifier" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="vocabType" type="xs:string"
-                                        minOccurs="1" />
-                                    <!-- uri to retrieve taxonomyauthority details -->
-                                    <xs:element name="uri" type="xs:anyURI"
-                                        minOccurs="1" />
-                                    <xs:element name="csid" type="xs:string"
-                                        minOccurs="1" />
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                    </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>                    
-        </xs:complexType>
-    </xs:element>
-    
 </xs:schema>
 
index 6b3e31e290bbf0612224abd7e3c69a8d4a034557..886c8cf3fc5122beb0b87b936fa8af15e5412e72 100644 (file)
@@ -37,9 +37,9 @@ import javax.ws.rs.Produces;
 @Consumes("application/xml")
 @Produces("application/xml")
 public class TaxonomyAuthorityResource
-        extends AuthorityResource<TaxonomyauthorityCommon, TaxonomyauthorityCommonList, TaxonCommon, TaxonDocumentModelHandler> {
+        extends AuthorityResource<TaxonomyauthorityCommon, TaxonDocumentModelHandler> {
 
-    private final static String taxonomyAuthorityServiceName = "taxonomyauthorities";
+    private final static String taxonomyAuthorityServiceName = "taxonomyauthority";
     private final static String TAXONOMYAUTHORITY_COMMON = "taxonomyauthority_common";
     private final static String taxonomyItemServiceName = "taxon";
     private final static String TAXONOMYITEM_COMMON = "taxon_common";
index b9247156066a88c96b8edd2ec229c775503e601b..95b1688f429aa8450bdfae1209497a18230e3cbe 100644 (file)
  */
 package org.collectionspace.services.taxonomy.nuxeo;
 
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
 import org.collectionspace.services.TaxonJAXBSchema;
-import org.collectionspace.services.client.TaxonomyAuthorityClient;
-import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.common.service.ObjectPartType;
-import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler;
-import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.taxonomy.TaxonCommon;
-import org.collectionspace.services.taxonomy.TaxonCommonList;
-import org.collectionspace.services.taxonomy.TaxonCommonList.TaxonListItem;
 import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * TaxonomyDocumentModelHandler
@@ -58,10 +40,8 @@ import org.slf4j.LoggerFactory;
  *
  */
 public class TaxonDocumentModelHandler
-        extends AuthorityItemDocumentModelHandler<TaxonCommon, TaxonCommonList> {
+        extends AuthorityItemDocumentModelHandler<TaxonCommon> {
 
-    /** The logger. */
-    private final Logger logger = LoggerFactory.getLogger(TaxonDocumentModelHandler.class);
     /**
      * Common part schema label
      */
@@ -138,37 +118,6 @@ public class TaxonDocumentModelHandler
         return newStr.toString();
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public TaxonCommonList extractCommonPartList(
-            DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-        TaxonCommonList coList = extractPagingInfo(new TaxonCommonList(), wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("displayName|refName|shortIdentifier|uri|csid");
-        List<TaxonCommonList.TaxonListItem> list = coList.getTaxonListItem();
-        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-        String commonPartLabel = getServiceContext().getCommonPartLabel("taxon");
-        while (iter.hasNext()) {
-            DocumentModel docModel = iter.next();
-            TaxonListItem ilistItem = new TaxonListItem();
-            ilistItem.setDisplayName((String) docModel.getProperty(
-                    commonPartLabel, AuthorityItemJAXBSchema.DISPLAY_NAME));
-            ilistItem.setShortIdentifier((String) docModel.getProperty(commonPartLabel,
-                    AuthorityItemJAXBSchema.SHORT_IDENTIFIER));
-            ilistItem.setRefName((String) docModel.getProperty(commonPartLabel,
-                    AuthorityItemJAXBSchema.REF_NAME));
-            String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-            ilistItem.setUri("/taxonomyauthorities/" + inAuthority + "/items/"
-                    + id);
-            ilistItem.setCsid(id);
-            list.add(ilistItem);
-        }
-
-        return coList;
-    }
-
     /**
      * getQProperty converts the given property to qualified schema property
      * @param prop
index 8bb95b744fbf0d2c9554d7abf13d4c65e9d5d77b..554f0b285b7ee4ac2bc30b540d5caaf9e77c5f74 100644 (file)
  */
 package org.collectionspace.services.taxonomy.nuxeo;
 
-import java.util.Iterator;
-import java.util.List;
-
-import org.collectionspace.services.common.document.DocumentHandler.Action;
-import org.collectionspace.services.common.document.DocumentFilter;
-import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.taxonomy.TaxonomyauthorityCommon;
-import org.collectionspace.services.taxonomy.TaxonomyauthorityCommonList;
-import org.collectionspace.services.taxonomy.TaxonomyauthorityCommonList.TaxonomyauthorityListItem;
-
-import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * TaxonomyAuthorityDocumentModelHandler
@@ -50,7 +33,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedDate$
  */
 public class TaxonomyAuthorityDocumentModelHandler
-        extends AuthorityDocumentModelHandler<TaxonomyauthorityCommon, TaxonomyauthorityCommonList> {
+        extends AuthorityDocumentModelHandler<TaxonomyauthorityCommon> {
 
     /**
      * Common part schema label
@@ -65,54 +48,5 @@ public class TaxonomyAuthorityDocumentModelHandler
         return COMMON_PART_LABEL;
     }
        
-    @Override
-    public TaxonomyauthorityCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-        TaxonomyauthorityCommonList coList = extractPagingInfo(new TaxonomyauthorityCommonList(),
-                       wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("displayName|refName|shortIdentifier|vocabType|uri|csid");
-
-        //FIXME: iterating over a long list of documents is not a long term
-        //strategy...need to change to more efficient iterating in future
-        List<TaxonomyauthorityCommonList.TaxonomyauthorityListItem> list = coList.getTaxonomyauthorityListItem();
-        // FIXME: This workaround - for the discrepancy between plural service
-        // name / path ("taxonomyauthorities") and singular common part name
-        // ("taxonomyauthority ... _common") in this service might be handled
-        // in a cleaner way than below.  Absent this workaround, values of fields
-        // (other than URI and CSID) could not be obtained via the document model.
-        // Perhaps this will be moot when we switch to the model of Person, et al.,
-        // where SERVICE_PAYLOAD_NAME can be distinct from SERVICE_NAME.
-        // String label = getServiceContext().getCommonPartLabel();
-        String label = getCommonPartLabel();
-        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-        while(iter.hasNext()){
-            DocumentModel docModel = iter.next();
-            TaxonomyauthorityListItem ilistItem = new TaxonomyauthorityListItem();
-            ilistItem.setDisplayName((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.DISPLAY_NAME));
-            ilistItem.setRefName((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.REF_NAME));
-            ilistItem.setShortIdentifier((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.SHORT_IDENTIFIER));
-            ilistItem.setVocabType((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.VOCAB_TYPE));
-            String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-            ilistItem.setUri(getServiceContextPath() + id);
-            ilistItem.setCsid(id);
-            list.add(ilistItem);
-        }
-
-        return coList;
-    }
-
-    /**
-     * getQProperty converts the given property to qualified schema property
-     * @param prop
-     * @return
-     */
-    @Override
-    public String getQProperty(String prop) {
-        return TaxonomyAuthorityConstants.NUXEO_SCHEMA_NAME + ":" + prop;
-    }
 }
 
index d8646d5b9b0b37747f33ad461eba2744b945fe81..54d87bfb956fed13c3cf87623a8eb3e063768f6f 100644 (file)
  */
 package org.collectionspace.services.client;
 
-import org.jboss.resteasy.client.ClientResponse;
-
-import org.collectionspace.services.vocabulary.VocabulariesCommonList;
-import org.collectionspace.services.vocabulary.VocabularyitemsCommonList;
-import org.collectionspace.services.client.VocabularyProxy;
-
 /**
  * The Class VocabularyClient.
  */
-public class VocabularyClient extends AuthorityClientImpl<VocabulariesCommonList, VocabularyitemsCommonList, VocabularyProxy> {
+public class VocabularyClient extends AuthorityClientImpl<VocabularyProxy> {
        public static final String SERVICE_NAME = "vocabularies";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -79,17 +73,4 @@ public class VocabularyClient extends AuthorityClientImpl<VocabulariesCommonList
     public String getCommonPartItemName() {
         return getCommonPartName(SERVICE_ITEM_PAYLOAD_NAME);
     }
-
-    /*
-     * Service calls
-     */
-    
-    /**
-     * Read list.
-     *
-     * @return the client response
-     */
-    public ClientResponse<VocabulariesCommonList> readList() {
-        return getProxy().readList();
-    }
 }
index c6b082d07c00f10df8f37130012a99143847be1c..7c4bbc3c5292ba9d6decf2327446e26c48823098 100644 (file)
@@ -1,17 +1,8 @@
 package org.collectionspace.services.client;
 
 import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
 import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-
-import org.collectionspace.services.vocabulary.VocabulariesCommonList;
-import org.collectionspace.services.vocabulary.VocabularyitemsCommonList;
-import org.collectionspace.services.client.workflow.WorkflowClient;
-
-import org.jboss.resteasy.client.ClientResponse;
 
 /**
  * @version $Revision:$
@@ -19,48 +10,6 @@ import org.jboss.resteasy.client.ClientResponse;
 @Path("/" + VocabularyClient.SERVICE_PATH_COMPONENT + "/")
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public interface VocabularyProxy extends AuthorityProxy<VocabulariesCommonList, VocabularyitemsCommonList> {
-    // List Vocabularies
-    @GET
-    @Produces({"application/xml"})
-    ClientResponse<VocabulariesCommonList> readList();
-    
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    ClientResponse<VocabulariesCommonList> readIncludeDeleted(
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);    
-    
-    @Override
-    @GET
-    @Produces({"application/xml"})
-    ClientResponse<VocabulariesCommonList> keywordSearchIncludeDeleted(
-               @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
-
-    /*
-     * List results that must be overridden for the RESTEasy proxy generation to work correctly.
-     */
-    
-    // List Items matching a partial term or keywords.
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    @Path("/{csid}/items/")
-    ClientResponse<VocabularyitemsCommonList> readItemList(
-               @PathParam("csid") String vcsid,
-            @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
-            @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
+public interface VocabularyProxy extends AuthorityProxy {
     
-    // List Items for a named authority matching a partial term or keywords.
-    @Override
-       @GET
-    @Produces({"application/xml"})
-    @Path("/urn:cspace:name({specifier})/items/")
-    ClientResponse<VocabularyitemsCommonList> readItemListForNamedAuthority(
-               @PathParam("specifier") String specifier,
-            @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
-            @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
-            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
 }
index a2615ab6b0ba3f7422fdf13aa3b8c5842365d710..fb103e585acedabd9468fd0c8231a1c560ac3ca4 100644 (file)
@@ -30,6 +30,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.client.AuthorityClient;
+import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PayloadOutputPart;
@@ -39,9 +40,7 @@ import org.collectionspace.services.client.VocabularyClient;
 import org.collectionspace.services.client.VocabularyClientUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.vocabulary.VocabulariesCommon;
-import org.collectionspace.services.vocabulary.VocabulariesCommonList;
 import org.collectionspace.services.vocabulary.VocabularyitemsCommon;
-import org.collectionspace.services.vocabulary.VocabularyitemsCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
 import org.slf4j.Logger;
@@ -91,15 +90,6 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         return new VocabularyClient();
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(VocabulariesCommonList.class);
-    }
-
     @Override
     protected PoxPayloadOut createInstance(String identifier) {
        VocabularyClient client = new VocabularyClient();
@@ -663,8 +653,8 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
 
         // Submit the request to the service and store the response.
         VocabularyClient client = new VocabularyClient();
-        ClientResponse<VocabulariesCommonList> res = client.readList();
-        VocabulariesCommonList list = res.getEntity();
+        ClientResponse<AbstractCommonList> res = client.readList();
+        AbstractCommonList list = res.getEntity();
         int statusCode = res.getStatus();
 
         // Check the status code of the response: does it match
@@ -677,22 +667,8 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
 
         // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = false;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            List<VocabulariesCommonList.VocabularyListItem> items =
-                    list.getVocabularyListItem();
-            int i = 0;
-            for (VocabulariesCommonList.VocabularyListItem item : items) {
-                String csid = item.getCsid();
-                logger.debug(testName + ": list-item[" + i + "] csid="
-                        + csid);
-                logger.debug(testName + ": list-item[" + i + "] displayName="
-                        + item.getDisplayName());
-                logger.debug(testName + ": list-item[" + i + "] URI="
-                        + item.getUri());
-                readItemListInt(csid, null, "readList");
-                i++;
-            }
+        if(logger.isTraceEnabled()){
+               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
         }
     }
 
@@ -715,7 +691,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
 
         // Submit the request to the service and store the response.
         VocabularyClient client = new VocabularyClient();
-        ClientResponse<VocabularyitemsCommonList> res = null;
+        ClientResponse<AbstractCommonList> res = null;
         if (vcsid != null) {
             res = client.readItemList(vcsid, null, null);
         } else if (shortId != null) {
@@ -723,7 +699,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         } else {
             Assert.fail("Internal Error: readItemList both vcsid and shortId are null!");
         }
-        VocabularyitemsCommonList list = res.getEntity();
+        AbstractCommonList list = res.getEntity();
         int statusCode = res.getStatus();
 
         // Check the status code of the response: does it match
@@ -735,8 +711,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
 
-        List<VocabularyitemsCommonList.VocabularyitemListItem> items =
-                list.getVocabularyitemListItem();
+        List<AbstractCommonList.ListItem> items = list.getListItem();
         int nItemsReturned = items.size();
         long nItemsTotal = list.getTotalItems();
         if (logger.isDebugEnabled()) {
@@ -745,20 +720,8 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         }
         Assert.assertEquals(nItemsTotal, nItemsToCreateInList);
 
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            logger.debug("  " + testName + ": checking items");
-            int i = 0;
-            for (VocabularyitemsCommonList.VocabularyitemListItem item : items) {
-                logger.debug("  " + testName + ": list-item[" + i + "] csid="
-                        + item.getCsid());
-                logger.debug("  " + testName + ": list-item[" + i + "] displayName="
-                        + item.getDisplayName());
-                logger.debug("  " + testName + ": list-item[" + i + "] URI="
-                        + item.getUri());
-                i++;
-            }
+        if(logger.isTraceEnabled()){
+               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
         }
     }
 
index 4e17b1c0e5d3710ed3c6b0a1e3dc2fc5734022df..c362b5a8ce9b5c46ca3be35d7c0485f20af3c0f1 100644 (file)
             </xs:sequence>
         </xs:complexType>
     </xs:element>
-    
-    <!-- This is the base class for paginated lists -->
-    <xs:complexType name="abstractCommonList">
-        <xs:annotation>
-            <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
-            </xs:appinfo>
-        </xs:annotation>
-    </xs:complexType>
-    
-    <!-- Vocabulary instances, as in nuxeo repository -->
-    <xs:element name="vocabularies-common-list">
-        <xs:complexType>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonList">                    
-                    <xs:sequence>
-                        <xs:element name="vocabulary-list-item" maxOccurs="unbounded">
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="displayName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="refName" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="shortIdentifier" type="xs:string"
-                                        minOccurs="1" />
-                                    <xs:element name="vocabType" type="xs:string"
-                                        minOccurs="1" />
-                                    <!-- uri to retrieve vocabulary details -->
-                                    <xs:element name="uri" type="xs:anyURI"
-                                        minOccurs="1" />
-                                    <xs:element name="csid" type="xs:string"
-                                        minOccurs="1" />
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                    </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>                    
-        </xs:complexType>
-    </xs:element>
-    
 </xs:schema>
 
index 27727365fea060b0d1ff438daf08b673067f83d1..fcde9d3c83fd3238a5ccccc09f72795ead9e916a 100644 (file)
             </xs:sequence>
         </xs:complexType>
     </xs:element>
-
-    <!-- This is the base class for paginated lists -->
-    <xs:complexType name="abstractCommonListItem">
-        <xs:annotation>
-            <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
-            </xs:appinfo>
-        </xs:annotation>
-    </xs:complexType>
-
-    <!-- Vocabularyitem instances, as in nuxeo repository -->
-    <xs:element name="vocabularyitems-common-list">
-        <xs:complexType>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonListItem">
-                    <xs:sequence>
-                        <xs:element name="vocabularyitem_list_item" maxOccurs="unbounded">
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="displayName" type="xs:string"
-                                                minOccurs="1"/>
-                                    <xs:element name="shortIdentifier" type="xs:string"
-                                                minOccurs="1"/>
-                                    <xs:element name="order" type="xs:string"
-                                                minOccurs="0"/>
-                                    <!-- uri to retrieve vocabularyitem details -->
-                                    <xs:element name="uri" type="xs:anyURI"
-                                                minOccurs="1"/>
-                                    <xs:element name="refName" type="xs:string"
-                                                minOccurs="1"/>
-                                    <xs:element name="csid" type="xs:string"
-                                                minOccurs="1"/>
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                    </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>
-        </xs:complexType>
-    </xs:element>
-
 </xs:schema>
 
index d9e07a5f41d613cd1283d8a71aa00c8e239ec4b0..91fdbaef31de48f232b8f10552bad79445b41001 100644 (file)
@@ -33,8 +33,7 @@ import javax.ws.rs.Path;
 
 @Path("/" + VocabularyClient.SERVICE_PATH_COMPONENT)
 public class VocabularyResource extends 
-       AuthorityResource<VocabulariesCommon, VocabulariesCommonList, VocabularyitemsCommonList,
-                                               VocabularyItemDocumentModelHandler> {
+       AuthorityResource<VocabulariesCommon, VocabularyItemDocumentModelHandler> {
 
     private final static String vocabularyServiceName = VocabularyClient.SERVICE_PATH_COMPONENT;
 
index b5609dc0247b9f01998e4306cece6c8f28620b22..ae145b1d53345310f4d78dcb3ea00eb90bfeae71 100644 (file)
  */
 package org.collectionspace.services.vocabulary.nuxeo;
 
-import java.util.Iterator;
-import java.util.List;
-
-import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler;
-import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.vocabulary.VocabulariesCommon;
-import org.collectionspace.services.vocabulary.VocabulariesCommonList;
-import org.collectionspace.services.vocabulary.VocabulariesCommonList.VocabularyListItem;
-
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * VocabularyDocumentModelHandler
@@ -47,7 +33,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedDate: $
  */
 public class VocabularyDocumentModelHandler
-               extends AuthorityDocumentModelHandler<VocabulariesCommon, VocabulariesCommonList> {
+               extends AuthorityDocumentModelHandler<VocabulariesCommon> {
 
     /**
      * Common part schema label
@@ -57,38 +43,6 @@ public class VocabularyDocumentModelHandler
     public VocabularyDocumentModelHandler() {
        super(COMMON_PART_LABEL);
     }
-       
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public VocabulariesCommonList extractCommonPartList(
-               DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-               String label = getServiceContext().getCommonPartLabel();
-        VocabulariesCommonList coList = extractPagingInfo(new VocabulariesCommonList(), wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("displayName|refName|shortIdentifier|vocabType|uri|csid");
-        List<VocabulariesCommonList.VocabularyListItem> list = coList.getVocabularyListItem();
-        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-        while(iter.hasNext()){
-            DocumentModel docModel = iter.next();
-            VocabularyListItem ilistItem = new VocabularyListItem();
-            ilistItem.setDisplayName((String) docModel.getProperty(label,
-                    AuthorityJAXBSchema.DISPLAY_NAME));
-            ilistItem.setRefName((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.REF_NAME));
-            ilistItem.setShortIdentifier((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.SHORT_IDENTIFIER));
-            ilistItem.setVocabType((String) docModel.getProperty(label,
-                       AuthorityJAXBSchema.VOCAB_TYPE));
-            String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-            ilistItem.setUri(getServiceContextPath() + id);
-            ilistItem.setCsid(id);
-            list.add(ilistItem);
-        }
-
-        return coList;
-    }
 
     /**
      * getQProperty converts the given property to qualified schema property
index 54683b20886c8135e1cee924d7cbc43e19e820f9..66e04b602299f1f31c1376531f68da81ba2a47e4 100644 (file)
  */
 package org.collectionspace.services.vocabulary.nuxeo;
 
-import java.util.Iterator;
-import java.util.List;
-
 import org.collectionspace.services.client.VocabularyClient;
-import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
-import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.vocabulary.VocabularyitemsCommon;
-import org.collectionspace.services.vocabulary.VocabularyitemsCommonList;
-import org.collectionspace.services.vocabulary.VocabularyitemsCommonList.VocabularyitemListItem;
-import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * VocabularyItemDocumentModelHandler
@@ -47,10 +34,8 @@ import org.slf4j.LoggerFactory;
  * $LastChangedDate: $
  */
 public class VocabularyItemDocumentModelHandler
-               extends AuthorityItemDocumentModelHandler<VocabularyitemsCommon, VocabularyitemsCommonList> {
+               extends AuthorityItemDocumentModelHandler<VocabularyitemsCommon> {
 
-    private final Logger logger = LoggerFactory.getLogger(VocabularyItemDocumentModelHandler.class);
-    
     private static final String COMMON_PART_LABEL = "vocabularyitems_common";   
     
     public VocabularyItemDocumentModelHandler() {
@@ -61,38 +46,7 @@ public class VocabularyItemDocumentModelHandler
     public String getAuthorityServicePath(){
         return VocabularyClient.SERVICE_PATH_COMPONENT;    // CSPACE-3932
     }
-       
     
-    @Override
-       public VocabularyitemsCommonList extractCommonPartList(
-                       DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-               VocabularyitemsCommonList coList = extractPagingInfo(new VocabularyitemsCommonList(), wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("displayName|refName|shortIdentifier|order|uri|csid");
-               
-               List<VocabularyitemsCommonList.VocabularyitemListItem> list = coList.getVocabularyitemListItem();
-               Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-               String commonPartLabel = getServiceContext().getCommonPartLabel("vocabularyItems");
-               while (iter.hasNext()) {
-                       DocumentModel docModel = iter.next();
-                       VocabularyitemListItem ilistItem = new VocabularyitemListItem();
-                       ilistItem.setDisplayName((String) docModel.getProperty(commonPartLabel, 
-                                       AuthorityItemJAXBSchema.DISPLAY_NAME));
-                       ilistItem.setShortIdentifier((String) docModel.getProperty(commonPartLabel,
-                                       AuthorityItemJAXBSchema.SHORT_IDENTIFIER));
-            ilistItem.setRefName((String) docModel.getProperty(commonPartLabel,
-                                AuthorityItemJAXBSchema.REF_NAME));
-            ilistItem.setOrder((String) docModel.getProperty(commonPartLabel,
-                              AuthorityItemJAXBSchema.ORDER));
-                       String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-                       ilistItem.setUri("/vocabularies/" + inAuthority + "/items/" + id);
-                       ilistItem.setCsid(id);
-                       list.add(ilistItem);
-               }
-
-               return coList;
-    }
-
     /**
      * getQProperty converts the given property to qualified schema property
      * @param prop