*/
@GET
@Produces("application/xml")
- public AbstractCommonList getAuthorityList(@Context UriInfo ui) {
+ public AbstractCommonList getAuthorityList(@Context UriInfo ui) { //FIXME - REM 5/3/2012 - This is not reachable from the JAX-RS dispatcher. Instead the equivalent method in ResourceBase is getting called.
try {
MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
}
/*
- * Note that the Vocabulary service's item-documentmodel-handler will override this method.
+ * Note: the Vocabulary service's VocabularyItemDocumentModelHandler class overrides this method.
*/
- protected ListResultField getListResultField() {
+ protected ListResultField getListResultsDisplayNameField() {
ListResultField result = new ListResultField();
// Per CSPACE-5132, the name of this element remains 'displayName'
// for backwards compatibility, although its value is obtained
return result;
}
+ /*
+ * Note: the Vocabulary service's VocabularyItemDocumentModelHandler class overrides this method.
+ */
+ protected ListResultField getListResultsTermStatusField() {
+ ListResultField result = new ListResultField();
+
+ result.setElement(AuthorityItemJAXBSchema.TERM_STATUS);
+ result.setXpath(NuxeoUtils.getPrimaryXPathPropertyName(
+ authorityItemCommonSchemaName, getItemTermInfoGroupXPathBase(), AuthorityItemJAXBSchema.TERM_STATUS));
+
+ return result;
+ }
+
@Override
public List<ListResultField> getListItemsArray() throws DocumentException {
List<ListResultField> list = super.getListItemsArray();
}
ListResultField field;
if (!hasDisplayName) {
- field = getListResultField();
+ field = getListResultsDisplayNameField();
list.add(field);
}
if (!hasShortId) {
list.add(field);
}
if (!hasTermStatus) {
- field = new ListResultField();
- field.setElement(AuthorityItemJAXBSchema.TERM_STATUS);
- field.setXpath(NuxeoUtils.getPrimaryXPathPropertyName(
- authorityItemCommonSchemaName, getItemTermInfoGroupXPathBase(), AuthorityItemJAXBSchema.TERM_STATUS));
+ field = getListResultsTermStatusField();
list.add(field);
}
// Now, check the new display and handle the refname update.
String newDisplayName = (String) getPrimaryDisplayName(wrapDoc.getWrappedObject(), authorityItemCommonSchemaName,
- this.authorityItemTermGroupXPathBase,
+ authorityItemTermGroupXPathBase,
AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
if (newDisplayName != null && !newDisplayName.equals(oldDisplayNameOnUpdate)) {
// Need to update the refName, and then fix all references.
//============================= END TODO refactor ==========================
public String getItemTermInfoGroupXPathBase() {
- return this.authorityItemTermGroupXPathBase;
+ return authorityItemTermGroupXPathBase;
}
public void setItemTermInfoGroupXPathBase(String itemTermInfoGroupXPathBase) {
- this.authorityItemTermGroupXPathBase = itemTermInfoGroupXPathBase;
+ authorityItemTermGroupXPathBase = itemTermInfoGroupXPathBase;
}
protected String getAuthorityItemCommonSchemaName() {
} else {\r
Assert.fail("Internal Error: readItemList both vcsid and shortId are null!");\r
}\r
- AbstractCommonList list = res.getEntity();\r
int statusCode = res.getStatus();\r
\r
// Check the status code of the response: does it match\r
invalidStatusCodeMessage(testRequestType, statusCode));\r
Assert.assertEquals(statusCode, testExpectedStatusCode);\r
\r
+ AbstractCommonList list = res.getEntity();\r
List<AbstractCommonList.ListItem> items = list.getListItem();\r
int nItemsReturned = items.size();\r
long nItemsTotal = list.getTotalItems();\r
\r
if(logger.isDebugEnabled()){\r
logger.debug("Import: Create Item: \""+itemMap.get(AuthorityItemJAXBSchema.SHORT_IDENTIFIER)\r
- +"\" in personAuthority: \"" + vcsid +"\"");\r
+ +"\" in vocabularyAuthority: \"" + vcsid +"\"");\r
}\r
PoxPayloadOut multipart = createVocabularyItemInstance(null, //vocabularyRefName,\r
itemMap, client.getItemCommonPartName());\r
}\r
if(statusCode != EXPECTED_STATUS_CODE) {\r
throw new RuntimeException("Unexpected Status when creating Item: \""+itemMap.get(AuthorityItemJAXBSchema.DISPLAY_NAME)\r
- + "\" in personAuthority: \"" + vcsid /*vocabularyRefName*/ + "\", Status:" + statusCode);\r
+ + "\" in vocabularyAuthority: \"" + vcsid /*vocabularyRefName*/ + "\", Status:" + statusCode);\r
}\r
\r
return extractId(res);\r
public interface VocabularyItemJAXBSchema {
final static String DISPLAY_NAME = "displayName";
+ final static String TERM_STATUS = "termStatus";
}
\ No newline at end of file
*/
@Override
public String getItemTermInfoGroupXPathBase() {
- throw new UnsupportedOperationException("operation not relevant for AccountDocumentHandler");
+ return null;
}
}
import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler;
import org.collectionspace.services.config.service.ListResultField;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+import org.collectionspace.services.vocabulary.VocabularyItemJAXBSchema;
import org.collectionspace.services.vocabulary.VocabularyitemsCommon;
-import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.DocumentModel;
/**
String result = null;
try {
- result = (String) docModel.getProperty(schema, AuthorityItemJAXBSchema.DISPLAY_NAME);
+ result = (String) docModel.getProperty(schema, VocabularyItemJAXBSchema.DISPLAY_NAME);
} catch (Exception e) {
throw new RuntimeException("Unknown problem retrieving property {"
+ schema + ":" + fieldName + "}." + e.getLocalizedMessage());
* Because the Vocabulary service's item schema is not standard, we need to override this method.
*/
@Override
- protected ListResultField getListResultField() {
+ protected ListResultField getListResultsDisplayNameField() {
ListResultField result = new ListResultField();
result.setElement(AuthorityItemJAXBSchema.DISPLAY_NAME);
- result.setXpath(NuxeoUtils.getPrimaryXPathPropertyName(this.getAuthorityItemCommonSchemaName(),
- getItemTermInfoGroupXPathBase(),
- AuthorityItemJAXBSchema.TERM_DISPLAY_NAME));
+ result.setXpath(AuthorityItemJAXBSchema.DISPLAY_NAME);
return result;
}
+ protected ListResultField getListResultsTermStatusField() {
+ ListResultField result = new ListResultField();
+
+ result.setElement(VocabularyItemJAXBSchema.DISPLAY_NAME);
+ result.setXpath(VocabularyItemJAXBSchema.TERM_STATUS);
+
+ return result;
+ }
+
}