Class AbstractUpgradeOperation

java.lang.Object
org.craftercms.commons.upgrade.impl.operations.AbstractUpgradeOperation<String>
org.craftercms.studio.impl.v2.upgrade.operations.AbstractUpgradeOperation
All Implemented Interfaces:
org.craftercms.commons.upgrade.UpgradeOperation<String>, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware
Direct Known Subclasses:
AbstractContentUpgradeOperation, AbstractPluginDescriptorUpgradeOperation, AbstractXsltFileUpgradeOperation, AddFileUpgradeOperation, AddSiteUuidOperation, BlueprintsUpgradeOperation, DbEncryptionUpgradeOperation, DbScriptUpgradeOperation, DeleteUpgradeOperation, GlobalRepoUpgradeOperation, RenameUpgradeOperation

public abstract class AbstractUpgradeOperation extends org.craftercms.commons.upgrade.impl.operations.AbstractUpgradeOperation<String> implements org.springframework.web.context.ServletContextAware
Provides access to system components for all upgrade operations.

Supported YAML properties:

  • currentVersion: (required) the version number that will be upgraded
  • nextVersion (required) the version number to use after the upgrade
  • commitDetails(optional) any additional details to include in the commits if there are repository changes
Author:
joseross
  • Field Details

    • CONFIG_KEY_COMMIT_DETAILS

      public static final String CONFIG_KEY_COMMIT_DETAILS
      See Also:
    • changedFiles

      protected List<String> changedFiles
    • deletedFiles

      protected List<String> deletedFiles
    • commitDetails

      protected String commitDetails
      Additional details for the commit message (optional)
    • studioConfiguration

      protected StudioConfiguration studioConfiguration
      The Studio configuration.
    • servletContext

      protected jakarta.servlet.ServletContext servletContext
      The servlet context.
  • Constructor Details

  • Method Details

    • setServletContext

      public void setServletContext(jakarta.servlet.ServletContext servletContext)
      Specified by:
      setServletContext in interface org.springframework.web.context.ServletContextAware
    • init

      public void init(String sourceVersion, String targetVersion, org.apache.commons.configuration2.HierarchicalConfiguration config) throws org.craftercms.commons.config.ConfigurationException
      Specified by:
      init in interface org.craftercms.commons.upgrade.UpgradeOperation<String>
      Overrides:
      init in class org.craftercms.commons.upgrade.impl.operations.AbstractUpgradeOperation<String>
      Throws:
      org.craftercms.commons.config.ConfigurationException
    • doExecute

      protected void doExecute(org.craftercms.commons.upgrade.impl.UpgradeContext<String> context) throws Exception
      Specified by:
      doExecute in class org.craftercms.commons.upgrade.impl.operations.AbstractUpgradeOperation<String>
      Throws:
      Exception
    • doExecute

      protected abstract void doExecute(StudioUpgradeContext context) throws Exception
      Throws:
      Exception
    • getCommitMessage

      protected String getCommitMessage()
    • loadResource

      protected org.springframework.core.io.Resource loadResource(String path)
      Overrides:
      loadResource in class org.craftercms.commons.upgrade.impl.operations.AbstractUpgradeOperation<String>
    • trackChangedFiles

      protected void trackChangedFiles(String... files)
    • trackDeletedFiles

      protected void trackDeletedFiles(String... files)
    • commitAllChanges

      protected void commitAllChanges(StudioUpgradeContext context) throws Exception
      Throws:
      Exception