Class RoleFile

java.lang.Object
io.wcm.devops.conga.model.shared.AbstractModel
io.wcm.devops.conga.model.role.RoleFile
All Implemented Interfaces:
Serializable

public final class RoleFile extends AbstractModel
Defines a file to be generated or downloaded for a role.
See Also:
  • Constructor Details

    • RoleFile

      public RoleFile()
  • Method Details

    • getFile

      public String getFile()
      Defines the file name of the generated or downloaded file. Variable placeholders can be used to reference variables or context properties, e.g. ${tenant} for the current tenant name if a tenant multiply plugin is used.
      Returns:
      File name
    • setFile

      public void setFile(String name)
      Sets file name.
      Parameters:
      name - File name
    • getDir

      public String getDir()
      Sets the directory to generate or download the file in. The directory name is relative to the configuration target directory of the node. Variable placeholders can be used to reference variables or context properties, e.g. ${tenant} for the current tenant name if a tenant multiply plugin is used.
      Returns:
      Directory name
    • setDir

      public void setDir(String dir)
      Sets directory.
      Parameters:
      dir - Directory name
    • getTemplate

      public String getTemplate()
      Defines the template name to be used to generate the file. The template file should have an ".hbs" extension. The file name is resolved relative to the template directory of the role.
      Returns:
      Template file name
    • setTemplate

      public void setTemplate(String template)
      Sets template name.
      Parameters:
      template - Template file name
    • getUrl

      public String getUrl()
      URL to download file from. If a URL is defined the template is ignored, and the target file property optional. If no file property is defined, the file name of the downloaded file is used. For URL protocols you can use http://, https://, classpath:// file:// or mvn://.
      Returns:
      Download URL
    • setUrl

      public void setUrl(String url)
      Sets download URL.
      Parameters:
      url - Download URL
    • getSymlinkTarget

      public String getSymlinkTarget()
      Target path for symlink. If a symlink target is defined, no file is generated or downloaded, but a symlink is created in the file system pointing to the given target. The target has to point to another file generated or downloaded by CONGA.
      Returns:
      Symlink target
    • setSymlinkTarget

      public void setSymlinkTarget(String symlinkTarget)
      Sets symlink target.
      Parameters:
      symlinkTarget - Symlink target
    • getVariants

      public List<String> getVariants()
      Defines the role variant names for which this file should be generated. If no names are defined the file is generated for all role variants. If the node/role has multiple variants, the file is generated if at least one variant from the file definition matches with at least one variant from the role/file ("or"). If the variant name is suffixed with a "*" this variant has to be matched ("and"). The "*" is not part of the variant name.
      Returns:
      List of role variant names
    • setVariants

      public void setVariants(List<String> variants)
      Sets role variant names.
      Parameters:
      variants - List of role variant names
    • getVariantsMetadata

      public List<RoleFile.RoleFileVariantMetadata> getVariantsMetadata()
      Gets variant metadata.
      Returns:
      List of variants with metadata ("*" suffix is parsed)
    • getCondition

      public String getCondition()
      Defines a condition whether the file should be generated or not. The condition contains one single variable placeholder reference, e.g. ${myvar}. The condition is true if the resulting string of the variable is not empty and does not match "false".
      Returns:
      Condition expression
    • setCondition

      public void setCondition(String condition)
      Sets condition.
      Parameters:
      condition - Condition expression
    • getFileHeader

      public String getFileHeader()
      Defines the name of a file header plugin that should be applied to the generated file. If no name is given the best-matching plugin is detected automatically by the file extension. If this is not wished, explicitly setting the property to "none" ensures that no plugin is applied.
      Returns:
      File header plugin name
    • setFileHeader

      public void setFileHeader(String fileHeader)
      Sets file header plugin name.
      Parameters:
      fileHeader - File header plugin name
    • getValidators

      public List<String> getValidators()
      Defines a list of validator plugin names that should be applied to the generated file. If none is given the best-matching plugins are detected automatically by the file extension. If this is not wished, explicitly setting a list entry with "none" ensures that no plugin is applied.
      Returns:
      List of validator plugin names
    • setValidators

      public void setValidators(List<String> validators)
      Sets validator plugin names.
      Parameters:
      validators - List of validator plugin names
    • getValidatorOptions

      public Map<String,Object> getValidatorOptions()
      Defines configuration parameters that are passed as options to the validator plugins. They are merged with the configuration parameters from the configuration inheritance tree.
      Returns:
      Configuration parameters
    • setValidatorOptions

      public void setValidatorOptions(Map<String,Object> validatorOptions)
      Sets validator options.
      Parameters:
      validatorOptions - Configuration parameters
    • getPostProcessors

      public List<String> getPostProcessors()
      Defines a list of post processor plugin names that should be applied to the generated file.
      Returns:
      List of post processor plugin names
    • setPostProcessors

      public void setPostProcessors(List<String> postProcessors)
      Sets post processor plugin names.
      Parameters:
      postProcessors - List of post processor plugin names
    • getPostProcessorOptions

      public Map<String,Object> getPostProcessorOptions()
      Defines configuration parameters that are passed as options to the post processor plugins. They are merged with the configuration parameters from the configuration inheritance tree.

      Two generic parameters are supported for all post processor:

      • postProcessor.fileHeader: Allows to set a file header for the post-processed files (or "none" for no header).
      • postProcessor.validators: Allows to set a list of validators for the post-processed files (or "none" for no validation)
      Returns:
      Configuration parameters
    • setPostProcessorOptions

      public void setPostProcessorOptions(Map<String,Object> postProcessorOptions)
      Sets post processor options.
      Parameters:
      postProcessorOptions - Configuration parameters
    • getMultiply

      public String getMultiply()
      Defines a multiply plugin name to be used. Using a mulitply plugin multiple files are generated instead of a single file, e.g. one per tenant. To ensure each file has a unique file name variables have to be used in the "file" property.
      Returns:
      Multiply plugin name
    • setMultiply

      public void setMultiply(String multiply)
      Sets multiply plugin name.
      Parameters:
      multiply - Multiply plugin name
    • getMultiplyOptions

      public Map<String,Object> getMultiplyOptions()
      Defines configuration parameters that are passed as options to the multiply plugin. They are merged with the configuration parameters from the configuration inheritance tree.
      Returns:
      Configuration parameters
    • setMultiplyOptions

      public void setMultiplyOptions(Map<String,Object> multiplyOptions)
      Sets multiply options.
      Parameters:
      multiplyOptions - Configuration parameters
    • getCharset

      public String getCharset()
      Defines a charset to be used for the generated file. It is expected that the templates is encoded in the same charset. If not set UTF-8 is the default charset.
      Returns:
      Charset name
    • setCharset

      public void setCharset(String charset)
      Sets charset.
      Parameters:
      charset - Charset name
    • getLineEndings

      public LineEndings getLineEndings()
      Defines the line endings style for the generated files. Possible values are 'unix', 'windows' and 'macos'. If not set 'unix' line endings are the default.
      Returns:
      Line endings style
    • setLineEndings

      public void setLineEndings(LineEndings lineEndings)
      Sets line endings style.
      Parameters:
      lineEndings - Line endings style
    • getEscapingStrategy

      public String getEscapingStrategy()
      Defines an handlebars escaping strategy plugin to be used. If no name is given the best-matching plugin is detected automatically by the file extension. If this is not wished, explicitly setting the property to "none" ensures that no plugin is applied.
      Returns:
      Handlebars escaping strategy plugin name.
    • setEscapingStrategy

      public void setEscapingStrategy(String escapingStrategy)
      Sets escaping strategy plugin name.
      Parameters:
      escapingStrategy - Handlebars escaping strategy plugin name
    • getModelOptions

      public Map<String,Object> getModelOptions()
      Defines additional options that are written to the exported model metadata for this file.
      Returns:
      Model options
    • setModelOptions

      public void setModelOptions(Map<String,Object> modelOptions)
      Sets model options.
      Parameters:
      modelOptions - Model options
    • isDeleteSource

      public boolean isDeleteSource()
      Whether to delete the the source file that was copied with this file definition. This can only be applied when a) the file defined was not generated but copied from an url and b) the url file provider supports deleting the source file (e.g. in local file system and not a remote URL).
      Returns:
      true if the source file references by the url should be deleted
    • setDeleteSource

      public void setDeleteSource(boolean deleteSource)
      Sets delete source flag.
      Parameters:
      deleteSource - true if the source file should be deleted