From c33e703be989c934770731f28c33627d67600d89 Mon Sep 17 00:00:00 2001 From: Rodica Sutu Date: Fri, 1 Nov 2019 09:51:48 +0200 Subject: [PATCH] add a list of namespace URIs for properties, which should be always editable for a frozen node --- .../rm-model-context.xml | 6 +++++ .../PropertyModificationAllowedCheck.java | 26 ++++++++++++++++++- ...pertyModificationAllowedCheckUnitTest.java | 4 +++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml index 932d24c525..d849ae16b1 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml @@ -177,6 +177,11 @@ + + + + http://www.alfresco.org/model/system/1.0 + @@ -185,6 +190,7 @@ + diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheck.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheck.java index 8e98601b61..52c7f956dd 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheck.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheck.java @@ -45,6 +45,29 @@ public class PropertyModificationAllowedCheck * List of qnames that can be modified */ private List whiteList; + + /** + * List of model URI's for which the properties can be updated + */ + private List editableURIs; + + /** + * Setter for list of model URI's + * @param editableURIs List + */ + public void setEditableURIs(List editableURIs) + { + this.editableURIs = editableURIs; + } + + /** + * Getter for list of model URI's + * @return return the list of model URI's + */ + public List getEditableURIs() + { + return editableURIs; + } /** * Setter for list of qnames @@ -93,7 +116,7 @@ public class PropertyModificationAllowedCheck if (before.get(key) != null && after.get(key) != null && !(after.get(key).equals(before.get(key)))) { //Property modified check to see if allowed - proceed = whiteList.contains(key); + proceed = whiteList.contains(key) || getEditableURIs().contains(key.getNamespaceURI()); if (!proceed) { break; @@ -103,4 +126,5 @@ public class PropertyModificationAllowedCheck return proceed; } + } diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheckUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheckUnitTest.java index 1b192a62c0..3cb5e89c0d 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheckUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheckUnitTest.java @@ -58,6 +58,7 @@ public class PropertyModificationAllowedCheckUnitTest private QName qName, qName2; private List list; + private List editableURIs; @Mock private Serializable serializable, serializable2; @@ -74,6 +75,9 @@ public class PropertyModificationAllowedCheckUnitTest before.put(qName, serializable); after.put(qName, serializable2); list = new ArrayList(); + editableURIs =new ArrayList<>(); + propertyModificationAllowedCheck.setWhiteList(list); + propertyModificationAllowedCheck.setEditableURIs(editableURIs); } /**