Closes #2521 - Fix code smells Stream.collect(Collectors.toList()) to Stream.toList()
This commit is contained in:
parent
9e547f8867
commit
72a4ec7bb1
|
@ -7,7 +7,6 @@ import java.lang.reflect.Field;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import pro.taskana.common.api.exceptions.SystemException;
|
import pro.taskana.common.api.exceptions.SystemException;
|
||||||
|
|
||||||
|
@ -56,7 +55,7 @@ public class ObjectAttributeChangeDetector {
|
||||||
.map(wrap(field -> Triplet.of(field, field.get(oldObject), field.get(newObject))))
|
.map(wrap(field -> Triplet.of(field, field.get(oldObject), field.get(newObject))))
|
||||||
.filter(not(t -> Objects.equals(t.getMiddle(), t.getRight())))
|
.filter(not(t -> Objects.equals(t.getMiddle(), t.getRight())))
|
||||||
.map(t -> generateChangedAttribute(t.getLeft(), t.getMiddle(), t.getRight()))
|
.map(t -> generateChangedAttribute(t.getLeft(), t.getMiddle(), t.getRight()))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
|
|
||||||
JSONObject changes = new JSONObject();
|
JSONObject changes = new JSONObject();
|
||||||
changes.put("changes", changedAttributes);
|
changes.put("changes", changedAttributes);
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class ReflectionUtil {
|
public class ReflectionUtil {
|
||||||
|
|
||||||
|
@ -38,7 +37,7 @@ public class ReflectionUtil {
|
||||||
fields.addAll(Arrays.asList(currentClass.getDeclaredFields()));
|
fields.addAll(Arrays.asList(currentClass.getDeclaredFields()));
|
||||||
currentClass = currentClass.getSuperclass();
|
currentClass = currentClass.getSuperclass();
|
||||||
}
|
}
|
||||||
return fields.stream().filter(not(Field::isSynthetic)).collect(Collectors.toList());
|
return fields.stream().filter(not(Field::isSynthetic)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class<?> getRawClass(Type type) {
|
public static Class<?> getRawClass(Type type) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package pro.taskana.common.internal.util;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
public class SpiLoader {
|
public class SpiLoader {
|
||||||
|
@ -13,6 +12,6 @@ public class SpiLoader {
|
||||||
|
|
||||||
public static <T> List<T> load(Class<T> clazz) {
|
public static <T> List<T> load(Class<T> clazz) {
|
||||||
ServiceLoader<T> serviceLoader = ServiceLoader.load(clazz);
|
ServiceLoader<T> serviceLoader = ServiceLoader.load(clazz);
|
||||||
return StreamSupport.stream(serviceLoader.spliterator(), false).collect(Collectors.toList());
|
return StreamSupport.stream(serviceLoader.spliterator(), false).toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ public class TaskanaConfiguration {
|
||||||
public List<String> getAllClassificationCategories() {
|
public List<String> getAllClassificationCategories() {
|
||||||
return this.classificationCategoriesByType.values().stream()
|
return this.classificationCategoriesByType.values().stream()
|
||||||
.flatMap(Collection::stream)
|
.flatMap(Collection::stream)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getClassificationCategoriesByType(String type) {
|
public List<String> getClassificationCategoriesByType(String type) {
|
||||||
|
@ -1353,18 +1353,15 @@ public class TaskanaConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adjustConfiguration() {
|
private void adjustConfiguration() {
|
||||||
domains = domains.stream().map(String::toUpperCase).collect(Collectors.toList());
|
domains = domains.stream().map(String::toUpperCase).toList();
|
||||||
classificationTypes =
|
classificationTypes = classificationTypes.stream().map(String::toUpperCase).toList();
|
||||||
classificationTypes.stream().map(String::toUpperCase).collect(Collectors.toList());
|
|
||||||
classificationCategoriesByType =
|
classificationCategoriesByType =
|
||||||
classificationCategoriesByType.entrySet().stream()
|
classificationCategoriesByType.entrySet().stream()
|
||||||
.map(
|
.map(
|
||||||
e ->
|
e ->
|
||||||
Map.entry(
|
Map.entry(
|
||||||
e.getKey().toUpperCase(),
|
e.getKey().toUpperCase(),
|
||||||
e.getValue().stream()
|
e.getValue().stream().map(String::toUpperCase).toList()))
|
||||||
.map(String::toUpperCase)
|
|
||||||
.collect(Collectors.toList())))
|
|
||||||
.sorted(Comparator.comparingInt(e -> classificationTypes.indexOf(e.getKey())))
|
.sorted(Comparator.comparingInt(e -> classificationTypes.indexOf(e.getKey())))
|
||||||
.collect(
|
.collect(
|
||||||
Collectors.toMap(
|
Collectors.toMap(
|
||||||
|
|
|
@ -3,7 +3,6 @@ package pro.taskana.common.internal.jobs;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import pro.taskana.common.api.ScheduledJob;
|
import pro.taskana.common.api.ScheduledJob;
|
||||||
|
@ -34,8 +33,7 @@ public class JobRunner {
|
||||||
|
|
||||||
private List<ScheduledJob> findAndLockJobsToRun() {
|
private List<ScheduledJob> findAndLockJobsToRun() {
|
||||||
return TaskanaTransactionProvider.executeInTransactionIfPossible(
|
return TaskanaTransactionProvider.executeInTransactionIfPossible(
|
||||||
txProvider,
|
txProvider, () -> jobService.findJobsToRun().stream().map(this::lockJob).toList());
|
||||||
() -> jobService.findJobsToRun().stream().map(this::lockJob).collect(Collectors.toList()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runJobTransactionally(ScheduledJob scheduledJob) {
|
private void runJobTransactionally(ScheduledJob scheduledJob) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package pro.taskana.monitor.api.reports;
|
package pro.taskana.monitor.api.reports;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.monitor.api.reports.header.ColumnHeader;
|
import pro.taskana.monitor.api.reports.header.ColumnHeader;
|
||||||
|
@ -25,7 +24,7 @@ public class TaskStatusReport extends Report<TaskQueryItem, TaskStatusColumnHead
|
||||||
super(
|
super(
|
||||||
(filter != null ? filter.stream() : Stream.of(TaskState.values()))
|
(filter != null ? filter.stream() : Stream.of(TaskState.values()))
|
||||||
.map(TaskStatusColumnHeader::new)
|
.map(TaskStatusColumnHeader::new)
|
||||||
.collect(Collectors.toList()),
|
.toList(),
|
||||||
new String[] {"DOMAINS"});
|
new String[] {"DOMAINS"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import pro.taskana.common.api.WorkingTimeCalculator;
|
import pro.taskana.common.api.WorkingTimeCalculator;
|
||||||
|
@ -91,7 +90,7 @@ public class WorkingDaysToDaysReportConverter {
|
||||||
cacheDaysToWorkingDays.entrySet().stream()
|
cacheDaysToWorkingDays.entrySet().stream()
|
||||||
.filter(entry -> entry.getValue() == amountOfWorkdays)
|
.filter(entry -> entry.getValue() == amountOfWorkdays)
|
||||||
.map(Entry::getKey)
|
.map(Entry::getKey)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
if (listOfAllMatchingDays.isEmpty()) {
|
if (listOfAllMatchingDays.isEmpty()) {
|
||||||
return Collections.singletonList(amountOfWorkdays);
|
return Collections.singletonList(amountOfWorkdays);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import static pro.taskana.common.api.BaseQuery.toLowerCopy;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import pro.taskana.common.api.IntInterval;
|
import pro.taskana.common.api.IntInterval;
|
||||||
import pro.taskana.common.api.TaskanaRole;
|
import pro.taskana.common.api.TaskanaRole;
|
||||||
import pro.taskana.common.api.WorkingTimeCalculator;
|
import pro.taskana.common.api.WorkingTimeCalculator;
|
||||||
|
@ -619,7 +618,7 @@ abstract class TimeIntervalReportBuilderImpl<
|
||||||
s.getSubKey(),
|
s.getSubKey(),
|
||||||
Collections.min(instance.convertWorkingDaysToDays(s.getLowerAgeLimit())),
|
Collections.min(instance.convertWorkingDaysToDays(s.getLowerAgeLimit())),
|
||||||
Collections.max(instance.convertWorkingDaysToDays(s.getUpperAgeLimit()))))
|
Collections.max(instance.convertWorkingDaysToDays(s.getUpperAgeLimit()))))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean subKeyIsSet(List<SelectedItem> selectedItems) {
|
private boolean subKeyIsSet(List<SelectedItem> selectedItems) {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import pro.taskana.common.api.TaskanaRole;
|
import pro.taskana.common.api.TaskanaRole;
|
||||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||||
|
@ -71,7 +70,7 @@ public class TimestampReportBuilderImpl
|
||||||
// That's why "the loop" is done outside mybatis.
|
// That's why "the loop" is done outside mybatis.
|
||||||
.map(this::getTasksCountForStatusGroupedByOrgLevel)
|
.map(this::getTasksCountForStatusGroupedByOrgLevel)
|
||||||
.flatMap(Collection::stream)
|
.flatMap(Collection::stream)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
|
|
||||||
report.addItems(
|
report.addItems(
|
||||||
items,
|
items,
|
||||||
|
|
|
@ -56,9 +56,7 @@ public class ObjectReferenceHandler {
|
||||||
void insertAndDeleteObjectReferencesOnTaskUpdate(TaskImpl newTaskImpl, TaskImpl oldTaskImpl)
|
void insertAndDeleteObjectReferencesOnTaskUpdate(TaskImpl newTaskImpl, TaskImpl oldTaskImpl)
|
||||||
throws ObjectReferencePersistenceException, InvalidArgumentException {
|
throws ObjectReferencePersistenceException, InvalidArgumentException {
|
||||||
List<ObjectReference> newObjectReferences =
|
List<ObjectReference> newObjectReferences =
|
||||||
newTaskImpl.getSecondaryObjectReferences().stream()
|
newTaskImpl.getSecondaryObjectReferences().stream().filter(Objects::nonNull).toList();
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
newTaskImpl.setSecondaryObjectReferences(newObjectReferences);
|
newTaskImpl.setSecondaryObjectReferences(newObjectReferences);
|
||||||
|
|
||||||
for (ObjectReference objectReference : newObjectReferences) {
|
for (ObjectReference objectReference : newObjectReferences) {
|
||||||
|
@ -81,7 +79,7 @@ public class ObjectReferenceHandler {
|
||||||
List<ObjectReference> newObjectReferences =
|
List<ObjectReference> newObjectReferences =
|
||||||
newTaskImpl.getSecondaryObjectReferences().stream()
|
newTaskImpl.getSecondaryObjectReferences().stream()
|
||||||
.filter(not(o -> oldObjectReferencesIds.contains(o.getId())))
|
.filter(not(o -> oldObjectReferencesIds.contains(o.getId())))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
|
|
||||||
for (ObjectReference objectReference : newObjectReferences) {
|
for (ObjectReference objectReference : newObjectReferences) {
|
||||||
insertNewObjectReferenceOnTaskUpdate(newTaskImpl, objectReference);
|
insertNewObjectReferenceOnTaskUpdate(newTaskImpl, objectReference);
|
||||||
|
@ -115,8 +113,7 @@ public class ObjectReferenceHandler {
|
||||||
final List<ObjectReference> newObjectReferences = newTaskImpl.getSecondaryObjectReferences();
|
final List<ObjectReference> newObjectReferences = newTaskImpl.getSecondaryObjectReferences();
|
||||||
List<String> newObjectReferencesIds = new ArrayList<>();
|
List<String> newObjectReferencesIds = new ArrayList<>();
|
||||||
if (newObjectReferences != null && !newObjectReferences.isEmpty()) {
|
if (newObjectReferences != null && !newObjectReferences.isEmpty()) {
|
||||||
newObjectReferencesIds =
|
newObjectReferencesIds = newObjectReferences.stream().map(ObjectReference::getId).toList();
|
||||||
newObjectReferences.stream().map(ObjectReference::getId).collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
List<ObjectReference> oldObjectReferences = oldTaskImpl.getSecondaryObjectReferences();
|
List<ObjectReference> oldObjectReferences = oldTaskImpl.getSecondaryObjectReferences();
|
||||||
if (oldObjectReferences != null && !oldObjectReferences.isEmpty()) {
|
if (oldObjectReferences != null && !oldObjectReferences.isEmpty()) {
|
||||||
|
|
|
@ -71,9 +71,7 @@ class ServiceLevelHandler {
|
||||||
}
|
}
|
||||||
if (priorityChanged) {
|
if (priorityChanged) {
|
||||||
List<MinimalTaskSummary> tasksWithoutManualPriority =
|
List<MinimalTaskSummary> tasksWithoutManualPriority =
|
||||||
tasks.stream()
|
tasks.stream().filter(not(MinimalTaskSummary::isManualPriorityActive)).toList();
|
||||||
.filter(not(MinimalTaskSummary::isManualPriorityActive))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
updateTaskPriorityOnClassificationUpdate(
|
updateTaskPriorityOnClassificationUpdate(
|
||||||
tasksWithoutManualPriority, attachments, allInvolvedClassifications);
|
tasksWithoutManualPriority, attachments, allInvolvedClassifications);
|
||||||
}
|
}
|
||||||
|
@ -214,7 +212,7 @@ class ServiceLevelHandler {
|
||||||
t.getTaskId(),
|
t.getTaskId(),
|
||||||
determinePriorityForATask(
|
determinePriorityForATask(
|
||||||
t, classificationIdToPriorityMap, taskIdToClassificationIdsMap)))
|
t, classificationIdToPriorityMap, taskIdToClassificationIdsMap)))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
return taskIdPriorities.stream()
|
return taskIdPriorities.stream()
|
||||||
.collect(
|
.collect(
|
||||||
groupingBy(
|
groupingBy(
|
||||||
|
@ -425,8 +423,7 @@ class ServiceLevelHandler {
|
||||||
referenceTask.setPlanned(durationHolder.getPlanned());
|
referenceTask.setPlanned(durationHolder.getPlanned());
|
||||||
referenceTask.setModified(Instant.now());
|
referenceTask.setModified(Instant.now());
|
||||||
referenceTask.setDue(calculateDue(referenceTask.getPlanned(), durationHolder.getDuration()));
|
referenceTask.setDue(calculateDue(referenceTask.getPlanned(), durationHolder.getDuration()));
|
||||||
List<String> taskIdsToUpdate =
|
List<String> taskIdsToUpdate = taskDurationList.stream().map(TaskDuration::getTaskId).toList();
|
||||||
taskDurationList.stream().map(TaskDuration::getTaskId).collect(Collectors.toList());
|
|
||||||
Pair<List<MinimalTaskSummary>, BulkLog> existingAndAuthorizedTasks =
|
Pair<List<MinimalTaskSummary>, BulkLog> existingAndAuthorizedTasks =
|
||||||
taskServiceImpl.getMinimalTaskSummaries(taskIdsToUpdate);
|
taskServiceImpl.getMinimalTaskSummaries(taskIdsToUpdate);
|
||||||
bulkLog.addAllErrors(existingAndAuthorizedTasks.getRight());
|
bulkLog.addAllErrors(existingAndAuthorizedTasks.getRight());
|
||||||
|
@ -565,9 +562,7 @@ class ServiceLevelHandler {
|
||||||
private List<AttachmentSummaryImpl> getAttachmentSummaries(
|
private List<AttachmentSummaryImpl> getAttachmentSummaries(
|
||||||
List<MinimalTaskSummary> existingTasksAuthorizedFor) {
|
List<MinimalTaskSummary> existingTasksAuthorizedFor) {
|
||||||
List<String> existingTaskIdsAuthorizedFor =
|
List<String> existingTaskIdsAuthorizedFor =
|
||||||
existingTasksAuthorizedFor.stream()
|
existingTasksAuthorizedFor.stream().map(MinimalTaskSummary::getTaskId).toList();
|
||||||
.map(MinimalTaskSummary::getTaskId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
return existingTaskIdsAuthorizedFor.isEmpty()
|
return existingTaskIdsAuthorizedFor.isEmpty()
|
||||||
? new ArrayList<>()
|
? new ArrayList<>()
|
||||||
|
|
|
@ -707,7 +707,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
}
|
}
|
||||||
if (historyEventManager.isEnabled()) {
|
if (historyEventManager.isEnabled()) {
|
||||||
taskIds.forEach(this::createTaskDeletedEvent);
|
taskIds.forEach(this::createTaskDeletedEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bulkLog;
|
return bulkLog;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.time.Instant;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import pro.taskana.TaskanaConfiguration;
|
import pro.taskana.TaskanaConfiguration;
|
||||||
|
@ -108,7 +107,7 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
|
||||||
.filter(not(entry -> entry.getKey().isEmpty()))
|
.filter(not(entry -> entry.getKey().isEmpty()))
|
||||||
.filter(not(entry -> entry.getValue().equals(countParentTask.get(entry.getKey()))))
|
.filter(not(entry -> entry.getValue().equals(countParentTask.get(entry.getKey()))))
|
||||||
.map(Map.Entry::getKey)
|
.map(Map.Entry::getKey)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
|
|
||||||
tasksToDelete =
|
tasksToDelete =
|
||||||
tasksToDelete.stream()
|
tasksToDelete.stream()
|
||||||
|
@ -116,7 +115,7 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
|
||||||
taskSummary ->
|
taskSummary ->
|
||||||
!taskIdsNotAllCompletedSameParentBusiness.contains(
|
!taskIdsNotAllCompletedSameParentBusiness.contains(
|
||||||
taskSummary.getParentBusinessProcessId()))
|
taskSummary.getParentBusinessProcessId()))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return tasksToDelete;
|
return tasksToDelete;
|
||||||
|
@ -138,8 +137,7 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
|
||||||
private int deleteTasks(List<TaskSummary> tasksToBeDeleted)
|
private int deleteTasks(List<TaskSummary> tasksToBeDeleted)
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
throws InvalidArgumentException, NotAuthorizedException {
|
||||||
|
|
||||||
List<String> tasksIdsToBeDeleted =
|
List<String> tasksIdsToBeDeleted = tasksToBeDeleted.stream().map(TaskSummary::getId).toList();
|
||||||
tasksToBeDeleted.stream().map(TaskSummary::getId).collect(Collectors.toList());
|
|
||||||
BulkOperationResults<String, TaskanaException> results =
|
BulkOperationResults<String, TaskanaException> results =
|
||||||
taskanaEngineImpl.getTaskService().deleteTasks(tasksIdsToBeDeleted);
|
taskanaEngineImpl.getTaskService().deleteTasks(tasksIdsToBeDeleted);
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class UserServiceImpl implements UserService {
|
||||||
|
|
||||||
users.forEach(user -> user.setDomains(determineDomains(user)));
|
users.forEach(user -> user.setDomains(determineDomains(user)));
|
||||||
|
|
||||||
return users.stream().map(User.class::cast).collect(Collectors.toList());
|
return users.stream().map(User.class::cast).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class ServiceProviderExtractor {
|
||||||
List<Class<?>> serviceProviders, Map<Class<?>, Object> enclosingTestInstancesByClass) {
|
List<Class<?>> serviceProviders, Map<Class<?>, Object> enclosingTestInstancesByClass) {
|
||||||
return serviceProviders.stream()
|
return serviceProviders.stream()
|
||||||
.map(clz -> instantiateClass(clz, enclosingTestInstancesByClass))
|
.map(clz -> instantiateClass(clz, enclosingTestInstancesByClass))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object instantiateClass(
|
private static Object instantiateClass(
|
||||||
|
|
|
@ -11,7 +11,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import org.springframework.beans.BeanInstantiationException;
|
import org.springframework.beans.BeanInstantiationException;
|
||||||
import org.springframework.beans.TypeMismatchException;
|
import org.springframework.beans.TypeMismatchException;
|
||||||
|
@ -220,13 +219,13 @@ public class TaskanaRestExceptionHandler extends ResponseEntityExceptionHandler
|
||||||
Arrays.stream(targetType.getEnumConstants())
|
Arrays.stream(targetType.getEnumConstants())
|
||||||
.map(Enum.class::cast)
|
.map(Enum.class::cast)
|
||||||
.map(Enum::name)
|
.map(Enum::name)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
Set<String> enumConstantSet = new HashSet<>(enumConstants);
|
Set<String> enumConstantSet = new HashSet<>(enumConstants);
|
||||||
|
|
||||||
return getRejectedValues(typeMismatchException)
|
return getRejectedValues(typeMismatchException)
|
||||||
.filter(not(enumConstantSet::contains))
|
.filter(not(enumConstantSet::contains))
|
||||||
.map(value -> new MalformedQueryParameter(queryParameter, value, enumConstants))
|
.map(value -> new MalformedQueryParameter(queryParameter, value, enumConstants))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -588,7 +588,7 @@ public class LdapClient {
|
||||||
.filter(not(LdapSettings.TASKANA_LDAP_GROUPS_OF_USER_NAME::equals))
|
.filter(not(LdapSettings.TASKANA_LDAP_GROUPS_OF_USER_NAME::equals))
|
||||||
.filter(not(LdapSettings.TASKANA_LDAP_GROUPS_OF_USER_TYPE::equals))
|
.filter(not(LdapSettings.TASKANA_LDAP_GROUPS_OF_USER_TYPE::equals))
|
||||||
.filter(p -> p.getValueFromEnv(env) == null)
|
.filter(p -> p.getValueFromEnv(env) == null)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void testMinSearchForLength(final String name) throws InvalidArgumentException {
|
void testMinSearchForLength(final String name) throws InvalidArgumentException {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package pro.taskana.monitor.rest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
@ -122,7 +121,7 @@ public class MonitorController {
|
||||||
List<PriorityColumnHeader> priorityColumnHeaders =
|
List<PriorityColumnHeader> priorityColumnHeaders =
|
||||||
Arrays.stream(columnHeaders)
|
Arrays.stream(columnHeaders)
|
||||||
.map(priorityColumnHeaderRepresentationModelAssembler::toEntityModel)
|
.map(priorityColumnHeaderRepresentationModelAssembler::toEntityModel)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
builder.withColumnHeaders(priorityColumnHeaders);
|
builder.withColumnHeaders(priorityColumnHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
||||||
import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType;
|
import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType;
|
||||||
|
@ -111,7 +110,7 @@ public class TaskController {
|
||||||
if (!taskRepresentationModel.getAttachments().stream()
|
if (!taskRepresentationModel.getAttachments().stream()
|
||||||
.filter(att -> Objects.nonNull(att.getTaskId()))
|
.filter(att -> Objects.nonNull(att.getTaskId()))
|
||||||
.filter(att -> !att.getTaskId().equals(taskRepresentationModel.getTaskId()))
|
.filter(att -> !att.getTaskId().equals(taskRepresentationModel.getTaskId()))
|
||||||
.collect(Collectors.toList())
|
.toList()
|
||||||
.isEmpty()) {
|
.isEmpty()) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
"An attachments' taskId must be empty or equal to the id of the task it belongs to");
|
"An attachments' taskId must be empty or equal to the id of the task it belongs to");
|
||||||
|
@ -715,17 +714,14 @@ public class TaskController {
|
||||||
|
|
||||||
List<TaskSummary> taskSummaries = query.list();
|
List<TaskSummary> taskSummaries = query.list();
|
||||||
|
|
||||||
List<String> taskIdsToDelete =
|
List<String> taskIdsToDelete = taskSummaries.stream().map(TaskSummary::getId).toList();
|
||||||
taskSummaries.stream().map(TaskSummary::getId).collect(Collectors.toList());
|
|
||||||
|
|
||||||
BulkOperationResults<String, TaskanaException> result =
|
BulkOperationResults<String, TaskanaException> result =
|
||||||
taskService.deleteTasks(taskIdsToDelete);
|
taskService.deleteTasks(taskIdsToDelete);
|
||||||
|
|
||||||
Set<String> failedIds = new HashSet<>(result.getFailedIds());
|
Set<String> failedIds = new HashSet<>(result.getFailedIds());
|
||||||
List<TaskSummary> successfullyDeletedTaskSummaries =
|
List<TaskSummary> successfullyDeletedTaskSummaries =
|
||||||
taskSummaries.stream()
|
taskSummaries.stream().filter(not(summary -> failedIds.contains(summary.getId()))).toList();
|
||||||
.filter(not(summary -> failedIds.contains(summary.getId())))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
return ResponseEntity.ok(
|
return ResponseEntity.ok(
|
||||||
taskSummaryRepresentationModelAssembler.toTaskanaCollectionModel(
|
taskSummaryRepresentationModelAssembler.toTaskanaCollectionModel(
|
||||||
|
|
|
@ -79,22 +79,16 @@ public class TaskRepresentationModelAssembler
|
||||||
repModel.setSecondaryObjectReferences(
|
repModel.setSecondaryObjectReferences(
|
||||||
task.getSecondaryObjectReferences().stream()
|
task.getSecondaryObjectReferences().stream()
|
||||||
.map(objectReferenceAssembler::toModel)
|
.map(objectReferenceAssembler::toModel)
|
||||||
.collect(Collectors.toList()));
|
.toList());
|
||||||
repModel.setRead(task.isRead());
|
repModel.setRead(task.isRead());
|
||||||
repModel.setTransferred(task.isTransferred());
|
repModel.setTransferred(task.isTransferred());
|
||||||
repModel.setGroupByCount(task.getGroupByCount());
|
repModel.setGroupByCount(task.getGroupByCount());
|
||||||
repModel.setAttachments(
|
repModel.setAttachments(
|
||||||
task.getAttachments().stream()
|
task.getAttachments().stream().map(attachmentAssembler::toModel).toList());
|
||||||
.map(attachmentAssembler::toModel)
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
repModel.setCustomAttributes(
|
repModel.setCustomAttributes(
|
||||||
task.getCustomAttributeMap().entrySet().stream()
|
task.getCustomAttributeMap().entrySet().stream().map(CustomAttribute::of).toList());
|
||||||
.map(CustomAttribute::of)
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
repModel.setCallbackInfo(
|
repModel.setCallbackInfo(
|
||||||
task.getCallbackInfo().entrySet().stream()
|
task.getCallbackInfo().entrySet().stream().map(CustomAttribute::of).toList());
|
||||||
.map(CustomAttribute::of)
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
repModel.setCustom1(task.getCustomField(TaskCustomField.CUSTOM_1));
|
repModel.setCustom1(task.getCustomField(TaskCustomField.CUSTOM_1));
|
||||||
repModel.setCustom2(task.getCustomField(TaskCustomField.CUSTOM_2));
|
repModel.setCustom2(task.getCustomField(TaskCustomField.CUSTOM_2));
|
||||||
repModel.setCustom3(task.getCustomField(TaskCustomField.CUSTOM_3));
|
repModel.setCustom3(task.getCustomField(TaskCustomField.CUSTOM_3));
|
||||||
|
@ -186,13 +180,11 @@ public class TaskRepresentationModelAssembler
|
||||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_7, repModel.getCustomInt7());
|
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_7, repModel.getCustomInt7());
|
||||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_8, repModel.getCustomInt8());
|
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_8, repModel.getCustomInt8());
|
||||||
task.setAttachments(
|
task.setAttachments(
|
||||||
repModel.getAttachments().stream()
|
repModel.getAttachments().stream().map(attachmentAssembler::toEntityModel).toList());
|
||||||
.map(attachmentAssembler::toEntityModel)
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
task.setSecondaryObjectReferences(
|
task.setSecondaryObjectReferences(
|
||||||
repModel.getSecondaryObjectReferences().stream()
|
repModel.getSecondaryObjectReferences().stream()
|
||||||
.map(objectReferenceAssembler::toEntity)
|
.map(objectReferenceAssembler::toEntity)
|
||||||
.collect(Collectors.toList()));
|
.toList());
|
||||||
task.setCustomAttributeMap(
|
task.setCustomAttributeMap(
|
||||||
repModel.getCustomAttributes().stream()
|
repModel.getCustomAttributes().stream()
|
||||||
.collect(Collectors.toMap(CustomAttribute::getKey, CustomAttribute::getValue)));
|
.collect(Collectors.toMap(CustomAttribute::getKey, CustomAttribute::getValue)));
|
||||||
|
|
|
@ -2,7 +2,6 @@ package pro.taskana.task.rest.assembler;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -79,14 +78,12 @@ public class TaskSummaryRepresentationModelAssembler
|
||||||
repModel.setSecondaryObjectReferences(
|
repModel.setSecondaryObjectReferences(
|
||||||
taskSummary.getSecondaryObjectReferences().stream()
|
taskSummary.getSecondaryObjectReferences().stream()
|
||||||
.map(objectReferenceAssembler::toModel)
|
.map(objectReferenceAssembler::toModel)
|
||||||
.collect(Collectors.toList()));
|
.toList());
|
||||||
repModel.setRead(taskSummary.isRead());
|
repModel.setRead(taskSummary.isRead());
|
||||||
repModel.setTransferred(taskSummary.isTransferred());
|
repModel.setTransferred(taskSummary.isTransferred());
|
||||||
repModel.setGroupByCount(taskSummary.getGroupByCount());
|
repModel.setGroupByCount(taskSummary.getGroupByCount());
|
||||||
repModel.setAttachmentSummaries(
|
repModel.setAttachmentSummaries(
|
||||||
taskSummary.getAttachmentSummaries().stream()
|
taskSummary.getAttachmentSummaries().stream().map(attachmentAssembler::toModel).toList());
|
||||||
.map(attachmentAssembler::toModel)
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
repModel.setCustom1(taskSummary.getCustomField(TaskCustomField.CUSTOM_1));
|
repModel.setCustom1(taskSummary.getCustomField(TaskCustomField.CUSTOM_1));
|
||||||
repModel.setCustom2(taskSummary.getCustomField(TaskCustomField.CUSTOM_2));
|
repModel.setCustom2(taskSummary.getCustomField(TaskCustomField.CUSTOM_2));
|
||||||
repModel.setCustom3(taskSummary.getCustomField(TaskCustomField.CUSTOM_3));
|
repModel.setCustom3(taskSummary.getCustomField(TaskCustomField.CUSTOM_3));
|
||||||
|
@ -146,14 +143,14 @@ public class TaskSummaryRepresentationModelAssembler
|
||||||
taskSummary.setSecondaryObjectReferences(
|
taskSummary.setSecondaryObjectReferences(
|
||||||
repModel.getSecondaryObjectReferences().stream()
|
repModel.getSecondaryObjectReferences().stream()
|
||||||
.map(objectReferenceAssembler::toEntity)
|
.map(objectReferenceAssembler::toEntity)
|
||||||
.collect(Collectors.toList()));
|
.toList());
|
||||||
taskSummary.setRead(repModel.isRead());
|
taskSummary.setRead(repModel.isRead());
|
||||||
taskSummary.setTransferred(repModel.isTransferred());
|
taskSummary.setTransferred(repModel.isTransferred());
|
||||||
taskSummary.setGroupByCount(repModel.getGroupByCount());
|
taskSummary.setGroupByCount(repModel.getGroupByCount());
|
||||||
taskSummary.setAttachmentSummaries(
|
taskSummary.setAttachmentSummaries(
|
||||||
repModel.getAttachmentSummaries().stream()
|
repModel.getAttachmentSummaries().stream()
|
||||||
.map(attachmentAssembler::toEntityModel)
|
.map(attachmentAssembler::toEntityModel)
|
||||||
.collect(Collectors.toList()));
|
.toList());
|
||||||
taskSummary.setCustom1(repModel.getCustom1());
|
taskSummary.setCustom1(repModel.getCustom1());
|
||||||
taskSummary.setCustom2(repModel.getCustom2());
|
taskSummary.setCustom2(repModel.getCustom2());
|
||||||
taskSummary.setCustom3(repModel.getCustom3());
|
taskSummary.setCustom3(repModel.getCustom3());
|
||||||
|
|
|
@ -3,7 +3,6 @@ package pro.taskana.user.jobs;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import pro.taskana.TaskanaConfiguration;
|
import pro.taskana.TaskanaConfiguration;
|
||||||
|
@ -64,9 +63,7 @@ public class UserInfoRefreshJob extends AbstractTaskanaJob {
|
||||||
|
|
||||||
List<User> users = ldapClient.searchUsersInUserRole();
|
List<User> users = ldapClient.searchUsersInUserRole();
|
||||||
List<User> usersAfterProcessing =
|
List<User> usersAfterProcessing =
|
||||||
users.stream()
|
users.stream().map(refreshUserPostprocessorManager::processUserAfterRefresh).toList();
|
||||||
.map(refreshUserPostprocessorManager::processUserAfterRefresh)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
addExistingConfigurationDataToUsers(usersAfterProcessing);
|
addExistingConfigurationDataToUsers(usersAfterProcessing);
|
||||||
clearExistingUsersAndGroupsAndPermissions();
|
clearExistingUsersAndGroupsAndPermissions();
|
||||||
insertNewUsers(usersAfterProcessing);
|
insertNewUsers(usersAfterProcessing);
|
||||||
|
|
|
@ -4,7 +4,6 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.beans.ConstructorProperties;
|
import java.beans.ConstructorProperties;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -313,7 +312,7 @@ public class WorkbasketController {
|
||||||
List<WorkbasketAccessItem> wbAccessItems =
|
List<WorkbasketAccessItem> wbAccessItems =
|
||||||
workbasketAccessItemRepModels.getContent().stream()
|
workbasketAccessItemRepModels.getContent().stream()
|
||||||
.map(workbasketAccessItemRepresentationModelAssembler::toEntityModel)
|
.map(workbasketAccessItemRepresentationModelAssembler::toEntityModel)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
workbasketService.setWorkbasketAccessItems(workbasketId, wbAccessItems);
|
workbasketService.setWorkbasketAccessItems(workbasketId, wbAccessItems);
|
||||||
List<WorkbasketAccessItem> updatedWbAccessItems =
|
List<WorkbasketAccessItem> updatedWbAccessItems =
|
||||||
workbasketService.getWorkbasketAccessItems(workbasketId);
|
workbasketService.getWorkbasketAccessItems(workbasketId);
|
||||||
|
|
Loading…
Reference in New Issue