public List<ListResultField> getListItemsArray() throws DocumentException {
List<ListResultField> list = super.getListItemsArray();
int nFields = list.size();
- // Ensure some common fields so do not depend upon config for general logic
+ // Ensure that each item in a list of Authority items includes
+ // a set of common fields, so we do not depend upon configuration
+ // for general logic.
boolean hasDisplayName = false;
boolean hasShortId = false;
boolean hasRefName = false;
if (!hasDisplayName) {
field = new ListResultField();
field.setElement(AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
- field.setXpath(AuthorityItemJAXBSchema.DISPLAY_NAME);
+ field.setXpath(NuxeoUtils.getPrimaryXPathPropertyName(
+ null, getItemTermInfoGroupXPathBase(), AuthorityItemJAXBSchema.TERM_DISPLAY_NAME));
+ // field.setXpath(AuthorityItemJAXBSchema.DISPLAY_NAME);
list.add(field);
}
if (!hasShortId) {
if (!hasTermStatus) {
field = new ListResultField();
field.setElement(AuthorityItemJAXBSchema.TERM_STATUS);
- field.setXpath(AuthorityItemJAXBSchema.TERM_STATUS);
+ field.setXpath(NuxeoUtils.getPrimaryXPathPropertyName(
+ null, getItemTermInfoGroupXPathBase(), AuthorityItemJAXBSchema.TERM_STATUS));
+ // field.setXpath(AuthorityItemJAXBSchema.TERM_STATUS);
list.add(field);
}
return list;
// AuthorityItemJAXBSchema.DISPLAY_NAME);
oldDisplayNameOnUpdate = (String) getStringValueInPrimaryRepeatingComplexProperty(
wrapDoc.getWrappedObject(), authorityItemCommonSchemaName,
- this.authorityItemTermGroupXPathBase,
+ getItemTermInfoGroupXPathBase(),
AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
oldRefNameOnUpdate = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName,
AuthorityItemJAXBSchema.REF_NAME);
String termDisplayName =
(String) getStringValueInPrimaryRepeatingComplexProperty(
docModel, authorityItemCommonSchemaName,
- this.authorityItemTermGroupXPathBase,
+ getItemTermInfoGroupXPathBase(),
AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
String termName =
(String) getStringValueInPrimaryRepeatingComplexProperty(
docModel, authorityItemCommonSchemaName,
- this.authorityItemTermGroupXPathBase,
+ getItemTermInfoGroupXPathBase(),
AuthorityItemJAXBSchema.TERM_NAME);
if (Tools.isEmpty(shortIdentifier)) {
String generatedShortIdentifier =
String displayName =
(String) getStringValueInPrimaryRepeatingComplexProperty(
docModel, authorityItemCommonSchemaName,
- this.authorityItemTermGroupXPathBase,
+ getItemTermInfoGroupXPathBase(),
AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
if (Tools.isEmpty(authorityRefBaseName)) {
throw new Exception("Could not create the refName for this authority term, because the refName for its authority parent was empty.");
import org.collectionspace.services.client.IQueryManager;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.api.Tools;
import org.collectionspace.services.common.context.ServiceBindingUtils;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.BadRequestException;
}
static public String getPrimaryXPathPropertyName(String schema, String complexPropertyName, String fieldName) {
- return schema + ":" + complexPropertyName + "/[0]/" + fieldName;
+ if (Tools.isBlank(schema)) {
+ return complexPropertyName + "/[0]/" + fieldName;
+ } else {
+ return schema + ":" + complexPropertyName + "/[0]/" + fieldName;
+ }
}
}