-
Notifications
You must be signed in to change notification settings - Fork 27
add select parameter type #242
add select parameter type #242
Conversation
f7af233
to
6619d75
Compare
continue; | ||
} | ||
|
||
Map<String, Object> properties = workFlowTaskParameter.getType().getAsJsonSchema(); | ||
properties.put("required", !workFlowTaskParameter.isOptional()); | ||
properties.put("description", workFlowTaskParameter.getDescription()); | ||
if (workFlowTaskParameter.getType().isSelect() && workFlowTaskParameter.getSelectOptions() != null) { | ||
properties.put("enum", workFlowTaskParameter.getSelectOptions()); |
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.
Missing test.
PASSWORD, TEXT, EMAIL, DATE, NUMBER, URL, SELECT, MULTI_SELECT; | ||
|
||
public boolean isSelect() { | ||
return SELECT.name().equals(name()) || MULTI_SELECT.name().equals(name()); |
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.
I would add a test for this just in case someone delete it something in the future.
@@ -55,6 +59,12 @@ public Map<String, Object> getAsJsonSchema() { | |||
properties.put("type", "string"); | |||
properties.put("format", "date"); | |||
break; | |||
case SELECT: | |||
properties.put("type", "select"); | |||
break; |
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.
test
properties.put("type", "select"); | ||
break; | ||
case MULTI_SELECT: | ||
properties.put("type", "multi-select"); |
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.
test
new WorkFlowOptions.Builder() | ||
.addNewOption(getWorkFlowOptions().get(0)) | ||
.build()); | ||
// @formatter:on |
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.
you should move out the formatter TBH
@@ -78,6 +80,15 @@ public static class ArgumentRequestDTO { | |||
|
|||
String value; | |||
|
|||
public void setValue(Object value) { |
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.
Is this used at all?
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.
yes, now the multi-select will return a list of string, I need to deserialize it to string here
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.
I changed to string.valueof to avoid some parsing issue with quotes
@RichardW98 There are commits that do not belong to the PR, please double check what happened during the rebase :) |
PASSWORD, TEXT, EMAIL, DATE, NUMBER, URL, SELECT, MULTI_SELECT; | ||
|
||
public boolean isSelect() { | ||
return SELECT.name().equals(name()) || MULTI_SELECT.name().equals(name()); |
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.
I'd like to suggest, to consider implementing this function defining an Enum
subset via EnumSet
.
For example:
private EnumSet<WorkFlowTaskParameterType> selectedTypes() {
return EnumSet.of(SELECT, MULTI_SELECT);
}
public boolean isSelect(WorkFlowTaskParameterType type) {
return type != null && selectedTypes().contains(type);
}
In this way It's possible to use factory methods available in EnumSet
(such as contains
, complementOf
, allOf
, etc.)
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.
yep, EnumSet is better
new WorkFlowOptions.Builder() | ||
.addNewOption(getWorkFlowOptions().get(0)) | ||
.build()); | ||
// @formatter:on |
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.
Is a //formatter:off
annotation missing?
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.
yes on & off are reversed
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.
I just found the //formatter:off
is here: https://github.com/RichardW98/parodos/blob/FLPATH-292-dropdown/workflow-examples/src/main/java/com/redhat/parodos/examples/master/task/OnboardingAssessmentTask.java#L51.
the code between them will not be formatted
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.
you're right! I missed it!
29d4434
to
3344242
Compare
I added some more change to combine "WorkflowTaskParameter" and "WorkflowParameter" |
/lgtm |
3344242
to
b8f1e21
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: anludke The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
add select parameter type