Class DuplicateThemeHandler

All Implemented Interfaces:
JcmsConstants, JaliosConstants

public class DuplicateThemeHandler extends JcmsFormHandler
Handler responsible for duplicating an existing UITheme.

This handler retrieves a source theme, validates duplication parameters, and creates a new UITheme instance based on the original one with updated metadata (name, description, thumbnail, creator).

The duplication process is triggered when the opDuplicate flag is set. The handler performs validation before creating the duplicated theme and persists it using Data.checkAndPerformCreate(Member).

On success, the handler sets a redirect URL in the request attribute modal.redirect pointing to the newly created theme display page.

  • Field Details

    • fromTheme

      protected UITheme fromTheme
      Source theme to duplicate.
    • duplicateTheme

      protected UITheme duplicateTheme
      Newly created duplicated theme.
    • id

      protected String id
      Identifier of the source theme.
    • description

      protected String description
      Description of the duplicated theme.
    • descriptionML

      protected HashMap<String,String> descriptionML
    • thumbnail

      protected String thumbnail
      Thumbnail URL or reference for the duplicated theme.
    • name

      protected String name
      Name of the duplicated theme.
    • creator

      protected String creator
      Creator metadata for the duplicated theme.
    • opDuplicate

      protected boolean opDuplicate
      Operation flag indicating that the duplication action was requested.
  • Constructor Details

    • DuplicateThemeHandler

      public DuplicateThemeHandler()
  • Method Details

    • processAction

      public boolean processAction()
      Processes the duplication request.

      Validates the duplication parameters and, if valid, performs the duplication.

      Overrides:
      processAction in class JcmsFormHandler
      Returns:
      true if the duplication was successfully performed, false otherwise
    • isOpDuplicate

      public boolean isOpDuplicate()
      Indicates whether the duplication operation has been requested.
      Returns:
      true if duplication should be executed
    • setOpDuplicate

      public void setOpDuplicate(boolean opDuplicate)
      Sets the duplication operation flag.
      Parameters:
      opDuplicate - true to trigger duplication
    • getId

      public String getId()
      Returns the identifier of the source theme.
      Returns:
      the source theme identifier
    • setId

      public void setId(String id)
      Sets the identifier of the source theme and loads the corresponding theme.
      Parameters:
      id - the theme identifier
    • getAvailableDescription

      public String getAvailableDescription()
      Returns the effective description used during duplication.

      If the field was not explicitly provided, the source theme description is used.

      Returns:
      the available description
    • setDescription

      public void setDescription(String[] v)
    • getAvailableDescriptionML

      public HashMap<String,String> getAvailableDescriptionML()
    • getAllAvailableDescriptionML

      public HashMap<String,String> getAllAvailableDescriptionML()
    • getThumbnail

      public String getThumbnail()
      Returns the thumbnail associated with the duplicated theme.
      Returns:
      the thumbnail reference
    • setThumbnail

      public void setThumbnail(String thumbnail)
      Sets the thumbnail for the duplicated theme.
      Parameters:
      thumbnail - the thumbnail reference
    • getAvailableThumbnail

      public String getAvailableThumbnail()
      Returns the effective thumbnail used during duplication.
      Returns:
      the available thumbnail
    • getName

      public String getName()
      Returns the name of the duplicated theme.
      Returns:
      the theme name
    • setName

      public void setName(String name)
      Sets the name of the duplicated theme.
      Parameters:
      name - the theme name
    • getAvailableName

      public String getAvailableName()
      Returns the effective theme name used during duplication.

      If no name was explicitly provided, a default copy name is generated.

      Returns:
      the available theme name
    • getCreator

      public String getCreator()
      Returns the creator metadata of the duplicated theme.
      Returns:
      the creator
    • setCreator

      public void setCreator(String creator)
      Sets the creator metadata for the duplicated theme.
      Parameters:
      creator - the creator
    • getAvailableCreator

      public String getAvailableCreator()
      Returns the effective creator used during duplication.
      Returns:
      the available creator
    • getFromTheme

      public UITheme getFromTheme()
      Returns the source theme used for duplication.
      Returns:
      the original UITheme
    • setTheme

      public void setTheme(UITheme fromTheme)
      Sets the source theme to duplicate.
      Parameters:
      fromTheme - the source theme
    • getAvailableTheme

      public UITheme getAvailableTheme()
      Returns the theme currently available for duplication.
      Returns:
      the source theme