add a list of namespace URIs for properties, which should be always editable for a frozen node

This commit is contained in:
Rodica Sutu
2019-11-01 09:51:48 +02:00
parent cb9bc19465
commit c33e703be9
3 changed files with 35 additions and 1 deletions

View File

@@ -178,6 +178,11 @@
<util:constant id="propThumbnailModification" static-field="org.alfresco.model.ContentModel.PROP_LAST_THUMBNAIL_MODIFICATION_DATA" />
<!-- Defines a list of namespace URIs for properties, which should be always editable for a frozen node-->
<util:list id="frozen_alwaysEditURIs" value-type="java.lang.String">
<value>http://www.alfresco.org/model/system/1.0</value>
</util:list>
<bean name="updateFrozenPropertyCheck"
class="org.alfresco.module.org_alfresco_module_rm.util.PropertyModificationAllowedCheck">
<property name="whiteList">
@@ -185,6 +190,7 @@
<ref bean="propThumbnailModification" />
</list>
</property>
<property name="editableURIs" ref="frozen_alwaysEditURIs" />
</bean>
<bean id="rma.vitalRecordDefinition" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.VitalRecordDefinitionAspect" parent="rm.baseBehaviour">

View File

@@ -46,6 +46,29 @@ public class PropertyModificationAllowedCheck
*/
private List<QName> whiteList;
/**
* List of model URI's for which the properties can be updated
*/
private List<String> editableURIs;
/**
* Setter for list of model URI's
* @param editableURIs List<String>
*/
public void setEditableURIs(List<String> editableURIs)
{
this.editableURIs = editableURIs;
}
/**
* Getter for list of model URI's
* @return return the list of model URI's
*/
public List<String> getEditableURIs()
{
return editableURIs;
}
/**
* Setter for list of qnames
* @param whiteList List<QName>
@@ -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;
}
}

View File

@@ -58,6 +58,7 @@ public class PropertyModificationAllowedCheckUnitTest
private QName qName, qName2;
private List<QName> list;
private List<String> 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);
}
/**