]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-4084 Added updatedAt to each item in refObjs results.
authorPatrick Schmitz <pschmitz@berkeley.edu>
Thu, 17 Nov 2011 06:58:04 +0000 (06:58 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Thu, 17 Nov 2011 06:58:04 +0000 (06:58 +0000)
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java
services/jaxb/src/main/resources/authorityrefdocs.xsd

index eedc243c7cc9fd1f4957e85bb72f355ca7fa04bd..5e22beb2aec4b6c8c7b41ea84452044ea317a9f8 100644 (file)
@@ -51,6 +51,7 @@ import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.document.DocumentUtils;\r
 import org.collectionspace.services.common.document.DocumentWrapper;\r
 import org.collectionspace.services.common.repository.RepositoryClient;\r
+import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;\r
 import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;\r
 import org.collectionspace.services.common.service.ServiceBindingType;\r
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
@@ -296,6 +297,11 @@ public class RefNameServiceUtils {
                 String csid = NuxeoUtils.getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());\r
                 ilistItem.setDocId(csid);\r
                 ilistItem.setUri(serviceContextPath + csid);\r
+                try {\r
+                       ilistItem.setUpdatedAt(DocHandlerBase.getUpdatedAtAsString(docModel));\r
+                } catch(Exception e) {\r
+                       logger.error("Error getting udpatedAt value for doc ["+csid+"]: "+e.getLocalizedMessage());\r
+                }\r
                 // The id and URI are the same on all doctypes\r
                 ilistItem.setDocType(docType);\r
                 ilistItem.setDocNumber(\r
index 2ce34ae91170b67f3d0ce1ccdc9452f83e868d15..91ae0a9b2450428d75b481800834d42e2ca8ed1c 100755 (executable)
@@ -163,6 +163,14 @@ public abstract class DocHandlerBase<T> extends RemoteDocumentModelHandlerImpl<T
         return commonList;\r
     }\r
 \r
+       public static String getUpdatedAtAsString(DocumentModel docModel) throws Exception {\r
+                       GregorianCalendar cal = (GregorianCalendar)\r
+                                                               docModel.getProperty(COLLECTIONSPACE_CORE_SCHEMA,\r
+                                                                                       COLLECTIONSPACE_CORE_UPDATED_AT);\r
+                       String updatedAt = DateTimeFormatUtils.formatAsISO8601Timestamp(cal);\r
+                       return updatedAt;\r
+       }\r
+\r
     @Override\r
     public AbstractCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {\r
         String classname = getDocHandlerParams().getAbstractCommonListClassname();\r
@@ -192,11 +200,7 @@ public abstract class DocHandlerBase<T> extends RemoteDocumentModelHandlerImpl<T
             item.put(fields[0], id);\r
             String uri = getUri(docModel);\r
             item.put(fields[1], uri);\r
-            GregorianCalendar cal = (GregorianCalendar)\r
-                                               docModel.getProperty(COLLECTIONSPACE_CORE_SCHEMA,\r
-                                                                       COLLECTIONSPACE_CORE_UPDATED_AT);\r
-            String updatedAt = DateTimeFormatUtils.formatAsISO8601Timestamp(cal);\r
-            item.put(fields[2], updatedAt);\r
+            item.put(fields[2], getUpdatedAtAsString(docModel));\r
 \r
             for (ListResultField field : resultsFields ){\r
                String schema = field.getSchema();\r
index 76f5c4f1711a621e7ab1c965384bce9057aa6c95..6b555c17609cafce9fe6cb2f8c736689b3089329 100644 (file)
@@ -47,6 +47,7 @@
                                                                        <xs:element name="docName"         type="xs:string" minOccurs="0" />
                                                                        <xs:element name="sourceField"     type="xs:string" minOccurs="1" />
                                                                        <xs:element name="uri"             type="xs:anyURI" minOccurs="1" />
+                                                                       <xs:element name="updatedAt"       type="xs:string" minOccurs="1" />
                                                                </xs:sequence>
                                                        </xs:complexType>
                                                </xs:element>