Interface ConfigurationWorkflowProvider
- All Superinterfaces:
PluginProvider
- Since:
- 1.2.6
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.morpheusdata.core.providers.PluginProvider
PluginProvider.ConfigurationDriftCheckFacet<T>, PluginProvider.EventSubscriberFacet<E extends Event>, PluginProvider.UpdateFacet<T> -
Method Summary
Modifier and TypeMethodDescriptiondefault voidafterSubmit(Map<String, Object> configurationWorkflowState, ServiceResponse<?> submitResponse, Object parentObject, Map<String, Object> opts) Optional method called after successful configuration workflow submission.default ServiceResponse<?>cancelConfigurationWorkflow(Map<String, Object> configurationWorkflowState, Object parentObject, Map<String, Object> opts) Optional method to cancel or abort a running configuration workflow process.default ConfigurationWorkflowReturns a complete ConfigurationWorkflow object representing this configuration workflow provider.getConfigurationWorkflowState(Object parentObject, Map<String, Object> opts) Optional method to retrieve the current configuration workflow state from the parent object.default StringReturns a description of this configuration workflow's purposeReturns the display name for this configuration workflowReturns the ordered list of configuration workflow steps that make up this workflow.default booleanDetermines whether the specified user has permission to access this configuration workflow.saveStepConfiguration(String stepCode, Map<String, Object> stepData, Map<String, Object> currentState, Map<String, Object> opts) Saves the configuration from a completed step to the configuration workflow state.default booleanshouldShowStep(ConfigurationWorkflowStep step, Map<String, Object> configurationWorkflowState, Map<String, Object> opts) Optional method to determine if a specific step should be shown based on the current configuration workflow state.submitConfigurationWorkflow(Map<String, Object> configurationWorkflowState, Object parentObject, Map<String, Object> opts) Submits and executes the configuration workflow.updateParentState(Object parentObject, Map<String, Object> configurationWorkflowState, Map<String, Object> opts) Updates the parent object with the current configuration workflow state.validateConfigurationWorkflow(Map<String, Object> configurationWorkflowState, Object parentObject, Map<String, Object> opts) Validates the complete configuration workflow state before final submission.Methods inherited from interface com.morpheusdata.core.providers.PluginProvider
getCode, getMorpheus, getName, getPlugin
-
Method Details
-
getWorkflowName
String getWorkflowName()Returns the display name for this configuration workflow- Returns:
- configuration workflow display name
-
getWorkflowDescription
Returns a description of this configuration workflow's purpose- Returns:
- configuration workflow description
-
getConfigurationWorkflow
Returns a complete ConfigurationWorkflow object representing this configuration workflow provider. This method constructs a ConfigurationWorkflow model from the provider's configuration, including the code, name, description, and steps.- Returns:
- ConfigurationWorkflow object representing this configuration workflow
-
hasAccess
Determines whether the specified user has permission to access this configuration workflow. This method allows providers to implement custom authorization logic based on user roles, permissions, or other criteria.- Parameters:
user- the user to check access for- Returns:
- true if the user can access this configuration workflow, false otherwise
-
getWorkflowSteps
List<ConfigurationWorkflowStep> getWorkflowSteps()Returns the ordered list of configuration workflow steps that make up this workflow. The steps will be presented to the user in the order returned by this list.- Returns:
- List of ConfigurationWorkflowStep objects defining the configuration workflow
-
saveStepConfiguration
ServiceResponse<?> saveStepConfiguration(String stepCode, Map<String, Object> stepData, Map<String, Object> currentState, Map<String, Object> opts) Saves the configuration from a completed step to the configuration workflow state. This method is called after each step's wizard is successfully completed, allowing the configuration workflow to accumulate configuration across all steps.The state map must use a flat structure: each step's data is stored at the top level keyed by step code.
Example state after two steps complete:
{ "my-network-step": { "managementIp": "10.0.0.1", ... }, "my-credentials-step": { "username": "admin", ... }, "status": "completed", "completed": true, "lastCompletedStep": "my-credentials-step" }The ServiceResponse data map must contain a
workflowStatekey holding the updated state map:ServiceResponse.success([workflowState: newState]).- Parameters:
stepCode- the code of the step that was completedstepData- the configuration data collected from the step's wizardcurrentState- the current configuration workflow state before this updateopts- additional options or context- Returns:
- ServiceResponse whose data contains
workflowStateâ the updated flat state map
-
updateParentState
ServiceResponse<?> updateParentState(Object parentObject, Map<String, Object> configurationWorkflowState, Map<String, Object> opts) Updates the parent object with the current configuration workflow state. This method is called after each step configuration is saved, allowing the parent object to persist and track the configuration workflow progress.- Parameters:
parentObject- the parent object that holds the configuration workflow stateconfigurationWorkflowState- the current complete state of the configuration workflowopts- additional options or context- Returns:
- ServiceResponse indicating success or failure of the update
-
validateConfigurationWorkflow
ServiceResponse<?> validateConfigurationWorkflow(Map<String, Object> configurationWorkflowState, Object parentObject, Map<String, Object> opts) Validates the complete configuration workflow state before final submission. This method performs cross-step validation and business rule checks that span multiple configuration workflow steps.The
configurationWorkflowStatemap uses a flat structure: step data is stored at the top level keyed by step code (e.g.state["my-network-step"]). Metadata keysstatus,completed, andlastCompletedStepare also present at the top level.- Parameters:
configurationWorkflowState- flat map of all step data, keyed by step code, plus metadata keysparentObject- the parent object that holds the configuration workflow stateopts- additional options or context- Returns:
- ServiceResponse containing validation results. If validation fails, the response should contain error messages explaining what went wrong.
-
submitConfigurationWorkflow
ServiceResponse<?> submitConfigurationWorkflow(Map<String, Object> configurationWorkflowState, Object parentObject, Map<String, Object> opts) Submits and executes the configuration workflow. This method is called after all steps are completed and validated. It should initiate the actual execution of the configuration workflow.The
configurationWorkflowStatemap uses a flat structure: step data is stored at the top level keyed by step code.Setting system status: Set
parentObject.status = "initialized"to signal that setup is complete.Since this method typically triggers another long-running process or method, it returns a synchronous ServiceResponse. The long-running execution should be handled by the method this calls.
- Parameters:
configurationWorkflowState- flat map of all step data, keyed by step code, plus metadata keysparentObject- the parent object that holds the configuration workflow stateopts- additional options or context- Returns:
- ServiceResponse containing the result of the configuration workflow submission
-
getConfigurationWorkflowState
default Map<String,Object> getConfigurationWorkflowState(Object parentObject, Map<String, Object> opts) Optional method to retrieve the current configuration workflow state from the parent object. This is useful for resuming an configuration workflow or reviewing its current progress.- Parameters:
parentObject- the parent object that holds the configuration workflow stateopts- additional options or context- Returns:
- Map containing the current configuration workflow state
-
shouldShowStep
default boolean shouldShowStep(ConfigurationWorkflowStep step, Map<String, Object> configurationWorkflowState, Map<String, Object> opts) Optional method to determine if a specific step should be shown based on the current configuration workflow state. This allows for conditional configuration workflow flows.- Parameters:
step- the configuration workflow step to evaluateconfigurationWorkflowState- map containing the current state from all previously completed stepsopts- additional options or context- Returns:
- true if the step should be shown, false to skip it
-
afterSubmit
default void afterSubmit(Map<String, Object> configurationWorkflowState, ServiceResponse<?> submitResponse, Object parentObject, Map<String, Object> opts) Optional method called after successful configuration workflow submission. Useful for cleanup, notifications, or triggering dependent actions after the configuration workflow process completes.- Parameters:
configurationWorkflowState- map containing all configuration data from all stepssubmitResponse- the response from submitConfigurationWorkflow()parentObject- the parent object that holds the configuration workflow stateopts- additional options or context
-
cancelConfigurationWorkflow
default ServiceResponse<?> cancelConfigurationWorkflow(Map<String, Object> configurationWorkflowState, Object parentObject, Map<String, Object> opts) Optional method to cancel or abort a running configuration workflow process.- Parameters:
configurationWorkflowState- map containing the current configuration workflow stateparentObject- the parent object that holds the configuration workflow stateopts- additional options or context- Returns:
- ServiceResponse indicating success or failure of the cancellation
-