From: Laramie Crocker Date: Fri, 12 Nov 2010 18:59:56 +0000 (+0000) Subject: CSPACE-1028 X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=2a75ee668c913b6c1d2a1820f37a59472e91b7b7;p=tmp%2Fjakarta-migration.git CSPACE-1028 --- diff --git a/3rdparty/nuxeo/nuxeo-platform-collectionspace/src/main/resources/schemas/collectionspace_core.xsd b/3rdparty/nuxeo/nuxeo-platform-collectionspace/src/main/resources/schemas/collectionspace_core.xsd index c7f45ea67..7ef65b122 100644 --- a/3rdparty/nuxeo/nuxeo-platform-collectionspace/src/main/resources/schemas/collectionspace_core.xsd +++ b/3rdparty/nuxeo/nuxeo-platform-collectionspace/src/main/resources/schemas/collectionspace_core.xsd @@ -13,6 +13,10 @@ xmlns="http://collectionspace.org/collectionspace_core/" targetNamespace="http://collectionspace.org/collectionspace_core/" version="0.1"> + - + + + + diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java index e46e751c3..c6475100a 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java @@ -57,7 +57,9 @@ public abstract class DocumentModelHandler public final static String COLLECTIONSPACE_CORE_SCHEMA = "collectionspace_core"; public final static String COLLECTIONSPACE_CORE_TENANTID = "tenantId"; - + public final static String COLLECTIONSPACE_CORE_CREATED_AT = "createdAt"; + public final static String COLLECTIONSPACE_CORE_UPDATED_AT = "updatedAt"; + /** * getRepositorySession returns Nuxeo Repository Session * @return diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java index 647359149..00f61d937 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java @@ -25,6 +25,7 @@ import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; import org.collectionspace.services.common.context.ServiceContext; +import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils; import org.collectionspace.services.common.query.IQueryManager; import org.collectionspace.services.common.query.QueryContext; import org.collectionspace.services.common.repository.RepositoryClient; @@ -100,12 +101,20 @@ public class RepositoryJavaClientImpl implements RepositoryClient { documentModel.setProperty(DocumentModelHandler.COLLECTIONSPACE_CORE_SCHEMA, DocumentModelHandler.COLLECTIONSPACE_CORE_TENANTID, ctx.getTenantId()); + + String now = GregorianCalendarDateTimeUtils.timestampUTC(); + switch (action) { case CREATE: - //add creation date value + documentModel.setProperty(DocumentModelHandler.COLLECTIONSPACE_CORE_SCHEMA, + DocumentModelHandler.COLLECTIONSPACE_CORE_CREATED_AT, + now); break; case UPDATE: - //add update value + documentModel.setProperty(DocumentModelHandler.COLLECTIONSPACE_CORE_SCHEMA, + DocumentModelHandler.COLLECTIONSPACE_CORE_UPDATED_AT, + now); + break; default: } @@ -115,8 +124,6 @@ public class RepositoryJavaClientImpl implements RepositoryClient { * create document in the Nuxeo repository * * @param ctx service context under which this method is invoked - * @param docType - * of the document created * @param handler * should be used by the caller to provide and transform the * document @@ -331,7 +338,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient { /** * find wrapped documentModel from the Nuxeo repository * @param ctx service context under which this method is invoked - * @param where NXQL where clause to get the document + * @param whereClause where NXQL where clause to get the document * @throws DocumentException */ @Override @@ -381,7 +388,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient { /** * find doc and return CSID from the Nuxeo repository * @param ctx service context under which this method is invoked - * @param where NXQL where clause to get the document + * @param whereClause where NXQL where clause to get the document * @throws DocumentException */ @Override @@ -411,8 +418,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient { /** * Find a list of documentModels from the Nuxeo repository * @param docTypes a list of DocType names to match - * @param where the clause to qualify on - * @param domain the domain for the associated services + * @param whereClause where the clause to qualify on * @return */ @Override @@ -637,7 +643,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient { ((DocumentModelHandler) handler).setRepositorySession(repoSession); DocumentWrapper wrapDoc = new DocumentWrapperImpl(doc); handler.handle(Action.UPDATE, wrapDoc); - setCollectionSpaceCoreValues(ctx, doc, Action.CREATE); + setCollectionSpaceCoreValues(ctx, doc, Action.UPDATE); repoSession.saveDocument(doc); repoSession.save(); handler.complete(Action.UPDATE, wrapDoc); @@ -841,7 +847,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient { * Append a WHERE clause to the NXQL query. * * @param query The NXQL query to which the WHERE clause will be appended. - * @param querycontext The query context, which provides the WHERE clause to append. + * @param queryContext The query context, which provides the WHERE clause to append. */ private final void appendNXQLWhere(StringBuilder query, QueryContext queryContext) { // @@ -876,7 +882,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient { * Append an ORDER BY clause to the NXQL query. * * @param query the NXQL query to which the ORDER BY clause will be appended. - * @param querycontext the query context, which provides the ORDER BY clause to append. + * @param queryContext the query context, which provides the ORDER BY clause to append. * * @throws DocumentException if the supplied value of the orderBy clause is not valid. *