Closes #2171 - Refactor toLowerCopy

This commit is contained in:
Daniel Schreider 2023-05-30 11:19:48 +02:00 committed by Alex
parent 5468e23808
commit 10f1d008da
11 changed files with 21 additions and 31 deletions

View File

@ -76,7 +76,7 @@ public interface BaseQuery<T, U extends Enum<U> & QueryColumnName> {
*/
long count();
default String[] toLowerCopy(String... source) {
static String[] toLowerCopy(String... source) {
if (source == null || source.length == 0) {
return null;
// we are currently aware that this is a code smell. Unfortunately the resolution of this

View File

@ -1,5 +1,7 @@
package pro.taskana.simplehistory.impl;
import static pro.taskana.common.api.BaseQuery.toLowerCopy;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,5 +1,7 @@
package pro.taskana.simplehistory.impl;
import static pro.taskana.common.api.BaseQuery.toLowerCopy;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,5 +1,7 @@
package pro.taskana.simplehistory.impl;
import static pro.taskana.common.api.BaseQuery.toLowerCopy;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,5 +1,7 @@
package pro.taskana.classification.internal;
import static pro.taskana.common.api.BaseQuery.toLowerCopy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

View File

@ -1,5 +1,7 @@
package pro.taskana.monitor.internal.reports;
import static pro.taskana.common.api.BaseQuery.toLowerCopy;
import java.time.Instant;
import java.util.Collections;
import java.util.List;
@ -628,19 +630,4 @@ abstract class TimeIntervalReportBuilderImpl<
}
return false;
}
private String[] toLowerCopy(String... source) {
if (source == null || source.length == 0) {
// we are currently aware that this is a code smell. Unfortunately the resolution of this
// would cause havoc in our queries, since we do not have a concept
// for a user input validation yet. As soon as that is done we can resolve this code smell.
return null;
} else {
String[] target = new String[source.length];
for (int i = 0; i < source.length; i++) {
target[i] = source[i].toLowerCase();
}
return target;
}
}
}

View File

@ -1,5 +1,7 @@
package pro.taskana.monitor.internal.reports;
import static pro.taskana.common.api.BaseQuery.toLowerCopy;
import java.util.Collections;
import java.util.List;
import pro.taskana.common.api.IntInterval;
@ -543,19 +545,4 @@ public class WorkbasketPriorityReportBuilderImpl implements WorkbasketPriorityRe
return this;
}
private String[] toLowerCopy(String... source) {
if (source == null || source.length == 0) {
// we are currently aware that this is a code smell. Unfortunately the resolution of this
// would cause havoc in our queries, since we do not have a concept
// for a user input validation yet. As soon as that is done we can resolve this code smell.
return null;
} else {
String[] target = new String[source.length];
for (int i = 0; i < source.length; i++) {
target[i] = source[i].toLowerCase();
}
return target;
}
}
}

View File

@ -1,5 +1,7 @@
package pro.taskana.task.internal;
import static pro.taskana.common.api.BaseQuery.toLowerCopy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

View File

@ -1,5 +1,7 @@
package pro.taskana.task.internal;
import static pro.taskana.common.api.BaseQuery.toLowerCopy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

View File

@ -1,5 +1,7 @@
package pro.taskana.workbasket.internal;
import static pro.taskana.common.api.BaseQuery.toLowerCopy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

View File

@ -1,5 +1,7 @@
package pro.taskana.workbasket.internal;
import static pro.taskana.common.api.BaseQuery.toLowerCopy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;