Understanding Job Input Statements

The AskInputStatement.of(String variable, boolean required, ParameterType inputType [, String description]) method creates a statement that indicates to the web client that a value of the specified input type should be provided by the user when launching the task, and should be stored under the specified variable name in the job memory.

The ParameterType argument provides indications on the type and bounds of the task input to the web client, so that it can assist the user in entering valid input. Note that this is an aid, not a validation tool. This argument can take the following values.

  • JobInputType.BOOLEAN: A Boolean value is expected. The web client will display a checkbox.

  • JobInputType.REAL: A number is expected. The web client will allow any number to be entered, unless one of the following forms is used instead.

    • JobInputType.real(Double min, Double max): The web client will make its best effort to constrain the number entered to be greater than, or equal to, the min value, and lower than, or equal to, the max value. The null value can be provided for either argument, meaning that the corresponding bound is open.

  • JobInputType.INTEGER: The web client will make its best effort to constrain the number entered to be an integer.

    • JobInputType.integer(Long min, Long max): The web client will make its best effort to constrain the number entered to be an integer between the provided bounds, both inclusive. Either can be provided with null to indicate an open bound.

  • JobInputType.TEXT: A text is expected. As for other inputs, whether it can be empty or not is controlled by the required argument to AskInputStatement.of().

  • Temporal data: Input types for dates and times are provided, as follows. If you need a date-time, use two inputs, one of each type.

    • JobInputType.DATE: A date is expected, that is, a day, a month, and a year. The web client will display a date chooser. The job variable for this input will contain a java.time.LocalDate value.

    • JobInputType.TIME: A time is expected, that is, an hour and minutes. The web client will display a time chooser. The job variable for this input will contain a java.time.LocalTime value.

  • JobInputType.FILE: A file is expected.

    • JobInputType.file(String... allowedExtensions): The web client will make its best effort to constrain the extension of the provided file to be among the ones specified.

  • JobInputType.SCENARIO_ID: The ID of a scenario is expected. The web client will display a scenario picker.

    • JobInputType.scenarioId(JobInputType.WorkspaceOrScenarioFilter... filters): The web client will make its best effort to constrain the scenario selected for this input to match the provided filters, which can be any of the following.

      • UNIQUE: The selected scenario should not be already selected as the value for another input to the job. This filter is only relevant when there are at least two job inputs with the type SCENARIO_ID.

      • OWNED: The owner of the selected scenario should be the user who executes the task.

      • WRITABLE: The user who executes the task should have the necessary writing permissions on the selected scenario.

  • JobInputType.WORKSPACE_ID: The ID of a workspace is expected. The web client will display a workspace picker.

    • JobInputType.workspaceId(JobInputType.WorkspaceOrScenarioFilter... filters): The web client will make its best effort to constrain the workspace selected for this input to match the provided filters, which are the same as for scenarios above.