-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DANS/7564 messaging from workflows #7635
Merged
kcondon
merged 16 commits into
IQSS:develop
from
GlobalDataverseCommunityConsortium:DANS/7564_messaging_from_workflows
Mar 23, 2021
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
35f5eab
pulling out messaging only for #7564
qqmyers 26e7ecc
update pause/message step to accept the same json as http/extauth
qqmyers f50b1d7
update docs
qqmyers 6f77d98
flyway sript
qqmyers eecd60a
send message with failure - per review catch
qqmyers a68a777
Don't imply success is a problem :-)
qqmyers b7de814
Merge remote-tracking branch 'IQSS/develop' into
qqmyers 54c5c15
Add messages to notification panel per review
qqmyers b6b2298
correct flyway number
qqmyers 4da0064
handle lower case keys, consolidate common code, fix typos.
qqmyers 1a0ad95
add example in docs
qqmyers 4c03de3
lower case for message types
qqmyers b495342
handle null message
qqmyers 626d1ce
typo
qqmyers 746955f
add reason logging, better log msgs
qqmyers 99d47bc
fix null when sent in Workflow Failure
qqmyers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand this correctly, that these notifications for workflow success and failure are email-only; in that you are purposefully excluding them from being shown on the dataverseuser.xhtml page? In part, I'm assuming, because of the above, that the custom comment/message doesn't get stored in the database. And with the assumption that the message will be shown to the user using the workflow UI messaging...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... having read the PR description one more time though, you are saying
so, is it "purposefully", or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The notification should be standard and show up in both places. The comment is just noting that UserNotification doesn't include a comment field, so the comment goes out in the email but isn't saved as part of the UserNotification . So, when I need to show something on the page which includes the comment, I needed a place to store the comment.
An alternate design would be to add a comment field to UserNotification but that was bigger, not necessarily something we'd want for other notifications, and the WorkflowComment class seemed to be ~intended for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I may be being slow here, but I just didn't see any code being added to dataverseuser.xhtml, that would show these new notifications in that tab. So my first assumption was that it was on purpose. Although, on a 2nd or 3rd thought, that could be confusing - if the little red alert in the account header is showing that there's one new notification, but nothing new is showing in the notifications tab - ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not intentional - I missed it, so the count goes up and a line in the table shows the date (done for all notifications), but there's not dataverseuser.xhtml fragment to provide the info specific to these types. I'll add them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, makes sense. I obviously didn't remember how that tab was working either; my recollection was that every table entry had to be hard-coded in full.