Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

108038: Merged 5.0.N (5.0.3) to HEAD-BUG-FIX (5.1/Cloud)
      107601: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.3)
         107332: Merged DEV to V4.2-BUG-FIX (4.2.5)
            105981 : MNT-12226 : Alfresco fails to version metadata after uploading new content version even when autoVersionOnUpdateProps=true
               - Added config for upload.post.js webscript. So now users may configure versioning for Share APP separatelly.
            106157 : MNT-12226 : Alfresco fails to version metadata after uploading new content version even when autoVersionOnUpdateProps=true
               - Updated previous solution so that if no config provided for upload.post.js webscript then default model versioning strategy used.,
         107537: MNT-12226 : Alfresco fails to version metadata after uploading new content version even when autoVersionOnUpdateProps=true
            - Fixed build failure.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@108069 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-07-09 22:09:30 +00:00
parent ae66d46812
commit c657b2825a
3 changed files with 39 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
<!-- modify this configuration to change the versioning behaviour for this API - remove the section to apply content model default behaviour -->
<upload>
<autoVersion>true</autoVersion>
<autoVersionProps>false</autoVersionProps>
</upload>

View File

@@ -55,6 +55,10 @@ function main()
utils.setLocale(args["lang"]);
}
var uploadConfig = new XML(config.script),
autoVersion = uploadConfig.autoVersion.toString() == "" ? null : uploadConfig.autoVersion.toString() == "true",
autoVersionProps = uploadConfig.autoVersionProps.toString() == "" ? null : uploadConfig.autoVersionProps.toString() == "true";
// Parse file attributes
for each (field in formdata.fields)
{
@@ -229,8 +233,15 @@ function main()
if (!workingcopy)
{
// Ensure the file is versionable (autoVersion = true, autoVersionProps = false)
updateNode.ensureVersioningEnabled(true, false);
// Ensure the file is versionable (autoVersion and autoVersionProps read from config)
if (autoVersion != null && autoVersionProps != null)
{
updateNode.ensureVersioningEnabled(autoVersion, autoVersionProps);
}
else
{
updateNode.ensureVersioningEnabled();
}
// It's not a working copy, do a check out to get the actual working copy
updateNode = updateNode.checkoutForUpload();
@@ -362,8 +373,15 @@ function main()
newFile.save();
// TODO (THOR-175) - review
// Ensure the file is versionable (autoVersion = true, autoVersionProps = false)
newFile.ensureVersioningEnabled(true, false);
// Ensure the file is versionable (autoVersion and autoVersionProps read from config)
if (autoVersion != null && autoVersionProps != null)
{
newFile.ensureVersioningEnabled(autoVersion, autoVersionProps);
}
else
{
newFile.ensureVersioningEnabled();
}
// NOTE: Removal of first request for thumbnails to improve upload performance
// Thumbnails are still requested by Share on first render of the doclist image.

View File

@@ -61,6 +61,7 @@ import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.tenant.TenantUtil;
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.repo.version.VersionableAspect;
import org.alfresco.rest.api.tests.RepoService.SiteInformation;
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
import org.alfresco.rest.api.tests.RepoService.TestPerson;
@@ -122,6 +123,7 @@ import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictExcept
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.io.IOUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
@@ -155,6 +157,7 @@ public class TestCMIS extends EnterpriseTestApi
private CMISStrictDictionaryService cmisDictionary;
private QNameFilter cmisTypeExclusions;
private NodeService nodeService;
private VersionableAspect versionableAspect;
@Before
public void before() throws Exception
@@ -166,6 +169,15 @@ public class TestCMIS extends EnterpriseTestApi
this.cmisDictionary = (CMISStrictDictionaryService)ctx.getBean("OpenCMISDictionaryService");
this.cmisTypeExclusions = (QNameFilter)ctx.getBean("cmisTypeExclusions");
this.nodeService = (NodeService) ctx.getBean("NodeService");
this.versionableAspect = (VersionableAspect) ctx.getBean("versionableAspect");
this.versionableAspect.setEnableAutoVersionOnUpdateProps(true);
}
@After
public void after()
{
this.versionableAspect.setEnableAutoVersionOnUpdateProps(false);
}
private void checkSecondaryTypes(Document doc, Set<String> expectedSecondaryTypes, Set<String> expectedMissingSecondaryTypes)