mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
- Action/Rule decoupling work
- Updated web services, SDK and web client where appropraite - Patch added to migrate existing rules - Entire rule service can now be disabled programmatically - Rule service is now disabled during the patching process - StoreEnum and languageEnum types removed from web service interfaces - Multiple rule types now supported in the repo (but not in the UI) - Removed owning node ref from action and rule .. now calculated from methods on the rule service git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3464 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -25,6 +25,7 @@ import java.util.Map;
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.repo.domain.AppliedPatch;
|
||||
import org.alfresco.service.cmr.admin.PatchException;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.descriptor.Descriptor;
|
||||
import org.alfresco.service.descriptor.DescriptorService;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -50,6 +51,7 @@ public class PatchServiceImpl implements PatchService
|
||||
private static Log logger = LogFactory.getLog(PatchServiceImpl.class);
|
||||
|
||||
private DescriptorService descriptorService;
|
||||
private RuleService ruleService;
|
||||
private PatchDaoService patchDaoService;
|
||||
private List<Patch> patches;
|
||||
|
||||
@@ -67,6 +69,11 @@ public class PatchServiceImpl implements PatchService
|
||||
{
|
||||
this.patchDaoService = patchDaoService;
|
||||
}
|
||||
|
||||
public void setRuleService(RuleService ruleService)
|
||||
{
|
||||
this.ruleService = ruleService;
|
||||
}
|
||||
|
||||
public void registerPatch(Patch patch)
|
||||
{
|
||||
@@ -75,31 +82,50 @@ public class PatchServiceImpl implements PatchService
|
||||
|
||||
public boolean applyOutstandingPatches()
|
||||
{
|
||||
// construct a map of all known patches by ID
|
||||
Map<String, Patch> allPatchesById = new HashMap<String, Patch>(23);
|
||||
for (Patch patch : patches)
|
||||
{
|
||||
allPatchesById.put(patch.getId(), patch);
|
||||
}
|
||||
// construct a list of executed patches by ID
|
||||
Map<String, AppliedPatch> appliedPatchesById = new HashMap<String, AppliedPatch>(23);
|
||||
List<AppliedPatch> appliedPatches = patchDaoService.getAppliedPatches();
|
||||
for (AppliedPatch appliedPatch : appliedPatches)
|
||||
{
|
||||
appliedPatchesById.put(appliedPatch.getId(), appliedPatch);
|
||||
}
|
||||
// go through all the patches and apply them where necessary
|
||||
boolean success = true;
|
||||
for (Patch patch : allPatchesById.values())
|
||||
|
||||
try
|
||||
{
|
||||
// apply the patch
|
||||
success = applyPatchAndDependencies(patch, appliedPatchesById);
|
||||
if (!success)
|
||||
// Diable rules whilst processing the patches
|
||||
this.ruleService.disableRules();
|
||||
try
|
||||
{
|
||||
// construct a map of all known patches by ID
|
||||
Map<String, Patch> allPatchesById = new HashMap<String, Patch>(23);
|
||||
for (Patch patch : patches)
|
||||
{
|
||||
// we failed to apply a patch or one of its dependencies - terminate
|
||||
break;
|
||||
allPatchesById.put(patch.getId(), patch);
|
||||
}
|
||||
// construct a list of executed patches by ID
|
||||
Map<String, AppliedPatch> appliedPatchesById = new HashMap<String, AppliedPatch>(23);
|
||||
List<AppliedPatch> appliedPatches = patchDaoService.getAppliedPatches();
|
||||
for (AppliedPatch appliedPatch : appliedPatches)
|
||||
{
|
||||
appliedPatchesById.put(appliedPatch.getId(), appliedPatch);
|
||||
}
|
||||
|
||||
// go through all the patches and apply them where necessary
|
||||
for (Patch patch : allPatchesById.values())
|
||||
{
|
||||
// apply the patch
|
||||
success = applyPatchAndDependencies(patch, appliedPatchesById);
|
||||
if (!success)
|
||||
{
|
||||
// we failed to apply a patch or one of its dependencies - terminate
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.ruleService.enableRules();
|
||||
}
|
||||
}
|
||||
catch (Throwable exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
// done
|
||||
return success;
|
||||
}
|
||||
|
Reference in New Issue
Block a user