JavaScript is disabled on your browser.
# demo-options
#using module h:\psec\flows\run-gael\setup-run-gael.psm1;
#using module h:\psec\lib\lib-setup-run-gael.psm1;
set-strictmode -version 2.0
function defineFlowTask([Flow]$flow,[Task]$task) {
#--- define
$def = new-module -asCustomObject -scriptBlock {
function fetchJavaMain([Object]$task,[hashtable]$parms) {
return 'org.srp.psec.TestArgsPsec'
}
<#.md
.example copying context values into description
.exkeys context
.desc
The description will pick up and display the current context values for `cycleNo` and `month
#>
function getTaskDesc([Task]$task) {
$tfs = $task.tfs;
[string]$desc = @"
This illustrates options capability of the PSEC workflow subsystem.`r`n
Current Values: cycleNo=$($tfs.globMap.demoGlobs.cycleNo) month=$($tfs.globMap.demoGlobs.month)`r`n
"@
return $desc;
}
<#
Fetch classpath setup during Workflow setup.
#>
function fetchJavaClassStr([Object]$task,[hashtable]$parms) {
$tfs = $task.tfs;
return $($tfs.globMap.demoGlobs.javaLib);
}
# ---------- define task parameters
<#
The $htOpts parms has the processed options. It can be modified or used to do
other changes to the setup.
#>
function params([Object]$task,[hashtable]$htOpts) {
#$tfs = $task.tfs;
$date = Get-Date
[string]$dateStr = $date.ToString("yyyyMMdd")
$htOpts.datestr = $dateStr;
$htOpts.brief = "$($task.statlocn)"
return $htOpts
}
# ---------- define task options
<#.md
.example multiple option types`
.exkeys input check radio combo
.desc
Illustrates the code required to implement the various type of input options supported by *PSEC*
This runs before the *params* function and the results are passed to it.
#>
function options([Task]$task) {
$opts = @();
#$tfs = $task.tfs;
$opts += @{type='input'; parm='gen'; label='Gen'; place='number of lines to generate'; regex='^[0-9]+$'}
$opts += @{type='input'; parm='genstr'; label='GenStr'; place='string to generate'}
$opts += @{type='check'; parm='bool1'; label='Bool1'; place='turns on bool1 option when checked'}
$opts += @{type='check'; parm='boolFail'; label='BoolFail'; place='turns on boolFail option when checked'}
$opts += @{type='radio'; parm='trap'; label='Trap'; valset='*/*no trap,fail/gen FAIL,trap/gen TRAP'}
$opts += @{type='combo'; parm='combo'; label='Combo'; valset='*/*--none--,green,red/show red,blue/set blue'}
$opts += @{type='file'; parm='fileInput'; label='Input'; place='Demo File Input'}
$opts += @{type='dir'; parm='becuDir'; label='BecuDir'; place='Base becu folder'}
return ,$opts
}
Export-ModuleMember -Variable * -Function *
}
hlog("defineFlowTask $flow $task")
return $def;
}