Package io.wcm.devops.conga.model.role
Class RoleFile
java.lang.Object
io.wcm.devops.conga.model.shared.AbstractModel
io.wcm.devops.conga.model.role.RoleFile
- All Implemented Interfaces:
Serializable
Defines a file to be generated or downloaded for a role.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRole file variant with metadata. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDefines a charset to be used for the generated file.Defines a condition whether the file should be generated or not.getDir()Sets the directory to generate or download the file in.Defines an handlebars escaping strategy plugin to be used.getFile()Defines the file name of the generated or downloaded file.Defines the name of a file header plugin that should be applied to the generated file.Defines the line endings style for the generated files.Defines additional options that are written to the exported model metadata for this file.Defines a multiply plugin name to be used.Defines configuration parameters that are passed as options to the multiply plugin.Defines configuration parameters that are passed as options to the post processor plugins.Defines a list of post processor plugin names that should be applied to the generated file.Target path for symlink.Defines the template name to be used to generate the file.getUrl()URL to download file from.Defines configuration parameters that are passed as options to the validator plugins.Defines a list of validator plugin names that should be applied to the generated file.Defines the role variant names for which this file should be generated.Gets variant metadata.booleanWhether to delete the the source file that was copied with this file definition.voidsetCharset(String charset) Sets charset.voidsetCondition(String condition) Sets condition.voidsetDeleteSource(boolean deleteSource) Sets delete source flag.voidSets directory.voidsetEscapingStrategy(String escapingStrategy) Sets escaping strategy plugin name.voidSets file name.voidsetFileHeader(String fileHeader) Sets file header plugin name.voidsetLineEndings(LineEndings lineEndings) Sets line endings style.voidsetModelOptions(Map<String, Object> modelOptions) Sets model options.voidsetMultiply(String multiply) Sets multiply plugin name.voidsetMultiplyOptions(Map<String, Object> multiplyOptions) Sets multiply options.voidsetPostProcessorOptions(Map<String, Object> postProcessorOptions) Sets post processor options.voidsetPostProcessors(List<String> postProcessors) Sets post processor plugin names.voidsetSymlinkTarget(String symlinkTarget) Sets symlink target.voidsetTemplate(String template) Sets template name.voidSets download URL.voidsetValidatorOptions(Map<String, Object> validatorOptions) Sets validator options.voidsetValidators(List<String> validators) Sets validator plugin names.voidsetVariants(List<String> variants) Sets role variant names.Methods inherited from class io.wcm.devops.conga.model.shared.AbstractModel
toString
-
Constructor Details
-
RoleFile
public RoleFile()
-
-
Method Details
-
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
Sets file name.- Parameters:
name- File name
-
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
Sets directory.- Parameters:
dir- Directory name
-
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
Sets template name.- Parameters:
template- Template file name
-
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
Sets download URL.- Parameters:
url- Download URL
-
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
Sets symlink target.- Parameters:
symlinkTarget- Symlink target
-
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
Sets role variant names.- Parameters:
variants- List of role variant names
-
getVariantsMetadata
Gets variant metadata.- Returns:
- List of variants with metadata ("*" suffix is parsed)
-
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
Sets condition.- Parameters:
condition- Condition expression
-
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
Sets file header plugin name.- Parameters:
fileHeader- File header plugin name
-
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
Sets validator plugin names.- Parameters:
validators- List of validator plugin names
-
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
Sets validator options.- Parameters:
validatorOptions- Configuration parameters
-
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
Sets post processor plugin names.- Parameters:
postProcessors- List of post processor plugin names
-
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
Sets post processor options.- Parameters:
postProcessorOptions- Configuration parameters
-
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
Sets multiply plugin name.- Parameters:
multiply- Multiply plugin name
-
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
Sets multiply options.- Parameters:
multiplyOptions- Configuration parameters
-
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
Sets charset.- Parameters:
charset- Charset name
-
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
-
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
Sets escaping strategy plugin name.- Parameters:
escapingStrategy- Handlebars escaping strategy plugin name
-
getModelOptions
Defines additional options that are written to the exported model metadata for this file.- Returns:
- Model options
-
setModelOptions
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
-