]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-1349, 1422, 1428, 1429, 1469, 1465, 1466, 1468, 1470, 1473:
authorRichard Millet <richard.millet@berkeley.edu>
Thu, 6 May 2010 08:09:02 +0000 (08:09 +0000)
committerRichard Millet <richard.millet@berkeley.edu>
Thu, 6 May 2010 08:09:02 +0000 (08:09 +0000)
1. Adding additional pagination tests to all Nuxeo based services.
2. Replacing .getAll() calls with .getFiltered
3. Removing dead/deprecated code in many http clients
4. Fixing file refs to test and config files to *not* assume current dir is in classpath.

34 files changed:
services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java
services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.java
services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/AcquisitionResource.java
services/authorization/service/pom.xml
services/authorization/service/src/test/java/org/collectionspace/services/authorization/test/AbstractAuthorizationTestImpl.java
services/authorization/service/src/test/java/org/collectionspace/services/authorization/test/AuthorizationSeedTest.java
services/client/pom.xml
services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java
services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java
services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/CollectionObjectResource.java
services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java
services/contact/client/src/main/java/org/collectionspace/services/client/ContactClient.java
services/contact/service/src/main/java/org/collectionspace/services/contact/ContactResource.java
services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java
services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java
services/dimension/service/src/main/java/org/collectionspace/services/dimension/DimensionResource.java
services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java
services/intake/service/src/main/java/org/collectionspace/services/intake/IntakeResource.java
services/jaxb/src/main/resources/AbstractCommonList.xsd
services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninClient.java
services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java
services/loanin/service/src/main/java/org/collectionspace/services/loanin/LoaninResource.java
services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutClient.java
services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java
services/loanout/service/src/main/java/org/collectionspace/services/loanout/LoanoutResource.java
services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java
services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java
services/pom.xml
services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java
services/relation/service/src/main/java/org/collectionspace/services/relation/NewRelationResource.java
services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java

index 0a893e67597297d2c4ae435e26e45d8a651b6f19..569e537a0e55112c28469de5d7e0574385a5886b 100644 (file)
@@ -181,9 +181,9 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
     }
 
     //to not cause uniqueness violation for accRole, createList is removed
-    @Override
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
     dependsOnMethods = {"create"})
+    @Override
     public void createList(String testName) throws Exception {
        //FIXME: Should this test really be empty?  If so, please comment accordingly.
     }
index 358804ef71b73a9edf2ce0473d39061aaba905f8..4aedd2722d3f3a6edbd588ab498b1af91ed6d28a 100644 (file)
@@ -29,7 +29,7 @@ public class AcquisitionClient extends AbstractServiceClientImpl {
     /**
      *
      */
-    private static final AcquisitionClient instance = new AcquisitionClient();
+//    private static final AcquisitionClient instance = new AcquisitionClient();
     /**
      *
      */
@@ -69,9 +69,9 @@ public class AcquisitionClient extends AbstractServiceClientImpl {
      *
      * @return
      */
-    public static AcquisitionClient getInstance() {
-        return instance;
-    }
+//    public static AcquisitionClient getInstance() {
+//        return instance;
+//    }
 
     /**
      * @return
index 5065ddb7855c5400dd29f82b38d7a44dcb132b61..291a8b2f94249f65cef8457c059aa5283f82c60f 100644 (file)
@@ -36,6 +36,7 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.core.UriInfo;
@@ -52,8 +53,7 @@ import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.query.IQueryManager;
 import org.collectionspace.services.common.query.QueryManager;
 import org.collectionspace.services.common.security.UnauthorizedException;
-import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
-import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
+import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
 import org.jboss.resteasy.util.HttpResponseCodes;
@@ -223,10 +223,11 @@ public class AcquisitionResource
     public AcquisitionsCommonList getAcquisitionList(@Context UriInfo ui,
                @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords) {
        AcquisitionsCommonList result = null;
+       MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
        if (keywords != null) {
-               result = searchAcquisitions(keywords);
+               result = searchAcquisitions(queryParams, keywords);
        } else {
-               result = getAcquisitionsList();
+               result = getAcquisitionsList(queryParams);
        }
        
        return result;
@@ -237,12 +238,12 @@ public class AcquisitionResource
      * 
      * @return the acquisitions list
      */
-    private AcquisitionsCommonList getAcquisitionsList() {
+    private AcquisitionsCommonList getAcquisitionsList(MultivaluedMap<String, String> queryParams) {
         AcquisitionsCommonList acquisitionObjectList;
         try {
-            ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();
+            ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
-            getRepositoryClient(ctx).getAll(ctx, handler);
+            getRepositoryClient(ctx).getFiltered(ctx, handler);
             acquisitionObjectList = (AcquisitionsCommonList) handler.getCommonPartList();
         } catch (UnauthorizedException ue) {
             Response response = Response.status(
@@ -366,9 +367,11 @@ public class AcquisitionResource
     @GET
     @Path("/search")    
     @Produces("application/xml")
+    @Deprecated    
     public AcquisitionsCommonList keywordsSearchAcquisitions(@Context UriInfo ui,
                @QueryParam (IQueryManager.SEARCH_TYPE_KEYWORDS) String keywords) {
-       return searchAcquisitions(keywords);
+       MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+       return searchAcquisitions(queryParams, keywords);
     }
     
     /**
@@ -378,10 +381,12 @@ public class AcquisitionResource
      * 
      * @return the acquisitions common list
      */
-    private AcquisitionsCommonList searchAcquisitions(String keywords) {
+    private AcquisitionsCommonList searchAcquisitions(
+               MultivaluedMap<String, String> queryParams,
+               String keywords) {
        AcquisitionsCommonList acquisitionObjectList;           
         try {
-            ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();
+            ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
 
             // perform a keyword search
@@ -392,12 +397,9 @@ public class AcquisitionResource
                    if (logger.isDebugEnabled()) {
                        logger.debug("The WHERE clause is: " + documentFilter.getWhereClause());
                    }
-                   getRepositoryClient(ctx).getFiltered(ctx, handler);
-            } else {
-               getRepositoryClient(ctx).getAll(ctx, handler);
-            }            
-            acquisitionObjectList = (AcquisitionsCommonList) handler.getCommonPartList();
-            
+            }
+            getRepositoryClient(ctx).getFiltered(ctx, handler);
+            acquisitionObjectList = (AcquisitionsCommonList) handler.getCommonPartList();            
         } catch (UnauthorizedException ue) {
             Response response = Response.status(
                     Response.Status.UNAUTHORIZED).entity("Index failed reason " + ue.getErrorReason()).type("text/plain").build();
@@ -432,8 +434,8 @@ public class AcquisitionResource
             ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();
             DocumentWrapper<DocumentModel> docWrapper = 
                getRepositoryClient(ctx).getDoc(ctx, csid);
-            RemoteDocumentModelHandlerImpl handler 
-               = (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
+            DocumentModelHandler<MultipartInput, MultipartOutput> handler 
+               = (DocumentModelHandler<MultipartInput, MultipartOutput>)createDocumentHandler(ctx);
             List<String> authRefFields = 
                ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(
                                ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);
index 981a48cb1335a7979eb50d9e9a978015b871a642..e1d7e05709a39aa6c1fa2de4be68e5aa823c8b72 100644 (file)
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
                     <systemProperties>
+                        <property>
+                            <name>maven.basedir</name>
+                            <value>${basedir}</value>
+                        </property>           
                         <property>
                             <name>log4j.configuration</name>
                             <value>file:${project.build.directory}/test-classes/log4j.properties</value>
index 259ae39c7891a6521ed564d1be9f306cccc644ee..585bdc3eee8b3eef608e5442596e466870f61664 100644 (file)
@@ -78,9 +78,18 @@ import org.testng.annotations.Test;
  */
 public abstract class AbstractAuthorizationTestImpl {
 
-    final Logger logger = LoggerFactory.getLogger(AbstractAuthorizationTestImpl.class);
+       static protected final String MAVEN_BASEDIR_PROPERTY = "maven.basedir";
+       final Logger logger = LoggerFactory.getLogger(AbstractAuthorizationTestImpl.class);
     private org.springframework.jdbc.datasource.DataSourceTransactionManager txManager;
     final static String testDataDir = "src/test/resources/test-data/";
+    static String baseDir;
+    static {
+       baseDir = System.getProperty(AbstractAuthorizationTestImpl.MAVEN_BASEDIR_PROPERTY);
+       if (baseDir == null || baseDir.isEmpty()) {
+               baseDir = System.getProperty("user.dir");
+       }
+       baseDir = baseDir + System.getProperty("file.separator");       
+    }
 
     /**
      * Returns the name of the currently running test.
index 8404f99752d60c5699009d3b16cb2e1c3928f74d..d45fffe97703d42316e84b56e959af594961aec5 100644 (file)
  */
 package org.collectionspace.services.authorization.test;
 
-import java.util.ArrayList;
-import java.util.List;
+//import java.util.ArrayList;
+//import java.util.List;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+//import org.collectionspace.services.client.test.BaseServiceTest;
 import org.collectionspace.services.authorization.AuthZ;
 import org.collectionspace.services.authorization.Permission;
 import org.collectionspace.services.authorization.PermissionRole;
@@ -62,20 +63,20 @@ public class AuthorizationSeedTest extends AbstractAuthorizationTestImpl {
     }
 
     public void seedRoles() throws Exception {
+       //Should this test really be empty?
     }
 
-    public void seedPermissions() throws Exception {
-
+    public void seedPermissions() throws Exception {           
         PermissionsList pcList =
-                (PermissionsList) fromFile(PermissionsList.class,
+                (PermissionsList) fromFile(PermissionsList.class, baseDir +
                 AbstractAuthorizationTestImpl.testDataDir + "test-permissions.xml");
         logger.info("read permissions from "
-                + AbstractAuthorizationTestImpl.testDataDir + "test-permissions.xml");
+                + baseDir + AbstractAuthorizationTestImpl.testDataDir + "test-permissions.xml");
         PermissionsRolesList pcrList =
-                (PermissionsRolesList) fromFile(PermissionsRolesList.class,
+                (PermissionsRolesList) fromFile(PermissionsRolesList.class, baseDir +
                 AbstractAuthorizationTestImpl.testDataDir + "test-permissions-roles.xml");
         logger.info("read permissions-roles from "
-                + AbstractAuthorizationTestImpl.testDataDir + "test-permissions.xml");
+                + baseDir + AbstractAuthorizationTestImpl.testDataDir + "test-permissions.xml");
         AuthZ authZ = AuthZ.get();
         for (Permission p : pcList.getPermissions()) {
             if (logger.isDebugEnabled()) {
index 5635bb6e000ffab20865f342f53b7e38e99d0cbf..4f82486a56e38ca2d7405e44b3af7519cf7f1bd7 100644 (file)
                 </exclusion>\r
             </exclusions>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>jaxrs-api</artifactId>\r
+        </dependency>        \r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
             <artifactId>resteasy-jaxb-provider</artifactId>\r
index d6da10add7796aca454c8c7473daea5e7a0e9f33..8d2dc3eb199846b9b979747d163f5710ff2b0655 100644 (file)
  */
 package org.collectionspace.services.client.test;
 
-import java.util.List;
+//import java.util.List;
 
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.client.CollectionSpaceClient;
-import org.collectionspace.services.client.AbstractServiceClientImpl;
+//import org.collectionspace.services.client.AbstractServiceClientImpl;
 import org.jboss.resteasy.client.ClientResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -50,6 +50,7 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
        
        /** The Constant DEFAULT_LIST_SIZE. */
        static protected final int DEFAULT_LIST_SIZE = 10;
+       static protected final int DEFAULT_PAGINATEDLIST_SIZE = 10;
 
 //    // Success outcomes
 //    /* (non-Javadoc)
@@ -243,7 +244,6 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
                ClientResponse<AbstractCommonList> response =
                        (ClientResponse<AbstractCommonList>)client.readList(Long.toString(pageSize),
                                        Long.toString(pageNumber));
-               AbstractCommonList list = this.getAbstractCommonList(response);
                int statusCode = response.getStatus();
 
                // Check the status code of the response: does it match
@@ -254,44 +254,115 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
                Assert.assertTrue(this.REQUEST_TYPE.isValidStatusCode(statusCode),
                                invalidStatusCodeMessage(this.REQUEST_TYPE, statusCode));
                Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE);
-               
+
+               AbstractCommonList list = this.getAbstractCommonList(response);         
                return list;
        }
 
+    /**
+     * Creates the list.
+     *
+     * @param testName the test name
+     * @param listSize the list size
+     * @throws Exception the exception
+     */
+    protected void createPaginatedList(String testName, int listSize) throws Exception {
+        for (int i = 0; i < listSize; i++) {
+            create(testName);
+        }
+    }
+       
+    /*@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    public void leafCeate(String testName) throws Exception {
+       this.create(testName);
+    }*/
+    
+    private void assertPaginationInfo(String testName,
+               AbstractCommonList list,
+               long expectedPageNum,
+               long expectedPageSize,
+               long expectedListSize,
+               long expectedTotalItems) {
+       Assert.assertNotNull(list);
+       
+       long pageNum = list.getPageNum();
+       Assert.assertEquals(pageNum, expectedPageNum);
+       if (getLogger().isDebugEnabled() == true) {
+               getLogger().debug(testName + ":" + "page number is " + pageNum);
+       }
+       
+       long pageSizeReturned = list.getPageSize();
+       Assert.assertEquals(pageSizeReturned, expectedPageSize);
+       if (getLogger().isDebugEnabled() == true) {
+               getLogger().debug(testName + ":" + "page size is " + list.getPageSize());
+       }
+       
+       long itemsInPage = list.getItemsInPage();
+       Assert.assertEquals(itemsInPage, expectedListSize);
+       if (getLogger().isDebugEnabled() == true) {
+               getLogger().debug(testName + ":" + "actual items in page was/were " + itemsInPage);
+       }               
+       
+       long totalItemsReturned = list.getTotalItems();
+       Assert.assertEquals(totalItemsReturned, expectedTotalItems);
+       if (getLogger().isDebugEnabled() == true) {
+               getLogger().debug(testName + ":" + "total number of items is " + list.getTotalItems());
+       }        
+    }
+    
        /**
         * Read paginated list.
         *
         * @param testName the test name
         * @throws Exception the exception
         */
-       @Test(dataProvider = "testName")
+    @Test(dataProvider = "testName") /*, dataProviderClass = AbstractServiceTestImpl.class,
+           dependsOnMethods = {"leafCeate"}) */
     public void readPaginatedList(String testName) throws Exception {
-
         // Perform setup.
         setupReadList(testName);
-        
-        long pageSize = DEFAULT_LIST_SIZE / 3; //create 3 pages to iterate over
         CollectionSpaceClient client = this.getClientInstance();
-        AbstractCommonList list = this.readList(testName, client, pageSize, 0);
-        long totalItems = list.getTotalItems();        
-        long pagesTotal = totalItems / pageSize;
+        
+        // Get the current total number of items.
+        // If there are no items then create some
+        AbstractCommonList list = this.readList(testName, client, 1 /*pgSz*/, 0 /*pgNum*/);
+        if (list == null || list.getTotalItems() == 0) {
+               this.createPaginatedList(testName, DEFAULT_PAGINATEDLIST_SIZE);
+               list = this.readList(testName, client, 1 /*pgSz*/, 0 /*pgNum*/);
+        }
+
+        // Print out the current list size to be paginated
+        Assert.assertNotNull(list);
+        long totalItems = list.getTotalItems();
+        Assert.assertFalse(totalItems == 0);
+        if (getLogger().isDebugEnabled() == true) {
+               getLogger().debug(testName + ":" + "created list of " + 
+                               totalItems + " to be paginated.");
+        }
+        
+        long pageSize = totalItems / 3; //create up to 3 pages to iterate over
+        long pagesTotal = pageSize > 0 ? (totalItems / pageSize) : 0;
         for (int i = 0; i < pagesTotal; i++) {
                list = this.readList(testName, client, pageSize, i);
-               if (getLogger().isDebugEnabled() == true) {
-                       getLogger().debug(testName + ":" + "page number is " + list.getPageNum());
-                       getLogger().debug(testName + ":" + "page size is " + list.getPageSize());
-                       getLogger().debug(testName + ":" + "total number of items is " + list.getTotalItems());
-               }
+               assertPaginationInfo(testName,
+                               list,
+                               i,                      //expected page number
+                               pageSize,       //expected page size
+                               pageSize,       //expected num of items in page
+                               totalItems);//expected total num of items
         }
         
+        // if there are any remainders be sure to paginate them as well
         long mod = totalItems % pageSize;
         if (mod != 0) {
                list = this.readList(testName, client, pageSize, pagesTotal);
-               getLogger().debug(testName + ":" + "page number is " + list.getPageNum());
-               getLogger().debug(testName + ":" + "page size is " + list.getPageSize());
-               getLogger().debug(testName + ":" + "total number of items is " + list.getTotalItems());
+               assertPaginationInfo(testName,
+                               list, 
+                               pagesTotal, //expected page number
+                               pageSize,       //expected page size
+                               mod,            //expected num of items in page
+                               totalItems);//expected total num of items
         }
-        
     }
 
        // ---------------------------------------------------------------
index bf87cd4a60dd8e064089da21dfc55258d744525d..0f2f42ac0e436b0e6257a7af06c8ea8dd9be7f99 100644 (file)
@@ -66,6 +66,9 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
  */\r
 public abstract class BaseServiceTest {\r
 \r
+       //Maven's base directory -i.e., the one containing the current pom.xml\r
+       static protected final String MAVEN_BASEDIR_PROPERTY = "maven.basedir";\r
+       \r
     /** The Constant logger. */\r
     static protected final Logger logger = LoggerFactory.getLogger(BaseServiceTest.class);\r
     \r
index f1861d2c68d3a82a8c1762f92680b0b0224088ea..f993942dbcc62e480b64b165e57bf5eb9d3d3bdf 100644 (file)
@@ -27,7 +27,7 @@ import java.util.List;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import org.collectionspace.services.client.AbstractServiceClientImpl;
+//import org.collectionspace.services.client.AbstractServiceClientImpl;
 import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
@@ -64,7 +64,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     private String knownResourceId = null;
     
     /** The all resource ids created. */
-    private List<String> allResourceIdsCreated = new ArrayList();
+    private List<String> allResourceIdsCreated = new ArrayList<String>();
     
     /** The multivalue. */
     private boolean multivalue; //toggle
@@ -260,7 +260,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         }
         testSubmitRequest(newId);
     }
-
+    
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.ServiceTest#createList()
      */
@@ -268,9 +268,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
     dependsOnMethods = {"create"})
     public void createList(String testName) throws Exception {
-        for (int i = 0; i < DEFAULT_LIST_SIZE; i++) {
-            create(testName);
-        }
+       this.createPaginatedList(testName, DEFAULT_LIST_SIZE);
     }
 
     // Failure outcomes
@@ -282,6 +280,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     @Override
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void createWithEmptyEntityBody(String testName) throws Exception {
+       //FIXME: Should this test really be empty?
     }
 
    /**
@@ -304,6 +303,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     @Override
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void createWithWrongXmlSchema(String testName) throws Exception {
+       //FIXME: Should this test really be empty?
     }
 
 
@@ -399,6 +399,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     * @param testName  The name of this test method.  This name is supplied
     *     automatically, via reflection, by a TestNG 'data provider' in
     *     a base class.
+    * @throws Exception 
     */
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void createWithRequiredValuesNullOrEmpty(String testName) throws Exception {
@@ -689,6 +690,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
     dependsOnMethods = {"read"})
     public void updateWithEmptyEntityBody(String testName) throws Exception {
+       //FIXME: Should this test really be empty?
     }
 
    /**
@@ -703,6 +705,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
     dependsOnMethods = {"read"})
     public void updateWithMalformedXml(String testName) throws Exception {
+       //FIXME: Should this test really be empty?
     }
 
     /* (non-Javadoc)
@@ -712,6 +715,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
     dependsOnMethods = {"read"})
     public void updateWithWrongXmlSchema(String testName) throws Exception {
+       //FIXME: Should this test really be empty?
     }
 
 /*
@@ -839,6 +843,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     * @param testName  The name of this test method.  This name is supplied
     *     automatically, via reflection, by a TestNG 'data provider' in
     *     a base class.
+ * @throws Exception 
     */
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
     dependsOnMethods = {"read"})
@@ -944,6 +949,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     /**
      * Tests the code for manually submitting data that is used by several
      * of the methods above.
+     * @throws Exception 
      */
 
     @Test(dependsOnMethods = {"create", "read"})
index ef0bf24c2ddaa4ca8a8de8cb6d8857cec13de23d..021879c4d1ca72697237fe661df863dc94cdc3b8 100644 (file)
@@ -238,7 +238,7 @@ public class CollectionObjectResource
     public CollectionobjectsCommonList getCollectionObjectList(@Context UriInfo ui,
                @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords) {
        CollectionobjectsCommonList result = null;
-       MultivaluedMap queryParams = ui.getQueryParameters();
+       MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
        if (keywords != null) {
                result = searchCollectionObjects(queryParams, keywords);
        } else {
@@ -251,7 +251,7 @@ public class CollectionObjectResource
     /**
      * Gets the collection object list.
      */
-    private CollectionobjectsCommonList getCollectionObjectList(MultivaluedMap queryParams) {
+    private CollectionobjectsCommonList getCollectionObjectList(MultivaluedMap<String, String> queryParams) {
         CollectionobjectsCommonList collectionObjectList;
         try {
             ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
@@ -385,6 +385,7 @@ public class CollectionObjectResource
     public IntakesCommonList getIntakesCommonList(@Context UriInfo ui,
                @PathParam("csid") String csid) {
         IntakesCommonList result = null;       
+       MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
         
         try {
                //
@@ -393,8 +394,9 @@ public class CollectionObjectResource
                String subjectCsid = csid;
                String predicate = RelationshipType.COLLECTIONOBJECT_INTAKE.value();
                String objectCsid = null;
-               NewRelationResource relationResource = new NewRelationResource();               
-               RelationsCommonList relationsCommonList = relationResource.getRelationList(subjectCsid, predicate, objectCsid);
+               NewRelationResource relationResource = new NewRelationResource();
+               RelationsCommonList relationsCommonList = relationResource.getRelationList(queryParams,
+                               subjectCsid, predicate, objectCsid);
                
                //
                // Create an array of Intake csid's
@@ -438,7 +440,8 @@ public class CollectionObjectResource
                @Context UriInfo ui) {
        AuthorityRefList authRefList = null;
         try {
-            ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+            ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
             DocumentWrapper<DocumentModel> docWrapper = 
                getRepositoryClient(ctx).getDoc(ctx, csid);
             DocumentModelHandler<MultipartInput, MultipartOutput> docHandler = 
@@ -501,7 +504,7 @@ public class CollectionObjectResource
     @Produces("application/xml")
     public CollectionobjectsCommonList keywordsSearchCollectionObjects(@Context UriInfo ui,
             @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS) String keywords) {
-       MultivaluedMap queryParams = ui.getQueryParameters();
+       MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
        return searchCollectionObjects(queryParams, keywords);
     }    
     
index 4a11f52e9eb34d5e942d11acc00426980994a8dc..54d821bf48b5ceab1ce6178037edaddb41ab7f35 100644 (file)
@@ -29,8 +29,6 @@ import java.util.List;
 import java.util.Map;
 import javax.ws.rs.core.MultivaluedMap;
 
-import org.collectionspace.authentication.AuthN;
-
 import org.collectionspace.services.common.ClientType;
 import org.collectionspace.services.common.ServiceMain;
 import org.collectionspace.services.common.config.PropertyItemUtils;
@@ -89,9 +87,15 @@ public abstract class AbstractServiceContextImpl<IT, OT>
     /** security context */
     private SecurityContext securityContext;
 
+    /**
+     * Instantiates a new abstract service context impl.
+     */
     private AbstractServiceContextImpl() {
-    } // private constructor for singleton pattern
+       // private constructor for singleton pattern
+    } 
+
     // request query params
+    /** The query params. */
     private MultivaluedMap<String, String> queryParams;
 
     /**
@@ -133,18 +137,16 @@ public abstract class AbstractServiceContextImpl<IT, OT>
         }
     }
 
-    /**
-     * getCommonPartLabel get common part label
-     * @return
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.context.ServiceContext#getCommonPartLabel()
      */
     @Override
     public String getCommonPartLabel() {
         return getCommonPartLabel(getServiceName());
     }
 
-    /**
-     * getCommonPartLabel get common part label
-     * @return
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.context.ServiceContext#getCommonPartLabel(java.lang.String)
      */
     public String getCommonPartLabel(String schemaName) {
         return schemaName.toLowerCase() + PART_LABEL_SEPERATOR + PART_COMMON_LABEL;
@@ -316,11 +318,17 @@ public abstract class AbstractServiceContextImpl<IT, OT>
         overrideDocumentType = docType;
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.context.ServiceContext#getSecurityContext()
+     */
     @Override
     public SecurityContext getSecurityContext() {
         return securityContext;
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.context.ServiceContext#getUserId()
+     */
     @Override
     public String getUserId() {
         return securityContext.getUserId();
@@ -422,7 +430,7 @@ public abstract class AbstractServiceContextImpl<IT, OT>
      */
     private DocumentHandler createDocumentHandlerInstance() throws Exception {
         ClassLoader tccl = Thread.currentThread().getContextClassLoader();
-        Class c = tccl.loadClass(getDocumentHandlerClass());
+        Class<?> c = tccl.loadClass(getDocumentHandlerClass());
         if (DocumentHandler.class.isAssignableFrom(c)) {
             docHandler = (DocumentHandler) c.newInstance();
         } else {
@@ -495,7 +503,7 @@ public abstract class AbstractServiceContextImpl<IT, OT>
         ClassLoader tccl = Thread.currentThread().getContextClassLoader();
         for (String clazz : handlerClazzes) {
             clazz = clazz.trim();
-            Class c = tccl.loadClass(clazz);
+            Class<?> c = tccl.loadClass(clazz);
             if (ValidatorHandler.class.isAssignableFrom(c)) {
                 handlers.add((ValidatorHandler) c.newInstance());
             }
@@ -524,13 +532,19 @@ public abstract class AbstractServiceContextImpl<IT, OT>
         return msg.toString();
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.context.ServiceContext#getQueryParams()
+     */
     @Override
     public MultivaluedMap<String, String> getQueryParams() {
         return this.queryParams;
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.context.ServiceContext#setQueryParams(javax.ws.rs.core.MultivaluedMap)
+     */
     @Override
-    public void setQueryParams(MultivaluedMap<String, String> queryParams) {
-        this.queryParams = queryParams;
+    public void setQueryParams(MultivaluedMap<String, String> theQueryParams) {
+        this.queryParams = theQueryParams;
     }
 }
index dbcb98eb51e704de76690a508100fe85ea536b83..22eaa36b97ea00b5442266e856b9cc5139f108b5 100644 (file)
@@ -120,8 +120,10 @@ public abstract class RemoteDocumentModelHandlerImpl<T, TL>
        // set the page size and page numer
        commonList.setPageNum(pageNum);
        commonList.setPageSize(pageSize);
-       // set the total result size
        DocumentModelList docList = wrapDoc.getWrappedObject();
+       // Set num of items in list. this is useful to our testing framework.
+       commonList.setItemsInPage(docList.size());
+       // set the total result size
        commonList.setTotalItems(docList.totalSize());
        
        return (TL)commonList;
index a5c2da88b8ec8472fe2bdb06eedd5f3be5287588..d0615a8437bafc9a7e80f68d241e058ad61cdf40 100644 (file)
@@ -46,7 +46,7 @@ public class ContactClient extends AbstractServiceClientImpl {
        /**
      *
      */
-    private static final ContactClient instance = new ContactClient();
+//    private static final ContactClient instance = new ContactClient();
     
     /**
      *
@@ -87,9 +87,9 @@ public class ContactClient extends AbstractServiceClientImpl {
      *
      * @return
      */
-    public static ContactClient getInstance() {
-        return instance;
-    }
+//    public static ContactClient getInstance() {
+//        return instance;
+//    }
 
     /**
      * @return
index 0a4d898268e2234ed78cd7f3a453513512378855..438e59e00b04d139ee3d64e746081afb138f9e90 100644 (file)
@@ -33,6 +33,7 @@ import javax.ws.rs.PUT;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.core.UriInfo;
@@ -40,8 +41,6 @@ import javax.ws.rs.core.UriInfo;
 import org.collectionspace.services.common.AbstractMultiPartCollectionSpaceResourceImpl;
 import org.collectionspace.services.common.ClientType;
 import org.collectionspace.services.common.ServiceMain;
-import org.collectionspace.services.common.context.MultipartServiceContext;
-import org.collectionspace.services.common.context.MultipartServiceContextFactory;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.document.DocumentHandler;
@@ -206,11 +205,12 @@ public class ContactResource extends
     @GET
     @Produces("application/xml")
     public ContactsCommonList getContactList(@Context UriInfo ui) {
+       MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
         ContactsCommonList contactObjectList = new ContactsCommonList();
         try {
-            ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();
+            ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
-            getRepositoryClient(ctx).getAll(ctx, handler);
+            getRepositoryClient(ctx).getFiltered(ctx, handler);
             contactObjectList = (ContactsCommonList) handler.getCommonPartList();
         } catch (Exception e) {
             if (logger.isDebugEnabled()) {
index ab26a2e5daf896a2d62bbd1a8a7e420e84973eb4..9d42e934f94e12dec5e8d5ff59f3f4dbbb17790b 100644 (file)
@@ -55,7 +55,7 @@ public class DimensionClient extends AbstractServiceClientImpl {
        /**
      *
      */
-    private static final DimensionClient instance = new DimensionClient();
+//    private static final DimensionClient instance = new DimensionClient();
     
     /**
      *
@@ -96,9 +96,9 @@ public class DimensionClient extends AbstractServiceClientImpl {
      *
      * @return
      */
-    public static DimensionClient getInstance() {
-        return instance;
-    }
+//    public static DimensionClient getInstance() {
+//        return instance;
+//    }
 
     /**
      * @return
index e0898e7882abb2c0ff4c04f9a0b9d3369fe514ea..2f195dcb6d893d9619e23b52357c1658bb63b422 100644 (file)
@@ -60,7 +60,7 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
     // Instance variables specific to this test.
     final String SERVICE_PATH_COMPONENT = "dimensions";
     private String knownResourceId = null;
-    private List<String> allResourceIdsCreated = new ArrayList();
+    private List<String> allResourceIdsCreated = new ArrayList<String>();
 
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
index d3cec99b822aca0d0e23e5b7a6752f0c231518cb..65c6ece816f5146298ae47fcc60ece115ce40bc3 100644 (file)
@@ -212,7 +212,7 @@ public class DimensionResource extends
         try {
                ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
-            getRepositoryClient(ctx).getAll(ctx, handler);
+            getRepositoryClient(ctx).getFiltered(ctx, handler);
             dimensionObjectList = (DimensionsCommonList) handler.getCommonPartList();
         } catch (Exception e) {
             if (logger.isDebugEnabled()) {
index cb215bec2bced863462529e1f536b97061ba1b88..93daec817e3d8cf48494c2e99dce06cb4ec51729 100644 (file)
@@ -57,7 +57,7 @@ public class IntakeClient extends AbstractServiceClientImpl {
     /**
      *
      */
-    private static final IntakeClient instance = new IntakeClient();
+//    private static final IntakeClient instance = new IntakeClient();
     /**
      *
      */
@@ -97,9 +97,9 @@ public class IntakeClient extends AbstractServiceClientImpl {
      *
      * @return
      */
-    public static IntakeClient getInstance() {
-        return instance;
-    }
+//    public static IntakeClient getInstance() {
+//        return instance;
+//    }
 
     /**
      * @return
index 7577b9e842b20c9ed89f52e34e9cbbd760e9147f..22bc8372856860f0e8d2c5b8319aac4155cb450a 100644 (file)
@@ -288,16 +288,18 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
         IntakeClient intakeClient = new IntakeClient();
-        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Note: Any non-success responses are ignored and not reported.
         for (String resourceId : intakeIdsCreated) {
             ClientResponse<Response> res = intakeClient.delete(resourceId);
         }
         // Delete persons before PersonAuth
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         for (String resourceId : personIdsCreated) {
             ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
         }
-        ClientResponse<Response> res = personAuthClient.delete(personAuthCSID);
+        if (personAuthCSID != null) {
+               personAuthClient.delete(personAuthCSID);
+        }
     }
 
     // ---------------------------------------------------------------
index 797b8aa5be8fd53f4696dee1078f089480102a88..18a0a43cdd412fae2f9d5fc4aa1213b997cd590d 100644 (file)
@@ -59,6 +59,7 @@ import org.collectionspace.services.common.query.IQueryManager;
 import org.collectionspace.services.common.query.QueryManager;
 import org.collectionspace.services.common.security.UnauthorizedException;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
+import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
@@ -255,7 +256,7 @@ public class IntakeResource extends
         try {
                ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
-            getRepositoryClient(ctx).getAll(ctx, handler);
+            getRepositoryClient(ctx).getFiltered(ctx, handler);
             intakeObjectList = (IntakesCommonList) handler.getCommonPartList();
         } catch (UnauthorizedException ue) {
             Response response = Response.status(
@@ -292,8 +293,8 @@ public class IntakeResource extends
                ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
             DocumentWrapper<DocumentModel> docWrapper = 
                getRepositoryClient(ctx).getDoc(ctx, csid);
-            RemoteDocumentModelHandlerImpl handler 
-               = (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
+            DocumentModelHandler<MultipartInput, MultipartOutput> handler 
+               = (DocumentModelHandler<MultipartInput, MultipartOutput>)createDocumentHandler(ctx);
             List<String> authRefFields = 
                ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(
                                ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);
@@ -474,13 +475,10 @@ public class IntakeResource extends
                    documentFilter.setWhereClause(whereClause);
                    if (logger.isDebugEnabled()) {
                        logger.debug("The WHERE clause is: " + documentFilter.getWhereClause());
-                   }
-                   getRepositoryClient(ctx).getFiltered(ctx, handler);
-            } else {
-               getRepositoryClient(ctx).getAll(ctx, handler);
-            }            
-            intakesObjectList = (IntakesCommonList) handler.getCommonPartList();
-            
+                   }               
+            }
+            getRepositoryClient(ctx).getFiltered(ctx, handler);
+            intakesObjectList = (IntakesCommonList) handler.getCommonPartList();            
         } catch (UnauthorizedException ue) {
             Response response = Response.status(
                     Response.Status.UNAUTHORIZED).entity("Index failed reason " + ue.getErrorReason()).type("text/plain").build();
index f71f4927ddfa1853f42e9a7da2e3fec307c392d1..947f111a51af99f3820b5fdd75aeccc8a0c3e3f7 100644 (file)
             <xs:sequence>
                 <xs:element name="pageNum" type="xs:unsignedInt" />
                 <xs:element name="pageSize" type="xs:unsignedInt" />
+                <!-- "itemsInPage" is useful to our testing framework's unit tests -->
+                <xs:element name="itemsInPage" type="xs:unsignedInt" />
                 <xs:element name="totalItems" type="xs:unsignedInt" />
             </xs:sequence>
         </xs:complexType>
     </xs:element>
     
-</xs:schema>
-
+</xs:schema>
\ No newline at end of file
index 405448e9b1f9b35c7c595aa02a2e825852e73d48..1e6ebeeaebfa0c804abcd230511a2b7eb771b3f8 100644 (file)
@@ -48,7 +48,7 @@ public class LoaninClient extends AbstractServiceClientImpl {
     /**
      *
      */
-    private static final LoaninClient instance = new LoaninClient();
+//    private static final LoaninClient instance = new LoaninClient();
     /**
      *
      */
@@ -88,9 +88,9 @@ public class LoaninClient extends AbstractServiceClientImpl {
      *
      * @return
      */
-    public static LoaninClient getInstance() {
-        return instance;
-    }
+//    public static LoaninClient getInstance() {
+//        return instance;
+//    }
 
     /**
      * @return
index db34e6b4f8790501e8816217aa7013a99ef9671d..5ccf8709b55d80c75f4b6b7bbee0b9705e4c04e1 100644 (file)
@@ -36,10 +36,10 @@ import org.collectionspace.services.client.LoaninClient;
 import org.collectionspace.services.client.PersonAuthorityClient;
 import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.common.authorityref.AuthorityRefList;
-import org.collectionspace.services.common.authorityref.AuthorityRefList.AuthorityRefItem;
+//import org.collectionspace.services.common.authorityref.AuthorityRefList.AuthorityRefItem;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.loanin.LoansinCommon;
-import org.collectionspace.services.loanin.LoansinCommonList;
+//import org.collectionspace.services.loanin.LoansinCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
 
@@ -69,8 +69,8 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
     final String SERVICE_PATH_COMPONENT = "loansin";
     final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
     private String knownResourceId = null;
-    private List<String> loaninIdsCreated = new ArrayList();
-    private List<String> personIdsCreated = new ArrayList();
+    private List<String> loaninIdsCreated = new ArrayList<String>();
+    private List<String> personIdsCreated = new ArrayList<String>();
     private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
     private int OK_STATUS = Response.Status.OK.getStatusCode();
     private String personAuthCSID = null;
@@ -304,19 +304,22 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
         }
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Delete Person resource(s) (before PersonAuthority resources).
-        ClientResponse<Response> res;
+        
         for (String resourceId : personIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
-            res = personAuthClient.deleteItem(personAuthCSID, resourceId);
+               personAuthClient.deleteItem(personAuthCSID, resourceId);
         }
+        
         // Delete PersonAuthority resource(s).
         // Note: Any non-success response is ignored and not reported.
-        res = personAuthClient.delete(personAuthCSID);
-        // Delete Loans In resource(s).
-        LoaninClient loaninClient = new LoaninClient();
-        for (String resourceId : loaninIdsCreated) {
-            // Note: Any non-success responses are ignored and not reported.
-            res = loaninClient.delete(resourceId);
+        if (personAuthCSID != null) {
+               personAuthClient.delete(personAuthCSID);
+               // Delete Loans In resource(s).
+               LoaninClient loaninClient = new LoaninClient();
+               for (String resourceId : loaninIdsCreated) {
+                   // Note: Any non-success responses are ignored and not reported.
+                   loaninClient.delete(resourceId);
+               }
         }
     }
 
index de642b32cee7b22676284cb2f6a2dee9c4a4dabf..cdef47adc5f7b67cf87c11756c4a16cf06bb57ae 100644 (file)
@@ -58,6 +58,7 @@ import org.collectionspace.services.common.query.IQueryManager;
 import org.collectionspace.services.common.query.QueryManager;
 import org.collectionspace.services.common.security.UnauthorizedException;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
+import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
@@ -253,7 +254,7 @@ public class LoaninResource extends
         try {
                ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
-            getRepositoryClient(ctx).getAll(ctx, handler);
+            getRepositoryClient(ctx).getFiltered(ctx, handler);
             loaninObjectList = (LoansinCommonList) handler.getCommonPartList();
         } catch (UnauthorizedException ue) {
             Response response = Response.status(
@@ -290,8 +291,8 @@ public class LoaninResource extends
                ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
             DocumentWrapper<DocumentModel> docWrapper = 
                getRepositoryClient(ctx).getDoc(ctx, csid);
-            RemoteDocumentModelHandlerImpl handler 
-               = (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
+            DocumentModelHandler<MultipartInput, MultipartOutput> handler 
+               = (DocumentModelHandler<MultipartInput, MultipartOutput>)createDocumentHandler(ctx);
             List<String> authRefFields = 
                ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(
                                ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);
@@ -441,7 +442,8 @@ public class LoaninResource extends
      * 
      * @return the loansin common list
      */
-    private LoansinCommonList searchLoansin(MultivaluedMap<String, String> queryParams,
+    private LoansinCommonList searchLoansin(
+               MultivaluedMap<String, String> queryParams,
                String keywords) {
        LoansinCommonList loansinObjectList;
         try {
@@ -456,12 +458,9 @@ public class LoaninResource extends
                    if (logger.isDebugEnabled()) {
                        logger.debug("The WHERE clause is: " + documentFilter.getWhereClause());
                    }
-                   getRepositoryClient(ctx).getFiltered(ctx, handler);
-            } else {
-               getRepositoryClient(ctx).getAll(ctx, handler);
-            }            
-            loansinObjectList = (LoansinCommonList) handler.getCommonPartList();
-            
+            }
+            getRepositoryClient(ctx).getFiltered(ctx, handler);
+            loansinObjectList = (LoansinCommonList) handler.getCommonPartList();            
         } catch (UnauthorizedException ue) {
             Response response = Response.status(
                     Response.Status.UNAUTHORIZED).entity("Index failed reason " + ue.getErrorReason()).type("text/plain").build();
index 8771e1ae1224f0ac8878091180c3c97c966f92ed..91445135126ec7473a8021d60249af1795b5aa4d 100644 (file)
@@ -48,7 +48,7 @@ public class LoanoutClient extends AbstractServiceClientImpl {
     /**
      *
      */
-    private static final LoanoutClient instance = new LoanoutClient();
+//    private static final LoanoutClient instance = new LoanoutClient();
     /**
      *
      */
@@ -88,9 +88,9 @@ public class LoanoutClient extends AbstractServiceClientImpl {
      *
      * @return
      */
-    public static LoanoutClient getInstance() {
-        return instance;
-    }
+//    public static LoanoutClient getInstance() {
+//        return instance;
+//    }
 
     /**
      * @return
index ef19f4c5f4eaa2f5cfa9c2fff59982501fb5a948..bec4f99400092ad042c3d2a0f5914f557f06912c 100644 (file)
@@ -36,10 +36,10 @@ import org.collectionspace.services.client.LoanoutClient;
 import org.collectionspace.services.client.PersonAuthorityClient;
 import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.common.authorityref.AuthorityRefList;
-import org.collectionspace.services.common.authorityref.AuthorityRefList.AuthorityRefItem;
+//import org.collectionspace.services.common.authorityref.AuthorityRefList.AuthorityRefItem;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.loanout.LoansoutCommon;
-import org.collectionspace.services.loanout.LoansoutCommonList;
+//import org.collectionspace.services.loanout.LoansoutCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
 
@@ -69,8 +69,8 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
     final String SERVICE_PATH_COMPONENT = "loansout";
     final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
     private String knownResourceId = null;
-    private List<String> loanoutIdsCreated = new ArrayList();
-    private List<String> personIdsCreated = new ArrayList();
+    private List<String> loanoutIdsCreated = new ArrayList<String>();
+    private List<String> personIdsCreated = new ArrayList<String>();
     private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
     private int OK_STATUS = Response.Status.OK.getStatusCode();
     private String personAuthCSID = null;
@@ -300,19 +300,20 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
         }
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Delete Person resource(s) (before PersonAuthority resources).
-        ClientResponse<Response> res;
         for (String resourceId : personIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
-            res = personAuthClient.deleteItem(personAuthCSID, resourceId);
+            personAuthClient.deleteItem(personAuthCSID, resourceId);
         }
         // Delete PersonAuthority resource(s).
         // Note: Any non-success response is ignored and not reported.
-        res = personAuthClient.delete(personAuthCSID);
-        // Delete Loans In resource(s).
-        LoanoutClient loanoutClient = new LoanoutClient();
-        for (String resourceId : loanoutIdsCreated) {
-            // Note: Any non-success responses are ignored and not reported.
-            res = loanoutClient.delete(resourceId);
+        if (personAuthCSID != null) {
+               personAuthClient.delete(personAuthCSID);
+               // Delete Loans In resource(s).
+               LoanoutClient loanoutClient = new LoanoutClient();
+               for (String resourceId : loanoutIdsCreated) {
+                   // Note: Any non-success responses are ignored and not reported.
+                   loanoutClient.delete(resourceId);
+               }
         }
     }
 
index bf6ef7c564938e5630eda907bc2c42fdbe8baf6f..36350a66985e6ac8e6ea029ce81649a166a9b6e0 100644 (file)
@@ -45,8 +45,6 @@ import org.collectionspace.services.common.AbstractMultiPartCollectionSpaceResou
 import org.collectionspace.services.common.ClientType;
 import org.collectionspace.services.common.ServiceMain;
 import org.collectionspace.services.common.authorityref.AuthorityRefList;
-import org.collectionspace.services.common.context.MultipartServiceContext;
-import org.collectionspace.services.common.context.MultipartServiceContextFactory;
 import org.collectionspace.services.common.context.MultipartServiceContextImpl;
 import org.collectionspace.services.common.context.ServiceBindingUtils;
 import org.collectionspace.services.common.context.ServiceContext;
@@ -57,7 +55,7 @@ import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.query.IQueryManager;
 import org.collectionspace.services.common.query.QueryManager;
 import org.collectionspace.services.common.security.UnauthorizedException;
-import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
+import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
@@ -253,7 +251,7 @@ public class LoanoutResource extends
         try {
                ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
-            getRepositoryClient(ctx).getAll(ctx, handler);
+            getRepositoryClient(ctx).getFiltered(ctx, handler);
             loanoutObjectList = (LoansoutCommonList) handler.getCommonPartList();
         } catch (UnauthorizedException ue) {
             Response response = Response.status(
@@ -290,8 +288,8 @@ public class LoanoutResource extends
                ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
             DocumentWrapper<DocumentModel> docWrapper = 
                getRepositoryClient(ctx).getDoc(ctx, csid);
-            RemoteDocumentModelHandlerImpl handler 
-               = (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
+            DocumentModelHandler<MultipartInput, MultipartOutput> handler 
+               = (DocumentModelHandler<MultipartInput, MultipartOutput>)createDocumentHandler(ctx);
             List<String> authRefFields = 
                ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(
                                ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);
@@ -456,12 +454,9 @@ public class LoanoutResource extends
                    if (logger.isDebugEnabled()) {
                        logger.debug("The WHERE clause is: " + documentFilter.getWhereClause());
                    }
-                   getRepositoryClient(ctx).getFiltered(ctx, handler);
-            } else {
-               getRepositoryClient(ctx).getAll(ctx, handler);
-            }            
+            }
+            getRepositoryClient(ctx).getFiltered(ctx, handler);
             loansoutObjectList = (LoansoutCommonList) handler.getCommonPartList();
-            
         } catch (UnauthorizedException ue) {
             Response response = Response.status(
                     Response.Status.UNAUTHORIZED).entity("Index failed reason " + ue.getErrorReason()).type("text/plain").build();
index 95b2195a12629e35a826a193a80cbd93ac144f09..5894be657a1110a31513fd548a3c85111cfeb7c9 100644 (file)
@@ -1,6 +1,32 @@
+/**    
+ * OrgAuthorityClient.java
+ *
+ * {Purpose of This Class}
+ *
+ * {Other Notes Relating to This Class (Optional)}
+ *
+ * $LastChangedBy: $
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ *
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 {Contributing Institution}
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ */
 package org.collectionspace.services.client;
 
-import javax.ws.rs.PathParam;
+//import javax.ws.rs.PathParam;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.common.authorityref.AuthorityRefList;
@@ -16,9 +42,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
 
 /**
- * A OrgAuthorityClient.
-
- * @version $Revision:$
+ * The Class OrgAuthorityClient.
  */
 public class OrgAuthorityClient extends AbstractServiceClientImpl {
 
@@ -30,22 +54,23 @@ public class OrgAuthorityClient extends AbstractServiceClientImpl {
         return "orgauthorities";
     }
 
-    public String getItemCommonPartName() {
-        return getCommonPartName("organizations");
-    }
-    /**
-     *
-     */
-    private static final OrgAuthorityClient instance = new OrgAuthorityClient();
     /**
+     * Gets the item common part name.
      *
+     * @return the item common part name
      */
+    public String getItemCommonPartName() {
+        return getCommonPartName("organizations");
+    }
+    
+    /** The Constant instance. */  //FIXME: This is wrong.  There should NOT be a static instance of the OrgAuthorityClient class
+//    private static final OrgAuthorityClient instance = new OrgAuthorityClient();
+    
+    /** The org authority proxy. */
     private OrgAuthorityProxy orgAuthorityProxy;
 
     /**
-     *
-     * Default constructor for OrgAuthorityClient class.
-     *
+     * Instantiates a new org authority client.
      */
     public OrgAuthorityClient() {
         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
@@ -53,13 +78,16 @@ public class OrgAuthorityClient extends AbstractServiceClientImpl {
         setProxy();
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.CollectionSpaceClient#getProxy()
+     */
     @Override
     public CollectionSpaceProxy getProxy() {
        return this.orgAuthorityProxy;
     }    
 
     /**
-     * allow to reset proxy as per security needs
+     * Sets the proxy.
      */
     public void setProxy() {
         if (useAuth()) {
@@ -72,54 +100,59 @@ public class OrgAuthorityClient extends AbstractServiceClientImpl {
     }
 
     /**
-     * FIXME Comment this
+     * Gets the single instance of OrgAuthorityClient.
      *
-     * @return
+     * @return single instance of OrgAuthorityClient //FIXME: This is wrong.  There should NOT be a static instance of the client
      */
-    public static OrgAuthorityClient getInstance() {
-        return instance;
-    }
+//    public static OrgAuthorityClient getInstance() {
+//        return instance;
+//    }
 
     /**
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#readList()
+     * Read list.
+     *
+     * @return the client response
      */
     public ClientResponse<OrgauthoritiesCommonList> readList() {
         return orgAuthorityProxy.readList();
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#read(java.lang.String)
+     * Read.
+     *
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<MultipartInput> read(String csid) {
         return orgAuthorityProxy.read(csid);
     }
 
     /**
-     * @param name
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#readByName(java.lang.String)
+     * Read by name.
+     *
+     * @param name the name
+     * @return the client response
      */
     public ClientResponse<MultipartInput> readByName(String name) {
         return orgAuthorityProxy.readByName(name);
     }
 
     /**
-     * @param orgAuthority
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#createOrgAuthority(org.collectionspace.hello.OrgAuthority)
+     * Creates the.
+     *
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<Response> create(MultipartOutput multipart) {
         return orgAuthorityProxy.create(multipart);
     }
 
     /**
-     * @param csid
-     * @param orgAuthority
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#updateOrgAuthority(java.lang.Long, org.collectionspace.hello.OrgAuthority)
+     * Update.
+     *
+     * @param csid the csid
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
         return orgAuthorityProxy.update(csid, multipart);
@@ -127,57 +160,75 @@ public class OrgAuthorityClient extends AbstractServiceClientImpl {
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#deleteOrgAuthority(java.lang.Long)
+     * Delete.
+     *
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<Response> delete(String csid) {
         return orgAuthorityProxy.delete(csid);
     }
 
     /**
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#readItemList()
+     * Read item list.
+     *
+     * @param vcsid the vcsid
+     * @return the client response
      */
     public ClientResponse<OrganizationsCommonList> readItemList(String vcsid) {
         return orgAuthorityProxy.readItemList(vcsid);
     }
 
     /**
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#readItemListForNamedAuthority()
+     * Read item list for named authority.
+     *
+     * @param specifier the specifier
+     * @return the client response
      */
     public ClientResponse<OrganizationsCommonList> readItemListForNamedAuthority(String specifier) {
         return orgAuthorityProxy.readItemListForNamedAuthority(specifier);
     }
 
+    /**
+     * Gets the item authority refs.
+     *
+     * @param parentcsid the parentcsid
+     * @param csid the csid
+     * @return the item authority refs
+     */
     public ClientResponse<AuthorityRefList> getItemAuthorityRefs(String parentcsid, String csid) {
         return orgAuthorityProxy.getItemAuthorityRefs(parentcsid, csid);
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#read(java.lang.String)
+     * Read item.
+     *
+     * @param vcsid the vcsid
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<MultipartInput> readItem(String vcsid, String csid) {
         return orgAuthorityProxy.readItem(vcsid, csid);
     }
 
     /**
-     * @param orgAuthority
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#createOrgAuthority(org.collectionspace.hello.OrgAuthority)
+     * Creates the item.
+     *
+     * @param vcsid the vcsid
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<Response> createItem(String vcsid, MultipartOutput multipart) {
         return orgAuthorityProxy.createItem(vcsid, multipart);
     }
 
     /**
-     * @param csid
-     * @param orgAuthority
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#updateOrgAuthority(java.lang.Long, org.collectionspace.hello.OrgAuthority)
+     * Update item.
+     *
+     * @param vcsid the vcsid
+     * @param csid the csid
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<MultipartInput> updateItem(String vcsid, String csid, MultipartOutput multipart) {
         return orgAuthorityProxy.updateItem(vcsid, csid, multipart);
@@ -185,34 +236,76 @@ public class OrgAuthorityClient extends AbstractServiceClientImpl {
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.OrgAuthorityProxy#deleteOrgAuthority(java.lang.Long)
+     * Delete item.
+     *
+     * @param vcsid the vcsid
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<Response> deleteItem(String vcsid, String csid) {
         return orgAuthorityProxy.deleteItem(vcsid, csid);
     }
 
+    /**
+     * Creates the contact.
+     *
+     * @param parentcsid the parentcsid
+     * @param itemcsid the itemcsid
+     * @param multipart the multipart
+     * @return the client response
+     */
     public ClientResponse<Response> createContact(String parentcsid,
             String itemcsid, MultipartOutput multipart) {
         return orgAuthorityProxy.createContact(parentcsid, itemcsid, multipart);
     }
 
+    /**
+     * Read contact.
+     *
+     * @param parentcsid the parentcsid
+     * @param itemcsid the itemcsid
+     * @param csid the csid
+     * @return the client response
+     */
     public ClientResponse<MultipartInput> readContact(String parentcsid,
             String itemcsid, String csid) {
         return orgAuthorityProxy.readContact(parentcsid, itemcsid, csid);
     }
 
+    /**
+     * Read contact list.
+     *
+     * @param parentcsid the parentcsid
+     * @param itemcsid the itemcsid
+     * @return the client response
+     */
     public ClientResponse<ContactsCommonList> readContactList(String parentcsid,
             String itemcsid) {
         return orgAuthorityProxy.readContactList(parentcsid, itemcsid);
     }
 
+    /**
+     * Update contact.
+     *
+     * @param parentcsid the parentcsid
+     * @param itemcsid the itemcsid
+     * @param csid the csid
+     * @param multipart the multipart
+     * @return the client response
+     */
     public ClientResponse<MultipartInput> updateContact(String parentcsid,
             String itemcsid, String csid, MultipartOutput multipart) {
         return orgAuthorityProxy.updateContact(parentcsid, itemcsid, csid, multipart);
     }
 
+    /**
+     * Delete contact.
+     *
+     * @param parentcsid the parentcsid
+     * @param itemcsid the itemcsid
+     * @param csid the csid
+     * @return the client response
+     */
     public ClientResponse<Response> deleteContact(String parentcsid,
         String itemcsid, String csid) {
         return orgAuthorityProxy.deleteContact(parentcsid,
index 782743bebaa3f8b995b936621cca5693aa8b49cb..c34e5ca9adb73722d4060e425722e2f88b961d4b 100644 (file)
@@ -1,9 +1,35 @@
+/**    
+ * PersonAuthorityClient.java
+ *
+ * {Purpose of This Class}
+ *
+ * {Other Notes Relating to This Class (Optional)}
+ *
+ * $LastChangedBy: $
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ *
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 {Contributing Institution}
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ */
 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.AuthorityRefList;
 import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
 import org.collectionspace.services.contact.ContactsCommonList;
 import org.collectionspace.services.person.PersonauthoritiesCommonList;
@@ -18,9 +44,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
 
 /**
- * A PersonAuthorityClient.
-
- * @version $Revision:$
+ * The Class PersonAuthorityClient.
  */
 public class PersonAuthorityClient extends AbstractServiceClientImpl {
 
@@ -32,23 +56,25 @@ public class PersonAuthorityClient extends AbstractServiceClientImpl {
         return "personauthorities";
     }
 
+    /**
+     * Gets the item common part name.
+     *
+     * @return the item common part name
+     */
     public String getItemCommonPartName() {
         return getCommonPartName("persons");
     }
 
-    /**
-     *
-     */
-    private static final PersonAuthorityClient instance = new PersonAuthorityClient();
+    /** The person authority proxy. */
+//    private static final PersonAuthorityClient instance = new PersonAuthorityClient();
+    
     /**
      *
      */
     private PersonAuthorityProxy personAuthorityProxy;
 
     /**
-     *
-     * Default constructor for PersonAuthorityClient class.
-     *
+     * Instantiates a new person authority client.
      */
     public PersonAuthorityClient() {
         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
@@ -56,13 +82,16 @@ public class PersonAuthorityClient extends AbstractServiceClientImpl {
         setProxy();
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.CollectionSpaceClient#getProxy()
+     */
     @Override
     public CollectionSpaceProxy getProxy() {
        return this.personAuthorityProxy;
     }    
 
     /**
-     * allow to reset proxy as per security needs
+     * Sets the proxy.
      */
     public void setProxy() {
         if (useAuth()) {
@@ -75,16 +104,16 @@ public class PersonAuthorityClient extends AbstractServiceClientImpl {
     }
 
     /**
-     * FIXME Comment this
+     * Read list.
      *
-     * @return
+     * @return the client response
      */
-    public static PersonAuthorityClient getInstance() {
-        return instance;
-    }
+//    public static PersonAuthorityClient getInstance() {
+//        return instance;
+//    }
 
     /**
-     * @return
+     * @return list
      * @see org.collectionspace.services.client.PersonAuthorityProxy#readList()
      */
     public ClientResponse<PersonauthoritiesCommonList> readList() {
@@ -92,37 +121,41 @@ public class PersonAuthorityClient extends AbstractServiceClientImpl {
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.PersonAuthorityProxy#read(java.lang.String)
+     * Read.
+     *
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<MultipartInput> read(String csid) {
         return personAuthorityProxy.read(csid);
     }
 
     /**
-     * @param name
-     * @return
-     * @see org.collectionspace.services.client.PersonAuthorityProxy#readByName(java.lang.String)
+     * Read by name.
+     *
+     * @param name the name
+     * @return the client response
      */
     public ClientResponse<MultipartInput> readByName(String name) {
         return personAuthorityProxy.readByName(name);
     }
 
     /**
-     * @param personAuthority
-     * @return
-     * @see org.collectionspace.services.client.PersonAuthorityProxy#createPersonAuthority(org.collectionspace.hello.PersonAuthority)
+     * Creates the.
+     *
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<Response> create(MultipartOutput multipart) {
         return personAuthorityProxy.create(multipart);
     }
 
     /**
-     * @param csid
-     * @param personAuthority
-     * @return
-     * @see org.collectionspace.services.client.PersonAuthorityProxy#updatePersonAuthority(java.lang.Long, org.collectionspace.hello.PersonAuthority)
+     * Update.
+     *
+     * @param csid the csid
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
         return personAuthorityProxy.update(csid, multipart);
@@ -130,62 +163,75 @@ public class PersonAuthorityClient extends AbstractServiceClientImpl {
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.PersonAuthorityProxy#deletePersonAuthority(java.lang.Long)
+     * Delete.
+     *
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<Response> delete(String csid) {
         return personAuthorityProxy.delete(csid);
     }
 
     /**
-     * @return
-     * @see org.collectionspace.services.client.PersonAuthorityProxy#readItemList()
+     * Read item list.
+     *
+     * @param vcsid the vcsid
+     * @return the client response
      */
     public ClientResponse<PersonsCommonList> readItemList(String vcsid) {
         return personAuthorityProxy.readItemList(vcsid);
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.IntakeProxy#getAuthorityRefs(java.lang.String)
+     * Gets the referencing objects.
+     *
+     * @param parentcsid the parentcsid
+     * @param csid the csid
+     * @return the referencing objects
      */
     public ClientResponse<AuthorityRefDocList> getReferencingObjects(String parentcsid, String csid) {
         return personAuthorityProxy.getReferencingObjects(parentcsid, csid);
     }
 
     /**
-     * @return
-     * @see org.collectionspace.services.client.PersonAuthorityProxy#readItemListForNamedAuthority()
+     * Read item list for named authority.
+     *
+     * @param specifier the specifier
+     * @return the client response
      */
     public ClientResponse<PersonsCommonList> readItemListForNamedAuthority(String specifier) {
         return personAuthorityProxy.readItemListForNamedAuthority(specifier);
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.PersonAuthorityProxy#read(java.lang.String)
+     * Read item.
+     *
+     * @param vcsid the vcsid
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<MultipartInput> readItem(String vcsid, String csid) {
         return personAuthorityProxy.readItem(vcsid, csid);
     }
 
     /**
-     * @param personAuthority
-     * @return
-     * @see org.collectionspace.services.client.PersonAuthorityProxy#createPersonAuthority(org.collectionspace.hello.PersonAuthority)
+     * Creates the item.
+     *
+     * @param vcsid the vcsid
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<Response> createItem(String vcsid, MultipartOutput multipart) {
         return personAuthorityProxy.createItem(vcsid, multipart);
     }
 
     /**
-     * @param csid
-     * @param personAuthority
-     * @return
-     * @see org.collectionspace.services.client.PersonAuthorityProxy#updatePersonAuthority(java.lang.Long, org.collectionspace.hello.PersonAuthority)
+     * Update item.
+     *
+     * @param vcsid the vcsid
+     * @param csid the csid
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<MultipartInput> updateItem(String vcsid, String csid, MultipartOutput multipart) {
         return personAuthorityProxy.updateItem(vcsid, csid, multipart);
@@ -193,34 +239,76 @@ public class PersonAuthorityClient extends AbstractServiceClientImpl {
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.PersonAuthorityProxy#deletePersonAuthority(java.lang.Long)
+     * Delete item.
+     *
+     * @param vcsid the vcsid
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<Response> deleteItem(String vcsid, String csid) {
         return personAuthorityProxy.deleteItem(vcsid, csid);
     }
 
+    /**
+     * Creates the contact.
+     *
+     * @param parentcsid the parentcsid
+     * @param itemcsid the itemcsid
+     * @param multipart the multipart
+     * @return the client response
+     */
     public ClientResponse<Response> createContact(String parentcsid,
             String itemcsid, MultipartOutput multipart) {
         return personAuthorityProxy.createContact(parentcsid, itemcsid, multipart);
     }
 
+    /**
+     * Read contact.
+     *
+     * @param parentcsid the parentcsid
+     * @param itemcsid the itemcsid
+     * @param csid the csid
+     * @return the client response
+     */
     public ClientResponse<MultipartInput> readContact(String parentcsid,
             String itemcsid, String csid) {
         return personAuthorityProxy.readContact(parentcsid, itemcsid, csid);
     }
 
+    /**
+     * Read contact list.
+     *
+     * @param parentcsid the parentcsid
+     * @param itemcsid the itemcsid
+     * @return the client response
+     */
     public ClientResponse<ContactsCommonList> readContactList(String parentcsid,
             String itemcsid) {
         return personAuthorityProxy.readContactList(parentcsid, itemcsid);
     }
 
+    /**
+     * Update contact.
+     *
+     * @param parentcsid the parentcsid
+     * @param itemcsid the itemcsid
+     * @param csid the csid
+     * @param multipart the multipart
+     * @return the client response
+     */
     public ClientResponse<MultipartInput> updateContact(String parentcsid,
             String itemcsid, String csid, MultipartOutput multipart) {
         return personAuthorityProxy.updateContact(parentcsid, itemcsid, csid, multipart);
     }
 
+    /**
+     * Delete contact.
+     *
+     * @param parentcsid the parentcsid
+     * @param itemcsid the itemcsid
+     * @param csid the csid
+     * @return the client response
+     */
     public ClientResponse<Response> deleteContact(String parentcsid,
         String itemcsid, String csid) {
         return personAuthorityProxy.deleteContact(parentcsid,
index 758598c56e43cc85341f10f30b930b56924f6e79..58a77a9b57f764d534db78e769108bf81ae2e12c 100644 (file)
                                 <name>log4j.configuration</name>
                                 <value>file:${project.build.directory}/test-classes/log4j.properties</value>
                             </property>
+                            <property>
+                                <name>maven.basedir</name>
+                                <value>${basedir}</value>
+                            </property>
                         </systemProperties>
                     </configuration>
                 </plugin>                
index 13f158366eaea393b32d895976c541ee9d7cb118..09b34a2ecfac5a4b8fee079eb886884c14ec2f7f 100644 (file)
@@ -55,11 +55,17 @@ import org.slf4j.LoggerFactory;
  */
 public class RelationServiceTest extends AbstractServiceTestImpl {
 
+   /** The logger. */
    private final Logger logger =
         LoggerFactory.getLogger(RelationServiceTest.class);
 
+    /** The SERVIC e_ pat h_ component. */
     final String SERVICE_PATH_COMPONENT = "relations";
+    
+    /** The known resource id. */
     private String knownResourceId = null;
+    
+    /** The all resource ids created. */
     private List<String> allResourceIdsCreated = new ArrayList<String>();
 
     /* (non-Javadoc)
@@ -83,6 +89,9 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
     // Success outcomes
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
+     */
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
     @Override
     public void create(String testName) throws Exception {
@@ -125,6 +134,9 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         allResourceIdsCreated.add(extractId(res));
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
+     */
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"create"})
@@ -137,13 +149,28 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     // Failure outcomes
     // Placeholders until the three tests below can be uncommented.
     // See Issue CSPACE-401.
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
+     */
+    @Override
     public void createWithEmptyEntityBody(String testName) throws Exception {
+       //Should this test really be empty?
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
+     */
+    @Override
     public void createWithMalformedXml(String testName) throws Exception {
+       //Should this test really be empty?
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
+     */
+    @Override
     public void createWithWrongXmlSchema(String testName) throws Exception {
+       //Should this test really be empty?
     }
 
     /*
@@ -230,6 +257,9 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     // CRUD tests : READ tests
     // ---------------------------------------------------------------
     // Success outcomes
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
+     */
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"create"})
@@ -261,6 +291,9 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     }
 
     // Failure outcomes
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
+     */
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"read"})
@@ -284,10 +317,26 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
     }
 
+       /* (non-Javadoc)
+        * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
+        */
+       @Test(dataProvider = "testName")
+       /*
+        * FIXME: Until the Relation service uses NXQL queries to get results,
+        * we need to skip the pagination tests
+        */
+       @Override
+       public void readPaginatedList(String testName) throws Exception {
+               //Override and skip the pagination tests
+       }
+   
     // ---------------------------------------------------------------
     // CRUD tests : READ_LIST tests
     // ---------------------------------------------------------------
     // Success outcomes
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
+     */
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"createList", "read"})
@@ -336,6 +385,9 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
 
     // Success outcomes
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
+     */
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"read"})
@@ -407,13 +459,28 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     // Failure outcomes
     // Placeholders until the three tests below can be uncommented.
     // See Issue CSPACE-401.
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
+     */
+    @Override
     public void updateWithEmptyEntityBody(String testName) throws Exception {
+       //Should this test really be empty?
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
+     */
+    @Override
     public void updateWithMalformedXml(String testName) throws Exception {
+       //Should this test really be empty?
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
+     */
+    @Override
     public void updateWithWrongXmlSchema(String testName) throws Exception {
+       //Should this test really be empty?
     }
 
     /*
@@ -496,6 +563,9 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     }
      */
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
+     */
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"update", "testSubmitRequest"})
@@ -527,6 +597,9 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     // CRUD tests : DELETE tests
     // ---------------------------------------------------------------
     // Success outcomes
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
+     */
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
@@ -551,6 +624,9 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     }
 
     // Failure outcomes
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
+     */
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"delete"})
@@ -577,8 +653,12 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     // RELATE_OBJECT tests
     // ---------------------------------------------------------------
+    /**
+     * Relate objects.
+     */
     @Test(dependsOnMethods = {"create"})
     public void relateObjects() {
+       //Should this test really be empty?
     }
 
     // ---------------------------------------------------------------
@@ -643,11 +723,20 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
+     */
     @Override
     public String getServicePathComponent() {
         return SERVICE_PATH_COMPONENT;
     }
 
+    /**
+     * Creates the relation instance.
+     *
+     * @param identifier the identifier
+     * @return the multipart output
+     */
     private MultipartOutput createRelationInstance(String identifier) {
         RelationsCommon relation = new RelationsCommon();
         fillRelation(relation, identifier);
@@ -665,10 +754,9 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
 
     /**
      * Fills the relation.
-     * 
+     *
+     * @param relation the relation
      * @param identifier the identifier
-     * 
-     * @return the relation
      */
     private void fillRelation(RelationsCommon relation, String identifier) {
         fillRelation(relation, "Subject-" + identifier,
@@ -680,14 +768,13 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
 
     /**
      * Fills the relation.
-     * 
+     *
+     * @param relation the relation
      * @param documentId1 the document id1
      * @param documentType1 the document type1
      * @param documentId2 the document id2
      * @param documentType2 the document type2
      * @param rt the rt
-     * 
-     * @return the relation
      */
     private void fillRelation(RelationsCommon relation,
             String documentId1, String documentType1,
index eeaa84c0f114c5d7bd47ae19f071fc9181b73c38..b57cdea49a8663bc627be3378131c2064e259a0a 100644 (file)
@@ -38,6 +38,7 @@ import javax.ws.rs.PUT;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.core.UriInfo;
@@ -151,14 +152,16 @@ public class NewRelationResource extends
        
        /**
         * Gets the relation.
-        * 
+        *
+        * @param ui the ui
         * @param csid the csid
-        * 
         * @return the relation
         */
        @GET
        @Path("{csid}")
-       public MultipartOutput getRelation(@PathParam("csid") String csid) {
+       public MultipartOutput getRelation(@Context UriInfo ui,
+                       @PathParam("csid") String csid) {
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
                if (logger.isDebugEnabled()) {
                        logger.debug("getRelation with csid=" + csid);
                }
@@ -171,7 +174,7 @@ public class NewRelationResource extends
                }
                MultipartOutput result = null;
                try {
-                       ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();
+                       ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
                        DocumentHandler handler = createDocumentHandler(ctx);
                        getRepositoryClient(ctx).get(ctx, csid, handler);
                        result = (MultipartOutput) ctx.getOutput();
@@ -222,7 +225,8 @@ public class NewRelationResource extends
        @GET
        @Produces("application/xml")
        public RelationsCommonList getRelationList(@Context UriInfo ui) {
-               return this.getRelationList(null, null, null);
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+               return this.getRelationList(queryParams, null, null, null);
        }
 
        /**
@@ -238,7 +242,8 @@ public class NewRelationResource extends
        @Produces("application/xml")
        public RelationsCommonList getRelationList_S(@Context UriInfo ui,
                        @PathParam("subjectCsid") String subjectCsid) {
-               return this.getRelationList(subjectCsid, null, null);
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+               return this.getRelationList(queryParams, subjectCsid, null, null);
        }
 
        /**
@@ -254,7 +259,8 @@ public class NewRelationResource extends
        @Produces("application/xml")
        public RelationsCommonList getRelationList_P(@Context UriInfo ui,
                        @PathParam("predicate") String predicate) {
-               return this.getRelationList(null, predicate, null);
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+               return this.getRelationList(queryParams, null, predicate, null);
        }
 
        /**
@@ -270,7 +276,8 @@ public class NewRelationResource extends
        @Produces("application/xml")
        public RelationsCommonList getRelationList_O(@Context UriInfo ui,
                        @PathParam("objectCsid") String objectCsid) {
-               return this.getRelationList(null, null, objectCsid);
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+               return this.getRelationList(queryParams, null, null, objectCsid);
        }
 
        /**
@@ -288,7 +295,8 @@ public class NewRelationResource extends
        public RelationsCommonList getRelationList_PS(@Context UriInfo ui,
                        @PathParam("predicate") String predicate,
                        @PathParam("subjectCsid") String subjectCsid) {
-               return this.getRelationList(subjectCsid, predicate, null);
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+               return this.getRelationList(queryParams, subjectCsid, predicate, null);
        }
 
        /**
@@ -306,7 +314,8 @@ public class NewRelationResource extends
        public RelationsCommonList getRelationList_SP(@Context UriInfo ui,
                        @PathParam("subjectCsid") String subjectCsid,
                        @PathParam("predicate") String predicate) {
-               return this.getRelationList(subjectCsid, predicate, null);
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+               return this.getRelationList(queryParams, subjectCsid, predicate, null);
        }
 
        /**
@@ -324,7 +333,8 @@ public class NewRelationResource extends
        public RelationsCommonList getRelationList_PO(@Context UriInfo ui,
                        @PathParam("predicate") String predicate,
                        @PathParam("objectCsid") String objectCsid) {
-               return this.getRelationList(null, predicate, objectCsid);
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+               return this.getRelationList(queryParams, null, predicate, objectCsid);
        }
 
        /**
@@ -342,7 +352,8 @@ public class NewRelationResource extends
        public RelationsCommonList getRelationList_OP(@Context UriInfo ui,
                        @PathParam("objectCsid") String objectCsid,
                        @PathParam("predicate") String predicate) {
-               return this.getRelationList(null, predicate, objectCsid);
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+               return this.getRelationList(queryParams, null, predicate, objectCsid);
        }
 
        /**
@@ -362,7 +373,8 @@ public class NewRelationResource extends
                        @PathParam("predicate") String predicate,
                        @PathParam("subjectCsid") String subjectCsid,
                        @PathParam("objectCsid") String objectCsid) {
-               return this.getRelationList(subjectCsid, predicate, objectCsid);
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+               return this.getRelationList(queryParams, subjectCsid, predicate, objectCsid);
        }
 
        /**
@@ -382,7 +394,8 @@ public class NewRelationResource extends
                        @PathParam("subjectCsid") String subjectCsid,
                        @PathParam("predicate") String predicate,
                        @PathParam("objectCsid") String objectCsid) {
-               return this.getRelationList(subjectCsid, predicate, objectCsid);
+               MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+               return this.getRelationList(queryParams, subjectCsid, predicate, objectCsid);
        }
 
        /*
@@ -487,23 +500,29 @@ public class NewRelationResource extends
        }
 
        /**
-        * Gets the relation list request.
-        * 
-        * @return the relation list request
-        * 
-        * @throws WebApplicationException
-        *             the web application exception
+        * Gets the relation list.
+        *
+        * @param queryParams the query params
+        * @param subjectCsid the subject csid
+        * @param predicate the predicate
+        * @param objectCsid the object csid
+        * @return the relation list
+        * @throws WebApplicationException the web application exception
         */
-       public RelationsCommonList getRelationList(String subjectCsid,
-                       String predicate, String objectCsid) throws WebApplicationException {
+       public RelationsCommonList getRelationList(
+                       MultivaluedMap<String, String> queryParams,
+                       String subjectCsid,
+                       String predicate, 
+                       String objectCsid) throws WebApplicationException {
                RelationsCommonList relationList = new RelationsCommonList();
                try {
-                       ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();
+                       ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
                        DocumentHandler handler = createDocumentHandler(ctx);
                        Map<String, Object> propsFromPath = handler.getProperties();
                        propsFromPath.put(IRelationsManager.SUBJECT, subjectCsid);
                        propsFromPath.put(IRelationsManager.PREDICATE, predicate);
                        propsFromPath.put(IRelationsManager.OBJECT, objectCsid);
+                       // Until we replace this with a search, "getAll()" is better then "getFiltered"
                        getRepositoryClient(ctx).getAll(ctx, handler);
                        relationList = (RelationsCommonList) handler.getCommonPartList();
                } catch (UnauthorizedException ue) {
index 94d9af7558ddef4eebc2a1191bad6375b5f89830..a5f3fb5371117abeb175eca0bb9698db98fa4dd0 100644 (file)
@@ -1,3 +1,29 @@
+/**    
+ * VocabularyClient.java
+ *
+ * {Purpose of This Class}
+ *
+ * {Other Notes Relating to This Class (Optional)}
+ *
+ * $LastChangedBy: $
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ *
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 {Contributing Institution}
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ */
 package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
@@ -14,9 +40,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
 
 /**
- * A VocabularyClient.
-
- * @version $Revision:$
+ * The Class VocabularyClient.
  */
 public class VocabularyClient extends AbstractServiceClientImpl {
 
@@ -28,22 +52,23 @@ public class VocabularyClient extends AbstractServiceClientImpl {
         return "vocabularies";
     }
 
-    public String getItemCommonPartName() {
-        return getCommonPartName("vocabularyitems");
-    }
-    /**
-     *
-     */
-    private static final VocabularyClient instance = new VocabularyClient();
     /**
+     * Gets the item common part name.
      *
+     * @return the item common part name
      */
+    public String getItemCommonPartName() {
+        return getCommonPartName("vocabularyitems");
+    }
+    
+    /** The Constant instance. */ //FIXME: This is wrong.  There should not be a static instance of the client.
+//    private static final VocabularyClient instance = new VocabularyClient();
+    
+    /** The vocabulary proxy. */
     private VocabularyProxy vocabularyProxy;
 
     /**
-     *
-     * Default constructor for VocabularyClient class.
-     *
+     * Instantiates a new vocabulary client.
      */
     public VocabularyClient() {
         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
@@ -51,13 +76,16 @@ public class VocabularyClient extends AbstractServiceClientImpl {
         setProxy();
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.CollectionSpaceClient#getProxy()
+     */
     @Override
     public CollectionSpaceProxy getProxy() {
        return this.vocabularyProxy;
     }    
 
     /**
-     * allow to reset proxy as per security needs
+     * Sets the proxy.
      */
     public void setProxy() {
         if (useAuth()) {
@@ -68,45 +96,49 @@ public class VocabularyClient extends AbstractServiceClientImpl {
     }
 
     /**
-     * FIXME Comment this
+     * Gets the single instance of VocabularyClient.
      *
-     * @return
+     * @return single instance of VocabularyClient //FIXME: This is wrong.  There should not be a static instance of the client.
      */
-    public static VocabularyClient getInstance() {
-        return instance;
-    }
+//    public static VocabularyClient getInstance() {
+//        return instance;
+//    }
 
     /**
-     * @return
-     * @see org.collectionspace.services.client.VocabularyProxy#readList()
+     * Read list.
+     *
+     * @return the client response
      */
     public ClientResponse<VocabulariesCommonList> readList() {
         return vocabularyProxy.readList();
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.VocabularyProxy#read(java.lang.String)
+     * Read.
+     *
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<MultipartInput> read(String csid) {
         return vocabularyProxy.read(csid);
     }
 
     /**
-     * @param vocabulary
-     * @return
-     * @see org.collectionspace.services.client.VocabularyProxy#createVocabulary(org.collectionspace.hello.Vocabulary)
+     * Creates the.
+     *
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<Response> create(MultipartOutput multipart) {
         return vocabularyProxy.create(multipart);
     }
 
     /**
-     * @param csid
-     * @param vocabulary
-     * @return
-     * @see org.collectionspace.services.client.VocabularyProxy#updateVocabulary(java.lang.Long, org.collectionspace.hello.Vocabulary)
+     * Update.
+     *
+     * @param csid the csid
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
         return vocabularyProxy.update(csid, multipart);
@@ -114,45 +146,54 @@ public class VocabularyClient extends AbstractServiceClientImpl {
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.VocabularyProxy#deleteVocabulary(java.lang.Long)
+     * Delete.
+     *
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<Response> delete(String csid) {
         return vocabularyProxy.delete(csid);
     }
 
     /**
-     * @return
-     * @see org.collectionspace.services.client.VocabularyProxy#readItemList()
+     * Read item list.
+     *
+     * @param vcsid the vcsid
+     * @return the client response
      */
     public ClientResponse<VocabularyitemsCommonList> readItemList(String vcsid) {
         return vocabularyProxy.readItemList(vcsid);
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.VocabularyProxy#read(java.lang.String)
+     * Read item.
+     *
+     * @param vcsid the vcsid
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<MultipartInput> readItem(String vcsid, String csid) {
         return vocabularyProxy.readItem(vcsid, csid);
     }
 
     /**
-     * @param vocabulary
-     * @return
-     * @see org.collectionspace.services.client.VocabularyProxy#createVocabulary(org.collectionspace.hello.Vocabulary)
+     * Creates the item.
+     *
+     * @param vcsid the vcsid
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<Response> createItem(String vcsid, MultipartOutput multipart) {
         return vocabularyProxy.createItem(vcsid, multipart);
     }
 
     /**
-     * @param csid
-     * @param vocabulary
-     * @return
-     * @see org.collectionspace.services.client.VocabularyProxy#updateVocabulary(java.lang.Long, org.collectionspace.hello.Vocabulary)
+     * Update item.
+     *
+     * @param vcsid the vcsid
+     * @param csid the csid
+     * @param multipart the multipart
+     * @return the client response
      */
     public ClientResponse<MultipartInput> updateItem(String vcsid, String csid, MultipartOutput multipart) {
         return vocabularyProxy.updateItem(vcsid, csid, multipart);
@@ -160,9 +201,11 @@ public class VocabularyClient extends AbstractServiceClientImpl {
     }
 
     /**
-     * @param csid
-     * @return
-     * @see org.collectionspace.services.client.VocabularyProxy#deleteVocabulary(java.lang.Long)
+     * Delete item.
+     *
+     * @param vcsid the vcsid
+     * @param csid the csid
+     * @return the client response
      */
     public ClientResponse<Response> deleteItem(String vcsid, String csid) {
         return vocabularyProxy.deleteItem(vcsid, csid);