<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
- Taxonomy schema (XSD)
+ Taxon schema (XSD)
- Entity : Taxonomy
+ Entity : Taxon (item child of a TaxonomyAuthority)
Part : Common
Used for: Nuxeo EP core document type
- $LastChangedRevision$
- $LastChangedDate$
+ $LastChangedRevision: 4622 $
+ $LastChangedDate: 2011-05-05 16:51:51 -0700 (Thu, 05 May 2011) $
-->
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:ns="http://collectionspace.org/services/taxonomy"
- xmlns="http://collectionspace.org/services/taxonomy"
- targetNamespace="http://collectionspace.org/services/taxonomy"
+ xmlns:ns="http://collectionspace.org/services/taxon"
+ xmlns="http://collectionspace.org/services/taxon"
+ targetNamespace="http://collectionspace.org/services/taxon"
version="0.1"
>
<!-- See http://wiki.collectionspace.org/display/collectionspace/Taxonomy+Service+Home -->
- <!-- Taxonomy Information Group -->
+ <!-- Taxonomic Identifier Information Group -->
<!-- inAuthority is the csid of the owning TaxonomyAuthority -->
<xs:element name="inAuthority" type="xs:string" />
<xs:element name="shortIdentifier" type="xs:string"/>
import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
import org.collectionspace.services.contact.ContactsCommonList;
import org.collectionspace.services.taxonomy.TaxonomyauthorityCommonList;
-import org.collectionspace.services.taxonomy.TaxonomyCommonList;
+import org.collectionspace.services.taxonomy.TaxonCommonList;
import org.collectionspace.services.client.TaxonomyAuthorityProxy;
import org.jboss.resteasy.client.ClientResponse;
/**
* The Class TaxonomyAuthorityClient.
*/
-public class TaxonomyAuthorityClient extends AuthorityClientImpl<TaxonomyauthorityCommonList, TaxonomyCommonList, TaxonomyAuthorityProxy> {
+public class TaxonomyAuthorityClient extends AuthorityClientImpl<TaxonomyauthorityCommonList, TaxonCommonList, TaxonomyAuthorityProxy> {
public static final String SERVICE_NAME = "Taxonomyauthority";
public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
import org.apache.commons.io.FileUtils;
import org.collectionspace.services.TaxonomyJAXBSchema;
import org.collectionspace.services.client.test.ServiceRequestType;
-import org.collectionspace.services.taxonomy.TaxonomyCommon;
+import org.collectionspace.services.taxonomy.TaxonCommon;
import org.collectionspace.services.taxonomy.TaxonomyauthorityCommon;
import org.dom4j.DocumentException;
import org.jboss.resteasy.client.ClientResponse;
public static PoxPayloadOut createTaxonomyInstance(
String taxonomyAuthRefName, Map<String, String> taxonomyInfo,
String headerLabel){
- TaxonomyCommon taxonomy = new TaxonomyCommon();
+ TaxonCommon taxonomy = new TaxonCommon();
String shortId = taxonomyInfo.get(TaxonomyJAXBSchema.SHORT_IDENTIFIER);
String displayName = taxonomyInfo.get(TaxonomyJAXBSchema.DISPLAY_NAME);
taxonomy.setShortIdentifier(shortId);
commonPart.setLabel(headerLabel);
if(logger.isDebugEnabled()){
- logger.debug("to be created, taxonomy common ", taxonomy, TaxonomyCommon.class);
+ logger.debug("to be created, taxonomy common ", taxonomy, TaxonCommon.class);
}
return multipart;
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.taxonomy.TaxonomyauthorityCommonList;
-import org.collectionspace.services.taxonomy.TaxonomyCommonList;
+import org.collectionspace.services.taxonomy.TaxonCommonList;
/**
* @version $Revision$
@Path(TaxonomyAuthorityClient.SERVICE_PATH + "/")
@Produces("application/xml")
@Consumes("application/xml")
-public interface TaxonomyAuthorityProxy extends AuthorityProxy<TaxonomyauthorityCommonList, TaxonomyCommonList> {
+public interface TaxonomyAuthorityProxy extends AuthorityProxy<TaxonomyauthorityCommonList, TaxonCommonList> {
// List Taxonomyauthority
@GET
@GET
@Produces({"application/xml"})
@Path("/{csid}/items/")
- ClientResponse<TaxonomyCommonList> readItemList(
+ ClientResponse<TaxonCommonList> readItemList(
@PathParam("csid") String vcsid,
@QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
@QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
@GET
@Produces({"application/xml"})
@Path("/urn:cspace:name({specifier})/items/")
- ClientResponse<TaxonomyCommonList> readItemListForNamedAuthority(
+ ClientResponse<TaxonCommonList> readItemListForNamedAuthority(
@PathParam("specifier") String specifier,
@QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
@QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
import org.collectionspace.services.jaxb.AbstractCommonList;
import org.collectionspace.services.taxonomy.TaxonomyauthorityCommon;
import org.collectionspace.services.taxonomy.TaxonomyauthorityCommonList;
-import org.collectionspace.services.taxonomy.TaxonomyCommon;
-import org.collectionspace.services.taxonomy.TaxonomyCommonList;
+import org.collectionspace.services.taxonomy.TaxonCommon;
+import org.collectionspace.services.taxonomy.TaxonCommonList;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Override
protected AbstractCommonList getAbstractCommonList(
ClientResponse<AbstractCommonList> response) {
- return response.getEntity(TaxonomyCommonList.class);
+ return response.getEntity(TaxonCommonList.class);
}
@Override
// Check whether we've received a taxonomy.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
- TaxonomyCommon taxonomy = (TaxonomyCommon) extractPart(input,
- client.getItemCommonPartName(), TaxonomyCommon.class);
+ TaxonCommon taxonomy = (TaxonCommon) extractPart(input,
+ client.getItemCommonPartName(), TaxonCommon.class);
Assert.assertNotNull(taxonomy);
boolean showFull = true;
if(showFull && logger.isDebugEnabled()){
logger.debug(testName + ": returned payload:");
- logger.debug(objectAsXmlString(taxonomy, TaxonomyCommon.class));
+ logger.debug(objectAsXmlString(taxonomy, TaxonCommon.class));
}
Assert.assertEquals(taxonomy.getInAuthority(), knownResourceId);
} finally {
// Check whether taxonomy has expected displayName.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
- TaxonomyCommon taxonomy = (TaxonomyCommon) extractPart(input,
- client.getItemCommonPartName(), TaxonomyCommon.class);
+ TaxonCommon taxonomy = (TaxonCommon) extractPart(input,
+ client.getItemCommonPartName(), TaxonCommon.class);
Assert.assertNotNull(taxonomy);
String displayName = taxonomy.getDisplayName();
// Make sure displayName matches computed form
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
- TaxonomyCommon updatedTaxonomy =
- (TaxonomyCommon) extractPart(input,
- client.getItemCommonPartName(), TaxonomyCommon.class);
+ TaxonCommon updatedTaxonomy =
+ (TaxonCommon) extractPart(input,
+ client.getItemCommonPartName(), TaxonCommon.class);
Assert.assertNotNull(updatedTaxonomy);
// Verify that the updated resource received the correct data.
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
updatedTaxonomy =
- (TaxonomyCommon) extractPart(input,
- client.getItemCommonPartName(), TaxonomyCommon.class);
+ (TaxonCommon) extractPart(input,
+ client.getItemCommonPartName(), TaxonCommon.class);
Assert.assertNotNull(updatedTaxonomy);
// Verify that the updated resource received the correct data.
// Check whether Taxonomy has expected displayName.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
- TaxonomyCommon taxonomy = (TaxonomyCommon) extractPart(input,
- client.getItemCommonPartName(), TaxonomyCommon.class);
+ TaxonCommon taxonomy = (TaxonCommon) extractPart(input,
+ client.getItemCommonPartName(), TaxonCommon.class);
Assert.assertNotNull(taxonomy);
// Try to Update with computed false and no displayName
taxonomy.setDisplayNameComputed(false);
// Submit the request to the service and store the response.
TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
- ClientResponse<TaxonomyCommonList> res = null;
+ ClientResponse<TaxonCommonList> res = null;
if(vcsid!= null) {
res = client.readItemList(vcsid, null, null);
} else if(shortId!= null) {
Assert.fail("readItemList passed null csid and name!");
}
try {
- TaxonomyCommonList list = res.getEntity();
+ TaxonCommonList list = res.getEntity();
int statusCode = res.getStatus();
// Check the status code of the response: does it match
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
- List<TaxonomyCommonList.TaxonomyListItem> items =
- list.getTaxonomyListItem();
+ List<TaxonCommonList.TaxonListItem> items =
+ list.getTaxonListItem();
int nItemsReturned = items.size();
// There will be one item created, associated with a
// known parent resource, by the createItem test.
Assert.assertEquals(nItemsReturned, nExpectedItems);
int i = 0;
- for (TaxonomyCommonList.TaxonomyListItem item : items) {
+ for (TaxonCommonList.TaxonListItem item : items) {
Assert.assertTrue((null != item.getRefName()), "Item refName is null!");
Assert.assertTrue((null != item.getDisplayName()), "Item displayName is null!");
// Optionally output additional data about list members for debugging.
" in TaxonomyAuthority: " + knownResourceId );
}
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
- TaxonomyCommon taxonomy = (TaxonomyCommon) extractPart(input,
- client.getItemCommonPartName(), TaxonomyCommon.class);
+ TaxonCommon taxonomy = (TaxonCommon) extractPart(input,
+ client.getItemCommonPartName(), TaxonCommon.class);
Assert.assertNotNull(taxonomy);
// Update the contents of this resource.
if(logger.isDebugEnabled()){
logger.debug("to be updated Taxonomy");
logger.debug(objectAsXmlString(taxonomy,
- TaxonomyCommon.class));
+ TaxonCommon.class));
}
// Submit the updated resource to the service and store the response.
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
- TaxonomyCommon updatedTaxonomy =
- (TaxonomyCommon) extractPart(input,
- client.getItemCommonPartName(), TaxonomyCommon.class);
+ TaxonCommon updatedTaxonomy =
+ (TaxonCommon) extractPart(input,
+ client.getItemCommonPartName(), TaxonCommon.class);
Assert.assertNotNull(updatedTaxonomy);
// Verify that the updated resource received the correct data.
version="0.1"
>
-
<!-- avoid XmlRootElement nightnmare, see http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html-->
<!-- See http://wiki.collectionspace.org/display/collectionspace/Taxonomy+Service+Home -->
- <!-- Taxonomy -->
- <xs:element name="taxonomy_common">
+ <!-- Taxon (item child of a TaxonomyAuthority) -->
+ <xs:element name="taxon_common">
<xs:complexType>
<xs:sequence>
<!-- Common identifier -->
</xs:complexType>
<!-- Taxonomy instances, as in nuxeo repository -->
- <xs:element name="taxonomy-common-list">
+ <xs:element name="taxon-common-list">
<xs:complexType>
<xs:complexContent>
<xs:extension base="abstractCommonListItem">
<xs:sequence>
- <xs:element name="taxonomy_list_item" maxOccurs="unbounded">
+ <xs:element name="taxon_list_item" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="displayName" type="xs:string"
minOccurs="1" />
<xs:element name="shortIdentifier" type="xs:string"
minOccurs="1" />
- <!-- uri to retrieve taxonomy details -->
+ <!-- uri to retrieve taxon details -->
<xs:element name="uri" type="xs:anyURI"
minOccurs="1" />
<xs:element name="refName" type="xs:string"
@Produces("application/xml")
public class TaxonomyAuthorityResource
extends AuthorityResource<TaxonomyauthorityCommon, TaxonomyauthorityCommonList,
- TaxonomyCommon, TaxonomyDocumentModelHandler> {
+ TaxonCommon, TaxonomyDocumentModelHandler> {
private final static String taxonomyAuthorityServiceName = "taxonomyauthorities";
private final static String LOCATIONAUTHORITIES_COMMON = "taxonomyauthority_common";
import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
import org.collectionspace.services.nuxeo.util.NuxeoUtils;
import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.taxonomy.TaxonomyCommon;
-import org.collectionspace.services.taxonomy.TaxonomyCommonList;
-import org.collectionspace.services.taxonomy.TaxonomyCommonList.TaxonomyListItem;
+import org.collectionspace.services.taxonomy.TaxonCommon;
+import org.collectionspace.services.taxonomy.TaxonCommonList;
+import org.collectionspace.services.taxonomy.TaxonCommonList.TaxonListItem;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.DocumentModelList;
import org.slf4j.Logger;
*
*/
public class TaxonomyDocumentModelHandler
- extends AuthorityItemDocumentModelHandler<TaxonomyCommon, TaxonomyCommonList> {
+ extends AuthorityItemDocumentModelHandler<TaxonCommon, TaxonCommonList> {
/** The logger. */
private final Logger logger = LoggerFactory.getLogger(TaxonomyDocumentModelHandler.class);
* @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
*/
@Override
- public TaxonomyCommonList extractCommonPartList(
+ public TaxonCommonList extractCommonPartList(
DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
- TaxonomyCommonList coList = extractPagingInfo(new TaxonomyCommonList(), wrapDoc);
+ TaxonCommonList coList = extractPagingInfo(new TaxonCommonList(), wrapDoc);
AbstractCommonList commonList = (AbstractCommonList) coList;
commonList.setFieldsReturned("displayName|refName|shortIdentifier|uri|csid");
- List<TaxonomyCommonList.TaxonomyListItem> list = coList.getTaxonomyListItem();
+ List<TaxonCommonList.TaxonListItem> list = coList.getTaxonListItem();
Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
String commonPartLabel = getServiceContext().getCommonPartLabel(
"taxonomy");
while (iter.hasNext()) {
DocumentModel docModel = iter.next();
- TaxonomyListItem ilistItem = new TaxonomyListItem();
+ TaxonListItem ilistItem = new TaxonListItem();
ilistItem.setDisplayName((String) docModel.getProperty(
commonPartLabel, AuthorityItemJAXBSchema.DISPLAY_NAME));
ilistItem.setShortIdentifier((String) docModel.getProperty(commonPartLabel,
*/
package org.collectionspace.services.taxonomy.nuxeo;
-import org.collectionspace.services.taxonomy.TaxonomyCommon;
+import org.collectionspace.services.taxonomy.TaxonCommon;
import org.collectionspace.services.common.context.MultipartServiceContext;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.DocumentHandler.Action;
}
try {
MultipartServiceContext mctx = (MultipartServiceContext) ctx;
- TaxonomyCommon taxonomy = (TaxonomyCommon) mctx.getInputPart(mctx.getCommonPartLabel(),
- TaxonomyCommon.class);
+ TaxonCommon taxonomy = (TaxonCommon) mctx.getInputPart(mctx.getCommonPartLabel(),
+ TaxonCommon.class);
String msg = "";
boolean invalid = false;
if(!taxonomy.isDisplayNameComputed() && (taxonomy.getDisplayName()==null)) {