\r
<xs:element name="tenantId" type="xs:string"/>\r
<xs:element name="uri" type="xs:string"/>\r
+ <xs:element name="refname" type="xs:string"/>\r
<!--<xs:element name="createdAt" type="xs:string"/>-->\r
<xs:element name="createdAt" type="xs:dateTime"/>\r
<xs:element name="updatedAt" type="xs:dateTime"/>\r
public final static String COLLECTIONSPACE_CORE_SCHEMA = "collectionspace_core";
public final static String COLLECTIONSPACE_CORE_TENANTID = "tenantId";
public final static String COLLECTIONSPACE_CORE_URI = "uri";
+ public final static String COLLECTIONSPACE_CORE_REFNAME = "refname";
public final static String COLLECTIONSPACE_CORE_CREATED_AT = "createdAt";
public final static String COLLECTIONSPACE_CORE_UPDATED_AT = "updatedAt";
public final static String COLLECTIONSPACE_CORE_CREATED_BY = "createdBy";
String displaySuffix = (displayName != null && (!displayName.isEmpty())) ? '\'' + displayName + '\'' : "";\r
return URN_PREFIX + tenantName + ':' + resource + ":" + "name" + "(" + shortIdentifier + ")" + displaySuffix;\r
}\r
+\r
+ public static Authority buildAuthority(String tenantName, String serviceName, String authorityShortIdentifier, String authorityDisplayName) {\r
+ Authority authority = new Authority();\r
+ authority.tenantName = tenantName;\r
+ authority.resource = serviceName;\r
+ if (Tools.notEmpty(authority.resource)) {\r
+ authority.resource = authority.resource.toLowerCase();\r
+ }\r
+ authority.shortIdentifier = authorityShortIdentifier;\r
+ authority.displayName = authorityDisplayName;\r
+ return authority;\r
+ }\r
}\r
\r
public static class AuthorityItem {\r
}\r
}\r
\r
- public static Authority buildAuthority(String tenantName, String serviceName, String authorityShortIdentifier, String authorityDisplayName) {\r
- Authority authority = new Authority();\r
- authority.tenantName = tenantName;\r
- authority.resource = serviceName;\r
- if (Tools.notEmpty(authority.resource)) {\r
- authority.resource = authority.resource.toLowerCase();\r
- }\r
- authority.shortIdentifier = authorityShortIdentifier;\r
- authority.displayName = authorityDisplayName;\r
- return authority;\r
- }\r
-\r
public static AuthorityItem buildAuthorityItem(String tenantName, String serviceName, String authorityShortIdentifier,\r
String itemShortIdentifier, String itemDisplayName) {\r
- Authority authority = buildAuthority(tenantName, serviceName, authorityShortIdentifier, "");\r
+ Authority authority = Authority.buildAuthority(tenantName, serviceName, authorityShortIdentifier, "");\r
return buildAuthorityItem(authority, itemShortIdentifier, itemDisplayName);\r
}\r
\r
\r
private AbstractCommonList commonList;\r
\r
- protected static final int NUM_STANDARD_LIST_RESULT_FIELDS = 4;\r
+ protected static final int NUM_STANDARD_LIST_RESULT_FIELDS = 5;\r
protected static final String STANDARD_LIST_CSID_FIELD = "csid";\r
protected static final String STANDARD_LIST_URI_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_URI;\r
+ protected static final String STANDARD_LIST_REFNAME_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME;\r
protected static final String STANDARD_LIST_UPDATED_AT_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT;\r
protected static final String STANDARD_LIST_WORKFLOW_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_WORKFLOWSTATE;\r
protected static final String STANDARD_LIST_MARK_RT_FIELD = "related";\r
throw new UnsupportedOperationException();\r
}\r
\r
- public static String getUpdatedAtAsString(DocumentModel docModel) throws Exception {\r
+ protected static String getRefname(DocumentModel docModel) throws Exception {\r
+ String result = (String)docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,\r
+ CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME);\r
+ return result;\r
+ }\r
+ \r
+ protected static String getUpdatedAtAsString(DocumentModel docModel) throws Exception {\r
GregorianCalendar cal = (GregorianCalendar)\r
docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,\r
CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT);\r
\r
@Override\r
public AbstractCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {\r
- String classname = getDocHandlerParams().getAbstractCommonListClassname();\r
CommonList commonList = new CommonList();\r
String markRtSbj = null;\r
RepositoryInstance repoSession = null;\r
nFields++;\r
baseFields++;\r
}\r
- String fields[] = new String[nFields];\r
+ String fields[] = new String[nFields]; // REM - Why can't this just be a static array defined once at the top? Then there'd be no need for these hardcoded "[x]" statements and no need for NUM_STANDARD_LIST_RESULT_FIELDS constant as well. \r
fields[0] = STANDARD_LIST_CSID_FIELD;\r
fields[1] = STANDARD_LIST_URI_FIELD;\r
- fields[2] = STANDARD_LIST_UPDATED_AT_FIELD;\r
- fields[3] = STANDARD_LIST_WORKFLOW_FIELD;\r
- if(markRtSbj!=null) {\r
- fields[4] = STANDARD_LIST_MARK_RT_FIELD;\r
+ fields[2] = STANDARD_LIST_REFNAME_FIELD;\r
+ fields[3] = STANDARD_LIST_UPDATED_AT_FIELD;\r
+ fields[4] = STANDARD_LIST_WORKFLOW_FIELD;\r
+ if(markRtSbj != null) {\r
+ fields[5] = STANDARD_LIST_MARK_RT_FIELD;\r
}\r
for(int i = baseFields; i < nFields; i++) {\r
ListResultField field = resultsFields.get(i - baseFields); \r
}\r
String uri = getUri(docModel);\r
item.put(STANDARD_LIST_URI_FIELD, uri);\r
+ item.put(STANDARD_LIST_REFNAME_FIELD, getRefname(docModel));\r
item.put(STANDARD_LIST_UPDATED_AT_FIELD,\r
getUpdatedAtAsString(docModel));\r
item.put(STANDARD_LIST_WORKFLOW_FIELD,\r
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils;
+import org.collectionspace.services.common.api.RefName;
import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.AbstractMultipartDocumentHandlerImpl;
//
documentModel.setProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
CollectionSpaceClient.COLLECTIONSPACE_CORE_URI, getUri(documentModel));
+ //
+ // Add the resource's refname
+ //
+ String csid = documentModel.getName();
+ String refname = RefName.Authority.buildAuthority(ctx.getTenantName(), ctx.getServiceName(),
+ csid, "" /*authorityDisplayName*/).toString();
+ documentModel.setProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
+ CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME, refname);
//
// Add the CSID to the DublinCore title so we can see the CSID in the default
// Nuxeo webapp.