return result.getBytes();
}
+ /*
+ * Most of the authority child classes will use this method. However, the Vocabulary service's item schema is
+ * different enough that it will have to override this method in it's resource class.
+ */
+ protected String getQualifiedDisplayNameField() {
+ String result = null;
+
+ result = NuxeoUtils.getPrimaryElPathPropertyName(
+ authorityItemCommonSchemaName, getItemTermInfoGroupXPathBase(),
+ AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
+
+ return result;
+ }
+
/**
* Gets the authorityItem list for the specified authority
* If partialPerm is specified, keywords will be ignored.
String keywords = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW);
String advancedSearch = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_AS);
- String qualifiedDisplayNameField =
- NuxeoUtils.getPrimaryElPathPropertyName(authorityItemCommonSchemaName,
- getItemTermInfoGroupXPathBase(), AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
+ String qualifiedDisplayNameField = getQualifiedDisplayNameField();
// Note that docType defaults to the ServiceName, so we're fine with that.
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = null;
for (int i = 0; i < nFields; i++) {
ListResultField field = list.get(i);
String elName = field.getElement();
- if (AuthorityItemJAXBSchema.TERM_DISPLAY_NAME.equals(elName)) {
+ if (AuthorityItemJAXBSchema.TERM_DISPLAY_NAME.equals(elName)) { //FIXME: Add a special if-case for Vocabulary item's displayName
hasDisplayName = true;
} else if (AuthorityItemJAXBSchema.SHORT_IDENTIFIER.equals(elName)) {
hasShortId = true;
ListResultField field;
if (!hasDisplayName) {
field = new ListResultField();
- // Per CSPACE-5132, the name of this element remains 'displayName'
+ // Per CSPACE-5132, the name of this element remains 'displayName' //FIXME: Add a special case again for Vocab item's displayName
// for backwards compatibility, although its value is obtained
// from the termDisplayName field.
//
// First, get a copy of the old displayName
// oldDisplayNameOnUpdate = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName,
// AuthorityItemJAXBSchema.DISPLAY_NAME);
- oldDisplayNameOnUpdate = (String) getStringValueInPrimaryRepeatingComplexProperty(
+ oldDisplayNameOnUpdate = (String) getStringValueInPrimaryRepeatingComplexProperty( //FIXME - This won't work for vocabulary items
wrapDoc.getWrappedObject(), authorityItemCommonSchemaName,
getItemTermInfoGroupXPathBase(),
AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
// handleComputedDisplayNames(wrapDoc.getWrappedObject());
// String newDisplayName = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName,
// AuthorityItemJAXBSchema.DISPLAY_NAME);
- String newDisplayName = (String) getStringValueInPrimaryRepeatingComplexProperty(
+ String newDisplayName = (String) getStringValueInPrimaryRepeatingComplexProperty( //FIXME - This won't work for vocabulary items
wrapDoc.getWrappedObject(), authorityItemCommonSchemaName,
this.authorityItemTermGroupXPathBase,
AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
* @param docModel the doc model
* @throws Exception the exception
*/
- protected void handleComputedDisplayNames(DocumentModel docModel) throws Exception {
- // Do nothing by default.
- }
+// protected void handleComputedDisplayNames(DocumentModel docModel) throws Exception {
+// // Do nothing by default.
+// }
/**
* Handle refName updates for changes to display name.
private void handleDisplayNameAsShortIdentifier(DocumentModel docModel, String schemaName) throws Exception {
String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.SHORT_IDENTIFIER);
String termDisplayName =
- (String) getStringValueInPrimaryRepeatingComplexProperty(
+ (String) getStringValueInPrimaryRepeatingComplexProperty( //FIXME - This won't work for vocabulary items
docModel, authorityItemCommonSchemaName,
getItemTermInfoGroupXPathBase(),
AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
String termName =
- (String) getStringValueInPrimaryRepeatingComplexProperty(
+ (String) getStringValueInPrimaryRepeatingComplexProperty( //FIXME - This won't work for vocabulary items
docModel, authorityItemCommonSchemaName,
getItemTermInfoGroupXPathBase(),
AuthorityItemJAXBSchema.TERM_NAME);
DocumentModel docModel = wrapDoc.getWrappedObject();
String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.SHORT_IDENTIFIER);
String displayName =
- (String) getStringValueInPrimaryRepeatingComplexProperty(
+ (String) getStringValueInPrimaryRepeatingComplexProperty( //FIXME - This won't work for vocabulary items
docModel, authorityItemCommonSchemaName,
getItemTermInfoGroupXPathBase(),
AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
import org.collectionspace.services.client.VocabularyClient;
import org.collectionspace.services.common.context.ServiceBindingUtils;
+import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
import org.collectionspace.services.common.vocabulary.AuthorityResource;
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;
import org.collectionspace.services.vocabulary.nuxeo.VocabularyItemDocumentModelHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
protected String getRefPropName() {
return ServiceBindingUtils.TERM_REF_PROP;
}
+
+ protected String getQualifiedDisplayNameField() {
+ String result = null;
+ result = authorityItemCommonSchemaName + ":" + VocabularyItemJAXBSchema.DISPLAY_NAME;
+
+ return result;
+ }
+
+ /*
+ * The item schema for the Vocabulary service does not support a multi-valued term list. Only authorities that support
+ * term lists need to implement this method.
+ */
@Override
public String getItemTermInfoGroupXPathBase() {
- // TODO Auto-generated method stub
- return VocabularyClient.TERM_INFO_GROUP_XPATH_BASE;
+ throw new UnsupportedOperationException("operation not relevant for AccountDocumentHandler");
}
-
}