Merged 5.0.N (5.0.3) to HEAD (5.1)

110205: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
      110092: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
         110055: Merged DEV to PATCHES/V4.2.5 (4.2.5)
            109047 : MNT-12226 : Alfresco fails to version metadata after uploading new content version even when autoVersionOnUpdateProps=true
               - Reimplemented previous solution. Configuration properties for autoVersioning should not affect all nodes in repo. They should just provide default behavior.
               - Added ability to specify default values for model properties using standard alfresco GLOBAL_PROPERTIES file.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@110627 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tatyana Valkevych
2015-08-21 16:42:09 +00:00
parent 5e0d90bb8d
commit 9cdc1f1377
6 changed files with 22 additions and 51 deletions

View File

@@ -112,12 +112,6 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
private Set<QName> excludedOnUpdatePropQNames = Collections.emptySet();
/** flag indicating whether auto-versioning should be enabled or not */
private boolean enableAutoVersioning = true;
/** flag indicating whether auto-versioning should be enabled on properties update or not */
private boolean enableAutoVersionOnUpdateProps = false;
/**
* Set the policy component
*
@@ -196,38 +190,11 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
this.excludedOnUpdateProps = Collections.unmodifiableList(excludedOnUpdateProps);
}
/**
* Set whether the aspect-associated behaviour should be enabled or disabled. This is only used
* during {@link #init() initialization}.
*
* @param enableAutoVersioning <tt>true</tt> to enable the aspect behaviour otherwise <tt>false</tt>
*/
public void setEnableAutoVersioning(boolean enableAutoVersioning)
{
this.enableAutoVersioning = enableAutoVersioning;
}
/**
* Set whether the OnUpdatePropertiesPolicy should be binded or not. This is only used
* during {@link #init() initialization}.
*
* @param enableAutoVersionOnUpdateProps <tt>true</tt> to bind OnUpdatePropertiesPolicy sotherwise <tt>false</tt>
*/
public void setEnableAutoVersionOnUpdateProps(boolean enableAutoVersionOnUpdateProps)
{
this.enableAutoVersionOnUpdateProps = enableAutoVersionOnUpdateProps;
}
/**
* Initialise the versionable aspect policies
*/
public void init()
{
if (!enableAutoVersioning)
{
return;
}
this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeAddAspect"),
ContentModel.ASPECT_VERSIONABLE,
@@ -467,8 +434,7 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
Map<QName, Serializable> before,
Map<QName, Serializable> after)
{
if (this.enableAutoVersionOnUpdateProps && // MNT-12226 : additional setting to override the behavior for metadata versioning
(this.nodeService.exists(nodeRef) == true) &&
if ((this.nodeService.exists(nodeRef) == true) &&
!LockUtils.isLockedAndReadOnly(nodeRef, lockService) &&
(this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true) &&
(this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY) == false))