From: Richard Millet Date: Mon, 28 Jan 2013 20:26:28 +0000 (-0800) Subject: NOJIRA: Renaming from Article to PublicItem service. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=f0d0e309f3436655de0675f29e1c9473e554e489;p=tmp%2Fjakarta-migration.git NOJIRA: Renaming from Article to PublicItem service. --- diff --git a/services/article/3rdparty/build.xml b/services/article/3rdparty/build.xml index 0ec33548a..7f3fdf96d 100644 --- a/services/article/3rdparty/build.xml +++ b/services/article/3rdparty/build.xml @@ -1,7 +1,7 @@ - + - Article service 3rdparty + PublicItem service 3rdparty @@ -109,18 +109,18 @@ - + description="deploy publicitem in ${jee.server.nuxeo}"> + - + description="undeploy publicitem from ${jee.server.nuxeo}"> + - + description="generate distribution for publicitem" depends="package"> + diff --git a/services/article/3rdparty/nuxeo-platform-cs-article/src/main/resources/schemas/articles_common.xsd b/services/article/3rdparty/nuxeo-platform-cs-article/src/main/resources/schemas/articles_common.xsd deleted file mode 100644 index 2f288e46e..000000000 --- a/services/article/3rdparty/nuxeo-platform-cs-article/src/main/resources/schemas/articles_common.xsd +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/services/article/3rdparty/nuxeo-platform-cs-article/build.xml b/services/article/3rdparty/nuxeo-platform-cs-publicitem/build.xml similarity index 83% rename from services/article/3rdparty/nuxeo-platform-cs-article/build.xml rename to services/article/3rdparty/nuxeo-platform-cs-publicitem/build.xml index e88ea9c34..bac61c91a 100644 --- a/services/article/3rdparty/nuxeo-platform-cs-article/build.xml +++ b/services/article/3rdparty/nuxeo-platform-cs-publicitem/build.xml @@ -1,7 +1,7 @@ - + - Article nuxeo document type + PublicItem's Nuxeo document type @@ -10,10 +10,10 @@ - - + + @@ -113,24 +113,24 @@ - + + description="undeploy publicitem doctype from ${jee.server.nuxeo}"> - + + description="generate distribution for publicitem doctype" depends="package"> - + diff --git a/services/article/3rdparty/nuxeo-platform-cs-article/pom.xml b/services/article/3rdparty/nuxeo-platform-cs-publicitem/pom.xml similarity index 79% rename from services/article/3rdparty/nuxeo-platform-cs-article/pom.xml rename to services/article/3rdparty/nuxeo-platform-cs-publicitem/pom.xml index 65328eab6..be1a1be49 100644 --- a/services/article/3rdparty/nuxeo-platform-cs-article/pom.xml +++ b/services/article/3rdparty/nuxeo-platform-cs-publicitem/pom.xml @@ -5,23 +5,23 @@ org.collectionspace.services - org.collectionspace.services.article.3rdparty + org.collectionspace.services.publicitem.3rdparty 3.2.1-SNAPSHOT 4.0.0 org.collectionspace.services - org.collectionspace.services.article.3rdparty.nuxeo - services.article.3rdparty.nuxeo + org.collectionspace.services.publicitem.3rdparty.nuxeo + services.publicitem.3rdparty.nuxeo jar - Article Nuxeo Document Type + PublicItem Nuxeo Document Type - article - Article - articles_common + publicitem + PublicItem + publicitems_common cs_default diff --git a/services/article/3rdparty/nuxeo-platform-cs-publicitem/src/main/resources/schemas/publicitems_common.xsd b/services/article/3rdparty/nuxeo-platform-cs-publicitem/src/main/resources/schemas/publicitems_common.xsd new file mode 100644 index 000000000..ecbcd3014 --- /dev/null +++ b/services/article/3rdparty/nuxeo-platform-cs-publicitem/src/main/resources/schemas/publicitems_common.xsd @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + diff --git a/services/article/3rdparty/pom.xml b/services/article/3rdparty/pom.xml index e0622fd67..625102d11 100644 --- a/services/article/3rdparty/pom.xml +++ b/services/article/3rdparty/pom.xml @@ -3,21 +3,21 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - org.collectionspace.services.article + org.collectionspace.services.publicitem org.collectionspace.services 3.2.1-SNAPSHOT 4.0.0 - org.collectionspace.services.article.3rdparty - services.article.3rdparty + org.collectionspace.services.publicitem.3rdparty + services.publicitem.3rdparty pom - 3rd party build for article service + 3rd party build for publicitem service - nuxeo-platform-cs-article + nuxeo-platform-cs-publicitem diff --git a/services/article/build.xml b/services/article/build.xml index bc60494e8..a366a3ef8 100644 --- a/services/article/build.xml +++ b/services/article/build.xml @@ -1,7 +1,7 @@ - + - Article service + PublicItem service @@ -107,17 +107,17 @@ + description="deploy publicitem service"> + description="undeploy publicitem service"> + description="distribute publicitem service"> diff --git a/services/article/client/pom.xml b/services/article/client/pom.xml index 53173d351..73c1fc37d 100644 --- a/services/article/client/pom.xml +++ b/services/article/client/pom.xml @@ -4,13 +4,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> org.collectionspace.services - org.collectionspace.services.article + org.collectionspace.services.publicitem 3.2.1-SNAPSHOT 4.0.0 - org.collectionspace.services.article.client - services.article.client + org.collectionspace.services.publicitem.client + services.publicitem.client @@ -37,7 +37,7 @@ org.collectionspace.services - org.collectionspace.services.article.jaxb + org.collectionspace.services.publicitem.jaxb ${project.version} @@ -81,6 +81,6 @@ - collectionspace-services-article-client + collectionspace-services-publicitem-client diff --git a/services/article/client/src/main/java/org/collectionspace/services/client/ArticleClient.java b/services/article/client/src/main/java/org/collectionspace/services/client/PublicItemClient.java similarity index 89% rename from services/article/client/src/main/java/org/collectionspace/services/client/ArticleClient.java rename to services/article/client/src/main/java/org/collectionspace/services/client/PublicItemClient.java index fff3669cb..c77dde6aa 100644 --- a/services/article/client/src/main/java/org/collectionspace/services/client/ArticleClient.java +++ b/services/article/client/src/main/java/org/collectionspace/services/client/PublicItemClient.java @@ -23,7 +23,7 @@ package org.collectionspace.services.client; * $LastChangedDate$ * */ -public class ArticleClient extends AbstractCommonListPoxServiceClientImpl { +public class PublicItemClient extends AbstractCommonListPoxServiceClientImpl { public static final String SERVICE_NAME = "articles"; public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; @@ -48,8 +48,8 @@ public class ArticleClient extends AbstractCommonListPoxServiceClientImpl getProxyClass() { - return ArticleProxy.class; + public Class getProxyClass() { + return PublicItemProxy.class; } } diff --git a/services/article/client/src/main/java/org/collectionspace/services/client/ArticleProxy.java b/services/article/client/src/main/java/org/collectionspace/services/client/PublicItemProxy.java similarity index 87% rename from services/article/client/src/main/java/org/collectionspace/services/client/ArticleProxy.java rename to services/article/client/src/main/java/org/collectionspace/services/client/PublicItemProxy.java index d5f8dea80..c51fff4e0 100644 --- a/services/article/client/src/main/java/org/collectionspace/services/client/ArticleProxy.java +++ b/services/article/client/src/main/java/org/collectionspace/services/client/PublicItemProxy.java @@ -27,8 +27,8 @@ import javax.ws.rs.Produces; * $LastChangedDate$ * */ -@Path(ArticleClient.SERVICE_PATH_PROXY) +@Path(PublicItemClient.SERVICE_PATH_PROXY) @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface ArticleProxy extends CollectionSpaceCommonListPoxProxy { +public interface PublicItemProxy extends CollectionSpaceCommonListPoxProxy { } diff --git a/services/article/client/src/test/java/org/collectionspace/services/client/test/ArticleServiceTest.java b/services/article/client/src/test/java/org/collectionspace/services/client/test/PublicItemServiceTest.java similarity index 80% rename from services/article/client/src/test/java/org/collectionspace/services/client/test/ArticleServiceTest.java rename to services/article/client/src/test/java/org/collectionspace/services/client/test/PublicItemServiceTest.java index 6bdbfb363..2cab8f920 100644 --- a/services/article/client/src/test/java/org/collectionspace/services/client/test/ArticleServiceTest.java +++ b/services/article/client/src/test/java/org/collectionspace/services/client/test/PublicItemServiceTest.java @@ -24,7 +24,6 @@ package org.collectionspace.services.client.test; //import java.util.ArrayList; import java.math.BigInteger; -import java.util.Date; import javax.ws.rs.core.Response; import javax.xml.datatype.DatatypeConfigurationException; @@ -32,15 +31,13 @@ import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import org.collectionspace.services.client.AbstractCommonListUtils; -import org.collectionspace.services.client.CollectionSpaceClient; -import org.collectionspace.services.client.ArticleClient; +import org.collectionspace.services.client.PublicItemClient; import org.collectionspace.services.client.PayloadInputPart; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; -import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils; import org.collectionspace.services.jaxb.AbstractCommonList; -import org.collectionspace.services.article.ArticlesCommon; +import org.collectionspace.services.publicitem.PublicitemsCommon; import org.jboss.resteasy.client.ClientResponse; import org.testng.Assert; @@ -49,21 +46,21 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * ArticleServiceTest, carries out tests against a deployed and running Articles + * PublicItemServiceTest, carries out tests against a deployed and running PublicItem * Service. * * $LastChangedRevision$ $LastChangedDate$ */ -public class ArticleServiceTest extends - AbstractPoxServiceTestImpl { +public class PublicItemServiceTest extends + AbstractPoxServiceTestImpl { /** The logger. */ - private final String CLASS_NAME = ArticleServiceTest.class.getName(); + private final String CLASS_NAME = PublicItemServiceTest.class.getName(); private final Logger logger = LoggerFactory.getLogger(CLASS_NAME); // Instance variables specific to this test. /** The service path component. */ - final String SERVICE_NAME = "articles"; - final String SERVICE_PATH_COMPONENT = "articles"; + final String SERVICE_NAME = PublicItemClient.SERVICE_NAME; + final String SERVICE_PATH_COMPONENT = PublicItemClient.SERVICE_PATH_COMPONENT; /* * (non-Javadoc) @@ -73,8 +70,8 @@ public class ArticleServiceTest extends * () */ @Override - protected ArticleClient getClientInstance() { - return new ArticleClient(); + protected PublicItemClient getClientInstance() { + return new PublicItemClient(); } /* @@ -112,9 +109,9 @@ public class ArticleServiceTest extends setupCreate(); // Submit the request to the service and store the response. - ArticleClient client = new ArticleClient(); + PublicItemClient client = new PublicItemClient(); String identifier = createIdentifier(); - PoxPayloadOut multipart = createArticleInstance(identifier); + PoxPayloadOut multipart = createPublicItemInstance(identifier); String newID = null; ClientResponse res = client.create(multipart); try { @@ -191,7 +188,7 @@ public class ArticleServiceTest extends setupRead(); // Submit the request to the service and store the response. - ArticleClient client = new ArticleClient(); + PublicItemClient client = new PublicItemClient(); ClientResponse res = client.read(knownResourceId); PoxPayloadIn input = null; try { @@ -206,11 +203,11 @@ public class ArticleServiceTest extends // Get the common part of the response and verify that it is not null. PayloadInputPart payloadInputPart = input.getPart(client .getCommonPartName()); - ArticlesCommon articlesCommon = null; + PublicitemsCommon publicItemsCommon = null; if (payloadInputPart != null) { - articlesCommon = (ArticlesCommon) payloadInputPart.getBody(); + publicItemsCommon = (PublicitemsCommon) payloadInputPart.getBody(); } - Assert.assertNotNull(articlesCommon); + Assert.assertNotNull(publicItemsCommon); } @@ -231,7 +228,7 @@ public class ArticleServiceTest extends setupReadNonExistent(); // Submit the request to the service and store the response. - ArticleClient client = new ArticleClient(); + PublicItemClient client = new PublicItemClient(); ClientResponse res = client.read(NON_EXISTENT_ID); try { int statusCode = res.getStatus(); @@ -274,7 +271,7 @@ public class ArticleServiceTest extends // Submit the request to the service and store the response. AbstractCommonList list = null; - ArticleClient client = new ArticleClient(); + PublicItemClient client = new PublicItemClient(); ClientResponse res = client.readList(); assertStatusCode(res, testName); try { @@ -330,7 +327,7 @@ public class ArticleServiceTest extends setupRead(); // Retrieve the contents of a resource to update. - ArticleClient client = new ArticleClient(); + PublicItemClient client = new PublicItemClient(); ClientResponse res = client.read(knownResourceId); PoxPayloadIn input = null; try { @@ -348,19 +345,19 @@ public class ArticleServiceTest extends // Extract the common part from the response. PayloadInputPart payloadInputPart = input.getPart(client .getCommonPartName()); - ArticlesCommon articlesCommon = null; + PublicitemsCommon publicItemsCommon = null; if (payloadInputPart != null) { - articlesCommon = (ArticlesCommon) payloadInputPart.getBody(); + publicItemsCommon = (PublicitemsCommon) payloadInputPart.getBody(); } - Assert.assertNotNull(articlesCommon); + Assert.assertNotNull(publicItemsCommon); // Update the content of this resource. - articlesCommon.setArticleNumber("updated-" - + articlesCommon.getArticleNumber()); - articlesCommon.setArticleJobId("updated-" + articlesCommon.getArticleJobId()); + publicItemsCommon.setItemNumber("updated-" + + publicItemsCommon.getItemNumber()); + publicItemsCommon.setContentCreationJobId("updated-" + publicItemsCommon.getContentCreationJobId()); if (logger.isDebugEnabled()) { logger.debug("to be updated object"); - logger.debug(objectAsXmlString(articlesCommon, ArticlesCommon.class)); + logger.debug(objectAsXmlString(publicItemsCommon, PublicitemsCommon.class)); } setupUpdate(); @@ -369,7 +366,7 @@ public class ArticleServiceTest extends // and store the response. PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent()); PayloadOutputPart commonPart = output.addPart( - client.getCommonPartName(), articlesCommon); + client.getCommonPartName(), publicItemsCommon); res = client.update(knownResourceId, output); try { assertStatusCode(res, testName); @@ -391,29 +388,29 @@ public class ArticleServiceTest extends // Extract the updated common part from the response. payloadInputPart = input.getPart(client.getCommonPartName()); - ArticlesCommon updatedArticleCommon = null; + PublicitemsCommon updatedPublicitemsCommon = null; if (payloadInputPart != null) { - updatedArticleCommon = (ArticlesCommon) payloadInputPart.getBody(); + updatedPublicitemsCommon = (PublicitemsCommon) payloadInputPart.getBody(); } - Assert.assertNotNull(updatedArticleCommon); + Assert.assertNotNull(updatedPublicitemsCommon); // Check selected fields in the updated common part. - Assert.assertEquals(updatedArticleCommon.getArticleNumber(), - articlesCommon.getArticleNumber(), + Assert.assertEquals(updatedPublicitemsCommon.getItemNumber(), + publicItemsCommon.getItemNumber(), "Data in updated object did not match submitted data."); if (logger.isDebugEnabled()) { - logger.debug("UTF-8 data sent=" + articlesCommon.getArticleJobId() + logger.debug("UTF-8 data sent=" + publicItemsCommon.getContentCreationJobId() + "\n" + "UTF-8 data received=" - + updatedArticleCommon.getArticleJobId()); + + updatedPublicitemsCommon.getContentCreationJobId()); } - Assert.assertTrue(updatedArticleCommon.getArticleSource().contains( + Assert.assertTrue(updatedPublicitemsCommon.getContentSource().contains( getUTF8DataFragment()), "UTF-8 data retrieved '" - + updatedArticleCommon.getArticleSource() + + updatedPublicitemsCommon.getContentSource() + "' does not contain expected data '" + getUTF8DataFragment()); - Assert.assertEquals(updatedArticleCommon.getArticleJobId(), - articlesCommon.getArticleJobId(), + Assert.assertEquals(updatedPublicitemsCommon.getContentCreationJobId(), + publicItemsCommon.getContentCreationJobId(), "Data in updated object did not match submitted data."); } @@ -428,8 +425,8 @@ public class ArticleServiceTest extends // Submit the request to the service and store the response. // Note: The ID used in this 'create' call may be arbitrary. // The only relevant ID may be the one used in update(), below. - ArticleClient client = new ArticleClient(); - PoxPayloadOut multipart = createArticleInstance(NON_EXISTENT_ID); + PublicItemClient client = new PublicItemClient(); + PoxPayloadOut multipart = createPublicItemInstance(NON_EXISTENT_ID); ClientResponse res = client.update(NON_EXISTENT_ID, multipart); try { int statusCode = res.getStatus(); @@ -471,7 +468,7 @@ public class ArticleServiceTest extends setupDelete(); // Submit the request to the service and store the response. - ArticleClient client = new ArticleClient(); + PublicItemClient client = new PublicItemClient(); ClientResponse res = client.delete(knownResourceId); try { int statusCode = res.getStatus(); @@ -508,7 +505,7 @@ public class ArticleServiceTest extends setupDeleteNonExistent(); // Submit the request to the service and store the response. - ArticleClient client = new ArticleClient(); + PublicItemClient client = new PublicItemClient(); ClientResponse res = client.delete(NON_EXISTENT_ID); try { int statusCode = res.getStatus(); @@ -579,59 +576,59 @@ public class ArticleServiceTest extends @Override protected PoxPayloadOut createInstance(String identifier) { - return createArticleInstance(identifier); + return createPublicItemInstance(identifier); } /** - * Creates the article instance. + * Creates the publicitem instance. * * @param identifier * the identifier * @return the multipart output */ - private PoxPayloadOut createArticleInstance(String identifier) { - return createArticleInstance("articleNumber-" + identifier, - "articleJobId-" + identifier); + private PoxPayloadOut createPublicItemInstance(String identifier) { + return createPublicItemInstance("itemNumber-" + identifier, + "contentCreationJobId-" + identifier); } /** - * Creates the Article instance. + * Creates the PublicItem instance. * - * @param articleNumber - * the article number - * @param articleJobId - * the article asynch job ID + * @param itemNumber + * the publicitem number + * @param contentCreationJobId + * the publicitem asynch job ID * @return the multipart output */ - private PoxPayloadOut createArticleInstance(String articleNumber, - String articleJobId) { - - ArticlesCommon articlesCommon = new ArticlesCommon(); - articlesCommon.setArticleNumber(articleNumber); - articlesCommon.setArticleContentName("contentname-" + articleNumber); - articlesCommon.setArticleContentRepositoryId("42640780-82eb-4650-8a70"); - articlesCommon.setArticleContentUrl("https://github.com/collectionspace/services/blob/CSPACE-5564-REM-A/services/article/jaxb/src/main/resources/articles-common.xsd"); - articlesCommon.setArticleJobId(articleJobId); - articlesCommon.setArticleSource(getUTF8DataFragment()); + private PoxPayloadOut createPublicItemInstance(String itemNumber, + String itemJobId) { + + PublicitemsCommon publicItemsCommon = new PublicitemsCommon(); + publicItemsCommon.setItemNumber(itemNumber); + publicItemsCommon.setContentName("Inventory report-" + itemNumber); + publicItemsCommon.setContentId("42640780-82eb-4650-8a70"); + publicItemsCommon.setContentUri("publicitems/1/7eaf0780-9eeb-af50-9d76/content"); + publicItemsCommon.setContentCreationJobId(itemJobId); + publicItemsCommon.setContentSource(getUTF8DataFragment()); try { XMLGregorianCalendar expirationDate = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(2013, 12, 31, 0); - articlesCommon.setAccessExpirationDate(expirationDate); + publicItemsCommon.setContentExpirationDate(expirationDate); } catch (DatatypeConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } - articlesCommon.setAccessedCount(new BigInteger("3")); - articlesCommon.setAccessedCountLimit(new BigInteger("5")); + publicItemsCommon.setContentAccessedCount(new BigInteger("3")); + publicItemsCommon.setContentAccessCountLimit(new BigInteger("5")); PoxPayloadOut multipart = new PoxPayloadOut( this.getServicePathComponent()); PayloadOutputPart commonPart = multipart.addPart( - new ArticleClient().getCommonPartName(), articlesCommon); + new PublicItemClient().getCommonPartName(), publicItemsCommon); if (logger.isDebugEnabled()) { - logger.debug("To be created, article common:"); - logger.debug(objectAsXmlString(articlesCommon, ArticlesCommon.class)); + logger.debug("To be created, publicitem common:"); + logger.debug(objectAsXmlString(publicItemsCommon, PublicitemsCommon.class)); } return multipart; @@ -646,19 +643,19 @@ public class ArticleServiceTest extends @Override protected PoxPayloadOut createInstance(String commonPartName, String identifier) { - PoxPayloadOut result = createArticleInstance(identifier); + PoxPayloadOut result = createPublicItemInstance(identifier); return result; } @Override - protected ArticlesCommon updateInstance(ArticlesCommon commonPartObject) { + protected PublicitemsCommon updateInstance(PublicitemsCommon commonPartObject) { // TODO Auto-generated method stub return null; } @Override - protected void compareUpdatedInstances(ArticlesCommon original, - ArticlesCommon updated) throws Exception { + protected void compareUpdatedInstances(PublicitemsCommon original, + PublicitemsCommon updated) throws Exception { // TODO Auto-generated method stub } diff --git a/services/article/jaxb/pom.xml b/services/article/jaxb/pom.xml index 7532bd4ac..84f749f76 100644 --- a/services/article/jaxb/pom.xml +++ b/services/article/jaxb/pom.xml @@ -3,14 +3,14 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - org.collectionspace.services.article + org.collectionspace.services.publicitem org.collectionspace.services 3.2.1-SNAPSHOT 4.0.0 - org.collectionspace.services.article.jaxb - services.article.jaxb + org.collectionspace.services.publicitem.jaxb + services.publicitem.jaxb @@ -21,7 +21,7 @@ - collectionspace-services-article-jaxb + collectionspace-services-publicitem-jaxb install diff --git a/services/article/jaxb/src/main/java/org/collectionspace/services/ArticlesCommonJAXBSchema.java b/services/article/jaxb/src/main/java/org/collectionspace/services/ArticlesCommonJAXBSchema.java deleted file mode 100644 index c5c3e3844..000000000 --- a/services/article/jaxb/src/main/java/org/collectionspace/services/ArticlesCommonJAXBSchema.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * String constants to access XML element names of the ArticlesCommon class. - */ -package org.collectionspace.services; - -/* - - - - - - - - - - - - - - - */ - -public interface ArticlesCommonJAXBSchema { - final static String ARTICLE_NUMBER = "articleNumber"; - final static String ARTICLE_CONTENT_NAME = "articleContentName"; - final static String ARTICLE_CONTENT_REPO_ID = "articleContentRepositoryId"; - final static String ARTICLE_CONTENT_URL = "articleContentUrl"; - final static String ARTICLE_JOB_ID = "articleJobId"; - final static String ARTICLE_SOURCE = "articleSource"; - final static String ARTICLE_ACCESS_EXPIRATION_DATE = "accessExpirationDate"; - final static String ARTICLE_ACCESSED_COUNT = "accessedCount"; - final static String ARTICLE_ACCESSED_COUNT_LIMIT = "accesseedCountLimit"; -} \ No newline at end of file diff --git a/services/article/jaxb/src/main/java/org/collectionspace/services/PublicitemsCommonJAXBSchema.java b/services/article/jaxb/src/main/java/org/collectionspace/services/PublicitemsCommonJAXBSchema.java new file mode 100644 index 000000000..70516cbdd --- /dev/null +++ b/services/article/jaxb/src/main/java/org/collectionspace/services/PublicitemsCommonJAXBSchema.java @@ -0,0 +1,34 @@ +/** + * String constants to access XML element names of the ArticlesCommon class. + */ +package org.collectionspace.services; + +/* + + + + + + + + + + + + + + + + */ + +public interface PublicitemsCommonJAXBSchema { + final static String ITEM_NUMBER = "itemNumber"; + final static String ITEM_CONTENT_NAME = "itemContentName"; + final static String ITEM_CONTENT_REPO_ID = "itemContentId"; + final static String ITEM_CONTENT_URI = "itemContentUri"; + final static String ITEM_JOB_ID = "itemJobId"; + final static String ITEM_SOURCE = "itemSource"; + final static String ITEM_ACCESS_EXPIRATION_DATE = "itemExpirationDate"; + final static String ITEM_ACCESSED_COUNT = "itemCount"; + final static String ITEM_ACCESSED_COUNT_LIMIT = "itemCountLimit"; +} \ No newline at end of file diff --git a/services/article/jaxb/src/main/resources/articles-common.xsd b/services/article/jaxb/src/main/resources/articles-common.xsd deleted file mode 100644 index d1ad13753..000000000 --- a/services/article/jaxb/src/main/resources/articles-common.xsd +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/services/article/jaxb/src/main/resources/publicitems-common.xsd b/services/article/jaxb/src/main/resources/publicitems-common.xsd new file mode 100644 index 000000000..c6d874b7a --- /dev/null +++ b/services/article/jaxb/src/main/resources/publicitems-common.xsd @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/article/pom.xml b/services/article/pom.xml index 9efdae2d0..6bbb441ff 100644 --- a/services/article/pom.xml +++ b/services/article/pom.xml @@ -8,8 +8,8 @@ 4.0.0 - org.collectionspace.services.article - services.article + org.collectionspace.services.publicitem + services.publicitem pom diff --git a/services/article/service/pom.xml b/services/article/service/pom.xml index 696554f01..e9d7dd1d1 100644 --- a/services/article/service/pom.xml +++ b/services/article/service/pom.xml @@ -3,13 +3,13 @@ org.collectionspace.services - org.collectionspace.services.article + org.collectionspace.services.publicitem 3.2.1-SNAPSHOT 4.0.0 - org.collectionspace.services.article.service - services.article.service + org.collectionspace.services.publicitem.service + services.publicitem.service jar @@ -20,12 +20,12 @@ org.collectionspace.services - org.collectionspace.services.article.jaxb + org.collectionspace.services.publicitem.jaxb ${project.version} org.collectionspace.services - org.collectionspace.services.article.client + org.collectionspace.services.publicitem.client ${project.version} @@ -98,7 +98,7 @@ - collectionspace-services-article + collectionspace-services-publicitem diff --git a/services/article/service/src/main/java/org/collectionspace/services/article/nuxeo/ArticleConstants.java b/services/article/service/src/main/java/org/collectionspace/services/publicitem/nuxeo/PublicItemConstants.java similarity index 92% rename from services/article/service/src/main/java/org/collectionspace/services/article/nuxeo/ArticleConstants.java rename to services/article/service/src/main/java/org/collectionspace/services/publicitem/nuxeo/PublicItemConstants.java index a645ea40f..0a45c67b9 100644 --- a/services/article/service/src/main/java/org/collectionspace/services/article/nuxeo/ArticleConstants.java +++ b/services/article/service/src/main/java/org/collectionspace/services/publicitem/nuxeo/PublicItemConstants.java @@ -21,13 +21,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.collectionspace.services.article.nuxeo; +package org.collectionspace.services.publicitem.nuxeo; /** * ArticleConstants specifies constants for the Articles In service * */ -public class ArticleConstants { +public class PublicItemConstants { public final static String NUXEO_DOCTYPE = "Article"; public final static String NUXEO_SCHEMA_NAME = "article"; public final static String NUXEO_DC_TITLE = "CollectionSpace-Article"; diff --git a/services/article/service/src/main/java/org/collectionspace/services/article/nuxeo/ArticleDocumentModelHandler.java b/services/article/service/src/main/java/org/collectionspace/services/publicitem/nuxeo/PublicItemDocumentModelHandler.java similarity index 52% rename from services/article/service/src/main/java/org/collectionspace/services/article/nuxeo/ArticleDocumentModelHandler.java rename to services/article/service/src/main/java/org/collectionspace/services/publicitem/nuxeo/PublicItemDocumentModelHandler.java index a6782c31c..a90f709f7 100644 --- a/services/article/service/src/main/java/org/collectionspace/services/article/nuxeo/ArticleDocumentModelHandler.java +++ b/services/article/service/src/main/java/org/collectionspace/services/publicitem/nuxeo/PublicItemDocumentModelHandler.java @@ -21,11 +21,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.collectionspace.services.article.nuxeo; +package org.collectionspace.services.publicitem.nuxeo; -import org.collectionspace.services.ArticlesCommonJAXBSchema; -import org.collectionspace.services.article.ArticlesCommon; -import org.collectionspace.services.client.ArticleClient; +import javax.ws.rs.core.UriInfo; + +import org.collectionspace.services.PublicitemsCommonJAXBSchema; +import org.collectionspace.services.article.PublicitemsCommon; +import org.collectionspace.services.client.PublicItemClient; import org.collectionspace.services.common.document.DocumentWrapper; import org.collectionspace.services.nuxeo.client.java.DocHandlerBase; import org.nuxeo.ecm.core.api.DocumentModel; @@ -34,8 +36,8 @@ import org.nuxeo.ecm.core.api.DocumentModel; * $LastChangedRevision$ * $LastChangedDate$ */ -public class ArticleDocumentModelHandler - extends DocHandlerBase { +public class PublicItemDocumentModelHandler + extends DocHandlerBase { @Override public void fillAllParts(DocumentWrapper wrapDoc, Action action) throws Exception { @@ -49,11 +51,27 @@ public class ArticleDocumentModelHandler // add it now. // DocumentModel documentModel = wrapDoc.getWrappedObject(); - String url = (String) documentModel.getProperty(ArticleClient.SERVICE_COMMON_PART_NAME, - ArticlesCommonJAXBSchema.ARTICLE_CONTENT_URL); - url = url.replace(ArticleClient.CSID_PATH_PARAM_VAR, documentModel.getName()); - documentModel.setProperty(ArticleClient.SERVICE_COMMON_PART_NAME, - ArticlesCommonJAXBSchema.ARTICLE_CONTENT_URL, url); + String url = (String) documentModel.getProperty(PublicItemClient.SERVICE_COMMON_PART_NAME, + PublicitemsCommonJAXBSchema.ITEM_CONTENT_URI); + url = url.replace(PublicItemClient.CSID_PATH_PARAM_VAR, documentModel.getName()); + documentModel.setProperty(PublicItemClient.SERVICE_COMMON_PART_NAME, + PublicitemsCommonJAXBSchema.ITEM_CONTENT_URI, url); } + + @Override + public void extractAllParts(DocumentWrapper wrapDoc) + throws Exception { + // + // Replace the URI with a fully qualified URL + // + DocumentModel documentModel = wrapDoc.getWrappedObject(); + String itemContentUri = (String) documentModel.getProperty(PublicItemClient.SERVICE_COMMON_PART_NAME, + PublicitemsCommonJAXBSchema.ITEM_CONTENT_URI); + UriInfo uriInfo = this.getServiceContext().getUriInfo(); + String baseUrl = uriInfo.getBaseUri().toString(); + String url = String.format("%s%s", baseUrl, itemContentUri); + documentModel.setProperty(PublicItemClient.SERVICE_COMMON_PART_NAME, + PublicitemsCommonJAXBSchema.ITEM_CONTENT_URI, url); + } } diff --git a/services/article/service/src/main/java/org/collectionspace/services/article/nuxeo/ArticleValidatorHandler.java b/services/article/service/src/main/java/org/collectionspace/services/publicitem/nuxeo/PublicItemValidatorHandler.java similarity index 73% rename from services/article/service/src/main/java/org/collectionspace/services/article/nuxeo/ArticleValidatorHandler.java rename to services/article/service/src/main/java/org/collectionspace/services/publicitem/nuxeo/PublicItemValidatorHandler.java index fb42e5cb1..01259236a 100644 --- a/services/article/service/src/main/java/org/collectionspace/services/article/nuxeo/ArticleValidatorHandler.java +++ b/services/article/service/src/main/java/org/collectionspace/services/publicitem/nuxeo/PublicItemValidatorHandler.java @@ -1,4 +1,4 @@ -package org.collectionspace.services.article.nuxeo; +package org.collectionspace.services.publicitem.nuxeo; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.document.InvalidDocumentException; @@ -7,13 +7,13 @@ import org.collectionspace.services.common.document.DocumentHandler.Action; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; -public class ArticleValidatorHandler implements ValidatorHandler { +public class PublicItemValidatorHandler implements ValidatorHandler { @Override public void validate(Action action, ServiceContext ctx) throws InvalidDocumentException { // TODO Auto-generated method stub - System.out.println("ArticleValidatorHandler executed."); + System.out.println("PublicItemValidatorHandler executed."); } diff --git a/services/article/service/src/test/java/org/collectionspace/services/test/ArticleServiceTest.java b/services/article/service/src/test/java/org/collectionspace/services/test/PublicItemServiceTest.java similarity index 50% rename from services/article/service/src/test/java/org/collectionspace/services/test/ArticleServiceTest.java rename to services/article/service/src/test/java/org/collectionspace/services/test/PublicItemServiceTest.java index 56fb8901f..b33974f83 100644 --- a/services/article/service/src/test/java/org/collectionspace/services/test/ArticleServiceTest.java +++ b/services/article/service/src/test/java/org/collectionspace/services/test/PublicItemServiceTest.java @@ -1,13 +1,10 @@ package org.collectionspace.services.test; -//import org.collectionspace.services.article.Article; -//import org.collectionspace.services.article.ArticleList; - /** * Placeholder for server-side testing of Articles service code. * * @version $Revision$ */ -public class ArticleServiceTest { +public class PublicItemServiceTest { //empty } diff --git a/services/blob/service/src/main/java/org/collectionspace/services/blob/BlobResource.java b/services/blob/service/src/main/java/org/collectionspace/services/blob/BlobResource.java index edd22d65c..d64214814 100644 --- a/services/blob/service/src/main/java/org/collectionspace/services/blob/BlobResource.java +++ b/services/blob/service/src/main/java/org/collectionspace/services/blob/BlobResource.java @@ -23,7 +23,7 @@ */ package org.collectionspace.services.blob; -import org.collectionspace.services.article.ArticlesCommon; +import org.collectionspace.services.article.PublicitemsCommon; import org.collectionspace.services.client.BlobClient; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.PayloadPart; @@ -294,7 +294,7 @@ public class BlobResource extends ResourceBase { BlobsCommon blobsCommon = getBlobsCommon(csid); StringBuffer mimeType = new StringBuffer(); InputStream contentStream = getBlobContent(ctx, csid, null /*derivative term*/, mimeType /*will get set*/); - result = ArticleUtil.publishToRepository((ArticlesCommon)null, resourceMap, uriInfo, + result = ArticleUtil.publishToRepository((PublicitemsCommon)null, resourceMap, uriInfo, getRepositoryClient(ctx), ctx, contentStream, blobsCommon.getName()); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.PUT_FAILED); @@ -318,7 +318,7 @@ public class BlobResource extends ResourceBase { BlobsCommon blobsCommon = getBlobsCommon(csid); StringBuffer mimeType = new StringBuffer(); InputStream contentStream = getBlobContent(ctx, csid, derivativeTerm, mimeType); - result = ArticleUtil.publishToRepository((ArticlesCommon)null, resourceMap, uriInfo, + result = ArticleUtil.publishToRepository((PublicitemsCommon)null, resourceMap, uriInfo, getRepositoryClient(ctx), ctx, contentStream, blobsCommon.getName()); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.CREATE_FAILED); diff --git a/services/common/src/main/java/org/collectionspace/services/common/article/ArticleResource.java b/services/common/src/main/java/org/collectionspace/services/common/article/ArticleResource.java index ae25c8e10..7f14e40c3 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/article/ArticleResource.java +++ b/services/common/src/main/java/org/collectionspace/services/common/article/ArticleResource.java @@ -26,8 +26,8 @@ package org.collectionspace.services.common.article; import java.io.InputStream; import org.collectionspace.authentication.spi.AuthNContext; -import org.collectionspace.services.article.ArticlesCommon; -import org.collectionspace.services.client.ArticleClient; +import org.collectionspace.services.article.PublicitemsCommon; +import org.collectionspace.services.client.PublicItemClient; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.common.ResourceBase; @@ -51,7 +51,7 @@ import javax.ws.rs.core.Request; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; -@Path(ArticleClient.SERVICE_PATH) +@Path(PublicItemClient.SERVICE_PATH) @Consumes("application/xml") @Produces("application/xml") public class ArticleResource extends ResourceBase { @@ -66,12 +66,12 @@ public class ArticleResource extends ResourceBase { @Override public String getServiceName() { - return ArticleClient.SERVICE_NAME; + return PublicItemClient.SERVICE_NAME; } @Override - public Class getCommonPartClass() { - return ArticlesCommon.class; + public Class getCommonPartClass() { + return PublicitemsCommon.class; } @Override @@ -81,7 +81,7 @@ public class ArticleResource extends ResourceBase { } @GET - @Path("/{csid}/{tenantId}/" + ArticleClient.PUBLICITEMS_CONTENT_SUFFIX) // "content" + @Path("/{csid}/{tenantId}/" + PublicItemClient.PUBLICITEMS_CONTENT_SUFFIX) // "content" public Response getPublishedResource( @Context Request request, @Context UriInfo uriInfo, @@ -95,7 +95,7 @@ public class ArticleResource extends ResourceBase { // RemoteServiceContext ctx = (RemoteServiceContext) createServiceContext(uriInfo); PoxPayloadOut poxPayloadOut = get(csid, ctx); - ArticlesCommon articlesCommon = (ArticlesCommon)poxPayloadOut.getPart(ArticleClient.SERVICE_COMMON_PART_NAME).getBody(); + PublicitemsCommon articlesCommon = (PublicitemsCommon)poxPayloadOut.getPart(PublicItemClient.SERVICE_COMMON_PART_NAME).getBody(); // // Get the repository blob ID and retrieve the content as a stream // diff --git a/services/common/src/main/java/org/collectionspace/services/common/article/ArticleUtil.java b/services/common/src/main/java/org/collectionspace/services/common/article/ArticleUtil.java index b03c5a6f2..6c63ba1eb 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/article/ArticleUtil.java +++ b/services/common/src/main/java/org/collectionspace/services/common/article/ArticleUtil.java @@ -5,9 +5,9 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; -import org.collectionspace.services.article.ArticlesCommon; +import org.collectionspace.services.article.PublicitemsCommon; import org.collectionspace.services.blob.BlobsCommon; -import org.collectionspace.services.client.ArticleClient; +import org.collectionspace.services.client.PublicItemClient; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.common.ResourceMap; @@ -21,29 +21,29 @@ public class ArticleUtil { /* * Sets common fields for an ArticlesCommon instance */ - private static ArticlesCommon setArticlesCommonMetadata( - ArticlesCommon articlesCommon, + private static PublicitemsCommon setArticlesCommonMetadata( + PublicitemsCommon articlesCommon, UriInfo uriInfo, ServiceContext parentCtx) { - ArticlesCommon result = articlesCommon; + PublicitemsCommon result = articlesCommon; if (result == null) { - result = new ArticlesCommon(); // If they passed in null, we'll create a new instance + result = new PublicitemsCommon(); // If they passed in null, we'll create a new instance } - String articleSource = result.getArticleSource(); - if (articleSource == null || articleSource.trim().isEmpty()) { + String itemSource = result.getItemSource(); + if (itemSource == null || itemSource.trim().isEmpty()) { String publishingService = parentCtx.getServiceName(); // Overrides any existing value - result.setArticleSource(publishingService); + result.setItemSource(publishingService); } - String publicUrl = String.format("%s%s/%s/%s/%s", // e.g., http://{base url}/articles/{csid}/{tenant ID}/content - uriInfo.getBaseUri().toString(), // the base part of the URL - ArticleClient.SERVICE_NAME, // the base service path to the Article service - ArticleClient.CSID_PATH_PARAM_VAR, // the {csid} param part that will be filled in later in ArticleDocumentModelHandler.fillAllParts() method - parentCtx.getTenantId(), // the tenant ID part - ArticleClient.PUBLICITEMS_CONTENT_SUFFIX); // the final "content" suffix - result.setArticleContentUrl(publicUrl); + String publicUri = String.format("%s/%s/%s/%s", // e.g., publicitems/{csid}/{tenant ID}/content +// uriInfo.getBaseUri().toString(), // the base part of the URL + PublicItemClient.SERVICE_NAME, // the base service path to the Article service + PublicItemClient.CSID_PATH_PARAM_VAR, // the {csid} param part that will be filled in later in ArticleDocumentModelHandler.fillAllParts() method + parentCtx.getTenantId(), // the tenant ID part + PublicItemClient.PUBLICITEMS_CONTENT_SUFFIX); // the final "content" suffix + result.setItemContentUri(publicUri); return result; } @@ -52,7 +52,7 @@ public class ArticleUtil { * Publishes a PoxPayloadOut instance for public access */ public static Response publishToRepository( - ArticlesCommon articlesCommon, + PublicitemsCommon articlesCommon, ResourceMap resourceMap, UriInfo uriInfo, ServiceContext parentCtx, @@ -60,8 +60,8 @@ public class ArticleUtil { Response result = null; articlesCommon = setArticlesCommonMetadata(articlesCommon, uriInfo, parentCtx); - PoxPayloadIn input = new PoxPayloadIn(ArticleClient.SERVICE_PAYLOAD_NAME, articlesCommon, - ArticleClient.SERVICE_COMMON_PART_NAME); + PoxPayloadIn input = new PoxPayloadIn(PublicItemClient.SERVICE_PAYLOAD_NAME, articlesCommon, + PublicItemClient.SERVICE_COMMON_PART_NAME); ArticleResource articleResource = new ArticleResource(); result = articleResource.create(parentCtx, resourceMap, uriInfo, input.getXmlPayload()); @@ -73,7 +73,7 @@ public class ArticleUtil { * Publishes a a byte stream for public access */ public static Response publishToRepository( - ArticlesCommon articlesCommon, + PublicitemsCommon articlesCommon, ResourceMap resourceMap, UriInfo uriInfo, RepositoryClient repositoryClient, @@ -86,11 +86,11 @@ public class ArticleUtil { inputStream, streamName, false); articlesCommon = setArticlesCommonMetadata(articlesCommon, uriInfo, parentCtx); - articlesCommon.setArticleContentRepositoryId(blobsCommon.getRepositoryId()); - articlesCommon.setArticleContentName(streamName); + articlesCommon.setItemContentId(blobsCommon.getRepositoryId()); + articlesCommon.setItemContentName(streamName); - PoxPayloadOut poxPayloadOut = new PoxPayloadOut(ArticleClient.SERVICE_PAYLOAD_NAME); - poxPayloadOut.addPart(ArticleClient.SERVICE_COMMON_PART_NAME, articlesCommon); + PoxPayloadOut poxPayloadOut = new PoxPayloadOut(PublicItemClient.SERVICE_PAYLOAD_NAME); + poxPayloadOut.addPart(PublicItemClient.SERVICE_COMMON_PART_NAME, articlesCommon); ArticleResource articleResource = new ArticleResource(); result = articleResource.create(parentCtx, resourceMap, uriInfo, poxPayloadOut.toXML()); diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java index 16b507172..884b61476 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java @@ -69,13 +69,11 @@ import org.collectionspace.services.common.storage.jpa.JpaStorageUtils; import org.collectionspace.services.common.api.CommonAPI; import org.collectionspace.services.common.api.RefNameUtils; import org.collectionspace.services.common.api.Tools; -import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthRefConfigInfo; import org.collectionspace.services.config.service.DocHandlerParams; import org.collectionspace.services.config.service.ListResultField; import org.collectionspace.services.config.service.ObjectPartType; -import org.collectionspace.services.config.service.ServiceBindingType; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.collectionspace.services.relation.RelationsCommon; import org.collectionspace.services.relation.RelationsCommonList; diff --git a/services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java b/services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java index 3657d6c75..f6f6c9f3f 100644 --- a/services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java +++ b/services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java @@ -27,7 +27,7 @@ import java.io.InputStream; import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.report.nuxeo.ReportDocumentModelHandler; -import org.collectionspace.services.article.ArticlesCommon; +import org.collectionspace.services.article.PublicitemsCommon; import org.collectionspace.services.client.IQueryManager; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; @@ -171,7 +171,7 @@ public class ReportResource extends ResourceBase { StringBuffer outReportFileName = new StringBuffer(); ServiceContext ctx = createServiceContext(); InputStream reportInputStream = invokeReport(ctx, csid, invContext, outMimeType, outReportFileName); - response = ArticleUtil.publishToRepository((ArticlesCommon)null, resourceMap, uriInfo, getRepositoryClient(ctx), ctx, + response = ArticleUtil.publishToRepository((PublicitemsCommon)null, resourceMap, uriInfo, getRepositoryClient(ctx), ctx, reportInputStream, outReportFileName.toString()); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.POST_FAILED);