*/\r
public interface AuthorityItemJAXBSchema {\r
final static String DISPLAY_NAME = "displayName";\r
+ final static String DISPLAY_NAME_COMPUTED = "displayNameComputed";\r
+ final static String SHORT_DISPLAY_NAME = "shortDisplayName";\r
+ final static String SHORT_DISPLAY_NAME_COMPUTED = "shortDisplayNameComputed";\r
final static String IN_AUTHORITY = "inAuthority";\r
final static String REF_NAME = "refName";\r
final static String SHORT_IDENTIFIER = "shortIdentifier";\r
- final static String STATUS = "status";\r
+ final static String TERM_STATUS = "termStatus";\r
final static String CSID = "csid";\r
}\r
\r
\r
public interface AuthorityItemListItemJAXBSchema {\r
final static String DISPLAY_NAME = "displayName";\r
+ final static String SHORT_DISPLAY_NAME = "shortDisplayName";\r
final static String REF_NAME = "refName";\r
final static String SHORT_IDENTIFIER = "shortIdentifier";\r
final static String CSID = "csid";\r
final static String REF_NAME = "refName";\r
final static String VOCAB_TYPE = "vocabType";\r
final static String CSID = "csid";\r
- final static String TERM_STATUS = "termStatus";\r
}\r
\r
\r
<xs:element name="termStatus" type="xs:string"/>
<xs:element name="displayName" type="xs:string"/>
<xs:element name="displayNameComputed" type="xs:boolean"/>
+ <xs:element name="shortDisplayName" type="xs:string"/>
+ <xs:element name="shortDisplayNameComputed" type="xs:boolean"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="conditionNote" type="xs:string"/>
<xs:element name="conditionNoteDate" type="xs:string"/>
* \r
*/\r
package org.collectionspace.services;\r
-import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;\r
+import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;\r
\r
/**\r
* @author pschmitz\r
*\r
*/\r
-public interface LocationJAXBSchema extends AuthorityJAXBSchema {\r
+public interface LocationJAXBSchema extends AuthorityItemJAXBSchema {\r
final static String LOCATIONS_COMMON = "locations_common";\r
- final static String DISPLAY_NAME_COMPUTED = "displayNameComputed";\r
final static String NAME = "name";\r
final static String CONDITION_NOTE = "conditionNote";\r
final static String CONDITION_NOTE_DATE = "conditionNoteDate";\r
<xs:element name="termStatus" type="xs:string"/>
<xs:element name="displayName" type="xs:string"/>
<xs:element name="displayNameComputed" type="xs:boolean"/>
+ <xs:element name="shortDisplayName" type="xs:string"/>
+ <xs:element name="shortDisplayNameComputed" type="xs:boolean"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="conditionNote" type="xs:string"/>
<xs:element name="conditionNoteDate" type="xs:string"/>
<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 location details -->
<xs:element name="uri" type="xs:anyURI"
import org.collectionspace.services.common.document.DocumentFilter;
import org.collectionspace.services.common.document.DocumentWrapper;
import org.collectionspace.services.common.service.ObjectPartType;
+import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler;
import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
import org.collectionspace.services.nuxeo.util.NuxeoUtils;
public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
// first fill all the parts of the document
super.handleCreate(wrapDoc);
- handleDisplayName(wrapDoc.getWrappedObject());
+ handleDisplayNames(wrapDoc.getWrappedObject());
}
/* (non-Javadoc)
@Override
public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
super.handleUpdate(wrapDoc);
- handleDisplayName(wrapDoc.getWrappedObject());
+ handleDisplayNames(wrapDoc.getWrappedObject());
}
/**
* @param docModel the doc model
* @throws Exception the exception
*/
- private void handleDisplayName(DocumentModel docModel) throws Exception {
+ private void handleDisplayNames(DocumentModel docModel) throws Exception {
String commonPartLabel = getServiceContext().getCommonPartLabel("locations");
Boolean displayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
LocationJAXBSchema.DISPLAY_NAME_COMPUTED);
- if (displayNameComputed) {
+ Boolean shortDisplayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
+ LocationJAXBSchema.SHORT_DISPLAY_NAME_COMPUTED);
+ if(displayNameComputed==null)
+ displayNameComputed = true;
+ if(shortDisplayNameComputed==null)
+ shortDisplayNameComputed = true;
+ if (displayNameComputed || shortDisplayNameComputed) {
String displayName = prepareDefaultDisplayName(
(String)docModel.getProperty(commonPartLabel, LocationJAXBSchema.NAME ));
- docModel.setProperty(commonPartLabel, LocationJAXBSchema.DISPLAY_NAME,
- displayName);
+ if (displayNameComputed) {
+ docModel.setProperty(commonPartLabel, LocationJAXBSchema.DISPLAY_NAME,
+ displayName);
+ }
+ if (shortDisplayNameComputed) {
+ docModel.setProperty(commonPartLabel, LocationJAXBSchema.SHORT_DISPLAY_NAME,
+ displayName);
+ }
}
}
DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
LocationsCommonList coList = extractPagingInfo(new LocationsCommonList(), wrapDoc);
AbstractCommonList commonList = (AbstractCommonList) coList;
- commonList.setFieldsReturned("displayName|refName|uri|csid");
+ commonList.setFieldsReturned("displayName|refName|shortIdentifier|uri|csid");
List<LocationsCommonList.LocationListItem> list = coList.getLocationListItem();
Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
String commonPartLabel = getServiceContext().getCommonPartLabel(
DocumentModel docModel = iter.next();
LocationListItem ilistItem = new LocationListItem();
ilistItem.setDisplayName((String) docModel.getProperty(
- commonPartLabel, LocationJAXBSchema.DISPLAY_NAME));
+ commonPartLabel, AuthorityItemJAXBSchema.DISPLAY_NAME));
+ ilistItem.setShortIdentifier((String) docModel.getProperty(commonPartLabel,
+ AuthorityItemJAXBSchema.SHORT_IDENTIFIER));
ilistItem.setRefName((String) docModel.getProperty(commonPartLabel,
- LocationJAXBSchema.REF_NAME));
+ AuthorityItemJAXBSchema.REF_NAME));
String id = NuxeoUtils.extractId(docModel.getPathAsString());
ilistItem.setUri("/locationauthorities/" + inAuthority + "/items/"
+ id);
<xs:element name="termStatus" type="xs:string"/>
<xs:element name="displayName" type="xs:string"/>
<xs:element name="displayNameComputed" type="xs:boolean"/>
+ <xs:element name="shortDisplayName" type="xs:string"/>
+ <xs:element name="shortDisplayNameComputed" type="xs:boolean"/>
<!-- FIXME Start of main body (represented by 'longName' element) repeatable group -->
<xs:element name="shortName" type="xs:string"/>
if((value = (String)orgInfo.get(OrganizationJAXBSchema.DISPLAY_NAME))!=null)\r
organization.setDisplayName(value);\r
\r
+ value = orgInfo.get(OrganizationJAXBSchema.SHORT_DISPLAY_NAME_COMPUTED);\r
+ boolean shortDisplayNameComputed = (value==null) || value.equalsIgnoreCase("true"); \r
+ organization.setShortDisplayNameComputed(shortDisplayNameComputed);\r
+ if((value = (String)orgInfo.get(OrganizationJAXBSchema.SHORT_DISPLAY_NAME))!=null)\r
+ organization.setShortDisplayName(value);\r
+ \r
String refName = createOrganizationRefName(orgAuthRefName, shortId, value);\r
organization.setRefName(refName);\r
\r
*/\r
package org.collectionspace.services;\r
\r
-import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;\r
+import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;\r
\r
/**\r
* @author pschmitz\r
*\r
*/\r
-public interface OrganizationJAXBSchema extends AuthorityJAXBSchema {\r
+public interface OrganizationJAXBSchema extends AuthorityItemJAXBSchema {\r
\r
final static String ORGANIZATIONS_COMMON = "organizations_common";\r
- final static String DISPLAY_NAME_COMPUTED = "displayNameComputed";\r
final static String SHORT_NAME = "shortName";\r
final static String LONG_NAME = "longName";\r
final static String NAME_ADDITIONS = "nameAdditions";\r
<xs:element name="termStatus" type="xs:string"/>
<xs:element name="displayName" type="xs:string"/>
<xs:element name="displayNameComputed" type="xs:boolean"/>
+ <xs:element name="shortDisplayName" type="xs:string"/>
+ <xs:element name="shortDisplayNameComputed" type="xs:boolean"/>
<xs:element name="shortName" type="xs:string"/>
<xs:element name="longName" type="xs:string"/>
<xs:element name="nameAdditions" type="xs:string"/>
<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 organization details -->
<xs:element name="uri" type="xs:anyURI"
public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
// first fill all the parts of the document
super.handleCreate(wrapDoc);
- handleDisplayName(wrapDoc.getWrappedObject());
+ handleDisplayNames(wrapDoc.getWrappedObject());
}
/* (non-Javadoc)
@Override
public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
super.handleUpdate(wrapDoc);
- handleDisplayName(wrapDoc.getWrappedObject());
+ handleDisplayNames(wrapDoc.getWrappedObject());
}
/**
*
* @throws Exception the exception
*/
- private void handleDisplayName(DocumentModel docModel) throws Exception {
+ private void handleDisplayNames(DocumentModel docModel) throws Exception {
String commonPartLabel = getServiceContext().getCommonPartLabel("organizations");
Boolean displayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
OrganizationJAXBSchema.DISPLAY_NAME_COMPUTED);
- if (displayNameComputed) {
- String displayName = prepareDefaultDisplayName(
- (String) docModel.getProperty(commonPartLabel,OrganizationJAXBSchema.SHORT_NAME),
- (String) docModel.getProperty(commonPartLabel,OrganizationJAXBSchema.FOUNDING_PLACE));
- docModel.setProperty(commonPartLabel, OrganizationJAXBSchema.DISPLAY_NAME,
- displayName);
+ Boolean shortDisplayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
+ OrganizationJAXBSchema.SHORT_DISPLAY_NAME_COMPUTED);
+ if(displayNameComputed==null)
+ displayNameComputed = true;
+ if(shortDisplayNameComputed==null)
+ shortDisplayNameComputed = true;
+ if (displayNameComputed || shortDisplayNameComputed) {
+ String shortName = (String) docModel.getProperty(commonPartLabel,
+ OrganizationJAXBSchema.SHORT_NAME);
+ if(shortDisplayNameComputed) {
+ String displayName = prepareDefaultDisplayName(shortName, null);
+ docModel.setProperty(commonPartLabel, OrganizationJAXBSchema.SHORT_DISPLAY_NAME,
+ displayName);
+ }
+ if(displayNameComputed) {
+ String foundingPlace = (String) docModel.getProperty(commonPartLabel,
+ OrganizationJAXBSchema.FOUNDING_PLACE);
+ String displayName = prepareDefaultDisplayName(shortName, foundingPlace);
+ docModel.setProperty(commonPartLabel, OrganizationJAXBSchema.DISPLAY_NAME,
+ displayName);
+ }
}
}
throws Exception {
OrganizationsCommonList coList = this.extractPagingInfo(new OrganizationsCommonList(), wrapDoc);
AbstractCommonList commonList = (AbstractCommonList) coList;
- commonList.setFieldsReturned("displayName|refName|uri|csid");
+ commonList.setFieldsReturned("displayName|refName|shortIdentifier|uri|csid");
List<OrganizationsCommonList.OrganizationListItem> list = coList.getOrganizationListItem();
Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
String commonPartLabel = getServiceContext().getCommonPartLabel("organizations");
OrganizationListItem ilistItem = new OrganizationListItem();
ilistItem.setDisplayName((String)
docModel.getProperty(commonPartLabel,OrganizationJAXBSchema.DISPLAY_NAME ));
+ ilistItem.setShortIdentifier((String) docModel.getProperty(commonPartLabel,
+ OrganizationJAXBSchema.SHORT_IDENTIFIER));
ilistItem.setRefName((String)
docModel.getProperty(commonPartLabel, OrganizationJAXBSchema.REF_NAME));
String id = NuxeoUtils.extractId(docModel.getPathAsString());
<xs:element name="termStatus" type="xs:string"/>
<xs:element name="displayName" type="xs:string"/>
<xs:element name="displayNameComputed" type="xs:boolean"/>
+ <xs:element name="shortDisplayName" type="xs:string"/>
+ <xs:element name="shortDisplayNameComputed" type="xs:boolean"/>
<!-- FIXME: Currently marked in repeatability spreadsheet as a -->
<!-- repeatable group. However, multiple personal names for the -->
if (displayNameComputed == false && displayName == null) {\r
throw new IllegalArgumentException("displayName cannot be null when displayComputed is 'false'");\r
} \r
+\r
+ booleanStr = personInfo.get(PersonJAXBSchema.SHORT_DISPLAY_NAME_COMPUTED);\r
+ boolean shortDisplayNameComputed = true;\r
+ if (booleanStr != null && booleanStr.length() > 0) {\r
+ shortDisplayNameComputed = Boolean.parseBoolean(booleanStr);\r
+ }\r
+ person.setShortDisplayNameComputed(shortDisplayNameComputed);\r
+\r
+ String shortDisplayName = personInfo.get(PersonJAXBSchema.SHORT_DISPLAY_NAME);\r
+ person.setShortDisplayName(shortDisplayName);\r
+ if (shortDisplayNameComputed == false && shortDisplayName == null) {\r
+ throw new IllegalArgumentException("shortDisplayName cannot be null when shortDisplayComputed is 'false'");\r
+ } \r
+\r
String refName = createPersonRefName(personAuthRefName, shortId, displayName);\r
person.setRefName(refName);\r
\r
personMap.get(PersonJAXBSchema.DEATH_DATE));\r
personMap.put(PersonJAXBSchema.DISPLAY_NAME, displayName);\r
}\r
+ String shortDisplayName = personMap.get(PersonJAXBSchema.SHORT_DISPLAY_NAME);\r
+ String shortDisplayNameComputedStr = personMap.get(PersonJAXBSchema.SHORT_DISPLAY_NAME_COMPUTED);\r
+ boolean shortDisplayNameComputed = (shortDisplayNameComputedStr==null) || shortDisplayNameComputedStr.equalsIgnoreCase("true");\r
+ if( shortDisplayName == null ) {\r
+ if(!shortDisplayNameComputed) {\r
+ throw new RuntimeException(\r
+ "CreateItem: Must supply a shortDisplayName if shortDisplayNameComputed is set to false.");\r
+ }\r
+ shortDisplayName = \r
+ prepareDefaultDisplayName(\r
+ personMap.get(PersonJAXBSchema.FORE_NAME), null,\r
+ personMap.get(PersonJAXBSchema.SUR_NAME),null,null);\r
+ personMap.put(PersonJAXBSchema.SHORT_DISPLAY_NAME, shortDisplayName);\r
+ }\r
\r
if(logger.isDebugEnabled()){\r
logger.debug("Import: Create Item: \"" + displayName\r
String shortId = "johnWayneActor";
johnWayneMap.put(PersonJAXBSchema.DISPLAY_NAME_COMPUTED, "false");
johnWayneMap.put(PersonJAXBSchema.DISPLAY_NAME, "John Wayne");
+ johnWayneMap.put(PersonJAXBSchema.SHORT_DISPLAY_NAME_COMPUTED, "false");
+ johnWayneMap.put(PersonJAXBSchema.SHORT_DISPLAY_NAME, "JohnWayne");
johnWayneMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
johnWayneMap.put(PersonJAXBSchema.FORE_NAME, TEST_FORE_NAME);
*/
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"update"}, dependsOnMethods = {"updateItem"})
- public void verifyItemDisplayName(String testName) throws Exception {
+ public void verifyItemDisplayNames(String testName) throws Exception {
if (logger.isDebugEnabled()) {
logger.debug(testBanner(testName, CLASS_NAME));
PersonAuthorityClientUtils.prepareDefaultDisplayName(
TEST_FORE_NAME, null, TEST_SUR_NAME,
TEST_BIRTH_DATE, TEST_DEATH_DATE);
- Assert.assertNotNull(displayName, expectedDisplayName);
+ Assert.assertFalse(displayName.equals(expectedDisplayName));
- // Update the shortName and verify the computed name is updated.
+ String shortDisplayName = person.getShortDisplayName();
+ // Make sure displayName matches computed form
+ String expectedShortDisplayName =
+ PersonAuthorityClientUtils.prepareDefaultDisplayName(
+ TEST_FORE_NAME, null, TEST_SUR_NAME,null, null);
+ Assert.assertFalse(expectedShortDisplayName.equals(shortDisplayName));
+
+ // Update the forename and verify the computed name is updated.
person.setCsid(null);
person.setDisplayNameComputed(true);
+ person.setShortDisplayNameComputed(true);
person.setForeName("updated-" + TEST_FORE_NAME);
expectedDisplayName =
PersonAuthorityClientUtils.prepareDefaultDisplayName(
"updated-" + TEST_FORE_NAME, null, TEST_SUR_NAME,
TEST_BIRTH_DATE, TEST_DEATH_DATE);
+ expectedShortDisplayName =
+ PersonAuthorityClientUtils.prepareDefaultDisplayName(
+ "updated-" + TEST_FORE_NAME, null, TEST_SUR_NAME,null, null);
// Submit the updated resource to the service and store the response.
MultipartOutput output = new MultipartOutput();
// Verify that the updated resource computes the right displayName.
Assert.assertEquals(updatedPerson.getDisplayName(), expectedDisplayName,
"Updated ForeName in Person not reflected in computed DisplayName.");
+ // Verify that the updated resource computes the right displayName.
+ Assert.assertEquals(updatedPerson.getShortDisplayName(), expectedShortDisplayName,
+ "Updated ForeName in Person not reflected in computed ShortDisplayName.");
// Now Update the displayName, not computed and verify the computed name is overriden.
person.setDisplayNameComputed(false);
expectedDisplayName = "TestName";
person.setDisplayName(expectedDisplayName);
+ person.setShortDisplayNameComputed(false);
+ person.setShortDisplayName(expectedDisplayName);
// Submit the updated resource to the service and store the response.
output = new MultipartOutput();
Assert.assertEquals(updatedPerson.getDisplayName(),
expectedDisplayName,
"Updated DisplayName (not computed) in Person not stored.");
+ // Verify that the updated resource received the correct data.
+ Assert.assertEquals(updatedPerson.isShortDisplayNameComputed(), false,
+ "Updated shortDisplayNameComputed in Person did not match submitted data.");
+ // Verify that the updated resource computes the right displayName.
+ Assert.assertEquals(updatedPerson.getShortDisplayName(),
+ expectedDisplayName,
+ "Updated ShortDisplayName (not computed) in Person not stored.");
}
/**
* @throws Exception the exception
*/
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
- groups = {"update"}, dependsOnMethods = {"verifyItemDisplayName"})
+ groups = {"update"}, dependsOnMethods = {"verifyItemDisplayNames"})
public void verifyIllegalItemDisplayName(String testName) throws Exception {
if (logger.isDebugEnabled()) {
* \r
*/\r
package org.collectionspace.services;\r
-import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;\r
+import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;\r
\r
/**\r
* @author pschmitz\r
*\r
*/\r
-public interface PersonJAXBSchema extends AuthorityJAXBSchema {\r
+public interface PersonJAXBSchema extends AuthorityItemJAXBSchema {\r
final static String PERSONS_COMMON = "persons_common";\r
- final static String DISPLAY_NAME_COMPUTED = "displayNameComputed";\r
final static String FORE_NAME = "foreName";\r
final static String MIDDLE_NAME = "middleName";\r
final static String SUR_NAME = "surName";\r
<!-- Person Information Group -->
<xs:element name="inAuthority" type="xs:string" />
- <xs:element name="shortIdentifier" type="xs:string"/>
+ <xs:element name="shortIdentifier" type="xs:string"/>
<xs:element name="refName" type="xs:string" />
<xs:element name="termStatus" type="xs:string"/>
<xs:element name="displayName" type="xs:string"/>
<xs:element name="displayNameComputed" type="xs:boolean"/>
+ <xs:element name="shortDisplayName" type="xs:string"/>
+ <xs:element name="shortDisplayNameComputed" type="xs:boolean"/>
<xs:element name="foreName" type="xs:string"/>
<xs:element name="middleName" type="xs:string"/>
<xs:element name="surName" type="xs:string"/>
<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 person details -->
<xs:element name="uri" type="xs:anyURI"
public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
// first fill all the parts of the document
super.handleCreate(wrapDoc);
- handleDisplayName(wrapDoc.getWrappedObject());
+ handleDisplayNames(wrapDoc.getWrappedObject());
}
/* (non-Javadoc)
@Override
public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
super.handleUpdate(wrapDoc);
- handleDisplayName(wrapDoc.getWrappedObject());
+ handleDisplayNames(wrapDoc.getWrappedObject());
}
/**
- * Handle display name.
+ * Handle display names.
*
* @param docModel the doc model
* @throws Exception the exception
*/
- private void handleDisplayName(DocumentModel docModel) throws Exception {
+ private void handleDisplayNames(DocumentModel docModel) throws Exception {
String commonPartLabel = getServiceContext().getCommonPartLabel("persons");
Boolean displayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
PersonJAXBSchema.DISPLAY_NAME_COMPUTED);
- if (displayNameComputed == true) {
- String displayName = prepareDefaultDisplayName(
- (String)docModel.getProperty(commonPartLabel, PersonJAXBSchema.FORE_NAME),
- (String)docModel.getProperty(commonPartLabel, PersonJAXBSchema.MIDDLE_NAME),
- (String)docModel.getProperty(commonPartLabel, PersonJAXBSchema.SUR_NAME),
- (String)docModel.getProperty(commonPartLabel, PersonJAXBSchema.BIRTH_DATE),
- (String)docModel.getProperty(commonPartLabel, PersonJAXBSchema.DEATH_DATE));
- docModel.setProperty(commonPartLabel, PersonJAXBSchema.DISPLAY_NAME,
- displayName);
+ Boolean shortDisplayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
+ PersonJAXBSchema.SHORT_DISPLAY_NAME_COMPUTED);
+ if(displayNameComputed==null)
+ displayNameComputed = true;
+ if(shortDisplayNameComputed==null)
+ shortDisplayNameComputed = true;
+ if (displayNameComputed || shortDisplayNameComputed) {
+ String forename =
+ (String)docModel.getProperty(commonPartLabel, PersonJAXBSchema.FORE_NAME);
+ String lastname =
+ (String)docModel.getProperty(commonPartLabel, PersonJAXBSchema.SUR_NAME);
+ if(shortDisplayNameComputed) {
+ String displayName = prepareDefaultDisplayName(forename, null, lastname,
+ null, null);
+ docModel.setProperty(commonPartLabel, PersonJAXBSchema.SHORT_DISPLAY_NAME,
+ displayName);
+ }
+ if(displayNameComputed) {
+ String midname =
+ (String)docModel.getProperty(commonPartLabel, PersonJAXBSchema.MIDDLE_NAME);
+ String birthdate =
+ (String)docModel.getProperty(commonPartLabel, PersonJAXBSchema.BIRTH_DATE);
+ String deathdate =
+ (String)docModel.getProperty(commonPartLabel, PersonJAXBSchema.DEATH_DATE);
+ String displayName = prepareDefaultDisplayName(forename, midname, lastname,
+ birthdate, deathdate);
+ docModel.setProperty(commonPartLabel, PersonJAXBSchema.DISPLAY_NAME,
+ displayName);
+ }
}
}
+
/**
* Produces a default displayName from the basic name and dates fields.
* @see PersonAuthorityClientUtils.prepareDefaultDisplayName() which
DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
PersonsCommonList coList = extractPagingInfo(new PersonsCommonList(), wrapDoc);
AbstractCommonList commonList = (AbstractCommonList) coList;
- commonList.setFieldsReturned("displayName|refName|uri|csid");
+ commonList.setFieldsReturned("displayName|refName|shortIdentifier|uri|csid");
List<PersonsCommonList.PersonListItem> list = coList.getPersonListItem();
Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
String commonPartLabel = getServiceContext().getCommonPartLabel(
PersonListItem ilistItem = new PersonListItem();
ilistItem.setDisplayName((String) docModel.getProperty(
commonPartLabel, PersonJAXBSchema.DISPLAY_NAME));
+ ilistItem.setShortIdentifier((String) docModel.getProperty(commonPartLabel,
+ PersonJAXBSchema.SHORT_IDENTIFIER));
ilistItem.setRefName((String) docModel.getProperty(commonPartLabel,
PersonJAXBSchema.REF_NAME));
String id = NuxeoUtils.extractId(docModel.getPathAsString());
<!-- Vocabulary Information Group -->
<xs:element name="displayName" type="xs:string"/>
- <xs:element name="shortIdentifier" type="xs:string"/>
+ <xs:element name="shortIdentifier" type="xs:string"/>
<xs:element name="refName" type="xs:string"/>
<xs:element name="vocabType" type="xs:string"/>
</xs:sequence>
<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 vocabularyitem details -->
<xs:element name="uri" type="xs:anyURI"
DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
VocabularyitemsCommonList coList = extractPagingInfo(new VocabularyitemsCommonList(), wrapDoc);
AbstractCommonList commonList = (AbstractCommonList) coList;
- commonList.setFieldsReturned("displayName|refName|uri|csid");
+ commonList.setFieldsReturned("displayName|refName|shortIdentifier|uri|csid");
List<VocabularyitemsCommonList.VocabularyitemListItem> list = coList.getVocabularyitemListItem();
Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
+ String commonPartLabel = getServiceContext().getCommonPartLabel("vocabularyItems");
while (iter.hasNext()) {
DocumentModel docModel = iter.next();
VocabularyitemListItem ilistItem = new VocabularyitemListItem();
- ilistItem.setDisplayName((String) docModel.getProperty(
- getServiceContext().getCommonPartLabel("vocabularyItems"),
+ ilistItem.setDisplayName((String) docModel.getProperty(commonPartLabel,
AuthorityItemJAXBSchema.DISPLAY_NAME));
- ilistItem.setRefName((String) docModel.getProperty(
- getServiceContext().getCommonPartLabel("vocabularyItems"),
+ ilistItem.setShortIdentifier((String) docModel.getProperty(commonPartLabel,
+ AuthorityItemJAXBSchema.SHORT_IDENTIFIER));
+ ilistItem.setRefName((String) docModel.getProperty(commonPartLabel,
AuthorityItemJAXBSchema.REF_NAME));
String id = NuxeoUtils.extractId(docModel.getPathAsString());
ilistItem.setUri("/vocabularies/" + inAuthority + "/items/" + id);