From: Richard Millet Date: Tue, 15 Feb 2011 23:46:49 +0000 (+0000) Subject: CSPACE-3574: Merging Plain Old XML payload work into trunk. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=67ea395d0264d971aef9e91aa3deefb4c21e559c;p=tmp%2Fjakarta-migration.git CSPACE-3574: Merging Plain Old XML payload work into trunk. --- diff --git a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.classpath b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.classpath index bd6bf38eb..3ee84c072 100644 --- a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.classpath +++ b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.classpath @@ -1,9 +1,9 @@ - - - - - - + + + - + + + + \ No newline at end of file diff --git a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.project b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.project index c48d25621..e2f800a22 100644 --- a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.project +++ b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.project @@ -1,23 +1,17 @@ - org.collectionspace.services.vocabulary.3rdparty.nuxeo - Vocabulary Nuxeo Document Type - - + Vocabulary Nuxeo Document Type. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + org.eclipse.jdt.core.javabuilder - - org.maven.ide.eclipse.maven2Builder - - org.maven.ide.eclipse.maven2Nature org.eclipse.jdt.core.javanature - + \ No newline at end of file diff --git a/services/vocabulary/client/.classpath b/services/vocabulary/client/.classpath index 425cd1620..caa326efe 100644 --- a/services/vocabulary/client/.classpath +++ b/services/vocabulary/client/.classpath @@ -1,10 +1,308 @@ - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/vocabulary/client/.project b/services/vocabulary/client/.project index ae0b5aa8b..5a16b4db1 100644 --- a/services/vocabulary/client/.project +++ b/services/vocabulary/client/.project @@ -1,26 +1,24 @@ - org.collectionspace.services.vocabulary.client - + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + org.collectionspace.services.3rdparty.nuxeo.quote-api org.collectionspace.services.client org.collectionspace.services.common + org.collectionspace.services.hyperjaxb + org.collectionspace.services.jaxb org.collectionspace.services.vocabulary.jaxb org.eclipse.jdt.core.javabuilder - - org.maven.ide.eclipse.maven2Builder - - org.maven.ide.eclipse.maven2Nature org.eclipse.jdt.core.javanature - + \ No newline at end of file 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 d69fb6f44..0c4580231 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 @@ -36,21 +36,38 @@ import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.client.ProxyFactory; import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor; import org.jboss.resteasy.plugins.providers.RegisterBuiltin; -import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; -import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * The Class VocabularyClient. */ public class VocabularyClient extends AbstractServiceClientImpl { - + public static final String SERVICE_NAME = "vocabularies"; + public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; + public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT; + public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; + // + // Subitem constants + // + public static final String SERVICE_ITEM_NAME = "vocabularyitems"; + public static final String SERVICE_PATH_ITEMS_COMPONENT = "items"; //FIXME: REM - This should be defined in an AuthorityClient base class + public static final String SERVICE_ITEM_PAYLOAD_NAME = SERVICE_ITEM_NAME; + + @Override + public String getServiceName() { + return SERVICE_NAME; + } + /* (non-Javadoc) * @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent() */ @Override public String getServicePathComponent() { - return "vocabularies"; + return SERVICE_PATH_COMPONENT; + } + + public String getPayloadName() { + return SERVICE_PAYLOAD_NAME; } /** @@ -58,8 +75,8 @@ public class VocabularyClient extends AbstractServiceClientImpl { * * @return the item common part name */ - public String getItemCommonPartName() { - return getCommonPartName("vocabularyitems"); + public String getCommonPartItemName() { + return getCommonPartName(SERVICE_ITEM_PAYLOAD_NAME); } /** The Constant instance. */ //FIXME: This is wrong. There should not be a static instance of the client. @@ -121,7 +138,7 @@ public class VocabularyClient extends AbstractServiceClientImpl { * @param csid the csid * @return the client response */ - public ClientResponse read(String csid) { + public ClientResponse read(String csid) { return vocabularyProxy.read(csid); } @@ -131,7 +148,7 @@ public class VocabularyClient extends AbstractServiceClientImpl { * @param name the name * @return the client response */ - public ClientResponse readByName(String name) { + public ClientResponse readByName(String name) { return vocabularyProxy.readByName(name); } @@ -141,8 +158,9 @@ public class VocabularyClient extends AbstractServiceClientImpl { * @param multipart the multipart * @return the client response */ - public ClientResponse create(MultipartOutput multipart) { - return vocabularyProxy.create(multipart); + public ClientResponse create(PoxPayloadOut poxPayloadout) { + String xmlPayload = poxPayloadout.toXML(); + return vocabularyProxy.create(xmlPayload); } /** @@ -152,8 +170,9 @@ public class VocabularyClient extends AbstractServiceClientImpl { * @param multipart the multipart * @return the client response */ - public ClientResponse update(String csid, MultipartOutput multipart) { - return vocabularyProxy.update(csid, multipart); + public ClientResponse update(String csid, PoxPayloadOut poxPayloadout) { + String xmlPayload = poxPayloadout.toXML(); + return vocabularyProxy.update(csid, xmlPayload); } @@ -208,7 +227,7 @@ public class VocabularyClient extends AbstractServiceClientImpl { * @param csid the csid * @return the client response */ - public ClientResponse readItem(String vcsid, String csid) { + public ClientResponse readItem(String vcsid, String csid) { return vocabularyProxy.readItem(vcsid, csid); } @@ -219,8 +238,9 @@ public class VocabularyClient extends AbstractServiceClientImpl { * @param multipart the multipart * @return the client response */ - public ClientResponse createItem(String vcsid, MultipartOutput multipart) { - return vocabularyProxy.createItem(vcsid, multipart); + public ClientResponse createItem(String vcsid, PoxPayloadOut poxPayloadOut) { + String xmlPayload = poxPayloadOut.toXML(); + return vocabularyProxy.createItem(vcsid, xmlPayload); } /** @@ -231,9 +251,9 @@ public class VocabularyClient extends AbstractServiceClientImpl { * @param multipart the multipart * @return the client response */ - public ClientResponse updateItem(String vcsid, String csid, MultipartOutput multipart) { - return vocabularyProxy.updateItem(vcsid, csid, multipart); - + public ClientResponse updateItem(String vcsid, String csid, PoxPayloadOut poxPayloadOut) { + String xmlPayload = poxPayloadOut.toXML(); + return vocabularyProxy.updateItem(vcsid, csid, xmlPayload); } /** diff --git a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClientUtils.java b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClientUtils.java index f07c21d8a..38b8efe1d 100644 --- a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClientUtils.java +++ b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClientUtils.java @@ -12,16 +12,16 @@ import org.collectionspace.services.client.test.ServiceRequestType; import org.collectionspace.services.vocabulary.VocabularyitemsCommon; import org.collectionspace.services.vocabulary.VocabulariesCommon; import org.jboss.resteasy.client.ClientResponse; -import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; -import org.jboss.resteasy.plugins.providers.multipart.OutputPart; +//import org.jboss.resteasy.plugins.providers.multipart.PoxPayloadOut; +//import org.jboss.resteasy.plugins.providers.multipart.OutputPart; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class VocabularyClientUtils { private static final Logger logger = LoggerFactory.getLogger(VocabularyClientUtils.class); - - public static MultipartOutput createEnumerationInstance( + + public static PoxPayloadOut createEnumerationInstance( String displayName, String shortIdentifier, String headerLabel ) { VocabulariesCommon vocabulary = new VocabulariesCommon(); vocabulary.setDisplayName(displayName); @@ -29,9 +29,9 @@ public class VocabularyClientUtils { String refName = createVocabularyRefName(shortIdentifier, displayName); vocabulary.setRefName(refName); vocabulary.setVocabType("enum"); - MultipartOutput multipart = new MultipartOutput(); - OutputPart commonPart = multipart.addPart(vocabulary, MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", headerLabel); + PoxPayloadOut multipart = new PoxPayloadOut(VocabularyClient.SERVICE_PAYLOAD_NAME); + PayloadOutputPart commonPart = multipart.addPart(vocabulary, MediaType.APPLICATION_XML_TYPE); + commonPart.setLabel(headerLabel); if(logger.isDebugEnabled()){ logger.debug("to be created, vocabulary common for enumeration ", @@ -43,7 +43,7 @@ public class VocabularyClientUtils { // Note that we do not use the map, but we will once we add more info to the // items - public static MultipartOutput createVocabularyItemInstance( + public static PoxPayloadOut createVocabularyItemInstance( String vocabularyRefName, Map vocabItemInfo, String headerLabel){ VocabularyitemsCommon vocabularyItem = new VocabularyitemsCommon(); String shortId = vocabItemInfo.get(AuthorityItemJAXBSchema.SHORT_IDENTIFIER); @@ -52,10 +52,10 @@ public class VocabularyClientUtils { vocabularyItem.setDisplayName(displayName); String refName = createVocabularyItemRefName(vocabularyRefName, shortId, displayName); vocabularyItem.setRefName(refName); - MultipartOutput multipart = new MultipartOutput(); - OutputPart commonPart = multipart.addPart(vocabularyItem, + PoxPayloadOut multipart = new PoxPayloadOut(VocabularyClient.SERVICE_ITEM_PAYLOAD_NAME); + PayloadOutputPart commonPart = multipart.addPart(vocabularyItem, MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", headerLabel); + commonPart.setLabel(headerLabel); if(logger.isDebugEnabled()){ logger.debug("to be created, vocabularyItem common ", vocabularyItem, VocabularyitemsCommon.class); @@ -76,21 +76,20 @@ public class VocabularyClientUtils { logger.debug("Import: Create Item: \""+itemMap.get(AuthorityItemJAXBSchema.SHORT_IDENTIFIER) +"\" in personAuthority: \"" + vcsid +"\""); } - MultipartOutput multipart = - createVocabularyItemInstance( vocabularyRefName, - itemMap, client.getItemCommonPartName() ); + PoxPayloadOut multipart = createVocabularyItemInstance(vocabularyRefName, + itemMap, client.getCommonPartItemName()); ClientResponse res = client.createItem(vcsid, multipart); int statusCode = res.getStatus(); if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { - throw new RuntimeException("Could not create Item: \""+itemMap.get(AuthorityItemJAXBSchema.DISPLAY_NAME) - +"\" in personAuthority: \"" + vocabularyRefName - +"\" "+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + throw new RuntimeException("Could not create Item: \"" + itemMap.get(AuthorityItemJAXBSchema.DISPLAY_NAME) + + "\" in personAuthority: \"" + vocabularyRefName + + "\" " + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); } if(statusCode != EXPECTED_STATUS_CODE) { throw new RuntimeException("Unexpected Status when creating Item: \""+itemMap.get(AuthorityItemJAXBSchema.DISPLAY_NAME) - +"\" in personAuthority: \"" + vocabularyRefName +"\", Status:"+ statusCode); + + "\" in personAuthority: \"" + vocabularyRefName + "\", Status:" + statusCode); } return extractId(res); @@ -129,17 +128,17 @@ public class VocabularyClientUtils { public static String createVocabularyRefName(String shortIdentifier, String displaySuffix) { String refName = "urn:cspace:org.collectionspace.demo:vocabulary:name(" - +shortIdentifier+")"; - if(displaySuffix!=null&&!displaySuffix.isEmpty()) - refName += "'"+displaySuffix+"'"; + + shortIdentifier + ")"; + if(displaySuffix != null && !displaySuffix.isEmpty()) + refName += "'" + displaySuffix + "'"; return refName; } public static String createVocabularyItemRefName( String vocabularyRefName, String shortIdentifier, String displaySuffix) { String refName = vocabularyRefName+":item:name("+shortIdentifier+")"; - if(displaySuffix!=null&&!displaySuffix.isEmpty()) - refName += "'"+displaySuffix+"'"; + if(displaySuffix != null && !displaySuffix.isEmpty()) + refName += "'" + displaySuffix + "'"; return refName; } 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 6d8c29192..cc111963d 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 @@ -9,23 +9,22 @@ 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.Context; +//import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; +//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; -import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; -import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; /** * @version $Revision:$ */ -@Path("/vocabularies/") -@Produces({"multipart/mixed"}) -@Consumes({"multipart/mixed"}) +//@Path("/vocabularies/") +@Path("/" + VocabularyClient.SERVICE_PATH_COMPONENT + "/") +@Produces({"application/xml"}) +@Consumes({"application/xml"}) public interface VocabularyProxy extends CollectionSpaceProxy { // List Vocabularies @@ -35,22 +34,22 @@ public interface VocabularyProxy extends CollectionSpaceProxy { //(C)reate @POST - ClientResponse create(MultipartOutput multipart); + ClientResponse create(String xmlPayload); //(R)ead @GET @Path("/{csid}") - ClientResponse read(@PathParam("csid") String csid); + ClientResponse read(@PathParam("csid") String csid); //(R)ead by name @GET @Path("/urn:cspace:name({name})") - ClientResponse readByName(@PathParam("name") String name); + ClientResponse readByName(@PathParam("name") String name); //(U)pdate @PUT @Path("/{csid}") - ClientResponse update(@PathParam("csid") String csid, MultipartOutput multipart); + ClientResponse update(@PathParam("csid") String csid, String xmlPayload); //(D)elete @DELETE @@ -78,17 +77,17 @@ public interface VocabularyProxy extends CollectionSpaceProxy { //(C)reate Item @POST @Path("/{vcsid}/items/") - ClientResponse createItem(@PathParam("vcsid") String vcsid, MultipartOutput multipart); + ClientResponse createItem(@PathParam("vcsid") String vcsid, String xmlPayload); //(R)ead @GET @Path("/{vcsid}/items/{csid}") - ClientResponse readItem(@PathParam("vcsid") String vcsid, @PathParam("csid") String csid); + ClientResponse readItem(@PathParam("vcsid") String vcsid, @PathParam("csid") String csid); //(U)pdate @PUT @Path("/{vcsid}/items/{csid}") - ClientResponse updateItem(@PathParam("vcsid") String vcsid, @PathParam("csid") String csid, MultipartOutput multipart); + ClientResponse updateItem(@PathParam("vcsid") String vcsid, @PathParam("csid") String csid, String xmlPayload); //(D)elete @DELETE 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 f68e33f1c..8f2447a7e 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 @@ -31,6 +31,9 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; +import org.collectionspace.services.client.PayloadOutputPart; +import org.collectionspace.services.client.PoxPayloadIn; +import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.VocabularyClient; import org.collectionspace.services.client.VocabularyClientUtils; import org.collectionspace.services.jaxb.AbstractCommonList; @@ -40,9 +43,6 @@ import org.collectionspace.services.vocabulary.VocabularyitemsCommon; import org.collectionspace.services.vocabulary.VocabularyitemsCommonList; import org.jboss.resteasy.client.ClientResponse; -import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; -import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; -import org.jboss.resteasy.plugins.providers.multipart.OutputPart; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -62,8 +62,12 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { private final Logger logger = LoggerFactory.getLogger(CLASS_NAME); // Instance variables specific to this test. - final String SERVICE_PATH_COMPONENT = "vocabularies"; - final String ITEM_SERVICE_PATH_COMPONENT = "items"; + final String SERVICE_PATH_COMPONENT = VocabularyClient.SERVICE_PATH_COMPONENT;//"vocabularies"; + final String SERVICE_PATH_ITEMS_COMPONENT = VocabularyClient.SERVICE_PATH_ITEMS_COMPONENT;//"items"; + + final String SERVICE_PAYLOAD_NAME = VocabularyClient.SERVICE_PAYLOAD_NAME; + final String SERVICE_ITEM_PAYLOAD_NAME = VocabularyClient.SERVICE_ITEM_PAYLOAD_NAME; + private String knownResourceId = null; private String knownResourceShortIdentifer = null; private String knownResourceRefName = null; @@ -119,7 +123,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { VocabularyClient client = new VocabularyClient(); String identifier = createIdentifier(); String displayName = "displayName-" + identifier; - MultipartOutput multipart = VocabularyClientUtils.createEnumerationInstance( + PoxPayloadOut multipart = VocabularyClientUtils.createEnumerationInstance( displayName, identifier, client.getCommonPartName()); ClientResponse res = client.create(multipart); int statusCode = res.getStatus(); @@ -227,7 +231,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // Submit the request to the service and store the response. VocabularyClient client = new VocabularyClient(); - MultipartOutput multipart = VocabularyClientUtils.createEnumerationInstance( + PoxPayloadOut multipart = VocabularyClientUtils.createEnumerationInstance( "Vocab with Bad Short Id", "Bad Short Id!", client.getCommonPartName()); ClientResponse res = client.create(multipart); int statusCode = res.getStatus(); @@ -260,9 +264,9 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { HashMap itemInfo = new HashMap(); itemInfo.put(AuthorityItemJAXBSchema.SHORT_IDENTIFIER, "Bad Item Short Id!"); itemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, "Bad Item!"); - MultipartOutput multipart = + PoxPayloadOut multipart = VocabularyClientUtils.createVocabularyItemInstance( knownResourceRefName, - itemInfo, client.getItemCommonPartName() ); + itemInfo, client.getCommonPartItemName() ); ClientResponse res = client.createItem(knownResourceId, multipart); int statusCode = res.getStatus(); @@ -384,7 +388,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // Submit the request to the service and store the response. VocabularyClient client = new VocabularyClient(); - ClientResponse res = client.read(knownResourceId); + ClientResponse res = client.read(knownResourceId); int statusCode = res.getStatus(); // Check the status code of the response: does it match @@ -397,7 +401,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); //FIXME: remove the following try catch once Aron fixes signatures try { - MultipartInput input = (MultipartInput) res.getEntity(); + PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input, client.getCommonPartName(), VocabulariesCommon.class); Assert.assertNotNull(vocabulary); @@ -425,7 +429,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // Submit the request to the service and store the response. VocabularyClient client = new VocabularyClient(); - ClientResponse res = client.readByName(knownResourceShortIdentifer); + ClientResponse res = client.readByName(knownResourceShortIdentifer); try { int statusCode = res.getStatus(); @@ -439,7 +443,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); //FIXME: remove the following try catch once Aron fixes signatures try { - MultipartInput input = (MultipartInput) res.getEntity(); + PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input, client.getCommonPartName(), VocabulariesCommon.class); Assert.assertNotNull(vocabulary); @@ -463,7 +467,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { setupRead(); // Submit the request to the service and store the response. - ClientResponse res = client.read(knownResourceId); + ClientResponse res = client.read(knownResourceId); int statusCode = res.getStatus(); // Check the status code of the response: does it match @@ -476,7 +480,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); //FIXME: remove the following try catch once Aron fixes signatures try { - MultipartInput input = (MultipartInput) res.getEntity(); + PoxPayloadIn input = (PoxPayloadIn) res.getEntity(); VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input, client.getCommonPartName(), VocabulariesCommon.class); Assert.assertNotNull(vocabulary); @@ -498,7 +502,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // Submit the request to the service and store the response. VocabularyClient client = new VocabularyClient(); - ClientResponse res = client.readItem(knownResourceId, knownItemResourceId); + ClientResponse res = client.readItem(knownResourceId, knownItemResourceId); int statusCode = res.getStatus(); // Check the status code of the response: does it match @@ -511,9 +515,9 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); // Check whether we've received a vocabulary item. - MultipartInput input = (MultipartInput) res.getEntity(); + PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); VocabularyitemsCommon vocabularyItem = (VocabularyitemsCommon) extractPart(input, - client.getItemCommonPartName(), VocabularyitemsCommon.class); + client.getCommonPartItemName(), VocabularyitemsCommon.class); Assert.assertNotNull(vocabularyItem); Assert.assertEquals(vocabularyItem.getInAuthority(), knownResourceId); } @@ -532,7 +536,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // Submit the request to the service and store the response. VocabularyClient client = new VocabularyClient(); - ClientResponse res = client.readItem(knownResourceId, knownItemResourceId); + ClientResponse res = client.readItem(knownResourceId, knownItemResourceId); int statusCode = res.getStatus(); // Check the status code of the response: does it match @@ -545,17 +549,17 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, Response.Status.OK.getStatusCode()); // Check whether Person has expected displayName. - MultipartInput input = (MultipartInput) res.getEntity(); + PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); VocabularyitemsCommon vitem = (VocabularyitemsCommon) extractPart(input, - client.getItemCommonPartName(), VocabularyitemsCommon.class); + client.getCommonPartItemName(), VocabularyitemsCommon.class); Assert.assertNotNull(vitem); // Try to Update with null displayName vitem.setDisplayName(null); // Submit the updated resource to the service and store the response. - MultipartOutput output = new MultipartOutput(); - OutputPart commonPart = output.addPart(vitem, MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", client.getItemCommonPartName()); + PoxPayloadOut output = new PoxPayloadOut(SERVICE_ITEM_PAYLOAD_NAME); + PayloadOutputPart commonPart = output.addPart(vitem, MediaType.APPLICATION_XML_TYPE); + commonPart.setLabel(client.getCommonPartItemName()); res = client.updateItem(knownResourceId, knownItemResourceId, output); statusCode = res.getStatus(); @@ -572,9 +576,9 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { vitem.setDisplayName("a"); // Submit the updated resource to the service and store the response. - output = new MultipartOutput(); + output = new PoxPayloadOut(SERVICE_ITEM_PAYLOAD_NAME); commonPart = output.addPart(vitem, MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", client.getItemCommonPartName()); + commonPart.setLabel(client.getCommonPartItemName()); res = client.updateItem(knownResourceId, knownItemResourceId, output); statusCode = res.getStatus(); @@ -601,7 +605,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // Submit the request to the service and store the response. VocabularyClient client = new VocabularyClient(); - ClientResponse res = client.read(NON_EXISTENT_ID); + ClientResponse res = client.read(NON_EXISTENT_ID); int statusCode = res.getStatus(); // Check the status code of the response: does it match @@ -626,7 +630,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // Submit the request to the service and store the response. VocabularyClient client = new VocabularyClient(); - ClientResponse res = client.readItem(knownResourceId, NON_EXISTENT_ID); + ClientResponse res = client.readItem(knownResourceId, NON_EXISTENT_ID); int statusCode = res.getStatus(); // Check the status code of the response: does it match @@ -774,7 +778,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // Retrieve the contents of a resource to update. VocabularyClient client = new VocabularyClient(); - ClientResponse res = + ClientResponse res = client.read(knownResourceId); if(logger.isDebugEnabled()){ logger.debug(testName + ": read status = " + res.getStatus()); @@ -784,7 +788,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { if(logger.isDebugEnabled()){ logger.debug("got Vocabulary to update with ID: " + knownResourceId); } - MultipartInput input = (MultipartInput) res.getEntity(); + PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input, client.getCommonPartName(), VocabulariesCommon.class); Assert.assertNotNull(vocabulary); @@ -798,9 +802,10 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { } // Submit the updated resource to the service and store the response. - MultipartOutput output = new MultipartOutput(); - OutputPart commonPart = output.addPart(vocabulary, MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", client.getCommonPartName()); + PoxPayloadOut output = new PoxPayloadOut(SERVICE_PAYLOAD_NAME); + + PayloadOutputPart commonPart = output.addPart(vocabulary, MediaType.APPLICATION_XML_TYPE); + commonPart.setLabel(client.getCommonPartName()); res = client.update(knownResourceId, output); int statusCode = res.getStatus(); @@ -813,7 +818,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); // Retrieve the updated resource and verify that its contents exist. - input = (MultipartInput) res.getEntity(); + input = new PoxPayloadIn(res.getEntity()); VocabulariesCommon updatedVocabulary = (VocabulariesCommon) extractPart(input, client.getCommonPartName(), VocabulariesCommon.class); @@ -837,7 +842,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // Retrieve the contents of a resource to update. VocabularyClient client = new VocabularyClient(); - ClientResponse res = + ClientResponse res = client.readItem(knownResourceId, knownItemResourceId); if(logger.isDebugEnabled()){ logger.debug(testName + ": read status = " + res.getStatus()); @@ -849,9 +854,9 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { knownItemResourceId + " in Vocab: " + knownResourceId ); } - MultipartInput input = (MultipartInput) res.getEntity(); + PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); VocabularyitemsCommon vocabularyItem = (VocabularyitemsCommon) extractPart(input, - client.getItemCommonPartName(), VocabularyitemsCommon.class); + client.getCommonPartItemName(), VocabularyitemsCommon.class); Assert.assertNotNull(vocabularyItem); // Update the contents of this resource. @@ -863,9 +868,9 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { } // Submit the updated resource to the service and store the response. - MultipartOutput output = new MultipartOutput(); - OutputPart commonPart = output.addPart(vocabularyItem, MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", client.getItemCommonPartName()); + PoxPayloadOut output = new PoxPayloadOut(SERVICE_ITEM_PAYLOAD_NAME); + PayloadOutputPart commonPart = output.addPart(vocabularyItem, MediaType.APPLICATION_XML_TYPE); + commonPart.setLabel(client.getCommonPartItemName()); res = client.updateItem(knownResourceId, knownItemResourceId, output); int statusCode = res.getStatus(); @@ -878,10 +883,10 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); // Retrieve the updated resource and verify that its contents exist. - input = (MultipartInput) res.getEntity(); + input = new PoxPayloadIn(res.getEntity()); VocabularyitemsCommon updatedVocabularyItem = (VocabularyitemsCommon) extractPart(input, - client.getItemCommonPartName(), VocabularyitemsCommon.class); + client.getCommonPartItemName(), VocabularyitemsCommon.class); Assert.assertNotNull(updatedVocabularyItem); // Verify that the updated resource received the correct data. @@ -902,7 +907,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // Submit the request to the service and store the response. VocabularyClient client = new VocabularyClient(); - ClientResponse res = client.readItem(knownResourceId, knownItemResourceId); + ClientResponse res = client.readItem(knownResourceId, knownItemResourceId); int statusCode = res.getStatus(); // Check the status code of the response: does it match @@ -915,9 +920,9 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); Assert.assertEquals(statusCode, Response.Status.OK.getStatusCode()); - MultipartInput input = (MultipartInput) res.getEntity(); + PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); VocabularyitemsCommon vitem = (VocabularyitemsCommon) extractPart(input, - client.getItemCommonPartName(), VocabularyitemsCommon.class); + client.getCommonPartItemName(), VocabularyitemsCommon.class); Assert.assertNotNull(vitem); // Try to Update with new parent vocab (use self, for test). Assert.assertEquals(vitem.getInAuthority(), @@ -926,9 +931,9 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { vitem.setInAuthority(knownItemResourceId); // Submit the updated resource to the service and store the response. - MultipartOutput output = new MultipartOutput(); - OutputPart commonPart = output.addPart(vitem, MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", client.getItemCommonPartName()); + PoxPayloadOut output = new PoxPayloadOut(SERVICE_ITEM_PAYLOAD_NAME); + PayloadOutputPart commonPart = output.addPart(vitem, MediaType.APPLICATION_XML_TYPE); + commonPart.setLabel(client.getCommonPartItemName()); res = client.updateItem(knownResourceId, knownItemResourceId, output); statusCode = res.getStatus(); @@ -942,10 +947,10 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // Retrieve the updated resource and verify that the parent did not change res = client.readItem(knownResourceId, knownItemResourceId); - input = (MultipartInput) res.getEntity(); + input = new PoxPayloadIn(res.getEntity()); VocabularyitemsCommon updatedVocabularyItem = (VocabularyitemsCommon) extractPart(input, - client.getItemCommonPartName(), VocabularyitemsCommon.class); + client.getCommonPartItemName(), VocabularyitemsCommon.class); Assert.assertNotNull(updatedVocabularyItem); // Verify that the updated resource received the correct data. @@ -1075,9 +1080,9 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { // The only relevant ID may be the one used in update(), below. VocabularyClient client = new VocabularyClient(); String displayName = "displayName-" + NON_EXISTENT_ID; - MultipartOutput multipart = VocabularyClientUtils.createEnumerationInstance( + PoxPayloadOut multipart = VocabularyClientUtils.createEnumerationInstance( displayName, NON_EXISTENT_ID, client.getCommonPartName()); - ClientResponse res = + ClientResponse res = client.update(NON_EXISTENT_ID, multipart); int statusCode = res.getStatus(); @@ -1108,11 +1113,11 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { HashMap itemInfo = new HashMap(); itemInfo.put(AuthorityItemJAXBSchema.SHORT_IDENTIFIER, "nonex"); itemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, "display-nonex"); - MultipartOutput multipart = + PoxPayloadOut multipart = VocabularyClientUtils.createVocabularyItemInstance( VocabularyClientUtils.createVocabularyRefName(NON_EXISTENT_ID, null), - itemInfo, client.getItemCommonPartName()); - ClientResponse res = + itemInfo, client.getCommonPartItemName()); + ClientResponse res = client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart); int statusCode = res.getStatus(); @@ -1333,8 +1338,8 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { return SERVICE_PATH_COMPONENT; } - public String getItemServicePathComponent() { - return ITEM_SERVICE_PATH_COMPONENT; + public String getServicePathItemsComponent() { + return this.SERVICE_PATH_ITEMS_COMPONENT; } /** @@ -1347,7 +1352,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { * @return The root URL for a service. */ protected String getItemServiceRootURL(String parentResourceIdentifier) { - return getResourceURL(parentResourceIdentifier) + "/" + getItemServicePathComponent(); + return getResourceURL(parentResourceIdentifier) + "/" + getServicePathItemsComponent(); } /** @@ -1362,6 +1367,8 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { return getItemServiceRootURL(parentResourceIdentifier) + "/" + resourceIdentifier; } - - + @Override + protected String getServiceName() { + return VocabularyClient.SERVICE_NAME; + } } diff --git a/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java b/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java index ec6089297..1e26c6880 100644 --- a/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java +++ b/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java @@ -29,11 +29,11 @@ import java.util.List; import javax.ws.rs.core.Response; import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; +import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.VocabularyClient; import org.collectionspace.services.client.VocabularyClientUtils; import org.collectionspace.services.client.test.ServiceRequestType; import org.jboss.resteasy.client.ClientResponse; -import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,7 +64,7 @@ public class VocabularyBaseImport { logger.debug("Import: Create vocabulary: \"" + vocabDisplayName + "\""); } String baseVocabRefName = VocabularyClientUtils.createVocabularyRefName(shortName, null); - MultipartOutput multipart = VocabularyClientUtils.createEnumerationInstance( + PoxPayloadOut multipart = VocabularyClientUtils.createEnumerationInstance( vocabDisplayName, shortName, client.getCommonPartName()); ClientResponse res = client.create(multipart); diff --git a/services/vocabulary/jaxb/.classpath b/services/vocabulary/jaxb/.classpath index fef07b28f..3de74d965 100644 --- a/services/vocabulary/jaxb/.classpath +++ b/services/vocabulary/jaxb/.classpath @@ -1,9 +1,300 @@ - - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/vocabulary/jaxb/.project b/services/vocabulary/jaxb/.project index 54569df45..fe02f33e0 100644 --- a/services/vocabulary/jaxb/.project +++ b/services/vocabulary/jaxb/.project @@ -1,23 +1,23 @@ - org.collectionspace.services.vocabulary.jaxb - + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + org.collectionspace.services.3rdparty.nuxeo.quote-api + org.collectionspace.services.client + org.collectionspace.services.common + org.collectionspace.services.hyperjaxb + org.collectionspace.services.jaxb org.eclipse.jdt.core.javabuilder - - org.maven.ide.eclipse.maven2Builder - - org.maven.ide.eclipse.maven2Nature org.eclipse.jdt.core.javanature - + \ No newline at end of file diff --git a/services/vocabulary/jaxb/.settings/org.maven.ide.eclipse.prefs b/services/vocabulary/jaxb/.settings/org.maven.ide.eclipse.prefs index cdc255801..d97eeb986 100644 --- a/services/vocabulary/jaxb/.settings/org.maven.ide.eclipse.prefs +++ b/services/vocabulary/jaxb/.settings/org.maven.ide.eclipse.prefs @@ -1,9 +1,9 @@ -#Fri Aug 06 11:15:34 PDT 2010 +#Wed Jan 19 22:49:37 PST 2011 activeProfiles= eclipse.preferences.version=1 fullBuildGoals=process-test-resources includeModules=false resolveWorkspaceProjects=true resourceFilterGoals=process-resources resources\:testResources -skipCompilerPlugin=false +skipCompilerPlugin=true version=1 diff --git a/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java b/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java index f49bcf899..7a8aa8839 100644 --- a/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java +++ b/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java @@ -36,6 +36,9 @@ import org.apache.log4j.BasicConfigurator; //import org.collectionspace.services.VocabularyItemJAXBSchema; import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; +import org.collectionspace.services.client.PayloadInputPart; +import org.collectionspace.services.client.PoxPayloadIn; +import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.VocabularyClient; import org.collectionspace.services.client.VocabularyClientUtils; import org.collectionspace.services.client.test.ServiceRequestType; @@ -44,8 +47,6 @@ import org.collectionspace.services.vocabulary.VocabulariesCommonList; import org.collectionspace.services.vocabulary.VocabularyitemsCommon; import org.collectionspace.services.vocabulary.VocabularyitemsCommonList; import org.jboss.resteasy.client.ClientResponse; -import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; -import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; import org.jboss.resteasy.plugins.providers.multipart.InputPart; import org.jboss.resteasy.plugins.providers.multipart.OutputPart; import org.slf4j.Logger; @@ -86,7 +87,7 @@ public class Sample { String displaySuffix = "displayName-" + System.currentTimeMillis(); //TODO: Laramie20100728 temp fix, made-up displaySuffix. String baseVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, displaySuffix); //TODO: Laramie20100728 temp fix was vocabName, false String fullVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, displaySuffix); //TODO: Laramie20100728 temp fix was vocabName, true - MultipartOutput multipart = VocabularyClientUtils.createEnumerationInstance( + PoxPayloadOut multipart = VocabularyClientUtils.createEnumerationInstance( vocabName, fullVocabRefName, client.getCommonPartName()); ClientResponse res = client.create(multipart); @@ -165,7 +166,7 @@ public class Sample { // Submit the request to the service and store the response. VocabulariesCommon vocabulary = null; try { - ClientResponse res = client.read(vocabId); + ClientResponse res = client.read(vocabId); int statusCode = res.getStatus(); if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { throw new RuntimeException("Could not read vocabulary" @@ -175,7 +176,7 @@ public class Sample { throw new RuntimeException("Unexpected Status when reading " + "vocabulary, Status:"+ statusCode); } - MultipartInput input = (MultipartInput) res.getEntity(); + PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); vocabulary = (VocabulariesCommon) extractPart(input, client.getCommonPartName(), VocabulariesCommon.class); } catch (Exception e) { @@ -332,10 +333,10 @@ public class Sample { } // TODO this should be moved to a common utils class - private Object extractPart(MultipartInput input, String label, + private Object extractPart(PoxPayloadIn input, String label, Class clazz) throws Exception { Object obj = null; - for(InputPart part : input.getParts()){ + for(PayloadInputPart part : input.getParts()){ String partLabel = part.getHeaders().getFirst("label"); if(label.equalsIgnoreCase(partLabel)){ String partStr = part.getBodyAsString(); diff --git a/services/vocabulary/service/.classpath b/services/vocabulary/service/.classpath index 425cd1620..b8968e0dd 100644 --- a/services/vocabulary/service/.classpath +++ b/services/vocabulary/service/.classpath @@ -1,10 +1,314 @@ - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/vocabulary/service/.project b/services/vocabulary/service/.project index 2b0d0c7de..49b08b9ce 100644 --- a/services/vocabulary/service/.project +++ b/services/vocabulary/service/.project @@ -1,25 +1,25 @@ - org.collectionspace.services.vocabulary.service - + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + org.collectionspace.services.3rdparty.nuxeo.quote-api + org.collectionspace.services.client org.collectionspace.services.common + org.collectionspace.services.hyperjaxb + org.collectionspace.services.jaxb + org.collectionspace.services.vocabulary.client org.collectionspace.services.vocabulary.jaxb org.eclipse.jdt.core.javabuilder - - org.maven.ide.eclipse.maven2Builder - - org.maven.ide.eclipse.maven2Nature org.eclipse.jdt.core.javanature - + \ No newline at end of file diff --git a/services/vocabulary/service/pom.xml b/services/vocabulary/service/pom.xml index 98805edab..8577ad0a1 100644 --- a/services/vocabulary/service/pom.xml +++ b/services/vocabulary/service/pom.xml @@ -32,6 +32,12 @@ org.collectionspace.services.vocabulary.jaxb ${project.version} + + org.collectionspace.services + org.collectionspace.services.vocabulary.client + ${project.version} + + junit diff --git a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java index 595db523b..6a0249ab7 100644 --- a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java +++ b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java @@ -23,53 +23,56 @@ */ package org.collectionspace.services.vocabulary; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; +//import javax.ws.rs.Consumes; +//import javax.ws.rs.DELETE; +//import javax.ws.rs.GET; +//import javax.ws.rs.POST; +//import javax.ws.rs.PUT; import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import javax.ws.rs.core.UriInfo; - -import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema; -import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; +//import javax.ws.rs.PathParam; +//import javax.ws.rs.Produces; +//import javax.ws.rs.QueryParam; +//import javax.ws.rs.WebApplicationException; +//import javax.ws.rs.core.Context; +//import javax.ws.rs.core.MultivaluedMap; +//import javax.ws.rs.core.Response; +//import javax.ws.rs.core.UriBuilder; +//import javax.ws.rs.core.UriInfo; + +//import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema; +//import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; import org.collectionspace.services.common.vocabulary.AuthorityResource; -import org.collectionspace.services.common.AbstractMultiPartCollectionSpaceResourceImpl; -import org.collectionspace.services.common.ClientType; -import org.collectionspace.services.common.ServiceMain; -import org.collectionspace.services.common.context.ServiceContext; -import org.collectionspace.services.common.document.BadRequestException; -import org.collectionspace.services.common.document.DocumentFilter; -import org.collectionspace.services.common.document.DocumentHandler; -import org.collectionspace.services.common.document.DocumentNotFoundException; -import org.collectionspace.services.common.security.UnauthorizedException; -import org.collectionspace.services.common.query.IQueryManager; +import org.collectionspace.services.client.VocabularyClient; + +//import org.collectionspace.services.common.AbstractMultiPartCollectionSpaceResourceImpl; +//import org.collectionspace.services.common.ClientType; +//import org.collectionspace.services.common.ServiceMain; +//import org.collectionspace.services.common.context.ServiceContext; +//import org.collectionspace.services.common.document.BadRequestException; +//import org.collectionspace.services.common.document.DocumentFilter; +//import org.collectionspace.services.common.document.DocumentHandler; +//import org.collectionspace.services.common.document.DocumentNotFoundException; +//import org.collectionspace.services.common.security.UnauthorizedException; +//import org.collectionspace.services.common.query.IQueryManager; import org.collectionspace.services.vocabulary.nuxeo.VocabularyItemDocumentModelHandler; -import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; -import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; -import org.jboss.resteasy.util.HttpResponseCodes; +//import org.jboss.resteasy.plugins.providers.multipart.PoxPayloadIn; +//import org.jboss.resteasy.plugins.providers.multipart.PoxPayloadOut; +//import org.jboss.resteasy.util.HttpResponseCodes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * The Class VocabularyResource. */ -@Path("/vocabularies") -@Consumes("multipart/mixed") -@Produces("multipart/mixed") +//@Path("/vocabularies") +@Path("/" + VocabularyClient.SERVICE_PATH_COMPONENT) public class VocabularyResource extends AuthorityResource { - private final static String vocabularyServiceName = "vocabularies"; + private final static String vocabularyServiceName = VocabularyClient.SERVICE_PATH_COMPONENT; +// private final static String vocabularyServiceName = "vocabularies"; + private final static String VOCABULARIES_COMMON = "vocabularies_common"; private final static String vocabularyItemServiceName = "vocabularyitems";