TSK-1209 refactored package structure
* TSK-1209: refactored package structure * TASK-1209: remember to squash this Co-authored-by: Christopher Heiting <christopher.heiting@novatec-gmbh.de>
This commit is contained in:
parent
7827557093
commit
8a6f7d573b
|
@ -23,7 +23,7 @@ import pro.taskana.common.api.BaseQuery;
|
|||
import pro.taskana.common.api.LoggerUtils;
|
||||
import pro.taskana.common.api.TimeInterval;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.rest.AbstractPagingController;
|
||||
import pro.taskana.common.rest.AbstractPagingController;
|
||||
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
||||
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||
import pro.taskana.simplehistory.query.HistoryQuery;
|
||||
|
@ -130,9 +130,9 @@ public class TaskHistoryEventController extends AbstractPagingController {
|
|||
|
||||
private static final String PAGING_PAGE_SIZE = "page-size";
|
||||
|
||||
private SimpleHistoryServiceImpl simpleHistoryService;
|
||||
private final SimpleHistoryServiceImpl simpleHistoryService;
|
||||
|
||||
private TaskHistoryEventResourceAssembler taskHistoryEventResourceAssembler;
|
||||
private final TaskHistoryEventResourceAssembler taskHistoryEventResourceAssembler;
|
||||
|
||||
public TaskHistoryEventController(
|
||||
TaskanaEngineConfiguration taskanaEngineConfiguration,
|
||||
|
@ -154,10 +154,10 @@ public class TaskHistoryEventController extends AbstractPagingController {
|
|||
|
||||
HistoryQuery query = simpleHistoryService.createHistoryQuery();
|
||||
query = applySortingParams(query, params);
|
||||
query = applyFilterParams(query, params);
|
||||
applyFilterParams(query, params);
|
||||
|
||||
PageMetadata pageMetadata = null;
|
||||
List<HistoryEventImpl> historyEvents = null;
|
||||
List<HistoryEventImpl> historyEvents;
|
||||
final String page = params.getFirst(PAGING_PAGE);
|
||||
final String pageSize = params.getFirst(PAGING_PAGE_SIZE);
|
||||
params.remove(PAGING_PAGE);
|
||||
|
@ -298,7 +298,7 @@ public class TaskHistoryEventController extends AbstractPagingController {
|
|||
return query;
|
||||
}
|
||||
|
||||
private HistoryQuery applyFilterParams(HistoryQuery query, MultiValueMap<String, String> params) {
|
||||
private void applyFilterParams(HistoryQuery query, MultiValueMap<String, String> params) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", query, params);
|
||||
}
|
||||
|
@ -487,7 +487,6 @@ public class TaskHistoryEventController extends AbstractPagingController {
|
|||
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
private TimeInterval getTimeIntervalOf(String[] created) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import pro.taskana.simplehistory.rest.resource.TaskHistoryEventResourceAssembler
|
|||
|
||||
/** Configuration for Taskana history REST service. */
|
||||
@Configuration
|
||||
@ComponentScan(basePackages = {"pro.taskana.rest", "pro.taskana.simplehistory.rest"})
|
||||
@ComponentScan(basePackages = {"pro.taskana", "pro.taskana.simplehistory.rest"})
|
||||
@EnableTransactionManagement
|
||||
public class TaskHistoryRestConfiguration {
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Collection;
|
|||
import org.springframework.hateoas.Link;
|
||||
import org.springframework.hateoas.PagedModel.PageMetadata;
|
||||
|
||||
import pro.taskana.rest.resource.PagedResources;
|
||||
import pro.taskana.common.rest.models.PagedResources;
|
||||
|
||||
/** Resource class for {@link TaskHistoryEventResource} with Pagination. */
|
||||
public class TaskHistoryEventListResource extends PagedResources<TaskHistoryEventResource> {
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.springframework.hateoas.IanaLinkRelations;
|
|||
import org.springframework.hateoas.Link;
|
||||
import org.springframework.hateoas.PagedModel.PageMetadata;
|
||||
|
||||
import pro.taskana.rest.resource.AbstractRessourcesAssembler;
|
||||
import pro.taskana.resource.rest.AbstractRessourcesAssembler;
|
||||
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
||||
import pro.taskana.simplehistory.rest.TaskHistoryEventController;
|
||||
|
||||
|
|
|
@ -9,10 +9,12 @@ import org.springframework.context.annotation.ComponentScan;
|
|||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import pro.taskana.RestConfiguration;
|
||||
import pro.taskana.common.rest.AccessIdController;
|
||||
import pro.taskana.common.rest.ldap.LdapClient;
|
||||
import pro.taskana.common.rest.ldap.LdapConfiguration;
|
||||
import pro.taskana.jobs.TransactionalJobsConfiguration;
|
||||
import pro.taskana.ldap.LdapCacheTestImpl;
|
||||
import pro.taskana.ldap.LdapClient;
|
||||
import pro.taskana.ldap.LdapConfiguration;
|
||||
import pro.taskana.sampledata.SampleDataGenerator;
|
||||
|
||||
/** Example Application showing the implementation of taskana-rest-spring. */
|
||||
|
|
|
@ -9,7 +9,8 @@ import java.util.Map;
|
|||
import java.util.stream.Collectors;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
||||
import pro.taskana.common.rest.ldap.LdapCache;
|
||||
import pro.taskana.common.rest.models.AccessIdRepresentationModel;
|
||||
|
||||
/**
|
||||
* Implementation of LdapCache used for Unit tests.
|
||||
|
@ -19,12 +20,6 @@ import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
|||
@Component
|
||||
public class LdapCacheTestImpl implements LdapCache {
|
||||
|
||||
/**
|
||||
* Dictionary is a {@link Map} collection that contains {@link AccessIdRepresentationModel} as key
|
||||
* (user) and {@link List} as value (groups of which the user is a member) .
|
||||
*/
|
||||
private Map<AccessIdRepresentationModel, List<AccessIdRepresentationModel>> users;
|
||||
|
||||
private final List<AccessIdRepresentationModel> accessIds =
|
||||
new ArrayList<>(
|
||||
Arrays.asList(
|
||||
|
@ -297,6 +292,11 @@ public class LdapCacheTestImpl implements LdapCache {
|
|||
"teamlead_4", "cn=teamlead_4,ou=groups,o=taskanatest"),
|
||||
new AccessIdRepresentationModel("team_3", "cn=team_3,ou=groups,o=taskanatest"),
|
||||
new AccessIdRepresentationModel("team_4", "cn=team_4,ou=groups,o=taskanatest")));
|
||||
/**
|
||||
* Dictionary is a {@link Map} collection that contains {@link AccessIdRepresentationModel} as key
|
||||
* (user) and {@link List} as value (groups of which the user is a member) .
|
||||
*/
|
||||
private Map<AccessIdRepresentationModel, List<AccessIdRepresentationModel>> users;
|
||||
|
||||
@Override
|
||||
public List<AccessIdRepresentationModel> findMatchingAccessId(
|
||||
|
|
|
@ -12,8 +12,8 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic
|
|||
|
||||
import pro.taskana.common.internal.security.GroupPrincipal;
|
||||
import pro.taskana.common.internal.security.UserPrincipal;
|
||||
import pro.taskana.common.rest.models.AccessIdRepresentationModel;
|
||||
import pro.taskana.ldap.LdapCacheTestImpl;
|
||||
import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
||||
|
||||
/** TODO. */
|
||||
public class SampleLoginModule extends UsernamePasswordAuthenticationFilter implements LoginModule {
|
||||
|
|
|
@ -21,16 +21,16 @@ import org.springframework.test.context.ActiveProfiles;
|
|||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.RestConfiguration;
|
||||
import pro.taskana.RestHelper;
|
||||
import pro.taskana.classification.api.models.Classification;
|
||||
import pro.taskana.classification.rest.assembler.ClassificationRepresentationModelAssembler;
|
||||
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.rest.RestConfiguration;
|
||||
import pro.taskana.rest.resource.ClassificationRepresentationModel;
|
||||
import pro.taskana.rest.resource.ClassificationRepresentationModelAssembler;
|
||||
import pro.taskana.rest.resource.TaskRepresentationModel;
|
||||
import pro.taskana.rest.resource.TaskRepresentationModelAssembler;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.task.api.models.Task;
|
||||
import pro.taskana.task.rest.assembler.TaskRepresentationModelAssembler;
|
||||
import pro.taskana.task.rest.models.TaskRepresentationModel;
|
||||
|
||||
/** Test async updates. */
|
||||
@ActiveProfiles({"test"})
|
||||
|
|
|
@ -10,10 +10,11 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import pro.taskana.RestConfiguration;
|
||||
import pro.taskana.common.api.LoggerUtils;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.rest.RestConfiguration;
|
||||
import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
||||
import pro.taskana.common.rest.ldap.LdapClient;
|
||||
import pro.taskana.common.rest.models.AccessIdRepresentationModel;
|
||||
|
||||
/** Test Ldap attachment. */
|
||||
@ActiveProfiles({"test"})
|
||||
|
|
|
@ -14,10 +14,12 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import pro.taskana.RestConfiguration;
|
||||
import pro.taskana.common.rest.AccessIdController;
|
||||
import pro.taskana.common.rest.ldap.LdapClient;
|
||||
import pro.taskana.common.rest.ldap.LdapConfiguration;
|
||||
import pro.taskana.jobs.TransactionalJobsConfiguration;
|
||||
import pro.taskana.ldap.LdapCacheTestImpl;
|
||||
import pro.taskana.ldap.LdapClient;
|
||||
import pro.taskana.ldap.LdapConfiguration;
|
||||
import pro.taskana.sampledata.SampleDataGenerator;
|
||||
|
||||
/** Example Application showing the implementation of taskana-rest-spring. */
|
||||
|
|
|
@ -23,12 +23,11 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import pro.taskana.common.rest.AccessIdController;
|
||||
import pro.taskana.common.rest.ldap.LdapClient;
|
||||
import pro.taskana.common.rest.ldap.LdapConfiguration;
|
||||
import pro.taskana.jobs.TransactionalJobsConfiguration;
|
||||
import pro.taskana.ldap.LdapCacheTestImpl;
|
||||
import pro.taskana.ldap.LdapClient;
|
||||
import pro.taskana.ldap.LdapConfiguration;
|
||||
import pro.taskana.rest.AccessIdController;
|
||||
import pro.taskana.rest.RestConfiguration;
|
||||
import pro.taskana.rest.WebMvcConfig;
|
||||
import pro.taskana.sampledata.SampleDataGenerator;
|
||||
|
||||
|
@ -43,7 +42,7 @@ import pro.taskana.sampledata.SampleDataGenerator;
|
|||
TransactionalJobsConfiguration.class,
|
||||
LdapConfiguration.class,
|
||||
RestConfiguration.class,
|
||||
WebMvcConfig.class
|
||||
WebMvcConfig.class,
|
||||
})
|
||||
public class TaskanaWildFlyApplication extends SpringBootServletInitializer {
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.springframework.http.ResponseEntity;
|
|||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.rest.resource.TaskanaUserInfoRepresentationModel;
|
||||
import pro.taskana.common.rest.models.TaskanaUserInfoRepresentationModel;
|
||||
|
||||
/**
|
||||
* This test class is configured to run with postgres DB if you want to run it with h2 it is needed.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana;
|
||||
|
||||
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
|
||||
import java.sql.SQLException;
|
||||
|
@ -13,11 +13,9 @@ import org.springframework.context.annotation.Scope;
|
|||
import org.springframework.http.converter.json.SpringHandlerInstantiator;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import pro.taskana.SpringTaskanaEngineConfiguration;
|
||||
import pro.taskana.TaskanaEngineConfiguration;
|
||||
import pro.taskana.classification.api.ClassificationService;
|
||||
import pro.taskana.common.api.TaskanaEngine;
|
||||
import pro.taskana.ldap.LdapClient;
|
||||
import pro.taskana.common.rest.ldap.LdapClient;
|
||||
import pro.taskana.monitor.api.MonitorService;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.workbasket.api.WorkbasketService;
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.classification.rest;
|
||||
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -27,16 +27,18 @@ import pro.taskana.classification.api.exceptions.ClassificationInUseException;
|
|||
import pro.taskana.classification.api.exceptions.ClassificationNotFoundException;
|
||||
import pro.taskana.classification.api.models.Classification;
|
||||
import pro.taskana.classification.api.models.ClassificationSummary;
|
||||
import pro.taskana.classification.rest.assembler.ClassificationRepresentationModelAssembler;
|
||||
import pro.taskana.classification.rest.assembler.ClassificationSummaryRepresentationModelAssembler;
|
||||
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
|
||||
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.common.api.BaseQuery.SortDirection;
|
||||
import pro.taskana.common.api.exceptions.ConcurrencyException;
|
||||
import pro.taskana.common.api.exceptions.DomainNotFoundException;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.rest.resource.ClassificationRepresentationModel;
|
||||
import pro.taskana.rest.resource.ClassificationRepresentationModelAssembler;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryRepresentationModelAssembler;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModel;
|
||||
import pro.taskana.common.rest.AbstractPagingController;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
|
||||
/** Controller for all {@link Classification} related endpoints. */
|
||||
@RestController
|
||||
|
@ -205,18 +207,19 @@ public class ClassificationController extends AbstractPagingController {
|
|||
|
||||
@DeleteMapping(path = Mapping.URL_CLASSIFICATIONS_ID)
|
||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public ResponseEntity<?> deleteClassification(@PathVariable String classificationId)
|
||||
public ResponseEntity<ClassificationRepresentationModel> deleteClassification(
|
||||
@PathVariable String classificationId)
|
||||
throws ClassificationNotFoundException, ClassificationInUseException, NotAuthorizedException {
|
||||
LOGGER.debug("Entry to deleteClassification(classificationId= {})", classificationId);
|
||||
classificationService.deleteClassification(classificationId);
|
||||
ResponseEntity<?> response = ResponseEntity.noContent().build();
|
||||
ResponseEntity<ClassificationRepresentationModel> response = ResponseEntity.noContent().build();
|
||||
LOGGER.debug("Exit from deleteClassification(), returning {}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
private ClassificationQuery applySortingParams(
|
||||
ClassificationQuery query, MultiValueMap<String, String> params)
|
||||
throws IllegalArgumentException {
|
||||
throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to applySortingParams(query= {}, params= {})", query, params);
|
||||
}
|
||||
|
@ -226,7 +229,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;
|
||||
|
@ -245,7 +248,7 @@ public class ClassificationController extends AbstractPagingController {
|
|||
query = query.orderByName(sortDirection);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown order '" + sortBy + "'");
|
||||
throw new InvalidArgumentException("Unknown order '" + sortBy + "'");
|
||||
}
|
||||
}
|
||||
params.remove(SORT_BY);
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.classification.rest;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
|
@ -29,13 +29,14 @@ import pro.taskana.classification.api.exceptions.ClassificationAlreadyExistExcep
|
|||
import pro.taskana.classification.api.exceptions.ClassificationNotFoundException;
|
||||
import pro.taskana.classification.api.models.Classification;
|
||||
import pro.taskana.classification.api.models.ClassificationSummary;
|
||||
import pro.taskana.classification.rest.assembler.ClassificationRepresentationModelAssembler;
|
||||
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
|
||||
import pro.taskana.common.api.LoggerUtils;
|
||||
import pro.taskana.common.api.exceptions.ConcurrencyException;
|
||||
import pro.taskana.common.api.exceptions.DomainNotFoundException;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.rest.resource.ClassificationRepresentationModel;
|
||||
import pro.taskana.rest.resource.ClassificationRepresentationModelAssembler;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
|
||||
/** Controller for Importing / Exporting classifications. */
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -46,9 +47,10 @@ public class ClassificationDefinitionController {
|
|||
private static final Logger LOGGER =
|
||||
LoggerFactory.getLogger(ClassificationDefinitionController.class);
|
||||
|
||||
private ClassificationService classificationService;
|
||||
private final ClassificationService classificationService;
|
||||
|
||||
private ClassificationRepresentationModelAssembler classificationRepresentationModelAssembler;
|
||||
private final ClassificationRepresentationModelAssembler
|
||||
classificationRepresentationModelAssembler;
|
||||
|
||||
ClassificationDefinitionController(
|
||||
ClassificationService classificationService,
|
||||
|
@ -157,12 +159,11 @@ public class ClassificationDefinitionController {
|
|||
}
|
||||
|
||||
String parentKeyAndDomain = cl.getParentKey() + "|" + cl.getDomain();
|
||||
if (!cl.getParentKey().isEmpty() && !cl.getParentKey().equals("")) {
|
||||
if (newKeysWithDomain.contains(parentKeyAndDomain)
|
||||
|| systemIds.containsKey(parentKeyAndDomain)) {
|
||||
childrenInFile.put(
|
||||
classificationRepresentationModelAssembler.toEntityModel(cl), cl.getParentKey());
|
||||
}
|
||||
if ((!cl.getParentKey().isEmpty() && !cl.getParentKey().equals("") && (
|
||||
newKeysWithDomain.contains(parentKeyAndDomain)
|
||||
|| systemIds.containsKey(parentKeyAndDomain)))) {
|
||||
childrenInFile.put(
|
||||
classificationRepresentationModelAssembler.toEntityModel(cl), cl.getParentKey());
|
||||
}
|
||||
}
|
||||
if (LOGGER.isDebugEnabled()) {
|
|
@ -1,12 +1,12 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.classification.rest.assembler;
|
||||
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||
|
||||
import java.time.Instant;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.hateoas.server.RepresentationModelAssembler;
|
||||
import org.springframework.hateoas.server.mvc.WebMvcLinkBuilder;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -14,8 +14,9 @@ import pro.taskana.classification.api.ClassificationService;
|
|||
import pro.taskana.classification.api.exceptions.ClassificationNotFoundException;
|
||||
import pro.taskana.classification.api.models.Classification;
|
||||
import pro.taskana.classification.internal.models.ClassificationImpl;
|
||||
import pro.taskana.classification.rest.ClassificationController;
|
||||
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
|
||||
import pro.taskana.common.api.exceptions.SystemException;
|
||||
import pro.taskana.rest.ClassificationController;
|
||||
|
||||
/**
|
||||
* Transforms {@link Classification} to its resource counterpart {@link
|
||||
|
@ -40,7 +41,8 @@ public class ClassificationRepresentationModelAssembler
|
|||
new ClassificationRepresentationModel(classification);
|
||||
try {
|
||||
resource.add(
|
||||
linkTo(methodOn(ClassificationController.class).getClassification(classification.getId()))
|
||||
WebMvcLinkBuilder.linkTo(
|
||||
methodOn(ClassificationController.class).getClassification(classification.getId()))
|
||||
.withSelfRel());
|
||||
} catch (ClassificationNotFoundException e) {
|
||||
throw new SystemException("caught unexpected Exception.", e.getCause());
|
|
@ -1,6 +1,6 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.classification.rest.assembler;
|
||||
|
||||
import static pro.taskana.rest.resource.TaskanaPagedModelKeys.CLASSIFICATIONS;
|
||||
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.CLASSIFICATIONS;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -14,8 +14,10 @@ import org.springframework.stereotype.Component;
|
|||
import pro.taskana.classification.api.ClassificationService;
|
||||
import pro.taskana.classification.api.models.ClassificationSummary;
|
||||
import pro.taskana.classification.internal.models.ClassificationImpl;
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.rest.resource.links.PageLinks;
|
||||
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.resource.rest.PageLinks;
|
||||
|
||||
/**
|
||||
* EntityModel assembler for {@link ClassificationSummaryRepresentationModel}.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.classification.rest.models;
|
||||
|
||||
import pro.taskana.classification.api.models.Classification;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.classification.rest.models;
|
||||
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -12,9 +12,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.ldap.LdapCache;
|
||||
import pro.taskana.ldap.LdapClient;
|
||||
import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
||||
import pro.taskana.common.rest.ldap.LdapCache;
|
||||
import pro.taskana.common.rest.ldap.LdapClient;
|
||||
import pro.taskana.common.rest.models.AccessIdRepresentationModel;
|
||||
|
||||
/**
|
||||
* Controller for access id validation.
|
||||
|
@ -26,8 +26,18 @@ import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
|||
public class AccessIdController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AccessIdController.class);
|
||||
private static final String EXIT_FROM_VALIDATE_ACCESS_IDS
|
||||
= "Exit from validateAccessIds(), returning {}";
|
||||
private static final String EXIT_FROM_GET_GROUP_BY_ACCESS_ID
|
||||
= "Exit from getGroupsByAccessId(), returning {}";
|
||||
private static LdapCache ldapCache;
|
||||
@Autowired LdapClient ldapClient;
|
||||
|
||||
LdapClient ldapClient;
|
||||
|
||||
@Autowired
|
||||
public AccessIdController(LdapClient ldapClient) {
|
||||
this.ldapClient = ldapClient;
|
||||
}
|
||||
|
||||
@GetMapping(path = Mapping.URL_ACCESSID)
|
||||
public ResponseEntity<List<AccessIdRepresentationModel>> validateAccessIds(
|
||||
|
@ -45,7 +55,7 @@ public class AccessIdController {
|
|||
List<AccessIdRepresentationModel> accessIdUsers = ldapClient.searchUsersAndGroups(searchFor);
|
||||
response = ResponseEntity.ok(accessIdUsers);
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from validateAccessIds(), returning {}", response);
|
||||
LOGGER.debug(EXIT_FROM_VALIDATE_ACCESS_IDS, response);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
@ -55,13 +65,13 @@ public class AccessIdController {
|
|||
ldapCache.findMatchingAccessId(
|
||||
searchFor, ldapClient.getMaxNumberOfReturnedAccessIds()));
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from validateAccessIds(), returning {}", response);
|
||||
LOGGER.debug(EXIT_FROM_VALIDATE_ACCESS_IDS, response);
|
||||
}
|
||||
|
||||
return response;
|
||||
} else {
|
||||
response = ResponseEntity.notFound().build();
|
||||
LOGGER.debug("Exit from validateAccessIds(), returning {}", response);
|
||||
LOGGER.debug(EXIT_FROM_VALIDATE_ACCESS_IDS, response);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -70,10 +80,8 @@ public class AccessIdController {
|
|||
public ResponseEntity<List<AccessIdRepresentationModel>> getGroupsByAccessId(
|
||||
@RequestParam("access-id") String accessId) throws InvalidArgumentException {
|
||||
LOGGER.debug("Entry to getGroupsByAccessId(access-id= {})", accessId);
|
||||
if (ldapClient.useLdap() || ldapCache != null) {
|
||||
if (!validateAccessId(accessId)) {
|
||||
throw new InvalidArgumentException("The accessId is invalid");
|
||||
}
|
||||
if ((ldapClient.useLdap() || ldapCache != null) && (!validateAccessId(accessId))) {
|
||||
throw new InvalidArgumentException("The accessId is invalid");
|
||||
}
|
||||
List<AccessIdRepresentationModel> accessIdUsers;
|
||||
ResponseEntity<List<AccessIdRepresentationModel>> response;
|
||||
|
@ -82,7 +90,7 @@ public class AccessIdController {
|
|||
accessIdUsers.addAll(ldapClient.searchGroupsofUsersIsMember(accessId));
|
||||
response = ResponseEntity.ok(accessIdUsers);
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from getGroupsByAccessId(), returning {}", response);
|
||||
LOGGER.debug(EXIT_FROM_GET_GROUP_BY_ACCESS_ID, response);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
@ -91,13 +99,13 @@ public class AccessIdController {
|
|||
ldapCache.findGroupsOfUser(accessId, ldapClient.getMaxNumberOfReturnedAccessIds());
|
||||
response = ResponseEntity.ok(accessIdUsers);
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from getGroupsByAccessId(), returning {}", response);
|
||||
LOGGER.debug(EXIT_FROM_GET_GROUP_BY_ACCESS_ID, response);
|
||||
}
|
||||
|
||||
return response;
|
||||
} else {
|
||||
response = ResponseEntity.notFound().build();
|
||||
LOGGER.debug("Exit from getGroupsByAccessId(), returning {}", response);
|
||||
LOGGER.debug(EXIT_FROM_GET_GROUP_BY_ACCESS_ID, response);
|
||||
return response;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
/** Collection of Url to Controller mappings. */
|
||||
public final class Mapping {
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -14,8 +14,8 @@ import pro.taskana.TaskanaEngineConfiguration;
|
|||
import pro.taskana.common.api.TaskanaEngine;
|
||||
import pro.taskana.common.api.TaskanaRole;
|
||||
import pro.taskana.common.internal.security.CurrentUserContext;
|
||||
import pro.taskana.rest.resource.TaskanaUserInfoRepresentationModel;
|
||||
import pro.taskana.rest.resource.VersionRepresentationModel;
|
||||
import pro.taskana.common.rest.models.TaskanaUserInfoRepresentationModel;
|
||||
import pro.taskana.common.rest.models.VersionRepresentationModel;
|
||||
|
||||
/** Controller for TaskanaEngine related tasks. */
|
||||
@RestController
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import java.util.Date;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
@ -11,11 +11,11 @@ import org.springframework.web.context.request.WebRequest;
|
|||
*/
|
||||
public class TaskanaErrorData {
|
||||
|
||||
private Date timestamp;
|
||||
private int status;
|
||||
private String error;
|
||||
private String exception;
|
||||
private String message;
|
||||
private final Date timestamp;
|
||||
private final int status;
|
||||
private final String error;
|
||||
private final String exception;
|
||||
private final String message;
|
||||
private String path;
|
||||
|
||||
TaskanaErrorData(HttpStatus stat, Exception ex, WebRequest req) {
|
||||
|
@ -25,7 +25,7 @@ public class TaskanaErrorData {
|
|||
this.exception = ex.getClass().getName();
|
||||
this.message = ex.getMessage();
|
||||
this.path = req.getDescription(false);
|
||||
if (this.path != null && this.path.startsWith("uri=")) {
|
||||
if (this.path.startsWith("uri=")) {
|
||||
this.path = this.path.substring(4);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
|
@ -37,8 +35,6 @@ import pro.taskana.workbasket.api.exceptions.WorkbasketInUseException;
|
|||
@ControllerAdvice
|
||||
public class TaskanaRestExceptionHandler extends ResponseEntityExceptionHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaRestExceptionHandler.class);
|
||||
|
||||
@ExceptionHandler(InvalidArgumentException.class)
|
||||
protected ResponseEntity<Object> handleInvalidArgument(
|
||||
InvalidArgumentException ex, WebRequest req) {
|
||||
|
@ -143,13 +139,13 @@ public class TaskanaRestExceptionHandler extends ResponseEntityExceptionHandler
|
|||
Exception ex, WebRequest req, HttpStatus status, boolean logExceptionOnError) {
|
||||
TaskanaErrorData errorData = new TaskanaErrorData(status, ex, req);
|
||||
if (logExceptionOnError) {
|
||||
LOGGER.error(
|
||||
logger.error(
|
||||
String.format(
|
||||
"Error occurred during processing of rest request: %s", errorData.toString()),
|
||||
ex);
|
||||
} else {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(
|
||||
String.format(
|
||||
"Error occurred during processing of rest request: %s", errorData.toString()),
|
||||
ex);
|
|
@ -1,8 +1,8 @@
|
|||
package pro.taskana.ldap;
|
||||
package pro.taskana.common.rest.ldap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
||||
import pro.taskana.common.rest.models.AccessIdRepresentationModel;
|
||||
|
||||
/**
|
||||
* This interface is used for caching Ldap data.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.ldap;
|
||||
package pro.taskana.common.rest.ldap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -25,7 +25,7 @@ import org.springframework.stereotype.Component;
|
|||
import pro.taskana.common.api.LoggerUtils;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.SystemException;
|
||||
import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
||||
import pro.taskana.common.rest.models.AccessIdRepresentationModel;
|
||||
|
||||
/**
|
||||
* Class for Ldap access.
|
||||
|
@ -320,7 +320,7 @@ public class LdapClient {
|
|||
|
||||
final List<LdapSettings> missingConfigurations = checkForMissingConfigurations();
|
||||
|
||||
if (missingConfigurations.size() > 0) {
|
||||
if (!missingConfigurations.isEmpty()) {
|
||||
message =
|
||||
String.format(
|
||||
"taskana.ldap.useLdap is set to true, but following configurations are missing: %s",
|
|
@ -1,6 +1,5 @@
|
|||
package pro.taskana.ldap;
|
||||
package pro.taskana.common.rest.ldap;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
|
@ -11,11 +10,17 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
|
|||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.core.support.LdapContextSource;
|
||||
|
||||
/** Configuration for Ldap access. */
|
||||
/**
|
||||
* Configuration for Ldap access.
|
||||
*/
|
||||
@Configuration
|
||||
public class LdapConfiguration {
|
||||
|
||||
@Autowired private Environment env;
|
||||
private final Environment env;
|
||||
|
||||
public LdapConfiguration(Environment env) {
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LdapContextSource contextSource() {
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.ldap;
|
||||
package pro.taskana.common.rest.ldap;
|
||||
|
||||
import org.springframework.core.env.Environment;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.common.rest.models;
|
||||
|
||||
/**
|
||||
* resource class for access id validation.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.common.rest.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.ArrayList;
|
||||
|
@ -17,13 +17,13 @@ import org.springframework.hateoas.RepresentationModel;
|
|||
*/
|
||||
public class PagedResources<T> extends RepresentationModel<PagedResources<T>> {
|
||||
|
||||
private Collection<T> content;
|
||||
private final Collection<T> content;
|
||||
|
||||
private PageMetadata metadata;
|
||||
private final PageMetadata metadata;
|
||||
|
||||
/** Default constructor to allow instantiation by reflection. */
|
||||
protected PagedResources() {
|
||||
this(new ArrayList<T>(), null);
|
||||
this(new ArrayList<>(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,8 +61,8 @@ public class PagedResources<T> extends RepresentationModel<PagedResources<T>> {
|
|||
@JsonProperty("page")
|
||||
public PageMetadata getMetadata() {
|
||||
if (Objects.isNull(metadata)) {
|
||||
Collection<T> content = getContent();
|
||||
return new PageMetadata(content.size(), 0, content.size());
|
||||
Collection<T> contentCollection = getContent();
|
||||
return new PageMetadata(contentCollection.size(), 0, contentCollection.size());
|
||||
}
|
||||
return metadata;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.common.rest.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.common.rest.models;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.common.rest.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.common.rest.models;
|
||||
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
package pro.taskana.ldap;
|
||||
|
||||
/**
|
||||
* Utility class to hold access ids.
|
||||
*
|
||||
* @author bbr
|
||||
*/
|
||||
public class AccessId {
|
||||
|
||||
private String accessId;
|
||||
private String name;
|
||||
|
||||
public String getAccessId() {
|
||||
return accessId;
|
||||
}
|
||||
|
||||
public void setAccessId(String accessId) {
|
||||
this.accessId = accessId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccessId [" + "accessId=" + this.accessId + ", name=" + this.name + "]";
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.monitor.rest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -7,6 +7,7 @@ import java.util.stream.IntStream;
|
|||
import java.util.stream.Stream;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -17,10 +18,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.monitor.api.MonitorService;
|
||||
import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader;
|
||||
import pro.taskana.rest.resource.ReportRepresentationModel;
|
||||
import pro.taskana.rest.resource.ReportRepresentationModelAssembler;
|
||||
import pro.taskana.monitor.rest.assembler.ReportRepresentationModelAssembler;
|
||||
import pro.taskana.monitor.rest.models.ReportRepresentationModel;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
|
||||
/** Controller for all monitoring endpoints. */
|
||||
|
@ -30,10 +32,11 @@ public class MonitorController {
|
|||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MonitorController.class);
|
||||
|
||||
private MonitorService monitorService;
|
||||
private final MonitorService monitorService;
|
||||
|
||||
private ReportRepresentationModelAssembler reportRepresentationModelAssembler;
|
||||
private final ReportRepresentationModelAssembler reportRepresentationModelAssembler;
|
||||
|
||||
@Autowired
|
||||
MonitorController(
|
||||
MonitorService monitorService,
|
||||
ReportRepresentationModelAssembler reportRepresentationModelAssembler) {
|
||||
|
@ -67,7 +70,7 @@ public class MonitorController {
|
|||
|
||||
@GetMapping(path = Mapping.URL_MONITOR_TASKSWORKBASKET)
|
||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public ResponseEntity<?> getTasksWorkbasketReport(
|
||||
public ResponseEntity<ReportRepresentationModel> getTasksWorkbasketReport(
|
||||
@RequestParam(value = "states") List<TaskState> states)
|
||||
throws NotAuthorizedException, InvalidArgumentException {
|
||||
LOGGER.debug("Entry to getTasksWorkbasketReport()");
|
||||
|
@ -89,7 +92,7 @@ public class MonitorController {
|
|||
|
||||
@GetMapping(path = Mapping.URL_MONITOR_TASKSWORKBASKETPLANNED)
|
||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public ResponseEntity<?> getTasksWorkbasketPlannedDateReport(
|
||||
public ResponseEntity<ReportRepresentationModel> getTasksWorkbasketPlannedDateReport(
|
||||
@RequestParam(value = "daysInPast") int daysInPast,
|
||||
@RequestParam(value = "states") List<TaskState> states)
|
||||
throws NotAuthorizedException, InvalidArgumentException {
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.monitor.rest.assembler;
|
||||
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||
|
@ -25,7 +25,8 @@ import pro.taskana.monitor.api.reports.item.QueryItem;
|
|||
import pro.taskana.monitor.api.reports.row.FoldableRow;
|
||||
import pro.taskana.monitor.api.reports.row.Row;
|
||||
import pro.taskana.monitor.api.reports.row.SingleRow;
|
||||
import pro.taskana.rest.MonitorController;
|
||||
import pro.taskana.monitor.rest.MonitorController;
|
||||
import pro.taskana.monitor.rest.models.ReportRepresentationModel;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
|
||||
/** Transforms any {@link Report} into its {@link ReportRepresentationModel}. */
|
||||
|
@ -34,7 +35,8 @@ public class ReportRepresentationModelAssembler {
|
|||
|
||||
@NonNull
|
||||
public ReportRepresentationModel toModel(
|
||||
@NonNull TaskStatusReport report, @NonNull List<String> domains,
|
||||
@NonNull TaskStatusReport report,
|
||||
@NonNull List<String> domains,
|
||||
@NonNull List<TaskState> states)
|
||||
throws NotAuthorizedException, InvalidArgumentException {
|
||||
ReportRepresentationModel resource = toReportResource(report);
|
||||
|
@ -57,8 +59,8 @@ public class ReportRepresentationModelAssembler {
|
|||
}
|
||||
|
||||
@NonNull
|
||||
public ReportRepresentationModel toModel(@NonNull WorkbasketReport report,
|
||||
@NonNull List<TaskState> states)
|
||||
public ReportRepresentationModel toModel(
|
||||
@NonNull WorkbasketReport report, @NonNull List<TaskState> states)
|
||||
throws NotAuthorizedException, InvalidArgumentException {
|
||||
ReportRepresentationModel resource = toReportResource(report);
|
||||
resource.add(
|
||||
|
@ -75,8 +77,8 @@ public class ReportRepresentationModelAssembler {
|
|||
ReportRepresentationModel resource = toReportResource(report);
|
||||
resource.add(
|
||||
linkTo(
|
||||
methodOn(MonitorController.class)
|
||||
.getTasksWorkbasketPlannedDateReport(daysInPast, states))
|
||||
methodOn(MonitorController.class)
|
||||
.getTasksWorkbasketPlannedDateReport(daysInPast, states))
|
||||
.withSelfRel()
|
||||
.expand());
|
||||
return resource;
|
||||
|
@ -91,12 +93,7 @@ public class ReportRepresentationModelAssembler {
|
|||
return resource;
|
||||
}
|
||||
|
||||
<I extends QueryItem, H extends ColumnHeader<? super I>>
|
||||
ReportRepresentationModel toReportResource(Report<I, H> report) {
|
||||
return toReportResource(report, Instant.now());
|
||||
}
|
||||
|
||||
<I extends QueryItem, H extends ColumnHeader<? super I>>
|
||||
public <I extends QueryItem, H extends ColumnHeader<? super I>>
|
||||
ReportRepresentationModel toReportResource(Report<I, H> report, Instant time) {
|
||||
String[] header =
|
||||
report.getColumnHeaders().stream().map(H::getDisplayName).toArray(String[]::new);
|
||||
|
@ -122,6 +119,11 @@ public class ReportRepresentationModelAssembler {
|
|||
return new ReportRepresentationModel(meta, rows, sumRow);
|
||||
}
|
||||
|
||||
<I extends QueryItem, H extends ColumnHeader<? super I>>
|
||||
ReportRepresentationModel toReportResource(Report<I, H> report) {
|
||||
return toReportResource(report, Instant.now());
|
||||
}
|
||||
|
||||
private <I extends QueryItem> List<ReportRepresentationModel.RowResource> transformRow(
|
||||
Row<I> row, String currentDesc, String[] desc, int depth) {
|
||||
// This is a very dirty solution.. Personally I'd prefer to use a visitor-like pattern here.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.monitor.rest.models;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -10,11 +10,11 @@ import pro.taskana.monitor.api.reports.row.SingleRow;
|
|||
/** EntityModel class for {@link Report}. */
|
||||
public class ReportRepresentationModel extends RepresentationModel<ReportRepresentationModel> {
|
||||
|
||||
private MetaInformation meta;
|
||||
private final MetaInformation meta;
|
||||
|
||||
private List<RowResource> rows;
|
||||
private final List<RowResource> rows;
|
||||
|
||||
private List<RowResource> sumRow;
|
||||
private final List<RowResource> sumRow;
|
||||
|
||||
public ReportRepresentationModel(
|
||||
MetaInformation meta, List<RowResource> rows, List<RowResource> sumRow) {
|
||||
|
@ -35,14 +35,16 @@ public class ReportRepresentationModel extends RepresentationModel<ReportReprese
|
|||
return sumRow;
|
||||
}
|
||||
|
||||
/** EntityModel class for {@link SingleRow}. */
|
||||
/**
|
||||
* EntityModel class for {@link SingleRow}.
|
||||
*/
|
||||
public static class RowResource {
|
||||
|
||||
private int[] cells;
|
||||
private int total;
|
||||
private int depth;
|
||||
private String[] desc;
|
||||
private boolean display;
|
||||
private final int[] cells;
|
||||
private final int total;
|
||||
private final int depth;
|
||||
private final String[] desc;
|
||||
private final boolean display;
|
||||
|
||||
public RowResource(int[] cells, int total, int depth, String[] desc, boolean display) {
|
||||
this.cells = cells;
|
||||
|
@ -85,15 +87,17 @@ 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";
|
||||
|
||||
private String name;
|
||||
private String date;
|
||||
private String[] header;
|
||||
private String[] rowDesc;
|
||||
private final String name;
|
||||
private final String date;
|
||||
private final String[] header;
|
||||
private final String[] rowDesc;
|
||||
|
||||
public MetaInformation(String name, String date, String[] header, String[] rowDesc) {
|
||||
this.name = name;
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.resource.rest;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -9,6 +9,8 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import pro.taskana.common.rest.models.PagedResources;
|
||||
|
||||
/**
|
||||
* Abstract resources assembler for taskana REST controller with pageable resources. This method is
|
||||
* deprecated, it can be removed after fixing taskana-simple-history references
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.links;
|
||||
package pro.taskana.resource.rest;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.links;
|
||||
package pro.taskana.resource.rest;
|
||||
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.web.util.UriComponentsBuilder;
|
|||
public class PageLinksAspect {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Around("@annotation(pro.taskana.rest.resource.links.PageLinks) && args(data, page, ..)")
|
||||
@Around("@annotation(pro.taskana.resource.rest.PageLinks) && args(data, page, ..)")
|
||||
public <T extends RepresentationModel<? extends T> & ProceedingJoinPoint>
|
||||
RepresentationModel<T> addLinksToPageResource(
|
||||
ProceedingJoinPoint joinPoint, List<?> data, PageMetadata page) throws Throwable {
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.task.rest;
|
||||
|
||||
import pro.taskana.task.api.models.Attachment;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.task.rest;
|
||||
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -19,13 +19,14 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import pro.taskana.common.api.exceptions.ConcurrencyException;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.rest.resource.TaskCommentRepresentationModel;
|
||||
import pro.taskana.rest.resource.TaskCommentRepresentationModelAssembler;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModel;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.exceptions.TaskCommentNotFoundException;
|
||||
import pro.taskana.task.api.exceptions.TaskNotFoundException;
|
||||
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. */
|
||||
@RestController
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.task.rest;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
|
@ -30,11 +30,9 @@ import pro.taskana.common.api.TimeInterval;
|
|||
import pro.taskana.common.api.exceptions.ConcurrencyException;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.rest.resource.TaskRepresentationModel;
|
||||
import pro.taskana.rest.resource.TaskRepresentationModelAssembler;
|
||||
import pro.taskana.rest.resource.TaskSummaryRepresentationModel;
|
||||
import pro.taskana.rest.resource.TaskSummaryRepresentationModelAssembler;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModel;
|
||||
import pro.taskana.common.rest.AbstractPagingController;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.task.api.TaskQuery;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
|
@ -46,6 +44,10 @@ import pro.taskana.task.api.exceptions.TaskAlreadyExistException;
|
|||
import pro.taskana.task.api.exceptions.TaskNotFoundException;
|
||||
import pro.taskana.task.api.models.Task;
|
||||
import pro.taskana.task.api.models.TaskSummary;
|
||||
import pro.taskana.task.rest.assembler.TaskRepresentationModelAssembler;
|
||||
import pro.taskana.task.rest.assembler.TaskSummaryRepresentationModelAssembler;
|
||||
import pro.taskana.task.rest.models.TaskRepresentationModel;
|
||||
import pro.taskana.task.rest.models.TaskSummaryRepresentationModel;
|
||||
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
|
||||
|
||||
/** Controller for all {@link Task} related endpoints. */
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.task.rest.assembler;
|
||||
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||
|
||||
|
@ -10,10 +10,12 @@ import org.springframework.hateoas.server.RepresentationModelAssembler;
|
|||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import pro.taskana.rest.AttachmentController;
|
||||
import pro.taskana.classification.rest.assembler.ClassificationSummaryRepresentationModelAssembler;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.models.Attachment;
|
||||
import pro.taskana.task.internal.models.AttachmentImpl;
|
||||
import pro.taskana.task.rest.AttachmentController;
|
||||
import pro.taskana.task.rest.models.AttachmentRepresentationModel;
|
||||
|
||||
/**
|
||||
* EntityModel assembler for {@link AttachmentRepresentationModel}.
|
||||
|
@ -42,10 +44,11 @@ public class AttachmentRepresentationModelAssembler
|
|||
}
|
||||
|
||||
public List<Attachment> toAttachmentList(List<AttachmentRepresentationModel> resources) {
|
||||
return resources.stream().map(this::apply).collect(Collectors.toList());
|
||||
return resources.stream().map(this::toEntityModel).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private AttachmentImpl apply(AttachmentRepresentationModel attachmentRepresentationModel) {
|
||||
private AttachmentImpl toEntityModel(
|
||||
AttachmentRepresentationModel attachmentRepresentationModel) {
|
||||
AttachmentImpl attachment = (AttachmentImpl) taskService.newAttachment();
|
||||
BeanUtils.copyProperties(attachmentRepresentationModel, attachment);
|
||||
attachment.setId(attachmentRepresentationModel.getAttachmentId());
|
|
@ -1,10 +1,11 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.task.rest.assembler;
|
||||
|
||||
import org.springframework.hateoas.server.RepresentationModelAssembler;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import pro.taskana.task.api.models.AttachmentSummary;
|
||||
import pro.taskana.task.rest.models.AttachmentSummaryRepresentationModel;
|
||||
|
||||
/**
|
||||
* EntityModel assembler for {@link AttachmentSummaryRepresentationModel}.
|
|
@ -1,8 +1,8 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.task.rest.assembler;
|
||||
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||
import static pro.taskana.rest.resource.TaskanaPagedModelKeys.TASK_COMMENTS;
|
||||
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.TASK_COMMENTS;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
@ -15,12 +15,14 @@ import org.springframework.lang.NonNull;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import pro.taskana.common.api.exceptions.SystemException;
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.rest.TaskCommentController;
|
||||
import pro.taskana.rest.resource.links.PageLinks;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.resource.rest.PageLinks;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.models.TaskComment;
|
||||
import pro.taskana.task.internal.models.TaskCommentImpl;
|
||||
import pro.taskana.task.rest.TaskCommentController;
|
||||
import pro.taskana.task.rest.models.TaskCommentRepresentationModel;
|
||||
|
||||
/** EntityModel assembler for {@link TaskCommentRepresentationModel}. */
|
||||
@Component
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.task.rest.assembler;
|
||||
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||
|
@ -12,15 +12,18 @@ import org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSuppor
|
|||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import pro.taskana.classification.rest.assembler.ClassificationSummaryRepresentationModelAssembler;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.common.api.exceptions.SystemException;
|
||||
import pro.taskana.rest.TaskController;
|
||||
import pro.taskana.rest.resource.TaskRepresentationModel.CustomAttribute;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.exceptions.TaskNotFoundException;
|
||||
import pro.taskana.task.api.models.Task;
|
||||
import pro.taskana.task.internal.models.TaskImpl;
|
||||
import pro.taskana.task.rest.TaskController;
|
||||
import pro.taskana.task.rest.models.TaskRepresentationModel;
|
||||
import pro.taskana.task.rest.models.TaskRepresentationModel.CustomAttribute;
|
||||
import pro.taskana.workbasket.rest.assembler.WorkbasketSummaryRepresentationModelAssembler;
|
||||
|
||||
/**
|
||||
* EntityModel assembler for {@link TaskRepresentationModel}.
|
|
@ -1,6 +1,6 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.task.rest.assembler;
|
||||
|
||||
import static pro.taskana.rest.resource.TaskanaPagedModelKeys.TASKS;
|
||||
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.TASKS;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -11,9 +11,11 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.SystemException;
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.rest.resource.links.PageLinks;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.resource.rest.PageLinks;
|
||||
import pro.taskana.task.api.models.TaskSummary;
|
||||
import pro.taskana.task.rest.models.TaskSummaryRepresentationModel;
|
||||
|
||||
/** EntityModel assembler for {@link TaskSummaryRepresentationModel}. */
|
||||
@Component
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.task.rest.models;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
|
@ -1,7 +1,8 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.task.rest.models;
|
||||
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
||||
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.task.api.models.AttachmentSummary;
|
||||
import pro.taskana.task.api.models.ObjectReference;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.task.rest.models;
|
||||
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.task.rest.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import java.util.ArrayList;
|
|
@ -1,15 +1,17 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.task.rest.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
||||
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.task.api.models.ObjectReference;
|
||||
import pro.taskana.task.api.models.TaskSummary;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel;
|
||||
|
||||
/**
|
||||
* EntityModel class for {@link WorkbasketSummary}.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.workbasket.rest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -18,13 +18,15 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import pro.taskana.common.api.BaseQuery;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.ldap.LdapClient;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModel;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemRepresentationModel;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemRepresentationModelAssembler;
|
||||
import pro.taskana.common.rest.AbstractPagingController;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.ldap.LdapClient;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.workbasket.api.WorkbasketAccessItemQuery;
|
||||
import pro.taskana.workbasket.api.WorkbasketService;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketAccessItem;
|
||||
import pro.taskana.workbasket.rest.assembler.WorkbasketAccessItemRepresentationModelAssembler;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketAccessItemRepresentationModel;
|
||||
|
||||
/** Controller for Workbasket access. */
|
||||
@RestController
|
||||
|
@ -136,7 +138,7 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
private void getAccessIds(
|
||||
WorkbasketAccessItemQuery query, MultiValueMap<String, String> params) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to getAccessIds(query= {}, params= {})", params);
|
||||
LOGGER.debug("Entry to getAccessIds(query= {}, params= {})", query, params);
|
||||
}
|
||||
|
||||
if (params.containsKey(ACCESS_IDS)) {
|
||||
|
@ -154,7 +156,7 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
private void applyFilterParams(
|
||||
WorkbasketAccessItemQuery query, MultiValueMap<String, String> params) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", params);
|
||||
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", query, params);
|
||||
}
|
||||
|
||||
if (params.containsKey(WORKBASKET_KEY)) {
|
||||
|
@ -183,9 +185,9 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
|
||||
private WorkbasketAccessItemQuery applySortingParams(
|
||||
WorkbasketAccessItemQuery query, MultiValueMap<String, String> params)
|
||||
throws IllegalArgumentException {
|
||||
throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to applySortingParams(query= {}, params= {})", params);
|
||||
LOGGER.debug("Entry to applySortingParams(query= {}, params= {})", query, params);
|
||||
}
|
||||
|
||||
// sorting
|
||||
|
@ -193,7 +195,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;
|
||||
|
@ -206,7 +208,7 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
query = query.orderByAccessId(sortDirection);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown order '" + sortBy + "'");
|
||||
throw new InvalidArgumentException("Unknown order '" + sortBy + "'");
|
||||
}
|
||||
}
|
||||
params.remove(SORT_BY);
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.workbasket.rest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -27,14 +27,9 @@ import pro.taskana.common.api.exceptions.ConcurrencyException;
|
|||
import pro.taskana.common.api.exceptions.DomainNotFoundException;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.rest.resource.DistributionTargetRepresentationModelAssembler;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModel;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemRepresentationModel;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemRepresentationModelAssembler;
|
||||
import pro.taskana.rest.resource.WorkbasketRepresentationModel;
|
||||
import pro.taskana.rest.resource.WorkbasketRepresentationModelAssembler;
|
||||
import pro.taskana.rest.resource.WorkbasketSummaryRepresentationModel;
|
||||
import pro.taskana.rest.resource.WorkbasketSummaryRepresentationModelAssembler;
|
||||
import pro.taskana.common.rest.AbstractPagingController;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.workbasket.api.WorkbasketPermission;
|
||||
import pro.taskana.workbasket.api.WorkbasketQuery;
|
||||
import pro.taskana.workbasket.api.WorkbasketService;
|
||||
|
@ -47,6 +42,13 @@ import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
|
|||
import pro.taskana.workbasket.api.models.Workbasket;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketAccessItem;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
import pro.taskana.workbasket.rest.assembler.DistributionTargetRepresentationModelAssembler;
|
||||
import pro.taskana.workbasket.rest.assembler.WorkbasketAccessItemRepresentationModelAssembler;
|
||||
import pro.taskana.workbasket.rest.assembler.WorkbasketRepresentationModelAssembler;
|
||||
import pro.taskana.workbasket.rest.assembler.WorkbasketSummaryRepresentationModelAssembler;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketAccessItemRepresentationModel;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketRepresentationModel;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel;
|
||||
|
||||
/** Controller for all {@link Workbasket} related endpoints. */
|
||||
@RestController
|
||||
|
@ -146,12 +148,12 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
|
||||
@DeleteMapping(path = Mapping.URL_WORKBASKET_ID)
|
||||
@Transactional(rollbackFor = Exception.class, noRollbackFor = WorkbasketNotFoundException.class)
|
||||
public ResponseEntity<?> deleteWorkbasket(
|
||||
public ResponseEntity<WorkbasketRepresentationModel> deleteWorkbasket(
|
||||
@PathVariable(value = "workbasketId") String workbasketId)
|
||||
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
|
||||
WorkbasketInUseException {
|
||||
WorkbasketInUseException {
|
||||
LOGGER.debug("Entry to markWorkbasketForDeletion(workbasketId= {})", workbasketId);
|
||||
ResponseEntity<?> response;
|
||||
ResponseEntity<WorkbasketRepresentationModel> response;
|
||||
|
||||
boolean workbasketDeleted = workbasketService.deleteWorkbasket(workbasketId);
|
||||
|
||||
|
@ -345,7 +347,7 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
}
|
||||
|
||||
private WorkbasketQuery applySortingParams(
|
||||
WorkbasketQuery query, MultiValueMap<String, String> params) throws IllegalArgumentException {
|
||||
WorkbasketQuery query, MultiValueMap<String, String> params) throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to applySortingParams(query= {}, params={})", query, params);
|
||||
}
|
||||
|
@ -355,7 +357,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;
|
||||
|
@ -377,7 +379,7 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
query = query.orderByDescription(sortDirection);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown order '" + sortBy + "'");
|
||||
throw new InvalidArgumentException("Unknown order '" + sortBy + "'");
|
||||
}
|
||||
}
|
||||
params.remove(SORT_BY);
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.workbasket.rest;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
|
@ -28,9 +28,7 @@ import pro.taskana.common.api.exceptions.ConcurrencyException;
|
|||
import pro.taskana.common.api.exceptions.DomainNotFoundException;
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.rest.resource.WorkbasketDefinitionRepresentationModel;
|
||||
import pro.taskana.rest.resource.WorkbasketDefinitionRepresentationModelAssembler;
|
||||
import pro.taskana.rest.resource.WorkbasketRepresentationModel;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.workbasket.api.WorkbasketQuery;
|
||||
import pro.taskana.workbasket.api.WorkbasketService;
|
||||
import pro.taskana.workbasket.api.exceptions.InvalidWorkbasketException;
|
||||
|
@ -42,6 +40,9 @@ import pro.taskana.workbasket.api.models.WorkbasketAccessItem;
|
|||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
import pro.taskana.workbasket.internal.models.WorkbasketAccessItemImpl;
|
||||
import pro.taskana.workbasket.internal.models.WorkbasketImpl;
|
||||
import pro.taskana.workbasket.rest.assembler.WorkbasketDefinitionRepresentationModelAssembler;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketDefinitionRepresentationModel;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketRepresentationModel;
|
||||
|
||||
/** Controller for all {@link WorkbasketDefinitionRepresentationModel} related endpoints. */
|
||||
@RestController
|
||||
|
@ -51,9 +52,9 @@ public class WorkbasketDefinitionController {
|
|||
private static final Logger LOGGER =
|
||||
LoggerFactory.getLogger(WorkbasketDefinitionController.class);
|
||||
|
||||
private WorkbasketService workbasketService;
|
||||
private final WorkbasketService workbasketService;
|
||||
|
||||
private WorkbasketDefinitionRepresentationModelAssembler workbasketDefinitionAssembler;
|
||||
private final WorkbasketDefinitionRepresentationModelAssembler workbasketDefinitionAssembler;
|
||||
|
||||
WorkbasketDefinitionController(
|
||||
WorkbasketService workbasketService,
|
||||
|
@ -74,7 +75,7 @@ public class WorkbasketDefinitionController {
|
|||
List<WorkbasketDefinitionRepresentationModel> basketExports = new ArrayList<>();
|
||||
for (WorkbasketSummary summary : workbasketSummaryList) {
|
||||
Workbasket workbasket = workbasketService.getWorkbasket(summary.getId());
|
||||
basketExports.add(workbasketDefinitionAssembler.toEntityModel(workbasket));
|
||||
basketExports.add(workbasketDefinitionAssembler.toModel(workbasket));
|
||||
}
|
||||
|
||||
ResponseEntity<List<WorkbasketDefinitionRepresentationModel>> response =
|
||||
|
@ -156,18 +157,16 @@ public class WorkbasketDefinitionController {
|
|||
// Since we would have a n² runtime when doing a lookup and updating the access items we
|
||||
// decided to
|
||||
// simply delete all existing accessItems and create new ones.
|
||||
boolean noWrongAuth =
|
||||
boolean authenticated =
|
||||
definition.getAuthorizations().stream()
|
||||
.noneMatch(
|
||||
access -> {
|
||||
return (!access.getWorkbasketId().equals(importedWb.getId()))
|
||||
|| (!access.getWorkbasketKey().equals(importedWb.getKey()));
|
||||
});
|
||||
if (!noWrongAuth) {
|
||||
.anyMatch(
|
||||
access -> (access.getWorkbasketId().equals(importedWb.getId()))
|
||||
&& (access.getWorkbasketKey().equals(importedWb.getKey())));
|
||||
if (!authenticated && !definition.getAuthorizations().isEmpty()) {
|
||||
throw new InvalidWorkbasketException(
|
||||
"The given Authentications for Workbasket "
|
||||
+ importedWb.getId()
|
||||
+ " doesn't match in WorkbasketId and/or WorkbasketKey. "
|
||||
+ " don't match in WorkbasketId and WorkbasketKey. "
|
||||
+ "Please provide consistent WorkbasketDefinitions");
|
||||
}
|
||||
for (WorkbasketAccessItem accessItem : workbasketService.getWorkbasketAccessItems(newId)) {
|
|
@ -1,9 +1,11 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.workbasket.rest.assembler;
|
||||
|
||||
import static pro.taskana.rest.resource.TaskanaPagedModelKeys.DISTRIBUTION_TARGETS;
|
||||
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.DISTRIBUTION_TARGETS;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModelKeys;
|
||||
|
||||
/**
|
||||
* Transforms WorkbasketSummary to its resource counterpart DistributionTargerResource and vice
|
||||
* versa.
|
|
@ -1,8 +1,8 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.workbasket.rest.assembler;
|
||||
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||
import static pro.taskana.rest.resource.TaskanaPagedModelKeys.ACCESSITEMS;
|
||||
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.ACCESSITEMS;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -14,13 +14,15 @@ import org.springframework.lang.NonNull;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.rest.WorkbasketController;
|
||||
import pro.taskana.rest.resource.links.PageLinks;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.resource.rest.PageLinks;
|
||||
import pro.taskana.workbasket.api.WorkbasketService;
|
||||
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketAccessItem;
|
||||
import pro.taskana.workbasket.internal.models.WorkbasketAccessItemImpl;
|
||||
import pro.taskana.workbasket.rest.WorkbasketController;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketAccessItemRepresentationModel;
|
||||
|
||||
/**
|
||||
* Transforms {@link WorkbasketAccessItem} to its resource counterpart {@link
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.workbasket.rest.assembler;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
|
@ -18,6 +18,9 @@ import pro.taskana.workbasket.api.models.WorkbasketAccessItem;
|
|||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
import pro.taskana.workbasket.internal.models.WorkbasketAccessItemImpl;
|
||||
import pro.taskana.workbasket.internal.models.WorkbasketImpl;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketDefinitionRepresentationModel;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketRepresentationModel;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketRepresentationModelWithoutLinks;
|
||||
|
||||
/**
|
||||
* Transforms {@link Workbasket} into a {@link WorkbasketDefinitionRepresentationModel} containing
|
||||
|
@ -44,7 +47,7 @@ public class WorkbasketDefinitionRepresentationModelAssembler {
|
|||
* @throws WorkbasketNotFoundException if {@code basket} is an unknown workbasket
|
||||
*/
|
||||
@NonNull
|
||||
public WorkbasketDefinitionRepresentationModel toEntityModel(Workbasket workbasket)
|
||||
public WorkbasketDefinitionRepresentationModel toModel(Workbasket workbasket)
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||
|
||||
WorkbasketRepresentationModelWithoutLinks basket =
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.workbasket.rest.assembler;
|
||||
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||
|
@ -14,11 +14,12 @@ import org.springframework.util.LinkedMultiValueMap;
|
|||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.common.api.exceptions.SystemException;
|
||||
import pro.taskana.rest.WorkbasketController;
|
||||
import pro.taskana.workbasket.api.WorkbasketService;
|
||||
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.workbasket.api.models.Workbasket;
|
||||
import pro.taskana.workbasket.internal.models.WorkbasketImpl;
|
||||
import pro.taskana.workbasket.rest.WorkbasketController;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketRepresentationModel;
|
||||
|
||||
/**
|
||||
* Transforms {@link Workbasket} to its resource counterpart {@link WorkbasketRepresentationModel}
|
|
@ -1,6 +1,6 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.workbasket.rest.assembler;
|
||||
|
||||
import static pro.taskana.rest.resource.TaskanaPagedModelKeys.WORKBASKETS;
|
||||
import static pro.taskana.common.rest.models.TaskanaPagedModelKeys.WORKBASKETS;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -11,11 +11,14 @@ import org.springframework.hateoas.server.RepresentationModelAssembler;
|
|||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.rest.resource.links.PageLinks;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModelKeys;
|
||||
import pro.taskana.resource.rest.PageLinks;
|
||||
import pro.taskana.workbasket.api.WorkbasketService;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
import pro.taskana.workbasket.internal.models.WorkbasketImpl;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel;
|
||||
|
||||
/**
|
||||
* EntityModel assembler for {@link WorkbasketSummaryRepresentationModel}.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.workbasket.rest.models;
|
||||
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.workbasket.rest.models;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.workbasket.rest.models;
|
||||
|
||||
import pro.taskana.workbasket.api.models.Workbasket;
|
||||
|
||||
|
@ -12,8 +12,7 @@ public class WorkbasketRepresentationModel
|
|||
private String created; // ISO-8601
|
||||
private String modified; // ISO-8601
|
||||
|
||||
@SuppressWarnings("unused") //Mandatory for Jackson
|
||||
protected WorkbasketRepresentationModel() {
|
||||
public WorkbasketRepresentationModel() {
|
||||
}
|
||||
|
||||
public WorkbasketRepresentationModel(Workbasket workbasket) {
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.workbasket.rest.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
|
@ -10,7 +10,7 @@ public class WorkbasketRepresentationModelWithoutLinks extends WorkbasketReprese
|
|||
|
||||
WorkbasketRepresentationModelWithoutLinks() {}
|
||||
|
||||
WorkbasketRepresentationModelWithoutLinks(Workbasket workbasket) {
|
||||
public WorkbasketRepresentationModelWithoutLinks(Workbasket workbasket) {
|
||||
super(workbasket);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.workbasket.rest.models;
|
||||
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.classification.rest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
@ -17,11 +17,12 @@ import org.springframework.test.annotation.DirtiesContext;
|
|||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.RestHelper;
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.rest.resource.ClassificationRepresentationModel;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModel;
|
||||
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
|
||||
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.RestHelper;
|
||||
import pro.taskana.common.rest.TaskanaSpringBootTest;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
|
||||
/**
|
||||
* Test ClassificationController.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.classification.rest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
@ -29,11 +29,12 @@ import org.springframework.util.MultiValueMap;
|
|||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.RestHelper;
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.rest.resource.ClassificationRepresentationModel;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModel;
|
||||
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
|
||||
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.RestHelper;
|
||||
import pro.taskana.common.rest.TaskanaSpringBootTest;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
|
||||
/** Test classification definitions. */
|
||||
@TaskanaSpringBootTest
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.classification.rest.assembler;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -6,11 +6,12 @@ import java.time.Instant;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.classification.api.ClassificationService;
|
||||
import pro.taskana.classification.api.models.Classification;
|
||||
import pro.taskana.classification.internal.models.ClassificationImpl;
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.TaskanaSpringBootTest;
|
||||
|
||||
/** Test for {@link ClassificationRepresentationModelAssembler}. */
|
||||
@TaskanaSpringBootTest
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.classification.rest.assembler;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -6,10 +6,11 @@ import java.time.Instant;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.classification.api.ClassificationService;
|
||||
import pro.taskana.classification.api.models.ClassificationSummary;
|
||||
import pro.taskana.classification.internal.models.ClassificationImpl;
|
||||
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.common.rest.TaskanaSpringBootTest;
|
||||
|
||||
/** Test for {@link ClassificationSummaryRepresentationModelAssembler}. */
|
||||
@TaskanaSpringBootTest
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
@ -17,9 +17,7 @@ import org.springframework.test.context.ActiveProfiles;
|
|||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.RestHelper;
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
||||
import pro.taskana.common.rest.models.AccessIdRepresentationModel;
|
||||
|
||||
@TaskanaSpringBootTest
|
||||
@ActiveProfiles({"test", "ldap"})
|
||||
|
@ -27,7 +25,8 @@ class AccessIdControllerIntTest {
|
|||
|
||||
private static RestTemplate template;
|
||||
|
||||
@Autowired RestHelper restHelper;
|
||||
@Autowired
|
||||
RestHelper restHelper;
|
||||
|
||||
@BeforeAll
|
||||
static void init() {
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.sql.DataSource;
|
||||
|
@ -17,7 +17,8 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import pro.taskana.ldap.LdapCacheTestImpl;
|
||||
import pro.taskana.RestConfiguration;
|
||||
import pro.taskana.common.rest.ldap.LdapCacheTestImpl;
|
||||
import pro.taskana.sampledata.SampleDataGenerator;
|
||||
|
||||
/** Example Application to create the documentation. */
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
|
@ -11,10 +11,8 @@ import org.springframework.http.HttpMethod;
|
|||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.RestHelper;
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModel;
|
||||
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
|
||||
/** Test general Exception Handling. */
|
||||
@TaskanaSpringBootTest
|
||||
|
@ -26,7 +24,8 @@ class GeneralExceptionHandlingTest {
|
|||
new ParameterizedTypeReference<
|
||||
TaskanaPagedModel<ClassificationSummaryRepresentationModel>>() {};
|
||||
private static RestTemplate template;
|
||||
@Autowired RestHelper restHelper;
|
||||
@Autowired
|
||||
RestHelper restHelper;
|
||||
|
||||
@BeforeAll
|
||||
static void init() {
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||
|
@ -8,6 +8,8 @@ import org.junit.jupiter.api.Test;
|
|||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import pro.taskana.task.rest.TaskController;
|
||||
|
||||
/** Test Mapping and Linkbuilder. */
|
||||
class MappingTest {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.security;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -12,8 +12,8 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic
|
|||
|
||||
import pro.taskana.common.internal.security.GroupPrincipal;
|
||||
import pro.taskana.common.internal.security.UserPrincipal;
|
||||
import pro.taskana.ldap.LdapCacheTestImpl;
|
||||
import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
||||
import pro.taskana.common.rest.ldap.LdapCacheTestImpl;
|
||||
import pro.taskana.common.rest.models.AccessIdRepresentationModel;
|
||||
|
||||
/**
|
||||
* This class will take care of Test API calls authentification. Also see {@link WebSecurityConfig}
|
||||
|
@ -39,7 +39,7 @@ public class SampleLoginModule extends UsernamePasswordAuthenticationFilter impl
|
|||
nameCallback = new NameCallback("prompt");
|
||||
passwordCallback = new PasswordCallback("prompt", false);
|
||||
|
||||
callbackHandler.handle(new Callback[] {nameCallback, passwordCallback});
|
||||
callbackHandler.handle(new Callback[]{nameCallback, passwordCallback});
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -11,17 +11,16 @@ import org.springframework.http.HttpMethod;
|
|||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.RestHelper;
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.common.api.TaskanaRole;
|
||||
import pro.taskana.rest.resource.TaskanaUserInfoRepresentationModel;
|
||||
import pro.taskana.common.rest.models.TaskanaUserInfoRepresentationModel;
|
||||
|
||||
/** Test TaskanaEngineController. */
|
||||
@TaskanaSpringBootTest
|
||||
class TaskanaEngineControllerIntTest {
|
||||
|
||||
private static RestTemplate template;
|
||||
@Autowired RestHelper restHelper;
|
||||
@Autowired
|
||||
RestHelper restHelper;
|
||||
|
||||
@BeforeAll
|
||||
static void init() {
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
|
@ -10,7 +10,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import pro.taskana.rest.RestConfiguration;
|
||||
import pro.taskana.RestConfiguration;
|
||||
|
||||
/** Use this annotation to test with a spring context and a standardized configuration. */
|
||||
@Target(ElementType.TYPE)
|
|
@ -1,11 +1,12 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import pro.taskana.RestConfiguration;
|
||||
import pro.taskana.TaskanaEngineConfiguration;
|
||||
import pro.taskana.ldap.LdapConfiguration;
|
||||
import pro.taskana.common.rest.ldap.LdapConfiguration;
|
||||
|
||||
/** Configuration class for all rest tests. */
|
||||
@Import({RestConfiguration.class, LdapConfiguration.class})
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -13,7 +13,6 @@ import org.junit.jupiter.api.Test;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import pro.taskana.SpringTaskanaEngineConfiguration;
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.common.internal.configuration.DB;
|
||||
import pro.taskana.sampledata.SampleDataGenerator;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.security;
|
||||
package pro.taskana.common.rest;
|
||||
|
||||
import java.util.Collections;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
|
@ -20,7 +20,9 @@ import org.springframework.web.filter.CorsFilter;
|
|||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/** Default basic configuration for taskana web example. */
|
||||
/**
|
||||
* Default basic configuration for taskana web example.
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
@ -29,10 +31,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
public JaasAuthenticationProvider jaasAuthProvider() {
|
||||
JaasAuthenticationProvider authenticationProvider = new JaasAuthenticationProvider();
|
||||
authenticationProvider.setAuthorityGranters(
|
||||
new AuthorityGranter[] {p -> Collections.singleton(p.getName())});
|
||||
new AuthorityGranter[]{p -> Collections.singleton(p.getName())});
|
||||
authenticationProvider.setCallbackHandlers(
|
||||
new JaasAuthenticationCallbackHandler[] {
|
||||
new JaasNameCallbackHandler(), new JaasPasswordCallbackHandler()
|
||||
new JaasAuthenticationCallbackHandler[]{
|
||||
new JaasNameCallbackHandler(), new JaasPasswordCallbackHandler()
|
||||
});
|
||||
authenticationProvider.setLoginContextName("taskana");
|
||||
authenticationProvider.setLoginConfig(new ClassPathResource("pss_jaas.config"));
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.ldap;
|
||||
package pro.taskana.common.rest.ldap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
||||
import pro.taskana.common.rest.models.AccessIdRepresentationModel;
|
||||
|
||||
/**
|
||||
* Implementation of LdapCache used for Unit tests.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.ldap;
|
||||
package pro.taskana.common.rest.ldap;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatCode;
|
||||
|
@ -9,7 +9,7 @@ import static org.mockito.ArgumentMatchers.eq;
|
|||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static pro.taskana.ldap.LdapSettings.TASKANA_LDAP_USE_LDAP;
|
||||
import static pro.taskana.common.rest.ldap.LdapSettings.TASKANA_LDAP_USE_LDAP;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -26,7 +26,7 @@ import org.springframework.ldap.core.LdapTemplate;
|
|||
|
||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.SystemException;
|
||||
import pro.taskana.rest.resource.AccessIdRepresentationModel;
|
||||
import pro.taskana.common.rest.models.AccessIdRepresentationModel;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class LdapClientTest {
|
|
@ -12,7 +12,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
|||
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
|
||||
/** Generate Rest Docu for AbstractPagingController. */
|
||||
class AbstractPagingControllerRestDocumentation extends BaseRestDocumentation {
|
||||
|
|
|
@ -13,8 +13,8 @@ import org.springframework.context.annotation.Import;
|
|||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import pro.taskana.RestHelper;
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.common.rest.RestHelper;
|
||||
import pro.taskana.common.rest.TaskanaSpringBootTest;
|
||||
import pro.taskana.doc.api.BaseRestDocumentation.ResultHandlerConfiguration;
|
||||
|
||||
/** Base class for Rest Documentation tests. */
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.springframework.restdocs.payload.FieldDescriptor;
|
|||
import org.springframework.test.web.servlet.MvcResult;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
|
||||
/**
|
||||
* Generate REST Dokumentation for ClassificationController.
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
|||
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
|
||||
/** Test ClassificationDefinitionControlller. */
|
||||
class ClassificationDefinitionControllerRestDocumentation extends BaseRestDocumentation {
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
|||
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
|
||||
/** Generate common REST Documentation. */
|
||||
class CommonRestDocumentation extends BaseRestDocumentation {
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
|||
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
|
||||
/** Generate REST docu for the monitor controller. */
|
||||
class MonitorControllerRestDocumentation extends BaseRestDocumentation {
|
||||
|
|
|
@ -21,10 +21,10 @@ import org.springframework.restdocs.payload.FieldDescriptor;
|
|||
import org.springframework.test.web.servlet.MvcResult;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModelKeys;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModelKeys;
|
||||
|
||||
public class TaskCommentControllerRestDocumentation extends BaseRestDocumentation {
|
||||
class TaskCommentControllerRestDocumentation extends BaseRestDocumentation {
|
||||
|
||||
private final HashMap<String, String> taskCommentFieldDescriptionsMap = new HashMap<>();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.springframework.restdocs.payload.FieldDescriptor;
|
|||
import org.springframework.test.web.servlet.MvcResult;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
|
||||
/** Generate REST Documentation for the TaskController. */
|
||||
class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
|||
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
|
||||
/** Generate REST Docu for the TaskanaEngineController. */
|
||||
class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.springframework.restdocs.payload.FieldDescriptor;
|
|||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
|
||||
/** Generate REST Docu for the WorkbasketAccessItemController. */
|
||||
class WorkbasketAccessItemControllerRestDocumentation extends BaseRestDocumentation {
|
||||
|
|
|
@ -19,8 +19,8 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
|||
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModelKeys;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModelKeys;
|
||||
|
||||
/** Generate REST Documentatioon for the WorkbasketController. */
|
||||
class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
|||
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import pro.taskana.rest.Mapping;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
|
||||
/** Generate Rest Documentation for Workbasket Definitions. */
|
||||
class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDocumentation {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource;
|
||||
package pro.taskana.monitor.rest.models;
|
||||
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
|
@ -16,23 +16,31 @@ import org.junit.jupiter.api.BeforeEach;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.common.rest.TaskanaSpringBootTest;
|
||||
import pro.taskana.monitor.api.reports.ClassificationReport;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketReport;
|
||||
import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader;
|
||||
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 {
|
||||
|
||||
@Autowired private ReportRepresentationModelAssembler reportRepresentationModelAssembler;
|
||||
|
||||
private final ReportRepresentationModelAssembler reportRepresentationModelAssembler;
|
||||
private int daysDiff;
|
||||
private LocalDateTime now;
|
||||
private List<TimeIntervalColumnHeader> headers;
|
||||
|
||||
@Autowired
|
||||
public ReportRepresentationModelTest(
|
||||
ReportRepresentationModelAssembler reportRepresentationModelAssembler) {
|
||||
this.reportRepresentationModelAssembler = reportRepresentationModelAssembler;
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void before() {
|
||||
now = LocalDate.parse("2019-01-02").atStartOfDay();
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.task.rest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
@ -20,10 +20,11 @@ import org.springframework.http.ResponseEntity;
|
|||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.RestHelper;
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.rest.resource.TaskCommentRepresentationModel;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModel;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.RestHelper;
|
||||
import pro.taskana.common.rest.TaskanaSpringBootTest;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.task.rest.models.TaskCommentRepresentationModel;
|
||||
|
||||
/** Test TaskCommentController. */
|
||||
@TaskanaSpringBootTest
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest;
|
||||
package pro.taskana.task.rest;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
@ -32,16 +32,17 @@ import org.springframework.http.ResponseEntity;
|
|||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.RestHelper;
|
||||
import pro.taskana.TaskanaSpringBootTest;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.rest.resource.TaskRepresentationModel;
|
||||
import pro.taskana.rest.resource.TaskSummaryRepresentationModel;
|
||||
import pro.taskana.rest.resource.TaskanaPagedModel;
|
||||
import pro.taskana.rest.resource.WorkbasketSummaryRepresentationModel;
|
||||
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.common.rest.Mapping;
|
||||
import pro.taskana.common.rest.RestHelper;
|
||||
import pro.taskana.common.rest.TaskanaSpringBootTest;
|
||||
import pro.taskana.common.rest.models.TaskanaPagedModel;
|
||||
import pro.taskana.sampledata.SampleDataGenerator;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.task.api.models.ObjectReference;
|
||||
import pro.taskana.task.rest.models.TaskRepresentationModel;
|
||||
import pro.taskana.task.rest.models.TaskSummaryRepresentationModel;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel;
|
||||
|
||||
/** Test Task Controller. */
|
||||
@TaskanaSpringBootTest
|
||||
|
@ -764,7 +765,7 @@ class TaskControllerIntTest {
|
|||
ParameterizedTypeReference.forType(TaskRepresentationModel.class));
|
||||
|
||||
assertThat(cancelClaimResponse.getBody()).isNotNull();
|
||||
assertThat(cancelClaimResponse.getStatusCode().is2xxSuccessful());
|
||||
assertThat(cancelClaimResponse.getStatusCode().is2xxSuccessful()).isTrue();
|
||||
|
||||
TaskRepresentationModel cancelClaimedtaskRepresentationModel = cancelClaimResponse.getBody();
|
||||
assertThat(cancelClaimedtaskRepresentationModel.getOwner()).isNull();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue