TSK-637: Initialized return values to empty lists
This commit is contained in:
parent
55cd5916c9
commit
d44e88b6cc
|
@ -117,6 +117,9 @@ public class AttachmentImpl implements Attachment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getCustomAttributes() {
|
public Map<String, String> getCustomAttributes() {
|
||||||
|
if (customAttributes == null) {
|
||||||
|
customAttributes = new HashMap<>();
|
||||||
|
}
|
||||||
return customAttributes;
|
return customAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -374,7 +374,7 @@ public class ClassificationQueryImpl implements ClassificationQuery {
|
||||||
@Override
|
@Override
|
||||||
public List<ClassificationSummary> list() {
|
public List<ClassificationSummary> list() {
|
||||||
LOGGER.debug("entry to list(), this = {}", this);
|
LOGGER.debug("entry to list(), this = {}", this);
|
||||||
List<ClassificationSummary> result = null;
|
List<ClassificationSummary> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
result = taskanaEngine.getSqlSession().selectList(LINK_TO_SUMMARYMAPPER, this);
|
result = taskanaEngine.getSqlSession().selectList(LINK_TO_SUMMARYMAPPER, this);
|
||||||
|
@ -392,7 +392,7 @@ public class ClassificationQueryImpl implements ClassificationQuery {
|
||||||
@Override
|
@Override
|
||||||
public List<ClassificationSummary> list(int offset, int limit) {
|
public List<ClassificationSummary> list(int offset, int limit) {
|
||||||
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
||||||
List<ClassificationSummary> result = null;
|
List<ClassificationSummary> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
RowBounds rowBounds = new RowBounds(offset, limit);
|
RowBounds rowBounds = new RowBounds(offset, limit);
|
||||||
|
@ -421,7 +421,7 @@ public class ClassificationQueryImpl implements ClassificationQuery {
|
||||||
@Override
|
@Override
|
||||||
public List<String> listValues(String columnName, SortDirection sortDirection) {
|
public List<String> listValues(String columnName, SortDirection sortDirection) {
|
||||||
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
||||||
List<String> result = null;
|
List<String> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
|
||||||
@Override
|
@Override
|
||||||
public List<ObjectReference> list() {
|
public List<ObjectReference> list() {
|
||||||
LOGGER.debug("entry to list(), this = {}", this);
|
LOGGER.debug("entry to list(), this = {}", this);
|
||||||
List<ObjectReference> result = null;
|
List<ObjectReference> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
result = taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this);
|
result = taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this);
|
||||||
|
@ -91,7 +91,7 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
|
||||||
@Override
|
@Override
|
||||||
public List<String> listValues(String columnName, SortDirection sortDirection) {
|
public List<String> listValues(String columnName, SortDirection sortDirection) {
|
||||||
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
||||||
List<String> result = null;
|
List<String> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
|
@ -112,7 +112,7 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
|
||||||
@Override
|
@Override
|
||||||
public List<ObjectReference> list(int offset, int limit) {
|
public List<ObjectReference> list(int offset, int limit) {
|
||||||
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
||||||
List<ObjectReference> result = null;
|
List<ObjectReference> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
RowBounds rowBounds = new RowBounds(offset, limit);
|
RowBounds rowBounds = new RowBounds(offset, limit);
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package pro.taskana.impl;
|
package pro.taskana.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -52,6 +54,9 @@ public abstract class ReportBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TimeIntervalColumnHeader> getColumnHeaders() {
|
public List<TimeIntervalColumnHeader> getColumnHeaders() {
|
||||||
|
if (columnHeaders == null) {
|
||||||
|
columnHeaders = new ArrayList<>();
|
||||||
|
}
|
||||||
return this.columnHeaders;
|
return this.columnHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,30 +65,51 @@ public abstract class ReportBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getWorkbasketIdIn() {
|
public List<String> getWorkbasketIdIn() {
|
||||||
|
if (workbasketIds == null) {
|
||||||
|
workbasketIds = new ArrayList<>();
|
||||||
|
}
|
||||||
return this.workbasketIds;
|
return this.workbasketIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TaskState> getStateIn() {
|
public List<TaskState> getStateIn() {
|
||||||
|
if (states == null) {
|
||||||
|
states = new ArrayList<>();
|
||||||
|
}
|
||||||
return this.states;
|
return this.states;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getCategoryIn() {
|
public List<String> getCategoryIn() {
|
||||||
|
if (categories == null) {
|
||||||
|
categories = new ArrayList<>();
|
||||||
|
}
|
||||||
return this.categories;
|
return this.categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDomainIn() {
|
public List<String> getDomainIn() {
|
||||||
|
if (domains == null) {
|
||||||
|
domains = new ArrayList<>();
|
||||||
|
}
|
||||||
return this.domains;
|
return this.domains;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getClassificationIdsIn() {
|
public List<String> getClassificationIdsIn() {
|
||||||
|
if (classificationIds == null) {
|
||||||
|
classificationIds = new ArrayList<>();
|
||||||
|
}
|
||||||
return this.classificationIds;
|
return this.classificationIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getExcludedClassificationIdsIn() {
|
public List<String> getExcludedClassificationIdsIn() {
|
||||||
|
if (excludedClassificationIds == null) {
|
||||||
|
excludedClassificationIds = new ArrayList<>();
|
||||||
|
}
|
||||||
return this.excludedClassificationIds;
|
return this.excludedClassificationIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<CustomField, String> getCustomAttributeFilter() {
|
public Map<CustomField, String> getCustomAttributeFilter() {
|
||||||
|
if (customAttributeFilter == null) {
|
||||||
|
customAttributeFilter = new HashMap<>();
|
||||||
|
}
|
||||||
return this.customAttributeFilter;
|
return this.customAttributeFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package pro.taskana.impl;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -307,6 +308,9 @@ public class TaskImpl implements Task {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getCustomAttributes() {
|
public Map<String, String> getCustomAttributes() {
|
||||||
|
if (customAttributes == null) {
|
||||||
|
customAttributes = new HashMap<>();
|
||||||
|
}
|
||||||
return customAttributes;
|
return customAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,6 +321,9 @@ public class TaskImpl implements Task {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getCallbackInfo() {
|
public Map<String, String> getCallbackInfo() {
|
||||||
|
if (callbackInfo == null) {
|
||||||
|
callbackInfo = new HashMap<>();
|
||||||
|
}
|
||||||
return callbackInfo;
|
return callbackInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,6 +471,9 @@ public class TaskImpl implements Task {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Attachment> getAttachments() {
|
public List<Attachment> getAttachments() {
|
||||||
|
if (attachments == null) {
|
||||||
|
attachments = new ArrayList<>();
|
||||||
|
}
|
||||||
return attachments;
|
return attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -773,7 +773,7 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
@Override
|
@Override
|
||||||
public List<String> listValues(String columnName, SortDirection sortDirection) {
|
public List<String> listValues(String columnName, SortDirection sortDirection) {
|
||||||
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
||||||
List<String> result = null;
|
List<String> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
|
|
|
@ -347,6 +347,9 @@ public class TaskSummaryImpl implements TaskSummary {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AttachmentSummary> getAttachmentSummaries() {
|
public List<AttachmentSummary> getAttachmentSummaries() {
|
||||||
|
if (attachmentSummaries == null) {
|
||||||
|
attachmentSummaries = new ArrayList<>();
|
||||||
|
}
|
||||||
return attachmentSummaries;
|
return attachmentSummaries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,7 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
|
||||||
@Override
|
@Override
|
||||||
public List<WorkbasketSummary> list() {
|
public List<WorkbasketSummary> list() {
|
||||||
LOGGER.debug("entry to list(), this = {}", this);
|
LOGGER.debug("entry to list(), this = {}", this);
|
||||||
List<WorkbasketSummary> workbaskets = null;
|
List<WorkbasketSummary> workbaskets = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
handleCallerRolesAndAccessIds();
|
handleCallerRolesAndAccessIds();
|
||||||
|
@ -390,7 +390,7 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
|
||||||
@Override
|
@Override
|
||||||
public List<String> listValues(String columnName, SortDirection sortDirection) {
|
public List<String> listValues(String columnName, SortDirection sortDirection) {
|
||||||
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
||||||
List<String> result = null;
|
List<String> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
|
@ -412,7 +412,7 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
|
||||||
@Override
|
@Override
|
||||||
public List<WorkbasketSummary> list(int offset, int limit) {
|
public List<WorkbasketSummary> list(int offset, int limit) {
|
||||||
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
||||||
List<WorkbasketSummary> workbaskets = null;
|
List<WorkbasketSummary> workbaskets = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
RowBounds rowBounds = new RowBounds(offset, limit);
|
RowBounds rowBounds = new RowBounds(offset, limit);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package pro.taskana.impl;
|
package pro.taskana.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -94,6 +95,9 @@ public class WorkbasketReportBuilderImpl extends ReportBuilder implements Workba
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CombinedClassificationFilter> getCombinedClassificationFilterIn() {
|
public List<CombinedClassificationFilter> getCombinedClassificationFilterIn() {
|
||||||
|
if (combinedClassificationFilter == null) {
|
||||||
|
combinedClassificationFilter = new ArrayList<>();
|
||||||
|
}
|
||||||
return this.combinedClassificationFilter;
|
return this.combinedClassificationFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,6 +208,15 @@ public class CategoryReportBuilderImplTest {
|
||||||
assertEquals(expectedResult, actualResult);
|
assertEquals(expectedResult, actualResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testListTaskIdsForSelectedItemsIsEmptyResult() throws NotAuthorizedException, InvalidArgumentException {
|
||||||
|
SelectedItem selectedItem = new SelectedItem();
|
||||||
|
List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
|
||||||
|
List<String> result = cut.createCategoryReportBuilder()
|
||||||
|
.listTaskIdsForSelectedItems(selectedItems);
|
||||||
|
assertNotNull(result);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListCustomAttributeValuesForCustomAttributeName()
|
public void testListCustomAttributeValuesForCustomAttributeName()
|
||||||
throws NotAuthorizedException {
|
throws NotAuthorizedException {
|
||||||
|
@ -257,4 +266,12 @@ public class CategoryReportBuilderImplTest {
|
||||||
assertNotNull(actualResult);
|
assertNotNull(actualResult);
|
||||||
assertEquals(expectedResult, actualResult);
|
assertEquals(expectedResult, actualResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws NotAuthorizedException {
|
||||||
|
List<String> result = cut.createCategoryReportBuilder()
|
||||||
|
.workbasketIdIn(Arrays.asList("DieGibtsSicherNed"))
|
||||||
|
.listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_1);
|
||||||
|
assertNotNull(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,6 +318,17 @@ public class ClassificationReportBuilderImplTest {
|
||||||
assertEquals(expectedResult, actualResult);
|
assertEquals(expectedResult, actualResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetTaskIdsForSelectedItemsIsEmptyResult() throws NotAuthorizedException, InvalidArgumentException {
|
||||||
|
SelectedItem selectedItem = new SelectedItem();
|
||||||
|
selectedItem.setKey("GIBTSNED");
|
||||||
|
List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
|
||||||
|
List<String> result = cut.createClassificationReportBuilder()
|
||||||
|
.workbasketIdIn(Arrays.asList("DieGibtsEhNed"))
|
||||||
|
.listTaskIdsForSelectedItems(selectedItems);
|
||||||
|
assertNotNull(result);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListCustomAttributeValuesForCustomAttributeName()
|
public void testListCustomAttributeValuesForCustomAttributeName()
|
||||||
throws NotAuthorizedException {
|
throws NotAuthorizedException {
|
||||||
|
@ -368,4 +379,13 @@ public class ClassificationReportBuilderImplTest {
|
||||||
assertEquals(expectedResult, actualResult);
|
assertEquals(expectedResult, actualResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult()
|
||||||
|
throws NotAuthorizedException {
|
||||||
|
List<String> result = cut.createClassificationReportBuilder()
|
||||||
|
.workbasketIdIn(Arrays.asList("DieGibtsGarantiertNed"))
|
||||||
|
.listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_10);
|
||||||
|
assertNotNull(result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class TestClassificationQuery implements ClassificationQuery {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ClassificationSummary> list(int offset, int limit) {
|
public List<ClassificationSummary> list(int offset, int limit) {
|
||||||
return null;
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -222,6 +222,16 @@ public class WorkbasketReportBuilderImplTest {
|
||||||
assertEquals(expectedResult, actualResult);
|
assertEquals(expectedResult, actualResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = InvalidArgumentException.class)
|
||||||
|
public void testlistTaskIdsForSelectedItemsIsEmptyResult()
|
||||||
|
throws NotAuthorizedException, InvalidArgumentException {
|
||||||
|
List<SelectedItem> selectedItems = new ArrayList<>();
|
||||||
|
List<String> result = cut.createWorkbasketReportBuilder()
|
||||||
|
.workbasketIdIn(Arrays.asList("DieGibtsGarantiertNed"))
|
||||||
|
.listTaskIdsForSelectedItems(selectedItems);
|
||||||
|
assertNotNull(result);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListCustomAttributeValuesForCustomAttributeName()
|
public void testListCustomAttributeValuesForCustomAttributeName()
|
||||||
throws NotAuthorizedException {
|
throws NotAuthorizedException {
|
||||||
|
@ -271,4 +281,13 @@ public class WorkbasketReportBuilderImplTest {
|
||||||
assertNotNull(actualResult);
|
assertNotNull(actualResult);
|
||||||
assertEquals(expectedResult, actualResult);
|
assertEquals(expectedResult, actualResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult()
|
||||||
|
throws NotAuthorizedException {
|
||||||
|
List<String> result = cut.createWorkbasketReportBuilder()
|
||||||
|
.workbasketIdIn(Arrays.asList("GibtsSicherNed"))
|
||||||
|
.listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_14);
|
||||||
|
assertNotNull(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue