Skip to content

Commit

Permalink
rc/5.11.0 || Fix builder according to the updated plugin-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Bortnik committed Dec 20, 2023
1 parent a174d1b commit 32298fb
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ private String getPatchOperationsForFields(PostTicketRQ ticketRQ, List<JsonPatch
.findFirst()
.get()
.getValueId());
} else if (field.getValue().size() == 0 && !field.getIsRequired()) {
} else if (field.getValue().size() == 0 && !field.isRequired()) {
continue;
} else {
value = field.getValue().get(0);
Expand Down Expand Up @@ -444,13 +444,12 @@ public List<PostFormField> getTicketFields(String issueType, Integration integra
defaultValue.add(allowedValues.get(0).getValueName());
}

PostFormField postFormField = new PostFormField(replaceIllegalCharacters(field.getReferenceName()),
field.getName(),
f.getType().toString(),
field.isAlwaysRequired(),
defaultValue,
allowedValues
);
PostFormField postFormField = PostFormField.builder()
.id(replaceIllegalCharacters(field.getReferenceName())).fieldName(field.getName())
.fieldType(f.getType().toString())
.isRequired(field.isAlwaysRequired()).value(defaultValue).definedValues(allowedValues)
.build();

ticketFields.add(postFormField);
});
}
Expand Down Expand Up @@ -619,14 +618,15 @@ private String replaceSeparators(String id) {

private List<PostFormField> sortTicketFields(List<PostFormField> ticketFields, String issueType) {
List<PostFormField> sortedTicketFields = ticketFields.stream()
.sorted(Comparator.comparing(PostFormField::getIsRequired).reversed().thenComparing(PostFormField::getFieldName))
.sorted(Comparator.comparing(PostFormField::isRequired).reversed().thenComparing(PostFormField::getFieldName))
.collect(Collectors.toList());

// Add to the top a custom field representing the work item type
sortedTicketFields.add(
0,
new PostFormField("issuetype", "Issue Type", "issuetype", true, List.of(issueType), new ArrayList<AllowedValue>())
);
sortedTicketFields.add(
0,
PostFormField.builder().id("issuetype").fieldName("Issue Type").fieldType("issuetype")
.isRequired(true).value(List.of(issueType)).definedValues(new ArrayList<>()).build()
);
return sortedTicketFields;
}

Expand Down

0 comments on commit 32298fb

Please sign in to comment.