Class ThemeBuilderOverlays

java.lang.Object
org.kuali.rice.krad.theme.ThemeBuilderOverlays

public class ThemeBuilderOverlays extends Object
Helper class for ThemeBuilder that performs the various overlays during the build process

There are three main overlay (copy) processes executed during the theme building:

  1. Copy related assets from web app source to the configured output directory
  2. Overlay assets from a parent theme to a child theme
  3. Perform any additional overlays that are configured in a theme's properties file
Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Constructor Details

    • ThemeBuilderOverlays

      public ThemeBuilderOverlays()
  • Method Details

    • copyAssetsToWorkingDir

      protected static void copyAssetsToWorkingDir(String webappSourceDir, String themeBuilderOutputDir, List<String> additionalThemeDirectories, List<String> additionalPluginDirectories) throws IOException
      Invoked at the beginning of the build process to move assets from the web source directory to the output directory, where they can be further processed

      Note: Not all web resources are copied, just the assets that are needed to build all themes. This includes all the theme directories, plugin directories, and KRAD scripts directory

      Parameters:
      webappSourceDir - absolute path to the web source directory
      themeBuilderOutputDir - absolute path to the target directory, where assets will be copied to and processed. If the directory does not exist it will be created
      additionalThemeDirectories - list of additional theme paths that should be copied to the output directory
      additionalPluginDirectories - list of additional plugin paths that should be copied to the output directory
      Throws:
      IOException
    • overlayParentAssets

      protected static void overlayParentAssets(String themeName, File themeDirectory, Properties themeProperties, Map<String,String> themeNamePathMapping)
      Overlays assets from a parent theme (if there is a parent) to a child theme

      If the given theme has a parent (determined by the parent property in the theme properties), all files from the parent theme directory are copied to the given theme directory unless:

      • A file exists in the child theme directory with the same name and relative path
      • The files has been exluded through the property parentExcludes
      Parameters:
      themeName - name of the theme to be processed
      themeDirectory - directory for the theme (parent assets will be copied here)
      themeProperties - properties for the theme, used to retrieve the parent configuration and the parent excludes
      themeNamePathMapping - mapping of theme names to theme paths, used to find the parent theme directory path
    • overlayAdditionalDirs

      protected static void overlayAdditionalDirs(File themeDirectory, Properties themeProperties, String webappSourceDir, String themeBuilderOutputDir)
      Performs any additional overlays that have been configured for the theme (with the additionalOverlays property)

      Additional overlays can take any directory or file from the web application, and move into the theme directory or one of its subdirectores. This is useful if there are dependencies in script that needs to be moved so they are present for the minified version

      Parameters:
      themeDirectory - directory for the theme where directories will be copied to
      themeProperties - properties for the theme to process, used to pull the additionalOverlays configuration
      webappSourceDir - absolute path to the web source directory, if the source overlay directory is not currently present in the output directory, we need to go back and pull it from source
      themeBuilderOutputDir - absolute path to the output directory, used to pull the source overly directory
    • parseAdditionalOverlaysStr

      protected static Map<String,String> parseAdditionalOverlaysStr(String additionalOverlaysStr)
      Helper method that parses the configuration string for additional overlays into a Map where the key is the source path and the map value is the target path

      Each mapping in the string should be separated by a comma. Within the mapping, the source path should be given, followed by the target path in parenthesis ex. sourcePath(targetPath),sourcePath2(targetPath2)

      Parameters:
      additionalOverlaysStr - string to parse into additional overlay mappings
      Returns:
      map of additional overlay mappings