Package com.orchestranetworks.userservice.declaration

# Interface WebComponentDeclarationContext

public interface WebComponentDeclarationContext
Provides a context to explicitly declare the HTTP parameters of a user service and to make this service available in the user interfaces used to to define a perspective action or a workflow user task. These interfaces display the defined parameters so that their value can be populated by the user.

The parameters are either built-in or specific:

- Built-in parameters are automatically deduced from the activation of the service. For example, if a service is activated at the dataset level then its built-in parameters will include `branch`, `version` and `instance` but not `xpath`. Built-in parameters are automatically added to this context, but they can be overridden, for example to change their label.
- Specific parameters must be specified by adding them through this context. At runtime, they can be accessed by invoking the method `Session.getInputParameterValue(boolean, String)`.

Since:
  5.8.0
See Also:
  - `UIHttpManagerComponent`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `WebComponentParameter`
  `addInputOutputParameter(String aName, UserMessage aLabel, UserMessage aDescription)`
  Adds the specified input-output parameter.
  `WebComponentParameter`
  `addInputParameter(String aName, UserMessage aLabel, UserMessage aDescription)`
  Adds the specified input-only parameter.
  `WebComponentParameter`
  `addOutputParameter(String aName, UserMessage aLabel, UserMessage aDescription)`
  Adds the specified output-only parameter.
  `WebComponentParameter`
  `addParameter(String aName, boolean isInput, boolean isOutput, UserMessage aLabel, UserMessage aDescription)`
  Adds the specified parameter.
  `WebComponentParameter`
  `getBuiltInParameterForOverride(String aName)`
  Retrieves the specified built-in parameter to override its definition, for example, to change its description.
  `void`
  `setAvailableAsPerspectiveAction(boolean isAvailableAsPerspectiveAction)`
  Defines whether the service is proposed in the user interface used to define a perspective action.
  `void`
  `setAvailableAsToolbarAction(boolean isAvailableAsToolbarAction)`
  Defines whether the service is proposed in the user interface used to define a toolbar web component action.
  `void`
  `setAvailableAsWorkflowUserTask(boolean isAvailableAsWorkflowUserTask)`
  This method is equivalent to:
  `void`
  `setAvailableAsWorkflowUserTask(boolean isAvailableAsWorkflowUserTask, boolean isAutoComplete)`
  Defines if the service is proposed in the user interface used to define a workflow user task, and if this user service auto-completes itself by calling `SessionInteraction.complete(com.orchestranetworks.interactions.InteractionHelper.ParametersMap)` in its implementation.

- ## Method Details

  - ### setAvailableAsPerspectiveAction

    void setAvailableAsPerspectiveAction(boolean isAvailableAsPerspectiveAction)
    Defines whether the service is proposed in the user interface used to define a perspective action.

    By default, a service is not proposed in this user interface.

    #### Limitations

    This method can only be used when declaring a new user service. When declaring a user service extension, this method does nothing and the service availability as perspective action is defined by the extended service.

    Also, when the service is declared in a data model which is not included in a module, this method does nothing and the service is never available as a perspective action.

  - ### setAvailableAsToolbarAction

    void setAvailableAsToolbarAction(boolean isAvailableAsToolbarAction)
    Defines whether the service is proposed in the user interface used to define a toolbar web component action.

    By default a service is not proposed in this user interface.

    #### Limitations

    This method can only be used when declaring a new user service. When declaring a user service extension, this method does nothing and the service availability as a toolbar web component action is defined by the extended service.

    Also, when the service is declared in a data model which is not included in a module, this method does nothing and the service is never available as a toolbar web component action.

    Since:
      5.9.0
    See Also:
      - `WebComponentAction`

  - ### setAvailableAsWorkflowUserTask

    void setAvailableAsWorkflowUserTask(boolean isAvailableAsWorkflowUserTask)

    This method is equivalent to:

    > `WebComponentDeclarationContext.setAvailableAsWorkflowUserTask(isAvailableAsWorkflowUserTask, false);`

    See Also:
      - `setAvailableAsWorkflowUserTask(boolean, boolean)`

  - ### setAvailableAsWorkflowUserTask

    void setAvailableAsWorkflowUserTask(boolean isAvailableAsWorkflowUserTask, boolean isAutoComplete)
    Defines if the service is proposed in the user interface used to define a workflow user task, and if this user service auto-completes itself by calling `SessionInteraction.complete(com.orchestranetworks.interactions.InteractionHelper.ParametersMap)` in its implementation.

    By default a service is not proposed in this user interface.

    #### Limitations

    This method can only be used when declaring a new user service. When declaring a user service extension, this method does nothing and the service availability as a workflow user task is defined by the extended service.

    Also, when the service is declared in a data model which is not included in a module, this method does nothing and the service is never available as a workflow user task.

    Parameters:
      `isAvailableAsWorkflowUserTask` - indicates if the user service is available as a workflow user task.
      `isAutoComplete` - if enabled for the workflow, indicates if the user service is auto-completed when the interaction is created by API using `WorkflowEngine.createOrOpenInteraction(com.orchestranetworks.workflow.WorkItemKey)`. Even if a user service is declared as auto-completed, the developer has the responsibility to call `SessionInteraction.complete(com.orchestranetworks.interactions.InteractionHelper.ParametersMap)` at first display in the associated user service Java code.
    Throws:
      `IllegalArgumentException` - if isAutoComplete is enabled whereas isAvailableAsWorkflowUserTask is disabled. The auto-complete parameter is only relevant in a workflow context.
    Since:
      5.8.1
    See Also:
      - `setAvailableAsWorkflowUserTask(boolean)`

  - ### getBuiltInParameterForOverride

    WebComponentParameter getBuiltInParameterForOverride(String aName)
    Retrieves the specified built-in parameter to override its definition, for example, to change its description.

    This method can only be used when declaring a new user service. It will always return `null` when declaring a user service extension, since parameters from the extended user service cannot be overridden.

  - ### addParameter

    WebComponentParameter addParameter(String aName, boolean isInput, boolean isOutput, UserMessage aLabel, UserMessage aDescription)
    Adds the specified parameter.
    Throws:
      `IllegalArgumentException` - if a parameter with the same name already exists (it can be a built-in parameter) or if both `isInput` and `isOutput` are `false`.

  - ### addInputParameter

    WebComponentParameter addInputParameter(String aName, UserMessage aLabel, UserMessage aDescription)
    Adds the specified input-only parameter.
    Throws:
      `IllegalArgumentException` - if a parameter with the same name already exists (it can be a built-in parameter).

  - ### addOutputParameter

    WebComponentParameter addOutputParameter(String aName, UserMessage aLabel, UserMessage aDescription)
    Adds the specified output-only parameter.
    Throws:
      `IllegalArgumentException` - if a parameter with the same name already exists (it can be a built-in parameter).

  - ### addInputOutputParameter

    WebComponentParameter addInputOutputParameter(String aName, UserMessage aLabel, UserMessage aDescription)
    Adds the specified input-output parameter.
    Throws:
      `IllegalArgumentException` - if a parameter with the same name already exists (it can be a built-in parameter).