-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7635 from GlobalDataverseCommunityConsortium/DANS…
…/7564_messaging_from_workflows DANS/7564 messaging from workflows
- Loading branch information
Showing
18 changed files
with
290 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/edu/harvard/iq/dataverse/workflow/internalspi/PauseWithMessageStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package edu.harvard.iq.dataverse.workflow.internalspi; | ||
|
||
import edu.harvard.iq.dataverse.workflow.WorkflowContext; | ||
import edu.harvard.iq.dataverse.workflow.step.Failure; | ||
import edu.harvard.iq.dataverse.workflow.step.Pending; | ||
import edu.harvard.iq.dataverse.workflow.step.WorkflowStep; | ||
import edu.harvard.iq.dataverse.workflow.step.WorkflowStepResult; | ||
import edu.harvard.iq.dataverse.workflows.WorkflowUtil; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.logging.Logger; | ||
|
||
|
||
/** | ||
* A sample step that pauses the workflow. | ||
* | ||
* @author michael | ||
*/ | ||
public class PauseWithMessageStep implements WorkflowStep { | ||
|
||
/** Constant used by testing to simulate a failed step. */ | ||
public static final String FAILURE_RESPONSE="fail"; | ||
|
||
private final Map<String,String> params = new HashMap<>(); | ||
|
||
public PauseWithMessageStep( Map<String,String> paramSet ) { | ||
params.putAll(paramSet); | ||
} | ||
|
||
@Override | ||
public WorkflowStepResult run(WorkflowContext context) { | ||
final Pending result = new Pending(); | ||
result.getData().putAll(params); | ||
return result; | ||
} | ||
|
||
@Override | ||
public WorkflowStepResult resume(WorkflowContext context, Map<String, String> internalData, String externalData) { | ||
return WorkflowUtil.parseResponse(externalData); | ||
} | ||
|
||
@Override | ||
public void rollback(WorkflowContext context, Failure reason) { | ||
// nothing to roll back | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.