Merged 5.1-MNT1 (5.1.0) to HEAD (5.1)

115580 adavis: Merged 5.1.N (5.1.1) to 5.1-MNT1 (5.1.0)
      115535 adavis: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
         115533 adavis: Merged 5.0.2-CLOUD (Cloud ) to 5.0.N (5.0.3)
            115531 adavis: Merged 5.0.2-PLUS (5.0.2-PLUS) to 5.0.2-CLOUD (Cloud )
               115517 abozianu: Merged DEV to 5.0.2-PLUS (5.0.2-PLUS)
                  115450 abozianu: MNT-15064 : [Cloud Upgrade] Errors apear in alfresco.log after Stop & Start upgrade Alfresco Cloud 39.6.5 to 40 on DP


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@115710 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-10-30 00:19:46 +00:00
parent 9fe8315e16
commit 80118cac2d

View File

@@ -29,6 +29,8 @@ import org.alfresco.repo.admin.patch.AbstractPatch;
import org.alfresco.repo.batch.BatchProcessWorkProvider; import org.alfresco.repo.batch.BatchProcessWorkProvider;
import org.alfresco.repo.batch.BatchProcessor; import org.alfresco.repo.batch.BatchProcessor;
import org.alfresco.repo.policy.BehaviourFilter; import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.site.SiteModel; import org.alfresco.repo.site.SiteModel;
import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
@@ -106,6 +108,7 @@ public class AddUnmovableAspectToSitesPatch extends AbstractPatch
logger, logger,
1000); 1000);
final String authenticatedUser = AuthenticationUtil.getFullyAuthenticatedUser();
BatchProcessor.BatchProcessWorker<ChildAssociationRef> worker = new BatchProcessor.BatchProcessWorker<ChildAssociationRef>() BatchProcessor.BatchProcessWorker<ChildAssociationRef> worker = new BatchProcessor.BatchProcessWorker<ChildAssociationRef>()
{ {
public void afterProcess() throws Throwable public void afterProcess() throws Throwable
@@ -121,17 +124,30 @@ public class AddUnmovableAspectToSitesPatch extends AbstractPatch
return entry.toString(); return entry.toString();
} }
public void process(ChildAssociationRef child) throws Throwable public void process(final ChildAssociationRef child) throws Throwable
{ {
try /*
* Fix for MNT-15064.
* Run as authenticated user to make sure the nodes are searched in the correct space store.
*/
RunAsWork<Void> work = new RunAsWork<Void>()
{ {
behaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE); @Override
nodeService.addAspect(child.getChildRef(), ContentModel.ASPECT_UNMOVABLE, null); public Void doWork() throws Exception
} {
finally try
{ {
behaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE); behaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE);
} nodeService.addAspect(child.getChildRef(), ContentModel.ASPECT_UNMOVABLE, null);
}
finally
{
behaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE);
}
return null;
}
};
AuthenticationUtil.runAs(work, authenticatedUser);
} }
}; };