Class AbstractPatchesSystemSetup

  • Direct Known Subclasses:
    PatchesDemoSystemSetup

    public abstract class AbstractPatchesSystemSetup
    extends java.lang.Object
    Abstract system setup class that offers methods for creating system setup parameters and checking configuration.
    • Constructor Detail

      • AbstractPatchesSystemSetup

        public AbstractPatchesSystemSetup()
    • 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 with false boolean value.
        Parameters:
        key - key for system setup parameter
        label - label for system setup parameter
        Returns:
        SystemSetupParameter with one value
      • createSystemSetupParameterBasedOnNotSelectedProperty

        protected SystemSetupParameter createSystemSetupParameterBasedOnNotSelectedProperty​(Patch patch)
        Helper method for creating a Boolean system setup parameter based on
         patches.<patchId>.notSelected
         

        property. If this property is set to true - parameter has default value false with possibility to change it to true, if property is not specified or has false value assigned - parameter has default value true with possibility to change it to false.

        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 parameter
        label - label for system setup parameter
        defaultValue - default true/false value for system setup parameter
        Returns:
        SystemSetupParameter with one value
      • executePatchBasedOnNotSelectedProperty

        protected void executePatchBasedOnNotSelectedProperty​(SystemSetup.Type type,
                                                              Patch patch)
        Helper method for executing Patch based on
         patches.<patchId>.notSelected
         

        property. If this property is set to true - patch won't be executed, if property is not specified or has false value assigned - patch will be executed.

        Parameters:
        type - SystemSetup.Type
        patch - 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 returns null.
        Parameters:
        context - SystemSetupContext
        key - key used as a parameter suffix
        Returns:
        true if parameter is set to Yes, false if parameter is set to No, null if 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 created
        rerunableEnabled - if rerunable functionality is enabled
        Returns:
        SystemSetupParameter with proper value
      • isPatchHidden

        protected boolean isPatchHidden​(java.lang.String patchId)
        Checks configuration for hidden Patch. If
         patches.<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:
        true if patch should be hidden, false otherwise
      • isPatchNotSelected

        protected boolean isPatchNotSelected​(java.lang.String patchId)
        Checks configuration for not selected Patch. If
         patches.<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:
        true if patch should not be selected, false otherwise
      • isPatchSelected

        protected boolean isPatchSelected​(java.lang.String patchId)
        Checks configuration for not selected Patch. If
         patches.<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:
        true if patch should not be selected, false otherwise
      • isPatchRerunableFunctionalityEnabled

        protected boolean isPatchRerunableFunctionalityEnabled()
        Checks configuration for rerunable Patches. If
         patches.allow.rerun.patches
         

        property is set to true returned is true. If it's not specified, default value is taken: false.

        Returns:
        true if patches can be executed again, false otherwise
      • isPatchRerunable

        protected boolean isPatchRerunable​(Patch patch)
        Checks if specified patch is re runnable. Checked is
         patches.allow.rerun.patches
         

        property or if Patch implements Rerunnable interface .

        Parameters:
        patch - Patch
        Returns:
        true if patch can be executed again, false otherwise
      • 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:
        true if value for given propertyKey equals true, false if value is false, otherwise null
      • 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 - SystemSetupContext
        type - 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.Type
        isInit - true if 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.Type
        patch - Patch
        isInit - true if 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.Type
        patch - 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)