From ede1386710f81d7e97f604ccb78d55329a4242ff Mon Sep 17 00:00:00 2001 From: Ana Bozianu Date: Fri, 16 Dec 2016 14:27:01 +0200 Subject: [PATCH] RM-4418 - added comments and localization --- .../messages/records-management-service.properties | 3 ++- .../model/rma/aspect/RecordAspect.java | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties index 37b4cd6ede..a42ee061f7 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties @@ -20,4 +20,5 @@ rm.service.node-has-aspect=The record type {1} is already showing for record {0} rm.service.final-version=Final rm.service.final-version-description=The final archived record version rm.service.enable-autoversion-on-record-creation=Auto Version on Record Creation -rm.service.add-children-to-closed-record-folder=You can't add new items to a closed record folder \ No newline at end of file +rm.service.add-children-to-closed-record-folder=You can't add new items to a closed record folder +rm.service.update-record-content=Could not update content property as it's immutable for records. \ No newline at end of file diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java index 7e0a4e72b3..ba5a48da63 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java @@ -54,6 +54,7 @@ import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.ScriptService; import org.alfresco.service.namespace.QName; +import org.springframework.extensions.surf.util.I18NUtil; /** * rma:record behaviour bean @@ -85,7 +86,10 @@ public class RecordAspect extends AbstractDisposableItem /** record service */ protected RecordService recordService; - + + /** I18N */ + private static final String MSG_CANNOT_UPDATE_RECORD_CONTENT = "rm.service.update-record-content"; + /** * @param extendedSecurityService extended security service */ @@ -349,9 +353,10 @@ public class RecordAspect extends AbstractDisposableItem ) public void onContentPropertyUpdate(NodeRef nodeRef, QName propertyQName, ContentData beforeValue, ContentData afterValue) { + // Allow creation of content but not update if (beforeValue != null) { - throw new IntegrityException("Content property cannot be updated for records", null); + throw new IntegrityException(I18NUtil.getMessage(MSG_CANNOT_UPDATE_RECORD_CONTENT), null); } } }