reformatted code
This commit is contained in:
parent
02e05a7d3b
commit
a2318c267e
|
@ -13,9 +13,7 @@ import pro.taskana.spi.history.api.TaskanaHistory;
|
|||
import pro.taskana.spi.history.api.events.TaskanaHistoryEvent;
|
||||
import pro.taskana.spi.history.api.exceptions.TaskanaHistoryEventNotFoundException;
|
||||
|
||||
/**
|
||||
* This is the implementation of TaskanaHistory.
|
||||
*/
|
||||
/** This is the implementation of TaskanaHistory. */
|
||||
public class SimpleHistoryServiceImpl implements TaskanaHistory {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleHistoryServiceImpl.class);
|
||||
|
@ -25,7 +23,7 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
|
|||
|
||||
@Override
|
||||
public void initialize(TaskanaEngineConfiguration taskanaEngineConfiguration) {
|
||||
|
||||
|
||||
this.taskanaHistoryEngine = getTaskanaEngine(taskanaEngineConfiguration);
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
|
|
|
@ -485,7 +485,6 @@ public class TaskHistoryEventController extends AbstractPagingController {
|
|||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private TimeInterval getTimeIntervalOf(String[] created) {
|
||||
|
|
|
@ -32,24 +32,24 @@ public class TaskHistoryEventListResourceAssembler extends AbstractRessourcesAss
|
|||
.withRel(IanaLinkRelations.FIRST));
|
||||
pagedResources.add(
|
||||
Link.of(
|
||||
this.getOriginal()
|
||||
.replaceQueryParam("page", pageMetadata.getTotalPages())
|
||||
.toUriString())
|
||||
this.getOriginal()
|
||||
.replaceQueryParam("page", pageMetadata.getTotalPages())
|
||||
.toUriString())
|
||||
.withRel(IanaLinkRelations.LAST));
|
||||
if (pageMetadata.getNumber() > 1) {
|
||||
pagedResources.add(
|
||||
Link.of(
|
||||
this.getOriginal()
|
||||
.replaceQueryParam("page", pageMetadata.getNumber() - 1)
|
||||
.toUriString())
|
||||
this.getOriginal()
|
||||
.replaceQueryParam("page", pageMetadata.getNumber() - 1)
|
||||
.toUriString())
|
||||
.withRel(IanaLinkRelations.PREV));
|
||||
}
|
||||
if (pageMetadata.getNumber() < pageMetadata.getTotalPages()) {
|
||||
pagedResources.add(
|
||||
Link.of(
|
||||
this.getOriginal()
|
||||
.replaceQueryParam("page", pageMetadata.getNumber() + 1)
|
||||
.toUriString())
|
||||
this.getOriginal()
|
||||
.replaceQueryParam("page", pageMetadata.getNumber() + 1)
|
||||
.toUriString())
|
||||
.withRel(IanaLinkRelations.NEXT));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -396,9 +396,7 @@ public class ClassificationQueryImpl implements ClassificationQuery {
|
|||
taskanaEngine.returnConnection();
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"exit from list(). Returning {} resulting Objects: {} ",
|
||||
result.size(),
|
||||
result);
|
||||
"exit from list(). Returning {} resulting Objects: {} ", result.size(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -450,9 +448,7 @@ public class ClassificationQueryImpl implements ClassificationQuery {
|
|||
taskanaEngine.returnConnection();
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"Exit from listValues. Returning {} resulting Objects: {} ",
|
||||
result.size(),
|
||||
result);
|
||||
"Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,10 +45,6 @@ public class GroupPrincipal implements Group {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GroupPrincipal [name="
|
||||
+ name
|
||||
+ ", members="
|
||||
+ this.members
|
||||
+ "]";
|
||||
return "GroupPrincipal [name=" + name + ", members=" + this.members + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,4 +18,3 @@ public interface CheckedConsumer<T, E extends Throwable> {
|
|||
|
||||
void accept(T t) throws E;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ public abstract class FoldableRow<I extends QueryItem> extends SingleRow<I> {
|
|||
@Override
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"FoldableRow [detailRows= %s, columnSize= %d]",
|
||||
this.foldableRows, columnSize);
|
||||
"FoldableRow [detailRows= %s, columnSize= %d]", this.foldableRows, columnSize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ public class WorkingDaysToDaysReportConverter {
|
|||
}
|
||||
|
||||
public static WorkingDaysToDaysReportConverter initialize(
|
||||
List<? extends TimeIntervalColumnHeader> columnHeaders,
|
||||
WorkingDaysToDaysConverter converter) throws InvalidArgumentException {
|
||||
List<? extends TimeIntervalColumnHeader> columnHeaders, WorkingDaysToDaysConverter converter)
|
||||
throws InvalidArgumentException {
|
||||
return initialize(columnHeaders, converter, Instant.now());
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,7 @@ package pro.taskana.task.api;
|
|||
|
||||
import pro.taskana.common.api.QueryColumnName;
|
||||
|
||||
/**
|
||||
* Enum containing the column names for TaskQueryMapper.queryTaskColumnValues.
|
||||
*
|
||||
*/
|
||||
/** Enum containing the column names for TaskQueryMapper.queryTaskColumnValues. */
|
||||
public enum TaskQueryColumnName implements QueryColumnName {
|
||||
ID("t.id"),
|
||||
EXTERNAL_ID("t.external_id"),
|
||||
|
|
|
@ -84,9 +84,7 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
|
|||
taskanaEngine.returnConnection();
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"exit from list(). Returning {} resulting Objects: {} ",
|
||||
result.size(),
|
||||
result);
|
||||
"exit from list(). Returning {} resulting Objects: {} ", result.size(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,9 +136,7 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
|
|||
taskanaEngine.returnConnection();
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"Exit from listValues. Returning {} resulting Objects: {} ",
|
||||
result.size(),
|
||||
result);
|
||||
"Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,8 +162,7 @@ public interface TaskMapper {
|
|||
+ " WHERE ID IN <foreach item='taskId' index='index' separator=',' open='(' close=')' collection='taskIds'>#{taskId}</foreach>"
|
||||
+ "</script>")
|
||||
void updateCompleted(
|
||||
@Param("taskIds") List<String> taskIds,
|
||||
@Param("referenceTask") TaskSummary referenceTask);
|
||||
@Param("taskIds") List<String> taskIds, @Param("referenceTask") TaskSummary referenceTask);
|
||||
|
||||
@Update(
|
||||
"<script>"
|
||||
|
@ -171,8 +170,7 @@ public interface TaskMapper {
|
|||
+ " WHERE ID IN <foreach item='taskId' index='index' separator=',' open='(' close=')' collection='taskIds'>#{taskId}</foreach>"
|
||||
+ "</script>")
|
||||
void updateClaimed(
|
||||
@Param("taskIds") List<String> taskIds,
|
||||
@Param("referenceTask") TaskSummary referenceTask);
|
||||
@Param("taskIds") List<String> taskIds, @Param("referenceTask") TaskSummary referenceTask);
|
||||
|
||||
@Select(
|
||||
"<script>SELECT ID, EXTERNAL_ID, STATE, WORKBASKET_ID, OWNER, MODIFIED, CLASSIFICATION_ID, "
|
||||
|
@ -298,5 +296,4 @@ public interface TaskMapper {
|
|||
@Results(value = {@Result(property = "id", column = "ID")})
|
||||
List<String> filterTaskIdsNotAuthorizedFor(
|
||||
@Param("taskIds") List<String> taskIds, @Param("accessIds") List<String> accessIds);
|
||||
|
||||
}
|
||||
|
|
|
@ -976,10 +976,7 @@ public class TaskQueryImpl implements TaskQuery {
|
|||
List<TaskSummaryImpl> tasks =
|
||||
taskanaEngine.getSqlSession().selectList(getLinkToMapperScript(), this);
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"mapper returned {} resulting Objects: {} ",
|
||||
tasks.size(),
|
||||
tasks);
|
||||
LOGGER.debug("mapper returned {} resulting Objects: {} ", tasks.size(), tasks);
|
||||
}
|
||||
result = taskService.augmentTaskSummariesByContainedSummaries(tasks);
|
||||
return result;
|
||||
|
@ -987,9 +984,7 @@ public class TaskQueryImpl implements TaskQuery {
|
|||
taskanaEngine.returnConnection();
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"exit from list(). Returning {} resulting Objects: {} ",
|
||||
result.size(),
|
||||
result);
|
||||
"exit from list(). Returning {} resulting Objects: {} ", result.size(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1061,9 +1056,7 @@ public class TaskQueryImpl implements TaskQuery {
|
|||
taskanaEngine.returnConnection();
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"Exit from listValues. Returning {} resulting Objects: {} ",
|
||||
result.size(),
|
||||
result);
|
||||
"Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1060,20 +1060,20 @@ public class TaskServiceImpl implements TaskService {
|
|||
getTasksToChange(taskIds).stream()
|
||||
.collect(Collectors.toMap(TaskSummary::getId, e -> (TaskSummaryImpl) e));
|
||||
return taskIds.stream()
|
||||
.map(id -> Pair.of(id, taskSummaryMap.get(id)))
|
||||
.filter(
|
||||
pair -> {
|
||||
if (pair.getRight() == null) {
|
||||
String taskId = pair.getLeft();
|
||||
bulkLog.addError(
|
||||
taskId,
|
||||
new TaskNotFoundException(
|
||||
taskId, String.format(TASK_WITH_ID_WAS_NOT_FOUND, taskId)));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.map(Pair::getRight);
|
||||
.map(id -> Pair.of(id, taskSummaryMap.get(id)))
|
||||
.filter(
|
||||
pair -> {
|
||||
if (pair.getRight() == null) {
|
||||
String taskId = pair.getLeft();
|
||||
bulkLog.addError(
|
||||
taskId,
|
||||
new TaskNotFoundException(
|
||||
taskId, String.format(TASK_WITH_ID_WAS_NOT_FOUND, taskId)));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.map(Pair::getRight);
|
||||
}
|
||||
|
||||
private static Predicate<TaskSummaryImpl> addErrorToBulkLog(
|
||||
|
|
|
@ -133,8 +133,7 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
|
|||
}
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"exit from getTasksCompletedBefore(), returning {}", taskList);
|
||||
LOGGER.debug("exit from getTasksCompletedBefore(), returning {}", taskList);
|
||||
}
|
||||
|
||||
return taskList;
|
||||
|
@ -142,9 +141,7 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
|
|||
|
||||
private int deleteTasksTransactionally(List<TaskSummary> tasksToBeDeleted) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"entry to deleteTasksTransactionally(tasksToBeDeleted = {})",
|
||||
tasksToBeDeleted);
|
||||
LOGGER.debug("entry to deleteTasksTransactionally(tasksToBeDeleted = {})", tasksToBeDeleted);
|
||||
}
|
||||
|
||||
int deletedTaskCount = 0;
|
||||
|
|
|
@ -92,9 +92,7 @@ abstract class AbstractWorkbasketAccessItemQueryImpl<
|
|||
taskanaEngine.returnConnection();
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"exit from list(). Returning {} resulting Objects: {} ",
|
||||
result.size(),
|
||||
result);
|
||||
"exit from list(). Returning {} resulting Objects: {} ", result.size(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,10 +107,7 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
|
|||
taskanaEngine.openAndReturnConnection(
|
||||
() -> new ArrayList<>(taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this)));
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"exit from list(). Returning {} resulting Objects: {} ",
|
||||
result.size(),
|
||||
result);
|
||||
LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", result.size(), result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -447,9 +447,7 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
|
|||
taskanaEngine.returnConnection();
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"Exit from listValues. Returning {} resulting Objects: {} ",
|
||||
result.size(),
|
||||
result);
|
||||
"Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,9 +40,7 @@ import pro.taskana.workbasket.internal.models.WorkbasketAccessItemImpl;
|
|||
import pro.taskana.workbasket.internal.models.WorkbasketImpl;
|
||||
import pro.taskana.workbasket.internal.models.WorkbasketSummaryImpl;
|
||||
|
||||
/**
|
||||
* This is the implementation of WorkbasketService.
|
||||
*/
|
||||
/** This is the implementation of WorkbasketService. */
|
||||
public class WorkbasketServiceImpl implements WorkbasketService {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketServiceImpl.class);
|
||||
|
@ -743,9 +741,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
|||
public BulkOperationResults<String, TaskanaException> deleteWorkbaskets(
|
||||
List<String> workbasketsIds) throws NotAuthorizedException, InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"entry to deleteWorkbaskets(workbasketId = {})",
|
||||
workbasketsIds);
|
||||
LOGGER.debug("entry to deleteWorkbaskets(workbasketId = {})", workbasketsIds);
|
||||
}
|
||||
|
||||
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
|
||||
|
|
|
@ -225,7 +225,6 @@ class UpdateClassificationAccTest extends AbstractAccTest {
|
|||
// TODO - resume old behaviour after attachment query is possible.
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
|
||||
|
||||
List<String> tasksWithP1D =
|
||||
new ArrayList<>(
|
||||
Arrays.asList(
|
||||
|
|
|
@ -615,6 +615,4 @@ class CompleteTaskAccTest extends AbstractAccTest {
|
|||
.isAfterOrEqualTo(beforeBulkComplete);
|
||||
assertThat(task.getOwner()).isEqualTo("user-3-2");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -437,8 +437,7 @@ class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
assertThat(readTask.getPriority()).isEqualTo(99);
|
||||
|
||||
Instant expDue =
|
||||
converter.addWorkingDaysToInstant(readTask.getPlanned(), Duration.ofDays(1));
|
||||
Instant expDue = converter.addWorkingDaysToInstant(readTask.getPlanned(), Duration.ofDays(1));
|
||||
|
||||
assertThat(readTask.getDue()).isEqualTo(expDue);
|
||||
}
|
||||
|
|
|
@ -455,7 +455,8 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
|
|||
task.setPlanned(planned);
|
||||
task = taskService.updateTask(task);
|
||||
String serviceLevel = task.getClassificationSummary().getServiceLevel();
|
||||
Instant expDue = converter.addWorkingDaysToInstant(task.getPlanned(), Duration.parse(serviceLevel));
|
||||
Instant expDue =
|
||||
converter.addWorkingDaysToInstant(task.getPlanned(), Duration.parse(serviceLevel));
|
||||
assertThat(task.getPlanned()).isEqualTo(planned);
|
||||
assertThat(task.getDue()).isEqualTo(expDue);
|
||||
}
|
||||
|
|
|
@ -336,12 +336,15 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
|
|||
assertThat(task.getPriority()).isEqualTo(101);
|
||||
Instant expDue = converter.addWorkingDaysToInstant(task.getPlanned(), Duration.ofDays(1));
|
||||
assertThat(task.getDue()).isEqualTo(expDue);
|
||||
assertThat(task.getAttachments()).hasSize(2)
|
||||
.areExactly(1,
|
||||
assertThat(task.getAttachments())
|
||||
.hasSize(2)
|
||||
.areExactly(
|
||||
1,
|
||||
new Condition<>(
|
||||
e -> "E-MAIL".equals(e.getChannel()) && e.getCustomAttributes().size() == 3,
|
||||
"E-MAIL with 3 custom attributes"))
|
||||
.areExactly(1,
|
||||
.areExactly(
|
||||
1,
|
||||
new Condition<>(
|
||||
e -> "ROHRPOST".equals(e.getChannel()) && e.getCustomAttributes().size() == 4,
|
||||
"ROHRPOST with 4 custom attributes"));
|
||||
|
@ -368,11 +371,13 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
|
|||
assertThat(task.getDue()).isEqualTo(expDue);
|
||||
assertThat(task.getAttachments())
|
||||
.hasSize(2)
|
||||
.areExactly(1,
|
||||
.areExactly(
|
||||
1,
|
||||
new Condition<>(
|
||||
e -> "FAX".equals(e.getChannel()) && e.getCustomAttributes().size() == 3,
|
||||
"FAX with 3 custom attributes"))
|
||||
.areExactly(1,
|
||||
.areExactly(
|
||||
1,
|
||||
new Condition<>(
|
||||
e -> "ROHRPOST".equals(e.getChannel()) && e.getCustomAttributes().size() == 4,
|
||||
"ROHRPOST with 4 custom attributes"));
|
||||
|
|
|
@ -71,8 +71,10 @@ class AsyncUpdateJobIntTest {
|
|||
classification.setServiceLevel("P5D");
|
||||
classification.setPriority(1000);
|
||||
|
||||
TEMPLATE.exchange(restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, CLASSIFICATION_ID),
|
||||
HttpMethod.PUT, new HttpEntity<>(classification, restHelper.getHeadersTeamlead_1()),
|
||||
TEMPLATE.exchange(
|
||||
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, CLASSIFICATION_ID),
|
||||
HttpMethod.PUT,
|
||||
new HttpEntity<>(classification, restHelper.getHeadersTeamlead_1()),
|
||||
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
|
||||
|
||||
// trigger jobs twice to refresh all entries. first entry on the first call and follow up on the
|
||||
|
|
|
@ -103,9 +103,8 @@ public class ClassificationController extends AbstractPagingController {
|
|||
@GetMapping(path = Mapping.URL_CLASSIFICATIONS)
|
||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public ResponseEntity<TaskanaPagedModel<ClassificationSummaryRepresentationModel>>
|
||||
getClassifications(
|
||||
@RequestParam MultiValueMap<String, String> params)
|
||||
throws InvalidArgumentException {
|
||||
getClassifications(@RequestParam MultiValueMap<String, String> params)
|
||||
throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to getClassifications(params= {})", params);
|
||||
}
|
||||
|
@ -155,8 +154,8 @@ public class ClassificationController extends AbstractPagingController {
|
|||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to createClassification(resource= {})", resource);
|
||||
}
|
||||
Classification classification = classificationRepresentationModelAssembler
|
||||
.toEntityModel(resource);
|
||||
Classification classification =
|
||||
classificationRepresentationModelAssembler.toEntityModel(resource);
|
||||
classification = classificationService.createClassification(classification);
|
||||
|
||||
ResponseEntity<ClassificationRepresentationModel> response =
|
||||
|
@ -185,8 +184,8 @@ public class ClassificationController extends AbstractPagingController {
|
|||
|
||||
ResponseEntity<ClassificationRepresentationModel> result;
|
||||
if (classificationId.equals(resource.getClassificationId())) {
|
||||
Classification classification = classificationRepresentationModelAssembler
|
||||
.toEntityModel(resource);
|
||||
Classification classification =
|
||||
classificationRepresentationModelAssembler.toEntityModel(resource);
|
||||
classification = classificationService.updateClassification(classification);
|
||||
result =
|
||||
ResponseEntity.ok(classificationRepresentationModelAssembler.toModel(classification));
|
||||
|
@ -229,7 +228,7 @@ public class ClassificationController extends AbstractPagingController {
|
|||
if (sortBy != null) {
|
||||
SortDirection sortDirection;
|
||||
if (params.getFirst(SORT_DIRECTION) != null
|
||||
&& "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||
&& "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||
sortDirection = SortDirection.DESCENDING;
|
||||
} else {
|
||||
sortDirection = SortDirection.ASCENDING;
|
||||
|
@ -260,8 +259,7 @@ public class ClassificationController extends AbstractPagingController {
|
|||
return query;
|
||||
}
|
||||
|
||||
private void applyFilterParams(
|
||||
ClassificationQuery query, MultiValueMap<String, String> params)
|
||||
private void applyFilterParams(ClassificationQuery query, MultiValueMap<String, String> params)
|
||||
throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", query, params);
|
||||
|
@ -332,6 +330,5 @@ public class ClassificationController extends AbstractPagingController {
|
|||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,9 +175,7 @@ public class ClassificationDefinitionController {
|
|||
}
|
||||
}
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"Exit from mapChildrenToParentKeys(), returning {}",
|
||||
childrenInFile);
|
||||
LOGGER.debug("Exit from mapChildrenToParentKeys(), returning {}", childrenInFile);
|
||||
}
|
||||
|
||||
return childrenInFile;
|
||||
|
|
|
@ -35,8 +35,7 @@ public class ClassificationRepresentationModelAssembler
|
|||
@NonNull
|
||||
@Override
|
||||
public ClassificationRepresentationModel toModel(@NonNull Classification classification) {
|
||||
ClassificationRepresentationModel repModel =
|
||||
new ClassificationRepresentationModel();
|
||||
ClassificationRepresentationModel repModel = new ClassificationRepresentationModel();
|
||||
repModel.setClassificationId(classification.getId());
|
||||
repModel.setApplicationEntryPoint(classification.getApplicationEntryPoint());
|
||||
repModel.setCategory(classification.getCategory());
|
||||
|
@ -63,8 +62,8 @@ public class ClassificationRepresentationModelAssembler
|
|||
try {
|
||||
repModel.add(
|
||||
WebMvcLinkBuilder.linkTo(
|
||||
methodOn(ClassificationController.class)
|
||||
.getClassification(classification.getId()))
|
||||
methodOn(ClassificationController.class)
|
||||
.getClassification(classification.getId()))
|
||||
.withSelfRel());
|
||||
} catch (ClassificationNotFoundException e) {
|
||||
throw new SystemException("caught unexpected Exception.", e.getCause());
|
||||
|
@ -77,14 +76,11 @@ public class ClassificationRepresentationModelAssembler
|
|||
return TaskanaPagedModelKeys.CLASSIFICATIONS;
|
||||
}
|
||||
|
||||
public Classification toEntityModel(
|
||||
ClassificationRepresentationModel repModel) {
|
||||
public Classification toEntityModel(ClassificationRepresentationModel repModel) {
|
||||
ClassificationImpl classification =
|
||||
(ClassificationImpl)
|
||||
classificationService.newClassification(
|
||||
repModel.getKey(),
|
||||
repModel.getDomain(),
|
||||
repModel.getType());
|
||||
repModel.getKey(), repModel.getDomain(), repModel.getType());
|
||||
|
||||
classification.setApplicationEntryPoint(repModel.getApplicationEntryPoint());
|
||||
classification.setCategory(repModel.getCategory());
|
||||
|
|
|
@ -62,8 +62,9 @@ public class ClassificationSummaryRepresentationModelAssembler
|
|||
public ClassificationSummary toEntityModel(ClassificationSummaryRepresentationModel repModel) {
|
||||
ClassificationSummaryImpl classification =
|
||||
(ClassificationSummaryImpl)
|
||||
classificationService.newClassification(
|
||||
repModel.getKey(), repModel.getDomain(), repModel.getType()).asSummary();
|
||||
classificationService
|
||||
.newClassification(repModel.getKey(), repModel.getDomain(), repModel.getType())
|
||||
.asSummary();
|
||||
classification.setId(repModel.getClassificationId());
|
||||
classification.setApplicationEntryPoint(repModel.getApplicationEntryPoint());
|
||||
classification.setCategory(repModel.getCategory());
|
||||
|
|
|
@ -4,9 +4,7 @@ import org.springframework.hateoas.RepresentationModel;
|
|||
|
||||
import pro.taskana.classification.api.models.ClassificationSummary;
|
||||
|
||||
/**
|
||||
* EntityModel class for {@link ClassificationSummary}.
|
||||
*/
|
||||
/** EntityModel class for {@link ClassificationSummary}. */
|
||||
public class ClassificationSummaryRepresentationModel
|
||||
extends RepresentationModel<ClassificationSummaryRepresentationModel> {
|
||||
|
||||
|
|
|
@ -14,8 +14,7 @@ public interface TaskanaPagingAssembler<T, D extends RepresentationModel<? super
|
|||
|
||||
TaskanaPagedModelKeys getProperty();
|
||||
|
||||
default TaskanaPagedModel<D> toPageModel(
|
||||
Iterable<T> entities, PageMetadata pageMetadata) {
|
||||
default TaskanaPagedModel<D> toPageModel(Iterable<T> entities, PageMetadata pageMetadata) {
|
||||
return StreamSupport.stream(entities.spliterator(), false)
|
||||
.map(this::toModel)
|
||||
.collect(
|
||||
|
|
|
@ -116,9 +116,7 @@ public class LdapClient {
|
|||
SearchControls.SUBTREE_SCOPE,
|
||||
userAttributesToReturn,
|
||||
new UserContextMapper());
|
||||
LOGGER.debug(
|
||||
"exit from searchUsersByName. Retrieved the following users: {}.",
|
||||
accessIds);
|
||||
LOGGER.debug("exit from searchUsersByName. Retrieved the following users: {}.", accessIds);
|
||||
return accessIds;
|
||||
}
|
||||
|
||||
|
@ -144,9 +142,7 @@ public class LdapClient {
|
|||
SearchControls.SUBTREE_SCOPE,
|
||||
getLookUpGoupAttributesToReturn(),
|
||||
new GroupContextMapper());
|
||||
LOGGER.debug(
|
||||
"Exit from searchGroupsByName. Retrieved the following groups: {}",
|
||||
accessIds);
|
||||
LOGGER.debug("Exit from searchGroupsByName. Retrieved the following groups: {}", accessIds);
|
||||
return accessIds;
|
||||
}
|
||||
|
||||
|
@ -187,8 +183,7 @@ public class LdapClient {
|
|||
userAttributesToReturn,
|
||||
new GroupContextMapper());
|
||||
LOGGER.debug(
|
||||
"exit from searchGroupsofUsersIsMember. Retrieved the following users: {}.",
|
||||
accessIds);
|
||||
"exit from searchGroupsofUsersIsMember. Retrieved the following users: {}.", accessIds);
|
||||
return accessIds;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,20 +11,16 @@ import org.springframework.ldap.core.support.LdapContextSource;
|
|||
@Configuration
|
||||
public class LdapConfiguration {
|
||||
|
||||
private final Environment env;
|
||||
@Value("${taskana.ldap.serverUrl:ldap://localhost:10389}")
|
||||
private String ldapServerUrl;
|
||||
|
||||
@Value("${taskana.ldap.baseDn:OU=Test,O=TASKANA}")
|
||||
private String ldapBaseDn;
|
||||
|
||||
@Value("${taskana.ldap.bindDn:uid=admin}")
|
||||
private String ldapBindDn;
|
||||
|
||||
@Value("${taskana.ldap.bindPassword:secret}")
|
||||
private String ldapBindPassowrd;
|
||||
|
||||
private final Environment env;
|
||||
|
||||
public LdapConfiguration(Environment env) {
|
||||
this.env = env;
|
||||
}
|
||||
|
|
|
@ -76,5 +76,4 @@ public class PagedResources<T> extends RepresentationModel<PagedResources<T>> {
|
|||
public Collection<T> getContent() {
|
||||
return Collections.unmodifiableCollection(content);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,9 +35,7 @@ public class ReportRepresentationModel extends RepresentationModel<ReportReprese
|
|||
return sumRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* EntityModel class for {@link SingleRow}.
|
||||
*/
|
||||
/** EntityModel class for {@link SingleRow}. */
|
||||
public static class RowResource {
|
||||
|
||||
private final int[] cells;
|
||||
|
@ -87,9 +85,7 @@ public class ReportRepresentationModel extends RepresentationModel<ReportReprese
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta Information about this ReportResource.
|
||||
*/
|
||||
/** Meta Information about this ReportResource. */
|
||||
public static class MetaInformation {
|
||||
|
||||
private static final String TOTAL_DESC = "Total";
|
||||
|
|
|
@ -53,15 +53,13 @@ public abstract class AbstractRessourcesAssembler {
|
|||
.withRel("last"));
|
||||
if (pageMetadata.getNumber() > 1L) {
|
||||
pagedResources.add(
|
||||
(Link.of(
|
||||
original.replaceQueryParam("page", pageMetadata.getNumber() - 1L).toUriString()))
|
||||
(Link.of(original.replaceQueryParam("page", pageMetadata.getNumber() - 1L).toUriString()))
|
||||
.withRel("prev"));
|
||||
}
|
||||
|
||||
if (pageMetadata.getNumber() < pageMetadata.getTotalPages()) {
|
||||
pagedResources.add(
|
||||
(Link.of(
|
||||
original.replaceQueryParam("page", pageMetadata.getNumber() + 1L).toUriString()))
|
||||
(Link.of(original.replaceQueryParam("page", pageMetadata.getNumber() + 1L).toUriString()))
|
||||
.withRel("next"));
|
||||
}
|
||||
|
||||
|
|
|
@ -44,33 +44,6 @@ public class SpringSecurityToJaasFilter extends GenericFilterBean {
|
|||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
private void initializeUserPrincipalFromAuthentication(
|
||||
Authentication authentication, Subject subject) {
|
||||
if (subject.getPrincipals().isEmpty()) {
|
||||
LOGGER.debug("Setting the principal of the subject with {}.", authentication.getPrincipal());
|
||||
subject
|
||||
.getPrincipals()
|
||||
.add(new UserPrincipal(((UserDetails) authentication.getPrincipal()).getUsername()));
|
||||
} else {
|
||||
LOGGER.debug("Principal of the subject is already set to {}.", subject.getPrincipals());
|
||||
throw new SystemException("Finding an existing principal is unexpected. Please investigate.");
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeGroupPrincipalsFromAuthentication(
|
||||
Authentication authentication, Subject subject) {
|
||||
|
||||
LOGGER.debug("Adding roles {} to subject.", authentication.getAuthorities());
|
||||
|
||||
authentication
|
||||
.getAuthorities()
|
||||
.forEach(
|
||||
grantedAuthority ->
|
||||
subject.getPrincipals().add(new GroupPrincipal(grantedAuthority.getAuthority())));
|
||||
|
||||
LOGGER.debug("{}", subject.getPublicCredentials(GroupPrincipal.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the <code>Subject</code> to run as or <code>null</code> if no <code>Subject</code> is
|
||||
* available.
|
||||
|
@ -100,4 +73,31 @@ public class SpringSecurityToJaasFilter extends GenericFilterBean {
|
|||
Optional<Authentication> getCurrentAuthentication() {
|
||||
return Optional.ofNullable(SecurityContextHolder.getContext().getAuthentication());
|
||||
}
|
||||
|
||||
private void initializeUserPrincipalFromAuthentication(
|
||||
Authentication authentication, Subject subject) {
|
||||
if (subject.getPrincipals().isEmpty()) {
|
||||
LOGGER.debug("Setting the principal of the subject with {}.", authentication.getPrincipal());
|
||||
subject
|
||||
.getPrincipals()
|
||||
.add(new UserPrincipal(((UserDetails) authentication.getPrincipal()).getUsername()));
|
||||
} else {
|
||||
LOGGER.debug("Principal of the subject is already set to {}.", subject.getPrincipals());
|
||||
throw new SystemException("Finding an existing principal is unexpected. Please investigate.");
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeGroupPrincipalsFromAuthentication(
|
||||
Authentication authentication, Subject subject) {
|
||||
|
||||
LOGGER.debug("Adding roles {} to subject.", authentication.getAuthorities());
|
||||
|
||||
authentication
|
||||
.getAuthorities()
|
||||
.forEach(
|
||||
grantedAuthority ->
|
||||
subject.getPrincipals().add(new GroupPrincipal(grantedAuthority.getAuthority())));
|
||||
|
||||
LOGGER.debug("{}", subject.getPublicCredentials(GroupPrincipal.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,9 +32,7 @@ import pro.taskana.task.api.models.TaskComment;
|
|||
import pro.taskana.task.rest.assembler.TaskCommentRepresentationModelAssembler;
|
||||
import pro.taskana.task.rest.models.TaskCommentRepresentationModel;
|
||||
|
||||
/**
|
||||
* Controller for all {@link TaskComment} related endpoints.
|
||||
*/
|
||||
/** Controller for all {@link TaskComment} related endpoints. */
|
||||
@RestController
|
||||
@EnableHypermediaSupport(type = HypermediaType.HAL)
|
||||
public class TaskCommentController {
|
||||
|
@ -46,7 +44,6 @@ public class TaskCommentController {
|
|||
private static final String CREATED = "created";
|
||||
private static final String MODIFIED = "modified";
|
||||
|
||||
|
||||
private final TaskService taskService;
|
||||
private final TaskCommentRepresentationModelAssembler taskCommentRepresentationModelAssembler;
|
||||
|
||||
|
@ -63,7 +60,7 @@ public class TaskCommentController {
|
|||
public ResponseEntity<TaskCommentRepresentationModel> getTaskComment(
|
||||
@PathVariable String taskCommentId)
|
||||
throws NotAuthorizedException, TaskNotFoundException, TaskCommentNotFoundException,
|
||||
InvalidArgumentException {
|
||||
InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to getTaskComment(taskCommentId= {})", taskCommentId);
|
||||
}
|
||||
|
@ -96,7 +93,7 @@ public class TaskCommentController {
|
|||
|
||||
List<TaskComment> taskComments = taskService.getTaskComments(taskId);
|
||||
|
||||
//TODO Maybe introduce a query for task comments
|
||||
// TODO Maybe introduce a query for task comments
|
||||
applySortingParams(taskComments, params);
|
||||
|
||||
TaskanaPagedModel<TaskCommentRepresentationModel> taskCommentListResource =
|
||||
|
@ -117,7 +114,7 @@ public class TaskCommentController {
|
|||
public ResponseEntity<TaskCommentRepresentationModel> deleteTaskComment(
|
||||
@PathVariable String taskCommentId)
|
||||
throws NotAuthorizedException, TaskNotFoundException, TaskCommentNotFoundException,
|
||||
InvalidArgumentException {
|
||||
InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to deleteTaskComment(taskCommentId= {})", taskCommentId);
|
||||
}
|
||||
|
@ -139,7 +136,7 @@ public class TaskCommentController {
|
|||
@PathVariable String taskCommentId,
|
||||
@RequestBody TaskCommentRepresentationModel taskCommentRepresentationModel)
|
||||
throws NotAuthorizedException, TaskNotFoundException, TaskCommentNotFoundException,
|
||||
InvalidArgumentException, ConcurrencyException {
|
||||
InvalidArgumentException, ConcurrencyException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"Entry to updateTaskComment(taskCommentId= {}, taskCommentResource= {})",
|
||||
|
@ -204,12 +201,13 @@ public class TaskCommentController {
|
|||
return result;
|
||||
}
|
||||
|
||||
private List<TaskComment> applySortingParams(List<TaskComment> taskComments,
|
||||
MultiValueMap<String, String> params) throws InvalidArgumentException {
|
||||
private List<TaskComment> applySortingParams(
|
||||
List<TaskComment> taskComments, MultiValueMap<String, String> params)
|
||||
throws InvalidArgumentException {
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER
|
||||
.debug("Entry to applySortingParams(taskComments= {}, params= {})", taskComments, params);
|
||||
LOGGER.debug(
|
||||
"Entry to applySortingParams(taskComments= {}, params= {})", taskComments, params);
|
||||
}
|
||||
|
||||
String sortBy = params.getFirst(SORT_BY);
|
||||
|
@ -219,20 +217,18 @@ public class TaskCommentController {
|
|||
switch (sortBy) {
|
||||
case (CREATED):
|
||||
if (params.getFirst(SORT_DIRECTION) != null
|
||||
&& "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||
&& "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||
taskComments.sort(Comparator.comparing(TaskComment::getCreated).reversed());
|
||||
} else {
|
||||
taskComments.sort(Comparator.comparing(TaskComment::getCreated));
|
||||
|
||||
}
|
||||
break;
|
||||
case (MODIFIED):
|
||||
if (params.getFirst(SORT_DIRECTION) != null
|
||||
&& "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||
&& "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||
taskComments.sort(Comparator.comparing(TaskComment::getModified).reversed());
|
||||
} else {
|
||||
taskComments.sort(Comparator.comparing(TaskComment::getModified));
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -5,12 +5,9 @@ import java.util.Map;
|
|||
|
||||
import pro.taskana.task.api.models.Attachment;
|
||||
|
||||
/**
|
||||
* EntityModel class for {@link Attachment}.
|
||||
*/
|
||||
public class AttachmentRepresentationModel
|
||||
extends AttachmentSummaryRepresentationModel {
|
||||
|
||||
/** EntityModel class for {@link Attachment}. */
|
||||
public class AttachmentRepresentationModel extends AttachmentSummaryRepresentationModel {
|
||||
|
||||
private Map<String, String> customAttributes = new HashMap<>();
|
||||
|
||||
public Map<String, String> getCustomAttributes() {
|
||||
|
|
|
@ -11,9 +11,7 @@ import pro.taskana.task.api.models.ObjectReference;
|
|||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel;
|
||||
|
||||
/**
|
||||
* EntityModel class for {@link WorkbasketSummary}.
|
||||
*/
|
||||
/** EntityModel class for {@link WorkbasketSummary}. */
|
||||
public class TaskSummaryRepresentationModel
|
||||
extends RepresentationModel<TaskSummaryRepresentationModel> {
|
||||
|
||||
|
@ -55,8 +53,7 @@ public class TaskSummaryRepresentationModel
|
|||
protected String custom14;
|
||||
protected String custom15;
|
||||
protected String custom16;
|
||||
private List<AttachmentSummaryRepresentationModel> attachmentSummaries =
|
||||
new ArrayList<>();
|
||||
private List<AttachmentSummaryRepresentationModel> attachmentSummaries = new ArrayList<>();
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
|
@ -183,8 +180,7 @@ public class TaskSummaryRepresentationModel
|
|||
return workbasketSummary;
|
||||
}
|
||||
|
||||
public void setWorkbasketSummary(
|
||||
WorkbasketSummaryRepresentationModel workbasketSummary) {
|
||||
public void setWorkbasketSummary(WorkbasketSummaryRepresentationModel workbasketSummary) {
|
||||
this.workbasketSummary = workbasketSummary;
|
||||
}
|
||||
|
||||
|
@ -372,6 +368,4 @@ public class TaskSummaryRepresentationModel
|
|||
public void setCustom16(String custom16) {
|
||||
this.custom16 = custom16;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -55,13 +55,14 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
|
||||
@Autowired
|
||||
public WorkbasketAccessItemController(
|
||||
LdapClient ldapClient, WorkbasketService workbasketService,
|
||||
LdapClient ldapClient,
|
||||
WorkbasketService workbasketService,
|
||||
WorkbasketAccessItemRepresentationModelAssembler
|
||||
workbasketAccessItemRepresentationModelAssembler) {
|
||||
this.ldapClient = ldapClient;
|
||||
this.workbasketService = workbasketService;
|
||||
this.workbasketAccessItemRepresentationModelAssembler
|
||||
= workbasketAccessItemRepresentationModelAssembler;
|
||||
this.workbasketAccessItemRepresentationModelAssembler =
|
||||
workbasketAccessItemRepresentationModelAssembler;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,14 +70,13 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
*
|
||||
* @param params filter, order and access ids.
|
||||
* @return all WorkbasketAccesItemResource.
|
||||
* @throws NotAuthorizedException if the user is not authorized.
|
||||
* @throws NotAuthorizedException if the user is not authorized.
|
||||
* @throws InvalidArgumentException if some argument is invalid.
|
||||
*/
|
||||
@GetMapping(path = Mapping.URL_WORKBASKET_ACCESS_ITEMS)
|
||||
public ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>>
|
||||
getWorkbasketAccessItems(
|
||||
@RequestParam MultiValueMap<String, String> params)
|
||||
throws NotAuthorizedException, InvalidArgumentException {
|
||||
getWorkbasketAccessItems(@RequestParam MultiValueMap<String, String> params)
|
||||
throws NotAuthorizedException, InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to getWorkbasketAccessItems(params= {})", params);
|
||||
}
|
||||
|
@ -135,8 +135,7 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
return response;
|
||||
}
|
||||
|
||||
private void getAccessIds(
|
||||
WorkbasketAccessItemQuery query, MultiValueMap<String, String> params) {
|
||||
private void getAccessIds(WorkbasketAccessItemQuery query, MultiValueMap<String, String> params) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to getAccessIds(query= {}, params= {})", query, params);
|
||||
}
|
||||
|
@ -150,7 +149,6 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from getAccessIds(), returning {}", query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void applyFilterParams(
|
||||
|
@ -180,7 +178,6 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private WorkbasketAccessItemQuery applySortingParams(
|
||||
|
@ -195,7 +192,7 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
if (sortBy != null) {
|
||||
BaseQuery.SortDirection sortDirection;
|
||||
if (params.getFirst(SORT_DIRECTION) != null
|
||||
&& "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||
&& "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||
sortDirection = BaseQuery.SortDirection.DESCENDING;
|
||||
} else {
|
||||
sortDirection = BaseQuery.SortDirection.ASCENDING;
|
||||
|
|
|
@ -78,8 +78,6 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
private final WorkbasketSummaryRepresentationModelAssembler
|
||||
workbasketSummaryRepresentationModelAssembler;
|
||||
|
||||
|
||||
|
||||
private final WorkbasketAccessItemRepresentationModelAssembler
|
||||
workbasketAccessItemRepresentationModelAssembler;
|
||||
|
||||
|
@ -146,7 +144,7 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
public ResponseEntity<WorkbasketRepresentationModel> deleteWorkbasket(
|
||||
@PathVariable(value = "workbasketId") String workbasketId)
|
||||
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
|
||||
WorkbasketInUseException {
|
||||
WorkbasketInUseException {
|
||||
LOGGER.debug("Entry to markWorkbasketForDeletion(workbasketId= {})", workbasketId);
|
||||
ResponseEntity<WorkbasketRepresentationModel> response;
|
||||
|
||||
|
@ -223,7 +221,7 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>>
|
||||
getWorkbasketAccessItems(@PathVariable(value = "workbasketId") String workbasketId)
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||
LOGGER.debug("Entry to getWorkbasketAccessItems(workbasketId= {})", workbasketId);
|
||||
ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>> result;
|
||||
|
||||
|
@ -244,10 +242,10 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>>
|
||||
setWorkbasketAccessItems(
|
||||
@PathVariable(value = "workbasketId") String workbasketId,
|
||||
@RequestBody List<WorkbasketAccessItemRepresentationModel> workbasketAccessResourceItems)
|
||||
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
|
||||
WorkbasketAccessItemAlreadyExistException {
|
||||
@PathVariable(value = "workbasketId") String workbasketId,
|
||||
@RequestBody List<WorkbasketAccessItemRepresentationModel> workbasketAccessResourceItems)
|
||||
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
|
||||
WorkbasketAccessItemAlreadyExistException {
|
||||
LOGGER.debug("Entry to setWorkbasketAccessItems(workbasketId= {})", workbasketId);
|
||||
if (workbasketAccessResourceItems == null) {
|
||||
throw new InvalidArgumentException("Can´t create something with NULL body-value.");
|
||||
|
@ -255,8 +253,9 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
|
||||
List<WorkbasketAccessItem> wbAccessItems = new ArrayList<>();
|
||||
workbasketAccessResourceItems.forEach(
|
||||
item -> wbAccessItems
|
||||
.add(workbasketAccessItemRepresentationModelAssembler.toEntityModel(item)));
|
||||
item ->
|
||||
wbAccessItems.add(
|
||||
workbasketAccessItemRepresentationModelAssembler.toEntityModel(item)));
|
||||
workbasketService.setWorkbasketAccessItems(workbasketId, wbAccessItems);
|
||||
List<WorkbasketAccessItem> updatedWbAccessItems =
|
||||
workbasketService.getWorkbasketAccessItems(workbasketId);
|
||||
|
@ -276,14 +275,14 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>>
|
||||
getDistributionTargets(@PathVariable(value = "workbasketId") String workbasketId)
|
||||
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||
|
||||
LOGGER.debug("Entry to getDistributionTargets(workbasketId= {})", workbasketId);
|
||||
List<WorkbasketSummary> distributionTargets =
|
||||
workbasketService.getDistributionTargets(workbasketId);
|
||||
TaskanaPagedModel<WorkbasketSummaryRepresentationModel> distributionTargetListResource =
|
||||
workbasketSummaryRepresentationModelAssembler
|
||||
.toDistributionTargetPageModel(distributionTargets, null);
|
||||
workbasketSummaryRepresentationModelAssembler.toDistributionTargetPageModel(
|
||||
distributionTargets, null);
|
||||
ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>> result =
|
||||
ResponseEntity.ok(distributionTargetListResource);
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
|
@ -297,9 +296,9 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>>
|
||||
setDistributionTargetsForWorkbasketId(
|
||||
@PathVariable(value = "workbasketId") String sourceWorkbasketId,
|
||||
@RequestBody List<String> targetWorkbasketIds)
|
||||
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||
@PathVariable(value = "workbasketId") String sourceWorkbasketId,
|
||||
@RequestBody List<String> targetWorkbasketIds)
|
||||
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"Entry to getTasksStatusReport(workbasketId= {}, targetWorkbasketIds´= {})",
|
||||
|
@ -313,8 +312,8 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
workbasketService.getDistributionTargets(sourceWorkbasketId);
|
||||
ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>> response =
|
||||
ResponseEntity.ok(
|
||||
workbasketSummaryRepresentationModelAssembler
|
||||
.toDistributionTargetPageModel(distributionTargets, null));
|
||||
workbasketSummaryRepresentationModelAssembler.toDistributionTargetPageModel(
|
||||
distributionTargets, null));
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from getTasksStatusReport(), returning {}", response);
|
||||
}
|
||||
|
@ -326,8 +325,8 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>>
|
||||
removeDistributionTargetForWorkbasketId(
|
||||
@PathVariable(value = "workbasketId") String targetWorkbasketId)
|
||||
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||
@PathVariable(value = "workbasketId") String targetWorkbasketId)
|
||||
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||
LOGGER.debug(
|
||||
"Entry to removeDistributionTargetForWorkbasketId(workbasketId= {})", targetWorkbasketId);
|
||||
|
||||
|
@ -354,7 +353,7 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
if (sortBy != null) {
|
||||
SortDirection sortDirection;
|
||||
if (params.getFirst(SORT_DIRECTION) != null
|
||||
&& "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||
&& "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||
sortDirection = SortDirection.DESCENDING;
|
||||
} else {
|
||||
sortDirection = SortDirection.ASCENDING;
|
||||
|
@ -388,8 +387,8 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
return query;
|
||||
}
|
||||
|
||||
private void applyFilterParams(
|
||||
WorkbasketQuery query, MultiValueMap<String, String> params) throws InvalidArgumentException {
|
||||
private void applyFilterParams(WorkbasketQuery query, MultiValueMap<String, String> params)
|
||||
throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", query, params);
|
||||
}
|
||||
|
@ -512,6 +511,5 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,8 +152,7 @@ public class WorkbasketDefinitionController {
|
|||
|
||||
// STEP 1: update or create workbaskets from the import
|
||||
for (WorkbasketDefinitionRepresentationModel definition : definitions.getContent()) {
|
||||
Workbasket importedWb =
|
||||
workbasketAssembler.toEntityModel(definition.getWorkbasket());
|
||||
Workbasket importedWb = workbasketAssembler.toEntityModel(definition.getWorkbasket());
|
||||
String newId;
|
||||
WorkbasketImpl wbWithoutId = (WorkbasketImpl) removeId(importedWb);
|
||||
if (systemIds.containsKey(logicalId(importedWb))) {
|
||||
|
@ -230,8 +229,7 @@ public class WorkbasketDefinitionController {
|
|||
List<String> identifiers = new ArrayList<>();
|
||||
Set<String> duplicates = new HashSet<>();
|
||||
for (WorkbasketDefinitionRepresentationModel definition : definitions) {
|
||||
String identifier =
|
||||
logicalId(workbasketAssembler.toEntityModel(definition.getWorkbasket()));
|
||||
String identifier = logicalId(workbasketAssembler.toEntityModel(definition.getWorkbasket()));
|
||||
if (identifiers.contains(identifier)) {
|
||||
duplicates.add(identifier);
|
||||
} else {
|
||||
|
|
|
@ -64,8 +64,8 @@ public class WorkbasketRepresentationModelAssembler
|
|||
}
|
||||
|
||||
public Workbasket toEntityModel(WorkbasketRepresentationModel repModel) {
|
||||
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket(repModel.getKey(),
|
||||
repModel.getDomain());
|
||||
WorkbasketImpl workbasket =
|
||||
(WorkbasketImpl) workbasketService.newWorkbasket(repModel.getKey(), repModel.getDomain());
|
||||
workbasket.setId(repModel.getWorkbasketId());
|
||||
workbasket.setName(repModel.getName());
|
||||
workbasket.setType(repModel.getType());
|
||||
|
|
|
@ -11,6 +11,7 @@ public class WorkbasketDefinitionRepresentationModel
|
|||
|
||||
@JsonIgnoreProperties("_links")
|
||||
private WorkbasketRepresentationModel workbasket;
|
||||
|
||||
private Collection<WorkbasketAccessItemRepresentationModel> authorizations;
|
||||
private Set<String> distributionTargets;
|
||||
|
||||
|
|
|
@ -4,11 +4,8 @@ import java.time.Instant;
|
|||
|
||||
import pro.taskana.workbasket.api.models.Workbasket;
|
||||
|
||||
/**
|
||||
* EntityModel class for {@link Workbasket}.
|
||||
*/
|
||||
public class WorkbasketRepresentationModel
|
||||
extends WorkbasketSummaryRepresentationModel {
|
||||
/** EntityModel class for {@link Workbasket}. */
|
||||
public class WorkbasketRepresentationModel extends WorkbasketSummaryRepresentationModel {
|
||||
|
||||
private Instant created; // ISO-8601
|
||||
private Instant modified; // ISO-8601
|
||||
|
|
|
@ -5,9 +5,7 @@ import org.springframework.hateoas.RepresentationModel;
|
|||
import pro.taskana.workbasket.api.WorkbasketType;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
|
||||
/**
|
||||
* EntityModel class for {@link WorkbasketSummary}.
|
||||
*/
|
||||
/** EntityModel class for {@link WorkbasketSummary}. */
|
||||
public class WorkbasketSummaryRepresentationModel
|
||||
extends RepresentationModel<WorkbasketSummaryRepresentationModel> {
|
||||
|
||||
|
@ -155,5 +153,4 @@ public class WorkbasketSummaryRepresentationModel
|
|||
public void setMarkedForDeletion(boolean markedForDeletion) {
|
||||
this.markedForDeletion = markedForDeletion;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -110,15 +110,11 @@ class ClassificationControllerIntTest {
|
|||
assertThat(response.getBody().getContent()).hasSize(5);
|
||||
assertThat(response.getBody().getContent().iterator().next().getKey()).isEqualTo("L1050");
|
||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||
String href = response
|
||||
.getBody()
|
||||
.getRequiredLink(IanaLinkRelations.SELF)
|
||||
.getHref();
|
||||
String href = response.getBody().getRequiredLink(IanaLinkRelations.SELF).getHref();
|
||||
assertThat(
|
||||
href
|
||||
.endsWith(
|
||||
"/api/v1/classifications?"
|
||||
+ "domain=DOMAIN_A&sort-by=key&order=asc&page-size=5&page=2"))
|
||||
href.endsWith(
|
||||
"/api/v1/classifications?"
|
||||
+ "domain=DOMAIN_A&sort-by=key&order=asc&page-size=5&page=2"))
|
||||
.isTrue();
|
||||
assertThat(response.getBody().getLink(IanaLinkRelations.FIRST)).isNotNull();
|
||||
assertThat(response.getBody().getLink(IanaLinkRelations.LAST)).isNotNull();
|
||||
|
|
|
@ -25,8 +25,7 @@ class AccessIdControllerIntTest {
|
|||
|
||||
private static RestTemplate template;
|
||||
|
||||
@Autowired
|
||||
RestHelper restHelper;
|
||||
@Autowired RestHelper restHelper;
|
||||
|
||||
@BeforeAll
|
||||
static void init() {
|
||||
|
|
|
@ -24,8 +24,7 @@ class GeneralExceptionHandlingTest {
|
|||
new ParameterizedTypeReference<
|
||||
TaskanaPagedModel<ClassificationSummaryRepresentationModel>>() {};
|
||||
private static RestTemplate template;
|
||||
@Autowired
|
||||
RestHelper restHelper;
|
||||
@Autowired RestHelper restHelper;
|
||||
|
||||
@BeforeAll
|
||||
static void init() {
|
||||
|
|
|
@ -19,8 +19,7 @@ import pro.taskana.common.rest.models.TaskanaUserInfoRepresentationModel;
|
|||
class TaskanaEngineControllerIntTest {
|
||||
|
||||
private static RestTemplate template;
|
||||
@Autowired
|
||||
RestHelper restHelper;
|
||||
@Autowired RestHelper restHelper;
|
||||
|
||||
@BeforeAll
|
||||
static void init() {
|
||||
|
|
|
@ -67,36 +67,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
|
||||
http.authorizeRequests()
|
||||
.and()
|
||||
.csrf()
|
||||
.disable()
|
||||
.httpBasic()
|
||||
.and()
|
||||
.addFilter(jaasApiIntegrationFilter())
|
||||
.addFilterAfter(new SpringSecurityToJaasFilter(), JaasApiIntegrationFilter.class)
|
||||
.authorizeRequests()
|
||||
.anyRequest()
|
||||
.fullyAuthenticated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.ldapAuthentication()
|
||||
.userDnPatterns(ldapUserDnPatterns)
|
||||
.groupSearchBase(ldapGroupSearchBase)
|
||||
.ldapAuthoritiesPopulator(authoritiesPopulator())
|
||||
.authoritiesMapper(grantedAuthoritiesMapper())
|
||||
.contextSource()
|
||||
.url(ldapServerUrl + "/" + ldapBaseDn)
|
||||
.and()
|
||||
.passwordCompare()
|
||||
.passwordAttribute("userPassword");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LdapAuthoritiesPopulator authoritiesPopulator() {
|
||||
Function<Map<String, List<String>>, GrantedAuthority> authorityMapper =
|
||||
|
@ -127,12 +97,34 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
return grantedAuthoritiesMapper;
|
||||
}
|
||||
|
||||
private static class CorsWebMvcConfigurer implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.ldapAuthentication()
|
||||
.userDnPatterns(ldapUserDnPatterns)
|
||||
.groupSearchBase(ldapGroupSearchBase)
|
||||
.ldapAuthoritiesPopulator(authoritiesPopulator())
|
||||
.authoritiesMapper(grantedAuthoritiesMapper())
|
||||
.contextSource()
|
||||
.url(ldapServerUrl + "/" + ldapBaseDn)
|
||||
.and()
|
||||
.passwordCompare()
|
||||
.passwordAttribute("userPassword");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**").allowedOrigins("*");
|
||||
}
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
|
||||
http.authorizeRequests()
|
||||
.and()
|
||||
.csrf()
|
||||
.disable()
|
||||
.httpBasic()
|
||||
.and()
|
||||
.addFilter(jaasApiIntegrationFilter())
|
||||
.addFilterAfter(new SpringSecurityToJaasFilter(), JaasApiIntegrationFilter.class)
|
||||
.authorizeRequests()
|
||||
.anyRequest()
|
||||
.fullyAuthenticated();
|
||||
}
|
||||
|
||||
private JaasApiIntegrationFilter jaasApiIntegrationFilter() {
|
||||
|
@ -140,4 +132,12 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
filter.setCreateEmptySubject(true);
|
||||
return filter;
|
||||
}
|
||||
|
||||
private static class CorsWebMvcConfigurer implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**").allowedOrigins("*");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,13 +22,10 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
|||
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
|
||||
/**
|
||||
* Generate REST Dokumentation for ClassificationController.
|
||||
*/
|
||||
/** Generate REST Dokumentation for ClassificationController. */
|
||||
class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
|
||||
|
||||
private final HashMap<String, String> classificationFieldDescriptionsMap =
|
||||
new HashMap<>();
|
||||
private final HashMap<String, String> classificationFieldDescriptionsMap = new HashMap<>();
|
||||
|
||||
private FieldDescriptor[] allClassificationsFieldDescriptors;
|
||||
private FieldDescriptor[] classificationFieldDescriptors;
|
||||
|
@ -253,7 +250,7 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
|
|||
this.mockMvc
|
||||
.perform(
|
||||
RestDocumentationRequestBuilders.get(
|
||||
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS) + "?domain=DOMAIN_B")
|
||||
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS) + "?domain=DOMAIN_B")
|
||||
.accept("application/hal+json")
|
||||
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
|
|
|
@ -82,10 +82,10 @@ class TaskCommentControllerRestDocumentation extends BaseRestDocumentation {
|
|||
};
|
||||
|
||||
allTaskCommentsFieldDescriptors =
|
||||
new FieldDescriptor[]{
|
||||
subsectionWithPath(TaskanaPagedModelKeys.TASK_COMMENTS.getPropertyName()).description(
|
||||
"An Array of task comments"),
|
||||
fieldWithPath("_links.self.href").ignored()
|
||||
new FieldDescriptor[] {
|
||||
subsectionWithPath(TaskanaPagedModelKeys.TASK_COMMENTS.getPropertyName())
|
||||
.description("An Array of task comments"),
|
||||
fieldWithPath("_links.self.href").ignored()
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -60,11 +60,9 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
|||
taskFieldDescriptionsMap.put("priority", "The priority of the task");
|
||||
taskFieldDescriptionsMap.put("state", "he state of the task. See (...)");
|
||||
taskFieldDescriptionsMap.put(
|
||||
"classificationSummary",
|
||||
"The <<classification-subset, Classification>> of the task");
|
||||
"classificationSummary", "The <<classification-subset, Classification>> of the task");
|
||||
taskFieldDescriptionsMap.put(
|
||||
"workbasketSummary",
|
||||
"The <<workbasket-subset, Workbasket>> of the task");
|
||||
"workbasketSummary", "The <<workbasket-subset, Workbasket>> of the task");
|
||||
taskFieldDescriptionsMap.put("businessProcessId", "");
|
||||
taskFieldDescriptionsMap.put("parentBusinessProcessId", "");
|
||||
taskFieldDescriptionsMap.put(
|
||||
|
@ -133,30 +131,28 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
|||
.description(taskFieldDescriptionsMap.get("planned"))
|
||||
.type("String"),
|
||||
fieldWithPath("due").description(taskFieldDescriptionsMap.get("due")).type("String"),
|
||||
fieldWithPath("name").description(taskFieldDescriptionsMap.get("name")),
|
||||
fieldWithPath("creator").description(taskFieldDescriptionsMap.get("creator")),
|
||||
fieldWithPath("description").description(taskFieldDescriptionsMap.get("description")),
|
||||
fieldWithPath("note")
|
||||
.description(taskFieldDescriptionsMap.get("note"))
|
||||
.description("Some custom Note"),
|
||||
fieldWithPath("priority").description(taskFieldDescriptionsMap.get("priority")),
|
||||
fieldWithPath("state").description(taskFieldDescriptionsMap.get("state")),
|
||||
subsectionWithPath("classificationSummary")
|
||||
.description(
|
||||
taskFieldDescriptionsMap.get("classificationSummary")),
|
||||
subsectionWithPath("workbasketSummary")
|
||||
.description(taskFieldDescriptionsMap.get("workbasketSummary")),
|
||||
fieldWithPath("businessProcessId")
|
||||
.description(taskFieldDescriptionsMap.get("businessProcessId")),
|
||||
fieldWithPath("parentBusinessProcessId")
|
||||
.description(taskFieldDescriptionsMap.get("parentBusinessProcessId")),
|
||||
fieldWithPath("owner").description(taskFieldDescriptionsMap.get("owner")).type(
|
||||
"String"),
|
||||
fieldWithPath("primaryObjRef.id")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.id"))
|
||||
.type("String"),
|
||||
fieldWithPath("primaryObjRef.company")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.company")),
|
||||
fieldWithPath("name").description(taskFieldDescriptionsMap.get("name")),
|
||||
fieldWithPath("creator").description(taskFieldDescriptionsMap.get("creator")),
|
||||
fieldWithPath("description").description(taskFieldDescriptionsMap.get("description")),
|
||||
fieldWithPath("note")
|
||||
.description(taskFieldDescriptionsMap.get("note"))
|
||||
.description("Some custom Note"),
|
||||
fieldWithPath("priority").description(taskFieldDescriptionsMap.get("priority")),
|
||||
fieldWithPath("state").description(taskFieldDescriptionsMap.get("state")),
|
||||
subsectionWithPath("classificationSummary")
|
||||
.description(taskFieldDescriptionsMap.get("classificationSummary")),
|
||||
subsectionWithPath("workbasketSummary")
|
||||
.description(taskFieldDescriptionsMap.get("workbasketSummary")),
|
||||
fieldWithPath("businessProcessId")
|
||||
.description(taskFieldDescriptionsMap.get("businessProcessId")),
|
||||
fieldWithPath("parentBusinessProcessId")
|
||||
.description(taskFieldDescriptionsMap.get("parentBusinessProcessId")),
|
||||
fieldWithPath("owner").description(taskFieldDescriptionsMap.get("owner")).type("String"),
|
||||
fieldWithPath("primaryObjRef.id")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.id"))
|
||||
.type("String"),
|
||||
fieldWithPath("primaryObjRef.company")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.company")),
|
||||
fieldWithPath("primaryObjRef.system")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.system")),
|
||||
fieldWithPath("primaryObjRef.systemInstance")
|
||||
|
@ -238,29 +234,28 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
|||
.description(taskFieldDescriptionsMap.get("planned"))
|
||||
.type("String"),
|
||||
fieldWithPath("due").description(taskFieldDescriptionsMap.get("due")).type("String"),
|
||||
fieldWithPath("name").description(taskFieldDescriptionsMap.get("name")),
|
||||
fieldWithPath("creator").description(taskFieldDescriptionsMap.get("creator")),
|
||||
fieldWithPath("description").ignored(),
|
||||
fieldWithPath("note")
|
||||
.description(taskFieldDescriptionsMap.get("note"))
|
||||
.description("Some custom Note"),
|
||||
fieldWithPath("priority").description(taskFieldDescriptionsMap.get("priority")),
|
||||
fieldWithPath("state").description(taskFieldDescriptionsMap.get("state")),
|
||||
subsectionWithPath("classificationSummary")
|
||||
.description(
|
||||
taskFieldDescriptionsMap.get("classificationSummary")),
|
||||
subsectionWithPath("workbasketSummary")
|
||||
.description(taskFieldDescriptionsMap.get("workbasketSummary")),
|
||||
fieldWithPath("businessProcessId")
|
||||
.description(taskFieldDescriptionsMap.get("businessProcessId")),
|
||||
fieldWithPath("parentBusinessProcessId")
|
||||
.description(taskFieldDescriptionsMap.get("parentBusinessProcessId")),
|
||||
fieldWithPath("owner").description(taskFieldDescriptionsMap.get("owner")),
|
||||
fieldWithPath("primaryObjRef.id")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.id"))
|
||||
.type("String"),
|
||||
fieldWithPath("primaryObjRef.company")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.company")),
|
||||
fieldWithPath("name").description(taskFieldDescriptionsMap.get("name")),
|
||||
fieldWithPath("creator").description(taskFieldDescriptionsMap.get("creator")),
|
||||
fieldWithPath("description").ignored(),
|
||||
fieldWithPath("note")
|
||||
.description(taskFieldDescriptionsMap.get("note"))
|
||||
.description("Some custom Note"),
|
||||
fieldWithPath("priority").description(taskFieldDescriptionsMap.get("priority")),
|
||||
fieldWithPath("state").description(taskFieldDescriptionsMap.get("state")),
|
||||
subsectionWithPath("classificationSummary")
|
||||
.description(taskFieldDescriptionsMap.get("classificationSummary")),
|
||||
subsectionWithPath("workbasketSummary")
|
||||
.description(taskFieldDescriptionsMap.get("workbasketSummary")),
|
||||
fieldWithPath("businessProcessId")
|
||||
.description(taskFieldDescriptionsMap.get("businessProcessId")),
|
||||
fieldWithPath("parentBusinessProcessId")
|
||||
.description(taskFieldDescriptionsMap.get("parentBusinessProcessId")),
|
||||
fieldWithPath("owner").description(taskFieldDescriptionsMap.get("owner")),
|
||||
fieldWithPath("primaryObjRef.id")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.id"))
|
||||
.type("String"),
|
||||
fieldWithPath("primaryObjRef.company")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.company")),
|
||||
fieldWithPath("primaryObjRef.system")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.system")),
|
||||
fieldWithPath("primaryObjRef.systemInstance")
|
||||
|
@ -294,21 +289,21 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
|||
};
|
||||
|
||||
createTaskFieldDescriptors =
|
||||
new FieldDescriptor[]{
|
||||
subsectionWithPath("classificationSummary")
|
||||
.description("The new classificationSummary for the task"),
|
||||
subsectionWithPath("workbasketSummary")
|
||||
.description("The new workbasketSummary for the task"),
|
||||
fieldWithPath("externalId")
|
||||
.description(taskFieldDescriptionsMap.get("externalId"))
|
||||
.type("String")
|
||||
.optional(),
|
||||
fieldWithPath("primaryObjRef.company")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.company")),
|
||||
fieldWithPath("primaryObjRef.system")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.system")),
|
||||
fieldWithPath("primaryObjRef.systemInstance")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.systemInstance")),
|
||||
new FieldDescriptor[] {
|
||||
subsectionWithPath("classificationSummary")
|
||||
.description("The new classificationSummary for the task"),
|
||||
subsectionWithPath("workbasketSummary")
|
||||
.description("The new workbasketSummary for the task"),
|
||||
fieldWithPath("externalId")
|
||||
.description(taskFieldDescriptionsMap.get("externalId"))
|
||||
.type("String")
|
||||
.optional(),
|
||||
fieldWithPath("primaryObjRef.company")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.company")),
|
||||
fieldWithPath("primaryObjRef.system")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.system")),
|
||||
fieldWithPath("primaryObjRef.systemInstance")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.systemInstance")),
|
||||
fieldWithPath("primaryObjRef.type")
|
||||
.description(taskFieldDescriptionsMap.get("primaryObjRef.type")),
|
||||
fieldWithPath("primaryObjRef.value")
|
||||
|
|
|
@ -38,8 +38,8 @@ class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDocumentat
|
|||
void exportAllWorkbasketDefinitions() throws Exception {
|
||||
this.mockMvc
|
||||
.perform(
|
||||
RestDocumentationRequestBuilders
|
||||
.get(restHelper.toUrl(Mapping.URL_WORKBASKET_DEFINITIONS))
|
||||
RestDocumentationRequestBuilders.get(
|
||||
restHelper.toUrl(Mapping.URL_WORKBASKET_DEFINITIONS))
|
||||
.accept("application/json")
|
||||
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
|
|
|
@ -24,9 +24,7 @@ import pro.taskana.monitor.api.reports.item.DetailedMonitorQueryItem;
|
|||
import pro.taskana.monitor.api.reports.item.MonitorQueryItem;
|
||||
import pro.taskana.monitor.rest.assembler.ReportRepresentationModelAssembler;
|
||||
|
||||
/**
|
||||
* Test for {@link ReportRepresentationModelAssembler}.
|
||||
*/
|
||||
/** Test for {@link ReportRepresentationModelAssembler}. */
|
||||
@TaskanaSpringBootTest
|
||||
class ReportRepresentationModelTest {
|
||||
|
||||
|
|
|
@ -26,23 +26,19 @@ import pro.taskana.common.rest.TaskanaSpringBootTest;
|
|||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.task.rest.models.TaskCommentRepresentationModel;
|
||||
|
||||
/**
|
||||
* Test TaskCommentController.
|
||||
*/
|
||||
/** Test TaskCommentController. */
|
||||
@TaskanaSpringBootTest
|
||||
class TaskCommentControllerIntTest {
|
||||
|
||||
private static final ParameterizedTypeReference<TaskanaPagedModel<TaskCommentRepresentationModel>>
|
||||
TASK_COMMENT_PAGE_MODEL_TYPE =
|
||||
new ParameterizedTypeReference<TaskanaPagedModel<TaskCommentRepresentationModel>>() {
|
||||
};
|
||||
new ParameterizedTypeReference<TaskanaPagedModel<TaskCommentRepresentationModel>>() {};
|
||||
private static RestTemplate template;
|
||||
|
||||
@Value("${taskana.schemaName:TASKANA}")
|
||||
public String schemaName;
|
||||
|
||||
@Autowired
|
||||
RestHelper restHelper;
|
||||
@Autowired RestHelper restHelper;
|
||||
|
||||
@BeforeAll
|
||||
static void init() {
|
||||
|
@ -92,15 +88,16 @@ class TaskCommentControllerIntTest {
|
|||
void should_ReturnSortedAndOrederedTaskCommentsSortedByModified_When_UsingSortAndOrderParams() {
|
||||
|
||||
String url =
|
||||
restHelper.toUrl(Mapping.URL_TASK_GET_POST_COMMENTS,
|
||||
"TKI:000000000000000000000000000000000000");
|
||||
restHelper.toUrl(
|
||||
Mapping.URL_TASK_GET_POST_COMMENTS, "TKI:000000000000000000000000000000000000");
|
||||
|
||||
ResponseEntity<TaskanaPagedModel<TaskCommentRepresentationModel>>
|
||||
getTaskCommentsSortedByModifiedOrderedByDescendingResponse = template.exchange(
|
||||
url + "?sort-by=modified&order=desc",
|
||||
HttpMethod.GET,
|
||||
new HttpEntity<String>(restHelper.getHeadersAdmin()),
|
||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||
getTaskCommentsSortedByModifiedOrderedByDescendingResponse =
|
||||
template.exchange(
|
||||
url + "?sort-by=modified&order=desc",
|
||||
HttpMethod.GET,
|
||||
new HttpEntity<String>(restHelper.getHeadersAdmin()),
|
||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||
|
||||
assertThat(getTaskCommentsSortedByModifiedOrderedByDescendingResponse.getBody().getContent())
|
||||
.hasSize(3)
|
||||
|
@ -108,11 +105,12 @@ class TaskCommentControllerIntTest {
|
|||
.isSortedAccordingTo(Comparator.reverseOrder());
|
||||
|
||||
ResponseEntity<TaskanaPagedModel<TaskCommentRepresentationModel>>
|
||||
getTaskCommentsSortedByModifiedOrderedByAscendingResponse = template.exchange(
|
||||
url + "?sort-by=modified",
|
||||
HttpMethod.GET,
|
||||
new HttpEntity<String>(restHelper.getHeadersAdmin()),
|
||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||
getTaskCommentsSortedByModifiedOrderedByAscendingResponse =
|
||||
template.exchange(
|
||||
url + "?sort-by=modified",
|
||||
HttpMethod.GET,
|
||||
new HttpEntity<String>(restHelper.getHeadersAdmin()),
|
||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||
|
||||
assertThat(getTaskCommentsSortedByModifiedOrderedByAscendingResponse.getBody().getContent())
|
||||
.hasSize(3)
|
||||
|
@ -120,11 +118,12 @@ class TaskCommentControllerIntTest {
|
|||
.isSortedAccordingTo(Comparator.naturalOrder());
|
||||
|
||||
ResponseEntity<TaskanaPagedModel<TaskCommentRepresentationModel>>
|
||||
getTaskCommentsSortedByCreatedOrderedByDescendingResponse = template.exchange(
|
||||
url + "?sort-by=created&order=desc",
|
||||
HttpMethod.GET,
|
||||
new HttpEntity<String>(restHelper.getHeadersAdmin()),
|
||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||
getTaskCommentsSortedByCreatedOrderedByDescendingResponse =
|
||||
template.exchange(
|
||||
url + "?sort-by=created&order=desc",
|
||||
HttpMethod.GET,
|
||||
new HttpEntity<String>(restHelper.getHeadersAdmin()),
|
||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||
|
||||
assertThat(getTaskCommentsSortedByCreatedOrderedByDescendingResponse.getBody().getContent())
|
||||
.hasSize(3)
|
||||
|
@ -132,26 +131,26 @@ class TaskCommentControllerIntTest {
|
|||
.isSortedAccordingTo(Comparator.reverseOrder());
|
||||
|
||||
ResponseEntity<TaskanaPagedModel<TaskCommentRepresentationModel>>
|
||||
getTaskCommentsSortedByCreatedOrderedByAscendingResponse = template.exchange(
|
||||
url + "?sort-by=created",
|
||||
HttpMethod.GET,
|
||||
new HttpEntity<String>(restHelper.getHeadersAdmin()),
|
||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||
getTaskCommentsSortedByCreatedOrderedByAscendingResponse =
|
||||
template.exchange(
|
||||
url + "?sort-by=created",
|
||||
HttpMethod.GET,
|
||||
new HttpEntity<String>(restHelper.getHeadersAdmin()),
|
||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||
|
||||
assertThat(getTaskCommentsSortedByCreatedOrderedByAscendingResponse.getBody().getContent())
|
||||
.hasSize(3)
|
||||
.extracting(TaskCommentRepresentationModel::getCreated)
|
||||
.isSortedAccordingTo(Comparator.naturalOrder());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_ThrowException_When_UsingInvalidSortParam() {
|
||||
|
||||
String url =
|
||||
restHelper.toUrl(Mapping.URL_TASK_GET_POST_COMMENTS,
|
||||
"TKI:000000000000000000000000000000000000");
|
||||
|
||||
restHelper.toUrl(
|
||||
Mapping.URL_TASK_GET_POST_COMMENTS, "TKI:000000000000000000000000000000000000");
|
||||
|
||||
ThrowingCallable httpCall =
|
||||
() -> {
|
||||
template.exchange(
|
||||
|
@ -163,10 +162,8 @@ class TaskCommentControllerIntTest {
|
|||
assertThatThrownBy(httpCall)
|
||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||
.isEqualTo(HttpStatus.BAD_REQUEST);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Disabled("Disabled until Authorization check is up!")
|
||||
@Test
|
||||
void should_FailToReturnTaskComment_When_TaskIstNotVisible() {
|
||||
|
@ -338,12 +335,12 @@ class TaskCommentControllerIntTest {
|
|||
|
||||
ResponseEntity<TaskanaPagedModel<TaskCommentRepresentationModel>>
|
||||
getTaskCommentsBeforeDeleteionResponse =
|
||||
template.exchange(
|
||||
restHelper.toUrl(
|
||||
Mapping.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000001"),
|
||||
HttpMethod.GET,
|
||||
new HttpEntity<String>(restHelper.getHeadersAdmin()),
|
||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||
template.exchange(
|
||||
restHelper.toUrl(
|
||||
Mapping.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000001"),
|
||||
HttpMethod.GET,
|
||||
new HttpEntity<String>(restHelper.getHeadersAdmin()),
|
||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||
assertThat(getTaskCommentsBeforeDeleteionResponse.getBody().getContent()).hasSize(2);
|
||||
|
||||
String url =
|
||||
|
|
|
@ -149,9 +149,7 @@ class WorkbasketControllerIntTest {
|
|||
TEMPLATE.exchange(
|
||||
restHelper.toUrl(Mapping.URL_WORKBASKET_ID, workbasketId),
|
||||
HttpMethod.PUT,
|
||||
new HttpEntity<>(
|
||||
workbasketRepresentationModel,
|
||||
restHelper.getHeadersTeamlead_1()),
|
||||
new HttpEntity<>(workbasketRepresentationModel, restHelper.getHeadersTeamlead_1()),
|
||||
ParameterizedTypeReference.forType(WorkbasketRepresentationModel.class));
|
||||
};
|
||||
assertThatThrownBy(httpCall)
|
||||
|
@ -287,8 +285,7 @@ class WorkbasketControllerIntTest {
|
|||
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
|
||||
assertThat(response.getBody()).isNotNull();
|
||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||
assertThat(response.getHeaders().getContentType())
|
||||
.isEqualTo(MediaTypes.HAL_JSON);
|
||||
assertThat(response.getHeaders().getContentType()).isEqualTo(MediaTypes.HAL_JSON);
|
||||
assertThat(response.getBody().getContent()).hasSize(4);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue