Skip to content

Commit

Permalink
incubator-kie-issues#1626: Fix Typo in public API method for custom U…
Browse files Browse the repository at this point in the history
…ser Task assignment strategy (#3786)

- Included reassignments typos.
  • Loading branch information
pefernan authored Nov 19, 2024
1 parent 13644c5 commit 35b4028
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ default String getName() {
return getClass().getName();
}

Optional<String> computeAssigment(UserTaskInstance userTaskInstance, IdentityProvider identityProvider);
Optional<String> computeAssignment(UserTaskInstance userTaskInstance, IdentityProvider identityProvider);

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Set<String> getPotentialGroups() {

@Override
public String toString() {
return "Reassigment [potentialUsers=" + potentialUsers + ", potentialGroups=" + potentialGroups + "]";
return "Reassignment [potentialUsers=" + potentialUsers + ", potentialGroups=" + potentialGroups + "]";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class AbstractUserTask implements UserTask {
private Set<String> excludedUsers;
private Collection<DeadlineInfo<Notification>> startDeadlines;
private Collection<DeadlineInfo<Notification>> endDeadlines;
private Collection<DeadlineInfo<Reassignment>> startReassigments;
private Collection<DeadlineInfo<Reassignment>> startReassignments;
private Collection<DeadlineInfo<Reassignment>> endReassignments;

public AbstractUserTask(String id, String name) {
Expand All @@ -60,7 +60,7 @@ public AbstractUserTask(String id, String name) {
this.excludedUsers = new HashSet<>();
this.startDeadlines = new HashSet<>();
this.endDeadlines = new HashSet<>();
this.startReassigments = new HashSet<>();
this.startReassignments = new HashSet<>();
this.endReassignments = new HashSet<>();
}

Expand Down Expand Up @@ -223,19 +223,19 @@ public void setNotCompletedDeadlines(String notStarted) {

@Override
public Collection<DeadlineInfo<Reassignment>> getNotStartedReassignments() {
return startReassigments;
return startReassignments;
}

public void setNotStartedReassignments(String reassignments) {
this.startReassigments = DeadlineHelper.parseReassignments(reassignments);
this.startReassignments = DeadlineHelper.parseReassignments(reassignments);
}

@Override
public Collection<DeadlineInfo<Reassignment>> getNotCompletedReassignments() {
return endReassignments;
}

public void setNotCompletedReassigments(String reassignments) {
public void setNotCompletedReassignments(String reassignments) {
this.endReassignments = DeadlineHelper.parseReassignments(reassignments);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public String getName() {
}

@Override
public Optional<String> computeAssigment(UserTaskInstance userTaskInstance, IdentityProvider identityProvider) {
public Optional<String> computeAssignment(UserTaskInstance userTaskInstance, IdentityProvider identityProvider) {
Set<String> users = new HashSet<>(userTaskInstance.getPotentialUsers());
users.removeAll(userTaskInstance.getExcludedUsers());
if (users.size() == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public class DefaultUserTaskInstance implements UserTaskInstance {

private Collection<DeadlineInfo<Reassignment>> notStartedReassignments;

private Collection<DeadlineInfo<Reassignment>> notCompletedReassigments;
private Collection<DeadlineInfo<Reassignment>> notCompletedReassignments;

private Map<String, Notification> notStartedDeadlinesTimers;

Expand Down Expand Up @@ -643,11 +643,11 @@ public void setNotStartedReassignments(Collection<DeadlineInfo<Reassignment>> no

@Override
public Collection<DeadlineInfo<Reassignment>> getNotCompletedReassignments() {
return notCompletedReassigments;
return notCompletedReassignments;
}

public void setNotCompletedReassignments(Collection<DeadlineInfo<Reassignment>> notCompletedReassigments) {
this.notCompletedReassigments = notCompletedReassigments;
public void setNotCompletedReassignments(Collection<DeadlineInfo<Reassignment>> notCompletedReassignments) {
this.notCompletedReassignments = notCompletedReassignments;
}

public void setJobsService(JobsService jobsService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public Optional<UserTaskTransitionToken> fail(UserTaskInstance userTaskInstance,

private String assignStrategy(UserTaskInstance userTaskInstance, IdentityProvider identityProvider) {
UserTaskAssignmentStrategy assignmentStrategy = userTaskInstance.getUserTask().getAssignmentStrategy();
return assignmentStrategy.computeAssigment(userTaskInstance, identityProvider).orElse(null);
return assignmentStrategy.computeAssignment(userTaskInstance, identityProvider).orElse(null);
}

private void checkPermission(UserTaskInstance userTaskInstance, IdentityProvider identityProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static Collection<DeadlineInfo<Reassignment>> parseReassignments(Object t
if (text instanceof String textString && textString.isBlank()) {
return Collections.emptyList();
}
return parseDeadlines(text, DeadlineHelper::parseReassigment, DeadlineHelper::getReassignmentSchedule);
return parseDeadlines(text, DeadlineHelper::parseReassignment, DeadlineHelper::getReassignmentSchedule);
}

public static Collection<DeadlineInfo<Notification>> parseDeadlines(Object text) {
Expand Down Expand Up @@ -221,7 +221,7 @@ private static Map<String, Object> asMap(String text) {
return result;
}

private static Reassignment parseReassigment(String text) {
private static Reassignment parseReassignment(String text) {
Map<String, Object> map = asMap(text);
return new Reassignment(parseSet(map.get("users")), parseSet(map.get("groups")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ public void testMultipleNotification() {

@Test
public void testReassignment() {
Collection<DeadlineInfo<Reassignment>> reassigments = DeadlineHelper.parseReassignments(
Collection<DeadlineInfo<Reassignment>> reassignments = DeadlineHelper.parseReassignments(
"[users:Pepe,Pepa|groups:Admin,Managers]@[1m]");
assertThat(reassigments).hasSize(1);
DeadlineInfo<Reassignment> reassignment = reassigments.iterator().next();
assertThat(reassignments).hasSize(1);
DeadlineInfo<Reassignment> reassignment = reassignments.iterator().next();
assertThat(reassignment.getNotification().getPotentialUsers()).containsExactlyInAnyOrder("Pepe", "Pepa");
assertThat(reassignment.getNotification().getPotentialGroups()).containsExactlyInAnyOrder("Admin", "Managers");
assertThat(reassignment.getScheduleInfo().iterator().next().getDuration()).isEqualTo(Duration.ofMinutes(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public List<GeneratedFile> generateUserTask() {
block.addStatement(new MethodCallExpr(new ThisExpr(), "setNotStartedDeadLines", NodeList.nodeList(toDeadlineExpression(info.getParameter("NotStartedNotify")))));
block.addStatement(new MethodCallExpr(new ThisExpr(), "setNotCompletedDeadlines", NodeList.nodeList(toDeadlineExpression(info.getParameter("NotCompletedNotify")))));
block.addStatement(new MethodCallExpr(new ThisExpr(), "setNotStartedReassignments", NodeList.nodeList(toDeadlineExpression(info.getParameter("NotStartedReassign")))));
block.addStatement(new MethodCallExpr(new ThisExpr(), "setNotCompletedReassigments", NodeList.nodeList(toDeadlineExpression(info.getParameter("NotCompletedReassign")))));
block.addStatement(new MethodCallExpr(new ThisExpr(), "setNotCompletedReassignments", NodeList.nodeList(toDeadlineExpression(info.getParameter("NotCompletedReassign")))));

generatedFiles.add(new GeneratedFile(GeneratedFileType.SOURCE, UserTaskCodegenHelper.path(info).resolve(className + ".java"), unit.toString()));
}
Expand All @@ -240,7 +240,7 @@ private Expression toDeadlineExpression(Object parameter) {
DeadlineHelper.parseDeadlines(stringParam);
return toStringExpression(stringParam);
} catch (Exception e) {
LOG.debug("to deadline calculation failure. {} it is not a proper expression");
LOG.debug("to deadline calculation failure. {} it is not a proper expression", stringParam);
}
}
return new CastExpr(StaticJavaParser.parseType(String.class.getName()), new NullLiteralExpr());
Expand Down

0 comments on commit 35b4028

Please sign in to comment.