TSK-858: removed unnecessary throws declarations

This commit is contained in:
Holger Hagen 2019-07-22 16:24:15 +02:00 committed by Dennis Lehmann
parent 523e0715c1
commit c216c4c380
3 changed files with 36 additions and 22 deletions

View File

@ -50,21 +50,37 @@ public class ClassificationController extends AbstractPagingController {
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationController.class);
private static final String LIKE = "%";
private static final String NAME = "name";
private static final String NAME_LIKE = "name-like";
private static final String KEY = "key";
private static final String DOMAIN = "domain";
private static final String CATEGORY = "category";
private static final String TYPE = "type";
private static final String CUSTOM_1_LIKE = "custom-1-like";
private static final String CUSTOM_2_LIKE = "custom-2-like";
private static final String CUSTOM_3_LIKE = "custom-3-like";
private static final String CUSTOM_4_LIKE = "custom-4-like";
private static final String CUSTOM_5_LIKE = "custom-5-like";
private static final String CUSTOM_6_LIKE = "custom-6-like";
private static final String CUSTOM_7_LIKE = "custom-7-like";
private static final String CUSTOM_8_LIKE = "custom-8-like";
private static final String SORT_BY = "sort-by";
private static final String SORT_DIRECTION = "order";
private ClassificationService classificationService;
@ -76,8 +92,7 @@ public class ClassificationController extends AbstractPagingController {
ClassificationController(
ClassificationService classificationService,
ClassificationResourceAssembler classificationResourceAssembler,
ClassificationSummaryResourceAssembler classificationSummaryResourceAssembler
) {
ClassificationSummaryResourceAssembler classificationSummaryResourceAssembler) {
this.classificationService = classificationService;
this.classificationResourceAssembler = classificationResourceAssembler;
this.classificationSummaryResourceAssembler = classificationSummaryResourceAssembler;
@ -101,7 +116,8 @@ public class ClassificationController extends AbstractPagingController {
ResponseEntity<PagedResources<ClassificationSummaryResource>> response = new ResponseEntity<>(
classificationSummaryResourceAssembler.toResources(
classificationSummaries,
pageMetadata), HttpStatus.OK);
pageMetadata),
HttpStatus.OK);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getClassifications(), returning {}",
new ResponseEntity<>(response, HttpStatus.OK));
@ -133,8 +149,8 @@ public class ClassificationController extends AbstractPagingController {
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<ClassificationResource> createClassification(
@RequestBody ClassificationResource resource)
throws NotAuthorizedException, ClassificationNotFoundException, ClassificationAlreadyExistException,
ConcurrencyException, DomainNotFoundException, InvalidArgumentException {
throws NotAuthorizedException, ClassificationAlreadyExistException,
DomainNotFoundException, InvalidArgumentException {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to createClassification(resource= {})", resource);
}
@ -155,7 +171,7 @@ public class ClassificationController extends AbstractPagingController {
public ResponseEntity<ClassificationResource> updateClassification(
@PathVariable(value = "classificationId") String classificationId, @RequestBody ClassificationResource resource)
throws NotAuthorizedException, ClassificationNotFoundException, ConcurrencyException,
ClassificationAlreadyExistException, DomainNotFoundException, InvalidArgumentException {
InvalidArgumentException {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to updateClassification(classificationId= {}, resource= {})", classificationId,
resource);

View File

@ -44,7 +44,7 @@ import pro.taskana.rest.resource.ClassificationResourceAssembler;
* Controller for Importing / Exporting classifications.
*/
@RestController
@RequestMapping(path = "/v1/classification-definitions", produces = {MediaType.APPLICATION_JSON_VALUE})
@RequestMapping(path = "/v1/classification-definitions", produces = { MediaType.APPLICATION_JSON_VALUE })
public class ClassificationDefinitionController {
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationDefinitionController.class);
@ -55,8 +55,7 @@ public class ClassificationDefinitionController {
ClassificationDefinitionController(
ClassificationService classificationService,
ClassificationResourceAssembler classificationResourceAssembler
) {
ClassificationResourceAssembler classificationResourceAssembler) {
this.classificationService = classificationService;
this.classificationResourceAssembler = classificationResourceAssembler;
}
@ -65,8 +64,7 @@ public class ClassificationDefinitionController {
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<List<ClassificationResource>> exportClassifications(
@RequestParam(required = false) String domain)
throws ClassificationNotFoundException, DomainNotFoundException, InvalidArgumentException,
NotAuthorizedException, ConcurrencyException, ClassificationAlreadyExistException {
throws ClassificationNotFoundException {
LOGGER.debug("Entry to exportClassifications(domain= {})", domain);
ClassificationQuery query = classificationService.createClassificationQuery();
@ -115,7 +113,7 @@ public class ClassificationDefinitionController {
}
private List<ClassificationResource> extractClassificationResourcesFromFile(MultipartFile file)
throws IOException {
throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
List<ClassificationResource> classificationsDefinitions = mapper.readValue(file.getInputStream(),
@ -125,7 +123,8 @@ public class ClassificationDefinitionController {
return classificationsDefinitions;
}
private Map<Classification, String> mapChildrenToParentKeys(List<ClassificationResource> classificationResources, Map<String, String> systemIds) {
private Map<Classification, String> mapChildrenToParentKeys(List<ClassificationResource> classificationResources,
Map<String, String> systemIds) {
LOGGER.debug("Entry to mapChildrenToParentKeys()");
Map<Classification, String> childrenInFile = new HashMap<>();
Set<String> newKeysWithDomain = new HashSet<>();
@ -180,14 +179,15 @@ public class ClassificationDefinitionController {
}
private void updateParentChildrenRelations(Map<Classification, String> childrenInFile)
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
InvalidArgumentException {
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
InvalidArgumentException {
LOGGER.debug("Entry to updateParentChildrenRelations()");
for (Classification childRes : childrenInFile.keySet()) {
Classification child = classificationService
.getClassification(childRes.getKey(), childRes.getDomain());
.getClassification(childRes.getKey(), childRes.getDomain());
String parentKey = childrenInFile.get(childRes);
String parentId = (parentKey == null) ? "" : classificationService.getClassification(parentKey, childRes.getDomain()).getId();
String parentId = (parentKey == null) ? ""
: classificationService.getClassification(parentKey, childRes.getDomain()).getId();
child.setParentKey(parentKey);
child.setParentId(parentId);
classificationService.updateClassification(child);

View File

@ -10,8 +10,6 @@ import org.springframework.test.context.web.WebAppConfiguration;
import pro.taskana.WorkbasketAccessItem;
import pro.taskana.WorkbasketService;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.impl.WorkbasketAccessItemImpl;
import pro.taskana.rest.TestConfiguration;
@ -19,18 +17,18 @@ import pro.taskana.rest.TestConfiguration;
* Test for {@link WorkbasketAccessItemResourceAssembler}.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {TestConfiguration.class})
@ContextConfiguration(classes = { TestConfiguration.class })
@WebAppConfiguration
public class WorkbasketAccessItemResourceAssemblerTest {
@Autowired
WorkbasketAccessItemResourceAssembler workbasketAccessItemResourceAssembler;
@Autowired
WorkbasketService workbasketService;
@Test
public void workBasketAccessItemToResourcePropertiesEqual()
throws NotAuthorizedException, WorkbasketNotFoundException {
public void workBasketAccessItemToResourcePropertiesEqual() {
// given
WorkbasketAccessItem accessItem = workbasketService.newWorkbasketAccessItem("1", "2");
((WorkbasketAccessItemImpl) accessItem).setWorkbasketKey("workbasketKey");