Skip to content
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

Fix task quries tests after the refactoring #19

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -40,7 +40,6 @@
import org.joda.time.DateTimeConstants;
import org.joda.time.Days;
import org.joda.time.LocalDate;
import org.kie.api.task.TaskService;
import org.kie.api.task.model.Content;
import org.kie.api.task.model.Group;
import org.kie.api.task.model.OrganizationalEntity;
Expand Down Expand Up @@ -109,21 +108,21 @@ public List<TaskSummary> getTasksOwnedByExpirationDateOptional(String userId, Li
return taskSummaries;
}


public Map<Long, List<String>> getPotentialOwnersForTaskIds(List<Long> taskIds) {
return taskService.getPotentialOwnersForTaskIds(taskIds);
}

/**
* Day adaptors
*/

public Map<Day, List<TaskSummary>> getTasksAssignedFromDateToDateByDays(String userId,
Date from, Date to, String language) {
return getTasksOwnedFromDateToDateByDays(userId, from, to, language);
}


public Map<Day, List<TaskSummary>> getTasksOwnedFromDateToDateByDays(String userId, List<String> strStatuses, Date from,
Date to, String language) {
List<Status> statuses = new ArrayList<Status>();
Expand Down Expand Up @@ -156,7 +155,7 @@ public Map<Day, List<TaskSummary>> getTasksOwnedFromDateToDateByDays(String user
statuses, currentDay));
//This is a hack we need to find a way to get the PotentialOwners in a performant way
taskIds = new ArrayList<Long>(dayTasks.size());

for (TaskSummary ts : dayTasks) {
taskIds.add(ts.getId());
}
Expand Down Expand Up @@ -210,7 +209,7 @@ public Map<Day, List<TaskSummary>> getTasksAssignedAsPotentialOwnerFromDateToDat
statuses, currentDay));
//This is a hack we need to find a way to get the PotentialOwners in a performant way
taskIds = new ArrayList<Long>(dayTasks.size());

for (TaskSummary ts : dayTasks) {
taskIds.add(ts.getId());
}
Expand Down Expand Up @@ -238,6 +237,7 @@ public Map<Day, List<TaskSummary>> getTasksOwnedFromDateToDateByDays(String user
return getTasksOwnedFromDateToDateByDays(userId, strStatuses, from, new Date(from.getTime() + plusDays), language);
}


public Map<Day, List<TaskSummary>> getTasksOwnedFromDateToDateByDays(String userId, Date from, Date to, String language) {
List<String> statuses = new ArrayList<String>();
statuses.add("InProgress");
Expand All @@ -246,7 +246,7 @@ public Map<Day, List<TaskSummary>> getTasksOwnedFromDateToDateByDays(String user
return getTasksOwnedFromDateToDateByDays(userId, statuses, from, to, language);
}


public Map<Day, List<TaskSummary>> getTasksAssignedAsPotentialOwnerFromDateToDateByDays(String userId, Date from, Date to, String language) {
List<String> statuses = new ArrayList<String>();
statuses.add("Ready");
Expand Down Expand Up @@ -292,7 +292,7 @@ public Map<Day, List<TaskSummary>> getTasksAssignedFromDateToDateByGroupsByDays(
taskIds.add(ts.getId());
}
Map<Long, List<String>> potentialOwnersForTaskIds = null;
if(taskIds.size() > 0){
if(taskIds.size() > 0) {
potentialOwnersForTaskIds = getPotentialOwnersForTaskIds(taskIds);
for (TaskSummary ts : firstDayTasks) {
ts.setPotentialOwners(potentialOwnersForTaskIds.get(ts.getId()));
Expand All @@ -303,7 +303,6 @@ public Map<Day, List<TaskSummary>> getTasksAssignedFromDateToDateByGroupsByDays(
tasksByDay.put(new Day(from, dayFormat.format(from)), firstDayTasks);
int nrOfDays = Days.daysBetween(new LocalDate(from), new LocalDate(to)).getDays();
for (int i = 1; i <= nrOfDays; i++) {

long plusDays = i * (long) DateTimeConstants.MILLIS_PER_DAY;
Date currentDay = new Date(from.getTime() + plusDays);
List<TaskSummary> currentDayGroupTasks = TaskSummaryHelper.adaptCollection(taskService
Expand Down Expand Up @@ -509,7 +508,7 @@ public Map<String, String> getTaskOutputContentByTaskId(long taskId) {
return new HashMap<String, String>();
}



@Override
public IdentitySummary getOrganizationalEntityById(String entityId) {
Expand Down