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.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.
*
@ -127,6 +129,10 @@ public class BulkOperationResults<K, V> {
}
return bulkLogMapped;
}
@Override
public String toString() {
return "BulkOperationResults [BulkOperationResults= " + LoggerUtils.mapToString(this.errorMap) + "]";
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -326,4 +326,14 @@ public final class DaysToWorkingDaysConverter {
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) {
LOGGER.debug("entry to initializeJobDefault(job = {})", job);
job.setCreated(Instant.now());
job.setState(ScheduledJob.State.READY);
job.setPriority(JOB_DEFAULT_PRIORITY);

View File

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

View File

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

View File

@ -721,91 +721,49 @@ public class TaskImpl implements Task {
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("TaskImpl [id=");
builder.append(id);
builder.append(", externalId=");
builder.append(externalId);
builder.append(", created=");
builder.append(created);
builder.append(", claimed=");
builder.append(claimed);
builder.append(", completed=");
builder.append(completed);
builder.append(", modified=");
builder.append(modified);
builder.append(", planned=");
builder.append(planned);
builder.append(", due=");
builder.append(due);
builder.append(", name=");
builder.append(name);
builder.append(", creator=");
builder.append(creator);
builder.append(", description=");
builder.append(description);
builder.append(", note=");
builder.append(note);
builder.append(", priority=");
builder.append(priority);
builder.append(", state=");
builder.append(state);
builder.append(", classificationSummary=");
builder.append(classificationSummary);
builder.append(", workbasketSummary=");
builder.append(workbasketSummary);
builder.append(", businessProcessId=");
builder.append(businessProcessId);
builder.append(", parentBusinessProcessId=");
builder.append(parentBusinessProcessId);
builder.append(", owner=");
builder.append(owner);
builder.append(", primaryObjRef=");
builder.append(primaryObjRef);
builder.append(", isRead=");
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();
return "TaskImpl [" +
"id= " + this.id +
", externalId= " + this.externalId +
", created= " + this.created +
", claimed= " + this.claimed +
", completed= " + this.completed +
", modified= " + this.modified +
", planned= " + this.planned +
", due= " + this.due +
", name= " + this.name +
", creator= " + this.creator +
", description= " + this.description +
", note= " + this.note +
", priority= " + this.priority +
", state= " + this.state +
", classificationSummary= " + this.classificationSummary +
", workbasketSummary= " + this.workbasketSummary +
", businessProcessId= " + this.businessProcessId +
", parentBusinessProcessId= " + this.parentBusinessProcessId +
", owner= " + this.owner +
", primaryObjRef= " + this.primaryObjRef +
", isRead= " + this.isRead +
", isTransferred= " + this.isTransferred +
", customAttributes= " + this.customAttributes +
", callbackInfo= " + this.callbackInfo +
", attachments= " + this.attachments +
", 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 +
"]";
}
@Override

View File

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

View File

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

View File

@ -590,85 +590,46 @@ public class TaskSummaryImpl implements TaskSummary {
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("TaskSummaryImpl [taskId=");
builder.append(taskId);
builder.append(", externalId=");
builder.append(externalId);
builder.append(", created=");
builder.append(created);
builder.append(", claimed=");
builder.append(claimed);
builder.append(", completed=");
builder.append(completed);
builder.append(", modified=");
builder.append(modified);
builder.append(", planned=");
builder.append(planned);
builder.append(", due=");
builder.append(due);
builder.append(", name=");
builder.append(name);
builder.append(", creator=");
builder.append(creator);
builder.append(", note=");
builder.append(note);
builder.append(", priority=");
builder.append(priority);
builder.append(", state=");
builder.append(state);
builder.append(", classificationSummary=");
builder.append(classificationSummary);
builder.append(", workbasketSummary=");
builder.append(workbasketSummary);
builder.append(", businessProcessId=");
builder.append(businessProcessId);
builder.append(", parentBusinessProcessId=");
builder.append(parentBusinessProcessId);
builder.append(", owner=");
builder.append(owner);
builder.append(", primaryObjRef=");
builder.append(primaryObjRef);
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();
return "TaskSummaryImpl [" +
"taskId=" + this.taskId +
", externalId=" + this.externalId +
", created=" + this.created +
", claimed=" + this.claimed +
", completed=" + this.completed +
", modified=" + this.modified +
", planned=" + this.planned +
", due=" + this.due +
", name=" + this.name +
", creator=" + this.creator +
", note=" + this.note +
", priority=" + this.priority +
", state=" + this.state +
", classificationSummary=" + this.classificationSummary +
", workbasketSummary=" + this.workbasketSummary +
", businessProcessId=" + this.businessProcessId +
", parentBusinessProcessId=" + this.parentBusinessProcessId +
", owner=" + this.owner +
", primaryObjRef=" + this.primaryObjRef +
", isRead=" + this.isRead +
", isTransferred=" + this.isTransferred +
", attachmentSummaries=" + this.attachmentSummaries +
", 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

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

View File

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

View File

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

View File

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

View File

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

View File

@ -400,9 +400,8 @@ public class WorkbasketServiceImpl implements WorkbasketService {
} finally {
taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size();
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)
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);

View File

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

View File

@ -37,7 +37,10 @@ public class CombinedClassificationFilter {
@Override
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;
}
@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.Map;
import pro.taskana.impl.util.LoggerUtils;
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;
}
@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() {
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
public String getDisplayName() {
return state.name();
return this.state.name();
}
@Override
public boolean fits(TaskQueryItem item) {
return item.getState() == state;
return item.getState() == this.state;
}
@Override

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -244,4 +244,23 @@ public class TaskHistoryEventResource extends ResourceSupport {
public void setNewData(String 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 ScriptRunner runner;
DataSource dataSource;
public SampleDataGenerator(DataSource dataSource) throws SQLException {

View File

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

View File

@ -2,24 +2,27 @@ package pro.taskana.rest.models;
public class User {
private String username;
private String password;
private String username;
private String password;
public String getUsername() {
return username;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPassword() {
return 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;
LOGGER.info("About to sleep for " + delay / 1000
+ " seconds to give JobScheduler a chance to process the classification change");
LOGGER.info("About to sleep for {} seconds to give JobScheduler a chance to process the classification change", delay / 1000);
Thread.sleep(delay);
LOGGER.info("Sleeping ended. Continuing .... ");

View File

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

View File

@ -56,7 +56,7 @@ public class LdapClient {
@PostConstruct
private void init() {
LOGGER.debug("Entry to init()");
String strMinSearchForLength = getMinSearchForLengthAsString();
if (strMinSearchForLength == null || strMinSearchForLength.isEmpty()) {
minSearchForLength = 3;
@ -126,6 +126,7 @@ public class LdapClient {
}
active = true;
}
LOGGER.debug("Exit from init()");
}
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.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.config.EnableHypermediaSupport;
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")
public class AccessIdController {
private static final Logger LOGGER = LoggerFactory.getLogger(AccessIdController.class);
@Autowired
LdapClient ldapClient;
@ -36,6 +40,7 @@ public class AccessIdController {
@GetMapping
public ResponseEntity<List<AccessIdResource>> validateAccessIds(
@RequestParam("search-for") String searchFor) throws InvalidArgumentException {
LOGGER.debug("Entry to validateAccessIds(search-for= {})", searchFor);
if (searchFor.length() < ldapClient.getMinSearchForLength()) {
throw new InvalidArgumentException(
"searchFor string '" + searchFor + "' is too short. Minimum searchFor length = "
@ -43,12 +48,23 @@ public class AccessIdController {
}
if (ldapClient.useLdap()) {
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);
} 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<>(
ldapCache.findMatchingAccessId(searchFor, ldapClient.getMaxNumberOfReturnedAccessIds()),
HttpStatus.OK);
} else {
LOGGER.debug("Exit from validateAccessIds(), returning {}", 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")
public ResponseEntity<List<AccessIdResource>> getGroupsByAccessId(
@RequestParam("access-id") String accessId) throws InvalidArgumentException {
LOGGER.debug("Entry to getGroupsByAccessId(access-id= {})", accessId);
if (ldapClient.useLdap() || ldapCache != null) {
if (!validateAccessId(accessId)) {
throw new InvalidArgumentException("The accessId is invalid");
@ -65,11 +82,20 @@ public class AccessIdController {
if (ldapClient.useLdap()) {
accessIdUsers = ldapClient.searchUsersAndGroups(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);
} else if (ldapCache != null) {
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);
} else {
LOGGER.debug("Exit from getGroupsByAccessId(), returning {}", 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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.PagedResources;
import org.springframework.hateoas.PagedResources.PageMetadata;
@ -34,8 +36,8 @@ import pro.taskana.exceptions.DomainNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.rest.resource.ClassificationResource;
import pro.taskana.rest.resource.ClassificationSummaryResource;
import pro.taskana.rest.resource.ClassificationResourceAssembler;
import pro.taskana.rest.resource.ClassificationSummaryResource;
import pro.taskana.rest.resource.ClassificationSummaryResourcesAssembler;
/**
@ -46,6 +48,8 @@ import pro.taskana.rest.resource.ClassificationSummaryResourcesAssembler;
@RequestMapping(path = "/v1/classifications", produces = "application/hal+json")
public class ClassificationController extends AbstractPagingController {
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationController.class);
private static final String LIKE = "%";
private static final String NAME = "name";
private static final String NAME_LIKE = "name-like";
@ -78,6 +82,9 @@ public class ClassificationController extends AbstractPagingController {
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<PagedResources<ClassificationSummaryResource>> getClassifications(
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getClassifications(params= {})", params);
}
ClassificationQuery query = classificationService.createClassificationQuery();
query = applySortingParams(query, params);
@ -107,6 +114,10 @@ public class ClassificationController extends AbstractPagingController {
PagedResources<ClassificationSummaryResource> pagedResources = assembler.toResources(classificationSummaries,
pageMetadata);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getClassifications(), returning {}", 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)
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationAlreadyExistException,
ConcurrencyException, DomainNotFoundException, InvalidArgumentException {
LOGGER.debug("Entry to getClassification(classificationId= {})", 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));
}
@ -125,8 +141,17 @@ public class ClassificationController extends AbstractPagingController {
@RequestBody ClassificationResource resource)
throws NotAuthorizedException, ClassificationNotFoundException, ClassificationAlreadyExistException,
ConcurrencyException, DomainNotFoundException, InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to createClassification(resource= {})", resource);
}
Classification classification = classificationResourceAssembler.toModel(resource);
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)
.body(classificationResourceAssembler.toResource(classification));
}
@ -137,6 +162,9 @@ public class ClassificationController extends AbstractPagingController {
@PathVariable(value = "classificationId") String classificationId, @RequestBody ClassificationResource resource)
throws NotAuthorizedException, ClassificationNotFoundException, ConcurrencyException,
ClassificationAlreadyExistException, DomainNotFoundException, InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to updateClassification(classificationId= {}, resource= {})", classificationId, resource);
}
ResponseEntity<ClassificationResource> result;
if (classificationId.equals(resource.classificationId)) {
@ -149,6 +177,10 @@ public class ClassificationController extends AbstractPagingController {
+ "') of the URI is not identical with the classificationId ('"
+ resource.getClassificationId() + "') of the object in the payload.");
}
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from updateClassification(), returning {}", result);
}
return result;
}
@ -156,12 +188,18 @@ public class ClassificationController extends AbstractPagingController {
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<?> deleteClassification(@PathVariable String classificationId)
throws ClassificationNotFoundException, ClassificationInUseException, NotAuthorizedException {
LOGGER.debug("Entry to deleteClassification(classificationId= {})", classificationId);
classificationService.deleteClassification(classificationId);
LOGGER.debug("Exit from deleteClassification(), returning {}", ResponseEntity.status(HttpStatus.NO_CONTENT).build());
return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
}
private ClassificationQuery applySortingParams(ClassificationQuery query, MultiValueMap<String, String> params)
throws IllegalArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applySortingParams(query= {}, params= {})", query, params);
}
// sorting
String sortBy = params.getFirst(SORT_BY);
if (sortBy != null) {
@ -190,11 +228,19 @@ public class ClassificationController extends AbstractPagingController {
}
params.remove(SORT_BY);
params.remove(SORT_DIRECTION);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applySortingParams(), returning {}", query);
}
return query;
}
private ClassificationQuery applyFilterParams(ClassificationQuery query,
MultiValueMap<String, String> params) throws InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", query, params);
}
if (params.containsKey(NAME)) {
String[] names = extractCommaSeparatedFields(params.get(NAME));
query.nameIn(names);
@ -256,6 +302,11 @@ public class ClassificationController extends AbstractPagingController {
query.customAttributeLike("8", LIKE + params.get(CUSTOM_8_LIKE).get(0) + LIKE);
params.remove(CUSTOM_8_LIKE);
}
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
}
return query;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -128,9 +128,7 @@ public class TaskanaRestExceptionHandler extends ResponseEntityExceptionHandler
}
private void logError(Exception ex, TaskanaErrorData errorData) {
LOGGER.error(
"Error occured during processing of rest request:\n" + errorData.toString(),
ex);
LOGGER.error("Error occurred 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.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.PagedResources;
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")
public class WorkbasketAccessItemController extends AbstractPagingController {
private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketAccessItemController.class);
private static final String LIKE = "%";
private static final String WORKBASKET_KEY = "workbasket-key";
private static final String WORKBASKET_KEY_LIKE = "workbasket-key-like";
@ -65,6 +69,9 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
public ResponseEntity<PagedResources<WorkbasketAccessItemResource>> getWorkbasketAccessItems(
@RequestParam MultiValueMap<String, String> params)
throws NotAuthorizedException, InvalidArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getWorkbasketAccessItems(params= {})", params);
}
WorkbasketAccessItemQuery query = workbasketService.createWorkbasketAccessItemQuery();
query = getAccessIds(query, params);
@ -96,6 +103,10 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
workbasketAccessItems,
pageMetadata);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getWorkbasketAccessItems(), returning {}", new ResponseEntity<>(pagedResources, HttpStatus.OK));
}
return new ResponseEntity<>(pagedResources, HttpStatus.OK);
}
@ -111,6 +122,7 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
public ResponseEntity<Void> removeWorkbasketAccessItems(
@RequestParam("access-id") String accessId)
throws NotAuthorizedException, InvalidArgumentException {
LOGGER.debug("Entry to removeWorkbasketAccessItems(access-id= {})", accessId);
if (!ldapClient.isGroup(accessId)) {
List<WorkbasketAccessItem> workbasketAccessItemList = workbasketService.createWorkbasketAccessItemQuery()
.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");
}
LOGGER.debug("Exit from removeWorkbasketAccessItems(), returning {}", ResponseEntity.status(HttpStatus.NO_CONTENT).build());
return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
}
private WorkbasketAccessItemQuery getAccessIds(WorkbasketAccessItemQuery query,
MultiValueMap<String, String> params) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getAccessIds(query= {}, params= {})", params);
}
if (params.containsKey(ACCESS_IDS)) {
String[] accessIds = extractVerticalBarSeparatedFields(params.get(ACCESS_IDS));
query.accessIdIn(accessIds);
params.remove(ACCESS_IDS);
}
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from getAccessIds(), returning {}", query);
}
return query;
}
private WorkbasketAccessItemQuery applyFilterParams(WorkbasketAccessItemQuery query,
MultiValueMap<String, String> params) {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", params);
}
if (params.containsKey(WORKBASKET_KEY)) {
String[] keys = extractCommaSeparatedFields(params.get(WORKBASKET_KEY));
query.workbasketKeyIn(keys);
@ -157,12 +183,20 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
query.accessIdLike(LIKE + params.get(ACCESS_ID_LIKE).get(0) + LIKE);
params.remove(ACCESS_ID_LIKE);
}
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
}
return query;
}
private WorkbasketAccessItemQuery applySortingParams(WorkbasketAccessItemQuery query,
MultiValueMap<String, String> params)
throws IllegalArgumentException {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to applySortingParams(query= {}, params= {})", params);
}
// sorting
String sortBy = params.getFirst(SORT_BY);
if (sortBy != null) {
@ -185,6 +219,10 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
}
params.remove(SORT_BY);
params.remove(SORT_DIRECTION);
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Exit from applySortingParams(), returning {}", query);
}
return query;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -93,4 +93,18 @@ public class AttachmentResource extends ResourceSupport {
public void setCustomAttributes(Map<String, String> 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) {
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
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ClassificationResource [classificationId=");
builder.append(classificationId);
builder.append(", key=");
builder.append(key);
builder.append(", parentId=");
builder.append(parentId);
builder.append(", parentKey=");
builder.append(parentKey);
builder.append(", category=");
builder.append(category);
builder.append(", type=");
builder.append(type);
builder.append(", domain=");
builder.append(domain);
builder.append(", isValidInDomain=");
builder.append(isValidInDomain);
builder.append(", created=");
builder.append(created);
builder.append(", modified=");
builder.append(modified);
builder.append(", name=");
builder.append(name);
builder.append(", description=");
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();
return "ClassificationResource [" +
"classificationId=" + this.classificationId +
", key=" + this.key +
", parentId=" + this.parentId +
", parentKey=" + this.parentKey +
", category=" + this.category +
", type=" + this.type +
", domain=" + this.domain +
", isValidInDomain=" + this.isValidInDomain +
", created=" + this.created +
", modified=" + this.modified +
", name=" + this.name +
", description=" + this.description +
", priority=" + this.priority +
", serviceLevel=" + this.serviceLevel +
", applicationEntryPoint=" + this.applicationEntryPoint +
", custom1=" + this.custom1 +
", custom2=" + this.custom2 +
", custom3=" + this.custom3 +
", custom4=" + this.custom4 +
", custom5=" + this.custom5 +
", custom6=" + this.custom6 +
", custom7=" + this.custom7 +
", custom8=" + this.custom8 +
"]";
}
}

View File

@ -161,4 +161,18 @@ public class ClassificationSummaryResource extends ResourceSupport {
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 pro.taskana.impl.util.LoggerUtils;
/**
* Resource class for {@link pro.taskana.report.Report}.
*/
@ -71,6 +73,16 @@ public class ReportResource extends ResourceSupport {
public String getRowDesc() {
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() {
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;
}
@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
* either {@link pro.taskana.Task#getCustomAttributes()} or {@link pro.taskana.Task#getCallbackInfo()}.
@ -412,5 +431,13 @@ public class TaskResource extends ResourceSupport {
public String getValue() {
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) {
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 pro.taskana.TaskanaRole;
import pro.taskana.impl.util.LoggerUtils;
/**
* Resource class for user information.
@ -40,4 +41,12 @@ public class TaskanaUserInfoResource extends ResourceSupport {
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) {
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) {
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.WorkbasketAccessItem;
import pro.taskana.impl.util.LoggerUtils;
/**
* this class represents a workbasket including its distro targets and authorisations.
@ -27,4 +28,13 @@ public class WorkbasketDefinition {
this.distributionTargets = distributionTargets;
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) {
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) {
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 {
distributionTargets.add(workbasketService.getWorkbasket(id));
} 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) {
LOGGER.error(
"The user misses some required permissions for the workbasket with ID '" + id
+ "'. Exception = {}.",
e);
LOGGER.error("The user misses some required permissions for the workbasket with ID ' {} '. Exception = {}.", id, e);
}
}
return distributionTargets;