TSK-1265: fixed checkstyle
This commit is contained in:
parent
6c4fef7635
commit
005075d852
|
|
@ -11,7 +11,8 @@ public final class Mapping {
|
||||||
public static final String URL_CLASSIFICATIONDEFINITIONS = PRE + "classification-definitions";
|
public static final String URL_CLASSIFICATIONDEFINITIONS = PRE + "classification-definitions";
|
||||||
public static final String URL_MONITOR = PRE + "monitor";
|
public static final String URL_MONITOR = PRE + "monitor";
|
||||||
public static final String URL_MONITOR_TASKS_STATUS = URL_MONITOR + "/tasks-status-report";
|
public static final String URL_MONITOR_TASKS_STATUS = URL_MONITOR + "/tasks-status-report";
|
||||||
public static final String URL_MONITOR_TASKS_WORKBASKET = URL_MONITOR + "/tasks-workbasket-report";
|
public static final String URL_MONITOR_TASKS_WORKBASKET =
|
||||||
|
URL_MONITOR + "/tasks-workbasket-report";
|
||||||
public static final String URL_MONITOR_TASKS_WORKBASKET_PLANNED =
|
public static final String URL_MONITOR_TASKS_WORKBASKET_PLANNED =
|
||||||
URL_MONITOR + "/tasks-workbasket-planned-date-report";
|
URL_MONITOR + "/tasks-workbasket-planned-date-report";
|
||||||
public static final String URL_MONITOR_TASKS_CLASSIFICATION =
|
public static final String URL_MONITOR_TASKS_CLASSIFICATION =
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ package pro.taskana.task.rest.assembler;
|
||||||
|
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.hateoas.server.RepresentationModelAssembler;
|
import org.springframework.hateoas.server.RepresentationModelAssembler;
|
||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
|
|
@ -16,9 +14,7 @@ import pro.taskana.task.internal.models.AttachmentImpl;
|
||||||
import pro.taskana.task.rest.AttachmentController;
|
import pro.taskana.task.rest.AttachmentController;
|
||||||
import pro.taskana.task.rest.models.AttachmentRepresentationModel;
|
import pro.taskana.task.rest.models.AttachmentRepresentationModel;
|
||||||
|
|
||||||
/**
|
/** EntityModel assembler for {@link AttachmentRepresentationModel}. */
|
||||||
* EntityModel assembler for {@link AttachmentRepresentationModel}.
|
|
||||||
*/
|
|
||||||
@Component
|
@Component
|
||||||
public class AttachmentRepresentationModelAssembler
|
public class AttachmentRepresentationModelAssembler
|
||||||
implements RepresentationModelAssembler<Attachment, AttachmentRepresentationModel> {
|
implements RepresentationModelAssembler<Attachment, AttachmentRepresentationModel> {
|
||||||
|
|
@ -53,8 +49,7 @@ public class AttachmentRepresentationModelAssembler
|
||||||
return repModel;
|
return repModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AttachmentImpl toEntityModel(
|
public AttachmentImpl toEntityModel(AttachmentRepresentationModel attachmentRepresentationModel) {
|
||||||
AttachmentRepresentationModel attachmentRepresentationModel) {
|
|
||||||
AttachmentImpl attachment = (AttachmentImpl) taskService.newAttachment();
|
AttachmentImpl attachment = (AttachmentImpl) taskService.newAttachment();
|
||||||
attachment.setId(attachmentRepresentationModel.getAttachmentId());
|
attachment.setId(attachmentRepresentationModel.getAttachmentId());
|
||||||
attachment.setTaskId(attachmentRepresentationModel.getTaskId());
|
attachment.setTaskId(attachmentRepresentationModel.getTaskId());
|
||||||
|
|
@ -70,4 +65,3 @@ public class AttachmentRepresentationModelAssembler
|
||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,8 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.TASK_COMMENTS;
|
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.TASK_COMMENTS;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.hateoas.PagedModel.PageMetadata;
|
import org.springframework.hateoas.PagedModel.PageMetadata;
|
||||||
import org.springframework.hateoas.server.RepresentationModelAssembler;
|
|
||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
@ -67,15 +64,15 @@ public class TaskCommentRepresentationModelAssembler
|
||||||
return taskComment;
|
return taskComment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskanaPagedModelKeys getProperty() {
|
||||||
|
return TASK_COMMENTS;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PageLinks(Mapping.URL_TASK_COMMENTS)
|
@PageLinks(Mapping.URL_TASK_COMMENTS)
|
||||||
public TaskanaPagedModel<TaskCommentRepresentationModel> toPageModel(
|
public TaskanaPagedModel<TaskCommentRepresentationModel> toPageModel(
|
||||||
Iterable<TaskComment> taskComments, PageMetadata pageMetadata) {
|
Iterable<TaskComment> taskComments, PageMetadata pageMetadata) {
|
||||||
return TaskanaPagingAssembler.super.toPageModel(taskComments, pageMetadata);
|
return TaskanaPagingAssembler.super.toPageModel(taskComments, pageMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TaskanaPagedModelKeys getProperty() {
|
|
||||||
return TASK_COMMENTS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ public class TaskRepresentationModel extends TaskSummaryRepresentationModel {
|
||||||
return of(entry.getKey(), entry.getValue());
|
return of(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CustomAttribute of (String key, String value) {
|
public static CustomAttribute of(String key, String value) {
|
||||||
CustomAttribute customAttribute = new CustomAttribute();
|
CustomAttribute customAttribute = new CustomAttribute();
|
||||||
customAttribute.setKey(key);
|
customAttribute.setKey(key);
|
||||||
customAttribute.setValue(value);
|
customAttribute.setValue(value);
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,11 @@ package pro.taskana.workbasket.rest.assembler;
|
||||||
|
|
||||||
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.DISTRIBUTION_TARGETS;
|
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.DISTRIBUTION_TARGETS;
|
||||||
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.WORKBASKETS;
|
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.WORKBASKETS;
|
||||||
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.WORKBASKET_DEFINITIONS;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.hateoas.PagedModel.PageMetadata;
|
import org.springframework.hateoas.PagedModel.PageMetadata;
|
||||||
import org.springframework.hateoas.server.RepresentationModelAssembler;
|
|
||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
@ -22,17 +20,14 @@ import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||||
import pro.taskana.workbasket.internal.models.WorkbasketImpl;
|
import pro.taskana.workbasket.internal.models.WorkbasketImpl;
|
||||||
import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel;
|
import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel;
|
||||||
|
|
||||||
/**
|
/** EntityModel assembler for {@link WorkbasketSummaryRepresentationModel}. */
|
||||||
* EntityModel assembler for {@link WorkbasketSummaryRepresentationModel}.
|
|
||||||
*/
|
|
||||||
@Component
|
@Component
|
||||||
public class WorkbasketSummaryRepresentationModelAssembler implements
|
public class WorkbasketSummaryRepresentationModelAssembler
|
||||||
TaskanaPagingAssembler<WorkbasketSummary, WorkbasketSummaryRepresentationModel> {
|
implements TaskanaPagingAssembler<WorkbasketSummary, WorkbasketSummaryRepresentationModel> {
|
||||||
|
|
||||||
private WorkbasketService workbasketService;
|
private WorkbasketService workbasketService;
|
||||||
|
|
||||||
public WorkbasketSummaryRepresentationModelAssembler() {
|
public WorkbasketSummaryRepresentationModelAssembler() {}
|
||||||
}
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public WorkbasketSummaryRepresentationModelAssembler(WorkbasketService workbasketService) {
|
public WorkbasketSummaryRepresentationModelAssembler(WorkbasketService workbasketService) {
|
||||||
|
|
@ -83,6 +78,11 @@ public class WorkbasketSummaryRepresentationModelAssembler implements
|
||||||
return workbasket;
|
return workbasket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskanaPagedModelKeys getProperty() {
|
||||||
|
return WORKBASKETS;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PageLinks(Mapping.URL_WORKBASKET)
|
@PageLinks(Mapping.URL_WORKBASKET)
|
||||||
public TaskanaPagedModel<WorkbasketSummaryRepresentationModel> toPageModel(
|
public TaskanaPagedModel<WorkbasketSummaryRepresentationModel> toPageModel(
|
||||||
|
|
@ -90,19 +90,14 @@ public class WorkbasketSummaryRepresentationModelAssembler implements
|
||||||
return TaskanaPagingAssembler.super.toPageModel(entities, pageMetadata);
|
return TaskanaPagingAssembler.super.toPageModel(entities, pageMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TaskanaPagedModelKeys getProperty() {
|
|
||||||
return WORKBASKETS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PageLinks(Mapping.URL_WORKBASKET_ID_DISTRIBUTION)
|
@PageLinks(Mapping.URL_WORKBASKET_ID_DISTRIBUTION)
|
||||||
public TaskanaPagedModel<WorkbasketSummaryRepresentationModel> toDistributionTargetPageModel(
|
public TaskanaPagedModel<WorkbasketSummaryRepresentationModel> toDistributionTargetPageModel(
|
||||||
List<WorkbasketSummary> workbasketSummaries, PageMetadata pageMetadata) {
|
List<WorkbasketSummary> workbasketSummaries, PageMetadata pageMetadata) {
|
||||||
return workbasketSummaries.stream()
|
return workbasketSummaries.stream()
|
||||||
.map(this::toModel)
|
.map(this::toModel)
|
||||||
.collect(
|
.collect(
|
||||||
Collectors.collectingAndThen(
|
Collectors.collectingAndThen(
|
||||||
Collectors.toList(),
|
Collectors.toList(),
|
||||||
list -> new TaskanaPagedModel<>(DISTRIBUTION_TARGETS, list, pageMetadata)));
|
list -> new TaskanaPagedModel<>(DISTRIBUTION_TARGETS, list, pageMetadata)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import java.time.Instant;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
|
@ -29,9 +28,7 @@ import pro.taskana.workbasket.api.WorkbasketService;
|
||||||
import pro.taskana.workbasket.api.models.Workbasket;
|
import pro.taskana.workbasket.api.models.Workbasket;
|
||||||
import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel;
|
import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel;
|
||||||
|
|
||||||
/**
|
/** Test for {@link TaskRepresentationModelAssembler}. */
|
||||||
* Test for {@link TaskRepresentationModelAssembler}.
|
|
||||||
*/
|
|
||||||
@TaskanaSpringBootTest
|
@TaskanaSpringBootTest
|
||||||
class TaskRepresentationModelAssemberTest {
|
class TaskRepresentationModelAssemberTest {
|
||||||
|
|
||||||
|
|
@ -41,7 +38,9 @@ class TaskRepresentationModelAssemberTest {
|
||||||
TaskRepresentationModelAssembler taskRepresentationModelAssembler;
|
TaskRepresentationModelAssembler taskRepresentationModelAssembler;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TaskRepresentationModelAssemberTest(TaskService taskService, WorkbasketService workbasketService,
|
TaskRepresentationModelAssemberTest(
|
||||||
|
TaskService taskService,
|
||||||
|
WorkbasketService workbasketService,
|
||||||
ClassificationService classificationService,
|
ClassificationService classificationService,
|
||||||
TaskRepresentationModelAssembler taskRepresentationModelAssembler) {
|
TaskRepresentationModelAssembler taskRepresentationModelAssembler) {
|
||||||
this.taskService = taskService;
|
this.taskService = taskService;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue