diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml index 7ca1fc7bab..6d4c60152e 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml @@ -46,6 +46,7 @@ + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml index f185ab5b08..985a809082 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml @@ -13,7 +13,6 @@ - @@ -29,7 +28,6 @@ - @@ -43,7 +41,6 @@ - @@ -61,7 +58,6 @@ - diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml index e1ba23b776..aa0a740c59 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml @@ -12,8 +12,7 @@ - - + @@ -31,8 +30,7 @@ - - + @@ -48,8 +46,7 @@ - - + @@ -62,8 +59,7 @@ - - + @@ -78,8 +74,7 @@ - - + @@ -92,8 +87,7 @@ - - + @@ -105,8 +99,7 @@ - - + diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java index 7b4a54abf4..89809db25c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java @@ -27,10 +27,17 @@ package org.alfresco.module.org_alfresco_module_rm.patch.compatibility; +import java.io.Serializable; + import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuterImpl; +import org.alfresco.repo.admin.registry.RegistryKey; +import org.alfresco.repo.admin.registry.RegistryService; import org.alfresco.repo.module.AbstractModuleComponent; +import org.alfresco.repo.module.ModuleComponentHelper; +import org.alfresco.repo.module.ModuleVersionNumber; import org.alfresco.repo.policy.BehaviourFilter; import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.service.cmr.module.ModuleDetails; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -44,6 +51,10 @@ import org.apache.commons.logging.LogFactory; @Deprecated public abstract class ModulePatchComponent extends AbstractModuleComponent { + private static final String REGISTRY_PATH_MODULES = "modules"; + private static final String REGISTRY_PROPERTY_INSTALLED_VERSION = "installedVersion"; + private static final String REGISTRY_PROPERTY_CURRENT_VERSION = "currentVersion"; + /** logger */ protected static final Log LOGGER = LogFactory.getLog(ModulePatchComponent.class); @@ -80,6 +91,14 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent this.modulePatchExecuter = modulePatchExecuter; } + /** + * @param registryService Registry service + */ + protected RegistryService registryService; + public void setRegistryService(RegistryService registryService) { + this.registryService = registryService; + } + /** * Init method */ @@ -96,6 +115,28 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent @Override protected void executeInternal() { + String moduleId = modulePatchExecuter.getModuleId(); + + RegistryKey moduleKeyInstalledVersion = new RegistryKey(ModuleComponentHelper.URI_MODULES_1_0, + new String[]{REGISTRY_PATH_MODULES, moduleId, REGISTRY_PROPERTY_INSTALLED_VERSION}); + Serializable moduleInstalledVersion = this.registryService.getProperty(moduleKeyInstalledVersion); + ModuleVersionNumber moduleInstalledVersionNumber = new ModuleVersionNumber(moduleInstalledVersion.toString()); + + RegistryKey moduleKeyCurrentVersion = new RegistryKey(ModuleComponentHelper.URI_MODULES_1_0, + new String[]{REGISTRY_PATH_MODULES, moduleId, REGISTRY_PROPERTY_CURRENT_VERSION}); + Serializable moduleCurrentVersion = this.registryService.getProperty(moduleKeyCurrentVersion); + ModuleVersionNumber moduleCurrentVersionNumber = new ModuleVersionNumber(moduleInstalledVersion.toString()); + + ModuleDetails moduleDetails = moduleService.getModule(moduleId); + ModuleVersionNumber moduleNewVersion = moduleDetails.getModuleVersionNumber(); + + LOGGER.debug("******************************************************************"); + LOGGER.debug(" moduleCurrentVersion : " + moduleCurrentVersion.toString()); + LOGGER.debug(" versionNumber: " + moduleCurrentVersionNumber.toString()); + LOGGER.debug(" moduleInstalledVersion: " + moduleInstalledVersion.toString()); + LOGGER.debug(" versionNumber: " + moduleInstalledVersionNumber.toString()); + LOGGER.debug(" moduleNewVersionNumber: " + moduleNewVersion.toString()); + try { if (LOGGER.isInfoEnabled())