</dependency>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.article.service</artifactId>\r
+ <artifactId>org.collectionspace.services.publicitem.service</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
<dependency>\r
import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ResourceMapHolder;
import org.collectionspace.services.common.ResourceMapImpl;
-import org.collectionspace.services.common.article.ArticleResource;
+import org.collectionspace.services.common.publicitem.PublicItemResource;
import org.collectionspace.services.common.relation.RelationResource;
import org.collectionspace.services.common.security.SecurityInterceptor;
addResourceToMapAndSingletons(new BlobResource());
addResourceToMapAndSingletons(new MovementResource());
addResourceToMapAndSingletons(new ReportResource());
- addResourceToMapAndSingletons(new ArticleResource());
+ addResourceToMapAndSingletons(new PublicItemResource());
singletons.add(new IDResource());
class="org.springframework.security.web.FilterChainProxy">
<sec:filter-chain-map path-type="ant">
<!-- Exclude the resource path to public items' content from AuthN and AuthZ. Let's us publish resources with anonymous access. -->
- <sec:filter-chain pattern="/articles/*/*/content"
+ <sec:filter-chain pattern="/publicitems/*/*/content"
filters="none"/>
<sec:filter-chain pattern="/**"
filters="securityContextPersistenceFilter,basicAuthenticationFilter,logoutFilter,exTranslationFilter,filterInvocationInterceptor"/>
+++ /dev/null
-/**
- * String constants to access XML element names of the ArticlesCommon class.
- */
-package org.collectionspace.services;
-
-/*
- <xs:element name="articles_common">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="itemNumber" type="xs:string" /> <!-- An identifier for the article (different than the CSID) -->
- <xs:element name="itemContentName" type="xs:string" /> <!-- A name for the article's content -->
- <xs:element name="itemContentId" type="xs:string" /> <!-- The backend repository ID of the article's content -->
- <xs:element name="itemContentUri" type="xs:string" /> <!-- The publicly accessible URL of the article's content -->
- <xs:element name="itemJobId" type="xs:string" /> <!-- The asynch job ID -if any -->
- <xs:element name="itemSource" type="xs:string" /> <!-- The name of the service/resource that was used to create the article. -->
- <xs:element name="itemExpirationDate" type="xs:dateTime" /> <!-- When the article is no longer available for access -->
- <xs:element name="itemCount" type="xs:integer" /> <!-- How many times the article has been accessed. -->
- <xs:element name="itemCountLimit" type="xs:integer" /> <!-- The maximum times the article can be accessed. -->
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- */
-
-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
</dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.article.client</artifactId>
+ <artifactId>org.collectionspace.services.publicitem.client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
<artifactId>nuxeo-core-api</artifactId>
- <version>${nuxeo.core.version}</version>
<exclusions>
<exclusion>
<artifactId>jboss-remoting</artifactId>
*/
package org.collectionspace.services.blob;
-import org.collectionspace.services.article.PublicitemsCommon;
+import org.collectionspace.services.publicitem.PublicitemsCommon;
import org.collectionspace.services.client.BlobClient;
import org.collectionspace.services.client.PayloadOutputPart;
import org.collectionspace.services.client.PayloadPart;
import org.collectionspace.services.common.ResourceBase;
import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ServiceMessages;
-import org.collectionspace.services.common.article.ArticleUtil;
import org.collectionspace.services.common.blob.BlobInput;
import org.collectionspace.services.common.blob.BlobUtil;
import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.publicitem.PublicItemUtil;
import org.collectionspace.services.nuxeo.client.java.CommonList;
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
BlobsCommon blobsCommon = getBlobsCommon(csid);
StringBuffer mimeType = new StringBuffer();
InputStream contentStream = getBlobContent(ctx, csid, null /*derivative term*/, mimeType /*will get set*/);
- result = ArticleUtil.publishToRepository((PublicitemsCommon)null, resourceMap, uriInfo,
+ result = PublicItemUtil.publishToRepository((PublicitemsCommon)null, resourceMap, uriInfo,
getRepositoryClient(ctx), ctx, contentStream, blobsCommon.getName());
} catch (Exception e) {
throw bigReThrow(e, ServiceMessages.PUT_FAILED);
BlobsCommon blobsCommon = getBlobsCommon(csid);
StringBuffer mimeType = new StringBuffer();
InputStream contentStream = getBlobContent(ctx, csid, derivativeTerm, mimeType);
- result = ArticleUtil.publishToRepository((PublicitemsCommon)null, resourceMap, uriInfo,
+ result = PublicItemUtil.publishToRepository((PublicitemsCommon)null, resourceMap, uriInfo,
getRepositoryClient(ctx), ctx, contentStream, blobsCommon.getName());
} catch (Exception e) {
throw bigReThrow(e, ServiceMessages.CREATE_FAILED);
<ant antfile="acquisition/build.xml" target="deploy" inheritAll="false"/>\r
<ant antfile="dimension/build.xml" target="deploy" inheritAll="false"/>\r
<ant antfile="contact/build.xml" target="deploy" inheritAll="false"/>\r
- <ant antfile="article/build.xml" target="deploy" inheritAll="false"/>\r
+ <ant antfile="publicitem/build.xml" target="deploy" inheritAll="false"/>\r
<ant antfile="JaxRsServiceProvider/build.xml" target="deploy" inheritAll="false"/>\r
</target>\r
\r
<ant antfile="vocabulary/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="organization/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="person/build.xml" target="undeploy" inheritAll="false"/>\r
- <ant antfile="article/build.xml" target="undeploy" inheritAll="false"/>\r
+ <ant antfile="publicitem/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="contact/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="dimension/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="acquisition/build.xml" target="undeploy" inheritAll="false"/>\r
</dependency>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.article.client</artifactId>\r
+ <artifactId>org.collectionspace.services.publicitem.client</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.article.jaxb</artifactId>\r
+ <artifactId>org.collectionspace.services.publicitem.jaxb</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
<!-- \r
</tenant:serviceBindings>
<!-- end account service meta-data -->
- <!-- begin Article service meta-data -->
- <tenant:serviceBindings id="Articles" name="Articles" type="procedure" version="0.1">
+ <!-- begin PublicItem service meta-data -->
+ <tenant:serviceBindings id="PublicItems" name="PublicItems" type="procedure" version="0.1">
<!-- other URI paths through which this service could be accessed -->
<!--
<service:uriPath xmlns:service='http://collectionspace.org/services/config/service'>
- /articles/*/authorityrefs/
+ /publicitems/*/authorityrefs/
</service:uriPath>
-->
<service:repositoryDomain xmlns:service="http://collectionspace.org/services/config/service">default-domain</service:repositoryDomain>
- <service:documentHandler xmlns:service="http://collectionspace.org/services/config/service">org.collectionspace.services.article.nuxeo.ArticleDocumentModelHandler</service:documentHandler>
+ <service:documentHandler xmlns:service="http://collectionspace.org/services/config/service">org.collectionspace.services.publicitem.nuxeo.PublicItemDocumentModelHandler</service:documentHandler>
<service:DocHandlerParams xmlns:service="http://collectionspace.org/services/config/service">
<service:params>
<service:ListResultsFields>
<service:ListResultField>
- <service:element>articleNumber</service:element>
- <service:xpath>articleNumber</service:xpath>
+ <service:element>itemNumber</service:element>
+ <service:xpath>itemNumber</service:xpath>
</service:ListResultField>
<service:ListResultField>
- <service:element>articleSource</service:element>
- <service:xpath>articleSource</service:xpath>
+ <service:element>contentSource</service:element>
+ <service:xpath>contentSource</service:xpath>
</service:ListResultField>
<service:ListResultField>
- <service:element>articleContentUrl</service:element>
- <service:xpath>articleContentUrl</service:xpath>
- </service:ListResultField>
+ <service:element>contentUri</service:element>
+ <service:xpath>contentUri</service:xpath>
+ </service:ListResultField>
</service:ListResultsFields>
</service:params>
</service:DocHandlerParams>
- <service:validatorHandler xmlns:service="http://collectionspace.org/services/config/service">org.collectionspace.services.article.nuxeo.ArticleValidatorHandler</service:validatorHandler>
+ <service:validatorHandler xmlns:service="http://collectionspace.org/services/config/service">org.collectionspace.services.publicitem.nuxeo.PublicItemValidatorHandler</service:validatorHandler>
<service:properties xmlns:service="http://collectionspace.org/services/config/service">
<types:item xmlns:types="http://collectionspace.org/services/config/types">
<types:key>objectNameProperty</types:key>
- <types:value>articleContentCsid</types:value>
+ <types:value>contentName</types:value>
</types:item>
<types:item xmlns:types="http://collectionspace.org/services/config/types">
<types:key>objectNumberProperty</types:key>
- <types:value>articleNumber</types:value>
+ <types:value>itemNumber</types:value>
</types:item>
</service:properties>
- <service:object xmlns:service="http://collectionspace.org/services/config/service" name="Article" version="0.1">
- <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="articles-system" updated="" order="0">
+ <service:object xmlns:service="http://collectionspace.org/services/config/service" name="PublicItem" version="0.1">
+ <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="publicitems-system" updated="" order="0">
<service:content contentType="application/xml">
<service:xmlContent namespaceURI="http://collectionspace.org/services/config/system" schemaLocation="http://collectionspace.org/services/config/system http://collectionspace.org/services/config/system/system-response.xsd" />
</service:content>
</service:part>
- <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="articles_common" updated="" order="1">
+ <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="publicitems_common" updated="" order="1">
<service:properties>
<!-- Fields containing authority term references -->
<!-- Fields containing term list / controlled vocabulary references -->
</service:properties>
<service:content contentType="application/xml">
- <service:xmlContent namespaceURI="http://collectionspace.org/services/article" schemaLocation="http://collectionspace.org/services/article http://services.collectionspace.org/article/articles_common.xsd" />
+ <service:xmlContent namespaceURI="http://collectionspace.org/services/publicitem" schemaLocation="http://collectionspace.org/services/publicitem http://services.collectionspace.org/publicitem/publicitems_common.xsd" />
</service:content>
</service:part>
<service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
</service:part>
</service:object>
</tenant:serviceBindings>
- <!-- end Article service meta-data -->
+ <!-- end PublicItem service meta-data -->
<!-- begin dimension service meta-data -->
<tenant:serviceBindings id="Dimensions" name="Dimensions" type="utility" version="0.1">
* Returns true if this resource allow anonymous access. It addition to returning 'true', this
* resources base URL path needs to be declared in the Spring Security config file's 'springSecurityFilterChain' bean.
* There needs to be a 'filter-chain' element something like the following:
- <sec:filter-chain pattern="/articles/**"
- filters="none"/>
* See the "applicationContext-security.xml" file for details.
*/
+// <sec:filter-chain pattern="/publicitems/*/*/content"
+// filters="none"/>
public boolean allowAnonymousAccess(HttpRequest request, ResourceMethod method);
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.collectionspace.services.common.article;
+package org.collectionspace.services.common.publicitem;
import java.io.InputStream;
import org.collectionspace.authentication.spi.AuthNContext;
-import org.collectionspace.services.article.PublicitemsCommon;
+import org.collectionspace.services.publicitem.PublicitemsCommon;
import org.collectionspace.services.client.PublicItemClient;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
@Path(PublicItemClient.SERVICE_PATH)
@Consumes("application/xml")
@Produces("application/xml")
-public class ArticleResource extends ResourceBase {
+public class PublicItemResource extends ResourceBase {
- final Logger logger = LoggerFactory.getLogger(ArticleResource.class);
+ final Logger logger = LoggerFactory.getLogger(PublicItemResource.class);
@Override
protected String getVersionString() {
try {
//
- // First, extract the ArticlesCommon instance.
+ // First, extract the PublicitemsCommon instance.
//
RemoteServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = (RemoteServiceContext<PoxPayloadIn, PoxPayloadOut>) createServiceContext(uriInfo);
PoxPayloadOut poxPayloadOut = get(csid, ctx);
- PublicitemsCommon articlesCommon = (PublicitemsCommon)poxPayloadOut.getPart(PublicItemClient.SERVICE_COMMON_PART_NAME).getBody();
+ PublicitemsCommon publicitemsCommon = (PublicitemsCommon)poxPayloadOut.getPart(PublicItemClient.SERVICE_COMMON_PART_NAME).getBody();
//
// Get the repository blob ID and retrieve the content as a stream
//
- String blobContentCsid = articlesCommon.getArticleContentRepositoryId();
+ String blobContentCsid = publicitemsCommon.getContentId();
StringBuffer outMimeType = new StringBuffer();
BlobOutput blobOutput = NuxeoBlobUtils.getBlobOutput(ctx, getRepositoryClient(ctx), blobContentCsid, outMimeType);
InputStream contentStream = blobOutput.getBlobInputStream();
//
Response.ResponseBuilder responseBuilder = Response.ok(contentStream, outMimeType.toString());
responseBuilder = responseBuilder.header("Content-Disposition","inline;filename=\""
- + articlesCommon.getArticleContentName() +"\"");
+ + publicitemsCommon.getContentName() +"\"");
result = responseBuilder.build();
} catch (Exception e) {
throw bigReThrow(e, ServiceMessages.READ_FAILED, csid);
-package org.collectionspace.services.common.article;
+package org.collectionspace.services.common.publicitem;
import java.io.InputStream;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
-import org.collectionspace.services.article.PublicitemsCommon;
+import org.collectionspace.services.publicitem.PublicitemsCommon;
import org.collectionspace.services.blob.BlobsCommon;
import org.collectionspace.services.client.PublicItemClient;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.TransactionException;
import org.collectionspace.services.common.imaging.nuxeo.NuxeoBlobUtils;
+import org.collectionspace.services.common.publicitem.PublicItemResource;
import org.collectionspace.services.common.repository.RepositoryClient;
-public class ArticleUtil {
+public class PublicItemUtil {
/*
- * Sets common fields for an ArticlesCommon instance
+ * Sets common fields for an PublicitemsCommon instance
*/
- private static PublicitemsCommon setArticlesCommonMetadata(
- PublicitemsCommon articlesCommon,
+ private static PublicitemsCommon setCommonMetadata(
+ PublicitemsCommon publicitemsCommon,
UriInfo uriInfo,
ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx) {
- PublicitemsCommon result = articlesCommon;
+ PublicitemsCommon result = publicitemsCommon;
if (result == null) {
result = new PublicitemsCommon(); // If they passed in null, we'll create a new instance
}
- String itemSource = result.getItemSource();
+ String itemSource = result.getContentSource();
if (itemSource == null || itemSource.trim().isEmpty()) {
String publishingService = parentCtx.getServiceName(); // Overrides any existing value
- result.setItemSource(publishingService);
+ result.setContentSource(publishingService);
}
- 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
+ //
+ // Store just a partial URL -just the CollectionSpace specific URI without the base URL.
+ //
+ String publicUri = String.format("%s/%s/%s/%s", // e.g., publicitems/{tenant ID}/{csid}/content
+ PublicItemClient.SERVICE_NAME, // the base service path to the PublicItem service
+ PublicItemClient.CSID_PATH_PARAM_VAR, // the {csid} param part that will be filled in later in PublicItemDocumentModelHandler.fillAllParts() method
parentCtx.getTenantId(), // the tenant ID part
PublicItemClient.PUBLICITEMS_CONTENT_SUFFIX); // the final "content" suffix
- result.setItemContentUri(publicUri);
+ result.setContentUri(publicUri);
return result;
}
* Publishes a PoxPayloadOut instance for public access
*/
public static Response publishToRepository(
- PublicitemsCommon articlesCommon,
+ PublicitemsCommon publicitemsCommon,
ResourceMap resourceMap,
UriInfo uriInfo,
ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx,
PoxPayloadOut poxPayloadOut) {
Response result = null;
- articlesCommon = setArticlesCommonMetadata(articlesCommon, uriInfo, parentCtx);
- PoxPayloadIn input = new PoxPayloadIn(PublicItemClient.SERVICE_PAYLOAD_NAME, articlesCommon,
+ publicitemsCommon = setCommonMetadata(publicitemsCommon, uriInfo, parentCtx);
+ PoxPayloadIn input = new PoxPayloadIn(PublicItemClient.SERVICE_PAYLOAD_NAME, publicitemsCommon,
PublicItemClient.SERVICE_COMMON_PART_NAME);
- ArticleResource articleResource = new ArticleResource();
- result = articleResource.create(parentCtx, resourceMap, uriInfo, input.getXmlPayload());
+ PublicItemResource publicItemResource = new PublicItemResource();
+ result = publicItemResource.create(parentCtx, resourceMap, uriInfo, input.getXmlPayload());
return result;
}
* Publishes a a byte stream for public access
*/
public static Response publishToRepository(
- PublicitemsCommon articlesCommon,
+ PublicitemsCommon publicitemsCommon,
ResourceMap resourceMap,
UriInfo uriInfo,
RepositoryClient<PoxPayloadIn, PoxPayloadOut> repositoryClient,
BlobsCommon blobsCommon = NuxeoBlobUtils.createBlobInRepository(parentCtx, repositoryClient,
inputStream, streamName, false);
- articlesCommon = setArticlesCommonMetadata(articlesCommon, uriInfo, parentCtx);
- articlesCommon.setItemContentId(blobsCommon.getRepositoryId());
- articlesCommon.setItemContentName(streamName);
+ publicitemsCommon = setCommonMetadata(publicitemsCommon, uriInfo, parentCtx);
+ publicitemsCommon.setContentId(blobsCommon.getRepositoryId());
+ publicitemsCommon.setContentName(streamName);
PoxPayloadOut poxPayloadOut = new PoxPayloadOut(PublicItemClient.SERVICE_PAYLOAD_NAME);
- poxPayloadOut.addPart(PublicItemClient.SERVICE_COMMON_PART_NAME, articlesCommon);
+ poxPayloadOut.addPart(PublicItemClient.SERVICE_COMMON_PART_NAME, publicitemsCommon);
- ArticleResource articleResource = new ArticleResource();
- result = articleResource.create(parentCtx, resourceMap, uriInfo, poxPayloadOut.toXML());
+ PublicItemResource publicItemResource = new PublicItemResource();
+ result = publicItemResource.create(parentCtx, resourceMap, uriInfo, poxPayloadOut.toXML());
return result;
}
super.handleUpdate(wrapDoc);
}
+ @Override
+ protected void handleRefNameChanges(ServiceContext ctx, DocumentModel docModel) throws ClientException {
+ //
+ // We are intentionally overriding this method to do nothing since the Workflow resource is a meta-resource without a refname
+ //
+ }
+
/*
* Handle read (GET)
*/
private final Logger logger = LoggerFactory.getLogger(DocumentModelHandler.class);
private RepositoryInstance repositorySession;
- protected String oldRefNameOnUpdate = null;
- protected String newRefNameOnUpdate = null;
+ protected String oldRefNameOnUpdate = null; // FIXME: REM - We should have setters and getters for these
+ protected String newRefNameOnUpdate = null; // FIXME: two fields.
/*
* Map Nuxeo's life cycle object to our JAX-B based life cycle object
return result;
}
- private void handleRefNameChanges(ServiceContext ctx, DocumentModel docModel) throws ClientException {
+ protected void handleRefNameChanges(ServiceContext ctx, DocumentModel docModel) throws ClientException {
// First get the old refName
this.oldRefNameOnUpdate = (String)docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME);
if (refName != null) {
this.newRefNameOnUpdate = refName.toString();
} else {
- logger.error(String.format("refName for document is missing. Document CSID=%s", docModel.getName()));
+ logger.error(String.format("The refName for document is missing. Document CSID=%s", docModel.getName())); // FIXME: REM - We should probably be throwing an exception here?
}
//
// Set the refName if it is an update or if the old refName was empty or null
@Override
public void handleWorkflowTransition(DocumentWrapper<DocumentModel> wrapDoc, TransitionDef transitionDef)
throws Exception {
- // Do nothing by default, but children can override if they want. The really workflow transition happens in the WorkflowDocumemtModelHandler class
+ // Do nothing by default, but children can override if they want. The real workflow transition happens in the WorkflowDocumemtModelHandler class
}
@Override
<module>contact</module>
<module>workflow</module>
<module>media</module>
- <module>article</module>
+ <module>publicitem</module>
<!--module>sdk</module-->
<module>IntegrationTests</module>
<module>PerformanceTests</module>
package org.collectionspace.services.client;
/**
- * ArticleClient.java
+ * PublicItemClient.java
*
* $LastChangedRevision$
* $LastChangedDate$
*/
public class PublicItemClient extends AbstractCommonListPoxServiceClientImpl<PublicItemProxy> {
- public static final String SERVICE_NAME = "articles";
+ public static final String SERVICE_NAME = "publicitems";
public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
import javax.ws.rs.Produces;
/**
- * ArticleProxy.java
+ * PublicItemProxy.java
*
* $LastChangedRevision$
* $LastChangedDate$
--- /dev/null
+/**
+ * String constants to access XML element names of the PublicitemsCommon class.
+ */
+package org.collectionspace.services;
+
+/*
+ <xs:element name="publicitems_common">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="itemNumber" type="xs:string" /> <!-- An identifier for the publicitem (different than the CSID) -->
+ <xs:element name="contentName" type="xs:string" /> <!-- A name for the publicitem's content -->
+ <xs:element name="contentId" type="xs:string" /> <!-- The the ID of the content blob in the back-end repository -->
+ <xs:element name="contentUri" type="xs:string" /> <!-- The publicly accessible URL of the publicitem's content -->
+ <xs:element name="contentCreationJobId" type="xs:string" /> <!-- The asynch job ID -if any -->
+ <xs:element name="contentSource" type="xs:string" /> <!-- The name of the service/resource that was used to create the publicitem. -->
+ <xs:element name="contentExpirationDate" type="xs:dateTime" /> <!-- When the publicitem is no longer available for access -->
+ <xs:element name="contentAccessedCount" type="xs:integer" /> <!-- How many times the publicitem has been accessed. -->
+ <xs:element name="contentAccessCountLimit" type="xs:integer" /> <!-- The maximum times the publicitem can be accessed. -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ */
+
+public interface PublicitemsCommonJAXBSchema {
+ final static String ITEM_NUMBER = "itemNumber";
+ final static String ITEM_CONTENT_NAME = "contentName";
+ final static String ITEM_CONTENT_REPO_ID = "contentId";
+ final static String ITEM_CONTENT_URI = "contentUri";
+ final static String ITEM_JOB_ID = "contentCreationJobId";
+ final static String ITEM_SOURCE = "contentSource";
+ final static String ITEM_ACCESS_EXPIRATION_DATE = "contentExpirationDate";
+ final static String ITEM_ACCESSED_COUNT = "contentAccessedCount";
+ final static String ITEM_ACCESSED_COUNT_LIMIT = "contentAccessCountLimit";
+}
\ No newline at end of file
package org.collectionspace.services.publicitem.nuxeo;
/**
- * ArticleConstants specifies constants for the Articles In service
+ * PublicItemConstants specifies constants for the PubicItem service
*
*/
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";
+ public final static String NUXEO_DOCTYPE = "PublicItem";
+ public final static String NUXEO_SCHEMA_NAME = "publicitem";
+ public final static String NUXEO_DC_TITLE = "CollectionSpace-PublicItem";
}
import javax.ws.rs.core.UriInfo;
import org.collectionspace.services.PublicitemsCommonJAXBSchema;
-import org.collectionspace.services.article.PublicitemsCommon;
+import org.collectionspace.services.publicitem.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;
-/** ArticleDocumentModelHandler
+/** PublicItemDocumentModelHandler
* $LastChangedRevision$
* $LastChangedDate$
*/
public void extractAllParts(DocumentWrapper<DocumentModel> wrapDoc)
throws Exception {
//
- // Replace the URI with a fully qualified URL
+ // Replace the URI in the Nuxeo documentModel with a fully qualified URL
//
DocumentModel documentModel = wrapDoc.getWrappedObject();
String itemContentUri = (String) documentModel.getProperty(PublicItemClient.SERVICE_COMMON_PART_NAME,
String url = String.format("%s%s", baseUrl, itemContentUri);
documentModel.setProperty(PublicItemClient.SERVICE_COMMON_PART_NAME,
PublicitemsCommonJAXBSchema.ITEM_CONTENT_URI, url);
+
+ //
+ // Hand control back to the parent to extract the data from the Nuxeo document model
+ // and turn it into an XML response payload.
+ //
+ super.extractAllParts(wrapDoc);
}
}
package org.collectionspace.services.test;
/**
- * Placeholder for server-side testing of Articles service code.
+ * Placeholder for server-side testing of PublicItem service code.
*
* @version $Revision$
*/
invalidStatusCodeMessage(testRequestType, statusCode));
Assert.assertEquals(statusCode, testExpectedStatusCode);
- String articleCsid = extractId(res);
- Assert.assertNotNull(articleCsid);
+ String publicItemCsid = extractId(res);
+ Assert.assertNotNull(publicItemCsid);
}
/* (non-Javadoc)
import org.collectionspace.services.jaxb.AbstractCommonList;
import org.collectionspace.services.report.nuxeo.ReportDocumentModelHandler;
-import org.collectionspace.services.article.PublicitemsCommon;
+import org.collectionspace.services.publicitem.PublicitemsCommon;
import org.collectionspace.services.client.IQueryManager;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.common.ResourceBase;
import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ServiceMessages;
-import org.collectionspace.services.common.article.ArticleUtil;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.DocumentFilter;
import org.collectionspace.services.common.document.DocumentHandler;
import org.collectionspace.services.common.invocable.Invocable;
import org.collectionspace.services.common.invocable.InvocationContext;
+import org.collectionspace.services.common.publicitem.PublicItemUtil;
import org.collectionspace.services.common.query.QueryManager;
+import org.collectionspace.services.common.repository.RepositoryClient;
import org.collectionspace.services.common.storage.JDBCTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
/*
- * Publishes the report to the Articles service. The response is a URI to the corresponding Article resource instance in
- * the form of /articles/{csid}.
- * To access the contents of the report use a form like /articles/{csid}/{tenantId}/content. For example,
- * http://localhost:8180/cspace-services/articles/2991da78-6001-4f34-b02/1/content
+ * Publishes the report to the PublicItem service. The response is a URI to the corresponding PublicItem resource instance in
+ * the form of /publicitems/{csid}.
+ * To access the contents of the report use a form like /publicitems/{tenantId}/{csid}/content. For example,
+ * http://localhost:8180/cspace-services/publicitems/2991da78-6001-4f34-b02/1/content
*/
@POST
@Path("{csid}/publish")
StringBuffer outReportFileName = new StringBuffer();
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
InputStream reportInputStream = invokeReport(ctx, csid, invContext, outMimeType, outReportFileName);
- response = ArticleUtil.publishToRepository((PublicitemsCommon)null, resourceMap, uriInfo, getRepositoryClient(ctx), ctx,
- reportInputStream, outReportFileName.toString());
+ response = PublicItemUtil.publishToRepository(
+ (PublicitemsCommon)null,
+ resourceMap,
+ uriInfo,
+ getRepositoryClient(ctx),
+ ctx,
+ reportInputStream,
+ outReportFileName.toString());
} catch (Exception e) {
throw bigReThrow(e, ServiceMessages.POST_FAILED);
}