FINERACT-2267: proper not null annotations. Remove jetbrains notnull, all services use non-null
This commit is contained in:
+8
-8
@@ -20,7 +20,6 @@ package org.apache.fineract.infrastructure.core.service;
|
||||
|
||||
import static java.time.temporal.ChronoUnit.DAYS;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
@@ -41,6 +40,7 @@ import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.JsonParserHelper;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
public final class DateUtils {
|
||||
|
||||
@@ -86,8 +86,8 @@ public final class DateUtils {
|
||||
return truncate == null ? now : now.truncatedTo(truncate);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static OffsetDateTime getOffsetDateTimeOfTenantFromLocalDate(@NotNull final LocalDate date) {
|
||||
@NonNull
|
||||
public static OffsetDateTime getOffsetDateTimeOfTenantFromLocalDate(@NonNull final LocalDate date) {
|
||||
return OffsetDateTime.of(date.atStartOfDay(), getOffsetDateTimeOfTenant().getOffset());
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ public final class DateUtils {
|
||||
return compare(first, second, null, false);
|
||||
}
|
||||
|
||||
public static int compareWithNullsLast(@NotNull Optional<OffsetDateTime> first, @NotNull Optional<OffsetDateTime> second) {
|
||||
public static int compareWithNullsLast(@NonNull Optional<OffsetDateTime> first, @NonNull Optional<OffsetDateTime> second) {
|
||||
return compareWithNullsLast(first.orElse(null), second.orElse(null));
|
||||
}
|
||||
|
||||
@@ -302,14 +302,14 @@ public final class DateUtils {
|
||||
return isAfter(first, second) || isEqual(first, second);
|
||||
}
|
||||
|
||||
public static long getDifference(LocalDate first, LocalDate second, @NotNull ChronoUnit unit) {
|
||||
public static long getDifference(LocalDate first, LocalDate second, @NonNull ChronoUnit unit) {
|
||||
if (first == null || second == null) {
|
||||
throw new IllegalArgumentException("Dates must not be null to get difference");
|
||||
}
|
||||
return unit.between(first, second);
|
||||
}
|
||||
|
||||
public static int getExactDifference(LocalDate first, LocalDate second, @NotNull ChronoUnit unit) {
|
||||
public static int getExactDifference(LocalDate first, LocalDate second, @NonNull ChronoUnit unit) {
|
||||
return Math.toIntExact(getDifference(first, second, unit));
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ public final class DateUtils {
|
||||
return fromDate != null && DateUtils.isAfter(targetDate, fromDate) && !DateUtils.isAfter(targetDate, toDate);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private static DateTimeFormatter getDateFormatter(String format, Locale locale) {
|
||||
DateTimeFormatter formatter = DEFAULT_DATE_FORMATTER;
|
||||
if (format != null || locale != null) {
|
||||
@@ -425,7 +425,7 @@ public final class DateUtils {
|
||||
return formatter;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private static DateTimeFormatter getDateTimeFormatter(String format, Locale locale) {
|
||||
DateTimeFormatter formatter = DEFAULT_DATETIME_FORMATTER;
|
||||
if (format != null || locale != null) {
|
||||
|
||||
+5
-5
@@ -18,12 +18,12 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.service;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
||||
import org.apache.fineract.organisation.monetary.domain.MoneyHelper;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
public final class MathUtil {
|
||||
|
||||
@@ -303,7 +303,7 @@ public final class MathUtil {
|
||||
/**
|
||||
* @return BigDecimal with scale set to the 'digitsAfterDecimal' of the parameter currency
|
||||
*/
|
||||
public static BigDecimal normalizeAmount(BigDecimal amount, @NotNull MonetaryCurrency currency) {
|
||||
public static BigDecimal normalizeAmount(BigDecimal amount, @NonNull MonetaryCurrency currency) {
|
||||
return amount == null ? null : amount.setScale(currency.getDigitsAfterDecimal(), MoneyHelper.getRoundingMode());
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ public final class MathUtil {
|
||||
return amount == null ? null : amount.toPlainString();
|
||||
}
|
||||
|
||||
public static Money toMoney(BigDecimal amount, @NotNull MonetaryCurrency currency) {
|
||||
public static Money toMoney(BigDecimal amount, @NonNull MonetaryCurrency currency) {
|
||||
return amount == null ? null : Money.of(currency, amount);
|
||||
}
|
||||
|
||||
@@ -331,11 +331,11 @@ public final class MathUtil {
|
||||
return value == null ? null : value.getAmount();
|
||||
}
|
||||
|
||||
public static Money nullToZero(Money value, @NotNull MonetaryCurrency currency) {
|
||||
public static Money nullToZero(Money value, @NonNull MonetaryCurrency currency) {
|
||||
return nullToDefault(value, Money.zero(currency));
|
||||
}
|
||||
|
||||
public static Money nullToZero(Money value, @NotNull MonetaryCurrency currency, @NotNull MathContext mc) {
|
||||
public static Money nullToZero(Money value, @NonNull MonetaryCurrency currency, @NonNull MathContext mc) {
|
||||
return nullToDefault(value, Money.zero(currency, mc));
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -20,7 +20,6 @@ package org.apache.fineract.infrastructure.core.service.database;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
@@ -35,6 +34,7 @@ import org.apache.logging.log4j.util.Strings;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@@ -96,7 +96,7 @@ public class DatabaseSpecificSQLGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
public String countLastExecutedQueryResult(@NotNull String sql) {
|
||||
public String countLastExecutedQueryResult(@NonNull String sql) {
|
||||
if (databaseTypeResolver.isMySQL()) {
|
||||
return "SELECT FOUND_ROWS()";
|
||||
} else {
|
||||
@@ -104,7 +104,7 @@ public class DatabaseSpecificSQLGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
public String countQueryResult(@NotNull String sql) {
|
||||
public String countQueryResult(@NonNull String sql) {
|
||||
// Needs to remove the limit and offset
|
||||
sql = sql.replaceAll("LIMIT \\d+", "").replaceAll("OFFSET \\d+", "").trim();
|
||||
return format("SELECT COUNT(*) FROM (%s) AS temp", sql);
|
||||
@@ -201,7 +201,7 @@ public class DatabaseSpecificSQLGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
public String alias(@NotNull String field, String alias) {
|
||||
public String alias(@NonNull String field, String alias) {
|
||||
return Strings.isEmpty(alias) ? field : (alias + '.') + field;
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public class DatabaseSpecificSQLGenerator {
|
||||
return from + escape(definition) + (Strings.isEmpty(alias) ? "" : (" " + alias));
|
||||
}
|
||||
|
||||
public String buildJoin(@NotNull String definition, String alias, @NotNull String fkCol, String refAlias, @NotNull String refCol,
|
||||
public String buildJoin(@NonNull String definition, String alias, @NonNull String fkCol, String refAlias, @NonNull String refCol,
|
||||
String joinType) {
|
||||
String join = Strings.isEmpty(joinType) ? "JOIN" : (joinType + " JOIN");
|
||||
alias = Strings.isEmpty(alias) ? "" : (" " + alias);
|
||||
@@ -246,7 +246,7 @@ public class DatabaseSpecificSQLGenerator {
|
||||
.collect(Collectors.joining(", "));
|
||||
}
|
||||
|
||||
public String buildInsert(@NotNull String definition, List<String> fields, Map<String, ResultsetColumnHeaderData> headers) {
|
||||
public String buildInsert(@NonNull String definition, List<String> fields, Map<String, ResultsetColumnHeaderData> headers) {
|
||||
if (fields == null || fields.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
@@ -254,7 +254,7 @@ public class DatabaseSpecificSQLGenerator {
|
||||
+ ") VALUES (" + fields.stream().map(e -> decoratePlaceHolder(headers, e, "?")).collect(Collectors.joining(", ")) + ")";
|
||||
}
|
||||
|
||||
public String buildUpdate(@NotNull String definition, List<String> fields, Map<String, ResultsetColumnHeaderData> headers) {
|
||||
public String buildUpdate(@NonNull String definition, List<String> fields, Map<String, ResultsetColumnHeaderData> headers) {
|
||||
if (fields == null || fields.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
+3
-3
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.service.database;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.Serializable;
|
||||
@@ -42,6 +41,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformServiceUnavailableException;
|
||||
import org.apache.fineract.organisation.monetary.domain.MoneyHelper;
|
||||
import org.springframework.data.domain.Persistable;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
public enum JavaType {
|
||||
|
||||
@@ -205,7 +205,7 @@ public enum JavaType {
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
public JavaType getObjectType() {
|
||||
if (!isPrimitive()) {
|
||||
return this;
|
||||
@@ -227,7 +227,7 @@ public enum JavaType {
|
||||
/**
|
||||
* @return the field metadata type for the given class. First class objects are not recognized in this method.
|
||||
*/
|
||||
@NotNull
|
||||
@NonNull
|
||||
public static JavaType forType(Class<?> type) {
|
||||
if (type == null) {
|
||||
return OBJECT;
|
||||
|
||||
+29
-29
@@ -19,10 +19,10 @@
|
||||
package org.apache.fineract.infrastructure.core.service.database;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.sql.JDBCType;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformServiceUnavailableException;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
public enum JdbcJavaType {
|
||||
|
||||
@@ -30,14 +30,14 @@ public enum JdbcJavaType {
|
||||
BIT(JavaType.BOOLEAN, new DialectType(JDBCType.BIT), new DialectType(JDBCType.BIT, true)) { //
|
||||
|
||||
@Override
|
||||
public Object toJdbcValueImpl(@NotNull DatabaseType dialect, Object value) {
|
||||
public Object toJdbcValueImpl(@NonNull DatabaseType dialect, Object value) {
|
||||
return value == null ? null : (Boolean.TRUE.equals(value) ? 1 : 0);
|
||||
}
|
||||
},
|
||||
BOOLEAN(JavaType.BOOLEAN, new DialectType(JDBCType.BIT), new DialectType(JDBCType.BOOLEAN, null, "BOOL")) { //
|
||||
|
||||
@Override
|
||||
public Object toJdbcValueImpl(@NotNull DatabaseType dialect, Object value) {
|
||||
public Object toJdbcValueImpl(@NonNull DatabaseType dialect, Object value) {
|
||||
return (value != null && dialect.isMySql()) ? (Boolean.TRUE.equals(value) ? 1 : 0) : super.toJdbcValueImpl(dialect, value);
|
||||
}
|
||||
},
|
||||
@@ -45,7 +45,7 @@ public enum JdbcJavaType {
|
||||
TINYINT(JavaType.SHORT, new DialectType(JDBCType.TINYINT, true), new DialectType(JDBCType.SMALLINT)) { //
|
||||
|
||||
@Override
|
||||
public Object toJdbcValueImpl(@NotNull DatabaseType dialect, Object value) {
|
||||
public Object toJdbcValueImpl(@NonNull DatabaseType dialect, Object value) {
|
||||
return dialect.isMySql() && value instanceof Boolean ? (Boolean.TRUE.equals(value) ? 1 : 0)
|
||||
: super.toJdbcValueImpl(dialect, value);
|
||||
}
|
||||
@@ -113,21 +113,21 @@ public enum JdbcJavaType {
|
||||
|
||||
private static final String PLACEHOLDER_TYPE = "{type}";
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private final JavaType javaType;
|
||||
private final ImmutableList<DialectType> dialectTypes;
|
||||
|
||||
JdbcJavaType(@NotNull JavaType javaType, DialectType... dialectTypes) {
|
||||
JdbcJavaType(@NonNull JavaType javaType, DialectType... dialectTypes) {
|
||||
this.javaType = javaType;
|
||||
this.dialectTypes = ImmutableList.copyOf(dialectTypes);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
public JavaType getJavaType() {
|
||||
return javaType;
|
||||
}
|
||||
|
||||
public static JdbcJavaType getByTypeName(@NotNull DatabaseType dialect, String name, boolean check) {
|
||||
public static JdbcJavaType getByTypeName(@NonNull DatabaseType dialect, String name, boolean check) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -161,8 +161,8 @@ public enum JdbcJavaType {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private DialectType getDialectType(@NotNull DatabaseType dialect) {
|
||||
@NonNull
|
||||
private DialectType getDialectType(@NonNull DatabaseType dialect) {
|
||||
DialectType dialectType = dialectTypes.get(dialect.ordinal());
|
||||
if (dialectType == null) {
|
||||
throw new PlatformServiceUnavailableException("error.msg.database.dialect.not.allowed",
|
||||
@@ -175,7 +175,7 @@ public enum JdbcJavaType {
|
||||
return getJavaType().isBooleanType();
|
||||
}
|
||||
|
||||
public boolean canBooleanType(@NotNull DatabaseType dialect) {
|
||||
public boolean canBooleanType(@NonNull DatabaseType dialect) {
|
||||
return isBooleanType() || (dialect.isMySql() && this == TINYINT);
|
||||
}
|
||||
|
||||
@@ -251,33 +251,33 @@ public enum JdbcJavaType {
|
||||
return getJavaType().isBinaryType();
|
||||
}
|
||||
|
||||
public boolean hasPrecision(@NotNull DatabaseType dialect) {
|
||||
public boolean hasPrecision(@NonNull DatabaseType dialect) {
|
||||
return getDialectType(dialect).precision;
|
||||
}
|
||||
|
||||
public boolean hasScale(@NotNull DatabaseType dialect) {
|
||||
public boolean hasScale(@NonNull DatabaseType dialect) {
|
||||
return getDialectType(dialect).scale;
|
||||
}
|
||||
|
||||
public String getJdbcName(@NotNull DatabaseType dialect) {
|
||||
public String getJdbcName(@NonNull DatabaseType dialect) {
|
||||
DialectType dialectType = getDialectType(dialect);
|
||||
return dialectType.getNameResolved();
|
||||
}
|
||||
|
||||
public String formatSql(@NotNull DatabaseType dialect, Integer precision) {
|
||||
public String formatSql(@NonNull DatabaseType dialect, Integer precision) {
|
||||
return formatSql(dialect, precision, null);
|
||||
}
|
||||
|
||||
public String formatSql(@NotNull DatabaseType dialect) {
|
||||
public String formatSql(@NonNull DatabaseType dialect) {
|
||||
return formatSql(dialect, null, null);
|
||||
}
|
||||
|
||||
public String formatSql(@NotNull DatabaseType dialect, Integer precision, Integer scale) {
|
||||
public String formatSql(@NonNull DatabaseType dialect, Integer precision, Integer scale) {
|
||||
DialectType dialectType = getDialectType(dialect);
|
||||
return dialectType.formatSql(precision, scale);
|
||||
}
|
||||
|
||||
public Object toJdbcValue(@NotNull DatabaseType dialect, Object value, boolean check) {
|
||||
public Object toJdbcValue(@NonNull DatabaseType dialect, Object value, boolean check) {
|
||||
if (value != null && check && !javaType.getObjectType().matchType(value.getClass(), false)) {
|
||||
throw new PlatformServiceUnavailableException("error.msg.database.type.not.valid",
|
||||
"Data type of parameter " + value + " does not match " + this);
|
||||
@@ -285,22 +285,22 @@ public enum JdbcJavaType {
|
||||
return toJdbcValueImpl(dialect, value);
|
||||
}
|
||||
|
||||
public Object toJdbcValueImpl(@NotNull DatabaseType dialect, Object value) {
|
||||
public Object toJdbcValueImpl(@NonNull DatabaseType dialect, Object value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@com.google.errorprone.annotations.Immutable
|
||||
private static final class DialectType implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private final JDBCType jdbcType;
|
||||
@NotNull
|
||||
@NonNull
|
||||
private final String name;
|
||||
private final boolean precision;
|
||||
private final boolean scale;
|
||||
private final ImmutableList<String> alterNames;
|
||||
|
||||
private DialectType(@NotNull JDBCType jdbcType, String name, boolean precision, boolean scale, String... alterNames) {
|
||||
private DialectType(@NonNull JDBCType jdbcType, String name, boolean precision, boolean scale, String... alterNames) {
|
||||
this.jdbcType = jdbcType;
|
||||
this.name = name == null ? jdbcType.getName() : name;
|
||||
this.precision = precision;
|
||||
@@ -308,27 +308,27 @@ public enum JdbcJavaType {
|
||||
this.alterNames = ImmutableList.copyOf(alterNames);
|
||||
}
|
||||
|
||||
private DialectType(@NotNull JDBCType jdbcType, String name, boolean precision, String... alterNames) {
|
||||
private DialectType(@NonNull JDBCType jdbcType, String name, boolean precision, String... alterNames) {
|
||||
this(jdbcType, name, precision, false, alterNames);
|
||||
}
|
||||
|
||||
private DialectType(@NotNull JDBCType jdbcType, String name, boolean precision) {
|
||||
private DialectType(@NonNull JDBCType jdbcType, String name, boolean precision) {
|
||||
this(jdbcType, name, precision, false);
|
||||
}
|
||||
|
||||
private DialectType(@NotNull JDBCType jdbcType, String name, String... alterNames) {
|
||||
private DialectType(@NonNull JDBCType jdbcType, String name, String... alterNames) {
|
||||
this(jdbcType, name, false, false, alterNames);
|
||||
}
|
||||
|
||||
private DialectType(@NotNull JDBCType jdbcType, boolean precision, boolean scale) {
|
||||
private DialectType(@NonNull JDBCType jdbcType, boolean precision, boolean scale) {
|
||||
this(jdbcType, null, precision, scale);
|
||||
}
|
||||
|
||||
private DialectType(@NotNull JDBCType jdbcType, boolean precision) {
|
||||
private DialectType(@NonNull JDBCType jdbcType, boolean precision) {
|
||||
this(jdbcType, null, precision, false);
|
||||
}
|
||||
|
||||
private DialectType(@NotNull JDBCType jdbcType) {
|
||||
private DialectType(@NonNull JDBCType jdbcType) {
|
||||
this(jdbcType, null, false, false);
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ public enum JdbcJavaType {
|
||||
}
|
||||
}
|
||||
|
||||
private String addSqlPrecisionScale(@NotNull String name, Integer precision, Integer scale) {
|
||||
private String addSqlPrecisionScale(@NonNull String name, Integer precision, Integer scale) {
|
||||
if (!this.precision || precision == null) {
|
||||
return name;
|
||||
}
|
||||
|
||||
+14
-14
@@ -20,13 +20,13 @@ package org.apache.fineract.infrastructure.core.service.database;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformServiceUnavailableException;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@@ -41,7 +41,7 @@ public enum SqlOperator {
|
||||
LIKE("LIKE") { //
|
||||
|
||||
@Override
|
||||
public String formatImpl(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
public String formatImpl(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
String... values) {
|
||||
return format("%s %s %s", definition, getSymbol(), sqlGenerator.formatValue(columnType, "%" + values[0] + "%"));
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public enum SqlOperator {
|
||||
NLIKE("NOT LIKE") { //
|
||||
|
||||
@Override
|
||||
public String formatImpl(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
public String formatImpl(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
String... values) {
|
||||
return format("%s %s %s", definition, getSymbol(), sqlGenerator.formatValue(columnType, "%" + values[0] + "%"));
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public enum SqlOperator {
|
||||
BTW("BETWEEN", 2) { //
|
||||
|
||||
@Override
|
||||
public String formatImpl(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
public String formatImpl(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
String... values) {
|
||||
return format("%s %s %s AND %s", definition, getSymbol(), sqlGenerator.formatValue(columnType, values[0]),
|
||||
sqlGenerator.formatValue(columnType, values[1]));
|
||||
@@ -81,7 +81,7 @@ public enum SqlOperator {
|
||||
NBTW("NOT BETWEEN", 2) { //
|
||||
|
||||
@Override
|
||||
public String formatImpl(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
public String formatImpl(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
String... values) {
|
||||
return format("%s %s %s AND %s", definition, getSymbol(), sqlGenerator.formatValue(columnType, values[0]),
|
||||
sqlGenerator.formatValue(columnType, values[1]));
|
||||
@@ -95,7 +95,7 @@ public enum SqlOperator {
|
||||
IN("IN", -1) { //
|
||||
|
||||
@Override
|
||||
public String formatImpl(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
public String formatImpl(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
String... values) {
|
||||
return format("%s %s (%s)", definition, getSymbol(),
|
||||
Arrays.stream(values).map(e -> sqlGenerator.formatValue(columnType, e)).collect(Collectors.joining(", ")));
|
||||
@@ -114,7 +114,7 @@ public enum SqlOperator {
|
||||
NIN("NOT IN", -1) { //
|
||||
|
||||
@Override
|
||||
public String formatImpl(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
public String formatImpl(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
String... values) {
|
||||
return format("%s %s (%s)", definition, getSymbol(),
|
||||
Arrays.stream(values).map(e -> sqlGenerator.formatValue(columnType, e)).collect(Collectors.joining(", ")));
|
||||
@@ -153,24 +153,24 @@ public enum SqlOperator {
|
||||
return paramCount < 0;
|
||||
}
|
||||
|
||||
public String formatSql(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition, String alias,
|
||||
public String formatSql(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition, String alias,
|
||||
List<String> values) {
|
||||
return formatSql(sqlGenerator, columnType, definition, alias, values == null ? null : values.toArray(String[]::new));
|
||||
}
|
||||
|
||||
public String formatSql(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition, String alias,
|
||||
public String formatSql(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition, String alias,
|
||||
String... values) {
|
||||
validateValues(values);
|
||||
return formatImpl(sqlGenerator, columnType, sqlGenerator.alias(sqlGenerator.escape(definition), alias), values);
|
||||
}
|
||||
|
||||
protected String formatImpl(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
protected String formatImpl(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, JdbcJavaType columnType, String definition,
|
||||
String... values) {
|
||||
return paramCount == 0 ? format("%s %s", definition, symbol)
|
||||
: format("%s %s %s", definition, symbol, sqlGenerator.formatValue(columnType, values[0]));
|
||||
}
|
||||
|
||||
public String formatNamedParam(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, String definition, int paramCount, String alias) {
|
||||
public String formatNamedParam(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, String definition, int paramCount, String alias) {
|
||||
validateParamCount(paramCount);
|
||||
if (paramCount > 1) {
|
||||
throw new PlatformServiceUnavailableException("error.msg.database.operator.named.invalid",
|
||||
@@ -183,11 +183,11 @@ public enum SqlOperator {
|
||||
return formatPlaceholderImpl(definition, paramCount, namedParam);
|
||||
}
|
||||
|
||||
public String formatPlaceholder(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, String definition, int paramCount, String alias) {
|
||||
public String formatPlaceholder(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, String definition, int paramCount, String alias) {
|
||||
return formatPlaceholder(sqlGenerator, definition, paramCount, alias, "?");
|
||||
}
|
||||
|
||||
public String formatPlaceholder(@NotNull DatabaseSpecificSQLGenerator sqlGenerator, String definition, int paramCount, String alias,
|
||||
public String formatPlaceholder(@NonNull DatabaseSpecificSQLGenerator sqlGenerator, String definition, int paramCount, String alias,
|
||||
String placeholder) {
|
||||
validateParamCount(paramCount);
|
||||
return formatPlaceholderImpl(sqlGenerator.alias(sqlGenerator.escape(definition), alias), paramCount, placeholder);
|
||||
@@ -212,7 +212,7 @@ public enum SqlOperator {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
public static SqlOperator forName(String name) {
|
||||
return name == null ? getDefault() : SqlOperator.valueOf(name.toUpperCase());
|
||||
}
|
||||
|
||||
+7
-7
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.infrastructure.dataqueries.service;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.apache.fineract.infrastructure.core.service.PagedLocalRequest;
|
||||
@@ -28,6 +27,7 @@ import org.apache.fineract.infrastructure.dataqueries.data.EntityTables;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.GenericResultsetData;
|
||||
import org.apache.fineract.portfolio.search.data.AdvancedQueryData;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
public interface DatatableReadService {
|
||||
|
||||
@@ -35,14 +35,14 @@ public interface DatatableReadService {
|
||||
|
||||
DatatableData retrieveDatatable(String datatable);
|
||||
|
||||
List<JsonObject> queryDataTable(@NotNull String datatable, @NotNull String columnName, String columnValue,
|
||||
@NotNull String resultColumns);
|
||||
List<JsonObject> queryDataTable(@NonNull String datatable, @NonNull String columnName, String columnValue,
|
||||
@NonNull String resultColumns);
|
||||
|
||||
Page<JsonObject> queryDataTableAdvanced(@NotNull String datatable, @NotNull PagedLocalRequest<AdvancedQueryData> pagedRequest);
|
||||
Page<JsonObject> queryDataTableAdvanced(@NonNull String datatable, @NonNull PagedLocalRequest<AdvancedQueryData> pagedRequest);
|
||||
|
||||
boolean buildDataQueryEmbedded(@NotNull EntityTables entityTable, @NotNull String datatable, @NotNull AdvancedQueryData request,
|
||||
@NotNull List<String> selectColumns, @NotNull StringBuilder select, @NotNull StringBuilder from, @NotNull StringBuilder where,
|
||||
@NotNull List<Object> params, String mainAlias, String alias, String dateFormat, String dateTimeFormat, Locale locale);
|
||||
boolean buildDataQueryEmbedded(@NonNull EntityTables entityTable, @NonNull String datatable, @NonNull AdvancedQueryData request,
|
||||
@NonNull List<String> selectColumns, @NonNull StringBuilder select, @NonNull StringBuilder from, @NonNull StringBuilder where,
|
||||
@NonNull List<Object> params, String mainAlias, String alias, String dateFormat, String dateTimeFormat, Locale locale);
|
||||
|
||||
GenericResultsetData retrieveDataTableGenericResultSet(String datatable, Long appTableId, String order, Long id);
|
||||
|
||||
|
||||
+5
-5
@@ -18,25 +18,25 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.jobs.service;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.api.IdTypeResolver;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.infrastructure.jobs.data.JobDetailData;
|
||||
import org.apache.fineract.infrastructure.jobs.data.JobDetailHistoryData;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
public interface SchedulerJobRunnerReadService {
|
||||
|
||||
List<JobDetailData> findAllJobDetails();
|
||||
|
||||
JobDetailData retrieveOne(@NotNull IdTypeResolver.IdType idType, String identifier);
|
||||
JobDetailData retrieveOne(@NonNull IdTypeResolver.IdType idType, String identifier);
|
||||
|
||||
Page<JobDetailHistoryData> retrieveJobHistory(@NotNull IdTypeResolver.IdType idType, String identifier,
|
||||
Page<JobDetailHistoryData> retrieveJobHistory(@NonNull IdTypeResolver.IdType idType, String identifier,
|
||||
SearchParameters searchParameters);
|
||||
|
||||
@NotNull
|
||||
Long retrieveId(@NotNull IdTypeResolver.IdType idType, String identifier);
|
||||
@NonNull
|
||||
Long retrieveId(@NonNull IdTypeResolver.IdType idType, String identifier);
|
||||
|
||||
boolean isUpdatesAllowed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user