From: Patrick Schmitz Date: Tue, 6 Jul 2010 17:10:48 +0000 (+0000) Subject: NOJIRA - cleaned up the Vocab/Authority client and proxy classes to reflect the parti... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=b4c40a0398dc76f7fba8902db421313ca52f3c5b;p=tmp%2Fjakarta-migration.git NOJIRA - cleaned up the Vocab/Authority client and proxy classes to reflect the partialTerm and keyword search options, in a simpler form. --- diff --git a/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityClient.java b/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityClient.java index 5f3e77d13..5613d9ba2 100644 --- a/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityClient.java +++ b/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityClient.java @@ -173,13 +173,20 @@ public class LocationAuthorityClient extends AbstractServiceClientImpl { } /** - * Read item list. + * Read item list, filtering by partial term match, or keywords. Only one of + * partialTerm or keywords should be specified. If both are specified, keywords + * will be ignored. * - * @param vcsid the vcsid + * @param inAuthority the parent authority + * @param partialTerm A partial term on which to match, + * which will filter list results to return only matched resources. + * @param keywords A set of keywords on which to match, + * which will filter list results to return only matched resources. * @return the client response */ - public ClientResponse readItemList(String vcsid) { - return locationAuthorityProxy.readItemList(vcsid); + public ClientResponse + readItemList(String inAuthority, String partialTerm, String keywords) { + return locationAuthorityProxy.readItemList(inAuthority, partialTerm, keywords); } /** @@ -194,13 +201,20 @@ public class LocationAuthorityClient extends AbstractServiceClientImpl { } /** - * Read item list for named authority. + * Read item list for named vocabulary, filtering by partial term match, or keywords. Only one of + * partialTerm or keywords should be specified. If both are specified, keywords + * will be ignored. * * @param specifier the specifier + * @param partialTerm A partial term on which to match, + * which will filter list results to return only matched resources. + * @param keywords A set of keywords on which to match, + * which will filter list results to return only matched resources. * @return the client response */ - public ClientResponse readItemListForNamedAuthority(String specifier) { - return locationAuthorityProxy.readItemListForNamedAuthority(specifier); + public ClientResponse + readItemListForNamedAuthority(String specifier, String partialTerm, String keywords) { + return locationAuthorityProxy.readItemListForNamedAuthority(specifier, partialTerm, keywords); } /** diff --git a/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityProxy.java b/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityProxy.java index 863265bd0..d577d69f3 100644 --- a/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityProxy.java +++ b/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityProxy.java @@ -8,8 +8,10 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; +import org.collectionspace.services.common.query.IQueryManager; import org.collectionspace.services.common.authorityref.AuthorityRefDocList; import org.collectionspace.services.contact.ContactsCommonList; import org.collectionspace.services.location.LocationauthoritiesCommonList; @@ -55,11 +57,14 @@ public interface LocationAuthorityProxy extends CollectionSpaceProxy { @Path("/{csid}") ClientResponse delete(@PathParam("csid") String csid); - // List Items + // List Items matching a partial term or keywords. @GET @Produces({"application/xml"}) @Path("/{vcsid}/items/") - ClientResponse readItemList(@PathParam("vcsid") String vcsid); + ClientResponse readItemList( + @PathParam("vcsid") String vcsid, + @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm, + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords); /** * @param csid @@ -73,11 +78,14 @@ public interface LocationAuthorityProxy extends CollectionSpaceProxy { @PathParam("csid") String parentcsid, @PathParam("itemcsid") String itemcsid); - // List Items for a named authority + // List Items for a named authority matching a partial term or keywords. @GET @Produces({"application/xml"}) @Path("/urn:cspace:name({specifier})/items/") - ClientResponse readItemListForNamedAuthority(@PathParam("specifier") String specifier); + ClientResponse readItemListForNamedAuthority( + @PathParam("specifier") String specifier, + @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm, + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords); //(C)reate Item @POST diff --git a/services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java b/services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java index e6de389dd..c9aefb2db 100644 --- a/services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java +++ b/services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java @@ -807,9 +807,9 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { LocationAuthorityClient client = new LocationAuthorityClient(); ClientResponse res = null; if(vcsid!= null) { - res = client.readItemList(vcsid); + res = client.readItemList(vcsid, null, null); } else if(shortId!= null) { - res = client.readItemListForNamedAuthority(shortId); + res = client.readItemListForNamedAuthority(shortId, null, null); } else { Assert.fail("readItemList passed null csid and name!"); } diff --git a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java index b826dac19..612c08666 100644 --- a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java +++ b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java @@ -172,13 +172,20 @@ public class OrgAuthorityClient extends AbstractServiceClientImpl { } /** - * Read item list. + * Read item list, filtering by partial term match, or keywords. Only one of + * partialTerm or keywords should be specified. If both are specified, keywords + * will be ignored. * - * @param vcsid the vcsid + * @param inAuthority the parent authority + * @param partialTerm A partial term on which to match, + * which will filter list results to return only matched resources. + * @param keywords A set of keywords on which to match, + * which will filter list results to return only matched resources. * @return the client response */ - public ClientResponse readItemList(String vcsid) { - return orgAuthorityProxy.readItemList(vcsid); + public ClientResponse + readItemList(String inAuthority, String partialTerm, String keywords) { + return orgAuthorityProxy.readItemList(inAuthority, partialTerm, keywords); } /** @@ -194,13 +201,20 @@ public class OrgAuthorityClient extends AbstractServiceClientImpl { /** - * Read item list for named authority. + * Read item list for named vocabulary, filtering by partial term match, or keywords. Only one of + * partialTerm or keywords should be specified. If both are specified, keywords + * will be ignored. * * @param specifier the specifier + * @param partialTerm A partial term on which to match, + * which will filter list results to return only matched resources. + * @param keywords A set of keywords on which to match, + * which will filter list results to return only matched resources. * @return the client response */ - public ClientResponse readItemListForNamedAuthority(String specifier) { - return orgAuthorityProxy.readItemListForNamedAuthority(specifier); + public ClientResponse + readItemListForNamedAuthority(String specifier, String partialTerm, String keywords) { + return orgAuthorityProxy.readItemListForNamedAuthority(specifier, partialTerm, keywords); } /** diff --git a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java index 32ca3dbd9..162c58572 100644 --- a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java +++ b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java @@ -17,6 +17,7 @@ import org.collectionspace.services.common.authorityref.AuthorityRefList; import org.collectionspace.services.contact.ContactsCommonList; import org.collectionspace.services.organization.OrgauthoritiesCommonList; import org.collectionspace.services.organization.OrganizationsCommonList; +import org.collectionspace.services.person.PersonsCommonList; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; @@ -58,12 +59,15 @@ public interface OrgAuthorityProxy extends CollectionSpaceProxy { @Path("/{csid}") ClientResponse delete(@PathParam("csid") String csid); - // List Items + // List Items with options for matching a partial term or keywords. @GET - @Produces({"application/xml"}) - @Path("/{vcsid}/items/") - ClientResponse readItemList(@PathParam("vcsid") String vcsid); - + @Produces("application/xml") + @Path("/{csid}/items/") + ClientResponsereadItemList( + @PathParam("csid") String parentcsid, + @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm, + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords); + /** * @param parentcsid * @param itemcsid @@ -78,20 +82,14 @@ public interface OrgAuthorityProxy extends CollectionSpaceProxy { @PathParam("csid") String parentcsid, @PathParam("itemcsid") String itemcsid); - // List Items for a named authority - @GET - @Produces({"application/xml"}) - @Path("/urn:cspace:name({specifier})/items/") - ClientResponse readItemListForNamedAuthority( - @PathParam("specifier") String specifier); - - // List Items for a named authority matching a partial term. + // List Items for a named authority matching a partial term or keywords. @GET @Produces({"application/xml"}) @Path("/urn:cspace:name({specifier})/items/") ClientResponse readItemListForNamedAuthority( @PathParam("specifier") String specifier, - @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm); + @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm, + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords); // List Item Authority References @GET diff --git a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java index 5f29214fa..d6527eb5f 100644 --- a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java +++ b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java @@ -1104,9 +1104,9 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { OrgAuthorityClient client = new OrgAuthorityClient(); ClientResponse res = null; if(vcsid!= null) { - res = client.readItemList(vcsid); + res = client.readItemList(vcsid, null, null); } else if(name!= null) { - res = client.readItemListForNamedAuthority(name); + res = client.readItemListForNamedAuthority(name, null, null); } else { Assert.fail("readItemList passed null csid and name!"); } diff --git a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java index 695667c20..b3fcc20b7 100644 --- a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java +++ b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java @@ -183,40 +183,38 @@ public class PersonAuthorityClient extends AbstractServiceClientImpl { return personAuthorityProxy.getReferencingObjects(parentcsid, csid); } - /** - * Read item list. - * - * @param vcsid the vcsid - * @return the client response - */ - public ClientResponse readItemList(String vcsid) { - return personAuthorityProxy.readItemList(vcsid); - } - /** * Read item list, filtering by partial term match, or keywords. Only one of * partialTerm or keywords should be specified. If both are specified, keywords * will be ignored. * - * @param vcsid the vcsid + * @param inAuthority the parent authority * @param partialTerm A partial term on which to match, * which will filter list results to return only matched resources. * @param keywords A set of keywords on which to match, * which will filter list results to return only matched resources. * @return the client response */ - public ClientResponse readItemList(String vcsid, String partialTerm, String keywords) { - return personAuthorityProxy.readItemList(vcsid, partialTerm, keywords); + public ClientResponse + readItemList(String inAuthority, String partialTerm, String keywords) { + return personAuthorityProxy.readItemList(inAuthority, partialTerm, keywords); } /** - * Read item list for named authority. + * Read item list for named vocabulary, filtering by partial term match, or keywords. Only one of + * partialTerm or keywords should be specified. If both are specified, keywords + * will be ignored. * * @param specifier the specifier + * @param partialTerm A partial term on which to match, + * which will filter list results to return only matched resources. + * @param keywords A set of keywords on which to match, + * which will filter list results to return only matched resources. * @return the client response */ - public ClientResponse readItemListForNamedAuthority(String specifier) { - return personAuthorityProxy.readItemListForNamedAuthority(specifier); + public ClientResponse + readItemListForNamedAuthority(String specifier, String partialTerm, String keywords) { + return personAuthorityProxy.readItemListForNamedAuthority(specifier, partialTerm, keywords); } /** diff --git a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java index ad3a0eaf0..8acd9e80b 100644 --- a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java +++ b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java @@ -57,13 +57,7 @@ public interface PersonAuthorityProxy extends CollectionSpaceProxy { @Path("/{csid}") ClientResponse delete(@PathParam("csid") String csid); - // List Items - @GET - @Produces({"application/xml"}) - @Path("/{vcsid}/items/") - ClientResponse readItemList(@PathParam("vcsid") String vcsid); - - // List Items matching a partial term. + // List Items with options for matching a partial term or keywords. @GET @Produces("application/xml") @Path("/{csid}/items/") @@ -86,20 +80,14 @@ public interface PersonAuthorityProxy extends CollectionSpaceProxy { @PathParam("csid") String parentcsid, @PathParam("itemcsid") String itemcsid); - // List Items for a named authority - @GET - @Produces({"application/xml"}) - @Path("/urn:cspace:name({specifier})/items/") - ClientResponse readItemListForNamedAuthority( - @PathParam("specifier") String specifier); - - // List Items for a named authority matching a partial term. + // List Items for a named authority matching a partial term or keywords. @GET @Produces({"application/xml"}) @Path("/urn:cspace:name({specifier})/items/") ClientResponse readItemListForNamedAuthority( @PathParam("specifier") String specifier, - @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm); + @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm, + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords); //(C)reate Item @POST diff --git a/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java b/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java index ae1ac0636..84b284cd8 100644 --- a/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java +++ b/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java @@ -1163,9 +1163,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { PersonAuthorityClient client = new PersonAuthorityClient(); ClientResponse res = null; if (vcsid!= null) { - res = client.readItemList(vcsid); + res = client.readItemList(vcsid, null, null); } else if (name!= null) { - res = client.readItemListForNamedAuthority(name); + res = client.readItemListForNamedAuthority(name, null, null); } else { Assert.fail("readItemList passed null csid and name!"); } diff --git a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java index 9b031f4d1..cb1177dc5 100644 --- a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java +++ b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java @@ -166,23 +166,37 @@ public class VocabularyClient extends AbstractServiceClientImpl { } /** - * Read item list. + * Read item list, filtering by partial term match, or keywords. Only one of + * partialTerm or keywords should be specified. If both are specified, keywords + * will be ignored. * - * @param vcsid the vcsid + * @param inAuthority the parent authority + * @param partialTerm A partial term on which to match, + * which will filter list results to return only matched resources. + * @param keywords A set of keywords on which to match, + * which will filter list results to return only matched resources. * @return the client response */ - public ClientResponse readItemList(String vcsid) { - return vocabularyProxy.readItemList(vcsid); + public ClientResponse + readItemList(String inAuthority, String partialTerm, String keywords) { + return vocabularyProxy.readItemList(inAuthority, partialTerm, keywords); } /** - * Read item list for named vocabulary. + * Read item list for named vocabulary, filtering by partial term match, or keywords. Only one of + * partialTerm or keywords should be specified. If both are specified, keywords + * will be ignored. * * @param specifier the specifier + * @param partialTerm A partial term on which to match, + * which will filter list results to return only matched resources. + * @param keywords A set of keywords on which to match, + * which will filter list results to return only matched resources. * @return the client response */ - public ClientResponse readItemListForNamedVocabulary(String specifier) { - return vocabularyProxy.readItemListForNamedVocabulary(specifier); + public ClientResponse + readItemListForNamedVocabulary(String specifier, String partialTerm, String keywords) { + return vocabularyProxy.readItemListForNamedVocabulary(specifier, partialTerm, keywords); } /** diff --git a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java index a9ff1eab2..6d8c29192 100644 --- a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java +++ b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java @@ -13,6 +13,7 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import org.collectionspace.services.common.query.IQueryManager; import org.collectionspace.services.vocabulary.VocabulariesCommonList; import org.collectionspace.services.vocabulary.VocabularyitemsCommonList; import org.jboss.resteasy.client.ClientResponse; @@ -56,17 +57,23 @@ public interface VocabularyProxy extends CollectionSpaceProxy { @Path("/{csid}") ClientResponse delete(@PathParam("csid") String csid); - // List Items + // List Items matching a partial term or keywords. @GET @Produces({"application/xml"}) @Path("/{vcsid}/items/") - ClientResponse readItemList(@PathParam("vcsid") String vcsid); + ClientResponse readItemList( + @PathParam("vcsid") String vcsid, + @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm, + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords); - // List Items using the name of the Vocab + // List Items for a named authority matching a partial term or keywords. @GET @Produces({"application/xml"}) @Path("/urn:cspace:name({specifier})/items") - ClientResponse readItemListForNamedVocabulary(@PathParam("specifier") String specifier); + ClientResponse readItemListForNamedVocabulary( + @PathParam("specifier") String specifier, + @QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm, + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords); //(C)reate Item @POST diff --git a/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java b/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java index e47ff29f7..d244e7b9d 100644 --- a/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java +++ b/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java @@ -710,9 +710,9 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { VocabularyClient client = new VocabularyClient(); ClientResponse res = null; if(vcsid!=null) { - res = client.readItemList(vcsid); + res = client.readItemList(vcsid, null, null); } else if(shortId!=null) { - res = client.readItemListForNamedVocabulary(shortId); + res = client.readItemListForNamedVocabulary(shortId, null, null); } else { Assert.fail("Internal Error: readItemList both vcsid and shortId are null!"); }