Class AbstractPatchesSystemSetup
- java.lang.Object
-
- de.hybris.platform.patches.AbstractPatchesSystemSetup
-
- Direct Known Subclasses:
PatchesDemoSystemSetup
public abstract class AbstractPatchesSystemSetup extends java.lang.ObjectAbstract system setup class that offers methods for creating system setup parameters and checking configuration.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringBOOLEAN_FALSEprotected static java.lang.StringBOOLEAN_TRUE
-
Constructor Summary
Constructors Constructor Description AbstractPatchesSystemSetup()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SystemSetupParametercreateBooleanSystemSetupParameter(java.lang.String key, java.lang.String label, boolean defaultValue)Helper method for creating a Boolean setup parameter.protected voidcreateEssentialData(SystemSetupContext setupContext)Method to create initial objects which will be called by system creator during initialization and system update.protected SystemSetupParametercreateFalseBooleanValueSystemSetupParameter(java.lang.String key, java.lang.String label)Helper method for creating a system setup parameter withfalseboolean value.protected voidcreateProjectData(SystemSetupContext setupContext)Method to create data that is used in your project.protected SystemSetupParametercreateSystemSetupParameterBasedOnExecutionInfo(Patch patch, boolean rerunableEnabled)Helper method for creating a system setup parameter for Update process type based on rerunable functionality.protected SystemSetupParametercreateSystemSetupParameterBasedOnNotSelectedProperty(Patch patch)Helper method for creating a Boolean system setup parameter based onprotected voidexecutePatchBasedOnConfiguration(SystemSetup.Type type, Patch patch, boolean isInit)Method executes Patches based on configuration from Properties.protected voidexecutePatchBasedOnDataType(SystemSetup.Type type, Patch patch)Method executes Patches based on data type (ESSENTIAL/PROJECT).protected voidexecutePatchBasedOnNotSelectedProperty(SystemSetup.Type type, Patch patch)Helper method for executing Patch based onprotected voidexecutePatches(SystemSetupContext setupContext, SystemSetup.Type type)Based on executionType kept in JaloSession different execution Patch method is called.protected voidexecutePatchesBasedOnConfiguration(SystemSetup.Type type, boolean isInit)Method iterates through list of Patches and for each executes checking Patch configuration based on properties.protected voidexecutePatchesBasedOnSetupContext(SystemSetupContext setupContext, SystemSetup.Type type)Method iterates through list of Patches and executes these which were setup inSystemSetupContext.protected voidexecuteVersionOnPatch(Patch patch)This method executes given Patch with given version.protected java.lang.BooleangetBooleanValueForGivenKey(java.lang.String propertyKey)Checks configuration specified in properties file for given propertyKey.java.util.List<SystemSetupParameter>getInitializationOptions()Iterates through list of patches which is configured in spring.protected java.lang.BooleangetSystemSetupParameter(SystemSetupContext context, java.lang.String key)Checks setting of a Boolean setup parameter taken from context.protected booleanisPatchHidden(java.lang.String patchId)Checks configuration for hidden Patch.protected booleanisPatchNotSelected(java.lang.String patchId)Checks configuration for not selected Patch.protected booleanisPatchRerunable(Patch patch)Checks if specified patch is re runnable.protected booleanisPatchRerunableFunctionalityEnabled()Checks configuration for rerunable Patches.protected booleanisPatchSelected(java.lang.String patchId)Checks configuration for not selected Patch.voidsetPatches(java.util.List<Patch> patches)voidsetPatchExecutionService(PatchExecutionService patchExecutionService)
-
-
-
Field Detail
-
BOOLEAN_TRUE
protected static final java.lang.String BOOLEAN_TRUE
- See Also:
- Constant Field Values
-
BOOLEAN_FALSE
protected static final java.lang.String BOOLEAN_FALSE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInitializationOptions
public java.util.List<SystemSetupParameter> getInitializationOptions()
Iterates through list of patches which is configured in spring. Checks configuration for each Patch and based on it creates system setup parameter with default value.- Returns:
List<SystemSetupParameter>which should be visible in hac console
-
createEssentialData
protected void createEssentialData(SystemSetupContext setupContext)
Method to create initial objects which will be called by system creator during initialization and system update. It sets jsp context as a ThreadLocal variable (it is needed for logging data in hac console) and removes after all Patches are executed.- Parameters:
setupContext- the context provides the selected parameters and values
-
createProjectData
protected void createProjectData(SystemSetupContext setupContext)
Method to create data that is used in your project. This method will be called during the system initialization and system update. It sets jsp context as a ThreadLocal variable (it is needed for logging data in hac console) and removes after all Patches are executed.- Parameters:
setupContext- the context provides the selected parameters and values
-
createFalseBooleanValueSystemSetupParameter
protected SystemSetupParameter createFalseBooleanValueSystemSetupParameter(java.lang.String key, java.lang.String label)
Helper method for creating a system setup parameter withfalseboolean value.- Parameters:
key- key for system setup parameterlabel- label for system setup parameter- Returns:
SystemSetupParameterwith one value
-
createSystemSetupParameterBasedOnNotSelectedProperty
protected SystemSetupParameter createSystemSetupParameterBasedOnNotSelectedProperty(Patch patch)
Helper method for creating a Boolean system setup parameter based onpatches.<patchId>.notSelected
property. If this property is set to true - parameter has default value
falsewith possibility to change it totrue, if property is not specified or hasfalsevalue assigned - parameter has default valuetruewith possibility to change it tofalse.- Parameters:
patch-Patch- Returns:
SystemSetupParameter
-
createBooleanSystemSetupParameter
protected SystemSetupParameter createBooleanSystemSetupParameter(java.lang.String key, java.lang.String label, boolean defaultValue)
Helper method for creating a Boolean setup parameter.- Parameters:
key- key for system setup parameterlabel- label for system setup parameterdefaultValue- default true/false value for system setup parameter- Returns:
SystemSetupParameterwith one value
-
executePatchBasedOnNotSelectedProperty
protected void executePatchBasedOnNotSelectedProperty(SystemSetup.Type type, Patch patch)
Helper method for executing Patch based onpatches.<patchId>.notSelected
property. If this property is set to true - patch won't be executed, if property is not specified or has
falsevalue assigned - patch will be executed.- Parameters:
type-SystemSetup.Typepatch-Patch
-
getSystemSetupParameter
protected java.lang.Boolean getSystemSetupParameter(SystemSetupContext context, java.lang.String key)
Checks setting of a Boolean setup parameter taken from context. If there is no information about Patch in context method returnsnull.- Parameters:
context-SystemSetupContextkey- key used as a parameter suffix- Returns:
trueif parameter is set to Yes,falseif parameter is set to No,nullif there is no information about Patch
-
createSystemSetupParameterBasedOnExecutionInfo
protected SystemSetupParameter createSystemSetupParameterBasedOnExecutionInfo(Patch patch, boolean rerunableEnabled)
Helper method for creating a system setup parameter for Update process type based on rerunable functionality.- Parameters:
patch- for which setup should be createdrerunableEnabled- if rerunable functionality is enabled- Returns:
SystemSetupParameterwith proper value
-
isPatchHidden
protected boolean isPatchHidden(java.lang.String patchId)
Checks configuration for hidden Patch. Ifpatches.<patchId>.hide
property is not specified, value of property
patches.hideAll
is checked. If it's also not specified, default value is returned:
false.- Parameters:
patchId- id of the patch- Returns:
trueif patch should be hidden,falseotherwise
-
isPatchNotSelected
protected boolean isPatchNotSelected(java.lang.String patchId)
Checks configuration for not selected Patch. Ifpatches.<patchId>.notSelected
property is set to true returned is
true. If it's not specified, default value is taken:false.- Parameters:
patchId- id of the patch- Returns:
trueif patch should not be selected,falseotherwise
-
isPatchSelected
protected boolean isPatchSelected(java.lang.String patchId)
Checks configuration for not selected Patch. Ifpatches.<patchId>.notSelected
property is set to false returned is
true. If it's not specified, default value is taken:false.- Parameters:
patchId- id of the patch- Returns:
trueif patch should not be selected,falseotherwise
-
isPatchRerunableFunctionalityEnabled
protected boolean isPatchRerunableFunctionalityEnabled()
Checks configuration for rerunable Patches. Ifpatches.allow.rerun.patches
property is set to true returned is
true. If it's not specified, default value is taken:false.- Returns:
trueif patches can be executed again,falseotherwise
-
isPatchRerunable
protected boolean isPatchRerunable(Patch patch)
Checks if specified patch is re runnable. Checked ispatches.allow.rerun.patches
property or if Patch implements
Rerunnableinterface .- Parameters:
patch-Patch- Returns:
trueif patch can be executed again,falseotherwise
-
getBooleanValueForGivenKey
protected java.lang.Boolean getBooleanValueForGivenKey(java.lang.String propertyKey)
Checks configuration specified in properties file for given propertyKey.- Parameters:
propertyKey- property key used in configuration file- Returns:
trueif value for given propertyKey equalstrue,falseif value isfalse, otherwisenull
-
executePatches
protected void executePatches(SystemSetupContext setupContext, SystemSetup.Type type)
Based on executionType kept in JaloSession different execution Patch method is called. For HAC execution depends on SystemSetupContext, for ANT: on Configuration from Properties. Handles major exceptions and logs them in patch execution and console. Handled exception is thrown further to stop init/update process. Stack trace is logged by platform mechanism.- Parameters:
setupContext-SystemSetupContexttype-SystemSetup.Type
-
executePatchesBasedOnSetupContext
protected void executePatchesBasedOnSetupContext(SystemSetupContext setupContext, SystemSetup.Type type)
Method iterates through list of Patches and executes these which were setup inSystemSetupContext. If no information about Patch is in context and Patch is hidden checked is configuration based on properties.- Parameters:
setupContext-SystemSetupContexttype-SystemSetup.Type
-
executePatchesBasedOnConfiguration
protected void executePatchesBasedOnConfiguration(SystemSetup.Type type, boolean isInit)
Method iterates through list of Patches and for each executes checking Patch configuration based on properties.- Parameters:
type-SystemSetup.TypeisInit-trueif current processType is Init, otherwise (update)false
-
executePatchBasedOnConfiguration
protected void executePatchBasedOnConfiguration(SystemSetup.Type type, Patch patch, boolean isInit)
Method executes Patches based on configuration from Properties.- Parameters:
type-SystemSetup.Typepatch-PatchisInit-trueif current processType is Init, otherwise (update)false
-
executePatchBasedOnDataType
protected void executePatchBasedOnDataType(SystemSetup.Type type, Patch patch)
Method executes Patches based on data type (ESSENTIAL/PROJECT).- Parameters:
type-SystemSetup.Typepatch-Patch
-
executeVersionOnPatch
protected void executeVersionOnPatch(Patch patch)
This method executes given Patch with given version. It also means that if given Patch introduced new version comparing to previous one, all previous patches will be executed with this new version (or versions).- Parameters:
patch-Patch
-
setPatches
public void setPatches(java.util.List<Patch> patches)
-
setPatchExecutionService
public void setPatchExecutionService(PatchExecutionService patchExecutionService)
-
-