TSK-769 - Improve the logger on both library and rest

This commit is contained in:
Jose Ignacio Recuerda Cambil 2019-01-15 17:27:09 +01:00 committed by BerndBreier
parent 8d8ef3df78
commit 24a700b81d
77 changed files with 1320 additions and 867 deletions

View File

@ -8,6 +8,8 @@ import java.util.Map;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pro.taskana.impl.util.LoggerUtils;
/** /**
* Returning type for a bulk db interaction with errors. This wrapper is storing them with a matching object ID. * Returning type for a bulk db interaction with errors. This wrapper is storing them with a matching object ID.
* *
@ -127,6 +129,10 @@ public class BulkOperationResults<K, V> {
} }
return bulkLogMapped; return bulkLogMapped;
}
@Override
public String toString() {
return "BulkOperationResults [BulkOperationResults= " + LoggerUtils.mapToString(this.errorMap) + "]";
} }
} }

View File

@ -33,13 +33,10 @@ public class KeyDomain {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "KeyDomain [" +
builder.append("KeyDomain [key="); "key=" + this.key +
builder.append(key); ", domain=" + this.domain +
builder.append(", domain="); "]";
builder.append(domain);
builder.append("]");
return builder.toString();
} }
@Override @Override

View File

@ -62,21 +62,14 @@ public class ObjectReference {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "ObjectReference [" +
builder.append("ObjectReference [id="); "id=" + this.id +
builder.append(id); ", company=" + this.company +
builder.append(", company="); ", system=" + this.system +
builder.append(company); ", systemInstance=" + this.systemInstance +
builder.append(", system="); ", type=" + this.type +
builder.append(system); ", value=" + this.value +
builder.append(", systemInstance="); "]";
builder.append(systemInstance);
builder.append(", type=");
builder.append(type);
builder.append(", value=");
builder.append(value);
builder.append("]");
return builder.toString();
} }
@Override @Override

View File

@ -53,13 +53,10 @@ public class TimeInterval {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "TimeInterval [" +
builder.append("TimeInterval [begin="); "begin=" + this.begin +
builder.append(begin); ", end=" + this.end +
builder.append(", end="); "]";
builder.append(end);
builder.append("]");
return builder.toString();
} }
@Override @Override

View File

@ -311,8 +311,11 @@ public class TaskanaEngineConfiguration {
} }
ensureRoleMapIsFullyInitialized(); ensureRoleMapIsFullyInitialized();
roleMap.forEach( if(LOGGER.isDebugEnabled()) {
(k, v) -> LOGGER.debug("Found Taskana RoleConfig {} : {} ", k, LoggerUtils.setToString(v))); roleMap.forEach(
(k, v) -> LOGGER.debug("Found Taskana RoleConfig {} : {} ", k, LoggerUtils.setToString(v)));
}
} }
private Properties readPropertiesFromFile(String propertiesFile) { private Properties readPropertiesFromFile(String propertiesFile) {

View File

@ -243,4 +243,25 @@ public class TaskanaHistoryEvent {
public void setNewData(String newData) { public void setNewData(String newData) {
this.newData = newData; this.newData = newData;
} }
@Override
public String toString() {
return "TaskanaHistoryEvent [" +
"id=" + this.id +
", businessProcessId=" + this.businessProcessId +
", parentBusinessProcessId=" + this.parentBusinessProcessId +
", taskId=" + this.taskId +
", eventType=" + this.eventType +
", created=" + this.created +
", userId=" + this.userId +
", domain=" + this.domain +
", workbasketKey=" + this.workbasketKey +
", taskClassificationKey=" + this.taskClassificationKey +
", attachmentClassificationKey=" + this.attachmentClassificationKey +
", oldValue=" + this.oldValue +
", newValue=" + this.newValue +
", oldData=" + this.oldData +
", newData=" + this.newData +
"]";
}
} }

View File

@ -175,4 +175,13 @@ public class TaskEvent extends TaskanaHistoryEvent {
this.porValue = porValue; this.porValue = porValue;
} }
@Override
public String toString() {
return "TaskEvent [taskId= " + this.taskId +
", businessProcessId= " + this.businessProcessId +
", parentBusinessProcessId= " + this.parentBusinessProcessId +
", domain= " + this.domain +
", workbasketKey= " + this.workbasketKey + "]";
}
} }

View File

@ -96,8 +96,7 @@ abstract class AbstractWorkbasketAccessItemQueryImpl<Q extends AbstractWorkbaske
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -146,8 +145,7 @@ abstract class AbstractWorkbasketAccessItemQueryImpl<Q extends AbstractWorkbaske
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -214,17 +212,12 @@ abstract class AbstractWorkbasketAccessItemQueryImpl<Q extends AbstractWorkbaske
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "AbstractWorkbasketAccessItemQueryImpl [" +
builder.append("AbstractWorkbasketAccessItemQueryImpl [idIn="); "idIn=" + Arrays.toString(this.idIn) +
builder.append(Arrays.toString(idIn)); ", accessIdIn=" + Arrays.toString(this.accessIdIn) +
builder.append(", accessIdIn="); ", workbasketIdIn=" + Arrays.toString(this.workbasketIdIn) +
builder.append(Arrays.toString(accessIdIn)); ", orderBy=" + this.orderBy +
builder.append(", workbasketIdIn="); "]";
builder.append(Arrays.toString(workbasketIdIn));
builder.append(", orderBy=");
builder.append(orderBy);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -238,26 +238,16 @@ public class AttachmentImpl implements Attachment {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "AttachmentImpl [" +
builder.append("AttachmentImpl [id="); "id= " + this.id +
builder.append(id); ", taskId= " + this.taskId +
builder.append(", taskId="); ", created= " + this.created +
builder.append(taskId); ", modified= " + this.modified +
builder.append(", created="); ", classificationSummary= " + this.classificationSummary +
builder.append(created); ", objectReference= " + this.objectReference +
builder.append(", modified="); ", channel= " + this.channel +
builder.append(modified); ", received= " + this.received +
builder.append(", classificationSummary="); ", customAttributes= " + this.customAttributes +
builder.append(classificationSummary); "]";
builder.append(", objectReference=");
builder.append(objectReference);
builder.append(", channel=");
builder.append(channel);
builder.append(", received=");
builder.append(received);
builder.append(", customAttributes=");
builder.append(customAttributes);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -226,25 +226,16 @@ public class AttachmentSummaryImpl implements AttachmentSummary {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "AttachmentSummaryImpl [" +
builder.append("AttachmentSummaryImpl [id="); "id=" + this.id +
builder.append(id); ", taskId=" + this.taskId +
builder.append(", taskId="); ", created=" + this.created +
builder.append(taskId); ", modified=" + this.modified +
builder.append(", created="); ", classificationSummary=" + this.classificationSummary +
builder.append(created); ", objectReference=" + this.objectReference +
builder.append(", modified="); ", channel=" + this.channel +
builder.append(modified); ", received=" + this.received +
builder.append(", classificationSummary="); "]";
builder.append(classificationSummary);
builder.append(", objectReference=");
builder.append(objectReference);
builder.append(", channel=");
builder.append(channel);
builder.append(", received=");
builder.append(received);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -313,55 +313,31 @@ public class ClassificationImpl implements Classification {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "Classification [" +
builder.append("Classification [id="); "id= " + this.id +
builder.append(id); ", key= " + this.key +
builder.append(", key="); ", parentId= " + this.parentId +
builder.append(key); ", parentKey= " + this.parentKey +
builder.append(", parentId="); ", category= " + this.category +
builder.append(parentId); ", type= " + this.type +
builder.append(", parentKey="); ", domain= " + this.domain +
builder.append(parentKey); ", isValidInDomain= " + this.isValidInDomain +
builder.append(", category="); ", created= " + this.created +
builder.append(category); ", modified= " + this.modified +
builder.append(", type="); ", name= " + this.name +
builder.append(type); ", description= " + this.description +
builder.append(", domain="); ", priority= " + this.priority +
builder.append(domain); ", serviceLevel= " + this.serviceLevel +
builder.append(", isValidInDomain="); ", applicationEntryPoint= " + this.applicationEntryPoint +
builder.append(isValidInDomain); ", custom1= " + this.custom1 +
builder.append(", created="); ", custom2= " + this.custom2 +
builder.append(created); ", custom3= " + this.custom3 +
builder.append(", modified="); ", custom4= " + this.custom4 +
builder.append(modified); ", custom5= " + this.custom5 +
builder.append(", name="); ", custom6= " + this.custom6 +
builder.append(name); ", custom7= " + this.custom7 +
builder.append(", description="); ", custom8= " + this.custom8 +
builder.append(description); "]";
builder.append(", priority=");
builder.append(priority);
builder.append(", serviceLevel=");
builder.append(serviceLevel);
builder.append(", applicationEntryPoint=");
builder.append(applicationEntryPoint);
builder.append(", custom1=");
builder.append(custom1);
builder.append(", custom2=");
builder.append(custom2);
builder.append(", custom3=");
builder.append(custom3);
builder.append(", custom4=");
builder.append(custom4);
builder.append(", custom5=");
builder.append(custom5);
builder.append(", custom6=");
builder.append(custom6);
builder.append(", custom7=");
builder.append(custom7);
builder.append(", custom8=");
builder.append(custom8);
builder.append("]");
return builder.toString();
} }
@Override @Override

View File

@ -378,8 +378,7 @@ public class ClassificationQueryImpl implements ClassificationQuery {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -407,8 +406,7 @@ public class ClassificationQueryImpl implements ClassificationQuery {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -428,8 +426,7 @@ public class ClassificationQueryImpl implements ClassificationQuery {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("Exit from listValues. Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("Exit from listValues. Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -620,81 +617,44 @@ public class ClassificationQueryImpl implements ClassificationQuery {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "ClassificationQueryImpl [" +
builder.append("ClassificationQueryImpl [columnName="); "columnName= " + this.columnName +
builder.append(columnName); ", key= " + Arrays.toString(this.key) +
builder.append(", key="); ", idIn= " + Arrays.toString(this.idIn) +
builder.append(Arrays.toString(key)); ", parentId= " + Arrays.toString(this.parentId) +
builder.append(", idIn="); ", parentKey= " + Arrays.toString(this.parentKey) +
builder.append(Arrays.toString(idIn)); ", category= " + Arrays.toString(this.category) +
builder.append(", parentId="); ", type= " + Arrays.toString(this.type) +
builder.append(Arrays.toString(parentId)); ", domain= " + Arrays.toString(this.domain) +
builder.append(", parentKey="); ", validInDomain= " + this.validInDomain +
builder.append(Arrays.toString(parentKey)); ", createdIn= " + Arrays.toString(this.createdIn) +
builder.append(", category="); ", modifiedIn= " + Arrays.toString(this.modifiedIn) +
builder.append(Arrays.toString(category)); ", nameIn= " + Arrays.toString(this.nameIn) +
builder.append(", type="); ", nameLike= " + Arrays.toString(this.nameLike) +
builder.append(Arrays.toString(type)); ", descriptionLike= " + this.descriptionLike +
builder.append(", domain="); ", priority= " + Arrays.toString(this.priority) +
builder.append(Arrays.toString(domain)); ", serviceLevelIn= " + Arrays.toString(this.serviceLevelIn) +
builder.append(", validInDomain="); ", serviceLevelLike= " + Arrays.toString(this.serviceLevelLike) +
builder.append(validInDomain); ", applicationEntryPointIn= " + Arrays.toString(this.applicationEntryPointIn) +
builder.append(", createdIn="); ", applicationEntryPointLike= " + Arrays.toString(this.applicationEntryPointLike) +
builder.append(Arrays.toString(createdIn)); ", custom1In= " + Arrays.toString(this.custom1In) +
builder.append(", modifiedIn="); ", custom1Like= " + Arrays.toString(this.custom1Like) +
builder.append(Arrays.toString(modifiedIn)); ", custom2In= " + Arrays.toString(this.custom2In) +
builder.append(", nameIn="); ", custom2Like= " + Arrays.toString(this.custom2Like) +
builder.append(Arrays.toString(nameIn)); ", custom3In= " + Arrays.toString(this.custom3In) +
builder.append(", nameLike="); ", custom3Like= " + Arrays.toString(this.custom3Like) +
builder.append(Arrays.toString(nameLike)); ", custom4In= " + Arrays.toString(this.custom4In) +
builder.append(", descriptionLike="); ", custom4Like= " + Arrays.toString(this.custom4Like) +
builder.append(descriptionLike); ", custom5In= " + Arrays.toString(this.custom5In) +
builder.append(", priority="); ", custom5Like= " + Arrays.toString(this.custom5Like) +
builder.append(Arrays.toString(priority)); ", custom6In= " + Arrays.toString(this.custom6In) +
builder.append(", serviceLevelIn="); ", custom6Like= " + Arrays.toString(this.custom6Like) +
builder.append(Arrays.toString(serviceLevelIn)); ", custom7In= " + Arrays.toString(this.custom7In) +
builder.append(", serviceLevelLike="); ", custom7Like= " + Arrays.toString(this.custom7Like) +
builder.append(Arrays.toString(serviceLevelLike)); ", custom8In= " + Arrays.toString(this.custom8In) +
builder.append(", applicationEntryPointIn="); ", custom8Like= " + Arrays.toString(this.custom8Like) +
builder.append(Arrays.toString(applicationEntryPointIn)); ", orderBy= " + this.orderBy +
builder.append(", applicationEntryPointLike="); "]";
builder.append(Arrays.toString(applicationEntryPointLike));
builder.append(", custom1In=");
builder.append(Arrays.toString(custom1In));
builder.append(", custom1Like=");
builder.append(Arrays.toString(custom1Like));
builder.append(", custom2In=");
builder.append(Arrays.toString(custom2In));
builder.append(", custom2Like=");
builder.append(Arrays.toString(custom2Like));
builder.append(", custom3In=");
builder.append(Arrays.toString(custom3In));
builder.append(", custom3Like=");
builder.append(Arrays.toString(custom3Like));
builder.append(", custom4In=");
builder.append(Arrays.toString(custom4In));
builder.append(", custom4Like=");
builder.append(Arrays.toString(custom4Like));
builder.append(", custom5In=");
builder.append(Arrays.toString(custom5In));
builder.append(", custom5Like=");
builder.append(Arrays.toString(custom5Like));
builder.append(", custom6In=");
builder.append(Arrays.toString(custom6In));
builder.append(", custom6Like=");
builder.append(Arrays.toString(custom6Like));
builder.append(", custom7In=");
builder.append(Arrays.toString(custom7In));
builder.append(", custom7Like=");
builder.append(Arrays.toString(custom7Like));
builder.append(", custom8In=");
builder.append(Arrays.toString(custom8In));
builder.append(", custom8Like=");
builder.append(Arrays.toString(custom8Like));
builder.append(", orderBy=");
builder.append(orderBy);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -351,45 +351,26 @@ public class ClassificationSummaryImpl implements ClassificationSummary {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "ClassificationSummaryImpl [" +
builder.append("ClassificationSummaryImpl [id="); "id= " + this.id +
builder.append(id); ", key= " + this.key +
builder.append(", key="); ", category= " + this.category +
builder.append(key); ", type= " + this.type +
builder.append(", category="); ", domain= " + this.domain +
builder.append(category); ", name= " + this.name +
builder.append(", type="); ", parentId= " + this.parentId +
builder.append(type); ", parentKey= " + parentKey +
builder.append(", domain="); ", priority= " + this.priority +
builder.append(domain); ", serviceLevel= " + this.serviceLevel +
builder.append(", name="); ", custom1= " + this.custom1 +
builder.append(name); ", custom2= " + this.custom2 +
builder.append(", parentId="); ", custom3= " + this.custom3 +
builder.append(parentId); ", custom4= " + this.custom4 +
builder.append(", parentKey="); ", custom5= " + this.custom5 +
builder.append(parentKey); ", custom6= " + this.custom6 +
builder.append(", priority="); ", custom7= " + this.custom7 +
builder.append(priority); ", custom8= " + this.custom8 +
builder.append(", serviceLevel="); "]";
builder.append(serviceLevel);
builder.append(", custom1=");
builder.append(custom1);
builder.append(", custom2=");
builder.append(custom2);
builder.append(", custom3=");
builder.append(custom3);
builder.append(", custom4=");
builder.append(custom4);
builder.append(", custom5=");
builder.append(custom5);
builder.append(", custom6=");
builder.append(custom6);
builder.append(", custom7=");
builder.append(custom7);
builder.append(", custom8=");
builder.append(custom8);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -326,4 +326,14 @@ public final class DaysToWorkingDaysConverter {
return germanHolidaysEnabled; return germanHolidaysEnabled;
} }
@Override
public String toString() {
return "DaysToWorkingDaysConverter [instance= " + instance +
", positiveDaysToWorkingDays= " + positiveDaysToWorkingDays +
", negativeDaysToWorkingDays= " + negativeDaysToWorkingDays +
", dateCreated= " + dateCreated +
", easterSunday= " + easterSunday +
", germanHolidaysEnabled= " + germanHolidaysEnabled +
", customHolidays= " + LoggerUtils.listToString(customHolidays) + "]";
}
} }

View File

@ -87,6 +87,7 @@ public class JobServiceImpl implements JobService {
} }
private ScheduledJob initializeJobDefault(ScheduledJob job) { private ScheduledJob initializeJobDefault(ScheduledJob job) {
LOGGER.debug("entry to initializeJobDefault(job = {})", job);
job.setCreated(Instant.now()); job.setCreated(Instant.now());
job.setState(ScheduledJob.State.READY); job.setState(ScheduledJob.State.READY);
job.setPriority(JOB_DEFAULT_PRIORITY); job.setPriority(JOB_DEFAULT_PRIORITY);

View File

@ -41,15 +41,11 @@ public class MinimalTaskSummary {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "MinimalTaskSummary [" +
builder.append("MinimalTaskSummary [taskId="); "taskId= " + this.taskId +
builder.append(taskId); ", workbasketId= " + this.workbasketId +
builder.append(", workbasketId="); ", taskState= " + this.taskState +
builder.append(workbasketId); "]";
builder.append(", taskState=");
builder.append(taskState);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -82,8 +82,7 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -103,8 +102,7 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("Exit from listValues. Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("Exit from listValues. Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -132,8 +130,7 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -219,20 +216,13 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "ObjectReferenceQueryImpl [" +
builder.append("ObjectReferenceQueryImpl [taskanaEngineImpl="); "taskanaEngineImpl= " + this.taskanaEngine +
builder.append(taskanaEngine); ", company= " + Arrays.toString(this.company) +
builder.append(", company="); ", system= " + Arrays.toString(this.system) +
builder.append(Arrays.toString(company)); ", systemInstance= " + Arrays.toString(this.systemInstance) +
builder.append(", system="); ", type= " + Arrays.toString(this.type) +
builder.append(Arrays.toString(system)); ", value= " + Arrays.toString(this.value) +
builder.append(", systemInstance="); "]";
builder.append(Arrays.toString(systemInstance));
builder.append(", type=");
builder.append(Arrays.toString(type));
builder.append(", value=");
builder.append(Arrays.toString(value));
builder.append("]");
return builder.toString();
} }
} }

View File

@ -721,91 +721,49 @@ public class TaskImpl implements Task {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "TaskImpl [" +
builder.append("TaskImpl [id="); "id= " + this.id +
builder.append(id); ", externalId= " + this.externalId +
builder.append(", externalId="); ", created= " + this.created +
builder.append(externalId); ", claimed= " + this.claimed +
builder.append(", created="); ", completed= " + this.completed +
builder.append(created); ", modified= " + this.modified +
builder.append(", claimed="); ", planned= " + this.planned +
builder.append(claimed); ", due= " + this.due +
builder.append(", completed="); ", name= " + this.name +
builder.append(completed); ", creator= " + this.creator +
builder.append(", modified="); ", description= " + this.description +
builder.append(modified); ", note= " + this.note +
builder.append(", planned="); ", priority= " + this.priority +
builder.append(planned); ", state= " + this.state +
builder.append(", due="); ", classificationSummary= " + this.classificationSummary +
builder.append(due); ", workbasketSummary= " + this.workbasketSummary +
builder.append(", name="); ", businessProcessId= " + this.businessProcessId +
builder.append(name); ", parentBusinessProcessId= " + this.parentBusinessProcessId +
builder.append(", creator="); ", owner= " + this.owner +
builder.append(creator); ", primaryObjRef= " + this.primaryObjRef +
builder.append(", description="); ", isRead= " + this.isRead +
builder.append(description); ", isTransferred= " + this.isTransferred +
builder.append(", note="); ", customAttributes= " + this.customAttributes +
builder.append(note); ", callbackInfo= " + this.callbackInfo +
builder.append(", priority="); ", attachments= " + this.attachments +
builder.append(priority); ", custom1= " + this.custom1 +
builder.append(", state="); ", custom2= " + this.custom2 +
builder.append(state); ", custom3= " + this.custom3 +
builder.append(", classificationSummary="); ", custom4= " + this.custom4 +
builder.append(classificationSummary); ", custom5= " + this.custom5 +
builder.append(", workbasketSummary="); ", custom6= " + this.custom6 +
builder.append(workbasketSummary); ", custom7= " + this.custom7 +
builder.append(", businessProcessId="); ", custom8= " + this.custom8 +
builder.append(businessProcessId); ", custom9= " + this.custom9 +
builder.append(", parentBusinessProcessId="); ", custom10= " + this.custom10 +
builder.append(parentBusinessProcessId); ", custom11= " + this.custom11 +
builder.append(", owner="); ", custom12= " + this.custom12 +
builder.append(owner); ", custom13= " + this.custom13 +
builder.append(", primaryObjRef="); ", custom14= " + this.custom14 +
builder.append(primaryObjRef); ", custom15= " + this.custom15 +
builder.append(", isRead="); ", custom16= " + this.custom16 +
builder.append(isRead); "]";
builder.append(", isTransferred=");
builder.append(isTransferred);
builder.append(", customAttributes=");
builder.append(customAttributes);
builder.append(", callbackInfo=");
builder.append(callbackInfo);
builder.append(", attachments=");
builder.append(attachments);
builder.append(", custom1=");
builder.append(custom1);
builder.append(", custom2=");
builder.append(custom2);
builder.append(", custom3=");
builder.append(custom3);
builder.append(", custom4=");
builder.append(custom4);
builder.append(", custom5=");
builder.append(custom5);
builder.append(", custom6=");
builder.append(custom6);
builder.append(", custom7=");
builder.append(custom7);
builder.append(", custom8=");
builder.append(custom8);
builder.append(", custom9=");
builder.append(custom9);
builder.append(", custom10=");
builder.append(custom10);
builder.append(", custom11=");
builder.append(custom11);
builder.append(", custom12=");
builder.append(custom12);
builder.append(", custom13=");
builder.append(custom13);
builder.append(", custom14=");
builder.append(custom14);
builder.append(", custom15=");
builder.append(custom15);
builder.append(", custom16=");
builder.append(custom16);
builder.append("]");
return builder.toString();
} }
@Override @Override

View File

@ -944,8 +944,7 @@ public class TaskQueryImpl implements TaskQuery {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -1031,8 +1030,7 @@ public class TaskQueryImpl implements TaskQuery {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("Exit from listValues. Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("Exit from listValues. Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -1063,8 +1061,7 @@ public class TaskQueryImpl implements TaskQuery {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }

View File

@ -412,7 +412,10 @@ public class TaskServiceImpl implements TaskService {
List<String> taskIds) throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException { List<String> taskIds) throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException {
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
LOGGER.debug("entry to transferBulk(targetWbId = {}, taskIds = {})", destinationWorkbasketId, taskIds); if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to transferTasks(targetWbId = {}, taskIds = {})", destinationWorkbasketId, LoggerUtils.listToString(taskIds));
}
// Check pre-conditions with trowing Exceptions // Check pre-conditions with trowing Exceptions
if (destinationWorkbasketId == null || destinationWorkbasketId.isEmpty()) { if (destinationWorkbasketId == null || destinationWorkbasketId.isEmpty()) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
@ -422,7 +425,10 @@ public class TaskServiceImpl implements TaskService {
return transferTasks(taskIds, destinationWorkbasket); return transferTasks(taskIds, destinationWorkbasket);
} finally { } finally {
LOGGER.debug("exit from transferBulk(targetWbKey = {}, taskIds = {})", destinationWorkbasketId, taskIds); if(LOGGER.isDebugEnabled()) {
LOGGER.debug("exit from transferTasks(targetWbKey = {}, taskIds = {})", destinationWorkbasketId, LoggerUtils.listToString(taskIds));
}
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
} }
} }
@ -433,8 +439,11 @@ public class TaskServiceImpl implements TaskService {
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException { throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException {
try { try {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
LOGGER.debug("entry to transferBulk(targetWbKey = {}, domain = {}, taskIds = {})", destinationWorkbasketKey, if(LOGGER.isDebugEnabled()) {
destinationWorkbasketDomain, taskIds); LOGGER.debug("entry to transferTasks(targetWbKey = {}, domain = {}, taskIds = {})", destinationWorkbasketKey,
destinationWorkbasketDomain, LoggerUtils.listToString(taskIds));
}
// Check pre-conditions with trowing Exceptions // Check pre-conditions with trowing Exceptions
if (destinationWorkbasketKey == null || destinationWorkbasketDomain == null) { if (destinationWorkbasketKey == null || destinationWorkbasketDomain == null) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
@ -445,8 +454,11 @@ public class TaskServiceImpl implements TaskService {
return transferTasks(taskIds, destinationWorkbasket); return transferTasks(taskIds, destinationWorkbasket);
} finally { } finally {
LOGGER.debug("exit from transferBulk(targetWbKey = {}, taskIds = {})", destinationWorkbasketKey, if(LOGGER.isDebugEnabled()) {
destinationWorkbasketDomain, taskIds); LOGGER.debug("exit from transferTasks(targetWbKey = {}, targetWbDomain = {}, destination taskIds = {})", destinationWorkbasketKey,
destinationWorkbasketDomain, LoggerUtils.listToString(taskIds));
}
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
} }
} }
@ -486,11 +498,13 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public Task newTask(String workbasketKey, String domain) { public Task newTask(String workbasketKey, String domain) {
LOGGER.debug("entry to newTask(workbasketKey = {}, domain = {})", workbasketKey, domain);
TaskImpl task = new TaskImpl(); TaskImpl task = new TaskImpl();
WorkbasketSummaryImpl wb = new WorkbasketSummaryImpl(); WorkbasketSummaryImpl wb = new WorkbasketSummaryImpl();
wb.setKey(workbasketKey); wb.setKey(workbasketKey);
wb.setDomain(domain); wb.setDomain(domain);
task.setWorkbasketSummary(wb); task.setWorkbasketSummary(wb);
LOGGER.debug("exit from newTask(), returning {}", task);
return task; return task;
} }
@ -547,6 +561,7 @@ public class TaskServiceImpl implements TaskService {
private void removeSingleTask(BulkOperationResults<String, TaskanaException> bulkLog, private void removeSingleTask(BulkOperationResults<String, TaskanaException> bulkLog,
List<MinimalTaskSummary> taskSummaries, Iterator<String> taskIdIterator) { List<MinimalTaskSummary> taskSummaries, Iterator<String> taskIdIterator) {
LOGGER.debug("entry to removeSingleTask()");
String currentTaskId = taskIdIterator.next(); String currentTaskId = taskIdIterator.next();
if (currentTaskId == null || currentTaskId.equals("")) { if (currentTaskId == null || currentTaskId.equals("")) {
bulkLog.addError("", bulkLog.addError("",
@ -568,6 +583,7 @@ public class TaskServiceImpl implements TaskService {
} }
} }
} }
LOGGER.debug("exit from removeSingleTask()");
} }
@Override @Override
@ -592,8 +608,10 @@ public class TaskServiceImpl implements TaskService {
if (!taskSummaries.isEmpty()) { if (!taskSummaries.isEmpty()) {
changedTasks = taskSummaries.stream().map(TaskSummary::getTaskId).collect(Collectors.toList()); changedTasks = taskSummaries.stream().map(TaskSummary::getTaskId).collect(Collectors.toList());
taskMapper.updateTasks(changedTasks, updated, fieldSelector); taskMapper.updateTasks(changedTasks, updated, fieldSelector);
LOGGER.debug("updateTasks() updated the following tasks: {} ", if(LOGGER.isDebugEnabled()) {
LoggerUtils.listToString(changedTasks)); LOGGER.debug("updateTasks() updated the following tasks: {} ", LoggerUtils.listToString(changedTasks));
}
} else { } else {
LOGGER.debug("updateTasks() found no tasks for update "); LOGGER.debug("updateTasks() found no tasks for update ");
} }
@ -602,7 +620,6 @@ public class TaskServiceImpl implements TaskService {
LOGGER.debug("exit from updateTasks()."); LOGGER.debug("exit from updateTasks().");
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
} }
} }
@Override @Override
@ -627,8 +644,10 @@ public class TaskServiceImpl implements TaskService {
if (!taskSummaries.isEmpty()) { if (!taskSummaries.isEmpty()) {
changedTasks = taskSummaries.stream().map(TaskSummary::getTaskId).collect(Collectors.toList()); changedTasks = taskSummaries.stream().map(TaskSummary::getTaskId).collect(Collectors.toList());
taskMapper.updateTasks(changedTasks, updatedTask, fieldSelector); taskMapper.updateTasks(changedTasks, updatedTask, fieldSelector);
LOGGER.debug("updateTasks() updated the following tasks: {} ", if(LOGGER.isDebugEnabled()) {
LoggerUtils.listToString(changedTasks)); LOGGER.debug("updateTasks() updated the following tasks: {} ", LoggerUtils.listToString(changedTasks));
}
} else { } else {
LOGGER.debug("updateTasks() found no tasks for update "); LOGGER.debug("updateTasks() found no tasks for update ");
} }
@ -665,6 +684,7 @@ public class TaskServiceImpl implements TaskService {
private void standardSettings(TaskImpl task, Classification classification, private void standardSettings(TaskImpl task, Classification classification,
PrioDurationHolder prioDurationFromAttachments) { PrioDurationHolder prioDurationFromAttachments) {
LOGGER.debug("entry to standardSettings()");
Instant now = Instant.now(); Instant now = Instant.now();
task.setId(IdGenerator.generateWithPrefix(ID_PREFIX_TASK)); task.setId(IdGenerator.generateWithPrefix(ID_PREFIX_TASK));
if (task.getExternalId() == null) { if (task.getExternalId() == null) {
@ -708,10 +728,12 @@ public class TaskServiceImpl implements TaskService {
attachmentMapper.insert(attachmentImpl); attachmentMapper.insert(attachmentImpl);
} }
} }
LOGGER.debug("exit from standardSettings()");
} }
private void processStandardSettingsForConfiguration(TaskImpl task, Classification classification, private void processStandardSettingsForConfiguration(TaskImpl task, Classification classification,
PrioDurationHolder prioDurationFromAttachments) { PrioDurationHolder prioDurationFromAttachments) {
LOGGER.debug("entry to processStandardSettingsForConfiguration()");
if (classification != null) { if (classification != null) {
PrioDurationHolder finalPrioDuration = getNewPrioDuration(prioDurationFromAttachments, PrioDurationHolder finalPrioDuration = getNewPrioDuration(prioDurationFromAttachments,
classification.getPriority(), classification.getServiceLevel()); classification.getPriority(), classification.getServiceLevel());
@ -732,11 +754,15 @@ public class TaskServiceImpl implements TaskService {
if (task.getDescription() == null && classification != null) { if (task.getDescription() == null && classification != null) {
task.setDescription(classification.getDescription()); task.setDescription(classification.getDescription());
} }
LOGGER.debug("exit from processStandardSettingsForConfiguration()");
} }
private BulkOperationResults<String, TaskanaException> transferTasks(List<String> taskIdsToBeTransferred, private BulkOperationResults<String, TaskanaException> transferTasks(List<String> taskIdsToBeTransferred,
Workbasket destinationWorkbasket) Workbasket destinationWorkbasket)
throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedException { throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to transferTasks(taskIdsToBeTransferred = {}, destinationWorkbasket = {})", LoggerUtils.listToString(taskIdsToBeTransferred), destinationWorkbasket);
}
workbasketService.checkAuthorization(destinationWorkbasket.getId(), WorkbasketPermission.APPEND); workbasketService.checkAuthorization(destinationWorkbasket.getId(), WorkbasketPermission.APPEND);
@ -759,11 +785,19 @@ public class TaskServiceImpl implements TaskService {
} }
checkIfTransferConditionsAreFulfilled(taskIds, taskSummaries, bulkLog); checkIfTransferConditionsAreFulfilled(taskIds, taskSummaries, bulkLog);
updateTasksToBeTransferred(taskIds, taskSummaries, destinationWorkbasket); updateTasksToBeTransferred(taskIds, taskSummaries, destinationWorkbasket);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("exit from transferTasks(), returning {}", bulkLog);
}
return bulkLog; return bulkLog;
} }
private void removeNonExistingTasksFromTaskIdList(List<String> taskIds, private void removeNonExistingTasksFromTaskIdList(List<String> taskIds,
BulkOperationResults<String, TaskanaException> bulkLog) { BulkOperationResults<String, TaskanaException> bulkLog) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to removeNonExistingTasksFromTaskIdList(targetWbId = {}, taskIds = {})", taskIds, bulkLog);
}
Iterator<String> taskIdIterator = taskIds.iterator(); Iterator<String> taskIdIterator = taskIds.iterator();
while (taskIdIterator.hasNext()) { while (taskIdIterator.hasNext()) {
String currentTaskId = taskIdIterator.next(); String currentTaskId = taskIdIterator.next();
@ -773,10 +807,16 @@ public class TaskServiceImpl implements TaskService {
taskIdIterator.remove(); taskIdIterator.remove();
} }
} }
LOGGER.debug("exit from removeNonExistingTasksFromTaskIdList()");
} }
private void checkIfTransferConditionsAreFulfilled(List<String> taskIds, List<MinimalTaskSummary> taskSummaries, private void checkIfTransferConditionsAreFulfilled(List<String> taskIds, List<MinimalTaskSummary> taskSummaries,
BulkOperationResults<String, TaskanaException> bulkLog) { BulkOperationResults<String, TaskanaException> bulkLog) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to checkIfTransferConditionsAreFulfilled(taskIds = {}, taskSummaries = {}, bulkLog = {})",
LoggerUtils.listToString(taskIds), LoggerUtils.listToString(taskSummaries), bulkLog);
}
Set<String> workbasketIds = new HashSet<>(); Set<String> workbasketIds = new HashSet<>();
taskSummaries.forEach(t -> workbasketIds.add(t.getWorkbasketId())); taskSummaries.forEach(t -> workbasketIds.add(t.getWorkbasketId()));
WorkbasketQueryImpl query = (WorkbasketQueryImpl) workbasketService.createWorkbasketQuery(); WorkbasketQueryImpl query = (WorkbasketQueryImpl) workbasketService.createWorkbasketQuery();
@ -791,10 +831,16 @@ public class TaskServiceImpl implements TaskService {
.list(); .list();
} }
checkIfTasksMatchTransferCriteria(taskIds, taskSummaries, sourceWorkbaskets, bulkLog); checkIfTasksMatchTransferCriteria(taskIds, taskSummaries, sourceWorkbaskets, bulkLog);
LOGGER.debug("exit from checkIfTransferConditionsAreFulfilled()");
} }
private void checkIfTasksMatchTransferCriteria(List<String> taskIds, List<MinimalTaskSummary> taskSummaries, private void checkIfTasksMatchTransferCriteria(List<String> taskIds, List<MinimalTaskSummary> taskSummaries,
List<WorkbasketSummary> sourceWorkbaskets, BulkOperationResults<String, TaskanaException> bulkLog) { List<WorkbasketSummary> sourceWorkbaskets, BulkOperationResults<String, TaskanaException> bulkLog) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to checkIfTasksMatchTransferCriteria(taskIds = {}, taskSummaries = {}, sourceWorkbaskets = {}, bulkLog = {})",
LoggerUtils.listToString(taskIds), LoggerUtils.listToString(taskSummaries), LoggerUtils.listToString(sourceWorkbaskets), bulkLog);
}
Iterator<String> taskIdIterator = taskIds.iterator(); Iterator<String> taskIdIterator = taskIds.iterator();
while (taskIdIterator.hasNext()) { while (taskIdIterator.hasNext()) {
String currentTaskId = taskIdIterator.next(); String currentTaskId = taskIdIterator.next();
@ -818,10 +864,16 @@ public class TaskServiceImpl implements TaskService {
taskIdIterator.remove(); taskIdIterator.remove();
} }
} }
LOGGER.debug("exit from checkIfTasksMatchTransferCriteria()");
} }
private void checkIfTasksMatchCompleteCriteria(List<String> taskIds, List<TaskSummary> taskSummaries, private void checkIfTasksMatchCompleteCriteria(List<String> taskIds, List<TaskSummary> taskSummaries,
BulkOperationResults<String, TaskanaException> bulkLog) { BulkOperationResults<String, TaskanaException> bulkLog) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to checkIfTasksMatchCompleteCriteria(taskIds = {}, taskSummaries = {}, bulkLog = {})",
LoggerUtils.listToString(taskIds), LoggerUtils.listToString(taskSummaries), bulkLog);
}
Instant now = Instant.now(); Instant now = Instant.now();
Iterator<String> taskIdIterator = taskIds.iterator(); Iterator<String> taskIdIterator = taskIds.iterator();
while (taskIdIterator.hasNext()) { while (taskIdIterator.hasNext()) {
@ -848,10 +900,15 @@ public class TaskServiceImpl implements TaskService {
taskSummary.setState(TaskState.COMPLETED); taskSummary.setState(TaskState.COMPLETED);
} }
} }
LOGGER.debug("exit from checkIfTasksMatchCompleteCriteria()");
} }
private void updateTasksToBeTransferred(List<String> taskIds, private void updateTasksToBeTransferred(List<String> taskIds,
List<MinimalTaskSummary> taskSummaries, Workbasket destinationWorkbasket) { List<MinimalTaskSummary> taskSummaries, Workbasket destinationWorkbasket) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to updateTasksToBeTransferred(taskIds = {}, taskSummaries = {})",
LoggerUtils.listToString(taskIds), LoggerUtils.listToString(taskSummaries), destinationWorkbasket);
}
taskSummaries = taskSummaries.stream() taskSummaries = taskSummaries.stream()
.filter(ts -> taskIds.contains(ts.getTaskId())) .filter(ts -> taskIds.contains(ts.getTaskId()))
@ -872,17 +929,22 @@ public class TaskServiceImpl implements TaskService {
createTasksTransferredEvents(taskSummaries, updateObject); createTasksTransferredEvents(taskSummaries, updateObject);
} }
} }
LOGGER.debug("exit from updateTasksToBeTransferred()");
} }
private void updateTasksToBeCompleted(List<String> taskIds, private void updateTasksToBeCompleted(List<String> taskIds,
List<TaskSummary> taskSummaries) { List<TaskSummary> taskSummaries) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to updateTasksToBeCompleted(taskIds = {}, taskSummaries = {})", LoggerUtils.listToString(taskIds), LoggerUtils.listToString(taskSummaries));
}
if (!taskIds.isEmpty() && !taskSummaries.isEmpty()) { if (!taskIds.isEmpty() && !taskSummaries.isEmpty()) {
taskMapper.updateCompleted(taskIds, (TaskSummaryImpl) taskSummaries.get(0)); taskMapper.updateCompleted(taskIds, (TaskSummaryImpl) taskSummaries.get(0));
if (HistoryEventProducer.isHistoryEnabled()) { if (HistoryEventProducer.isHistoryEnabled()) {
createTasksCompletedEvents(taskSummaries); createTasksCompletedEvents(taskSummaries);
} }
} }
LOGGER.debug("exit from updateTasksToBeCompleted()");
} }
private Task cancelClaim(String taskId, boolean forceUnclaim) private Task cancelClaim(String taskId, boolean forceUnclaim)
@ -922,7 +984,12 @@ public class TaskServiceImpl implements TaskService {
private void addClassificationSummariesToTaskSummaries(List<TaskSummaryImpl> tasks, private void addClassificationSummariesToTaskSummaries(List<TaskSummaryImpl> tasks,
List<ClassificationSummary> classifications) { List<ClassificationSummary> classifications) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to addClassificationSummariesToTaskSummaries(tasks = {}, classifications = {})", LoggerUtils.listToString(tasks), LoggerUtils.listToString(classifications));
}
if (tasks == null || tasks.isEmpty()) { if (tasks == null || tasks.isEmpty()) {
LOGGER.debug("exit from addClassificationSummariesToTaskSummaries()");
return; return;
} }
// assign query results to appropriate tasks. // assign query results to appropriate tasks.
@ -940,11 +1007,12 @@ public class TaskServiceImpl implements TaskService {
// set the classification on the task object // set the classification on the task object
task.setClassificationSummary(aClassification); task.setClassificationSummary(aClassification);
} }
LOGGER.debug("exit from addClassificationSummariesToTaskSummaries()");
} }
private List<ClassificationSummary> findClassificationsForTasksAndAttachments( private List<ClassificationSummary> findClassificationsForTasksAndAttachments(
List<TaskSummaryImpl> taskSummaries, List<AttachmentSummaryImpl> attachmentSummaries) { List<TaskSummaryImpl> taskSummaries, List<AttachmentSummaryImpl> attachmentSummaries) {
LOGGER.debug("entry to getClassificationsForTasksAndAttachments()"); LOGGER.debug("entry to findClassificationsForTasksAndAttachments()");
if (taskSummaries == null || taskSummaries.isEmpty()) { if (taskSummaries == null || taskSummaries.isEmpty()) {
return new ArrayList<>(); return new ArrayList<>();
} }
@ -959,21 +1027,21 @@ public class TaskServiceImpl implements TaskService {
classificationIdSet.add(att.getClassificationSummary().getId()); classificationIdSet.add(att.getClassificationSummary().getId());
} }
} }
LOGGER.debug("exit from findClassificationsForTasksAndAttachments()");
return queryClassificationsForTasksAndAttachments(classificationIdSet); return queryClassificationsForTasksAndAttachments(classificationIdSet);
} }
private List<ClassificationSummary> findClassificationForTaskImplAndAttachments(TaskImpl task, private List<ClassificationSummary> findClassificationForTaskImplAndAttachments(TaskImpl task,
List<AttachmentImpl> attachmentImpls) { List<AttachmentImpl> attachmentImpls) {
LOGGER.debug("entry to transferBulk()");
Set<String> classificationIdSet = new HashSet<>(Arrays.asList(task.getClassificationSummary().getId())); Set<String> classificationIdSet = new HashSet<>(Arrays.asList(task.getClassificationSummary().getId()));
if (attachmentImpls != null && !attachmentImpls.isEmpty()) { if (attachmentImpls != null && !attachmentImpls.isEmpty()) {
for (AttachmentImpl att : attachmentImpls) { for (AttachmentImpl att : attachmentImpls) {
classificationIdSet.add(att.getClassificationSummary().getId()); classificationIdSet.add(att.getClassificationSummary().getId());
} }
} }
LOGGER.debug("exit from findClassificationForTaskImplAndAttachments()");
return queryClassificationsForTasksAndAttachments(classificationIdSet); return queryClassificationsForTasksAndAttachments(classificationIdSet);
} }
private List<ClassificationSummary> queryClassificationsForTasksAndAttachments(Set<String> classificationIdSet) { private List<ClassificationSummary> queryClassificationsForTasksAndAttachments(Set<String> classificationIdSet) {
@ -1027,6 +1095,11 @@ public class TaskServiceImpl implements TaskService {
private void addAttachmentSummariesToTaskSummaries(List<TaskSummaryImpl> taskSummaries, private void addAttachmentSummariesToTaskSummaries(List<TaskSummaryImpl> taskSummaries,
List<AttachmentSummaryImpl> attachmentSummaries, List<ClassificationSummary> classifications) { List<AttachmentSummaryImpl> attachmentSummaries, List<ClassificationSummary> classifications) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to addAttachmentSummariesToTaskSummaries(taskSummaries = {}, attachmentSummaries = {}, classifications = {})",
LoggerUtils.listToString(taskSummaries), LoggerUtils.listToString(attachmentSummaries), LoggerUtils.listToString(classifications));
}
if (taskSummaries == null || taskSummaries.isEmpty()) { if (taskSummaries == null || taskSummaries.isEmpty()) {
return; return;
} }
@ -1045,13 +1118,16 @@ public class TaskServiceImpl implements TaskService {
} }
} }
LOGGER.debug("exit from addAttachmentSummariesToTaskSummaries()");
} }
private void addClassificationSummariesToAttachmentSummaries(List<AttachmentSummaryImpl> attachmentSummaries, private void addClassificationSummariesToAttachmentSummaries(List<AttachmentSummaryImpl> attachmentSummaries,
List<TaskSummaryImpl> taskSummaries, List<ClassificationSummary> classifications) { List<TaskSummaryImpl> taskSummaries, List<ClassificationSummary> classifications) {
LOGGER.debug("entry to addClassificationSummariesToAttachmentSummaries()");
// prereq: in each attachmentSummary, the classificationSummary.key property is set. // prereq: in each attachmentSummary, the classificationSummary.key property is set.
if (attachmentSummaries == null || attachmentSummaries.isEmpty() || taskSummaries == null if (attachmentSummaries == null || attachmentSummaries.isEmpty() || taskSummaries == null
|| taskSummaries.isEmpty()) { || taskSummaries.isEmpty()) {
LOGGER.debug("exit from addClassificationSummariesToAttachmentSummaries()");
return; return;
} }
// iterate over all attachment summaries an add the appropriate classification summary to each // iterate over all attachment summaries an add the appropriate classification summary to each
@ -1066,11 +1142,18 @@ public class TaskServiceImpl implements TaskService {
} }
att.setClassificationSummary(aClassification); att.setClassificationSummary(aClassification);
} }
LOGGER.debug("exit from addClassificationSummariesToAttachmentSummaries()");
} }
private List<Attachment> addClassificationSummariesToAttachments(List<AttachmentImpl> attachmentImpls, private List<Attachment> addClassificationSummariesToAttachments(List<AttachmentImpl> attachmentImpls,
List<ClassificationSummary> classifications) { List<ClassificationSummary> classifications) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to addClassificationSummariesToAttachments(targetWbId = {}, taskIds = {})",
LoggerUtils.listToString(attachmentImpls), LoggerUtils.listToString(classifications));
}
if (attachmentImpls == null || attachmentImpls.isEmpty()) { if (attachmentImpls == null || attachmentImpls.isEmpty()) {
LOGGER.debug("exit from addClassificationSummariesToAttachments()");
return new ArrayList<>(); return new ArrayList<>();
} }
@ -1088,11 +1171,19 @@ public class TaskServiceImpl implements TaskService {
att.setClassificationSummary(aClassification); att.setClassificationSummary(aClassification);
result.add(att); result.add(att);
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("exit from addClassificationSummariesToAttachments(), returning {}", result);
}
return result; return result;
} }
private TaskImpl initUpdatedTask(Map<String, String> customFieldsToUpdate, CustomPropertySelector fieldSelector) private TaskImpl initUpdatedTask(Map<String, String> customFieldsToUpdate, CustomPropertySelector fieldSelector)
throws InvalidArgumentException { throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to initUpdatedTask(customFieldsToUpdate = {}, fieldSelector = {})", LoggerUtils.mapToString(customFieldsToUpdate), fieldSelector);
}
TaskImpl newTask = new TaskImpl(); TaskImpl newTask = new TaskImpl();
newTask.setModified(Instant.now()); newTask.setModified(Instant.now());
@ -1101,10 +1192,18 @@ public class TaskServiceImpl implements TaskService {
fieldSelector.setCustomProperty(key, true); fieldSelector.setCustomProperty(key, true);
newTask.setCustomAttribute(key, entry.getValue()); newTask.setCustomAttribute(key, entry.getValue());
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("exit from initUpdatedTask(), returning {}", newTask);
}
return newTask; return newTask;
} }
private void validateCustomFields(Map<String, String> customFieldsToUpdate) throws InvalidArgumentException { private void validateCustomFields(Map<String, String> customFieldsToUpdate) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to validateCustomFields(customFieldsToUpdate = {}, taskIds = {})", LoggerUtils.mapToString(customFieldsToUpdate));
}
if (customFieldsToUpdate == null || customFieldsToUpdate.isEmpty()) { if (customFieldsToUpdate == null || customFieldsToUpdate.isEmpty()) {
throw new InvalidArgumentException("The customFieldsToUpdate argument to updateTasks must not be empty."); throw new InvalidArgumentException("The customFieldsToUpdate argument to updateTasks must not be empty.");
} }
@ -1116,6 +1215,7 @@ public class TaskServiceImpl implements TaskService {
"The customFieldsToUpdate argument to updateTasks contains invalid key " + key); "The customFieldsToUpdate argument to updateTasks contains invalid key " + key);
} }
} }
LOGGER.debug("exit from validateCustomFields()");
} }
private List<TaskSummary> getTasksToChange(List<String> taskIds) { private List<TaskSummary> getTasksToChange(List<String> taskIds) {
@ -1136,6 +1236,7 @@ public class TaskServiceImpl implements TaskService {
private void validateObjectReference(ObjectReference objRef, String objRefType, String objName) private void validateObjectReference(ObjectReference objRef, String objRefType, String objName)
throws InvalidArgumentException { throws InvalidArgumentException {
LOGGER.debug("entry to validateObjectReference()");
// check that all values in the ObjectReference are set correctly // check that all values in the ObjectReference are set correctly
if (objRef == null) { if (objRef == null) {
throw new InvalidArgumentException(objRefType + " of " + objName + " must not be null"); throw new InvalidArgumentException(objRefType + " of " + objName + " must not be null");
@ -1153,9 +1254,14 @@ public class TaskServiceImpl implements TaskService {
} else if (objRef.getValue() == null || objRef.getValue().length() == 0) { } else if (objRef.getValue() == null || objRef.getValue().length() == 0) {
throw new InvalidArgumentException("Value of" + objRefType + " of " + objName + MUST_NOT_BE_EMPTY); throw new InvalidArgumentException("Value of" + objRefType + " of " + objName + MUST_NOT_BE_EMPTY);
} }
LOGGER.debug("exit from validateObjectReference()");
} }
private PrioDurationHolder handleAttachments(TaskImpl task) throws InvalidArgumentException { private PrioDurationHolder handleAttachments(TaskImpl task) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to handleAttachments(task = {})", task);
}
List<Attachment> attachments = task.getAttachments(); List<Attachment> attachments = task.getAttachments();
if (attachments == null || attachments.isEmpty()) { if (attachments == null || attachments.isEmpty()) {
return new PrioDurationHolder(null, Integer.MIN_VALUE); return new PrioDurationHolder(null, Integer.MIN_VALUE);
@ -1176,6 +1282,7 @@ public class TaskServiceImpl implements TaskService {
actualPrioDuration.setDuration(null); actualPrioDuration.setDuration(null);
} }
LOGGER.debug("exit from handleAttachments(), returning {}", actualPrioDuration);
return actualPrioDuration; return actualPrioDuration;
} }
@ -1233,6 +1340,7 @@ public class TaskServiceImpl implements TaskService {
private void updateClassificationRelatedProperties(TaskImpl oldTaskImpl, TaskImpl newTaskImpl, private void updateClassificationRelatedProperties(TaskImpl oldTaskImpl, TaskImpl newTaskImpl,
PrioDurationHolder prioDurationFromAttachments) PrioDurationHolder prioDurationFromAttachments)
throws ClassificationNotFoundException { throws ClassificationNotFoundException {
LOGGER.debug("entry to updateClassificationRelatedProperties()");
// insert Classification specifications if Classification is given. // insert Classification specifications if Classification is given.
ClassificationSummary oldClassificationSummary = oldTaskImpl.getClassificationSummary(); ClassificationSummary oldClassificationSummary = oldTaskImpl.getClassificationSummary();
ClassificationSummary newClassificationSummary = newTaskImpl.getClassificationSummary(); ClassificationSummary newClassificationSummary = newTaskImpl.getClassificationSummary();
@ -1248,11 +1356,13 @@ public class TaskServiceImpl implements TaskService {
} }
LOGGER.debug("exit from updateClassificationRelatedProperties()");
} }
private void updateTaskPrioDurationFromClassification(TaskImpl newTaskImpl, private void updateTaskPrioDurationFromClassification(TaskImpl newTaskImpl,
PrioDurationHolder prioDurationFromAttachments, ClassificationSummary oldClassificationSummary, PrioDurationHolder prioDurationFromAttachments, ClassificationSummary oldClassificationSummary,
ClassificationSummary newClassificationSummary) throws ClassificationNotFoundException { ClassificationSummary newClassificationSummary) throws ClassificationNotFoundException {
LOGGER.debug("entry to updateTaskPrioDurationFromClassification()");
Classification newClassification = null; Classification newClassification = null;
if (!oldClassificationSummary.getKey().equals(newClassificationSummary.getKey())) { if (!oldClassificationSummary.getKey().equals(newClassificationSummary.getKey())) {
newClassification = this.classificationService newClassification = this.classificationService
@ -1289,10 +1399,14 @@ public class TaskServiceImpl implements TaskService {
int newPriority = Math.max(newClassificationSummary.getPriority(), prioDurationFromAttachments.getPrio()); int newPriority = Math.max(newClassificationSummary.getPriority(), prioDurationFromAttachments.getPrio());
newTaskImpl.setPriority(newPriority); newTaskImpl.setPriority(newPriority);
LOGGER.debug("exit from updateTaskPrioDurationFromClassification()");
} }
private PrioDurationHolder handleAttachmentsOnTaskUpdate(TaskImpl oldTaskImpl, TaskImpl newTaskImpl) private PrioDurationHolder handleAttachmentsOnTaskUpdate(TaskImpl oldTaskImpl, TaskImpl newTaskImpl)
throws AttachmentPersistenceException { throws AttachmentPersistenceException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to handleAttachmentsOnTaskUpdate(oldTaskImpl = {}, newTaskImpl = {})", oldTaskImpl, newTaskImpl);
}
PrioDurationHolder prioDuration = new PrioDurationHolder(MAX_DURATION, Integer.MIN_VALUE); PrioDurationHolder prioDuration = new PrioDurationHolder(MAX_DURATION, Integer.MIN_VALUE);
@ -1312,10 +1426,16 @@ public class TaskServiceImpl implements TaskService {
if (MAX_DURATION.equals(prioDuration.getDuration())) { if (MAX_DURATION.equals(prioDuration.getDuration())) {
prioDuration.setDuration(null); prioDuration.setDuration(null);
} }
LOGGER.debug("exit from handleAttachmentsOnTaskUpdate()");
return prioDuration; return prioDuration;
} }
private void deleteAttachmentOnTaskUpdate(TaskImpl oldTaskImpl, TaskImpl newTaskImpl) { private void deleteAttachmentOnTaskUpdate(TaskImpl oldTaskImpl, TaskImpl newTaskImpl) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to deleteAttachmentOnTaskUpdate(oldTaskImpl = {}, newTaskImpl = {})", oldTaskImpl, newTaskImpl);
}
for (Attachment oldAttachment : oldTaskImpl.getAttachments()) { for (Attachment oldAttachment : oldTaskImpl.getAttachments()) {
if (oldAttachment != null) { if (oldAttachment != null) {
boolean isRepresented = false; boolean isRepresented = false;
@ -1333,10 +1453,12 @@ public class TaskServiceImpl implements TaskService {
} }
} }
} }
LOGGER.debug("exit from deleteAttachmentOnTaskUpdate()");
} }
private PrioDurationHolder handlePrioDurationOfOneAttachmentOnTaskUpdate(TaskImpl oldTaskImpl, TaskImpl newTaskImpl, private PrioDurationHolder handlePrioDurationOfOneAttachmentOnTaskUpdate(TaskImpl oldTaskImpl, TaskImpl newTaskImpl,
PrioDurationHolder prioDuration, Attachment attachment) throws AttachmentPersistenceException { PrioDurationHolder prioDuration, Attachment attachment) throws AttachmentPersistenceException {
LOGGER.debug("entry to handlePrioDurationOfOneAttachmentOnTaskUpdate()");
boolean wasAlreadyPresent = false; boolean wasAlreadyPresent = false;
if (attachment.getId() != null) { if (attachment.getId() != null) {
for (Attachment oldAttachment : oldTaskImpl.getAttachments()) { for (Attachment oldAttachment : oldTaskImpl.getAttachments()) {
@ -1357,11 +1479,14 @@ public class TaskServiceImpl implements TaskService {
prioDuration = handleNewAttachmentOnTaskUpdate(newTaskImpl, prioDuration, attachment); prioDuration = handleNewAttachmentOnTaskUpdate(newTaskImpl, prioDuration, attachment);
} }
LOGGER.debug("exit from handlePrioDurationOfOneAttachmentOnTaskUpdate(), returning {}", prioDuration);
return prioDuration; return prioDuration;
} }
private PrioDurationHolder handlePrioDurationOfOneNewAttachmentOnTaskUpdate(TaskImpl newTaskImpl, private PrioDurationHolder handlePrioDurationOfOneNewAttachmentOnTaskUpdate(TaskImpl newTaskImpl,
PrioDurationHolder prioDuration, Attachment attachment) { PrioDurationHolder prioDuration, Attachment attachment) {
LOGGER.debug("entry to handlePrioDurationOfOneNewAttachmentOnTaskUpdate()");
AttachmentImpl temp = (AttachmentImpl) attachment; AttachmentImpl temp = (AttachmentImpl) attachment;
ClassificationSummary classification = attachment.getClassificationSummary(); ClassificationSummary classification = attachment.getClassificationSummary();
@ -1375,11 +1500,13 @@ public class TaskServiceImpl implements TaskService {
LOGGER.debug("TaskService.updateTask() for TaskId={} UPDATED an Attachment={}.", LOGGER.debug("TaskService.updateTask() for TaskId={} UPDATED an Attachment={}.",
newTaskImpl.getId(), newTaskImpl.getId(),
attachment); attachment);
LOGGER.debug("exit from handlePrioDurationOfOneNewAttachmentOnTaskUpdate(), returning {}", prioDuration);
return prioDuration; return prioDuration;
} }
private PrioDurationHolder handleNewAttachmentOnTaskUpdate(TaskImpl newTaskImpl, PrioDurationHolder prioDuration, private PrioDurationHolder handleNewAttachmentOnTaskUpdate(TaskImpl newTaskImpl, PrioDurationHolder prioDuration,
Attachment attachment) throws AttachmentPersistenceException { Attachment attachment) throws AttachmentPersistenceException {
LOGGER.debug("entry to handleNewAttachmentOnTaskUpdate()");
AttachmentImpl attachmentImpl = (AttachmentImpl) attachment; AttachmentImpl attachmentImpl = (AttachmentImpl) attachment;
initAttachment(attachmentImpl, newTaskImpl); initAttachment(attachmentImpl, newTaskImpl);
ClassificationSummary classification = attachment.getClassificationSummary(); ClassificationSummary classification = attachment.getClassificationSummary();
@ -1399,10 +1526,14 @@ public class TaskServiceImpl implements TaskService {
+ newTaskImpl.getId() + " because it already exists.", + newTaskImpl.getId() + " because it already exists.",
e.getCause()); e.getCause());
} }
LOGGER.debug("exit from handleNewAttachmentOnTaskUpdate(), returning {}", prioDuration);
return prioDuration; return prioDuration;
} }
private PrioDurationHolder handleAttachmentsOnClassificationUpdate(Task task) { private PrioDurationHolder handleAttachmentsOnClassificationUpdate(Task task) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to handleAttachmentsOnClassificationUpdate(task = {})", task);
}
PrioDurationHolder prioDuration = new PrioDurationHolder(MAX_DURATION, Integer.MIN_VALUE); PrioDurationHolder prioDuration = new PrioDurationHolder(MAX_DURATION, Integer.MIN_VALUE);
@ -1422,11 +1553,15 @@ public class TaskServiceImpl implements TaskService {
if (MAX_DURATION.equals(prioDuration.getDuration())) { if (MAX_DURATION.equals(prioDuration.getDuration())) {
prioDuration.setDuration(null); prioDuration.setDuration(null);
} }
LOGGER.debug("exit from handleAttachmentsOnClassificationUpdate(), returning {}", prioDuration);
return prioDuration; return prioDuration;
} }
private PrioDurationHolder getNewPrioDuration(PrioDurationHolder prioDurationHolder, int prioFromClassification, private PrioDurationHolder getNewPrioDuration(PrioDurationHolder prioDurationHolder, int prioFromClassification,
String serviceLevelFromClassification) { String serviceLevelFromClassification) {
LOGGER.debug("entry to getNewPrioDuration(prioDurationHolder = {}, prioFromClassification = {}, serviceLevelFromClassification = {})",
prioDurationHolder, prioFromClassification, serviceLevelFromClassification);
Duration minDuration = prioDurationHolder.getDuration(); Duration minDuration = prioDurationHolder.getDuration();
int maxPrio = prioDurationHolder.getPrio(); int maxPrio = prioDurationHolder.getPrio();
@ -1444,10 +1579,12 @@ public class TaskServiceImpl implements TaskService {
maxPrio = prioFromClassification; maxPrio = prioFromClassification;
} }
LOGGER.debug("exit from getNewPrioDuration(), returning {}", new PrioDurationHolder(minDuration, maxPrio));
return new PrioDurationHolder(minDuration, maxPrio); return new PrioDurationHolder(minDuration, maxPrio);
} }
private void initAttachment(AttachmentImpl attachment, Task newTask) { private void initAttachment(AttachmentImpl attachment, Task newTask) {
LOGGER.debug("entry to initAttachment()");
if (attachment.getId() == null) { if (attachment.getId() == null) {
attachment.setId(IdGenerator.generateWithPrefix(ID_PREFIX_ATTACHMENT)); attachment.setId(IdGenerator.generateWithPrefix(ID_PREFIX_ATTACHMENT));
} }
@ -1460,9 +1597,11 @@ public class TaskServiceImpl implements TaskService {
if (attachment.getTaskId() == null) { if (attachment.getTaskId() == null) {
attachment.setTaskId(newTask.getId()); attachment.setTaskId(newTask.getId());
} }
LOGGER.debug("exit from initAttachment()");
} }
public Set<String> findTasksIdsAffectedByClassificationChange(String classificationId) { public Set<String> findTasksIdsAffectedByClassificationChange(String classificationId) {
LOGGER.debug("entry to findTasksIdsAffectedByClassificationChange(classificationId = {})", classificationId);
// tasks directly affected // tasks directly affected
List<TaskSummary> tasks = createTaskQuery() List<TaskSummary> tasks = createTaskQuery()
.classificationIdIn(classificationId) .classificationIdIn(classificationId)
@ -1484,6 +1623,7 @@ public class TaskServiceImpl implements TaskService {
LOGGER.debug("the following tasks are affected by the update of classification {} : {}", classificationId, LOGGER.debug("the following tasks are affected by the update of classification {} : {}", classificationId,
LoggerUtils.setToString(affectedTaskIds)); LoggerUtils.setToString(affectedTaskIds));
} }
LOGGER.debug("exit from findTasksIdsAffectedByClassificationChange(). ");
return affectedTaskIds; return affectedTaskIds;
} }
@ -1525,6 +1665,7 @@ public class TaskServiceImpl implements TaskService {
private void updatePrioDueDateOnClassificationUpdate(TaskImpl task, private void updatePrioDueDateOnClassificationUpdate(TaskImpl task,
PrioDurationHolder prioDurationFromAttachments) { PrioDurationHolder prioDurationFromAttachments) {
LOGGER.debug("entry to updatePrioDueDateOnClassificationUpdate()");
ClassificationSummary classificationSummary = task.getClassificationSummary(); ClassificationSummary classificationSummary = task.getClassificationSummary();
if (classificationSummary == null) { // classification is null -> take prio and duration from attachments if (classificationSummary == null) { // classification is null -> take prio and duration from attachments
@ -1534,10 +1675,12 @@ public class TaskServiceImpl implements TaskService {
classificationSummary); classificationSummary);
} }
LOGGER.debug("exit from updatePrioDueDateOnClassificationUpdate()");
} }
private void updateTaskPrioDurationFromClassificationAndAttachments(TaskImpl task, private void updateTaskPrioDurationFromClassificationAndAttachments(TaskImpl task,
PrioDurationHolder prioDurationFromAttachments, ClassificationSummary classificationSummary) { PrioDurationHolder prioDurationFromAttachments, ClassificationSummary classificationSummary) {
LOGGER.debug("entry to updateTaskPrioDurationFromClassificationAndAttachments()");
if (classificationSummary.getServiceLevel() != null) { if (classificationSummary.getServiceLevel() != null) {
Duration durationFromClassification = Duration.parse(classificationSummary.getServiceLevel()); Duration durationFromClassification = Duration.parse(classificationSummary.getServiceLevel());
Duration minDuration = prioDurationFromAttachments.getDuration(); Duration minDuration = prioDurationFromAttachments.getDuration();
@ -1557,6 +1700,7 @@ public class TaskServiceImpl implements TaskService {
int newPriority = Math.max(classificationSummary.getPriority(), prioDurationFromAttachments.getPrio()); int newPriority = Math.max(classificationSummary.getPriority(), prioDurationFromAttachments.getPrio());
task.setPriority(newPriority); task.setPriority(newPriority);
LOGGER.debug("exit from updateTaskPrioDurationFromClassificationAndAttachments()");
} }
private Task completeTask(String taskId, boolean isForced) private Task completeTask(String taskId, boolean isForced)
@ -1638,6 +1782,7 @@ public class TaskServiceImpl implements TaskService {
} }
private void updateTaskPrioDurationFromAttachments(TaskImpl task, PrioDurationHolder prioDurationFromAttachments) { private void updateTaskPrioDurationFromAttachments(TaskImpl task, PrioDurationHolder prioDurationFromAttachments) {
LOGGER.debug("entry to updateTaskPrioDurationFromAttachments()");
if (prioDurationFromAttachments.getDuration() != null) { if (prioDurationFromAttachments.getDuration() != null) {
long days = converter.convertWorkingDaysToDays(task.getPlanned(), long days = converter.convertWorkingDaysToDays(task.getPlanned(),
prioDurationFromAttachments.getDuration().toDays()); prioDurationFromAttachments.getDuration().toDays());
@ -1647,10 +1792,12 @@ public class TaskServiceImpl implements TaskService {
if (prioDurationFromAttachments.getPrio() > Integer.MIN_VALUE) { if (prioDurationFromAttachments.getPrio() > Integer.MIN_VALUE) {
task.setPriority(prioDurationFromAttachments.getPrio()); task.setPriority(prioDurationFromAttachments.getPrio());
} }
LOGGER.debug("exit from updateTaskPrioDurationFromAttachments()");
} }
private List<Attachment> augmentAttachmentsByClassification(List<AttachmentImpl> attachmentImpls, private List<Attachment> augmentAttachmentsByClassification(List<AttachmentImpl> attachmentImpls,
BulkOperationResults<String, Exception> bulkLog) { BulkOperationResults<String, Exception> bulkLog) {
LOGGER.debug("entry to augmentAttachmentsByClassification()");
List<Attachment> result = new ArrayList<>(); List<Attachment> result = new ArrayList<>();
if (attachmentImpls == null || attachmentImpls.isEmpty()) { if (attachmentImpls == null || attachmentImpls.isEmpty()) {
return result; return result;
@ -1678,6 +1825,7 @@ public class TaskServiceImpl implements TaskService {
} }
} }
LOGGER.debug("exit from augmentAttachmentsByClassification()");
return result; return result;
} }
@ -1728,7 +1876,10 @@ public class TaskServiceImpl implements TaskService {
} }
List<TaskSummary> augmentTaskSummariesByContainedSummaries(List<TaskSummaryImpl> taskSummaries) { List<TaskSummary> augmentTaskSummariesByContainedSummaries(List<TaskSummaryImpl> taskSummaries) {
LOGGER.debug("entry to augmentTaskSummariesByContainedSummaries()"); if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to augmentTaskSummariesByContainedSummaries(taskSummaries= {})", LoggerUtils.listToString(taskSummaries));
}
List<TaskSummary> result = new ArrayList<>(); List<TaskSummary> result = new ArrayList<>();
if (taskSummaries == null || taskSummaries.isEmpty()) { if (taskSummaries == null || taskSummaries.isEmpty()) {
return result; return result;
@ -1786,13 +1937,10 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "PrioDurationHolder [" +
builder.append("PrioDurationHolder [duration="); "duration=" + this.duration +
builder.append(duration); ", prio=" + this.prio +
builder.append(", prio="); "]";
builder.append(prio);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -590,85 +590,46 @@ public class TaskSummaryImpl implements TaskSummary {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "TaskSummaryImpl [" +
builder.append("TaskSummaryImpl [taskId="); "taskId=" + this.taskId +
builder.append(taskId); ", externalId=" + this.externalId +
builder.append(", externalId="); ", created=" + this.created +
builder.append(externalId); ", claimed=" + this.claimed +
builder.append(", created="); ", completed=" + this.completed +
builder.append(created); ", modified=" + this.modified +
builder.append(", claimed="); ", planned=" + this.planned +
builder.append(claimed); ", due=" + this.due +
builder.append(", completed="); ", name=" + this.name +
builder.append(completed); ", creator=" + this.creator +
builder.append(", modified="); ", note=" + this.note +
builder.append(modified); ", priority=" + this.priority +
builder.append(", planned="); ", state=" + this.state +
builder.append(planned); ", classificationSummary=" + this.classificationSummary +
builder.append(", due="); ", workbasketSummary=" + this.workbasketSummary +
builder.append(due); ", businessProcessId=" + this.businessProcessId +
builder.append(", name="); ", parentBusinessProcessId=" + this.parentBusinessProcessId +
builder.append(name); ", owner=" + this.owner +
builder.append(", creator="); ", primaryObjRef=" + this.primaryObjRef +
builder.append(creator); ", isRead=" + this.isRead +
builder.append(", note="); ", isTransferred=" + this.isTransferred +
builder.append(note); ", attachmentSummaries=" + this.attachmentSummaries +
builder.append(", priority="); ", custom1=" + this.custom1 +
builder.append(priority); ", custom2=" + this.custom2 +
builder.append(", state="); ", custom3=" + this.custom3 +
builder.append(state); ", custom4=" + this.custom4 +
builder.append(", classificationSummary="); ", custom5=" + this.custom5 +
builder.append(classificationSummary); ", custom6=" + this.custom6 +
builder.append(", workbasketSummary="); ", custom7=" + this.custom7 +
builder.append(workbasketSummary); ", custom8=" + this.custom8 +
builder.append(", businessProcessId="); ", custom9=" + this.custom9 +
builder.append(businessProcessId); ", custom10=" + this.custom10 +
builder.append(", parentBusinessProcessId="); ", custom11=" + this.custom11 +
builder.append(parentBusinessProcessId); ", custom12=" + this.custom12 +
builder.append(", owner="); ", custom13=" + this.custom13 +
builder.append(owner); ", custom14=" + this.custom14 +
builder.append(", primaryObjRef="); ", custom15=" + this.custom15 +
builder.append(primaryObjRef); ", custom16=" + this.custom16 +
builder.append(", isRead="); "]";
builder.append(isRead);
builder.append(", isTransferred=");
builder.append(isTransferred);
builder.append(", attachmentSummaries=");
builder.append(attachmentSummaries);
builder.append(", custom1=");
builder.append(custom1);
builder.append(", custom2=");
builder.append(custom2);
builder.append(", custom3=");
builder.append(custom3);
builder.append(", custom4=");
builder.append(custom4);
builder.append(", custom5=");
builder.append(custom5);
builder.append(", custom6=");
builder.append(custom6);
builder.append(", custom7=");
builder.append(custom7);
builder.append(", custom8=");
builder.append(custom8);
builder.append(", custom9=");
builder.append(custom9);
builder.append(", custom10=");
builder.append(custom10);
builder.append(", custom11=");
builder.append(custom11);
builder.append(", custom12=");
builder.append(custom12);
builder.append(", custom13=");
builder.append(custom13);
builder.append(", custom14=");
builder.append(custom14);
builder.append(", custom15=");
builder.append(custom15);
builder.append(", custom16=");
builder.append(custom16);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -124,8 +124,11 @@ abstract class TimeIntervalReportBuilderImpl<B extends TimeIntervalReportBuilder
@Override @Override
public List<String> listTaskIdsForSelectedItems(List<SelectedItem> selectedItems) public List<String> listTaskIdsForSelectedItems(List<SelectedItem> selectedItems)
throws NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
LOGGER.debug("entry to listTaskIdsForSelectedItems(selectedItems = {}), this = {}", if(LOGGER.isDebugEnabled()) {
LoggerUtils.listToString(selectedItems), this); LOGGER.debug("entry to listTaskIdsForSelectedItems(selectedItems = {}), this = {}",
LoggerUtils.listToString(selectedItems), this);
}
this.taskanaEngine.checkRoleMembership(TaskanaRole.MONITOR); this.taskanaEngine.checkRoleMembership(TaskanaRole.MONITOR);
try { try {
this.taskanaEngine.openConnection(); this.taskanaEngine.openConnection();

View File

@ -413,51 +413,28 @@ public class WorkbasketAccessItemImpl implements WorkbasketAccessItem {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "WorkbasketAccessItem [id=" + this.id
builder.append("WorkbasketAccessItem [id="); + ", workbasketId=" + this.workbasketId
builder.append(id); + ", workbasketKey=" + this.workbasketKey
builder.append(", workbasketId="); + ", accessId=" + this.accessId
builder.append(workbasketId); + ", permRead=" + this.permRead
builder.append(", workbasketKey="); + ", permOpen=" + this.permOpen
builder.append(workbasketKey); + ", permAppend=" + this.permAppend
builder.append(", accessId="); + ", permTransfer=" + this.permTransfer
builder.append(accessId); + ", permDistribute=" + this.permDistribute
builder.append(", permRead="); + ", permCustom1=" + this.permCustom1
builder.append(permRead); + ", permCustom2=" + this.permCustom2
builder.append(", permOpen="); + ", permCustom3=" + this.permCustom3
builder.append(permOpen); + ", permCustom4=" + this.permCustom4
builder.append(", permAppend="); + ", permCustom5=" + this.permCustom5
builder.append(permAppend); + ", permCustom6=" + this.permCustom6
builder.append(", permTransfer="); + ", permCustom7=" + this.permCustom7
builder.append(permTransfer); + ", permCustom8=" + this.permCustom8
builder.append(", permDistribute="); + ", permCustom9=" + this.permCustom9
builder.append(permDistribute); + ", permCustom10=" + this.permCustom10
builder.append(", permCustom1="); + ", permCustom11=" + this.permCustom11
builder.append(permCustom1); + ", permCustom12=" + this.permCustom12 +
builder.append(", permCustom2="); "]";
builder.append(permCustom2);
builder.append(", permCustom3=");
builder.append(permCustom3);
builder.append(", permCustom4=");
builder.append(permCustom4);
builder.append(", permCustom5=");
builder.append(permCustom5);
builder.append(", permCustom6=");
builder.append(permCustom6);
builder.append(", permCustom7=");
builder.append(permCustom7);
builder.append(", permCustom8=");
builder.append(permCustom8);
builder.append(", permCustom9=");
builder.append(permCustom9);
builder.append(", permCustom10=");
builder.append(permCustom10);
builder.append(", permCustom11=");
builder.append(permCustom11);
builder.append(", permCustom12=");
builder.append(permCustom12);
builder.append("]");
return builder.toString();
} }
@Override @Override

View File

@ -113,8 +113,7 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -163,8 +162,7 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -243,17 +241,12 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "WorkbasketAccessItemQueryImpl [" +
builder.append("WorkbasketAccessItemQueryImpl [idIn="); "idIn=" + Arrays.toString(this.idIn) +
builder.append(Arrays.toString(idIn)); ", accessIdIn=" + Arrays.toString(this.accessIdIn) +
builder.append(", accessIdIn="); ", workbasketIdIn=" + Arrays.toString(this.workbasketIdIn) +
builder.append(Arrays.toString(accessIdIn)); ", orderBy=" + this.orderBy +
builder.append(", workbasketIdIn="); "]";
builder.append(Arrays.toString(workbasketIdIn));
builder.append(", orderBy=");
builder.append(orderBy);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -381,42 +381,24 @@ public class WorkbasketImpl implements Workbasket {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "Workbasket [" +
builder.append("Workbasket [id="); "id=" + this.id +
builder.append(id); ", key=" + this.key +
builder.append(", key="); ", created=" + this.created +
builder.append(key); ", modified=" + this.modified +
builder.append(", created="); ", name=" + this.name +
builder.append(created); ", description=" + this.description +
builder.append(", modified="); ", owner=" + this.owner +
builder.append(modified); ", domain=" + this.domain +
builder.append(", name="); ", type=" + this.type +
builder.append(name); ", custom1=" + this.custom1 +
builder.append(", description="); ", custom2=" + this.custom2 +
builder.append(description); ", custom3=" + this.custom3 +
builder.append(", owner="); ", custom4=" + this.custom4 +
builder.append(owner); ", orgLevel1=" + this.orgLevel1 +
builder.append(", domain="); ", orgLevel2=" + this.orgLevel2 +
builder.append(domain); ", orgLevel3=" + this.orgLevel3 +
builder.append(", type="); ", orgLevel4=" + this.orgLevel4 +
builder.append(type); "]";
builder.append(", custom1=");
builder.append(custom1);
builder.append(", custom2=");
builder.append(custom2);
builder.append(", custom3=");
builder.append(custom3);
builder.append(", custom4=");
builder.append(custom4);
builder.append(", orgLevel1=");
builder.append(orgLevel1);
builder.append(", orgLevel2=");
builder.append(orgLevel2);
builder.append(", orgLevel3=");
builder.append(orgLevel3);
builder.append(", orgLevel4=");
builder.append(orgLevel4);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -409,8 +409,7 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size(); LOGGER.debug("Exit from listValues. Returning {} resulting Objects: {} ", result.size(),
LOGGER.debug("Exit from listValues. Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(result)); LoggerUtils.listToString(result));
} }
} }
@ -437,8 +436,7 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = workbaskets == null ? 0 : workbaskets.size(); LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", workbaskets.size(),
LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects,
LoggerUtils.listToString(workbaskets)); LoggerUtils.listToString(workbaskets));
} }
} }
@ -632,85 +630,46 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "WorkbasketQueryImpl [" +
builder.append("WorkbasketQueryImpl [columnName="); "columnName=" + this.columnName +
builder.append(columnName); ", accessId=" + Arrays.toString(this.accessId) +
builder.append(", accessId="); ", idIn=" + Arrays.toString(this.idIn) +
builder.append(Arrays.toString(accessId)); ", permission=" + this.permission +
builder.append(", idIn="); ", nameIn=" + Arrays.toString(this.nameIn) +
builder.append(Arrays.toString(idIn)); ", nameLike=" + Arrays.toString(this.nameLike) +
builder.append(", permission="); ", keyIn=" + Arrays.toString(this.keyIn) +
builder.append(permission); ", keyLike=" + Arrays.toString(this.keyLike) +
builder.append(", nameIn="); ", keyOrNameLike=" + Arrays.toString(this.keyOrNameLike) +
builder.append(Arrays.toString(nameIn)); ", domainIn=" + Arrays.toString(this.domainIn) +
builder.append(", nameLike="); ", domainLike=" + Arrays.toString(this.domainLike) +
builder.append(Arrays.toString(nameLike)); ", type=" + Arrays.toString(this.type) +
builder.append(", keyIn="); ", createdIn=" + Arrays.toString(this.createdIn) +
builder.append(Arrays.toString(keyIn)); ", modifiedIn=" + Arrays.toString(this.modifiedIn) +
builder.append(", keyLike="); ", descriptionLike=" + Arrays.toString(this.descriptionLike) +
builder.append(Arrays.toString(keyLike)); ", ownerIn=" + Arrays.toString(this.ownerIn) +
builder.append(", keyOrNameLike="); ", ownerLike=" + Arrays.toString(this.ownerLike) +
builder.append(Arrays.toString(keyOrNameLike)); ", custom1In=" + Arrays.toString(this.custom1In) +
builder.append(", domainIn="); ", custom1Like=" + Arrays.toString(this.custom1Like) +
builder.append(Arrays.toString(domainIn)); ", custom2In=" + Arrays.toString(this.custom2In) +
builder.append(", domainLike="); ", custom2Like=" + Arrays.toString(this.custom2Like) +
builder.append(Arrays.toString(domainLike)); ", custom3In=" + Arrays.toString(this.custom3In) +
builder.append(", type="); ", custom3Like=" + Arrays.toString(this.custom3Like) +
builder.append(Arrays.toString(type)); ", custom4In=" + Arrays.toString(this.custom4In) +
builder.append(", createdIn="); ", custom4Like=" + Arrays.toString(this.custom4Like) +
builder.append(Arrays.toString(createdIn)); ", orgLevel1In=" + Arrays.toString(this.orgLevel1In) +
builder.append(", modifiedIn="); ", orgLevel1Like=" + Arrays.toString(this.orgLevel1Like) +
builder.append(Arrays.toString(modifiedIn)); ", orgLevel2In=" + Arrays.toString(this.orgLevel2In) +
builder.append(", descriptionLike="); ", orgLevel2Like=" + Arrays.toString(this.orgLevel2Like) +
builder.append(Arrays.toString(descriptionLike)); ", orgLevel3In=" + Arrays.toString(this.orgLevel3In) +
builder.append(", ownerIn="); ", orgLevel3Like=" + Arrays.toString(this.orgLevel3Like) +
builder.append(Arrays.toString(ownerIn)); ", orgLevel4In=" + Arrays.toString(this.orgLevel4In) +
builder.append(", ownerLike="); ", orgLevel4Like=" + Arrays.toString(this.orgLevel4Like) +
builder.append(Arrays.toString(ownerLike)); ", markedForDeletion=" + this.markedForDeletion +
builder.append(", custom1In="); ", orderBy=" + this.orderBy +
builder.append(Arrays.toString(custom1In)); ", joinWithAccessList=" + this.joinWithAccessList +
builder.append(", custom1Like="); ", checkReadPermission=" + this.checkReadPermission +
builder.append(Arrays.toString(custom1Like)); ", usedToAugmentTasks=" + this.usedToAugmentTasks +
builder.append(", custom2In="); "]";
builder.append(Arrays.toString(custom2In));
builder.append(", custom2Like=");
builder.append(Arrays.toString(custom2Like));
builder.append(", custom3In=");
builder.append(Arrays.toString(custom3In));
builder.append(", custom3Like=");
builder.append(Arrays.toString(custom3Like));
builder.append(", custom4In=");
builder.append(Arrays.toString(custom4In));
builder.append(", custom4Like=");
builder.append(Arrays.toString(custom4Like));
builder.append(", orgLevel1In=");
builder.append(Arrays.toString(orgLevel1In));
builder.append(", orgLevel1Like=");
builder.append(Arrays.toString(orgLevel1Like));
builder.append(", orgLevel2In=");
builder.append(Arrays.toString(orgLevel2In));
builder.append(", orgLevel2Like=");
builder.append(Arrays.toString(orgLevel2Like));
builder.append(", orgLevel3In=");
builder.append(Arrays.toString(orgLevel3In));
builder.append(", orgLevel3Like=");
builder.append(Arrays.toString(orgLevel3Like));
builder.append(", orgLevel4In=");
builder.append(Arrays.toString(orgLevel4In));
builder.append(", orgLevel4Like=");
builder.append(Arrays.toString(orgLevel4Like));
builder.append(", markedForDeletion=");
builder.append(markedForDeletion);
builder.append(", orderBy=");
builder.append(orderBy);
builder.append(", joinWithAccessList=");
builder.append(joinWithAccessList);
builder.append(", checkReadPermission=");
builder.append(checkReadPermission);
builder.append(", usedToAugmentTasks=");
builder.append(usedToAugmentTasks);
builder.append("]");
return builder.toString();
} }
private void handleCallerRolesAndAccessIds() { private void handleCallerRolesAndAccessIds() {

View File

@ -400,9 +400,8 @@ public class WorkbasketServiceImpl implements WorkbasketService {
} finally { } finally {
taskanaEngine.returnConnection(); taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size();
LOGGER.debug("exit from getWorkbasketAccessItems(workbasketId). Returning {} resulting Objects: {} ", LOGGER.debug("exit from getWorkbasketAccessItems(workbasketId). Returning {} resulting Objects: {} ",
numberOfResultObjects, LoggerUtils.listToString(result)); result.size(), LoggerUtils.listToString(result));
} }
} }
} }
@ -790,7 +789,9 @@ public class WorkbasketServiceImpl implements WorkbasketService {
public BulkOperationResults<String, TaskanaException> deleteWorkbaskets(List<String> workbasketsIds) public BulkOperationResults<String, TaskanaException> deleteWorkbaskets(List<String> workbasketsIds)
throws NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
LOGGER.debug("entry to deleteWorkbaskets(workbasketId = {})", LoggerUtils.listToString(workbasketsIds)); if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to deleteWorkbaskets(workbasketId = {})", LoggerUtils.listToString(workbasketsIds));
}
taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);

View File

@ -340,31 +340,19 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "WorkbasketSummaryImpl [" +
builder.append("WorkbasketSummaryImpl [id="); "id=" + this.id +
builder.append(id); ", key=" + this.key +
builder.append(", key="); ", name=" + this.name +
builder.append(key); ", description=" + this.description +
builder.append(", name="); ", owner=" + this.owner +
builder.append(name); ", domain=" + this.domain +
builder.append(", description="); ", type=" + this.type +
builder.append(description); ", orgLevel1=" + this.orgLevel1 +
builder.append(", owner="); ", orgLevel2=" + this.orgLevel2 +
builder.append(owner); ", orgLevel3=" + this.orgLevel3 +
builder.append(", domain="); ", orgLevel4=" + this.orgLevel4 +
builder.append(domain); "]";
builder.append(", type=");
builder.append(type);
builder.append(", orgLevel1=");
builder.append(orgLevel1);
builder.append(", orgLevel2=");
builder.append(orgLevel2);
builder.append(", orgLevel3=");
builder.append(orgLevel3);
builder.append(", orgLevel4=");
builder.append(orgLevel4);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -37,7 +37,10 @@ public class CombinedClassificationFilter {
@Override @Override
public String toString() { public String toString() {
return "(" + this.taskClassificationId + "," + this.attachmentClassificationId + ")"; return "CombinedClassificationFilter [" +
"taskClassificationId= " + this.taskClassificationId +
", attachmentClassificationId= " + this.attachmentClassificationId +
"]";
} }
} }

View File

@ -16,4 +16,11 @@ public class DetailedMonitorQueryItem extends MonitorQueryItem {
this.attachmentKey = attachmentKey; this.attachmentKey = attachmentKey;
} }
@Override
public String toString() {
return "DetailedMonitorQueryItem [" +
"attachmentKey= " + this.attachmentKey +
"]";
}
} }

View File

@ -3,6 +3,7 @@ package pro.taskana.impl.report;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import pro.taskana.impl.util.LoggerUtils;
import pro.taskana.report.ReportRow; import pro.taskana.report.ReportRow;
/** /**
@ -50,4 +51,11 @@ public class DetailedReportRow extends ReportRow<DetailedMonitorQueryItem> {
} }
} }
@Override
public String toString() {
return "DetailedReportRow [" +
"detailRows= " + LoggerUtils.mapToString(this.detailRows) +
", columnCount= " + this.columnCount +
"]";
}
} }

View File

@ -35,4 +35,13 @@ public class MonitorQueryItem implements QueryItem {
this.numberOfTasks = numberOfTasks; this.numberOfTasks = numberOfTasks;
} }
@Override
public String toString() {
return "MonitorQueryItem [" +
"key= " + this.key +
", ageInDays= " + this.ageInDays +
", numberOfTasks= " + this.numberOfTasks +
"]";
}
} }

View File

@ -37,4 +37,13 @@ public class TaskQueryItem implements QueryItem {
public int getValue() { public int getValue() {
return count; return count;
} }
@Override
public String toString() {
return "TaskQueryItem [" +
"domain= " + this.domain +
", state= " + this.state.name() +
", count= " + this.count +
"]";
}
} }

View File

@ -16,12 +16,12 @@ public class TaskStatusColumnHeader implements ReportColumnHeader<TaskQueryItem>
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return state.name(); return this.state.name();
} }
@Override @Override
public boolean fits(TaskQueryItem item) { public boolean fits(TaskQueryItem item) {
return item.getState() == state; return item.getState() == this.state;
} }
@Override @Override

View File

@ -3,7 +3,7 @@ package pro.taskana.impl.util;
import java.util.UUID; import java.util.UUID;
/** /**
* This class contains util emthods for generating ids. * This class contains util methods for generating ids.
*/ */
public final class IdGenerator { public final class IdGenerator {

View File

@ -46,7 +46,7 @@ public class JobRunner {
runJobTransactionally(scheduledJob); runJobTransactionally(scheduledJob);
} }
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("Error occured whle running jobs: ", e); LOGGER.error("Error occurred while running jobs: ", e);
} finally { } finally {
LOGGER.info("exit from runJobs()."); LOGGER.info("exit from runJobs().");
} }
@ -98,9 +98,9 @@ public class JobRunner {
} }
jobService.deleteJob(scheduledJob); jobService.deleteJob(scheduledJob);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); LOGGER.error(
LOGGER.warn( "Processing of job {} failed. Trying to split it up into two pieces...",
"Processing of job " + scheduledJob.getJobId() + " failed. Trying to split it up into two pieces...", scheduledJob.getJobId(),
e); e);
} }
} }

View File

@ -109,29 +109,18 @@ public class ScheduledJob {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "ScheduledJob [" +
builder.append("ScheduledJob [jobId="); "jobId=" + this.jobId +
builder.append(jobId); ", priority=" + this.priority +
builder.append(", priority="); ", created=" + this.created +
builder.append(priority); ", due=" + this.due +
builder.append(", created="); ", state=" + this.state +
builder.append(created); ", lockedBy=" + this.lockedBy +
builder.append(", due="); ", lockExpires=" + this.lockExpires +
builder.append(due); ", type=" + this.type +
builder.append(", state="); ", retryCount=" + this.retryCount +
builder.append(state); ", arguments=" + this.arguments +
builder.append(", lockedBy="); "]";
builder.append(lockedBy);
builder.append(", lockExpires=");
builder.append(lockExpires);
builder.append(", type=");
builder.append(type);
builder.append(", retryCount=");
builder.append(retryCount);
builder.append(", arguments=");
builder.append(arguments);
builder.append("]");
return builder.toString();
} }
/** /**

View File

@ -18,6 +18,7 @@ import pro.taskana.TaskanaEngine;
import pro.taskana.TimeInterval; import pro.taskana.TimeInterval;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.TaskanaException; import pro.taskana.exceptions.TaskanaException;
import pro.taskana.impl.util.LoggerUtils;
import pro.taskana.transaction.TaskanaTransactionProvider; import pro.taskana.transaction.TaskanaTransactionProvider;
/** /**
@ -71,6 +72,7 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
} }
private List<TaskSummary> getTasksCompletedBefore(Instant untilDate) { private List<TaskSummary> getTasksCompletedBefore(Instant untilDate) {
LOGGER.debug("entry to getTasksCompletedBefore(untilDate = {})", untilDate);
List<TaskSummary> taskList = taskanaEngineImpl.getTaskService() List<TaskSummary> taskList = taskanaEngineImpl.getTaskService()
.createTaskQuery() .createTaskQuery()
.completedWithin(new TimeInterval(null, untilDate)) .completedWithin(new TimeInterval(null, untilDate))
@ -96,6 +98,7 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
}); });
if (idsList.isEmpty()) { if (idsList.isEmpty()) {
LOGGER.debug("exit from getTasksCompletedBefore(), returning {}", new ArrayList<>());
return new ArrayList<>(); return new ArrayList<>();
} }
@ -107,10 +110,18 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
.list(); .list();
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("exit from getTasksCompletedBefore(), returning {}", LoggerUtils.listToString(taskList));
}
return taskList; return taskList;
} }
private int deleteTasksTransactionally(List<TaskSummary> tasksToBeDeleted) { private int deleteTasksTransactionally(List<TaskSummary> tasksToBeDeleted) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to deleteTasksTransactionally(tasksToBeDeleted = {})", LoggerUtils.listToString(tasksToBeDeleted));
}
int deletedTaskCount = 0; int deletedTaskCount = 0;
if (txProvider != null) { if (txProvider != null) {
Integer count = (Integer) txProvider.executeInTransaction(() -> { Integer count = (Integer) txProvider.executeInTransaction(() -> {
@ -121,6 +132,7 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
return new Integer(0); return new Integer(0);
} }
}); });
LOGGER.debug("exit from deleteTasksTransactionally(), returning {}", count.intValue());
return count.intValue(); return count.intValue();
} else { } else {
try { try {
@ -129,10 +141,15 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
LOGGER.warn("Could not delete tasks.", e); LOGGER.warn("Could not delete tasks.", e);
} }
} }
LOGGER.debug("exit from deleteTasksTransactionally(), returning {}", deletedTaskCount);
return deletedTaskCount; return deletedTaskCount;
} }
private int deleteTasks(List<TaskSummary> tasksToBeDeleted) throws InvalidArgumentException { private int deleteTasks(List<TaskSummary> tasksToBeDeleted) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to deleteTasks(tasksToBeDeleted = {})", tasksToBeDeleted);
}
List<String> tasksIdsToBeDeleted = tasksToBeDeleted.stream() List<String> tasksIdsToBeDeleted = tasksToBeDeleted.stream()
.map(task -> task.getTaskId()) .map(task -> task.getTaskId())
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -142,6 +159,7 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
for (String failedId : results.getFailedIds()) { for (String failedId : results.getFailedIds()) {
LOGGER.warn("Task with id {} could not be deleted. Reason: {}", failedId, results.getErrorForId(failedId)); LOGGER.warn("Task with id {} could not be deleted. Reason: {}", failedId, results.getErrorForId(failedId));
} }
LOGGER.debug("exit from deleteTasks(), returning {}", tasksIdsToBeDeleted.size() - results.getFailedIds().size());
return tasksIdsToBeDeleted.size() - results.getFailedIds().size(); return tasksIdsToBeDeleted.size() - results.getFailedIds().size();
} }

View File

@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
import pro.taskana.exceptions.TaskanaException; import pro.taskana.exceptions.TaskanaException;
import pro.taskana.impl.TaskServiceImpl; import pro.taskana.impl.TaskServiceImpl;
import pro.taskana.impl.util.LoggerUtils;
import pro.taskana.transaction.TaskanaTransactionProvider; import pro.taskana.transaction.TaskanaTransactionProvider;
/** /**
@ -51,4 +52,9 @@ public class TaskRefreshJob extends AbstractTaskanaJob {
} }
} }
@Override
public String toString(){
return "TaskRefreshJob [affectedTaskIds= " + LoggerUtils.listToString(affectedTaskIds) + "]";
}
} }

View File

@ -219,4 +219,25 @@ public class CustomPropertySelector {
this.custom16 = custom16; this.custom16 = custom16;
} }
@Override
public String toString() {
return "CustomPropertySelector [" +
"custom1= " + this.custom1 +
", custom2= " + this.custom2 +
", custom3= " + this.custom3 +
", custom4= " + this.custom4 +
", custom5= " + this.custom5 +
", custom6= " + this.custom6 +
", custom7= " + this.custom7 +
", custom8= " + this.custom8 +
", custom9= " + this.custom9 +
", custom10= " + this.custom10 +
", custom11= " + this.custom11 +
", custom12= " + this.custom12 +
", custom13= " + this.custom13 +
", custom14= " + this.custom14 +
", custom15= " + this.custom15 +
", custom16= " + this.custom16 +
"]";
}
} }

View File

@ -7,6 +7,8 @@ import java.util.Enumeration;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import pro.taskana.impl.util.LoggerUtils;
/** /**
* Represents a group with a name and a set of members. * Represents a group with a name and a set of members.
*/ */
@ -44,4 +46,12 @@ public class GroupPrincipal implements Group {
public Enumeration<? extends Principal> members() { public Enumeration<? extends Principal> members() {
return Collections.enumeration(this.members); return Collections.enumeration(this.members);
} }
@Override
public String toString() {
return "GroupPrincipal [" +
"name= " + this.name +
", members= " + LoggerUtils.setToString(this.members) +
"]";
}
} }

View File

@ -17,4 +17,9 @@ public class UserPrincipal implements Principal {
public String getName() { public String getName() {
return this.name; return this.name;
} }
@Override
public String toString() {
return "UserPrincipal [name= " + this.getName() + "]";
}
} }

View File

@ -4,6 +4,8 @@ import java.time.Instant;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.PagedResources; import org.springframework.hateoas.PagedResources;
import org.springframework.hateoas.PagedResources.PageMetadata; import org.springframework.hateoas.PagedResources.PageMetadata;
@ -21,6 +23,7 @@ import pro.taskana.BaseQuery;
import pro.taskana.TimeInterval; import pro.taskana.TimeInterval;
import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.impl.util.LoggerUtils;
import pro.taskana.rest.resource.TaskHistoryEventResource; import pro.taskana.rest.resource.TaskHistoryEventResource;
import pro.taskana.rest.resource.TaskHistoryEventListAssembler; import pro.taskana.rest.resource.TaskHistoryEventListAssembler;
import pro.taskana.simplehistory.impl.HistoryEventImpl; import pro.taskana.simplehistory.impl.HistoryEventImpl;
@ -34,6 +37,7 @@ import pro.taskana.simplehistory.query.HistoryQuery;
@EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL) @EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL)
@RequestMapping(path = "/v1/task-history-event", produces = "application/hal+json") @RequestMapping(path = "/v1/task-history-event", produces = "application/hal+json")
public class TaskHistoryEventController extends AbstractPagingController { public class TaskHistoryEventController extends AbstractPagingController {
private static final Logger LOGGER = LoggerFactory.getLogger(TaskHistoryEventController.class);
private static final String LIKE = "%"; private static final String LIKE = "%";
private static final String BUSINESS_PROCESS_ID = "business-process-id"; private static final String BUSINESS_PROCESS_ID = "business-process-id";
@ -96,6 +100,9 @@ public class TaskHistoryEventController extends AbstractPagingController {
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<PagedResources<TaskHistoryEventResource>> getTaskHistoryEvent( public ResponseEntity<PagedResources<TaskHistoryEventResource>> getTaskHistoryEvent(
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException { @RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getTaskHistoryEvent(params= {})", LoggerUtils.mapToString(params));
}
HistoryQuery query = simpleHistoryService.createHistoryQuery(); HistoryQuery query = simpleHistoryService.createHistoryQuery();
query = applySortingParams(query, params); query = applySortingParams(query, params);
@ -122,11 +129,19 @@ public class TaskHistoryEventController extends AbstractPagingController {
TaskHistoryEventListAssembler assembler = new TaskHistoryEventListAssembler(); TaskHistoryEventListAssembler assembler = new TaskHistoryEventListAssembler();
PagedResources<TaskHistoryEventResource> pagedResources = assembler.toResources(historyEvents, pageMetadata); PagedResources<TaskHistoryEventResource> pagedResources = assembler.toResources(historyEvents, pageMetadata);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getTaskHistoryEvent(), returning {}", new ResponseEntity<>(pagedResources, HttpStatus.OK));
}
return new ResponseEntity<>(pagedResources, HttpStatus.OK); return new ResponseEntity<>(pagedResources, HttpStatus.OK);
} }
private HistoryQuery applySortingParams(HistoryQuery query, MultiValueMap<String, String> params) private HistoryQuery applySortingParams(HistoryQuery query, MultiValueMap<String, String> params)
throws IllegalArgumentException, InvalidArgumentException { throws IllegalArgumentException, InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applySortingParams(params= {})", LoggerUtils.mapToString(params));
}
String sortBy = params.getFirst(SORT_BY); String sortBy = params.getFirst(SORT_BY);
if (sortBy != null) { if (sortBy != null) {
BaseQuery.SortDirection sortDirection; BaseQuery.SortDirection sortDirection;
@ -202,11 +217,19 @@ public class TaskHistoryEventController extends AbstractPagingController {
} }
params.remove(SORT_BY); params.remove(SORT_BY);
params.remove(SORT_DIRECTION); params.remove(SORT_DIRECTION);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applySortingParams(), returning {}", query);
}
return query; return query;
} }
private HistoryQuery applyFilterParams(HistoryQuery query, private HistoryQuery applyFilterParams(HistoryQuery query,
MultiValueMap<String, String> params) { MultiValueMap<String, String> params) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", query, params);
}
if (params.containsKey(BUSINESS_PROCESS_ID)) { if (params.containsKey(BUSINESS_PROCESS_ID)) {
String[] businessProcessId = extractCommaSeparatedFields(params.get(BUSINESS_PROCESS_ID)); String[] businessProcessId = extractCommaSeparatedFields(params.get(BUSINESS_PROCESS_ID));
query.businessProcessIdIn(businessProcessId); query.businessProcessIdIn(businessProcessId);
@ -381,6 +404,10 @@ public class TaskHistoryEventController extends AbstractPagingController {
query.custom4Like(LIKE + params.get(CUSTOM_4_LIKE).get(0) + LIKE); query.custom4Like(LIKE + params.get(CUSTOM_4_LIKE).get(0) + LIKE);
params.remove(CUSTOM_4_LIKE); params.remove(CUSTOM_4_LIKE);
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
}
return query; return query;
} }
} }

View File

@ -244,4 +244,23 @@ public class TaskHistoryEventResource extends ResourceSupport {
public void setNewData(String newData) { public void setNewData(String newData) {
this.newData = newData; this.newData = newData;
} }
@Override
public String toString() {
return "TaskHistoryEventResource [" +
"taskHistoryEventId= " + this.taskHistoryEventId +
"businessProcessId= " + this.businessProcessId +
"parentBusinessProcessId= " + this.parentBusinessProcessId +
"taskId= " + this.taskId +
"eventType= " + this.eventType +
"created= " + this.created +
"userId= " + this.userId +
"domain= " + this.domain +
"workbasketKey= " + this.workbasketKey +
"oldValue= " + this.oldValue +
"newValue= " + this.newValue +
"oldData= " + this.oldData +
"newData= " + this.newData +
"]";
}
} }

View File

@ -25,7 +25,6 @@ public class SampleDataGenerator {
private static final String HISTORY_EVENT = TEST_DATA + "/history-event.sql"; private static final String HISTORY_EVENT = TEST_DATA + "/history-event.sql";
private ScriptRunner runner; private ScriptRunner runner;
DataSource dataSource; DataSource dataSource;
public SampleDataGenerator(DataSource dataSource) throws SQLException { public SampleDataGenerator(DataSource dataSource) throws SQLException {

View File

@ -1,24 +1,21 @@
package pro.taskana.rest.controllers; package pro.taskana.rest.controllers;
import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger;
import javax.servlet.http.HttpServletResponse; import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpSession;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Controller @Controller
public class LoginController implements WebMvcConfigurer { public class LoginController implements WebMvcConfigurer {
private static final Logger LOGGER = LoggerFactory.getLogger(LoginController.class);
@Override @Override
public void addViewControllers(ViewControllerRegistry registry) { public void addViewControllers(ViewControllerRegistry registry) {
LOGGER.debug("Entry to addViewControllers()");
registry.addViewController("/login").setViewName("login"); registry.addViewController("/login").setViewName("login");
registry.setOrder(Ordered.HIGHEST_PRECEDENCE); registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
LOGGER.debug("Exit from addViewControllers()");
} }
}
}

View File

@ -2,24 +2,27 @@ package pro.taskana.rest.models;
public class User { public class User {
private String username; private String username;
private String password; private String password;
public String getUsername() { public String getUsername() {
return username; return username;
} }
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
public String getPassword() { public String getPassword() {
return password; return password;
} }
public void setPassword(String password) {
this.password = password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "User [" + "username= " + this.username + "]";
}
} }

View File

@ -121,8 +121,7 @@ public class AsyncUpdateJobIntTest {
long delay = 16000; long delay = 16000;
LOGGER.info("About to sleep for " + delay / 1000 LOGGER.info("About to sleep for {} seconds to give JobScheduler a chance to process the classification change", delay / 1000);
+ " seconds to give JobScheduler a chance to process the classification change");
Thread.sleep(delay); Thread.sleep(delay);
LOGGER.info("Sleeping ended. Continuing .... "); LOGGER.info("Sleeping ended. Continuing .... ");

View File

@ -28,13 +28,10 @@ public class AccessId {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "AccessId [" +
builder.append("AccessId [accessId="); "accessId=" + this.accessId +
builder.append(accessId); ", name=" + this.name +
builder.append(", name="); "]";
builder.append(name);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -56,7 +56,7 @@ public class LdapClient {
@PostConstruct @PostConstruct
private void init() { private void init() {
LOGGER.debug("Entry to init()");
String strMinSearchForLength = getMinSearchForLengthAsString(); String strMinSearchForLength = getMinSearchForLengthAsString();
if (strMinSearchForLength == null || strMinSearchForLength.isEmpty()) { if (strMinSearchForLength == null || strMinSearchForLength.isEmpty()) {
minSearchForLength = 3; minSearchForLength = 3;
@ -126,6 +126,7 @@ public class LdapClient {
} }
active = true; active = true;
} }
LOGGER.debug("Exit from init()");
} }
public List<AccessIdResource> searchUsersAndGroups(final String name) throws InvalidArgumentException { public List<AccessIdResource> searchUsersAndGroups(final String name) throws InvalidArgumentException {

View File

@ -3,6 +3,8 @@ package pro.taskana.rest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.hateoas.config.EnableHypermediaSupport;
import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType; import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType;
@ -28,6 +30,8 @@ import pro.taskana.rest.resource.AccessIdResource;
@RequestMapping(path = "/v1/access-ids", produces = "application/hal+json") @RequestMapping(path = "/v1/access-ids", produces = "application/hal+json")
public class AccessIdController { public class AccessIdController {
private static final Logger LOGGER = LoggerFactory.getLogger(AccessIdController.class);
@Autowired @Autowired
LdapClient ldapClient; LdapClient ldapClient;
@ -36,6 +40,7 @@ public class AccessIdController {
@GetMapping @GetMapping
public ResponseEntity<List<AccessIdResource>> validateAccessIds( public ResponseEntity<List<AccessIdResource>> validateAccessIds(
@RequestParam("search-for") String searchFor) throws InvalidArgumentException { @RequestParam("search-for") String searchFor) throws InvalidArgumentException {
LOGGER.debug("Entry to validateAccessIds(search-for= {})", searchFor);
if (searchFor.length() < ldapClient.getMinSearchForLength()) { if (searchFor.length() < ldapClient.getMinSearchForLength()) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
"searchFor string '" + searchFor + "' is too short. Minimum searchFor length = " "searchFor string '" + searchFor + "' is too short. Minimum searchFor length = "
@ -43,12 +48,23 @@ public class AccessIdController {
} }
if (ldapClient.useLdap()) { if (ldapClient.useLdap()) {
List<AccessIdResource> accessIdUsers = ldapClient.searchUsersAndGroups(searchFor); List<AccessIdResource> accessIdUsers = ldapClient.searchUsersAndGroups(searchFor);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from validateAccessIds(), returning {}", new ResponseEntity<>(accessIdUsers, HttpStatus.OK));
}
return new ResponseEntity<>(accessIdUsers, HttpStatus.OK); return new ResponseEntity<>(accessIdUsers, HttpStatus.OK);
} else if (ldapCache != null) { } else if (ldapCache != null) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from validateAccessIds(), returning {}", new ResponseEntity<>(
ldapCache.findMatchingAccessId(searchFor, ldapClient.getMaxNumberOfReturnedAccessIds()),
HttpStatus.OK));
}
return new ResponseEntity<>( return new ResponseEntity<>(
ldapCache.findMatchingAccessId(searchFor, ldapClient.getMaxNumberOfReturnedAccessIds()), ldapCache.findMatchingAccessId(searchFor, ldapClient.getMaxNumberOfReturnedAccessIds()),
HttpStatus.OK); HttpStatus.OK);
} else { } else {
LOGGER.debug("Exit from validateAccessIds(), returning {}", new ResponseEntity<>(new ArrayList<>(), HttpStatus.NOT_FOUND));
return new ResponseEntity<>(new ArrayList<>(), HttpStatus.NOT_FOUND); return new ResponseEntity<>(new ArrayList<>(), HttpStatus.NOT_FOUND);
} }
} }
@ -56,6 +72,7 @@ public class AccessIdController {
@GetMapping(path = "/groups") @GetMapping(path = "/groups")
public ResponseEntity<List<AccessIdResource>> getGroupsByAccessId( public ResponseEntity<List<AccessIdResource>> getGroupsByAccessId(
@RequestParam("access-id") String accessId) throws InvalidArgumentException { @RequestParam("access-id") String accessId) throws InvalidArgumentException {
LOGGER.debug("Entry to getGroupsByAccessId(access-id= {})", accessId);
if (ldapClient.useLdap() || ldapCache != null) { if (ldapClient.useLdap() || ldapCache != null) {
if (!validateAccessId(accessId)) { if (!validateAccessId(accessId)) {
throw new InvalidArgumentException("The accessId is invalid"); throw new InvalidArgumentException("The accessId is invalid");
@ -65,11 +82,20 @@ public class AccessIdController {
if (ldapClient.useLdap()) { if (ldapClient.useLdap()) {
accessIdUsers = ldapClient.searchUsersAndGroups(accessId); accessIdUsers = ldapClient.searchUsersAndGroups(accessId);
accessIdUsers.addAll(ldapClient.searchGroupsofUsersIsMember(accessId)); accessIdUsers.addAll(ldapClient.searchGroupsofUsersIsMember(accessId));
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getGroupsByAccessId(), returning {}", new ResponseEntity<>(accessIdUsers, HttpStatus.OK));
}
return new ResponseEntity<>(accessIdUsers, HttpStatus.OK); return new ResponseEntity<>(accessIdUsers, HttpStatus.OK);
} else if (ldapCache != null) { } else if (ldapCache != null) {
accessIdUsers = ldapCache.findGroupsOfUser(accessId, ldapClient.getMaxNumberOfReturnedAccessIds()); accessIdUsers = ldapCache.findGroupsOfUser(accessId, ldapClient.getMaxNumberOfReturnedAccessIds());
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getGroupsByAccessId(), returning {}", new ResponseEntity<>(accessIdUsers, HttpStatus.OK));
}
return new ResponseEntity<>(accessIdUsers, HttpStatus.OK); return new ResponseEntity<>(accessIdUsers, HttpStatus.OK);
} else { } else {
LOGGER.debug("Exit from getGroupsByAccessId(), returning {}", new ResponseEntity<>(new ArrayList<>(), HttpStatus.NOT_FOUND));
return new ResponseEntity<>(new ArrayList<>(), HttpStatus.NOT_FOUND); return new ResponseEntity<>(new ArrayList<>(), HttpStatus.NOT_FOUND);
} }
} }

View File

@ -2,6 +2,8 @@ package pro.taskana.rest;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.PagedResources; import org.springframework.hateoas.PagedResources;
import org.springframework.hateoas.PagedResources.PageMetadata; import org.springframework.hateoas.PagedResources.PageMetadata;
@ -34,8 +36,8 @@ import pro.taskana.exceptions.DomainNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.rest.resource.ClassificationResource; import pro.taskana.rest.resource.ClassificationResource;
import pro.taskana.rest.resource.ClassificationSummaryResource;
import pro.taskana.rest.resource.ClassificationResourceAssembler; import pro.taskana.rest.resource.ClassificationResourceAssembler;
import pro.taskana.rest.resource.ClassificationSummaryResource;
import pro.taskana.rest.resource.ClassificationSummaryResourcesAssembler; import pro.taskana.rest.resource.ClassificationSummaryResourcesAssembler;
/** /**
@ -46,6 +48,8 @@ import pro.taskana.rest.resource.ClassificationSummaryResourcesAssembler;
@RequestMapping(path = "/v1/classifications", produces = "application/hal+json") @RequestMapping(path = "/v1/classifications", produces = "application/hal+json")
public class ClassificationController extends AbstractPagingController { public class ClassificationController extends AbstractPagingController {
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationController.class);
private static final String LIKE = "%"; private static final String LIKE = "%";
private static final String NAME = "name"; private static final String NAME = "name";
private static final String NAME_LIKE = "name-like"; private static final String NAME_LIKE = "name-like";
@ -78,6 +82,9 @@ public class ClassificationController extends AbstractPagingController {
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<PagedResources<ClassificationSummaryResource>> getClassifications( public ResponseEntity<PagedResources<ClassificationSummaryResource>> getClassifications(
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException { @RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getClassifications(params= {})", params);
}
ClassificationQuery query = classificationService.createClassificationQuery(); ClassificationQuery query = classificationService.createClassificationQuery();
query = applySortingParams(query, params); query = applySortingParams(query, params);
@ -107,6 +114,10 @@ public class ClassificationController extends AbstractPagingController {
PagedResources<ClassificationSummaryResource> pagedResources = assembler.toResources(classificationSummaries, PagedResources<ClassificationSummaryResource> pagedResources = assembler.toResources(classificationSummaries,
pageMetadata); pageMetadata);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getClassifications(), returning {}", new ResponseEntity<>(pagedResources, HttpStatus.OK));
}
return new ResponseEntity<>(pagedResources, HttpStatus.OK); return new ResponseEntity<>(pagedResources, HttpStatus.OK);
} }
@ -115,7 +126,12 @@ public class ClassificationController extends AbstractPagingController {
public ResponseEntity<ClassificationResource> getClassification(@PathVariable String classificationId) public ResponseEntity<ClassificationResource> getClassification(@PathVariable String classificationId)
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationAlreadyExistException, throws ClassificationNotFoundException, NotAuthorizedException, ClassificationAlreadyExistException,
ConcurrencyException, DomainNotFoundException, InvalidArgumentException { ConcurrencyException, DomainNotFoundException, InvalidArgumentException {
LOGGER.debug("Entry to getClassification(classificationId= {})", classificationId);
Classification classification = classificationService.getClassification(classificationId); Classification classification = classificationService.getClassification(classificationId);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getClassification(), returning {}", ResponseEntity.status(HttpStatus.OK).body(classificationResourceAssembler.toResource(classification)));
}
return ResponseEntity.status(HttpStatus.OK).body(classificationResourceAssembler.toResource(classification)); return ResponseEntity.status(HttpStatus.OK).body(classificationResourceAssembler.toResource(classification));
} }
@ -125,8 +141,17 @@ public class ClassificationController extends AbstractPagingController {
@RequestBody ClassificationResource resource) @RequestBody ClassificationResource resource)
throws NotAuthorizedException, ClassificationNotFoundException, ClassificationAlreadyExistException, throws NotAuthorizedException, ClassificationNotFoundException, ClassificationAlreadyExistException,
ConcurrencyException, DomainNotFoundException, InvalidArgumentException { ConcurrencyException, DomainNotFoundException, InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to createClassification(resource= {})", resource);
}
Classification classification = classificationResourceAssembler.toModel(resource); Classification classification = classificationResourceAssembler.toModel(resource);
classification = classificationService.createClassification(classification); classification = classificationService.createClassification(classification);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from createClassification(), returning {}", ResponseEntity.status(HttpStatus.CREATED)
.body(classificationResourceAssembler.toResource(classification)));
}
return ResponseEntity.status(HttpStatus.CREATED) return ResponseEntity.status(HttpStatus.CREATED)
.body(classificationResourceAssembler.toResource(classification)); .body(classificationResourceAssembler.toResource(classification));
} }
@ -137,6 +162,9 @@ public class ClassificationController extends AbstractPagingController {
@PathVariable(value = "classificationId") String classificationId, @RequestBody ClassificationResource resource) @PathVariable(value = "classificationId") String classificationId, @RequestBody ClassificationResource resource)
throws NotAuthorizedException, ClassificationNotFoundException, ConcurrencyException, throws NotAuthorizedException, ClassificationNotFoundException, ConcurrencyException,
ClassificationAlreadyExistException, DomainNotFoundException, InvalidArgumentException { ClassificationAlreadyExistException, DomainNotFoundException, InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to updateClassification(classificationId= {}, resource= {})", classificationId, resource);
}
ResponseEntity<ClassificationResource> result; ResponseEntity<ClassificationResource> result;
if (classificationId.equals(resource.classificationId)) { if (classificationId.equals(resource.classificationId)) {
@ -149,6 +177,10 @@ public class ClassificationController extends AbstractPagingController {
+ "') of the URI is not identical with the classificationId ('" + "') of the URI is not identical with the classificationId ('"
+ resource.getClassificationId() + "') of the object in the payload."); + resource.getClassificationId() + "') of the object in the payload.");
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from updateClassification(), returning {}", result);
}
return result; return result;
} }
@ -156,12 +188,18 @@ public class ClassificationController extends AbstractPagingController {
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<?> deleteClassification(@PathVariable String classificationId) public ResponseEntity<?> deleteClassification(@PathVariable String classificationId)
throws ClassificationNotFoundException, ClassificationInUseException, NotAuthorizedException { throws ClassificationNotFoundException, ClassificationInUseException, NotAuthorizedException {
LOGGER.debug("Entry to deleteClassification(classificationId= {})", classificationId);
classificationService.deleteClassification(classificationId); classificationService.deleteClassification(classificationId);
LOGGER.debug("Exit from deleteClassification(), returning {}", ResponseEntity.status(HttpStatus.NO_CONTENT).build());
return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
} }
private ClassificationQuery applySortingParams(ClassificationQuery query, MultiValueMap<String, String> params) private ClassificationQuery applySortingParams(ClassificationQuery query, MultiValueMap<String, String> params)
throws IllegalArgumentException { throws IllegalArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applySortingParams(query= {}, params= {})", query, params);
}
// sorting // sorting
String sortBy = params.getFirst(SORT_BY); String sortBy = params.getFirst(SORT_BY);
if (sortBy != null) { if (sortBy != null) {
@ -190,11 +228,19 @@ public class ClassificationController extends AbstractPagingController {
} }
params.remove(SORT_BY); params.remove(SORT_BY);
params.remove(SORT_DIRECTION); params.remove(SORT_DIRECTION);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applySortingParams(), returning {}", query);
}
return query; return query;
} }
private ClassificationQuery applyFilterParams(ClassificationQuery query, private ClassificationQuery applyFilterParams(ClassificationQuery query,
MultiValueMap<String, String> params) throws InvalidArgumentException { MultiValueMap<String, String> params) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", query, params);
}
if (params.containsKey(NAME)) { if (params.containsKey(NAME)) {
String[] names = extractCommaSeparatedFields(params.get(NAME)); String[] names = extractCommaSeparatedFields(params.get(NAME));
query.nameIn(names); query.nameIn(names);
@ -256,6 +302,11 @@ public class ClassificationController extends AbstractPagingController {
query.customAttributeLike("8", LIKE + params.get(CUSTOM_8_LIKE).get(0) + LIKE); query.customAttributeLike("8", LIKE + params.get(CUSTOM_8_LIKE).get(0) + LIKE);
params.remove(CUSTOM_8_LIKE); params.remove(CUSTOM_8_LIKE);
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
}
return query; return query;
} }

View File

@ -5,6 +5,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
@ -27,6 +29,7 @@ import pro.taskana.exceptions.ConcurrencyException;
import pro.taskana.exceptions.DomainNotFoundException; import pro.taskana.exceptions.DomainNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.util.LoggerUtils;
import pro.taskana.rest.resource.ClassificationResource; import pro.taskana.rest.resource.ClassificationResource;
import pro.taskana.rest.resource.ClassificationResourceAssembler; import pro.taskana.rest.resource.ClassificationResourceAssembler;
@ -48,6 +51,8 @@ import java.util.Set;
@RequestMapping(path = "/v1/classification-definitions", produces = {MediaType.APPLICATION_JSON_VALUE}) @RequestMapping(path = "/v1/classification-definitions", produces = {MediaType.APPLICATION_JSON_VALUE})
public class ClassificationDefinitionController { public class ClassificationDefinitionController {
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationDefinitionController.class);
@Autowired @Autowired
private ClassificationService classificationService; private ClassificationService classificationService;
@ -56,22 +61,18 @@ public class ClassificationDefinitionController {
@GetMapping @GetMapping
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<List<ClassificationResource>> exportClassifications( public ResponseEntity<List<ClassificationSummary>> exportClassifications(
@RequestParam(required = false) String domain) @RequestParam(required = false) String domain) {
throws ClassificationNotFoundException, DomainNotFoundException, ConcurrencyException, InvalidArgumentException, LOGGER.debug("Entry to exportClassifications(domain= {})", domain);
NotAuthorizedException, ClassificationAlreadyExistException {
ClassificationQuery query = classificationService.createClassificationQuery(); ClassificationQuery query = classificationService.createClassificationQuery();
List<ClassificationSummary> summaries = domain != null ? query.domainIn(domain).list() : query.list(); List<ClassificationSummary> summaries = domain != null ? query.domainIn(domain).list() : query.list();
List<ClassificationResource> export = new ArrayList<>(); List<ClassificationResource> export = new ArrayList<>();
if(LOGGER.isDebugEnabled()) {
for (ClassificationSummary summary : summaries) { LOGGER.debug("Exit from exportClassifications(), returning {}", new ResponseEntity<>(summaries, HttpStatus.OK));
Classification classification = classificationService.getClassification(summary.getKey(),
summary.getDomain());
export.add(classificationResourceAssembler.toDefinition(classification));
} }
return new ResponseEntity<>(export, HttpStatus.OK);
return new ResponseEntity<>(summaries, HttpStatus.OK);
} }
@PostMapping @PostMapping
@ -80,16 +81,15 @@ public class ClassificationDefinitionController {
@RequestParam("file") MultipartFile file) @RequestParam("file") MultipartFile file)
throws InvalidArgumentException, NotAuthorizedException, ConcurrencyException, ClassificationNotFoundException, throws InvalidArgumentException, NotAuthorizedException, ConcurrencyException, ClassificationNotFoundException,
ClassificationAlreadyExistException, DomainNotFoundException, IOException { ClassificationAlreadyExistException, DomainNotFoundException, IOException {
LOGGER.debug("Entry to importClassifications()");
Map<String, String> systemIds = getSystemIds(); Map<String, String> systemIds = getSystemIds();
List<ClassificationResource> classificationsResources = extractClassificationResourcesFromFile(file); List<ClassificationResource> classificationsResources = extractClassificationResourcesFromFile(file);
Map<Classification, String> childsInFile = mapChildsToParentKeys(classificationsResources, systemIds); Map<Classification, String> childsInFile = mapChildsToParentKeys(classificationsResources, systemIds);
insertOrUpdateClassificationsWithoutParent(classificationsResources, systemIds); insertOrUpdateClassificationsWithoutParent(classificationsResources, systemIds);
updateParentChildRelations(childsInFile); updateParentChildRelations(childsInFile);
LOGGER.debug("Exit from importClassifications(), returning {}", new ResponseEntity<>(HttpStatus.OK));
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
private Map<String, String> getSystemIds() { private Map<String, String> getSystemIds() {
@ -112,6 +112,7 @@ public class ClassificationDefinitionController {
} }
private Map<Classification, String> mapChildsToParentKeys(List<ClassificationResource> classificationResources, Map<String, String> systemIds) { private Map<Classification, String> mapChildsToParentKeys(List<ClassificationResource> classificationResources, Map<String, String> systemIds) {
LOGGER.debug("Entry to mapChildsToParentKeys()");
Map<Classification, String> childsInFile = new HashMap<>(); Map<Classification, String> childsInFile = new HashMap<>();
Set<String> newKeysWithDomain = new HashSet<>(); Set<String> newKeysWithDomain = new HashSet<>();
classificationResources.forEach(cl -> newKeysWithDomain.add(cl.getKey() + "|" + cl.getDomain())); classificationResources.forEach(cl -> newKeysWithDomain.add(cl.getKey() + "|" + cl.getDomain()));
@ -134,7 +135,11 @@ public class ClassificationDefinitionController {
childsInFile.put(classificationResourceAssembler.toModel(cl), cl.getParentKey()); childsInFile.put(classificationResourceAssembler.toModel(cl), cl.getParentKey());
} }
} }
}
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from mapChildsToParentKeys(), returning {}", LoggerUtils.mapToString(childsInFile));
} }
return childsInFile; return childsInFile;
} }
@ -142,7 +147,7 @@ public class ClassificationDefinitionController {
Map<String, String> systemIds) Map<String, String> systemIds)
throws ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException, throws ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException,
ClassificationAlreadyExistException, DomainNotFoundException, ConcurrencyException { ClassificationAlreadyExistException, DomainNotFoundException, ConcurrencyException {
LOGGER.debug("Entry to insertOrUpdateClassificationsWithoutParent()");
for (ClassificationResource classificationResource : classificationResources) { for (ClassificationResource classificationResource : classificationResources) {
classificationResource.setParentKey(null); classificationResource.setParentKey(null);
classificationResource.setParentId(null); classificationResource.setParentId(null);
@ -155,12 +160,14 @@ public class ClassificationDefinitionController {
classificationService.createClassification( classificationService.createClassification(
classificationResourceAssembler.toModel(classificationResource)); classificationResourceAssembler.toModel(classificationResource));
} }
} }
LOGGER.debug("Exit from insertOrUpdateClassificationsWithoutParent()");
} }
private void updateParentChildRelations(Map<Classification, String> childsInFile) private void updateParentChildRelations(Map<Classification, String> childsInFile)
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
InvalidArgumentException { InvalidArgumentException {
LOGGER.debug("Entry to updateParentChildRelations()");
for (Classification childRes : childsInFile.keySet()) { for (Classification childRes : childsInFile.keySet()) {
Classification child = classificationService Classification child = classificationService
.getClassification(childRes.getKey(), childRes.getDomain()); .getClassification(childRes.getKey(), childRes.getDomain());
@ -170,11 +177,13 @@ public class ClassificationDefinitionController {
child.setParentId(parentId); child.setParentId(parentId);
classificationService.updateClassification(child); classificationService.updateClassification(child);
} }
LOGGER.debug("Exit from updateParentChildRelations()");
} }
private void updateExistingClassification(ClassificationResource cl, private void updateExistingClassification(ClassificationResource cl,
String systemId) throws ClassificationNotFoundException, NotAuthorizedException, String systemId) throws ClassificationNotFoundException, NotAuthorizedException,
ConcurrencyException, InvalidArgumentException { ConcurrencyException, InvalidArgumentException {
LOGGER.debug("Entry to updateExistingClassification()");
Classification currentClassification = classificationService.getClassification(systemId); Classification currentClassification = classificationService.getClassification(systemId);
if (cl.getType() != null && !cl.getType().equals(currentClassification.getType())) { if (cl.getType() != null && !cl.getType().equals(currentClassification.getType())) {
throw new InvalidArgumentException("Can not change the type of a classification."); throw new InvalidArgumentException("Can not change the type of a classification.");
@ -195,6 +204,7 @@ public class ClassificationDefinitionController {
currentClassification.setCustom7(cl.custom7); currentClassification.setCustom7(cl.custom7);
currentClassification.setCustom8(cl.custom8); currentClassification.setCustom8(cl.custom8);
classificationService.updateClassification(currentClassification); classificationService.updateClassification(currentClassification);
LOGGER.debug("Exit from updateExistingClassification()");
} }
} }

View File

@ -5,6 +5,8 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@ -30,6 +32,7 @@ import pro.taskana.rest.resource.ReportAssembler;
@RestController @RestController
@RequestMapping(path = "/v1/monitor", produces = "application/hal+json") @RequestMapping(path = "/v1/monitor", produces = "application/hal+json")
public class MonitorController { public class MonitorController {
private static final Logger LOGGER = LoggerFactory.getLogger(MonitorController.class);
@Autowired @Autowired
private TaskMonitorService taskMonitorService; private TaskMonitorService taskMonitorService;
@ -42,6 +45,13 @@ public class MonitorController {
public ResponseEntity<ReportResource> getTasksStatusReport(@RequestParam(required = false) List<String> domains, public ResponseEntity<ReportResource> getTasksStatusReport(@RequestParam(required = false) List<String> domains,
@RequestParam(required = false) List<TaskState> states) throws NotAuthorizedException, @RequestParam(required = false) List<TaskState> states) throws NotAuthorizedException,
InvalidArgumentException { InvalidArgumentException {
LOGGER.debug("Entry to getTasksStatusReport()");
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getTasksStatusReport(), returning {}", reportAssembler.toResource(
taskMonitorService.createTaskStatusReportBuilder().stateIn(states).domainIn(domains).buildReport(),
domains, states));
}
return ResponseEntity.status(HttpStatus.OK) return ResponseEntity.status(HttpStatus.OK)
.body(reportAssembler.toResource( .body(reportAssembler.toResource(
taskMonitorService.createTaskStatusReportBuilder().stateIn(states).domainIn(domains).buildReport(), taskMonitorService.createTaskStatusReportBuilder().stateIn(states).domainIn(domains).buildReport(),
@ -54,6 +64,14 @@ public class MonitorController {
@RequestParam(value = "daysInPast") int daysInPast, @RequestParam(value = "daysInPast") int daysInPast,
@RequestParam(value = "states") List<TaskState> states) @RequestParam(value = "states") List<TaskState> states)
throws NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
LOGGER.debug("Entry to getTasksWorkbasketReport()");
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getTasksWorkbasketReport(), returning {}", reportAssembler.toResource(
taskMonitorService.createWorkbasketReportBuilder()
.stateIn(states)
.withColumnHeaders(getTasksWorkbasketsTimeInterval(daysInPast)).buildReport(), daysInPast, states));
}
return ResponseEntity.status(HttpStatus.OK) return ResponseEntity.status(HttpStatus.OK)
.body(reportAssembler.toResource( .body(reportAssembler.toResource(
taskMonitorService.createWorkbasketReportBuilder() taskMonitorService.createWorkbasketReportBuilder()
@ -66,6 +84,13 @@ public class MonitorController {
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportResource> getTasksClassificationReport() public ResponseEntity<ReportResource> getTasksClassificationReport()
throws NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
LOGGER.debug("Entry to getTasksClassificationReport()");
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getTasksClassificationReport(), returning {}",reportAssembler.toResource(
taskMonitorService.createClassificationReportBuilder()
.withColumnHeaders(getTaskClassificationTimeInterval())
.buildReport()));
}
return ResponseEntity.status(HttpStatus.OK) return ResponseEntity.status(HttpStatus.OK)
.body(reportAssembler.toResource( .body(reportAssembler.toResource(

View File

@ -42,8 +42,8 @@ import pro.taskana.exceptions.TaskAlreadyExistException;
import pro.taskana.exceptions.TaskNotFoundException; import pro.taskana.exceptions.TaskNotFoundException;
import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.rest.resource.TaskResource; import pro.taskana.rest.resource.TaskResource;
import pro.taskana.rest.resource.TaskSummaryResource;
import pro.taskana.rest.resource.TaskResourceAssembler; import pro.taskana.rest.resource.TaskResourceAssembler;
import pro.taskana.rest.resource.TaskSummaryResource;
import pro.taskana.rest.resource.TaskSummaryResourcesAssembler; import pro.taskana.rest.resource.TaskSummaryResourcesAssembler;
/** /**
@ -94,6 +94,9 @@ public class TaskController extends AbstractPagingController {
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<PagedResources<TaskSummaryResource>> getTasks( public ResponseEntity<PagedResources<TaskSummaryResource>> getTasks(
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException { @RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getTasks(params= {})", params);
}
TaskQuery query = taskService.createTaskQuery(); TaskQuery query = taskService.createTaskQuery();
query = applyFilterParams(query, params); query = applyFilterParams(query, params);
@ -123,6 +126,9 @@ public class TaskController extends AbstractPagingController {
TaskSummaryResourcesAssembler taskSummaryResourcesAssembler = new TaskSummaryResourcesAssembler(); TaskSummaryResourcesAssembler taskSummaryResourcesAssembler = new TaskSummaryResourcesAssembler();
PagedResources<TaskSummaryResource> pagedResources = taskSummaryResourcesAssembler.toResources(taskSummaries, PagedResources<TaskSummaryResource> pagedResources = taskSummaryResourcesAssembler.toResources(taskSummaries,
pageMetadata); pageMetadata);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getTasks(), returning {}", new ResponseEntity<>(pagedResources, HttpStatus.OK));
}
return new ResponseEntity<>(pagedResources, HttpStatus.OK); return new ResponseEntity<>(pagedResources, HttpStatus.OK);
} }
@ -131,9 +137,14 @@ public class TaskController extends AbstractPagingController {
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskResource> getTask(@PathVariable String taskId) public ResponseEntity<TaskResource> getTask(@PathVariable String taskId)
throws TaskNotFoundException, NotAuthorizedException { throws TaskNotFoundException, NotAuthorizedException {
LOGGER.debug("Entry to getTask(taskId= {})", taskId);
Task task = taskService.getTask(taskId); Task task = taskService.getTask(taskId);
ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(task), ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(task),
HttpStatus.OK); HttpStatus.OK);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getTask(), returning {}", result);
}
return result; return result;
} }
@ -141,11 +152,16 @@ public class TaskController extends AbstractPagingController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskResource> claimTask(@PathVariable String taskId, @RequestBody String userName) public ResponseEntity<TaskResource> claimTask(@PathVariable String taskId, @RequestBody String userName)
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException { throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException {
LOGGER.debug("Entry to claimTask(taskId= {}, userName= {})", taskId, userName);
// TODO verify user // TODO verify user
taskService.claim(taskId); taskService.claim(taskId);
Task updatedTask = taskService.getTask(taskId); Task updatedTask = taskService.getTask(taskId);
ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(updatedTask), ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(updatedTask),
HttpStatus.OK); HttpStatus.OK);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from claimTask(), returning {}", result);
}
return result; return result;
} }
@ -153,10 +169,15 @@ public class TaskController extends AbstractPagingController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskResource> completeTask(@PathVariable String taskId) public ResponseEntity<TaskResource> completeTask(@PathVariable String taskId)
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException { throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException {
LOGGER.debug("Entry to completeTask(taskId= {})", taskId);
taskService.forceCompleteTask(taskId); taskService.forceCompleteTask(taskId);
Task updatedTask = taskService.getTask(taskId); Task updatedTask = taskService.getTask(taskId);
ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(updatedTask), ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(updatedTask),
HttpStatus.OK); HttpStatus.OK);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from completeTask(), returning {}", result);
}
return result; return result;
} }
@ -164,8 +185,10 @@ public class TaskController extends AbstractPagingController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskResource> deleteTask(@PathVariable String taskId) public ResponseEntity<TaskResource> deleteTask(@PathVariable String taskId)
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException { throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
LOGGER.debug("Entry to deleteTask(taskId= {})", taskId);
taskService.forceDeleteTask(taskId); taskService.forceDeleteTask(taskId);
ResponseEntity<TaskResource> result = new ResponseEntity<>(HttpStatus.NO_CONTENT); ResponseEntity<TaskResource> result = new ResponseEntity<>(HttpStatus.NO_CONTENT);
LOGGER.debug("Exit from deleteTask(), returning {}", result);
return result; return result;
} }
@ -174,9 +197,17 @@ public class TaskController extends AbstractPagingController {
public ResponseEntity<TaskResource> createTask(@RequestBody TaskResource taskResource) public ResponseEntity<TaskResource> createTask(@RequestBody TaskResource taskResource)
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
TaskAlreadyExistException, InvalidArgumentException { TaskAlreadyExistException, InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to createTask(params= {})", taskResource);
}
Task createdTask = taskService.createTask(taskResourceAssembler.toModel(taskResource)); Task createdTask = taskService.createTask(taskResourceAssembler.toModel(taskResource));
ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(createdTask), ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(createdTask),
HttpStatus.CREATED); HttpStatus.CREATED);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from createTask(), returning {}", result);
}
return result; return result;
} }
@ -184,9 +215,14 @@ public class TaskController extends AbstractPagingController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskResource> transferTask(@PathVariable String taskId, @PathVariable String workbasketId) public ResponseEntity<TaskResource> transferTask(@PathVariable String taskId, @PathVariable String workbasketId)
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException { throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException {
LOGGER.debug("Entry to transferTask(taskId= {}, workbasketId= {})", taskId, workbasketId);
Task updatedTask = taskService.transfer(taskId, workbasketId); Task updatedTask = taskService.transfer(taskId, workbasketId);
ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(updatedTask), ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(updatedTask),
HttpStatus.OK); HttpStatus.OK);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from transferTask(), returning {}", result);
}
return result; return result;
} }
@ -197,6 +233,7 @@ public class TaskController extends AbstractPagingController {
@RequestBody TaskResource taskResource) @RequestBody TaskResource taskResource)
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
LOGGER.debug("Entry to updateTask(taskId= {}, taskResource= {})", taskId, taskResource);
ResponseEntity<TaskResource> result; ResponseEntity<TaskResource> result;
if (taskId.equals(taskResource.getTaskId())) { if (taskId.equals(taskResource.getTaskId())) {
Task task = taskResourceAssembler.toModel(taskResource); Task task = taskResourceAssembler.toModel(taskResource);
@ -209,11 +246,18 @@ public class TaskController extends AbstractPagingController {
+ taskResource.getTaskId() + "')"); + taskResource.getTaskId() + "')");
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from updateTask(), returning {}", result);
}
return result; return result;
} }
private TaskQuery applyFilterParams(TaskQuery taskQuery, MultiValueMap<String, String> params) private TaskQuery applyFilterParams(TaskQuery taskQuery, MultiValueMap<String, String> params)
throws InvalidArgumentException { throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applyFilterParams(taskQuery= {}, params= {})", taskQuery, params);
}
// apply filters // apply filters
if (params.containsKey(NAME)) { if (params.containsKey(NAME)) {
@ -295,11 +339,19 @@ public class TaskController extends AbstractPagingController {
taskQuery.primaryObjectReferenceValueLike(LIKE + params.get(POR_VALUE).get(0) + LIKE); taskQuery.primaryObjectReferenceValueLike(LIKE + params.get(POR_VALUE).get(0) + LIKE);
params.remove(POR_VALUE); params.remove(POR_VALUE);
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applyFilterParams(), returning {}", taskQuery);
}
return taskQuery; return taskQuery;
} }
private TaskQuery applySortingParams(TaskQuery taskQuery, MultiValueMap<String, String> params) private TaskQuery applySortingParams(TaskQuery taskQuery, MultiValueMap<String, String> params)
throws InvalidArgumentException { throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applySortingParams(taskQuery= {}, params= {})", taskQuery, params);
}
// sorting // sorting
String sortBy = params.getFirst(SORT_BY); String sortBy = params.getFirst(SORT_BY);
@ -341,18 +393,34 @@ public class TaskController extends AbstractPagingController {
} }
params.remove(SORT_BY); params.remove(SORT_BY);
params.remove(SORT_DIRECTION); params.remove(SORT_DIRECTION);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applySortingParams(), returning {}", taskQuery);
}
return taskQuery; return taskQuery;
} }
private int[] extractPriorities(String[] prioritiesInString) { private int[] extractPriorities(String[] prioritiesInString) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to extractPriorities(prioritiesInString= {})", prioritiesInString);
}
int[] priorities = new int[prioritiesInString.length]; int[] priorities = new int[prioritiesInString.length];
for (int i = 0; i < prioritiesInString.length; i++) { for (int i = 0; i < prioritiesInString.length; i++) {
priorities[i] = Integer.valueOf(prioritiesInString[i]); priorities[i] = Integer.valueOf(prioritiesInString[i]);
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from extractPriorities(), returning {}", priorities);
}
return priorities; return priorities;
} }
private TaskState[] extractStates(MultiValueMap<String, String> params) throws InvalidArgumentException { private TaskState[] extractStates(MultiValueMap<String, String> params) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to extractStates(params= {})", params);
}
List<TaskState> states = new ArrayList<>(); List<TaskState> states = new ArrayList<>();
for (String item : params.get(STATE)) { for (String item : params.get(STATE)) {
for (String state : item.split(",")) { for (String state : item.split(",")) {
@ -371,6 +439,8 @@ public class TaskController extends AbstractPagingController {
} }
} }
} }
LOGGER.debug("Exit from extractStates()");
return states.toArray(new TaskState[0]); return states.toArray(new TaskState[0]);
} }
} }

View File

@ -2,6 +2,8 @@ package pro.taskana.rest;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -22,6 +24,7 @@ import pro.taskana.security.CurrentUserContext;
*/ */
@RestController @RestController
public class TaskanaEngineController { public class TaskanaEngineController {
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaEngineController.class);
@Autowired @Autowired
TaskanaEngineConfiguration taskanaEngineConfiguration; TaskanaEngineConfiguration taskanaEngineConfiguration;
@ -52,6 +55,7 @@ public class TaskanaEngineController {
@GetMapping(path = "/v1/current-user-info", produces = {MediaType.APPLICATION_JSON_VALUE}) @GetMapping(path = "/v1/current-user-info", produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<TaskanaUserInfoResource> getCurrentUserInfo() { public ResponseEntity<TaskanaUserInfoResource> getCurrentUserInfo() {
LOGGER.debug("Entry to getCurrentUserInfo()");
TaskanaUserInfoResource resource = new TaskanaUserInfoResource(); TaskanaUserInfoResource resource = new TaskanaUserInfoResource();
resource.setUserId(CurrentUserContext.getUserid()); resource.setUserId(CurrentUserContext.getUserid());
resource.setGroupIds(CurrentUserContext.getGroupIds()); resource.setGroupIds(CurrentUserContext.getGroupIds());
@ -60,6 +64,10 @@ public class TaskanaEngineController {
resource.getRoles().add(role); resource.getRoles().add(role);
} }
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getCurrentUserInfo(), returning {}", new ResponseEntity<>(resource, HttpStatus.OK));
}
return new ResponseEntity<>(resource, HttpStatus.OK); return new ResponseEntity<>(resource, HttpStatus.OK);
} }
@ -70,9 +78,10 @@ public class TaskanaEngineController {
*/ */
@GetMapping(path = "/v1/version", produces = {MediaType.APPLICATION_JSON_VALUE}) @GetMapping(path = "/v1/version", produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<VersionResource> currentVersion() { public ResponseEntity<VersionResource> currentVersion() {
LOGGER.debug("Entry to currentVersion()");
VersionResource resource = new VersionResource(); VersionResource resource = new VersionResource();
resource.setVersion(version); resource.setVersion(version);
return new ResponseEntity<>(resource, LOGGER.debug("Exit from currentVersion(), returning {}", new ResponseEntity<>(resource, HttpStatus.OK));
HttpStatus.OK); return new ResponseEntity<>(resource, HttpStatus.OK);
} }
} }

View File

@ -57,21 +57,13 @@ public class TaskanaErrorData {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "TaskanaErrorData [" +
builder.append("TaskanaErrorData [timestamp="); "timestamp=" + this.timestamp +
builder.append(timestamp); ", status=" + this.status +
builder.append(", status="); ", error=" + this.error +
builder.append(status); ", exception=" + this.exception +
builder.append(", error="); ", message=" + this.message +
builder.append(error); ", path=" + this.path + "]";
builder.append(", exception=");
builder.append(exception);
builder.append(", message=");
builder.append(message);
builder.append(", path=");
builder.append(path);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -128,9 +128,7 @@ public class TaskanaRestExceptionHandler extends ResponseEntityExceptionHandler
} }
private void logError(Exception ex, TaskanaErrorData errorData) { private void logError(Exception ex, TaskanaErrorData errorData) {
LOGGER.error( LOGGER.error("Error occurred during processing of rest request:\n {}" + errorData.toString(), ex);
"Error occured during processing of rest request:\n" + errorData.toString(),
ex);
} }
} }

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.PagedResources; import org.springframework.hateoas.PagedResources;
import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.hateoas.config.EnableHypermediaSupport;
@ -34,6 +36,8 @@ import pro.taskana.rest.resource.WorkbasketAccessItemAssembler;
@RequestMapping(path = "/v1/workbasket-access-items", produces = "application/hal+json") @RequestMapping(path = "/v1/workbasket-access-items", produces = "application/hal+json")
public class WorkbasketAccessItemController extends AbstractPagingController { public class WorkbasketAccessItemController extends AbstractPagingController {
private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketAccessItemController.class);
private static final String LIKE = "%"; private static final String LIKE = "%";
private static final String WORKBASKET_KEY = "workbasket-key"; private static final String WORKBASKET_KEY = "workbasket-key";
private static final String WORKBASKET_KEY_LIKE = "workbasket-key-like"; private static final String WORKBASKET_KEY_LIKE = "workbasket-key-like";
@ -65,6 +69,9 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
public ResponseEntity<PagedResources<WorkbasketAccessItemResource>> getWorkbasketAccessItems( public ResponseEntity<PagedResources<WorkbasketAccessItemResource>> getWorkbasketAccessItems(
@RequestParam MultiValueMap<String, String> params) @RequestParam MultiValueMap<String, String> params)
throws NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getWorkbasketAccessItems(params= {})", params);
}
WorkbasketAccessItemQuery query = workbasketService.createWorkbasketAccessItemQuery(); WorkbasketAccessItemQuery query = workbasketService.createWorkbasketAccessItemQuery();
query = getAccessIds(query, params); query = getAccessIds(query, params);
@ -96,6 +103,10 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
workbasketAccessItems, workbasketAccessItems,
pageMetadata); pageMetadata);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getWorkbasketAccessItems(), returning {}", new ResponseEntity<>(pagedResources, HttpStatus.OK));
}
return new ResponseEntity<>(pagedResources, HttpStatus.OK); return new ResponseEntity<>(pagedResources, HttpStatus.OK);
} }
@ -111,6 +122,7 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
public ResponseEntity<Void> removeWorkbasketAccessItems( public ResponseEntity<Void> removeWorkbasketAccessItems(
@RequestParam("access-id") String accessId) @RequestParam("access-id") String accessId)
throws NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
LOGGER.debug("Entry to removeWorkbasketAccessItems(access-id= {})", accessId);
if (!ldapClient.isGroup(accessId)) { if (!ldapClient.isGroup(accessId)) {
List<WorkbasketAccessItem> workbasketAccessItemList = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> workbasketAccessItemList = workbasketService.createWorkbasketAccessItemQuery()
.accessIdIn(accessId) .accessIdIn(accessId)
@ -124,21 +136,35 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
accessId + " corresponding to a group, not a user. You just can remove access items for a user"); accessId + " corresponding to a group, not a user. You just can remove access items for a user");
} }
LOGGER.debug("Exit from removeWorkbasketAccessItems(), returning {}", ResponseEntity.status(HttpStatus.NO_CONTENT).build());
return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
} }
private WorkbasketAccessItemQuery getAccessIds(WorkbasketAccessItemQuery query, private WorkbasketAccessItemQuery getAccessIds(WorkbasketAccessItemQuery query,
MultiValueMap<String, String> params) { MultiValueMap<String, String> params) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getAccessIds(query= {}, params= {})", params);
}
if (params.containsKey(ACCESS_IDS)) { if (params.containsKey(ACCESS_IDS)) {
String[] accessIds = extractVerticalBarSeparatedFields(params.get(ACCESS_IDS)); String[] accessIds = extractVerticalBarSeparatedFields(params.get(ACCESS_IDS));
query.accessIdIn(accessIds); query.accessIdIn(accessIds);
params.remove(ACCESS_IDS); params.remove(ACCESS_IDS);
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getAccessIds(), returning {}", query);
}
return query; return query;
} }
private WorkbasketAccessItemQuery applyFilterParams(WorkbasketAccessItemQuery query, private WorkbasketAccessItemQuery applyFilterParams(WorkbasketAccessItemQuery query,
MultiValueMap<String, String> params) { MultiValueMap<String, String> params) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", params);
}
if (params.containsKey(WORKBASKET_KEY)) { if (params.containsKey(WORKBASKET_KEY)) {
String[] keys = extractCommaSeparatedFields(params.get(WORKBASKET_KEY)); String[] keys = extractCommaSeparatedFields(params.get(WORKBASKET_KEY));
query.workbasketKeyIn(keys); query.workbasketKeyIn(keys);
@ -157,12 +183,20 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
query.accessIdLike(LIKE + params.get(ACCESS_ID_LIKE).get(0) + LIKE); query.accessIdLike(LIKE + params.get(ACCESS_ID_LIKE).get(0) + LIKE);
params.remove(ACCESS_ID_LIKE); params.remove(ACCESS_ID_LIKE);
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
}
return query; return query;
} }
private WorkbasketAccessItemQuery applySortingParams(WorkbasketAccessItemQuery query, private WorkbasketAccessItemQuery applySortingParams(WorkbasketAccessItemQuery query,
MultiValueMap<String, String> params) MultiValueMap<String, String> params)
throws IllegalArgumentException { throws IllegalArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applySortingParams(query= {}, params= {})", params);
}
// sorting // sorting
String sortBy = params.getFirst(SORT_BY); String sortBy = params.getFirst(SORT_BY);
if (sortBy != null) { if (sortBy != null) {
@ -185,6 +219,10 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
} }
params.remove(SORT_BY); params.remove(SORT_BY);
params.remove(SORT_DIRECTION); params.remove(SORT_DIRECTION);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applySortingParams(), returning {}", query);
}
return query; return query;
} }

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.PagedResources; import org.springframework.hateoas.PagedResources;
import org.springframework.hateoas.PagedResources.PageMetadata; import org.springframework.hateoas.PagedResources.PageMetadata;
@ -40,6 +42,7 @@ import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.WorkbasketAlreadyExistException; import pro.taskana.exceptions.WorkbasketAlreadyExistException;
import pro.taskana.exceptions.WorkbasketInUseException; import pro.taskana.exceptions.WorkbasketInUseException;
import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.impl.util.LoggerUtils;
import pro.taskana.rest.resource.DistributionTargetResource; import pro.taskana.rest.resource.DistributionTargetResource;
import pro.taskana.rest.resource.WorkbasketAccessItemResource; import pro.taskana.rest.resource.WorkbasketAccessItemResource;
import pro.taskana.rest.resource.WorkbasketResource; import pro.taskana.rest.resource.WorkbasketResource;
@ -57,6 +60,7 @@ import pro.taskana.rest.resource.WorkbasketSummaryResourcesAssembler;
@EnableHypermediaSupport(type = HypermediaType.HAL) @EnableHypermediaSupport(type = HypermediaType.HAL)
@RequestMapping(path = "/v1/workbaskets", produces = "application/hal+json") @RequestMapping(path = "/v1/workbaskets", produces = "application/hal+json")
public class WorkbasketController extends AbstractPagingController { public class WorkbasketController extends AbstractPagingController {
private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketController.class);
private static final String LIKE = "%"; private static final String LIKE = "%";
private static final String NAME = "name"; private static final String NAME = "name";
@ -99,6 +103,9 @@ public class WorkbasketController extends AbstractPagingController {
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<PagedResources<WorkbasketSummaryResource>> getWorkbaskets( public ResponseEntity<PagedResources<WorkbasketSummaryResource>> getWorkbaskets(
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException { @RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getWorkbaskets(params= {})", params);
}
WorkbasketQuery query = workbasketService.createWorkbasketQuery(); WorkbasketQuery query = workbasketService.createWorkbasketQuery();
query = applySortingParams(query, params); query = applySortingParams(query, params);
@ -128,6 +135,10 @@ public class WorkbasketController extends AbstractPagingController {
PagedResources<WorkbasketSummaryResource> pagedResources = assembler.toResources(workbasketSummaries, PagedResources<WorkbasketSummaryResource> pagedResources = assembler.toResources(workbasketSummaries,
pageMetadata); pageMetadata);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getWorkbaskets(), returning {}", new ResponseEntity<>(pagedResources, HttpStatus.OK));
}
return new ResponseEntity<>(pagedResources, HttpStatus.OK); return new ResponseEntity<>(pagedResources, HttpStatus.OK);
} }
@ -135,9 +146,14 @@ public class WorkbasketController extends AbstractPagingController {
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<WorkbasketResource> getWorkbasket(@PathVariable(value = "workbasketId") String workbasketId) public ResponseEntity<WorkbasketResource> getWorkbasket(@PathVariable(value = "workbasketId") String workbasketId)
throws WorkbasketNotFoundException, NotAuthorizedException { throws WorkbasketNotFoundException, NotAuthorizedException {
LOGGER.debug("Entry to getWorkbasket(workbasketId= {})", workbasketId);
ResponseEntity<WorkbasketResource> result; ResponseEntity<WorkbasketResource> result;
Workbasket workbasket = workbasketService.getWorkbasket(workbasketId); Workbasket workbasket = workbasketService.getWorkbasket(workbasketId);
result = new ResponseEntity<>(workbasketResourceAssembler.toResource(workbasket), HttpStatus.OK); result = new ResponseEntity<>(workbasketResourceAssembler.toResource(workbasket), HttpStatus.OK);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getWorkbasket(), returning {}", result);
}
return result; return result;
} }
@ -146,6 +162,8 @@ public class WorkbasketController extends AbstractPagingController {
public ResponseEntity<?> markWorkbasketForDeletion(@PathVariable(value = "workbasketId") String workbasketId) public ResponseEntity<?> markWorkbasketForDeletion(@PathVariable(value = "workbasketId") String workbasketId)
throws NotAuthorizedException, InvalidArgumentException, throws NotAuthorizedException, InvalidArgumentException,
WorkbasketNotFoundException, WorkbasketInUseException { WorkbasketNotFoundException, WorkbasketInUseException {
LOGGER.debug("Entry to markWorkbasketForDeletion(workbasketId= {})", workbasketId);
LOGGER.debug("Exit from markWorkbasketForDeletion(), returning {}", new ResponseEntity<>(workbasketService.deleteWorkbasket(workbasketId), HttpStatus.ACCEPTED));
return new ResponseEntity<>(workbasketService.deleteWorkbasket(workbasketId), HttpStatus.ACCEPTED); return new ResponseEntity<>(workbasketService.deleteWorkbasket(workbasketId), HttpStatus.ACCEPTED);
} }
@ -154,8 +172,16 @@ public class WorkbasketController extends AbstractPagingController {
public ResponseEntity<WorkbasketResource> createWorkbasket(@RequestBody WorkbasketResource workbasketResource) public ResponseEntity<WorkbasketResource> createWorkbasket(@RequestBody WorkbasketResource workbasketResource)
throws InvalidWorkbasketException, NotAuthorizedException, WorkbasketAlreadyExistException, throws InvalidWorkbasketException, NotAuthorizedException, WorkbasketAlreadyExistException,
WorkbasketNotFoundException, DomainNotFoundException { WorkbasketNotFoundException, DomainNotFoundException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to createWorkbasket(workbasketResource= {})", workbasketResource);
}
Workbasket workbasket = workbasketResourceAssembler.toModel(workbasketResource); Workbasket workbasket = workbasketResourceAssembler.toModel(workbasketResource);
workbasket = workbasketService.createWorkbasket(workbasket); workbasket = workbasketService.createWorkbasket(workbasket);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from createWorkbasket(), returning {}", new ResponseEntity<>(workbasketResourceAssembler.toResource(workbasket), HttpStatus.CREATED));
}
return new ResponseEntity<>(workbasketResourceAssembler.toResource(workbasket), HttpStatus.CREATED); return new ResponseEntity<>(workbasketResourceAssembler.toResource(workbasket), HttpStatus.CREATED);
} }
@ -165,6 +191,7 @@ public class WorkbasketController extends AbstractPagingController {
@PathVariable(value = "workbasketId") String workbasketId, @PathVariable(value = "workbasketId") String workbasketId,
@RequestBody WorkbasketResource workbasketResource) @RequestBody WorkbasketResource workbasketResource)
throws InvalidWorkbasketException, WorkbasketNotFoundException, NotAuthorizedException { throws InvalidWorkbasketException, WorkbasketNotFoundException, NotAuthorizedException {
LOGGER.debug("Entry to updateWorkbasket(workbasketId= {})", workbasketId);
ResponseEntity<WorkbasketResource> result; ResponseEntity<WorkbasketResource> result;
if (workbasketId.equals(workbasketResource.workbasketId)) { if (workbasketId.equals(workbasketResource.workbasketId)) {
Workbasket workbasket = workbasketResourceAssembler.toModel(workbasketResource); Workbasket workbasket = workbasketResourceAssembler.toModel(workbasketResource);
@ -177,6 +204,10 @@ public class WorkbasketController extends AbstractPagingController {
+ workbasketResource.getId() + "')"); + workbasketResource.getId() + "')");
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from updateWorkbasket(), returning {}", result);
}
return result; return result;
} }
@ -185,13 +216,17 @@ public class WorkbasketController extends AbstractPagingController {
public ResponseEntity<Resources<WorkbasketAccessItemResource>> getWorkbasketAccessItems( public ResponseEntity<Resources<WorkbasketAccessItemResource>> getWorkbasketAccessItems(
@PathVariable(value = "workbasketId") String workbasketId) @PathVariable(value = "workbasketId") String workbasketId)
throws NotAuthorizedException, WorkbasketNotFoundException { throws NotAuthorizedException, WorkbasketNotFoundException {
LOGGER.debug("Entry to getWorkbasketAccessItems(workbasketId= {})", workbasketId);
ResponseEntity<Resources<WorkbasketAccessItemResource>> result; ResponseEntity<Resources<WorkbasketAccessItemResource>> result;
List<WorkbasketAccessItem> accessItems = workbasketService.getWorkbasketAccessItems(workbasketId); List<WorkbasketAccessItem> accessItems = workbasketService.getWorkbasketAccessItems(workbasketId);
Resources<WorkbasketAccessItemResource> accessItemListResource = accessItemListAssembler Resources<WorkbasketAccessItemResource> accessItemListResource = accessItemListAssembler
.toResource(workbasketId, accessItems); .toResource(workbasketId, accessItems);
result = new ResponseEntity<>(accessItemListResource, HttpStatus.OK); result = new ResponseEntity<>(accessItemListResource, HttpStatus.OK);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getWorkbasketAccessItems(), returning {}", result);
}
return result; return result;
} }
@ -201,6 +236,7 @@ public class WorkbasketController extends AbstractPagingController {
@PathVariable(value = "workbasketId") String workbasketId, @PathVariable(value = "workbasketId") String workbasketId,
@RequestBody List<WorkbasketAccessItemResource> workbasketAccessResourceItems) @RequestBody List<WorkbasketAccessItemResource> workbasketAccessResourceItems)
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException { throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException {
LOGGER.debug("Entry to setWorkbasketAccessItems(workbasketId= {})", workbasketId);
if (workbasketAccessResourceItems == null) { if (workbasketAccessResourceItems == null) {
throw new InvalidArgumentException("Can´t create something with NULL body-value."); throw new InvalidArgumentException("Can´t create something with NULL body-value.");
} }
@ -213,6 +249,10 @@ public class WorkbasketController extends AbstractPagingController {
Resources<WorkbasketAccessItemResource> accessItemListResource = accessItemListAssembler Resources<WorkbasketAccessItemResource> accessItemListResource = accessItemListAssembler
.toResource(workbasketId, updatedWbAccessItems); .toResource(workbasketId, updatedWbAccessItems);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from setWorkbasketAccessItems(), returning {}", new ResponseEntity<>(accessItemListResource, HttpStatus.OK));
}
return new ResponseEntity<>(accessItemListResource, HttpStatus.OK); return new ResponseEntity<>(accessItemListResource, HttpStatus.OK);
} }
@ -221,12 +261,16 @@ public class WorkbasketController extends AbstractPagingController {
public ResponseEntity<Resources<DistributionTargetResource>> getDistributionTargets( public ResponseEntity<Resources<DistributionTargetResource>> getDistributionTargets(
@PathVariable(value = "workbasketId") String workbasketId) @PathVariable(value = "workbasketId") String workbasketId)
throws WorkbasketNotFoundException, NotAuthorizedException { throws WorkbasketNotFoundException, NotAuthorizedException {
LOGGER.debug("Entry to getDistributionTargets(workbasketId= {})", workbasketId);
ResponseEntity<Resources<DistributionTargetResource>> result; ResponseEntity<Resources<DistributionTargetResource>> result;
List<WorkbasketSummary> distributionTargets = workbasketService.getDistributionTargets(workbasketId); List<WorkbasketSummary> distributionTargets = workbasketService.getDistributionTargets(workbasketId);
Resources<DistributionTargetResource> distributionTargetListResource = distributionTargetListAssembler Resources<DistributionTargetResource> distributionTargetListResource = distributionTargetListAssembler
.toResource(workbasketId, distributionTargets); .toResource(workbasketId, distributionTargets);
result = new ResponseEntity<>(distributionTargetListResource, HttpStatus.OK); result = new ResponseEntity<>(distributionTargetListResource, HttpStatus.OK);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getDistributionTargets(), returning {}", result);
}
return result; return result;
} }
@ -235,12 +279,21 @@ public class WorkbasketController extends AbstractPagingController {
public ResponseEntity<Resources<DistributionTargetResource>> setDistributionTargetsForWorkbasketId( public ResponseEntity<Resources<DistributionTargetResource>> setDistributionTargetsForWorkbasketId(
@PathVariable(value = "workbasketId") String sourceWorkbasketId, @PathVariable(value = "workbasketId") String sourceWorkbasketId,
@RequestBody List<String> targetWorkbasketIds) throws WorkbasketNotFoundException, NotAuthorizedException { @RequestBody List<String> targetWorkbasketIds) throws WorkbasketNotFoundException, NotAuthorizedException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getTasksStatusReport(workbasketId= {}, targetWorkbasketIds´= {})", sourceWorkbasketId,
LoggerUtils.listToString(targetWorkbasketIds));
}
workbasketService.setDistributionTargets(sourceWorkbasketId, targetWorkbasketIds); workbasketService.setDistributionTargets(sourceWorkbasketId, targetWorkbasketIds);
List<WorkbasketSummary> distributionTargets = workbasketService.getDistributionTargets(sourceWorkbasketId); List<WorkbasketSummary> distributionTargets = workbasketService.getDistributionTargets(sourceWorkbasketId);
Resources<DistributionTargetResource> distributionTargetListResource = distributionTargetListAssembler Resources<DistributionTargetResource> distributionTargetListResource = distributionTargetListAssembler
.toResource(sourceWorkbasketId, distributionTargets); .toResource(sourceWorkbasketId, distributionTargets);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getTasksStatusReport(), returning {}", new ResponseEntity<>(distributionTargetListResource, HttpStatus.OK));
}
return new ResponseEntity<>(distributionTargetListResource, HttpStatus.OK); return new ResponseEntity<>(distributionTargetListResource, HttpStatus.OK);
} }
@ -249,16 +302,22 @@ public class WorkbasketController extends AbstractPagingController {
public ResponseEntity<Resources<DistributionTargetResource>> removeDistributionTargetForWorkbasketId( public ResponseEntity<Resources<DistributionTargetResource>> removeDistributionTargetForWorkbasketId(
@PathVariable(value = "workbasketId") String targetWorkbasketId) @PathVariable(value = "workbasketId") String targetWorkbasketId)
throws WorkbasketNotFoundException, NotAuthorizedException { throws WorkbasketNotFoundException, NotAuthorizedException {
LOGGER.debug("Entry to removeDistributionTargetForWorkbasketId(workbasketId= {})", targetWorkbasketId);
List<WorkbasketSummary> sourceWorkbaskets = workbasketService.getDistributionSources(targetWorkbasketId); List<WorkbasketSummary> sourceWorkbaskets = workbasketService.getDistributionSources(targetWorkbasketId);
for (WorkbasketSummary source : sourceWorkbaskets) { for (WorkbasketSummary source : sourceWorkbaskets) {
workbasketService.removeDistributionTarget(source.getId(), targetWorkbasketId); workbasketService.removeDistributionTarget(source.getId(), targetWorkbasketId);
} }
LOGGER.debug("Exit from removeDistributionTargetForWorkbasketId(), returning {}", new ResponseEntity<>(HttpStatus.NO_CONTENT));
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} }
private WorkbasketQuery applySortingParams(WorkbasketQuery query, MultiValueMap<String, String> params) private WorkbasketQuery applySortingParams(WorkbasketQuery query, MultiValueMap<String, String> params)
throws IllegalArgumentException { throws IllegalArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applySortingParams(query= {}, params={})", query, params);
}
// sorting // sorting
String sortBy = params.getFirst(SORT_BY); String sortBy = params.getFirst(SORT_BY);
if (sortBy != null) { if (sortBy != null) {
@ -290,11 +349,19 @@ public class WorkbasketController extends AbstractPagingController {
} }
params.remove(SORT_BY); params.remove(SORT_BY);
params.remove(SORT_DIRECTION); params.remove(SORT_DIRECTION);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applySortingParams(), returning {}", query);
}
return query; return query;
} }
private WorkbasketQuery applyFilterParams(WorkbasketQuery query, private WorkbasketQuery applyFilterParams(WorkbasketQuery query,
MultiValueMap<String, String> params) throws InvalidArgumentException { MultiValueMap<String, String> params) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", query, params);
}
if (params.containsKey(NAME)) { if (params.containsKey(NAME)) {
String[] names = extractCommaSeparatedFields(params.get(NAME)); String[] names = extractCommaSeparatedFields(params.get(NAME));
query.nameIn(names); query.nameIn(names);
@ -409,6 +476,10 @@ public class WorkbasketController extends AbstractPagingController {
} }
params.remove(REQUIRED_PERMISSION); params.remove(REQUIRED_PERMISSION);
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
}
return query; return query;
} }

View File

@ -6,6 +6,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
@ -44,6 +46,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@RestController @RestController
@RequestMapping(path = "/v1/workbasket-definitions", produces = {MediaType.APPLICATION_JSON_VALUE}) @RequestMapping(path = "/v1/workbasket-definitions", produces = {MediaType.APPLICATION_JSON_VALUE})
public class WorkbasketDefinitionController { public class WorkbasketDefinitionController {
private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketDefinitionController.class);
@Autowired @Autowired
private WorkbasketService workbasketService; private WorkbasketService workbasketService;
@ -53,20 +56,17 @@ public class WorkbasketDefinitionController {
@GetMapping @GetMapping
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<List<WorkbasketDefinition>> exportWorkbaskets(@RequestParam(required = false) String domain) public ResponseEntity<List<WorkbasketSummary>> exportWorkbaskets(@RequestParam(required = false) String domain) {
throws NotAuthorizedException, WorkbasketNotFoundException { LOGGER.debug("Entry to exportWorkbaskets(domain= {})", domain);
WorkbasketQuery workbasketQuery = workbasketService.createWorkbasketQuery(); WorkbasketQuery workbasketQuery = workbasketService.createWorkbasketQuery();
List<WorkbasketSummary> workbasketSummaryList = domain != null List<WorkbasketSummary> workbasketSummaryList = domain != null
? workbasketQuery.domainIn(domain).list() ? workbasketQuery.domainIn(domain).list()
: workbasketQuery.list(); : workbasketQuery.list();
List<WorkbasketDefinition> basketExports = new ArrayList<>(); if(LOGGER.isDebugEnabled()) {
for (WorkbasketSummary summary : workbasketSummaryList) { LOGGER.debug("Exit from exportWorkbaskets(), returning {}", new ResponseEntity<>(workbasketSummaryList, HttpStatus.OK));
Workbasket workbasket = workbasketService.getWorkbasket(summary.getId());
basketExports.add(workbasketDefinitionAssembler.toDefinition(workbasket));
} }
return new ResponseEntity<>(basketExports, HttpStatus.OK);
return new ResponseEntity<>(workbasketSummaryList, HttpStatus.OK);
} }
/** /**
@ -83,7 +83,7 @@ public class WorkbasketDefinitionController {
public ResponseEntity<String> importWorkbaskets(@RequestParam("file") MultipartFile file) public ResponseEntity<String> importWorkbaskets(@RequestParam("file") MultipartFile file)
throws IOException, NotAuthorizedException, DomainNotFoundException, InvalidWorkbasketException, throws IOException, NotAuthorizedException, DomainNotFoundException, InvalidWorkbasketException,
WorkbasketAlreadyExistException, WorkbasketNotFoundException, InvalidArgumentException { WorkbasketAlreadyExistException, WorkbasketNotFoundException, InvalidArgumentException {
LOGGER.debug("Entry to importWorkbaskets()");
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
List<WorkbasketDefinition> definitions = mapper.readValue(file.getInputStream(), List<WorkbasketDefinition> definitions = mapper.readValue(file.getInputStream(),
@ -141,9 +141,9 @@ public class WorkbasketDefinitionController {
workbasketService.setDistributionTargets( workbasketService.setDistributionTargets(
// no verification necessary since the workbasket was already imported in step 1. // no verification necessary since the workbasket was already imported in step 1.
idConversion.get(definition.workbasket.getWorkbasketId()), distributionTargets); idConversion.get(definition.workbasket.getWorkbasketId()), distributionTargets);
} }
LOGGER.debug("Exit from importWorkbaskets(), returning {}", new ResponseEntity<>(HttpStatus.OK));
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
private String logicalId(WorkbasketSummary workbasket) { private String logicalId(WorkbasketSummary workbasket) {

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
@ -13,12 +15,14 @@ import pro.taskana.TaskService;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.TaskSummary; import pro.taskana.TaskSummary;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.impl.util.LoggerUtils;
/** /**
* TODO. * TODO.
*/ */
@Component @Component
public class TaskFilter { public class TaskFilter {
private static final Logger LOGGER = LoggerFactory.getLogger(TaskFilter.class);
private static final String CLASSIFICATION = "classification"; private static final String CLASSIFICATION = "classification";
private static final String POR = "por"; private static final String POR = "por";
@ -56,6 +60,10 @@ public class TaskFilter {
public List<TaskSummary> inspectParams(MultiValueMap<String, String> params) public List<TaskSummary> inspectParams(MultiValueMap<String, String> params)
throws InvalidArgumentException { throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to inspectParams(params= {})", params);
}
TaskQuery taskQuery = taskService.createTaskQuery(); TaskQuery taskQuery = taskService.createTaskQuery();
// apply filters // apply filters
@ -116,6 +124,11 @@ public class TaskFilter {
if (params.containsKey(IS_TRANSFERRED)) { if (params.containsKey(IS_TRANSFERRED)) {
taskQuery.transferredEquals(Boolean.getBoolean(params.get(IS_TRANSFERRED).get(0))); taskQuery.transferredEquals(Boolean.getBoolean(params.get(IS_TRANSFERRED).get(0)));
} }
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from inspectParams(), returning {}", LoggerUtils.listToString(taskQuery.list()));
}
return taskQuery.list(); return taskQuery.list();
} }
@ -134,6 +147,10 @@ public class TaskFilter {
} }
private TaskState[] extractStates(MultiValueMap<String, String> params) throws InvalidArgumentException { private TaskState[] extractStates(MultiValueMap<String, String> params) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to extractStates(params= {})", params);
}
List<TaskState> states = new ArrayList<>(); List<TaskState> states = new ArrayList<>();
for (String item : params.get(STATE)) { for (String item : params.get(STATE)) {
for (String state : item.split(COMMA)) { for (String state : item.split(COMMA)) {
@ -152,6 +169,7 @@ public class TaskFilter {
} }
} }
} }
LOGGER.debug("Exit from extractStates()");
return states.toArray(new TaskState[0]); return states.toArray(new TaskState[0]);
} }
} }

View File

@ -37,13 +37,10 @@ public class AccessIdResource {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "AccessIdResource [" +
builder.append("AccessIdResource [name="); "name=" + this.name +
builder.append(name); ", accessId=" + this.accessId +
builder.append(", accessId="); "]";
builder.append(accessId);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -93,4 +93,18 @@ public class AttachmentResource extends ResourceSupport {
public void setCustomAttributes(Map<String, String> customAttributes) { public void setCustomAttributes(Map<String, String> customAttributes) {
this.customAttributes = customAttributes; this.customAttributes = customAttributes;
} }
@Override
public String toString() {
return "AttachmentResource ["
+ "attachmentId= " + this.attachmentId
+ "taskId= " + this.taskId
+ "created= " + this.created
+ "modified= " + this.modified
+ "classificationSummaryResource= " + this.classificationSummaryResource
+ "objectReference= " + this.objectReference
+ "channel= " + this.channel
+ "received= " + this.received
+ "]";
}
} }

View File

@ -80,4 +80,18 @@ public class AttachmentSummaryResource extends ResourceSupport {
public void setReceived(String received) { public void setReceived(String received) {
this.received = received; this.received = received;
} }
@Override
public String toString() {
return "AttachmentSummaryResource ["
+ "attachmentId= " + this.attachmentId
+ "taskId= " + this.taskId
+ "created= " + this.created
+ "modified= " + this.modified
+ "classificationSummaryResource= " + this.classificationSummaryResource
+ "objectReference= " + this.objectReference
+ "channel= " + this.channel
+ "received= " + this.received
+ "]";
}
} }

View File

@ -217,54 +217,30 @@ public class ClassificationResource extends ResourceSupport {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "ClassificationResource [" +
builder.append("ClassificationResource [classificationId="); "classificationId=" + this.classificationId +
builder.append(classificationId); ", key=" + this.key +
builder.append(", key="); ", parentId=" + this.parentId +
builder.append(key); ", parentKey=" + this.parentKey +
builder.append(", parentId="); ", category=" + this.category +
builder.append(parentId); ", type=" + this.type +
builder.append(", parentKey="); ", domain=" + this.domain +
builder.append(parentKey); ", isValidInDomain=" + this.isValidInDomain +
builder.append(", category="); ", created=" + this.created +
builder.append(category); ", modified=" + this.modified +
builder.append(", type="); ", name=" + this.name +
builder.append(type); ", description=" + this.description +
builder.append(", domain="); ", priority=" + this.priority +
builder.append(domain); ", serviceLevel=" + this.serviceLevel +
builder.append(", isValidInDomain="); ", applicationEntryPoint=" + this.applicationEntryPoint +
builder.append(isValidInDomain); ", custom1=" + this.custom1 +
builder.append(", created="); ", custom2=" + this.custom2 +
builder.append(created); ", custom3=" + this.custom3 +
builder.append(", modified="); ", custom4=" + this.custom4 +
builder.append(modified); ", custom5=" + this.custom5 +
builder.append(", name="); ", custom6=" + this.custom6 +
builder.append(name); ", custom7=" + this.custom7 +
builder.append(", description="); ", custom8=" + this.custom8 +
builder.append(description); "]";
builder.append(", priority=");
builder.append(priority);
builder.append(", serviceLevel=");
builder.append(serviceLevel);
builder.append(", applicationEntryPoint=");
builder.append(applicationEntryPoint);
builder.append(", custom1=");
builder.append(custom1);
builder.append(", custom2=");
builder.append(custom2);
builder.append(", custom3=");
builder.append(custom3);
builder.append(", custom4=");
builder.append(custom4);
builder.append(", custom5=");
builder.append(custom5);
builder.append(", custom6=");
builder.append(custom6);
builder.append(", custom7=");
builder.append(custom7);
builder.append(", custom8=");
builder.append(custom8);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -161,4 +161,18 @@ public class ClassificationSummaryResource extends ResourceSupport {
this.custom8 = custom8; this.custom8 = custom8;
} }
@Override
public String toString() {
return "ClassificationSummaryResource ["
+ "classificationId= " + this.classificationId
+ "key= " + this.key
+ "parentId= " + this.parentId
+ "parentKey= " + this.parentKey
+ "type= " + this.type
+ "domain= " + this.domain
+ "name= " + this.name
+ "priority= " + this.priority
+ "]";
}
} }

View File

@ -4,6 +4,8 @@ import java.util.Map;
import org.springframework.hateoas.ResourceSupport; import org.springframework.hateoas.ResourceSupport;
import pro.taskana.impl.util.LoggerUtils;
/** /**
* Resource class for {@link pro.taskana.report.Report}. * Resource class for {@link pro.taskana.report.Report}.
*/ */
@ -71,6 +73,16 @@ public class ReportResource extends ResourceSupport {
public String getRowDesc() { public String getRowDesc() {
return rowDesc; return rowDesc;
} }
@Override
public String toString() {
return "MetaInformation ["
+ "name= " + this.name
+ "date= " + this.date
+ "header= " + this.header
+ "rowDesc= " + this.rowDesc
+ "]";
}
} }
/** /**
@ -93,5 +105,13 @@ public class ReportResource extends ResourceSupport {
public int getTotal() { public int getTotal() {
return total; return total;
} }
@Override
public String toString() {
return "RowResource ["
+ "rowDesc= " + LoggerUtils.mapToString(this.cells)
+ "taskId= " + this.total
+ "]";
}
} }
} }

View File

@ -385,6 +385,25 @@ public class TaskResource extends ResourceSupport {
this.custom16 = custom16; this.custom16 = custom16;
} }
@Override
public String toString() {
return "TaskResource ["
+ "taskId= " + this.taskId
+ "externalId= " + this.externalId
+ "created= " + this.created
+ "modified= " + this.modified
+ "claimed= " + this.claimed
+ "completed= " + this.completed
+ "planned= " + this.planned
+ "due= " + this.due
+ "name= " + this.name
+ "creator= " + this.creator
+ "description= " + this.description
+ "priority= " + this.priority
+ "owner= " + this.owner
+ "]";
}
/** /**
* A CustomAttribute is a user customized attribute which is saved as a Map and can be retreived from * A CustomAttribute is a user customized attribute which is saved as a Map and can be retreived from
* either {@link pro.taskana.Task#getCustomAttributes()} or {@link pro.taskana.Task#getCallbackInfo()}. * either {@link pro.taskana.Task#getCustomAttributes()} or {@link pro.taskana.Task#getCallbackInfo()}.
@ -412,5 +431,13 @@ public class TaskResource extends ResourceSupport {
public String getValue() { public String getValue() {
return value; return value;
} }
@Override
public String toString() {
return "CustomAttribute ["
+ "key= " + this.key
+ "value= " + this.value
+ "]";
}
} }
} }

View File

@ -378,4 +378,23 @@ public class TaskSummaryResource extends ResourceSupport {
public void setCustom16(String custom16) { public void setCustom16(String custom16) {
this.custom16 = custom16; this.custom16 = custom16;
} }
@Override
public String toString() {
return "TaskSummaryResource ["
+ "taskId= " + this.taskId
+ "externalId= " + this.externalId
+ "created= " + this.created
+ "modified= " + this.modified
+ "claimed= " + this.claimed
+ "completed= " + this.completed
+ "planned= " + this.planned
+ "due= " + this.due
+ "name= " + this.name
+ "creator= " + this.creator
+ "description= " + this.description
+ "priority= " + this.priority
+ "owner= " + this.owner
+ "]";
}
} }

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.springframework.hateoas.ResourceSupport; import org.springframework.hateoas.ResourceSupport;
import pro.taskana.TaskanaRole; import pro.taskana.TaskanaRole;
import pro.taskana.impl.util.LoggerUtils;
/** /**
* Resource class for user information. * Resource class for user information.
@ -40,4 +41,12 @@ public class TaskanaUserInfoResource extends ResourceSupport {
this.roles = roles; this.roles = roles;
} }
@Override
public String toString() {
return "TaskanaUserInfoResource ["
+ "userId= " + this.userId
+ "groupIds= " + LoggerUtils.listToString(this.groupIds)
+ "roles= " + LoggerUtils.listToString(this.roles)
+ "]";
}
} }

View File

@ -16,4 +16,9 @@ public class VersionResource extends ResourceSupport {
public void setVersion(String version) { public void setVersion(String version) {
this.version = version; this.version = version;
} }
@Override
public String toString() {
return "VersionResource [" + "version= " + this.version + "]";
}
} }

View File

@ -217,4 +217,15 @@ public class WorkbasketAccessItemResource extends ResourceSupport {
public void setPermCustom12(boolean permCustom12) { public void setPermCustom12(boolean permCustom12) {
this.permCustom12 = permCustom12; this.permCustom12 = permCustom12;
} }
@Override
public String toString() {
return "WorkbasketAccessItemResource ["
+ "accessItemId= " + this.accessItemId
+ "workbasketId= " + this.workbasketId
+ "workbasketKey= " + this.workbasketKey
+ "accessId= " + this.accessId
+ "accessName= " + this.accessName
+ "]";
}
} }

View File

@ -5,6 +5,7 @@ import java.util.Set;
import pro.taskana.Workbasket; import pro.taskana.Workbasket;
import pro.taskana.WorkbasketAccessItem; import pro.taskana.WorkbasketAccessItem;
import pro.taskana.impl.util.LoggerUtils;
/** /**
* this class represents a workbasket including its distro targets and authorisations. * this class represents a workbasket including its distro targets and authorisations.
@ -27,4 +28,13 @@ public class WorkbasketDefinition {
this.distributionTargets = distributionTargets; this.distributionTargets = distributionTargets;
this.authorizations = authorizations; this.authorizations = authorizations;
} }
@Override
public String toString() {
return "WorkbasketDefinition ["
+ "distributionTargets= " + LoggerUtils.setToString(this.distributionTargets)
+ "authorizations= " + LoggerUtils.listToString(this.authorizations)
+ "workbasket= " + this.workbasket
+ "]";
}
} }

View File

@ -173,4 +173,16 @@ public class WorkbasketResource extends ResourceSupport {
public void setOrgLevel4(String orgLevel4) { public void setOrgLevel4(String orgLevel4) {
this.orgLevel4 = orgLevel4; this.orgLevel4 = orgLevel4;
} }
@Override
public String toString() {
return "WorkbasketResource ["
+ "workbasketId= " + this.workbasketId
+ "key= " + this.key
+ "name= " + this.name
+ "domain= " + this.domain
+ "type= " + this.type
+ "owner= " + this.owner
+ "]";
}
} }

View File

@ -166,4 +166,16 @@ public class WorkbasketSummaryResource extends ResourceSupport {
public void setMarkedForDeletion(boolean markedForDeletion) { public void setMarkedForDeletion(boolean markedForDeletion) {
this.markedForDeletion = markedForDeletion; this.markedForDeletion = markedForDeletion;
} }
@Override
public String toString() {
return "WorkbasketSummaryResource ["
+ "workbasketId= " + this.workbasketId
+ "key= " + this.key
+ "name= " + this.name
+ "domain= " + this.domain
+ "type= " + this.type
+ "owner= " + this.owner
+ "]";
}
} }

View File

@ -50,12 +50,9 @@ public class DistributionTargetDeserializer extends StdDeserializer<List<Workbas
try { try {
distributionTargets.add(workbasketService.getWorkbasket(id)); distributionTargets.add(workbasketService.getWorkbasket(id));
} catch (WorkbasketNotFoundException e) { } catch (WorkbasketNotFoundException e) {
LOGGER.error("The workbasket with the id '" + id + "' is not found in database."); LOGGER.error("The workbasket with the id ' {} ' is not found in database.", id);
} catch (NotAuthorizedException e) { } catch (NotAuthorizedException e) {
LOGGER.error( LOGGER.error("The user misses some required permissions for the workbasket with ID ' {} '. Exception = {}.", id, e);
"The user misses some required permissions for the workbasket with ID '" + id
+ "'. Exception = {}.",
e);
} }
} }
return distributionTargets; return distributionTargets;