From b6da50d5432cdb9b0eedd55d7563b6c6f82dc92a Mon Sep 17 00:00:00 2001 From: arolfes Date: Wed, 4 Oct 2023 08:10:48 +0200 Subject: [PATCH] reformat java code --- .../configuration/parser/PropertyParser.java | 3 +- .../internal/util/ComparableVersion.java | 1 + .../TaskHistoryEventRepresentationModel.java | 25 ++++ .../acceptance/TaskanaConfigurationTest.java | 2 +- .../update/UpdateClassificationAccTest.java | 15 +- .../jobs/AbstractTaskanaJobAccTest.java | 52 +++---- .../acceptance/user/UserServiceAccTest.java | 141 ++++++++---------- .../pro/taskana/TaskanaConfiguration.java | 10 ++ .../internal/ClassificationServiceImpl.java | 14 +- .../java/pro/taskana/task/api/TaskQuery.java | 1 + .../task/internal/models/TaskSummaryImpl.java | 8 +- .../pro/taskana/user/internal/UserMapper.java | 18 ++- .../workbasket/api/WorkbasketService.java | 1 + .../ClassificationQueryFilterParameter.java | 1 + .../ClassificationRepresentationModel.java | 3 + ...ssificationSummaryRepresentationModel.java | 18 +++ .../models/AccessIdRepresentationModel.java | 1 + .../common/rest/models/PageMetadata.java | 3 + .../TaskanaUserInfoRepresentationModel.java | 2 + .../models/ReportRepresentationModel.java | 10 ++ .../pro/taskana/task/rest/TaskController.java | 18 ++- .../rest/TaskQueryFilterCustomFields.java | 1 + .../rest/TaskQueryFilterCustomIntFields.java | 53 +++++++ .../task/rest/TaskQueryFilterParameter.java | 43 +++++- .../task/rest/TaskQueryGroupByParameter.java | 74 ++++----- .../AttachmentSummaryRepresentationModel.java | 7 + .../ObjectReferenceRepresentationModel.java | 5 + .../TaskCommentRepresentationModel.java | 6 + .../rest/models/TaskRepresentationModel.java | 1 + .../TaskSummaryRepresentationModel.java | 51 +++++++ .../pro/taskana/user/rest/UserController.java | 13 +- .../rest/models/UserRepresentationModel.java | 15 ++ ...rkbasketAccessItemRepresentationModel.java | 23 +++ ...rkbasketDefinitionRepresentationModel.java | 2 + .../models/WorkbasketRepresentationModel.java | 1 + .../WorkbasketSummaryRepresentationModel.java | 19 +++ .../task/rest/TaskControllerIntTest.java | 2 +- .../user/rest/UserControllerIntTest.java | 75 +++++----- 38 files changed, 522 insertions(+), 216 deletions(-) diff --git a/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/parser/PropertyParser.java b/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/parser/PropertyParser.java index ee7cdb8fc..61b33b76e 100644 --- a/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/parser/PropertyParser.java +++ b/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/parser/PropertyParser.java @@ -35,8 +35,7 @@ public interface PropertyParser { new SimpleParser<>(Long.class, Long::parseLong), new SimpleParser<>(String.class, Function.identity()), new SimpleParser<>(ZoneId.class, ZoneId::of)) - .collect( - Collectors.toUnmodifiableMap(PropertyParser::getTargetClass, t -> t)); + .collect(Collectors.toUnmodifiableMap(PropertyParser::getTargetClass, t -> t)); static PropertyParser getPropertyParser(Class forClass) { forClass = ReflectionUtil.wrap(forClass); diff --git a/common/taskana-common/src/main/java/pro/taskana/common/internal/util/ComparableVersion.java b/common/taskana-common/src/main/java/pro/taskana/common/internal/util/ComparableVersion.java index c07d4c201..6cefcd5ca 100644 --- a/common/taskana-common/src/main/java/pro/taskana/common/internal/util/ComparableVersion.java +++ b/common/taskana-common/src/main/java/pro/taskana/common/internal/util/ComparableVersion.java @@ -436,6 +436,7 @@ public class ComparableVersion implements Comparable { Arrays.asList("alpha", "beta", "milestone", "rc", "snapshot", "", "sp"); private static final Properties ALIASES = new Properties(); + /** * A comparable value for the empty-string qualifier. This one is used to determine if a given * qualifier makes the version older than one without a qualifier, or more recent. diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/models/TaskHistoryEventRepresentationModel.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/models/TaskHistoryEventRepresentationModel.java index 68c47d0f2..958267f44 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/models/TaskHistoryEventRepresentationModel.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/models/TaskHistoryEventRepresentationModel.java @@ -10,58 +10,83 @@ public class TaskHistoryEventRepresentationModel /** Unique Id. */ private String taskHistoryId; + /** The Id of the business process. */ private String businessProcessId; + /** The Id of the parent business process. */ private String parentBusinessProcessId; + /** The Id of the task. */ private String taskId; + /** The type of the event. */ private String eventType; + /** * The time of event creation. * *

The format is ISO-8601. */ private Instant created; + /** The Id of the user. */ private String userId; + /** The long name of the user. */ private String userLongName; + /** Domain. */ private String domain; + /** The key of the Workbasket. */ private String workbasketKey; + /** The company the referenced primary object belongs to. */ private String porCompany; + /** The type of the referenced primary object (contract, claim, policy, customer, ...). */ private String porType; + /** The (kind of) system, the referenced primary object resides in (e.g. SAP, MySystem A, ...). */ private String porSystem; + /** The instance of the system where the referenced primary object is located. */ private String porInstance; + /** The value of the primary object reference. */ private String porValue; + /** The long name of the task owner. */ private String taskOwnerLongName; + /** The key of the task's classification. */ private String taskClassificationKey; + /** The category of the task's classification. */ private String taskClassificationCategory; + /** The classification key of the task's attachment. */ private String attachmentClassificationKey; + /** The old value. */ private String oldValue; + /** The new value. */ private String newValue; + /** A custom property with name "1". */ private String custom1; + /** A custom property with name "2". */ private String custom2; + /** A custom property with name "3". */ private String custom3; + /** A custom property with name "4". */ private String custom4; + /** details of changes within the task. */ private String details; diff --git a/lib/taskana-core-test/src/test/java/acceptance/TaskanaConfigurationTest.java b/lib/taskana-core-test/src/test/java/acceptance/TaskanaConfigurationTest.java index 21efb159b..1d85d4d32 100644 --- a/lib/taskana-core-test/src/test/java/acceptance/TaskanaConfigurationTest.java +++ b/lib/taskana-core-test/src/test/java/acceptance/TaskanaConfigurationTest.java @@ -507,7 +507,7 @@ class TaskanaConfigurationTest { // user configuration .addAdditionalUserInfo(true) .minimalPermissionsToAssignDomains(Set.of(WorkbasketPermission.CUSTOM_2)) - //database configuration + // database configuration .useSpecificDb2Taskquery(false) .build(); diff --git a/lib/taskana-core-test/src/test/java/acceptance/classification/update/UpdateClassificationAccTest.java b/lib/taskana-core-test/src/test/java/acceptance/classification/update/UpdateClassificationAccTest.java index 8caadb52f..4f64d3511 100644 --- a/lib/taskana-core-test/src/test/java/acceptance/classification/update/UpdateClassificationAccTest.java +++ b/lib/taskana-core-test/src/test/java/acceptance/classification/update/UpdateClassificationAccTest.java @@ -205,13 +205,14 @@ class UpdateClassificationAccTest { .permission(WorkbasketPermission.APPEND) .buildAndStore(workbasketService, "businessadmin"); - Task task = new TaskBuilder() - .classificationSummary(classification.asSummary()) - .workbasketSummary(workbasketSummary) - .primaryObjRef(defaultTestObjectReference().build()) - .planned(Instant.parse("2021-04-27T15:34:00.000Z")) - .due(null) - .buildAndStore(taskService); + Task task = + new TaskBuilder() + .classificationSummary(classification.asSummary()) + .workbasketSummary(workbasketSummary) + .primaryObjRef(defaultTestObjectReference().build()) + .planned(Instant.parse("2021-04-27T15:34:00.000Z")) + .due(null) + .buildAndStore(taskService); classificationService.updateClassification(classification); runAssociatedJobs(); diff --git a/lib/taskana-core-test/src/test/java/acceptance/jobs/AbstractTaskanaJobAccTest.java b/lib/taskana-core-test/src/test/java/acceptance/jobs/AbstractTaskanaJobAccTest.java index d4536b2b6..9406367ad 100644 --- a/lib/taskana-core-test/src/test/java/acceptance/jobs/AbstractTaskanaJobAccTest.java +++ b/lib/taskana-core-test/src/test/java/acceptance/jobs/AbstractTaskanaJobAccTest.java @@ -105,32 +105,6 @@ class AbstractTaskanaJobAccTest { assertThat(jobsToRun).doesNotContainAnyElementsOf(taskCleanupJobs); } - @Nested - @TestInstance(Lifecycle.PER_CLASS) - class CleanCompletedTasks implements TaskanaConfigurationModifier { - @TaskanaInject TaskanaEngine taskanaEngine; - - @TaskanaInject JobMapper jobMapper; - - @Override - public Builder modify(Builder builder) { - return builder - .taskCleanupJobEnabled(true) - .jobRunEvery(Duration.ofMillis(1)) - .jobFirstRun(Instant.now().plus(5, ChronoUnit.MINUTES)); - } - - @WithAccessId(user = "admin") - @Test - void should_FindNoJobsToRunUntilFirstRunIsReached_When_CleanupScheduleIsInitialized() - throws Exception { - AbstractTaskanaJob.initializeSchedule(taskanaEngine, TaskCleanupJob.class); - - List nextJobs = jobMapper.findJobsToRun(Instant.now()); - assertThat(nextJobs).isEmpty(); - } - } - @Test void should_CreateSampleTaskanaJob_When_JobHasMoreThenOneConstructor() { @@ -172,4 +146,30 @@ class AbstractTaskanaJobAccTest { @Override protected void execute() throws TaskanaException {} } + + @Nested + @TestInstance(Lifecycle.PER_CLASS) + class CleanCompletedTasks implements TaskanaConfigurationModifier { + @TaskanaInject TaskanaEngine taskanaEngine; + + @TaskanaInject JobMapper jobMapper; + + @Override + public Builder modify(Builder builder) { + return builder + .taskCleanupJobEnabled(true) + .jobRunEvery(Duration.ofMillis(1)) + .jobFirstRun(Instant.now().plus(5, ChronoUnit.MINUTES)); + } + + @WithAccessId(user = "admin") + @Test + void should_FindNoJobsToRunUntilFirstRunIsReached_When_CleanupScheduleIsInitialized() + throws Exception { + AbstractTaskanaJob.initializeSchedule(taskanaEngine, TaskCleanupJob.class); + + List nextJobs = jobMapper.findJobsToRun(Instant.now()); + assertThat(nextJobs).isEmpty(); + } + } } diff --git a/lib/taskana-core-test/src/test/java/acceptance/user/UserServiceAccTest.java b/lib/taskana-core-test/src/test/java/acceptance/user/UserServiceAccTest.java index 610eee225..55df7aefc 100644 --- a/lib/taskana-core-test/src/test/java/acceptance/user/UserServiceAccTest.java +++ b/lib/taskana-core-test/src/test/java/acceptance/user/UserServiceAccTest.java @@ -205,54 +205,50 @@ class UserServiceAccTest { @WithAccessId(user = "user-1-1") @Test void should_DetermineDomains_When_WorkbasketPermissionsExistForUsersWithPermissions() - throws Exception { + throws Exception { Workbasket workbasketDomainA = - defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin"); + defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin"); createAccessItem( - "permissions-domaina", - workbasketDomainA, - WorkbasketPermission.READ, - WorkbasketPermission.OPEN); + "permissions-domaina", + workbasketDomainA, + WorkbasketPermission.READ, + WorkbasketPermission.OPEN); Workbasket workbasketDomainB = - defaultTestWorkbasket() - .domain("DOMAIN_B") - .buildAndStore(workbasketService, "businessadmin"); + defaultTestWorkbasket() + .domain("DOMAIN_B") + .buildAndStore(workbasketService, "businessadmin"); createAccessItem( - "permissions-domainb", - workbasketDomainB, - WorkbasketPermission.READ, - WorkbasketPermission.OPEN); + "permissions-domainb", + workbasketDomainB, + WorkbasketPermission.READ, + WorkbasketPermission.OPEN); Set users = new HashSet<>(); for (int i = 0; i < 6; i++) { users.add( - randomTestUser() - .permissions(Set.of("test1", "test2", "permissions-domaina")) - .buildAndStore(userService, "businessadmin")); + randomTestUser() + .permissions(Set.of("test1", "test2", "permissions-domaina")) + .buildAndStore(userService, "businessadmin")); } for (int i = 0; i < 4; i++) { users.add( - randomTestUser() - .permissions(Set.of("test1", "test2", "permissions-domainb")) - .buildAndStore(userService, "businessadmin")); + randomTestUser() + .permissions(Set.of("test1", "test2", "permissions-domainb")) + .buildAndStore(userService, "businessadmin")); } Set userIds = users.stream().map(User::getId).collect(Collectors.toSet()); List returnedUsers = userService.getUsers(userIds); assertThat(returnedUsers) - .extracting(User::getDomains) - .areExactly( - 6, - new Condition<>( - domains -> - Set.of(workbasketDomainA.getDomain()) - .equals(domains), "DOMAIN_A")) - .areExactly( - 4, - new Condition<>( - domains -> - Set.of(workbasketDomainB.getDomain()) - .equals(domains), "DOMAIN_B")); + .extracting(User::getDomains) + .areExactly( + 6, + new Condition<>( + domains -> Set.of(workbasketDomainA.getDomain()).equals(domains), "DOMAIN_A")) + .areExactly( + 4, + new Condition<>( + domains -> Set.of(workbasketDomainB.getDomain()).equals(domains), "DOMAIN_B")); } @WithAccessId(user = "user-1-1") @@ -634,9 +630,8 @@ class UserServiceAccTest { t -> { Set existingPerms = t.getMiddle(); Set newPerms = t.getMiddle(); - User userToUpdate = randomTestUser() - .permissions(existingPerms) - .buildAndStore(userService); + User userToUpdate = + randomTestUser().permissions(existingPerms).buildAndStore(userService); userToUpdate.setPermissions(newPerms); userService.updateUser(userToUpdate); @@ -944,8 +939,8 @@ class UserServiceAccTest { void should_DeletePermissionsFromDatabase_When_UserHadPermissions() throws Exception { User userToDelete = randomTestUser() - .permissions(Set.of("permission1", "permission2")) - .buildAndStore(userService); + .permissions(Set.of("permission1", "permission2")) + .buildAndStore(userService); userService.deleteUser(userToDelete.getId()); @@ -1045,16 +1040,16 @@ class UserServiceAccTest { @WithAccessId(user = "user-1-1") @Test void should_ReturnOneDomain_When_PermissionHasSufficientMinimalPermissionsToAssignDomains() - throws Exception { + throws Exception { String permissionsId = UUID.randomUUID().toString(); User user = - randomTestUser() - .permissions(Set.of(permissionsId)) - .buildAndStore(userService, "businessadmin"); + randomTestUser() + .permissions(Set.of(permissionsId)) + .buildAndStore(userService, "businessadmin"); Workbasket workbasket = - defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin"); - createAccessItem(permissionsId, - workbasket, WorkbasketPermission.OPEN, WorkbasketPermission.READ); + defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin"); + createAccessItem( + permissionsId, workbasket, WorkbasketPermission.OPEN, WorkbasketPermission.READ); User userInDatabase = userService.getUser(user.getId()); @@ -1112,7 +1107,7 @@ class UserServiceAccTest { @WithAccessId(user = "businessadmin") @Test void should_ReturnEmptyDomains_When_GroupHasSufficientPermissionsAndThenPermissionIsUpdated() - throws Exception { + throws Exception { String groupId = UUID.randomUUID().toString(); User user = randomTestUser().permissions(Set.of(groupId)).buildAndStore(userService); Workbasket workbasket = defaultTestWorkbasket().buildAndStore(workbasketService); @@ -1181,27 +1176,27 @@ class UserServiceAccTest { @WithAccessId(user = "user-1-1") @Test void should_ReturnMultipleDomains_When_UserAndPermHaveSufficientMinimalPermsForMultipleDomains() - throws Exception { + throws Exception { String permissionId = UUID.randomUUID().toString(); User user = - randomTestUser() - .permissions(Set.of(permissionId)) - .buildAndStore(userService, "businessadmin"); + randomTestUser() + .permissions(Set.of(permissionId)) + .buildAndStore(userService, "businessadmin"); Workbasket workbasket1 = - defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin"); + defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin"); Workbasket workbasket2 = - defaultTestWorkbasket() - .domain("DOMAIN_B") - .buildAndStore(workbasketService, "businessadmin"); + defaultTestWorkbasket() + .domain("DOMAIN_B") + .buildAndStore(workbasketService, "businessadmin"); createAccessItem( - user.getId(), workbasket1, WorkbasketPermission.OPEN, WorkbasketPermission.READ); + user.getId(), workbasket1, WorkbasketPermission.OPEN, WorkbasketPermission.READ); createAccessItem( - permissionId, workbasket2, WorkbasketPermission.OPEN, WorkbasketPermission.READ); + permissionId, workbasket2, WorkbasketPermission.OPEN, WorkbasketPermission.READ); User userInDatabase = userService.getUser(user.getId()); assertThat(userInDatabase.getDomains()) - .containsExactlyInAnyOrder(workbasket1.getDomain(), workbasket2.getDomain()); + .containsExactlyInAnyOrder(workbasket1.getDomain(), workbasket2.getDomain()); } @Nested @@ -1250,18 +1245,16 @@ class UserServiceAccTest { @WithAccessId(user = "user-1-1") @Test void should_ReturnEmptyDomains_When_PermHasInsufficientMinimalPermissionsToAssignDomains() - throws Exception { + throws Exception { String permissionId = UUID.randomUUID().toString(); User user = - randomTestUser() - .permissions(Set.of(permissionId)) - .buildAndStore(userService, "businessadmin"); + randomTestUser() + .permissions(Set.of(permissionId)) + .buildAndStore(userService, "businessadmin"); Workbasket workbasket = - defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin"); - createAccessItem(permissionId, - workbasket, - WorkbasketPermission.OPEN, - WorkbasketPermission.READ); + defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin"); + createAccessItem( + permissionId, workbasket, WorkbasketPermission.OPEN, WorkbasketPermission.READ); User userInDatabase = userService.getUser(user.getId()); @@ -1299,7 +1292,6 @@ class UserServiceAccTest { assertThat(userInDatabase.getDomains()).containsExactly(workbasket.getDomain()); } - } @Nested @@ -1346,19 +1338,16 @@ class UserServiceAccTest { @WithAccessId(user = "user-1-1") @Test - void should_ReturnEmptyDomains_When_PropertyIsNotSetAndPermission() - throws Exception { + void should_ReturnEmptyDomains_When_PropertyIsNotSetAndPermission() throws Exception { String permissionId = UUID.randomUUID().toString(); User user = - randomTestUser() - .permissions(Set.of(permissionId)) - .buildAndStore(userService, "businessadmin"); + randomTestUser() + .permissions(Set.of(permissionId)) + .buildAndStore(userService, "businessadmin"); Workbasket workbasket = - defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin"); - createAccessItem(permissionId, - workbasket, - WorkbasketPermission.OPEN, - WorkbasketPermission.READ); + defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin"); + createAccessItem( + permissionId, workbasket, WorkbasketPermission.OPEN, WorkbasketPermission.READ); User userInDatabase = userService.getUser(user.getId()); diff --git a/lib/taskana-core/src/main/java/pro/taskana/TaskanaConfiguration.java b/lib/taskana-core/src/main/java/pro/taskana/TaskanaConfiguration.java index 3759ba81a..ceac93451 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/TaskanaConfiguration.java +++ b/lib/taskana-core/src/main/java/pro/taskana/TaskanaConfiguration.java @@ -134,6 +134,7 @@ public class TaskanaConfiguration { // region custom configuration private final Map properties; + // endregion private TaskanaConfiguration(Builder builder) { @@ -717,11 +718,13 @@ public class TaskanaConfiguration { @TaskanaProperty("taskana.servicelevel.validation.enforce") private boolean enforceServiceLevel = true; + // endregion // region authentication configuration @TaskanaProperty("taskana.roles") private Map> roleMap = new EnumMap<>(TaskanaRole.class); + // endregion // region classification configuration @@ -730,6 +733,7 @@ public class TaskanaConfiguration { @TaskanaProperty("taskana.classification.categories") private Map> classificationCategoriesByType = new HashMap<>(); + // endregion // region working time configuration @@ -752,6 +756,7 @@ public class TaskanaConfiguration { @TaskanaProperty("taskana.workingTime.holidays.german.corpus-christi.enabled") private boolean germanPublicHolidaysCorpusChristiEnabled = false; + // endregion // region history configuration @@ -760,6 +765,7 @@ public class TaskanaConfiguration { @TaskanaProperty("taskana.history.logger.name") private String logHistoryLoggerName = null; // default value will be set in the logger class. + // endregion // region job configuration @@ -852,6 +858,7 @@ public class TaskanaConfiguration { @TaskanaProperty("taskana.jobs.customJobs") private Set customJobs = new HashSet<>(); + // endregion // region user configuration @@ -860,15 +867,18 @@ public class TaskanaConfiguration { @TaskanaProperty("taskana.user.minimalPermissionsToAssignDomains") private Set minimalPermissionsToAssignDomains = new HashSet<>(); + // endregion // region database configuration @TaskanaProperty("taskana.feature.useSpecificDb2Taskquery") private boolean useSpecificDb2Taskquery = true; + // endregion // region custom configuration private Map properties = Collections.emptyMap(); + // endregion public Builder(DataSource dataSource, boolean useManagedTransactions, String schemaName) { diff --git a/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationServiceImpl.java index 6b2ec9ab7..66021990c 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationServiceImpl.java @@ -179,8 +179,11 @@ public class ClassificationServiceImpl implements ClassificationService { @Override public Classification createClassification(Classification classification) - throws ClassificationAlreadyExistException, DomainNotFoundException, InvalidArgumentException, - MalformedServiceLevelException, NotAuthorizedException { + throws ClassificationAlreadyExistException, + DomainNotFoundException, + InvalidArgumentException, + MalformedServiceLevelException, + NotAuthorizedException { taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); if (!taskanaEngine.domainExists(classification.getDomain()) && !MASTER_DOMAIN.equals(classification.getDomain())) { @@ -235,8 +238,11 @@ public class ClassificationServiceImpl implements ClassificationService { @Override public Classification updateClassification(Classification classification) - throws ConcurrencyException, ClassificationNotFoundException, InvalidArgumentException, - MalformedServiceLevelException, NotAuthorizedException { + throws ConcurrencyException, + ClassificationNotFoundException, + InvalidArgumentException, + MalformedServiceLevelException, + NotAuthorizedException { taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); ClassificationImpl classificationImpl; try { diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskQuery.java b/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskQuery.java index fb72c306b..40be507a3 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskQuery.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskQuery.java @@ -975,6 +975,7 @@ public interface TaskQuery extends BaseQuery { * @return the query */ TaskQuery primaryObjectReferenceIn(ObjectReference... objectReferences); + // endregion // region primaryObjectReferenceCompany diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/models/TaskSummaryImpl.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/models/TaskSummaryImpl.java index a06ae9436..beeadfb29 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/models/TaskSummaryImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/models/TaskSummaryImpl.java @@ -219,6 +219,10 @@ public class TaskSummaryImpl implements TaskSummary { return this.groupByCount; } + public void setGroupByCount(Integer n) { + groupByCount = n; + } + @Override public Instant getDue() { return due != null ? due.truncatedTo(ChronoUnit.MILLIS) : null; @@ -493,10 +497,6 @@ public class TaskSummaryImpl implements TaskSummary { setWorkbasketSummary(workbasketSummary); } - public void setGroupByCount(Integer n) { - groupByCount = n; - } - public void addAttachmentSummary(AttachmentSummary attachmentSummary) { if (this.attachmentSummaries == null) { this.attachmentSummaries = new ArrayList<>(); diff --git a/lib/taskana-core/src/main/java/pro/taskana/user/internal/UserMapper.java b/lib/taskana-core/src/main/java/pro/taskana/user/internal/UserMapper.java index c3115ffb3..11ae85ead 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/user/internal/UserMapper.java +++ b/lib/taskana-core/src/main/java/pro/taskana/user/internal/UserMapper.java @@ -16,8 +16,10 @@ public interface UserMapper { @SelectProvider(type = UserMapperSqlProvider.class, method = "findById") @Result(property = "id", column = "USER_ID") @Result(property = "groups", column = "USER_ID", many = @Many(select = "findGroupsById")) - @Result(property = "permissions", column = "USER_ID", - many = @Many(select = "findPermissionsById")) + @Result( + property = "permissions", + column = "USER_ID", + many = @Many(select = "findPermissionsById")) @Result(property = "firstName", column = "FIRST_NAME") @Result(property = "lastName", column = "LASTNAME") @Result(property = "fullName", column = "FULL_NAME") @@ -34,8 +36,10 @@ public interface UserMapper { @Result(property = "id", column = "USER_ID") @Result(property = "groups", column = "USER_ID", many = @Many(select = "findGroupsById")) - @Result(property = "permissions", column = "USER_ID", - many = @Many(select = "findPermissionsById")) + @Result( + property = "permissions", + column = "USER_ID", + many = @Many(select = "findPermissionsById")) @Result(property = "firstName", column = "FIRST_NAME") @Result(property = "lastName", column = "LASTNAME") @Result(property = "fullName", column = "FULL_NAME") @@ -68,9 +72,9 @@ public interface UserMapper { void insertGroups(User user); @InsertProvider( - type = UserMapperSqlProvider.class, - method = "insertPermissionsOracle", - databaseId = "oracle") + type = UserMapperSqlProvider.class, + method = "insertPermissionsOracle", + databaseId = "oracle") @InsertProvider(type = UserMapperSqlProvider.class, method = "insertPermissions") void insertPermissions(User user); diff --git a/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java b/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java index e2b0df18d..fd4017300 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java +++ b/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java @@ -424,6 +424,7 @@ public interface WorkbasketService { * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin} */ WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() throws NotAuthorizedException; + // endregion // region Permission and Authorization diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationQueryFilterParameter.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationQueryFilterParameter.java index 5261a8819..7bb073f90 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationQueryFilterParameter.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationQueryFilterParameter.java @@ -90,6 +90,7 @@ public class ClassificationQueryFilterParameter */ @JsonProperty("custom-6-like") private final String[] custom6Like; + /** * Filter by the value of the field custom7. This results in a substring search.. (% is appended * to the beginning and end of the requested value). Further SQL "LIKE" wildcard characters will diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationRepresentationModel.java index b12f5291a..b1c131587 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationRepresentationModel.java @@ -8,18 +8,21 @@ public class ClassificationRepresentationModel extends ClassificationSummaryRepr /** True, if this classification to objects in this domain. */ private Boolean isValidInDomain; + /** * The creation timestamp of the classification in the system. * *

The format is ISO-8601. */ private Instant created; + /** * The timestamp of the last modification. * *

The format is ISO-8601. */ private Instant modified; + /** The description of the classification. */ private String description; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationSummaryRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationSummaryRepresentationModel.java index 056232d1c..2d22b64b2 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationSummaryRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationSummaryRepresentationModel.java @@ -10,53 +10,71 @@ public class ClassificationSummaryRepresentationModel /** Unique Id. */ @NotNull protected String classificationId; + /** * The key of the Classification. This is typically an externally known code or abbreviation of * the Classification. */ @NotNull protected String key; + /** * The logical name of the entry point. This is needed by the task list application to determine * the redirect to work on a task of this Classification. */ protected String applicationEntryPoint; + /** * The category of the classification. Categories can be configured in the file * 'taskana.properties'. */ @NotNull protected String category; + /** The domain for which this classification is specified. */ protected String domain; + /** The name of the classification. */ @NotNull protected String name; + /** The Id of the parent classification. Empty string ("") if this is a root classification. */ protected String parentId; + /** The key of the parent classification. Empty string ("") if this is a root classification. */ protected String parentKey; + /** The priority of the classification. */ @NotNull protected int priority; + /** * The service level of the classification. * *

This is stated according to ISO 8601. */ @NotNull protected String serviceLevel; + /** The type of classification. Types can be configured in the file 'taskana.properties'. */ protected String type; + /** A custom property with name "1". */ protected String custom1; + /** A custom property with name "2". */ protected String custom2; + /** A custom property with name "3". */ protected String custom3; + /** A custom property with name "4". */ protected String custom4; + /** A custom property with name "5". */ protected String custom5; + /** A custom property with name "6". */ protected String custom6; + /** A custom property with name "7". */ protected String custom7; + /** A custom property with name "8". */ protected String custom8; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/AccessIdRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/AccessIdRepresentationModel.java index 5c9e91df0..7a0f695af 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/AccessIdRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/AccessIdRepresentationModel.java @@ -8,6 +8,7 @@ public class AccessIdRepresentationModel extends RepresentationModel groupIds = new ArrayList<>(); + /** All taskana roles the current user fulfills. */ private List roles = new ArrayList<>(); diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/models/ReportRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/models/ReportRepresentationModel.java index 514ba505a..885ae8e45 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/models/ReportRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/models/ReportRepresentationModel.java @@ -13,8 +13,10 @@ public class ReportRepresentationModel extends RepresentationModel rows; + /** Array holding the sums in the columns over all rows. */ private final List sumRow; @@ -45,12 +47,16 @@ public class ReportRepresentationModel extends RepresentationModel 0, then this row is a sub-row of a prior row */ private final int depth; + /** Array containing description of the row. */ private final String[] desc; + /** Boolean identifying if the given row should be initially displayed or not. */ private final boolean display; @@ -105,12 +111,16 @@ public class ReportRepresentationModel extends RepresentationModel Objects.nonNull(att.getTaskId())) - .filter(att -> !att.getTaskId().equals(taskRepresentationModel.getTaskId())) - .collect(Collectors.toList()).isEmpty()) { + .filter(att -> Objects.nonNull(att.getTaskId())) + .filter(att -> !att.getTaskId().equals(taskRepresentationModel.getTaskId())) + .collect(Collectors.toList()) + .isEmpty()) { 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"); } Task fromResource = taskRepresentationModelAssembler.toEntityModel(taskRepresentationModel); @@ -597,11 +598,12 @@ public class TaskController { } if (!taskRepresentationModel.getAttachments().stream() - .filter(att -> Objects.nonNull(att.getTaskId())) - .filter(att -> !att.getTaskId().equals(taskRepresentationModel.getTaskId())) - .collect(Collectors.toList()).isEmpty()) { + .filter(att -> Objects.nonNull(att.getTaskId())) + .filter(att -> !att.getTaskId().equals(taskRepresentationModel.getTaskId())) + .collect(Collectors.toList()) + .isEmpty()) { 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"); } Task task = taskRepresentationModelAssembler.toEntityModel(taskRepresentationModel); diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryFilterCustomFields.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryFilterCustomFields.java index 143d98932..cb6586145 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryFilterCustomFields.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryFilterCustomFields.java @@ -395,6 +395,7 @@ public class TaskQueryFilterCustomFields implements QueryParameter /** Filter by what the task id shouldn't be. This is an exact match. */ @JsonProperty("task-id-not") private final String[] taskIdNotIn; + // endregion // region externalId /** Filter by the external id of the Task. This is an exact match. */ @@ -37,6 +38,7 @@ public class TaskQueryFilterParameter implements QueryParameter /** Filter by what the external id of the Task shouldn't be. This is an exact match. */ @JsonProperty("external-id-not") private final String[] externalIdNotIn; + // endregion // region received /** @@ -101,6 +103,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("received-until-not") private final Instant receivedUntilNot; + // endregion // region created /** @@ -164,6 +167,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("created-until-not") private final Instant createdUntilNot; + // endregion // region claimed /** @@ -183,6 +187,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("claimed-not") private final Instant[] claimedNotWithin; + // endregion // region modified /** @@ -202,6 +207,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("modified-not") private final Instant[] modifiedNotWithin; + // endregion // region planned /** @@ -265,6 +271,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("planned-until-not") private final Instant plannedUntilNot; + // endregion // region due /** @@ -328,6 +335,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("due-until-not") private final Instant dueUntilNot; + // endregion // region completed /** @@ -392,6 +400,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("completed-until-not") private final Instant completedUntilNot; + // endregion // region name /** Filter by the name of the Task. This is an exact match. */ @@ -417,6 +426,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("name-not-like") private final String[] nameNotLike; + // endregion // region creator /** Filter by creator of the Task. This is an exact match. */ @@ -442,6 +452,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("creator-not-like") private final String[] creatorNotLike; + // endregion // region note /** @@ -459,6 +470,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("note-not-like") private final String[] noteNotLike; + // endregion // region description /** @@ -476,6 +488,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("description-not-like") private final String[] descriptionNotLike; + // endregion // region priority /** Filter by the priority of the Task. This is an exact match. */ @@ -509,6 +522,7 @@ public class TaskQueryFilterParameter implements QueryParameter /** Filter by excluding priority up to the given value (inclusive). */ @JsonProperty("priority-not-until") private final Integer priorityNotUntil; + // endregion // region state /** Filter by the Task state. This is an exact match. */ @@ -518,6 +532,7 @@ public class TaskQueryFilterParameter implements QueryParameter /** Filter by what the Task state shouldn't be. This is an exact match. */ @JsonProperty("state-not") private final TaskState[] stateNotIn; + // endregion // region classificationId /** Filter by the classification id of the Task. This is an exact match. */ @@ -527,6 +542,7 @@ public class TaskQueryFilterParameter implements QueryParameter /** Filter by what the classification id of the Task shouldn't be. This is an exact match. */ @JsonProperty("classification-id-not") private final String[] classificationIdNotIn; + // endregion // region classificationKey /** Filter by the classification key of the Task. This is an exact match. */ @@ -552,6 +568,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("classification-key-not-like") private final String[] classificationKeyNotLike; + // endregion // region classificationParentKey /** @@ -583,6 +600,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("classification-parent-key-not-like") private final String[] classificationParentKeyNotLike; + // endregion // region classificationCategory /** Filter by the classification category of the Task. This is an exact match. */ @@ -610,6 +628,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("classification-category-not-like") private final String[] classificationCategoryNotLike; + // endregion // region classificationName /** Filter by the classification name of the Task. This is an exact match. */ @@ -635,6 +654,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("classification-name-not-like") private final String[] classificationNameNotLike; + // endregion // region workbasketId /** Filter by workbasket id of the Task. This is an exact match. */ @@ -644,6 +664,7 @@ public class TaskQueryFilterParameter implements QueryParameter /** Filter by what the workbasket id of the Task shouldn't be. This is an exact match. */ @JsonProperty("workbasket-id-not") private final String[] workbasketIdNotIn; + // endregion // region workbasketKeyDomain /** @@ -663,6 +684,7 @@ public class TaskQueryFilterParameter implements QueryParameter /** Filter by domain of the Task. This is an exact match. */ @JsonProperty("domain") private final String domain; + // endregion // region businessProcessId /** Filter by the business process id of the Task. This is an exact match. */ @@ -749,6 +771,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("owner-is-null") private final String ownerNull; + // endregion // region primaryObjectReference /** @@ -759,6 +782,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("por") private final ObjectReference[] primaryObjectReferenceIn; + // endregion // region primaryObjectReferenceCompany /** Filter by the company of the primary object reference of the Task. This is an exact match. */ @@ -787,6 +811,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("por-company-not-like") private final String[] porCompanyNotLike; + // endregion // region primaryObjectReferenceSystem /** Filter by the system of the primary object reference of the Task. This is an exact match. */ @@ -815,6 +840,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("por-system-not-like") private final String[] porSystemNotLike; + // endregion // region primaryObjectReferenceSystemInstance /** @@ -846,6 +872,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("por-instance-not-like") private final String[] porInstanceNotLike; + // endregion // region primaryObjectReferenceSystemType /** Filter by the type of the primary object reference of the Task. This is an exact match. */ @@ -874,6 +901,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("por-type-not-like") private final String[] porTypeNotLike; + // endregion // region primaryObjectReferenceSystemValue /** Filter by the value of the primary object reference of the Task. This is an exact match. */ @@ -902,6 +930,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("por-value-not-like") private final String[] porValueNotLike; + // endregion // region secondaryObjectReference /** @@ -912,6 +941,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("sor") private final ObjectReference[] secondaryObjectReferenceIn; + // endregion // region secondaryObjectReferenceCompany /** @@ -992,11 +1022,13 @@ public class TaskQueryFilterParameter implements QueryParameter /** Filter by the is read flag of the Task. This is an exact match. */ @JsonProperty("is-read") private final Boolean isRead; + // endregion // region transferred /** Filter by the is transferred flag of the Task. This is an exact match. */ @JsonProperty("is-transferred") private final Boolean isTransferred; + // endregion // region attachmentClassificationId /** Filter by the attachment classification id of the Task. This is an exact match. */ @@ -1009,6 +1041,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("attachment-classification-id-not") private final String[] attachmentClassificationIdNotIn; + // endregion // region attachmentClassificationKey /** Filter by the attachment classification key of the Task. This is an exact match. */ @@ -1037,6 +1070,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("attachment-classification-key-not-like") private final String[] attachmentClassificationKeyNotLike; + // endregion // region attachmentClassificationName /** Filter by the attachment classification name of the Task. This is an exact match. */ @@ -1065,6 +1099,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("attachment-classification-name-not-like") private final String[] attachmentClassificationNameNotLike; + // endregion // region attachmentChannel /** Filter by the attachment channel of the Task. This is an exact match. */ @@ -1090,6 +1125,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("attachment-channel-not-like") private final String[] attachmentChannelNotLike; + // endregion // region attachmentReferenceValue /** Filter by the attachment reference of the Task. This is an exact match. */ @@ -1115,6 +1151,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("attachment-reference-not-like") private final String[] attachmentReferenceNotLike; + // endregion // region attachmentReceived /** @@ -1134,6 +1171,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("attachment-received-not") private final Instant[] attachmentReceivedNotWithin; + // endregion // region withoutAttachment /** @@ -1142,6 +1180,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("without-attachment") private final Boolean withoutAttachment; + // endregion // region callbackState /** Filter by the callback state of the Task. This is an exact match. */ @@ -1151,6 +1190,7 @@ public class TaskQueryFilterParameter implements QueryParameter /** Filter by what the callback state of the Task shouldn't be. This is an exact match. */ @JsonProperty("callback-state-not") private final CallbackState[] callbackStateNotIn; + // endregion // region wildcardSearchValue /** @@ -1168,6 +1208,7 @@ public class TaskQueryFilterParameter implements QueryParameter */ @JsonProperty("wildcard-search-value") private final String wildcardSearchValue; + // endregion // region constructor @@ -2203,7 +2244,7 @@ public class TaskQueryFilterParameter implements QueryParameter return this.ownerIn; } if (this.ownerIn == null) { - return new String[]{null}; + return new String[] {null}; } List ownerInAsList = new ArrayList(Arrays.asList(this.ownerIn)); ownerInAsList.add(null); diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryGroupByParameter.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryGroupByParameter.java index 40c21f021..638fb700b 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryGroupByParameter.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryGroupByParameter.java @@ -9,6 +9,43 @@ import pro.taskana.common.rest.QueryParameter; import pro.taskana.task.api.TaskQuery; public class TaskQueryGroupByParameter implements QueryParameter { + // region groupBy + @JsonProperty("group-by") + private final TaskQueryGroupBy groupByPor; + @JsonProperty("group-by-sor") + private final String groupBySor; + + @ConstructorProperties({"group-by", "group-by-sor"}) + public TaskQueryGroupByParameter(TaskQueryGroupBy groupBy, String groupBySor) + throws InvalidArgumentException { + this.groupByPor = groupBy; + this.groupBySor = groupBySor; + validateGroupByParameters(); + } + + // endregion + + // region constructor + + @Override + public Void apply(TaskQuery query) { + + Optional.ofNullable(groupBySor).ifPresent(query::groupBySor); + Optional.ofNullable(groupByPor) + .ifPresent(taskQueryGroupBy -> taskQueryGroupBy.applyGroupByForQuery(query)); + + return null; + } + + // endregion + + private void validateGroupByParameters() throws InvalidArgumentException { + if (groupByPor != null && groupBySor != null) { + throw new InvalidArgumentException( + "Only one of the following can be provided: Either group-by or group-by-sor"); + } + } + public enum TaskQueryGroupBy { POR_VALUE(TaskQuery::groupByPor); private final Consumer consumer; @@ -21,41 +58,4 @@ public class TaskQueryGroupByParameter implements QueryParameter taskQueryGroupBy.applyGroupByForQuery(query)); - - return null; - } - - private void validateGroupByParameters() throws InvalidArgumentException { - if (groupByPor != null && groupBySor != null) { - throw new InvalidArgumentException( - "Only one of the following can be provided: Either group-by or group-by-sor"); - } - } } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/AttachmentSummaryRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/AttachmentSummaryRepresentationModel.java index 2685164ef..6d773e453 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/AttachmentSummaryRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/AttachmentSummaryRepresentationModel.java @@ -11,18 +11,25 @@ public class AttachmentSummaryRepresentationModel /** Unique Id. */ protected String attachmentId; + /** the referenced task id. */ protected String taskId; + /** The creation timestamp in the system. */ protected Instant created; + /** The timestamp of the last modification. */ protected Instant modified; + /** The timestamp of the entry date. */ protected Instant received; + /** The classification of this attachment. */ protected ClassificationSummaryRepresentationModel classificationSummary; + /** The Objects primary ObjectReference. */ protected ObjectReferenceRepresentationModel objectReference; + /** Determines on which channel this attachment was received. */ protected String channel; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/ObjectReferenceRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/ObjectReferenceRepresentationModel.java index fd2cacd99..e76c2300c 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/ObjectReferenceRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/ObjectReferenceRepresentationModel.java @@ -10,14 +10,19 @@ public class ObjectReferenceRepresentationModel /** Task Id. */ private String taskId; + /** The company the referenced primary object belongs to. */ private String company; + /** The (kind of) system, the referenced primary object resides in (e.g. SAP, MySystem A, ...). */ private String system; + /** The instance of the system where the referenced primary object is located. */ private String systemInstance; + /** The type of the referenced primary object (contract, claim, policy, customer, ...). */ private String type; + /** The value of the primary object reference. */ private String value; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskCommentRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskCommentRepresentationModel.java index 3d57d9d8f..46b2e2bc9 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskCommentRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskCommentRepresentationModel.java @@ -10,16 +10,22 @@ public class TaskCommentRepresentationModel /** Unique Id. */ private String taskCommentId; + /** Task Id. Can identify the task the comment belongs to. */ private String taskId; + /** The content of the comment. */ private String textField; + /** The creator of the task comment. */ private String creator; + /** The long name of the task comment creator. */ private String creatorFullName; + /** The creation timestamp in the system. */ private Instant created; + /** Timestamp of the last task comment modification. */ private Instant modified; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskRepresentationModel.java index 4dc3b5935..a88aeecd1 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskRepresentationModel.java @@ -53,6 +53,7 @@ public class TaskRepresentationModel extends TaskSummaryRepresentationModel { /** the key of the custom attribute. */ private String key; + /** the value of the custom attribute. */ private String value; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java index 9de67262c..8ec4b9e1a 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java @@ -16,121 +16,172 @@ public class TaskSummaryRepresentationModel /** Unique Id. */ protected String taskId; + /** * External Id. Can be used to enforce idempotence at task creation. Can identify an external * task. */ protected String externalId; + /** The creation timestamp in the system. */ protected Instant created; + /** The timestamp of the last claim-operation. */ protected Instant claimed; + /** The timestamp of the completion. */ protected Instant completed; + /** The timestamp of the last modification. */ protected Instant modified; + /** * Planned start of the task. The actual completion of the task should be between PLANNED and DUE. */ protected Instant planned; + /** * Timestamp when the task has been received. It notes when the surrounding process started and * not just when the actual task was created. */ protected Instant received; + /** * Timestamp when the task is due. The actual completion of the task should be between PLANNED and * DUE. */ protected Instant due; + /** The name of the task. */ protected String name; + /** the creator of the task. */ protected String creator; + /** note. */ protected String note; + /** The description of the task. */ protected String description; + /** The priority of the task. */ protected int priority; + /** * The manual priority of the task. If the value of manualPriority is zero or greater, the * priority is automatically set to manualPriority. In this case, all computations of priority are * disabled. If the value of manualPriority is negative, Tasks are not prioritized manually. */ protected int manualPriority = DEFAULT_MANUAL_PRIORITY; + /** The current task state. */ protected TaskState state; + /** The classification of this task. */ @NotNull protected ClassificationSummaryRepresentationModel classificationSummary; + /** The workbasket this task resides in. */ @NotNull protected WorkbasketSummaryRepresentationModel workbasketSummary; + /** The business process id. */ protected String businessProcessId; + /** the parent business process id. */ protected String parentBusinessProcessId; + /** The owner of the task. The owner is set upon claiming of the task. */ protected String owner; + /** The long name of the task owner. */ protected String ownerLongName; + /** The Objects primary ObjectReference. */ @NotNull protected ObjectReferenceRepresentationModel primaryObjRef; + /** Indicator if the task has been read. */ protected boolean isRead; + /** Indicator if the task has been transferred. */ protected boolean isTransferred; + /** Number of Tasks that are grouped together with this Task during a groupBy. */ protected Integer groupByCount; + /** A custom property with name "1". */ protected String custom1; + /** A custom property with name "2". */ protected String custom2; + /** A custom property with name "3". */ protected String custom3; + /** A custom property with name "4". */ protected String custom4; + /** A custom property with name "5". */ protected String custom5; + /** A custom property with name "6". */ protected String custom6; + /** A custom property with name "7". */ protected String custom7; + /** A custom property with name "8". */ protected String custom8; + /** A custom property with name "9". */ protected String custom9; + /** A custom property with name "10". */ protected String custom10; + /** A custom property with name "11". */ protected String custom11; + /** A custom property with name "12". */ protected String custom12; + /** A custom property with name "13". */ protected String custom13; + /** A custom property with name "14". */ protected String custom14; + /** A custom property with name "15". */ protected String custom15; + /** A custom property with name "16". */ protected String custom16; + /** A custom int property with name "1". */ protected Integer customInt1; + /** A custom int property with name "2". */ protected Integer customInt2; + /** A custom int property with name "3". */ protected Integer customInt3; + /** A custom int property with name "4". */ protected Integer customInt4; + /** A custom int property with name "5". */ protected Integer customInt5; + /** A custom int property with name "6". */ protected Integer customInt6; + /** A custom int property with name "7". */ protected Integer customInt7; + /** A custom int property with name "8". */ protected Integer customInt8; + /** Secondary object references of the task. */ protected List secondaryObjectReferences = new ArrayList<>(); + /** The attachment summaries of this task. */ private List attachmentSummaries = new ArrayList<>(); diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/user/rest/UserController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/user/rest/UserController.java index d82dc52ad..6ee814daa 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/user/rest/UserController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/user/rest/UserController.java @@ -41,9 +41,10 @@ public class UserController { private final CurrentUserContext currentUserContext; @Autowired - UserController(UserService userService, - UserRepresentationModelAssembler userAssembler, - CurrentUserContext currentUserContext) { + UserController( + UserService userService, + UserRepresentationModelAssembler userAssembler, + CurrentUserContext currentUserContext) { this.userService = userService; this.userAssembler = userAssembler; this.currentUserContext = currentUserContext; @@ -68,8 +69,8 @@ public class UserController { /** * This endpoint retrieves multiple Users. If a userId can't be found in the database it will be - * ignored. If none of the given userIds is valid, the returned list will be empty. - * If currentUser is set, the current User from the context will be retrieved as well + * ignored. If none of the given userIds is valid, the returned list will be empty. If currentUser + * is set, the current User from the context will be retrieved as well * * @title Get multiple Users * @param request the HttpServletRequest of the request itself @@ -85,7 +86,7 @@ public class UserController { HttpServletRequest request, @RequestParam(name = "user-id", required = false) String[] userIds, @RequestParam(name = "current-user", required = false) String currentUser) - throws InvalidArgumentException, UserNotFoundException { + throws InvalidArgumentException, UserNotFoundException { Set users = new HashSet<>(); if (userIds != null) { diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/user/rest/models/UserRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/user/rest/models/UserRepresentationModel.java index e8e29793a..ba78386d5 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/user/rest/models/UserRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/user/rest/models/UserRepresentationModel.java @@ -12,10 +12,13 @@ public class UserRepresentationModel extends RepresentationModel groups; + /** The permissions of the User. */ private Set permissions; + /** * The domains of the User. * @@ -23,28 +26,40 @@ public class UserRepresentationModel extends RepresentationModel domains = Collections.emptySet(); + /** The first name of the User. */ private String firstName; + /** The last name of the User. */ private String lastName; + /** The full name of the User. */ private String fullName; + /** The long name of the User. */ private String longName; + /** The email of the User. */ private String email; + /** The phone number of the User. */ private String phone; + /** The mobile phone number of the User. */ private String mobilePhone; + /** The fourth organisation level of the User. */ private String orgLevel4; + /** The third organisation level of the User. */ private String orgLevel3; + /** The second organisation level of the User. */ private String orgLevel2; + /** The first organisation level of the User. */ private String orgLevel1; + /** The data of the User. This field is used for additional information about the User. */ private String data; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketAccessItemRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketAccessItemRepresentationModel.java index 97e75cd2b..3fed09ee0 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketAccessItemRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketAccessItemRepresentationModel.java @@ -9,52 +9,75 @@ public class WorkbasketAccessItemRepresentationModel /** Unique Id. */ private String accessItemId; + /** The workbasket Id. */ private String workbasketId; + /** The Access Id. This could be either a user Id or a full qualified group Id. */ private String accessId; + /** The workbasket key. */ private String workbasketKey; + /** The name. */ private String accessName; + /** The permission to read the information about the workbasket. */ private boolean permRead; + /** The permission to access a task from the workbasket. */ private boolean permReadTasks; + /** The permission to view the content (the tasks) of a workbasket. */ private boolean permOpen; + /** * The permission to add tasks to the workbasket. Required for creation and transferring of tasks. */ private boolean permAppend; + /** The permission to edit a task from the workbasket. */ private boolean permEditTasks; + /** The permission to transfer tasks (out of the current workbasket). */ private boolean permTransfer; + /** The permission to distribute tasks from the workbasket. */ private boolean permDistribute; + /** The custom permission with the name "1". */ private boolean permCustom1; + /** The custom permission with the name "2". */ private boolean permCustom2; + /** The custom permission with the name "3". */ private boolean permCustom3; + /** The custom permission with the name "4". */ private boolean permCustom4; + /** The custom permission with the name "5". */ private boolean permCustom5; + /** The custom permission with the name "6". */ private boolean permCustom6; + /** The custom permission with the name "7". */ private boolean permCustom7; + /** The custom permission with the name "8". */ private boolean permCustom8; + /** The custom permission with the name "9". */ private boolean permCustom9; + /** The custom permission with the name "10". */ private boolean permCustom10; + /** The custom permission with the name "11". */ private boolean permCustom11; + /** The custom permission with the name "12". */ private boolean permCustom12; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketDefinitionRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketDefinitionRepresentationModel.java index db3953134..6b32571c0 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketDefinitionRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketDefinitionRepresentationModel.java @@ -14,8 +14,10 @@ public class WorkbasketDefinitionRepresentationModel /** The workbasket which is represented. */ @JsonIgnoreProperties("_links") private WorkbasketRepresentationModel workbasket; + /** The workbasket authorizations. */ private Collection authorizations = new ArrayList<>(); + /** The distribution targets for this workbasket. */ private Set distributionTargets = new HashSet<>(); diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketRepresentationModel.java index a3319ca5a..6dfaffc51 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketRepresentationModel.java @@ -12,6 +12,7 @@ public class WorkbasketRepresentationModel extends WorkbasketSummaryRepresentati *

The format is ISO-8601. */ private Instant created; + /** * The timestamp of the last modification. * diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketSummaryRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketSummaryRepresentationModel.java index edd24e4f7..a8b0b74e6 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketSummaryRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/models/WorkbasketSummaryRepresentationModel.java @@ -10,37 +10,52 @@ public class WorkbasketSummaryRepresentationModel /** Unique Id. */ protected String workbasketId; + /** the professional key for the workbasket. */ protected String key; + /** The name of the workbasket. */ protected String name; + /** The domain the workbasket belongs to. */ protected String domain; + /** The type of the workbasket. */ protected WorkbasketType type; + /** the description of the workbasket. */ protected String description; + /** * The owner of the workbasket. The owner is responsible for the on-time completion of all tasks * in the workbasket. */ protected String owner; + /** A custom property with name "1". */ protected String custom1; + /** A custom property with name "2". */ protected String custom2; + /** A custom property with name "3". */ protected String custom3; + /** A custom property with name "4". */ protected String custom4; + /** A custom property with name "5". */ protected String custom5; + /** A custom property with name "6". */ protected String custom6; + /** A custom property with name "7". */ protected String custom7; + /** A custom property with name "8". */ protected String custom8; + /** * The first Org Level (the top one). * @@ -49,12 +64,16 @@ public class WorkbasketSummaryRepresentationModel * tasks in the workbasket. */ protected String orgLevel1; + /** The second Org Level. */ protected String orgLevel2; + /** The third Org Level. */ protected String orgLevel3; + /** The fourth Org Level (the lowest one). */ protected String orgLevel4; + /** Identifier to tell if this workbasket can be deleted. */ private boolean markedForDeletion; diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java index 3f964d507..451bde59f 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java @@ -61,7 +61,6 @@ import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel; @TaskanaSpringBootTest class TaskControllerIntTest { - @Autowired TaskanaConfiguration taskanaConfiguration; private static final ParameterizedTypeReference TASK_SUMMARY_PAGE_MODEL_TYPE = new ParameterizedTypeReference<>() {}; private static final ParameterizedTypeReference @@ -71,6 +70,7 @@ class TaskControllerIntTest { private final RestHelper restHelper; private final DataSource dataSource; private final String schemaName; + @Autowired TaskanaConfiguration taskanaConfiguration; @Autowired TaskControllerIntTest( diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/user/rest/UserControllerIntTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/user/rest/UserControllerIntTest.java index 9ef02b3c3..553705d20 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/user/rest/UserControllerIntTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/user/rest/UserControllerIntTest.java @@ -69,11 +69,11 @@ class UserControllerIntTest { HttpEntity auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1")); ResponseEntity response = - TEMPLATE.exchange( - url, - HttpMethod.GET, - auth, - ParameterizedTypeReference.forType(UserCollectionRepresentationModel.class)); + TEMPLATE.exchange( + url, + HttpMethod.GET, + auth, + ParameterizedTypeReference.forType(UserCollectionRepresentationModel.class)); assertThat(response.getBody()).isNotNull(); assertThat(response.getBody().getContent()).hasSize(1); assertThat(response.getBody().getContent()).extracting("userId").containsExactly("teamlead-1"); @@ -85,16 +85,17 @@ class UserControllerIntTest { HttpEntity auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1")); ThrowingCallable httpCall = - () -> TEMPLATE.exchange( - url, - HttpMethod.GET, - auth, - ParameterizedTypeReference.forType(UserCollectionRepresentationModel.class)); + () -> + TEMPLATE.exchange( + url, + HttpMethod.GET, + auth, + ParameterizedTypeReference.forType(UserCollectionRepresentationModel.class)); assertThatThrownBy(httpCall) - .isInstanceOf(HttpStatusCodeException.class) - .extracting(HttpStatusCodeException.class::cast) - .extracting(HttpStatusCodeException::getStatusCode) - .isEqualTo(HttpStatus.BAD_REQUEST); + .isInstanceOf(HttpStatusCodeException.class) + .extracting(HttpStatusCodeException.class::cast) + .extracting(HttpStatusCodeException::getStatusCode) + .isEqualTo(HttpStatus.BAD_REQUEST); } @Test @@ -103,16 +104,17 @@ class UserControllerIntTest { HttpEntity auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1")); ThrowingCallable httpCall = - () -> TEMPLATE.exchange( - url, - HttpMethod.GET, - auth, - ParameterizedTypeReference.forType(UserCollectionRepresentationModel.class)); + () -> + TEMPLATE.exchange( + url, + HttpMethod.GET, + auth, + ParameterizedTypeReference.forType(UserCollectionRepresentationModel.class)); assertThatThrownBy(httpCall) - .isInstanceOf(HttpStatusCodeException.class) - .extracting(HttpStatusCodeException.class::cast) - .extracting(HttpStatusCodeException::getStatusCode) - .isEqualTo(HttpStatus.BAD_REQUEST); + .isInstanceOf(HttpStatusCodeException.class) + .extracting(HttpStatusCodeException.class::cast) + .extracting(HttpStatusCodeException::getStatusCode) + .isEqualTo(HttpStatus.BAD_REQUEST); } @Test @@ -121,11 +123,11 @@ class UserControllerIntTest { HttpEntity auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1")); ResponseEntity response = - TEMPLATE.exchange( - url, - HttpMethod.GET, - auth, - ParameterizedTypeReference.forType(UserCollectionRepresentationModel.class)); + TEMPLATE.exchange( + url, + HttpMethod.GET, + auth, + ParameterizedTypeReference.forType(UserCollectionRepresentationModel.class)); assertThat(response.getBody()).isNotNull(); assertThat(response.getBody().getContent()).hasSize(1); assertThat(response.getBody().getContent()).extracting("userId").containsExactly("teamlead-1"); @@ -133,22 +135,23 @@ class UserControllerIntTest { @Test void should_ReturnExistingUsersAndCurrentUser() throws Exception { - String url = restHelper.toUrl(RestEndpoints.URL_USERS) + String url = + restHelper.toUrl(RestEndpoints.URL_USERS) + "?user-id=user-1-1&user-id=USER-1-2¤t-user"; HttpEntity auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1")); ResponseEntity responseEntity = - TEMPLATE.exchange( - url, - HttpMethod.GET, - auth, - ParameterizedTypeReference.forType(UserCollectionRepresentationModel.class)); + TEMPLATE.exchange( + url, + HttpMethod.GET, + auth, + ParameterizedTypeReference.forType(UserCollectionRepresentationModel.class)); UserCollectionRepresentationModel response = responseEntity.getBody(); assertThat(response).isNotNull(); assertThat(response.getContent()).hasSize(3); assertThat(response.getContent()) - .extracting("userId") - .containsExactlyInAnyOrder("user-1-1", "user-1-2", "teamlead-1"); + .extracting("userId") + .containsExactlyInAnyOrder("user-1-1", "user-1-2", "teamlead-1"); } @Test