TSK-53 Comments from Holger

This commit is contained in:
BerndBreier 2017-12-04 09:46:58 +01:00
parent 7fb36ac156
commit 3db95975a1
4 changed files with 23 additions and 23 deletions

View File

@ -83,7 +83,7 @@ public class ClassificationServiceImpl implements ClassificationService {
this.setDefaultValues(classification); this.setDefaultValues(classification);
classificationMapper.insert(classification); classificationMapper.insert(classification);
LOGGER.info("Method addClassification added classification {}.", classification); LOGGER.debug("Method addClassification added classification {}.", classification);
} finally { } finally {
taskanaEngineImpl.returnConnection(); taskanaEngineImpl.returnConnection();
LOGGER.debug("exit from addClassification()"); LOGGER.debug("exit from addClassification()");
@ -100,25 +100,25 @@ public class ClassificationServiceImpl implements ClassificationService {
Classification oldClassification = null; Classification oldClassification = null;
try { try {
oldClassification = this.getClassification(classification.getId(), classification.getDomain()); oldClassification = this.getClassification(classification.getId(), classification.getDomain());
LOGGER.info("Method updateClassification() inserted classification {}.", classification); LOGGER.debug("Method updateClassification() inserted classification {}.", classification);
// ! If you update an classification twice the same day, // ! If you update an classification twice the same day,
// the older version is valid from today until yesterday. // the older version is valid from today until yesterday.
if (!oldClassification.getDomain().equals(classification.getDomain())) { if (!oldClassification.getDomain().equals(classification.getDomain())) {
classification.setCreated(Date.valueOf(LocalDate.now())); classification.setCreated(Date.valueOf(LocalDate.now()));
classificationMapper.insert(classification); classificationMapper.insert(classification);
LOGGER.info("Method updateClassification() inserted classification {}.", classification); LOGGER.debug("Method updateClassification() inserted classification {}.", classification);
} else { } else {
oldClassification.setValidUntil(Date.valueOf(LocalDate.now().minusDays(1))); oldClassification.setValidUntil(Date.valueOf(LocalDate.now().minusDays(1)));
classificationMapper.update(oldClassification); classificationMapper.update(oldClassification);
classificationMapper.insert(classification); classificationMapper.insert(classification);
LOGGER.info("Method updateClassification() updated old classification {} and inserted new {}.", oldClassification, classification); LOGGER.debug("Method updateClassification() updated old classification {} and inserted new {}.", oldClassification, classification);
} }
} catch (ClassificationNotFoundException e) { } catch (ClassificationNotFoundException e) {
classification.setId(IdGenerator.generateWithPrefix(ID_PREFIX_CLASSIFICATION)); classification.setId(IdGenerator.generateWithPrefix(ID_PREFIX_CLASSIFICATION));
classification.setCreated(Date.valueOf(LocalDate.now())); classification.setCreated(Date.valueOf(LocalDate.now()));
classificationMapper.insert(classification); classificationMapper.insert(classification);
LOGGER.info("Method updateClassification() inserted classification {}.", classification); LOGGER.debug("Method updateClassification() inserted classification {}.", classification);
} }
} finally { } finally {
taskanaEngineImpl.returnConnection(); taskanaEngineImpl.returnConnection();

View File

@ -35,8 +35,8 @@ public class SummaryServiceImpl implements SummaryService {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
taskSummaries = summaryMapper.findTasksummariesByWorkbasketId(workbasketId); taskSummaries = summaryMapper.findTasksummariesByWorkbasketId(workbasketId);
} catch (Exception ex) { } catch (Exception ex) {
LOGGER.warn("Getting TASKSUMMARY failed internally.", ex); LOGGER.error("Getting TASKSUMMARY failed internally.", ex);
} finally { } finally {
if (taskSummaries == null) { if (taskSummaries == null) {
taskSummaries = new ArrayList<>(); taskSummaries = new ArrayList<>();
} }

View File

@ -71,7 +71,7 @@ public class TaskServiceImpl implements TaskService {
task.setClaimed(now); task.setClaimed(now);
task.setState(TaskState.CLAIMED); task.setState(TaskState.CLAIMED);
taskMapper.update(task); taskMapper.update(task);
LOGGER.info("Method claim() claimed task '{}' for user '{}'.", id, userName); LOGGER.debug("Method claim() claimed task '{}' for user '{}'.", id, userName);
} else { } else {
LOGGER.warn("Method claim() didn't find task with id {}. Throwing TaskNotFoundException", id); LOGGER.warn("Method claim() didn't find task with id {}. Throwing TaskNotFoundException", id);
throw new TaskNotFoundException(id); throw new TaskNotFoundException(id);
@ -96,7 +96,7 @@ public class TaskServiceImpl implements TaskService {
task.setModified(now); task.setModified(now);
task.setState(TaskState.COMPLETED); task.setState(TaskState.COMPLETED);
taskMapper.update(task); taskMapper.update(task);
LOGGER.info("Method complete() completed Task '{}'.", id); LOGGER.debug("Method complete() completed Task '{}'.", id);
} else { } else {
LOGGER.warn("Method complete() didn't find task with id {}. Throwing TaskNotFoundException", id); LOGGER.warn("Method complete() didn't find task with id {}. Throwing TaskNotFoundException", id);
throw new TaskNotFoundException(id); throw new TaskNotFoundException(id);
@ -119,7 +119,7 @@ public class TaskServiceImpl implements TaskService {
this.taskMapper.insert(task); this.taskMapper.insert(task);
LOGGER.info("Method create() created Task '{}'.", task.getId()); LOGGER.debug("Method create() created Task '{}'.", task.getId());
return task; return task;
} finally { } finally {
taskanaEngineImpl.returnConnection(); taskanaEngineImpl.returnConnection();
@ -161,7 +161,7 @@ public class TaskServiceImpl implements TaskService {
this.taskMapper.insert(task); this.taskMapper.insert(task);
LOGGER.info("Method create() created Task '{}'.", task.getId()); LOGGER.debug("Method create() created Task '{}'.", task.getId());
return task; return task;
} finally { } finally {
taskanaEngineImpl.returnConnection(); taskanaEngineImpl.returnConnection();
@ -256,7 +256,7 @@ public class TaskServiceImpl implements TaskService {
taskMapper.update(task); taskMapper.update(task);
result = getTaskById(taskId); result = getTaskById(taskId);
LOGGER.info("Method transfer() transferred Task '{}' to destination workbasket {}", taskId, destinationWorkbasketId); LOGGER.debug("Method transfer() transferred Task '{}' to destination workbasket {}", taskId, destinationWorkbasketId);
return result; return result;
} finally { } finally {
taskanaEngineImpl.returnConnection(); taskanaEngineImpl.returnConnection();
@ -299,7 +299,7 @@ public class TaskServiceImpl implements TaskService {
task.setModified(Timestamp.valueOf(LocalDateTime.now())); task.setModified(Timestamp.valueOf(LocalDateTime.now()));
taskMapper.update(task); taskMapper.update(task);
result = getTaskById(taskId); result = getTaskById(taskId);
LOGGER.info("Method setTaskRead() set read property of Task '{}' to {} ", result, isRead); LOGGER.debug("Method setTaskRead() set read property of Task '{}' to {} ", result, isRead);
return result; return result;
} finally { } finally {
taskanaEngineImpl.returnConnection(); taskanaEngineImpl.returnConnection();

View File

@ -124,17 +124,17 @@ public class WorkbasketServiceImpl implements WorkbasketService {
workbasket.setId(IdGenerator.generateWithPrefix(ID_PREFIX_WORKBASKET)); workbasket.setId(IdGenerator.generateWithPrefix(ID_PREFIX_WORKBASKET));
} }
workbasketMapper.insert(workbasket); workbasketMapper.insert(workbasket);
LOGGER.info("Method createWorkbasket() created Workbasket '{}'", workbasket); LOGGER.debug("Method createWorkbasket() created Workbasket '{}'", workbasket);
if (workbasket.getDistributionTargets() != null) { if (workbasket.getDistributionTargets() != null) {
for (Workbasket distributionTarget : workbasket.getDistributionTargets()) { for (Workbasket distributionTarget : workbasket.getDistributionTargets()) {
if (workbasketMapper.findById(distributionTarget.getId()) == null) { if (workbasketMapper.findById(distributionTarget.getId()) == null) {
distributionTarget.setCreated(now); distributionTarget.setCreated(now);
distributionTarget.setModified(now); distributionTarget.setModified(now);
workbasketMapper.insert(distributionTarget); workbasketMapper.insert(distributionTarget);
LOGGER.info("Method createWorkbasket() created distributionTarget '{}'", distributionTarget); LOGGER.debug("Method createWorkbasket() created distributionTarget '{}'", distributionTarget);
} }
distributionTargetMapper.insert(workbasket.getId(), distributionTarget.getId()); distributionTargetMapper.insert(workbasket.getId(), distributionTarget.getId());
LOGGER.info("Method createWorkbasket() created distributiontarget for source '{}' and target {}", workbasket.getId(), distributionTarget.getId()); LOGGER.debug("Method createWorkbasket() created distributiontarget for source '{}' and target {}", workbasket.getId(), distributionTarget.getId());
} }
} }
result = workbasketMapper.findById(workbasket.getId()); result = workbasketMapper.findById(workbasket.getId());
@ -153,24 +153,24 @@ public class WorkbasketServiceImpl implements WorkbasketService {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
workbasket.setModified(new Timestamp(System.currentTimeMillis())); workbasket.setModified(new Timestamp(System.currentTimeMillis()));
workbasketMapper.update(workbasket); workbasketMapper.update(workbasket);
LOGGER.info("Method updateWorkbasket() updated workbasket '{}'", workbasket.getId()); LOGGER.debug("Method updateWorkbasket() updated workbasket '{}'", workbasket.getId());
List<String> oldDistributionTargets = distributionTargetMapper.findBySourceId(workbasket.getId()); List<String> oldDistributionTargets = distributionTargetMapper.findBySourceId(workbasket.getId());
List<Workbasket> distributionTargets = workbasket.getDistributionTargets(); List<Workbasket> distributionTargets = workbasket.getDistributionTargets();
for (Workbasket distributionTarget : distributionTargets) { for (Workbasket distributionTarget : distributionTargets) {
if (!oldDistributionTargets.contains(distributionTarget.getId())) { if (!oldDistributionTargets.contains(distributionTarget.getId())) {
if (workbasketMapper.findById(distributionTarget.getId()) == null) { if (workbasketMapper.findById(distributionTarget.getId()) == null) {
workbasketMapper.insert(distributionTarget); workbasketMapper.insert(distributionTarget);
LOGGER.info(" Method updateWorkbasket() created distributionTarget '{}'", distributionTarget); LOGGER.debug(" Method updateWorkbasket() created distributionTarget '{}'", distributionTarget);
} }
distributionTargetMapper.insert(workbasket.getId(), distributionTarget.getId()); distributionTargetMapper.insert(workbasket.getId(), distributionTarget.getId());
LOGGER.info("Method updateWorkbasket() created distributionTarget for '{}' and '{}'", workbasket.getId(), distributionTarget.getId()); LOGGER.debug("Method updateWorkbasket() created distributionTarget for '{}' and '{}'", workbasket.getId(), distributionTarget.getId());
} else { } else {
oldDistributionTargets.remove(distributionTarget.getId()); oldDistributionTargets.remove(distributionTarget.getId());
} }
} }
distributionTargetMapper.deleteMultiple(workbasket.getId(), oldDistributionTargets); distributionTargetMapper.deleteMultiple(workbasket.getId(), oldDistributionTargets);
if (LOGGER.isInfoEnabled()) { if (LOGGER.isInfoEnabled()) {
LOGGER.info("Method updateWorkbasket() deleted distributionTargets for '{}' and old distribution targets {}", LOGGER.debug("Method updateWorkbasket() deleted distributionTargets for '{}' and old distribution targets {}",
workbasket.getId(), LoggerUtils.listToString(oldDistributionTargets)); workbasket.getId(), LoggerUtils.listToString(oldDistributionTargets));
} }
result = workbasketMapper.findById(workbasket.getId()); result = workbasketMapper.findById(workbasket.getId());
@ -188,7 +188,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
workbasketAccessItem.setId(IdGenerator.generateWithPrefix(ID_PREFIX_WORKBASKET_AUTHORIZATION)); workbasketAccessItem.setId(IdGenerator.generateWithPrefix(ID_PREFIX_WORKBASKET_AUTHORIZATION));
workbasketAccessMapper.insert(workbasketAccessItem); workbasketAccessMapper.insert(workbasketAccessItem);
LOGGER.info("Method createWorkbasketAuthorization() created workbaskteAccessItem {}", workbasketAccessItem); LOGGER.debug("Method createWorkbasketAuthorization() created workbaskteAccessItem {}", workbasketAccessItem);
return workbasketAccessItem; return workbasketAccessItem;
} finally { } finally {
taskanaEngineImpl.returnConnection(); taskanaEngineImpl.returnConnection();
@ -216,7 +216,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
try { try {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
workbasketAccessMapper.delete(id); workbasketAccessMapper.delete(id);
LOGGER.info("Method deleteWorkbasketAuthorization() deleted workbasketAccessItem wit Id {}", id); LOGGER.debug("Method deleteWorkbasketAuthorization() deleted workbasketAccessItem wit Id {}", id);
} finally { } finally {
taskanaEngineImpl.returnConnection(); taskanaEngineImpl.returnConnection();
LOGGER.debug("exit from deleteWorkbasketAuthorization(id)."); LOGGER.debug("exit from deleteWorkbasketAuthorization(id).");
@ -280,7 +280,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
try { try {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
workbasketAccessMapper.update(workbasketAccessItem); workbasketAccessMapper.update(workbasketAccessItem);
LOGGER.info("Method updateWorkbasketAuthorization() updated workbasketAccessItem {}", workbasketAccessItem); LOGGER.debug("Method updateWorkbasketAuthorization() updated workbasketAccessItem {}", workbasketAccessItem);
return workbasketAccessItem; return workbasketAccessItem;
} finally { } finally {
taskanaEngineImpl.returnConnection(); taskanaEngineImpl.returnConnection();