<?xml version="1.0"?>
<component name="org.collectionspace.acquisition.coreTypes">
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
- <schema name="acquisitions_common" prefix="acq" src="schemas/acquisitions_common.xsd"/>
+ <schema name="acquisitions_common" prefix="acquisitions_common" src="schemas/acquisitions_common.xsd"/>
</extension>
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
<doctype name="Acquisition" extends="Document">
<rows>
<row><widget>accessionDate</widget></row>
<row><widget>acquisitionAuthorizer</widget></row>
- <row><widget>AcquisitionAuthorizerDate</widget></row>
- <row><widget>AcquisitionDate</widget></row>
- <row><widget>AcquisitionFundingDenomination</widget></row>
- <row><widget>AcquisitionFundingSource</widget></row>
- <row><widget>AcquisitionFundingSourceProvisos</widget></row>
- <row><widget>AcquisitionMethod</widget></row>
- <row><widget>AcquisitionNote</widget></row>
- <row><widget>AcquisitionProvisos</widget></row>
- <row><widget>AcquisitionReason</widget></row>
- <row><widget>AcquisitionReferenceNumber</widget></row>
- <row><widget>AcquisitionSource</widget></row>
- <row><widget>GroupPurchasePriceDenomination</widget></row>
- <row><widget>GroupPurchasePriceValue</widget></row>
- <row><widget>ObjectOfferPriceDenomination</widget></row>
- <row><widget>ObjectOfferPriceValue</widget></row>
- <row><widget>ObjectPurchaseOfferPriceDenomination</widget></row>
- <row><widget>ObjectPurchaseOfferPriceValue</widget></row>
- <row><widget>ObjectPurchasePriceDenomination</widget></row>
- <row><widget>ObjectPurchasePriceValue</widget></row>
- <row><widget>OriginalObjectPurchasePriceDenomination</widget></row>
- <row><widget>OriginalObjectPurchasePriceValue</widget></row>
- <row><widget>TransferOfTitleNumber</widget></row>
+ <row><widget>acquisitionAuthorizerDate</widget></row>
+ <row><widget>acquisitionDate</widget></row>
+ <row><widget>acquisitionFundingDenomination</widget></row>
+ <row><widget>acquisitionFundingValue</widget></row>
+ <row><widget>acquisitionFundingSource</widget></row>
+ <row><widget>acquisitionFundingSourceProvisos</widget></row>
+ <row><widget>acquisitionMethod</widget></row>
+ <row><widget>acquisitionNote</widget></row>
+ <row><widget>acquisitionProvisos</widget></row>
+ <row><widget>acquisitionReason</widget></row>
+ <row><widget>acquisitionReferenceNumber</widget></row>
+ <row><widget>acquisitionSource</widget></row>
+ <row><widget>groupPurchasePriceDenomination</widget></row>
+ <row><widget>groupPurchasePriceValue</widget></row>
+ <row><widget>objectOfferPriceDenomination</widget></row>
+ <row><widget>objectOfferPriceValue</widget></row>
+ <row><widget>objectPurchaseOfferPriceDenomination</widget></row>
+ <row><widget>objectPurchaseOfferPriceValue</widget></row>
+ <row><widget>objectPurchasePriceDenomination</widget></row>
+ <row><widget>objectPurchasePriceValue</widget></row>
+ <row><widget>originalObjectPurchasePriceDenomination</widget></row>
+ <row><widget>originalObjectPurchasePriceValue</widget></row>
+ <row><widget>transferOfTitleNumber</widget></row>
<row><widget>fieldCollectionDate</widget></row>
<row><widget>fieldCollectionEventName</widget></row>
<row><widget>fieldCollectionNumber</widget></row>
</labels>
<translated>true</translated>
<fields>
- <field>acq:accessionDate</field>
+ <field>acquisitions_common:accessionDate</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</labels>
<translated>true</translated>
<fields>
- <field>acq:acquisitionAuthorizer</field>
+ <field>acquisitions_common:acquisitionAuthorizer</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionAuthorizerDate" type="text">
+ <widget name="acquisitionAuthorizerDate" type="text">
<labels>
- <label mode="any">AcquisitionAuthorizerDate</label>
+ <label mode="any">acquisitionAuthorizerDate</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:acquisitionAuthorizerDate</field>
+ <field>acquisitions_common:acquisitionAuthorizerDate</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionDate" type="text">
+ <widget name="acquisitionDate" type="text">
<labels>
- <label mode="any">AcquisitionDate</label>
+ <label mode="any">acquisitionDate</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:acquisitionDate</field>
+ <field>acquisitions_common:acquisitionDate</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionFunding" type="text">
+ <widget name="acquisitionFundingDenomination" type="text">
<labels>
- <label mode="any">AcquisitionFunding</label>
+ <label mode="any">acquisitionFundingDenomination</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:acquisitionFunding</field>
+ <field>acquisitions_common:acquisitionFundingDenomination</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionFundingDenomination" type="text">
+ <widget name="acquisitionFundingValue" type="text">
<labels>
- <label mode="any">AcquisitionFundingDenomination</label>
+ <label mode="any">acquisitionFundingValue</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:acquisitionFundingDenomination</field>
+ <field>acquisitions_common:acquisitionFundingValue</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionFundingDenomination" type="text">
+ <widget name="acquisitionFundingSource" type="text">
<labels>
- <label mode="any">AcquisitionFundingValue</label>
+ <label mode="any">acquisitionFundingSource</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:acquisitionFundingValue</field>
- </fields>
- <properties widgetMode="edit">
- <property name="styleClass">dataInputText</property>
- </properties>
- </widget>
-
- <widget name="AcquisitionFundingSource" type="text">
- <labels>
- <label mode="any">AcquisitionFundingSource</label>
- </labels>
- <translated>true</translated>
- <fields>
- <field>acq:acquisitionFundingSource</field>
+ <field>acquisitions_common:acquisitionFundingSource</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionFundingSourceProvisos" type="text">
+ <widget name="acquisitionFundingSourceProvisos" type="text">
<labels>
- <label mode="any">AcquisitionFundingSourceProvisos</label>
+ <label mode="any">acquisitionFundingSourceProvisos</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:AcquisitionFundingSourceProvisos</field>
+ <field>acquisitions_common:acquisitionFundingSourceProvisos</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionMethod" type="text">
+ <widget name="acquisitionMethod" type="text">
<labels>
- <label mode="any">AcquisitionMethod</label>
+ <label mode="any">acquisitionMethod</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:AcquisitionMethod</field>
+ <field>acquisitions_common:acquisitionMethod</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionNote" type="text">
+ <widget name="acquisitionNote" type="text">
<labels>
- <label mode="any">AcquisitionNote</label>
+ <label mode="any">acquisitionNote</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:AcquisitionNote</field>
+ <field>acquisitions_common:acquisitionNote</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionProvisos" type="text">
+ <widget name="acquisitionProvisos" type="text">
<labels>
- <label mode="any">AcquisitionProvisos</label>
+ <label mode="any">acquisitionProvisos</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:AcquisitionProvisos</field>
+ <field>acquisitions_common:acquisitionProvisos</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionReason" type="text">
+ <widget name="acquisitionReason" type="text">
<labels>
- <label mode="any">AcquisitionReason</label>
+ <label mode="any">acquisitionReason</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:AcquisitionReason</field>
+ <field>acquisitions_common:acquisitionReason</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionReferenceNumber" type="text">
+ <widget name="acquisitionReferenceNumber" type="text">
<labels>
- <label mode="any">AcquisitionReferenceNumber</label>
+ <label mode="any">acquisitionReferenceNumber</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:AcquisitionReferenceNumber</field>
+ <field>acquisitions_common:acquisitionReferenceNumber</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="AcquisitionSource" type="text">
+ <widget name="acquisitionSource" type="text">
<labels>
- <label mode="any">AcquisitionSource</label>
+ <label mode="any">acquisitionSources</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:AcquisitionSource</field>
+ <field>acquisitions_common:acquisitionSources</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="GroupPurchasePriceDenomination" type="text">
+ <widget name="groupPurchasePriceDenomination" type="text">
<labels>
- <label mode="any">GroupPurchasePriceDenomination</label>
+ <label mode="any">groupPurchasePriceDenomination</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:groupPurchasePriceDenomination</field>
+ <field>acquisitions_common:groupPurchasePriceDenomination</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="GroupPurchasePriceValue" type="text">
+ <widget name="groupPurchasePriceValue" type="text">
<labels>
- <label mode="any">GroupPurchasePriceValue</label>
+ <label mode="any">groupPurchasePriceValue</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:groupPurchasePriceValue</field>
+ <field>acquisitions_common:groupPurchasePriceValue</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="ObjectOfferPriceDenomination" type="text">
+ <widget name="objectOfferPriceDenomination" type="text">
<labels>
- <label mode="any">ObjectOfferPriceDenomination</label>
+ <label mode="any">objectOfferPriceDenomination</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:objectOfferPriceDenomination</field>
+ <field>acquisitions_common:objectOfferPriceDenomination</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="ObjectOfferPriceValue" type="text">
+ <widget name="objectOfferPriceValue" type="text">
<labels>
<label mode="any">objectOfferPriceValue</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:objectOfferPriceValue</field>
+ <field>acquisitions_common:objectOfferPriceValue</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="ObjectPurchaseOfferPriceDenomination" type="text">
+ <widget name="objectPurchaseOfferPriceDenomination" type="text">
<labels>
- <label mode="any">ObjectPurchaseOfferPriceDenomination</label>
+ <label mode="any">objectPurchaseOfferPriceDenomination</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:objectPurchaseOfferPriceDenomination</field>
+ <field>acquisitions_common:objectPurchaseOfferPriceDenomination</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="ObjectPurchaseOfferPriceValue" type="text">
+ <widget name="objectPurchaseOfferPriceValue" type="text">
<labels>
- <label mode="any">ObjectPurchaseOfferPriceValue</label>
+ <label mode="any">objectPurchaseOfferPriceValue</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:objectPurchaseOfferPriceValue</field>
+ <field>acquisitions_common:objectPurchaseOfferPriceValue</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="ObjectPurchasePriceDenomination" type="text">
+ <widget name="objectPurchasePriceDenomination" type="text">
<labels>
- <label mode="any">ObjectPurchasePriceDenomination</label>
+ <label mode="any">objectPurchasePriceDenomination</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:objectPurchasePriceDenomination</field>
+ <field>acquisitions_common:objectPurchasePriceDenomination</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="ObjectPurchasePriceValue" type="text">
+ <widget name="objectPurchasePriceValue" type="text">
<labels>
- <label mode="any">ObjectPurchasePriceValue</label>
+ <label mode="any">objectPurchasePriceValue</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:objectPurchasePriceValue</field>
+ <field>acquisitions_common:objectPurchasePriceValue</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="OriginalObjectPurchasePriceDenomination" type="text">
+ <widget name="originalObjectPurchasePriceDenomination" type="text">
<labels>
- <label mode="any">OriginalObjectPurchasePriceDenomination</label>
+ <label mode="any">originalObjectPurchasePriceDenomination</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:OriginalObjectPurchasePriceDenomination</field>
+ <field>acquisitions_common:originalObjectPurchasePriceDenomination</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="OriginalObjectPurchasePriceValue" type="text">
+ <widget name="originalObjectPurchasePriceValue" type="text">
<labels>
- <label mode="any">OriginalObjectPurchasePriceValue</label>
+ <label mode="any">originalObjectPurchasePriceValue</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:originalObjectPurchasePriceValue</field>
+ <field>acquisitions_common:originalObjectPurchasePriceValue</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</properties>
</widget>
- <widget name="TransferOfTitleNumber" type="text">
+ <widget name="transferOfTitleNumber" type="text">
<labels>
- <label mode="any">TransferOfTitleNumber</label>
+ <label mode="any">transferOfTitleNumber</label>
</labels>
<translated>true</translated>
<fields>
- <field>acq:transferOfTitleNumber</field>
+ <field>acquisitions_common:transferOfTitleNumber</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</labels>
<translated>true</translated>
<fields>
- <field>acq:fieldCollectionDate</field>
+ <field>acquisitions_common:fieldCollectionDate</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</labels>
<translated>true</translated>
<fields>
- <field>acq:fieldCollectionEventName</field>
+ <field>acquisitions_common:fieldCollectionEventName</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</labels>
<translated>true</translated>
<fields>
- <field>acq:fieldCollectionNumber</field>
+ <field>acquisitions_common:fieldCollectionNumber</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
</labels>
<translated>true</translated>
<fields>
- <field>acq:fieldCollector</field>
+ <field>acquisitions_common:fieldCollector</field>
</fields>
<properties widgetMode="edit">
<property name="styleClass">dataInputText</property>
import org.collectionspace.services.common.AbstractMultiPartCollectionSpaceResourceImpl;
import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.context.MultipartServiceContextImpl;
+import org.collectionspace.services.common.context.ServiceBindingUtils;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.DocumentFilter;
import org.collectionspace.services.common.document.DocumentNotFoundException;
getRepositoryClient(ctx).getDoc(ctx, csid);
RemoteDocumentModelHandlerImpl handler
= (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
- List<String> authRefFields = ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(RefNameServiceUtils.AUTH_REF_PROP);
+ List<String> authRefFields =
+ ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(
+ ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);
authRefList = handler.getAuthorityRefs(docWrapper, authRefFields);
} catch (UnauthorizedException ue) {
Response response = Response.status(
//import org.collectionspace.services.common.context.MultipartServiceContext;
import org.collectionspace.services.common.context.MultipartServiceContextFactory;
import org.collectionspace.services.common.context.MultipartServiceContextImpl;
+import org.collectionspace.services.common.context.ServiceBindingUtils;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.BadRequestException;
import org.collectionspace.services.common.document.DocumentFilter;
getRepositoryClient(ctx).getDoc(ctx, csid);
RemoteDocumentModelHandlerImpl handler
= (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
- List<String> authRefFields = ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(RefNameServiceUtils.AUTH_REF_PROP);
+ List<String> authRefFields =
+ ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(
+ ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);
authRefList = handler.getAuthorityRefs(docWrapper, authRefFields);
} catch (UnauthorizedException ue) {
Response response = Response.status(
<service:validatorHandler xmlns:service='http://collectionspace.org/services/common/service'>
org.collectionspace.services.collectionobject.nuxeo.CollectionObjectValidatorHandler
</service:validatorHandler>
- <service:object name="CollectionObject" version="0.1"
+ <service:properties xmlns:service='http://collectionspace.org/services/common/service'>
+ <types:item><types:key>objectNameProperty</types:key><types:value>objectName</types:value></types:item>
+ <types:item><types:key>objectNumberProperty</types:key><types:value>objectNumber</types:value></types:item>
+ </service:properties>
+ <service:object name="CollectionObject" version="0.1"
xmlns:service='http://collectionspace.org/services/common/service'>
<service:part id="0" control_group="Managed"
versionable="true" auditable="false"
<service:validatorHandler xmlns:service='http://collectionspace.org/services/common/service'>
org.collectionspace.services.intake.nuxeo.IntakeValidatorHandler
</service:validatorHandler>
+ <service:properties xmlns:service='http://collectionspace.org/services/common/service'>
+ <!-- What to use for name???
+ <types:item><types:key>objectNameProperty</types:key><types:value>objectName</types:value></types:item> -->
+ <types:item><types:key>objectNumberProperty</types:key><types:value>entryNumber</types:value></types:item>
+ </service:properties>
<service:object name="Intake" version="0.1"
xmlns:service='http://collectionspace.org/services/common/service'>
<service:part id="0" control_group="Managed"
<service:validatorHandler xmlns:service='http://collectionspace.org/services/common/service'>
org.collectionspace.services.loanin.nuxeo.LoaninValidatorHandler
</service:validatorHandler>
+ <service:properties xmlns:service='http://collectionspace.org/services/common/service'>
+ <!-- What to use for name???
+ <types:item><types:key>objectNameProperty</types:key><types:value>objectName</types:value></types:item> -->
+ <types:item><types:key>objectNumberProperty</types:key><types:value>loanInNumber</types:value></types:item>
+ </service:properties>
<service:object name="Loanin" version="0.1"
xmlns:service='http://collectionspace.org/services/common/service'>
<service:part id="0" control_group="Managed"
<types:item><types:key>authRef</types:key><types:value>borrowersContact</types:value></types:item>
<types:item><types:key>authRef</types:key><types:value>lendersAuthorizer</types:value></types:item>
<types:item><types:key>authRef</types:key><types:value>lendersContact</types:value></types:item>
- </service:properties>
+ </service:properties>
<service:content contentType="application/xml">
<service:xmlContent
namespaceURI="http://collectionspace.org/services/loanout"
<service:part id="1" control_group="Managed"
versionable="true" auditable="false"
label="organizations_common" updated="" order="1">
+ <service:properties>
+ <types:item><types:key>authRef</types:key><types:value>contactName</types:value></types:item>
+ </service:properties>
+
<service:content contentType="application/xml">
<service:xmlContent
namespaceURI="http://collectionspace.org/services/organization"
<service:validatorHandler xmlns:service='http://collectionspace.org/services/common/service'>
org.collectionspace.services.acquisition.nuxeo.AcquisitionValidatorHandler
</service:validatorHandler>
+ <service:properties xmlns:service='http://collectionspace.org/services/common/service'>
+ <!-- What to use for name???
+ <types:item><types:key>objectNameProperty</types:key><types:value>objectName</types:value></types:item> -->
+ <types:item><types:key>objectNumberProperty</types:key><types:value>acquisitionReferenceNumber</types:value></types:item>
+ </service:properties>
<service:object name="Acquisition" version="0.1"
xmlns:service='http://collectionspace.org/services/common/service'>
<service:part id="0" control_group="Managed"
* @param propName the property to fetch\r
* @return the String value of the named property\r
*/\r
- public static String getPropertyValueFromNodeList(List<PropertyType> propNodeList,\r
+ public static String getPropertyValueByNameFromNodeList(List<PropertyType> propNodeList,\r
String propName) {\r
if(propNodeList.isEmpty()) {\r
return null;\r
}\r
- return getPropertyValue(propNodeList.get(0).getItem(), propName);\r
+ return getPropertyValueByName(propNodeList.get(0).getItem(), propName);\r
}\r
\r
\r
* @param propName the property to fetch\r
* @return the String value of the named property\r
*/\r
- public static String getPropertyValue(List<PropertyItemType> propList,\r
+ public static String getPropertyValueByName(List<PropertyItemType> propList,\r
String propName) {\r
if(propName==null) {\r
throw new IllegalArgumentException("PropertyItemUtils.getPropertyValues: null property name!");\r
return null;\r
}\r
\r
+ /**\r
+ * @param propNodeList the JAXB wrapping node of for the list to search for the named property\r
+ * @param propName the name of the property of interest\r
+ * @param qualPrefix a namespace qualifier prefix (with ':') to prepend, or null\r
+ * @return a List of string values found for the named property\r
+ */\r
public static List<String> getPropertyValuesByNameInNodeList(\r
- List<PropertyType> propNodeList, String propName) {\r
- return getPropertyValuesByNameInNodeList(propNodeList, propName, null);\r
+ List<PropertyType> propNodeList, String propName, String qualPrefix) {\r
+ return getPropertyValuesByNameInNodeList(propNodeList, propName, qualPrefix, null);\r
}\r
\r
+ /**\r
+ * @param propNodeList the JAXB wrapping node of for the list to search for the named property\r
+ * @param propName the name of the property of interest\r
+ * @param qualPrefix a namespace qualifier prefix (with ':') to prepend, or null\r
+ * @param values and existing list to append values to. If null, a new one will be created.\r
+ * @return values, or that is null, a new List of string values found for the named property\r
+ */\r
public static List<String> getPropertyValuesByNameInNodeList(\r
- List<PropertyType> propNodeList, String propName, List<String> values) {\r
+ List<PropertyType> propNodeList, String propName, String qualPrefix,\r
+ List<String> values) {\r
if(propNodeList.isEmpty()) {\r
if(values==null)\r
- return new ArrayList<String>();\r
+ values = new ArrayList<String>();\r
+ return values;\r
}\r
- return getPropertyValuesByName(propNodeList.get(0).getItem(), propName, null);\r
+ return getPropertyValuesByName(propNodeList.get(0).getItem(), \r
+ propName, qualPrefix, values);\r
}\r
\r
+ /**\r
+ * @param propNodeList the Item list to search for the named property\r
+ * @param propName the name of the property of interest\r
+ * @param qualPrefix a namespace qualifier prefix (with ':') to prepend, or null\r
+ * @return a List of string values found for the named property\r
+ */\r
public static List<String> getPropertyValuesByName(\r
- List<PropertyItemType> propItems, String propName) {\r
- return getPropertyValuesByName(propItems, propName, null);\r
+ List<PropertyItemType> propItems, String propName, String qualPrefix) {\r
+ return getPropertyValuesByName(propItems, propName, qualPrefix, null);\r
}\r
\r
+ /**\r
+ * @param propNodeList the Item list to search for the named property\r
+ * @param propName the name of the property of interest\r
+ * @param qualPrefix a namespace qualifier prefix (with ':') to prepend, or null\r
+ * @param values and existing list to append values to. If null, a new one will be created.\r
+ * @return values, or that is null, a new List of string values found for the named property\r
+ */\r
public static List<String> getPropertyValuesByName(\r
- List<PropertyItemType> propItems, String propName,\r
+ List<PropertyItemType> propItems, String propName, String qualPrefix,\r
List<String> values ) {\r
if(values==null)\r
values = new ArrayList<String>();\r
if(propName.equals(propItem.getKey())) {\r
String value = propItem.getValue();\r
if(value!=null) {\r
- values.add(value);\r
+ values.add((qualPrefix!=null)?(qualPrefix+value):value);\r
}\r
}\r
}\r
TenantBindingType tenant = tenantBindings.get(tenantId);
if (tenant != null) {
for (ServiceBindingType sb : tenant.getServiceBindings()) {
- if (sb.getType().equals(serviceType)) {
+ if (serviceType.equals(sb.getType())) {
if (list == null) {
list = new ArrayList<ServiceBindingType>();
}
return serviceWorkspaces.get(tenantService);
}
+ /**
+ * @param tenantId
+ * @param serviceName
+ * @return the properly qualified service name
+ */
public static String getTenantQualifiedServiceName(
String tenantId, String serviceName) {
return tenantId + "." + serviceName.toLowerCase();
return RepositoryClientFactory.getInstance().getClient(clientName);
}
+ /**
+ * Sets properties in the passed list on the local properties for this TenantBinding.
+ * Note: will only set properties not already set on the TenantBinding.
+ *
+ * @param propList
+ * @param propagateToServices If true, recurses to set set properties
+ * on the associated services.
+ */
public void setDefaultPropertiesOnTenants(List<PropertyItemType> propList,
boolean propagateToServices) {
// For each tenant, set properties in list that are not already set
throw new IllegalArgumentException("TenantBindingUtils.getPropertyValues: null property name!");\r
}\r
List<PropertyType> tenantPropList = tenantBinding.getProperties();\r
- return PropertyItemUtils.getPropertyValueFromNodeList(tenantPropList, propName );\r
+ return PropertyItemUtils.getPropertyValueByNameFromNodeList(tenantPropList, propName );\r
}\r
\r
/**\r
* $LastChangedRevision: $
* $LastChangedDate: $
*/
+/**
+ * @author pschmitz
+ *
+ * @param <IT>
+ * @param <OT>
+ */
+/**
+ * @author pschmitz
+ *
+ * @param <IT>
+ * @param <OT>
+ */
public abstract class AbstractServiceContextImpl<IT, OT>
implements ServiceContext<IT, OT> {
}
/**
- * Gets the property values for part.
- *
- * @param partLabel the part label
- * @param propName the prop name
- *
- * @return the property values for part
+ * @param partLabel The name of the scehma part to search in
+ * @param propName The name of the property (or properties) to find
+ * @param qualified Whether the returned values should be qualified with the
+ * partLabel. This is when the property values are schema field references.
+ * @return List of property values for the matched property on the named schema part.
*/
- public List<String> getPropertyValuesForPart(String partLabel, String propName) {
+ public List<String> getPropertyValuesForPart(String partLabel, String propName, boolean qualified) {
List<PropertyItemType> allProps = getPropertiesForPart(partLabel);
- return PropertyItemUtils.getPropertyValuesByName(allProps, propName);
+ return PropertyItemUtils.getPropertyValuesByName(allProps, propName,
+ (qualified?(partLabel+":"):null));
}
/**
- * Gets the all parts property values.
- *
- * @param propName the prop name
- *
- * @return the all parts property values
+ * @param propName The name of the property (or properties) to find
+ * @param qualified Whether the returned values should be qualified with the
+ * partLabel. This is when the property values are schema field references.
+ * @return List of property values for the matched property on any schema part.
*/
- public List<String> getAllPartsPropertyValues(String propName) {
- return ServiceBindingUtils.getAllPartsPropertyValues(getServiceBinding(), propName);
+ public List<String> getAllPartsPropertyValues(String propName, boolean qualified) {
+ return ServiceBindingUtils.getAllPartsPropertyValues(getServiceBinding(), propName, qualified);
}
/* (non-Javadoc)
}
/**
- * Gets the common part property values.
- *
- * @param propName the prop name
- *
- * @return the common part property values
+ * @param propName The name of the property (or properties) to find
+ * @param qualified Whether the returned values should be qualified with the
+ * partLabel. This is when the property values are schema field references.
+ * @return List of property values for the matched property on the common schema part.
*/
- public List<String> getCommonPartPropertyValues(String propName) {
- return getPropertyValuesForPart(getCommonPartLabel(), propName);
+ public List<String> getCommonPartPropertyValues(String propName, boolean qualified) {
+ return getPropertyValuesForPart(getCommonPartLabel(), propName, qualified);
}
/* (non-Javadoc)
import org.collectionspace.services.common.tenant.TenantBindingType;\r
import org.collectionspace.services.common.types.PropertyItemType;\r
import org.collectionspace.services.common.types.PropertyType;\r
+import org.nuxeo.ecm.core.api.ClientException;\r
+import org.nuxeo.ecm.core.api.DocumentModel;\r
\r
public class ServiceBindingUtils {\r
+ public static final boolean QUALIFIED_PROP_NAMES = true;\r
+ public static final boolean UNQUALIFIED_PROP_NAMES = false;\r
+ public static final String AUTH_REF_PROP = "authRef";\r
+ public static final String OBJ_NUMBER_PROP = "objectNumberProperty";\r
+ public static final String OBJ_NAME_PROP = "objectNameProperty";\r
+ public static final String SERVICE_TYPE_PROP = "type";\r
+ public static final String SERVICE_TYPE_OBJECT = "object";\r
+ public static final String SERVICE_TYPE_PROCEDURE = "procedure";\r
+ \r
+ // TODO consider building up a hashTable of the properties for each\r
+ // service binding. There will be generic properties, as well as\r
+ // properties on each part. Could build up a key from tenant id, \r
+ // servicename, (partname for those props), propName\r
\r
public static void getPartsMetadata(ServiceBindingType serviceBinding, \r
Map<String, ObjectPartType> objectPartMap) {\r
}\r
}\r
\r
- public static List<PropertyItemType> getPropertiesForPart(ServiceBindingType serviceBinding,\r
+ private static List<PropertyItemType> getPropertiesForPart(ServiceBindingType serviceBinding,\r
String partLabel) {\r
ServiceObjectType objectType = serviceBinding.getObject();\r
List<ObjectPartType> objectPartTypes = objectType.getPart();\r
}\r
\r
public static List<String> getPropertyValuesForPart(ServiceBindingType serviceBinding,\r
- String partLabel, String propName) {\r
+ String partLabel, String propName, boolean qualify) {\r
List<PropertyItemType> partProps = getPropertiesForPart(serviceBinding, partLabel);\r
- return PropertyItemUtils.getPropertyValuesByName(partProps, propName);\r
+ return PropertyItemUtils.getPropertyValuesByName(partProps, propName, \r
+ (qualify?(partLabel+":"):null));\r
}\r
\r
+ /**\r
+ * @param serviceBinding the service to work from\r
+ * @param propName the name of the property of interest\r
+ * @param qualify if QUALIFIED_PROP_NAMES, will prefix all values with the part label\r
+ * @return a list of (qualified)\r
+ */\r
public static List<String> getAllPartsPropertyValues(ServiceBindingType serviceBinding,\r
- String propName) {\r
+ String propName, boolean qualify) {\r
List<String> values = new ArrayList<String>();\r
ServiceObjectType objectType = serviceBinding.getObject();\r
List<ObjectPartType> objectPartTypes = objectType.getPart();\r
for (ObjectPartType objectPartType : objectPartTypes) {\r
List<PropertyType> propNodeList = objectPartType.getProperties();\r
- PropertyItemUtils.getPropertyValuesByNameInNodeList(propNodeList, propName, values);\r
+ PropertyItemUtils.getPropertyValuesByNameInNodeList(propNodeList, \r
+ propName, (qualify?(objectPartType.getLabel()+":"):null), values);\r
}\r
return values;\r
}\r
throw new IllegalArgumentException("ServiceBindingUtils.getPropertyValues: null property name!");\r
}\r
List<PropertyType> servicePropList = service.getProperties();\r
- return PropertyItemUtils.getPropertyValueFromNodeList(servicePropList, propName );\r
+ return PropertyItemUtils.getPropertyValueByNameFromNodeList(servicePropList, propName );\r
}\r
\r
/**\r
propName, value, onlyIfNotSet);\r
}\r
\r
+ public static String getMappedFieldInDoc( ServiceBindingType sb,\r
+ String logicalFieldName, DocumentModel docModel ) {\r
+ // Now we have to get the number, which is configured as some field\r
+ // on each docType\r
+ /* If we go to qualified field names, we'll need this\r
+ String[] strings = qPropName.split(":");\r
+ if(strings.length!=2) {\r
+ throw new RuntimeException(\r
+ "getMappedFieldInDoc: Bad configuration of "\r
+ +logicalFieldName+" field for: "+docModel.getDocumentType().getName());\r
+ }\r
+ */\r
+ String propName = getPropertyValue(sb, logicalFieldName);\r
+ if(propName==null||propName.isEmpty())\r
+ return null;\r
+ try {\r
+ return (String)docModel.getPropertyValue(propName);\r
+ } catch(ClientException ce) {\r
+ throw new RuntimeException(\r
+ "getMappedFieldInDoc: Problem fetching: "+propName, ce);\r
+ }\r
+ } \r
+\r
}\r
* filter that is relevant to be used with this document handler
* and corresponding storage client
*
- * @param ctx ServiceContext used to fetch default pagination, etc.
* @return
*/
public DocumentFilter createDocumentFilter();
package org.collectionspace.services.common.vocabulary;\r
\r
import java.util.ArrayList;\r
+import java.util.HashMap;\r
+import java.util.Iterator;\r
import java.util.List;\r
\r
+import org.nuxeo.ecm.core.api.ClientException;\r
+import org.nuxeo.ecm.core.api.DocumentModel;\r
import org.nuxeo.ecm.core.api.DocumentModelList;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
import org.collectionspace.services.common.document.DocumentWrapper;\r
import org.collectionspace.services.common.repository.RepositoryClient;\r
import org.collectionspace.services.common.service.ServiceBindingType;\r
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;\r
\r
/**\r
* RefNameServiceUtils is a collection of services utilities related to refName usage.\r
* $LastChangedDate: $\r
*/\r
public class RefNameServiceUtils {\r
- \r
- public static final String AUTH_REF_PROP = "authRef";\r
\r
private final Logger logger = LoggerFactory.getLogger(RefNameServiceUtils.class);\r
\r
- public AuthorityRefDocList getAuthorityRefDocs(RepositoryClient repoClient, \r
+ public static AuthorityRefDocList getAuthorityRefDocs(RepositoryClient repoClient, \r
String tenantId, String serviceType, String refName,\r
int pageSize, int pageNum, boolean computeTotal )\r
throws DocumentException, DocumentNotFoundException {\r
TenantBindingConfigReaderImpl tReader =\r
ServiceMain.getInstance().getTenantBindingConfigReader();\r
List<ServiceBindingType> servicebindings = tReader.getServiceBindingsByType(tenantId, serviceType);\r
- if(servicebindings==null || servicebindings.size()>0)\r
+ if(servicebindings==null || servicebindings.isEmpty())\r
return null;\r
+ // Need to escape the quotes in the refName\r
+ // TODO What if they are already escaped?\r
+ String escapedRefName = refName.replaceAll("'", "\\\\'");\r
String domain = tReader.getTenantBinding(tenantId).getRepositoryDomain();\r
ArrayList<String> docTypes = new ArrayList<String>(); \r
+ HashMap<String, ServiceBindingType> queriedServiceBindings = new HashMap<String, ServiceBindingType>(); \r
+ HashMap<String, List<String>> authRefFieldsByService = new HashMap<String, List<String>>(); \r
StringBuilder whereClause = new StringBuilder();\r
+ boolean fFirst = true;\r
for(ServiceBindingType sb:servicebindings) {\r
- List<String> authRefFields = ServiceBindingUtils.getAllPartsPropertyValues(sb, AUTH_REF_PROP);\r
+ List<String> authRefFields = \r
+ ServiceBindingUtils.getAllPartsPropertyValues(sb, \r
+ ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);\r
+ if(authRefFields.isEmpty())\r
+ continue;\r
String docType = sb.getObject().getName();\r
+ queriedServiceBindings.put(docType, sb);\r
+ authRefFieldsByService.put(docType, authRefFields);\r
docTypes.add(docType);\r
+ /*\r
+ // HACK - need to get qualified properties from the ServiceBinding\r
+ String prefix = "";\r
+ if(docType.equalsIgnoreCase("Intake"))\r
+ prefix = "intakes_common:";\r
+ else if(docType.equalsIgnoreCase("Loanin"))\r
+ prefix = "loansin_common:";\r
+ else if(docType.equalsIgnoreCase("Acquisition"))\r
+ prefix = "acquisitions_common:";\r
+ */\r
for(String field:authRefFields) {\r
// Build up the where clause for each authRef field\r
- throw new UnsupportedOperationException();\r
+ if(fFirst) {\r
+ fFirst = false;\r
+ } else {\r
+ whereClause.append(" OR ");\r
+ }\r
+ //whereClause.append(prefix);\r
+ whereClause.append(field);\r
+ whereClause.append("='");\r
+ whereClause.append(escapedRefName);\r
+ whereClause.append("'");\r
}\r
}\r
+ if(fFirst) // found no authRef fields - nothing to query\r
+ return wrapperList;\r
+ String fullQuery = whereClause.toString(); // for debug\r
// Now we have to issue the search\r
DocumentWrapper<DocumentModelList> docListWrapper = repoClient.findDocs(\r
docTypes, whereClause.toString(), domain, pageSize, pageNum, computeTotal );\r
- return null;\r
+ // Now we gather the info for each document into the list and return\r
+ DocumentModelList docList = docListWrapper.getWrappedObject();\r
+ Iterator<DocumentModel> iter = docList.iterator();\r
+ while(iter.hasNext()){\r
+ DocumentModel docModel = iter.next();\r
+ AuthorityRefDocList.AuthorityRefDocItem ilistItem = new AuthorityRefDocList.AuthorityRefDocItem();\r
+ String csid = NuxeoUtils.extractId(docModel.getPathAsString());\r
+ String docType = docModel.getDocumentType().getName();\r
+ ServiceBindingType sb = queriedServiceBindings.get(docType);\r
+ if(sb==null) {\r
+ throw new RuntimeException(\r
+ "getAuthorityRefDocs: No Service Binding for docType: "+docType);\r
+ }\r
+ String serviceContextPath = "/" + sb.getName().toLowerCase() + "/";\r
+ // The id and URI are the same on all doctypes\r
+ ilistItem.setDocId(csid);\r
+ ilistItem.setUri(serviceContextPath+csid);\r
+ ilistItem.setDocType(docType);\r
+ ilistItem.setDocNumber(\r
+ ServiceBindingUtils.getMappedFieldInDoc(sb, ServiceBindingUtils.OBJ_NUMBER_PROP, docModel));\r
+ ilistItem.setDocName(\r
+ ServiceBindingUtils.getMappedFieldInDoc(sb, ServiceBindingUtils.OBJ_NAME_PROP, docModel));\r
+ // Now, we have to loop over the authRefFieldsByService to figure\r
+ // out which field matched this. Ignore multiple matches.\r
+ List<String> authRefFields = authRefFieldsByService.get(docType);\r
+ if(authRefFields==null || authRefFields.isEmpty()){\r
+ throw new RuntimeException(\r
+ "getAuthorityRefDocs: internal logic error: can't fetch authRefFields for DocType." );\r
+ }\r
+ boolean fRefFound = false;\r
+ /* Use this if we go to qualified field names\r
+ for(String field:authRefFields){\r
+ String[] strings = field.split(":");\r
+ if(strings.length!=2) {\r
+ throw new RuntimeException(\r
+ "getAuthorityRefDocs: Bad configuration of authRefField.");\r
+ }\r
+ try {\r
+ if(refName.equals(docModel.getProperty(strings[0], strings[1]))) {\r
+ ilistItem.setSourceField(field);\r
+ fRefFound = true;\r
+ break;\r
+ }\r
+ } catch(ClientException ce) {\r
+ throw new RuntimeException(\r
+ "getAuthorityRefDocs: Problem fetching: "+field, ce);\r
+ }\r
+ }\r
+ */\r
+ for(String field:authRefFields){\r
+ try {\r
+ if(refName.equals(docModel.getPropertyValue(field))) {\r
+ ilistItem.setSourceField(field);\r
+ fRefFound = true;\r
+ break;\r
+ }\r
+ } catch(ClientException ce) {\r
+ throw new RuntimeException(\r
+ "getAuthorityRefDocs: Problem fetching: "+field, ce);\r
+ }\r
+ }\r
+ if(!fRefFound) {\r
+ throw new RuntimeException(\r
+ "getAuthorityRefDocs: Could not find refname in object:"\r
+ +docType+":"+csid);\r
+ }\r
+ list.add(ilistItem);\r
+ }\r
+ return wrapperList;\r
}\r
\r
- \r
}\r
\r
return result;
}
+ /**
+ * @param docWrapper
+ * @param authRefFields list of schema-qualified field names
+ * @return
+ * @throws PropertyException
+ */
public AuthorityRefList getAuthorityRefs(
DocumentWrapper<DocumentModel> docWrapper,
List<String> authRefFields) throws PropertyException {
wrapDoc = new DocumentWrapperImpl<DocumentModelList>(docList);
} catch (IllegalArgumentException iae) {
throw iae;
- } catch (DocumentException de) {
- throw de;
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Caught exception ", e);
boolean fFirst = true;
for(String docType:docTypes) {
if(fFirst) {
- query.append(",");
fFirst = false;
+ } else {
+ query.append(",");
}
query.append(docType);
}
<artifactId>org.collectionspace.services.jaxb</artifactId>\r
<version>${project.version}</version>\r
</dependency> \r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.common</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.intake.jaxb</artifactId>\r
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.collectionspace.services.client.test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.PersonJAXBSchema;
+import org.collectionspace.services.client.IntakeClient;
+import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.PersonAuthorityClientUtils;
+import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
+import org.collectionspace.services.intake.IntakesCommon;
+import org.collectionspace.services.intake.IntakesCommonList;
+
+import org.jboss.resteasy.client.ClientResponse;
+
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * PersonAuthRefDocsTest, carries out tests against a
+ * deployed and running Person Service.
+ *
+ * $LastChangedRevision: 1327 $
+ * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
+ */
+public class PersonAuthRefDocsTest extends BaseServiceTest {
+
+ private final Logger logger =
+ LoggerFactory.getLogger(PersonAuthRefDocsTest.class);
+
+ // Instance variables specific to this test.
+ private IntakeClient intakeClient = new IntakeClient();
+ private PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ final String SERVICE_PATH_COMPONENT = "intakes";
+ final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
+ private String knownIntakeId = null;
+ private List<String> intakeIdsCreated = new ArrayList();
+ private List<String> personIdsCreated = new ArrayList();
+ private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
+ private int OK_STATUS = Response.Status.OK.getStatusCode();
+ private String personAuthCSID = null;
+ private String currentOwnerPersonCSID = null;
+ private String currentOwnerRefName = null;
+ private String depositorRefName = null;
+ private String conditionCheckAssesorRefName = null;
+ private String insurerRefName = null;
+ private String fieldCollectorRefName = null;
+ private String valuerRefName = null;
+ private final int NUM_AUTH_REF_DOCS_EXPECTED = 1;
+
+ // ---------------------------------------------------------------
+ // CRUD tests : CREATE tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
+ public void createIntakeWithAuthRefs(String testName) throws Exception {
+
+ testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);
+
+ // Submit the request to the service and store the response.
+ String identifier = createIdentifier();
+
+ // Create all the person refs and entities
+ createPersonRefs();
+
+ MultipartOutput multipart = createIntakeInstance(
+ "entryNumber-" + identifier,
+ "entryDate-" + identifier,
+ currentOwnerRefName,
+ depositorRefName,
+ conditionCheckAssesorRefName,
+ insurerRefName,
+ fieldCollectorRefName,
+ valuerRefName );
+
+ ClientResponse<Response> res = intakeClient.create(multipart);
+
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ //
+ // Specifically:
+ // Does it fall within the set of valid status codes?
+ // Does it exactly match the expected status code?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ // Store the ID returned from the first resource created
+ // for additional tests below.
+ if (knownIntakeId == null){
+ knownIntakeId = extractId(res);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testName + ": knownIntakeId=" + knownIntakeId);
+ }
+ }
+
+ // Store the IDs from every resource created by tests,
+ // so they can be deleted after tests have been run.
+ intakeIdsCreated.add(extractId(res));
+ }
+
+ protected void createPersonRefs(){
+ String authRefName =
+ PersonAuthorityClientUtils.createPersonAuthRefName(PERSON_AUTHORITY_NAME, false);
+ MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
+ PERSON_AUTHORITY_NAME, authRefName, personAuthClient.getCommonPartName());
+ ClientResponse<Response> res = personAuthClient.create(multipart);
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, CREATED_STATUS);
+ personAuthCSID = extractId(res);
+
+ currentOwnerRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Olivier Owner", true);
+ currentOwnerPersonCSID = createPerson("Olivier", "Owner", currentOwnerRefName);
+ personIdsCreated.add(currentOwnerPersonCSID);
+
+ depositorRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Debbie Depositor", true);
+ personIdsCreated.add(createPerson("Debbie", "Depositor", depositorRefName));
+
+ conditionCheckAssesorRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Andrew Assessor", true);
+ personIdsCreated.add(createPerson("Andrew", "Assessor", conditionCheckAssesorRefName));
+
+ insurerRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Ingrid Insurer", true);
+ personIdsCreated.add(createPerson("Ingrid", "Insurer", insurerRefName));
+
+ fieldCollectorRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Connie Collector", true);
+ personIdsCreated.add(createPerson("Connie", "Collector", fieldCollectorRefName));
+
+ valuerRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Vince Valuer", true);
+ personIdsCreated.add(createPerson("Vince", "Valuer", valuerRefName));
+
+
+ }
+
+ protected String createPerson(String firstName, String surName, String refName ) {
+ Map<String, String> personInfo = new HashMap<String,String>();
+ personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
+ personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+ MultipartOutput multipart =
+ PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
+ refName, personInfo, personAuthClient.getItemCommonPartName());
+ ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, CREATED_STATUS);
+ return extractId(res);
+ }
+
+ // Success outcomes
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"createIntakeWithAuthRefs"})
+ public void readAndCheckAuthRefDocs(String testName) throws Exception {
+
+ // Perform setup.
+ testSetup(OK_STATUS, ServiceRequestType.READ,testName);
+
+ // Get the auth ref docs and check them
+ ClientResponse<AuthorityRefDocList> refDocListResp =
+ personAuthClient.getReferencingObjects(personAuthCSID, currentOwnerPersonCSID);
+
+ int statusCode = refDocListResp.getStatus();
+
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ".getReferencingObjects: status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ AuthorityRefDocList list = refDocListResp.getEntity();
+
+ // Optionally output additional data about list members for debugging.
+ boolean iterateThroughList = true;
+ boolean fFoundIntake = false;
+ if(iterateThroughList && logger.isDebugEnabled()){
+ List<AuthorityRefDocList.AuthorityRefDocItem> items =
+ list.getAuthorityRefDocItem();
+ int i = 0;
+ logger.debug(testName + ": Docs that use: " + currentOwnerRefName);
+ for(AuthorityRefDocList.AuthorityRefDocItem item : items){
+ logger.debug(testName + ": list-item[" + i + "] " +
+ item.getDocType() + "(" +
+ item.getDocId() + ") Name:[" +
+ item.getDocName() + "] Number:[" +
+ item.getDocNumber() + "] in field:[" +
+ item.getSourceField() + "]");
+ if(!fFoundIntake && knownIntakeId.equalsIgnoreCase(item.getDocId())) {
+ fFoundIntake = true;
+ }
+ i++;
+ }
+ Assert.assertTrue(fFoundIntake, "Did not find Intake with authref!");
+ }
+ }
+
+
+ // ---------------------------------------------------------------
+ // Cleanup of resources created during testing
+ // ---------------------------------------------------------------
+
+ /**
+ * Deletes all resources created by tests, after all tests have been run.
+ *
+ * This cleanup method will always be run, even if one or more tests fail.
+ * For this reason, it attempts to remove all resources created
+ * at any point during testing, even if some of those resources
+ * may be expected to be deleted by certain tests.
+ */
+ @AfterClass(alwaysRun=true)
+ public void cleanUp() {
+ String noTest = System.getProperty("noTestCleanup");
+ if("true".equalsIgnoreCase(noTest)) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Skipping Cleanup phase");
+ }
+ return;
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("Cleaning up temporary resources created for testing ...");
+ }
+ // Note: Any non-success responses are ignored and not reported.
+ for (String resourceId : intakeIdsCreated) {
+ ClientResponse<Response> res = intakeClient.delete(resourceId);
+ }
+ // Delete persons before PersonAuth
+ for (String resourceId : personIdsCreated) {
+ ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
+ }
+ ClientResponse<Response> res = personAuthClient.delete(personAuthCSID);
+ }
+
+ // ---------------------------------------------------------------
+ // Utility methods used by tests above
+ // ---------------------------------------------------------------
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ private MultipartOutput createIntakeInstance(String entryNumber,
+ String entryDate,
+ String currentOwner,
+ String depositor,
+ String conditionCheckAssesor,
+ String insurer,
+ String fieldCollector,
+ String Valuer ) {
+ IntakesCommon intake = new IntakesCommon();
+ intake.setEntryNumber(entryNumber);
+ intake.setEntryDate(entryDate);
+ intake.setCurrentOwner(currentOwner);
+ intake.setDepositor(depositor);
+ intake.setConditionCheckAssesor(conditionCheckAssesor);
+ intake.setInsurer(insurer);
+ intake.setFieldCollector(fieldCollector);
+ intake.setValuer(Valuer);
+ MultipartOutput multipart = new MultipartOutput();
+ OutputPart commonPart =
+ multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
+ commonPart.getHeaders().add("label", intakeClient.getCommonPartName());
+
+ if(logger.isDebugEnabled()){
+ logger.debug("to be created, intake common");
+ logger.debug(objectAsXmlString(intake, IntakesCommon.class));
+ }
+
+ return multipart;
+ }
+}
//import org.collectionspace.services.common.context.MultipartServiceContext;
//import org.collectionspace.services.common.context.MultipartServiceContextFactory;
import org.collectionspace.services.common.context.MultipartServiceContextImpl;
+import org.collectionspace.services.common.context.ServiceBindingUtils;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.DocumentFilter;
import org.collectionspace.services.common.document.DocumentHandler;
getRepositoryClient(ctx).getDoc(ctx, csid);
RemoteDocumentModelHandlerImpl handler
= (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
- List<String> authRefFields = ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(RefNameServiceUtils.AUTH_REF_PROP);
+ List<String> authRefFields =
+ ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(
+ ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);
authRefList = handler.getAuthorityRefs(docWrapper, authRefFields);
} catch (UnauthorizedException ue) {
Response response = Response.status(
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2009 University of California at Berkeley
+ Licensed under the Educational Community License (ECL), Version 2.0.
+ You may not use this file except in compliance with this License.
+
+ You may obtain a copy of the ECL 2.0 License at
+ https://source.collectionspace.org/collection-space/LICENSE.txt
+
+ Document : authorityrefdocs.xsd
+ Revision : $LastChangedRevision: 1292 $
+ Created on : $LastChangedDate: 2010-01-29 14:55:28 -0800 (Fri, 29 Jan 2010) $
+ Author : $LastChangedBy: $
+ Description: AuthorityRefDocs describes a list of values that describe
+ document (CollectionObject, Intake, etc.)
+ references to a given authority term.
+-->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://collectionspace.org/services/common/authorityref"
+ targetNamespace="http://collectionspace.org/services/common/authorityref"
+ version="0.1"
+ >
+
+ <xs:element name="authority-ref-doc-list">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="authority-ref-doc-item" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="docType" type="xs:string" minOccurs="1" />
+ <xs:element name="docId" type="xs:string" minOccurs="1" />
+ <xs:element name="docNumber" type="xs:string" minOccurs="0" />
+ <xs:element name="docName" type="xs:string" minOccurs="0" />
+ <xs:element name="sourceField" type="xs:string" minOccurs="1" />
+ <xs:element name="uri" type="xs:anyURI" minOccurs="1" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
import org.collectionspace.services.common.context.MultipartServiceContext;
import org.collectionspace.services.common.context.MultipartServiceContextFactory;
import org.collectionspace.services.common.context.MultipartServiceContextImpl;
+import org.collectionspace.services.common.context.ServiceBindingUtils;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.DocumentFilter;
import org.collectionspace.services.common.document.DocumentHandler;
getRepositoryClient(ctx).getDoc(ctx, csid);
RemoteDocumentModelHandlerImpl handler
= (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
- List<String> authRefFields = ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(RefNameServiceUtils.AUTH_REF_PROP);
+ List<String> authRefFields =
+ ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(
+ ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);
authRefList = handler.getAuthorityRefs(docWrapper, authRefFields);
} catch (UnauthorizedException ue) {
Response response = Response.status(
import org.collectionspace.services.common.context.MultipartServiceContext;
import org.collectionspace.services.common.context.MultipartServiceContextFactory;
import org.collectionspace.services.common.context.MultipartServiceContextImpl;
+import org.collectionspace.services.common.context.ServiceBindingUtils;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.DocumentFilter;
import org.collectionspace.services.common.document.DocumentHandler;
getRepositoryClient(ctx).getDoc(ctx, csid);
RemoteDocumentModelHandlerImpl handler
= (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
- List<String> authRefFields = ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(RefNameServiceUtils.AUTH_REF_PROP);
+ List<String> authRefFields =
+ ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(
+ ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);
authRefList = handler.getAuthorityRefs(docWrapper, authRefFields);
} catch (UnauthorizedException ue) {
Response response = Response.status(
<scope>test</scope>\r
</dependency>\r
<!-- CollectionSpace dependencies -->\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.common</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.person.jaxb</artifactId>\r
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
import org.collectionspace.services.contact.ContactsCommonList;
import org.collectionspace.services.person.PersonauthoritiesCommonList;
import org.collectionspace.services.person.PersonsCommonList;
return personAuthorityProxy.readItemList(vcsid);
}
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.services.client.IntakeProxy#getAuthorityRefs(java.lang.String)
+ */
+ public ClientResponse<AuthorityRefDocList> getReferencingObjects(String parentcsid, String csid) {
+ return personAuthorityProxy.getReferencingObjects(parentcsid, csid);
+ }
+
/**
* @return
* @see org.collectionspace.services.client.PersonAuthorityProxy#readItemListForNamedAuthority()
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
+import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
import org.collectionspace.services.contact.ContactsCommonList;
import org.collectionspace.services.person.PersonauthoritiesCommonList;
import org.collectionspace.services.person.PersonsCommonList;
@Path("/{vcsid}/items/")
ClientResponse<PersonsCommonList> readItemList(@PathParam("vcsid") String vcsid);
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.services.client.IntakeProxy#getAuthorityRefs(java.lang.String)
+ */
+ @GET
+ @Path("{csid}/items/{itemcsid}/refObjs")
+ @Produces("application/xml")
+ ClientResponse<AuthorityRefDocList> getReferencingObjects(
+ @PathParam("csid") String parentcsid,
+ @PathParam("itemcsid") String itemcsid);
+
// List Items for a named authority
@GET
@Produces({"application/xml"})
*/
package org.collectionspace.services.person;
-//import java.net.URI;
+import java.util.List;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
-//import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import org.collectionspace.services.common.AbstractMultiPartCollectionSpaceResourceImpl;
import org.collectionspace.services.common.ClientType;
import org.collectionspace.services.common.ServiceMain;
-//import org.collectionspace.services.common.context.MultipartServiceContext;
-//import org.collectionspace.services.common.context.MultipartServiceContextFactory;
+import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.common.context.MultipartServiceContext;
+import org.collectionspace.services.common.context.MultipartServiceContextFactory;
+import org.collectionspace.services.common.context.MultipartServiceContextImpl;
+import org.collectionspace.services.common.context.ServiceBindingUtils;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.BadRequestException;
+import org.collectionspace.services.common.document.DocumentException;
import org.collectionspace.services.common.document.DocumentFilter;
import org.collectionspace.services.common.document.DocumentHandler;
import org.collectionspace.services.common.document.DocumentNotFoundException;
-//import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.repository.RepositoryClient;
import org.collectionspace.services.common.security.UnauthorizedException;
-//import org.collectionspace.services.common.vocabulary.RefNameUtils;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
+import org.collectionspace.services.common.vocabulary.RefNameUtils;
import org.collectionspace.services.common.query.IQueryManager;
import org.collectionspace.services.contact.ContactResource;
import org.collectionspace.services.contact.ContactsCommon;
import org.collectionspace.services.contact.ContactsCommonList;
import org.collectionspace.services.contact.ContactJAXBSchema;
import org.collectionspace.services.contact.nuxeo.ContactDocumentModelHandler;
+import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
import org.collectionspace.services.person.nuxeo.PersonDocumentModelHandler;
import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
import org.jboss.resteasy.util.HttpResponseCodes;
-//import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.core.api.DocumentModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
/**
- * Gets the person authority.
+ * Gets the entities referencing this Person instance. The service type
+ * can be passed as a query param "type", and must match a configured type
+ * for the service bindings. If not set, the type defaults to
+ * ServiceBindingUtils.SERVICE_TYPE_PROCEDURE.
*
- * @param csid the csid
+ * @param csid the parent csid
+ * @param itemcsid the person csid
+ * @param ui the ui
*
- * @return the person authority
+ * @return the info for the referencing objects
*/
+ @GET
+ @Path("{csid}/items/{itemcsid}/refObjs")
+ @Produces("application/xml")
+ public AuthorityRefDocList getReferencingObjects(
+ @PathParam("csid") String parentcsid,
+ @PathParam("itemcsid") String itemcsid,
+ @Context UriInfo ui) {
+ AuthorityRefDocList authRefDocList = null;
+ if (logger.isDebugEnabled()) {
+ logger.debug("getReferencingObjects with parentcsid="
+ + parentcsid + " and itemcsid=" + itemcsid);
+ }
+ if (parentcsid == null || "".equals(parentcsid)
+ || itemcsid == null || "".equals(itemcsid)) {
+ logger.error("getPerson: missing parentcsid or itemcsid!");
+ Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+ "get failed on Person with parentcsid="
+ + parentcsid + " and itemcsid=" + itemcsid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ try {
+ // Note that we have to create the service context for the Items, not the main service
+ ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(getItemServiceName());
+ DocumentHandler handler = createItemDocumentHandler(ctx, parentcsid);
+ RepositoryClient repoClient = getRepositoryClient(ctx);
+ DocumentFilter myFilter = handler.createDocumentFilter();
+ MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+ myFilter.setPagination(queryParams);
+ String serviceType = ServiceBindingUtils.SERVICE_TYPE_PROCEDURE;
+ List<String> list = queryParams.remove(ServiceBindingUtils.SERVICE_TYPE_PROP);
+ if (list != null) {
+ serviceType = list.get(0);
+ }
+ DocumentWrapper<DocumentModel> docWrapper = repoClient.getDoc(ctx, itemcsid);
+ DocumentModel docModel = docWrapper.getWrappedObject();
+ String refName = (String)docModel.getPropertyValue(PersonJAXBSchema.REF_NAME);
+
+ authRefDocList = RefNameServiceUtils.getAuthorityRefDocs(repoClient,
+ ctx.getTenantId(), serviceType, refName,
+ myFilter.getPageSize(), myFilter.getStartPage(), true );
+ } catch (UnauthorizedException ue) {
+ Response response = Response.status(
+ Response.Status.UNAUTHORIZED).entity("Get failed reason " + ue.getErrorReason()).type("text/plain").build();
+ throw new WebApplicationException(response);
+ } catch (DocumentNotFoundException dnfe) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getReferencingObjects", dnfe);
+ }
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "GetReferencingObjects failed with parentcsid="
+ + parentcsid + " and itemcsid=" + itemcsid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ } catch (Exception e) { // Includes DocumentException
+ if (logger.isDebugEnabled()) {
+ logger.debug("GetReferencingObjects", e);
+ }
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Get failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ if (authRefDocList == null) {
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Get failed, the requested Person CSID:" + itemcsid + ": was not found.").type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return authRefDocList;
+ }
+
@GET
@Path("{csid}")
public MultipartOutput getPersonAuthority(@PathParam("csid") String csid) {
if (logger.isDebugEnabled()) {
logger.debug("getPerson with parentcsid=" + parentcsid + " and itemcsid=" + itemcsid);
}
- if (parentcsid == null || "".equals(parentcsid)) {
- logger.error("getPerson: missing csid!");
+ if (parentcsid == null || "".equals(parentcsid)
+ || itemcsid == null || "".equals(itemcsid)) {
+ logger.error("getPerson: missing parentcsid or itemcsid!");
Response response = Response.status(Response.Status.BAD_REQUEST).entity(
- "get failed on Person csid=" + parentcsid).type(
- "text/plain").build();
- throw new WebApplicationException(response);
- }
- if (itemcsid == null || "".equals(itemcsid)) {
- logger.error("getPerson: missing itemcsid!");
- Response response = Response.status(Response.Status.BAD_REQUEST).entity(
- "get failed on Person itemcsid=" + itemcsid).type(
+ "get failed on Person with parentcsid="
+ + parentcsid + " and itemcsid=" + itemcsid).type(
"text/plain").build();
throw new WebApplicationException(response);
}
}
return personObjectList;
}
+
/**
* Gets the person list by auth name.