Merged V2.0 to HEAD

5425: AR-1309
   5426: AR-1342
   5427: AWC-1157


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5480 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-04-11 21:46:19 +00:00
parent 529c4840e9
commit f43d8864cb
10 changed files with 203 additions and 27 deletions

View File

@@ -32,6 +32,7 @@ import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.node.integrity.IntegrityChecker;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.TransactionUtil;
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
import org.alfresco.service.cmr.admin.PatchException;
@@ -263,6 +264,7 @@ public abstract class AbstractPatch implements Patch
{
return this.dependsOn;
}
/**
* Set all the dependencies for this patch. It should not be executed
* before all the dependencies have been applied.
@@ -334,19 +336,28 @@ public abstract class AbstractPatch implements Patch
// execute in a transaction
try
{
TransactionWork<String> patchWork = new TransactionWork<String>()
AuthenticationUtil.RunAsWork<String> authorisedPathWork = new AuthenticationUtil.RunAsWork<String>()
{
public String doWork() throws Exception
{
// downgrade integrity checking
IntegrityChecker.setWarnInTransaction();
TransactionWork<String> patchWork = new TransactionWork<String>()
{
public String doWork() throws Exception
{
String report = applyInternal();
// done
return report;
};
// downgrade integrity checking
IntegrityChecker.setWarnInTransaction();
String report = applyInternal();
// done
return report;
}
};
return TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, patchWork);
}
};
String report = TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, patchWork);
String report = AuthenticationUtil.runAs(authorisedPathWork, AuthenticationUtil.getSystemUserName());
// the patch was successfully applied
applied = true;
// done