TSK-1710: Fixed a few code smells
This commit is contained in:
parent
2b7e7902a3
commit
3f124f47db
|
@ -87,7 +87,7 @@ public class DbSchemaCreator {
|
||||||
connection.setSchema(this.schemaName);
|
connection.setSchema(this.schemaName);
|
||||||
SqlRunner runner = new SqlRunner(connection);
|
SqlRunner runner = new SqlRunner(connection);
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
LOGGER.debug(connection.getMetaData().toString());
|
LOGGER.debug("{}", connection.getMetaData());
|
||||||
}
|
}
|
||||||
|
|
||||||
String query =
|
String query =
|
||||||
|
@ -163,8 +163,7 @@ public class DbSchemaCreator {
|
||||||
|
|
||||||
private boolean isSchemaPreexisting(Connection connection, String dbProductId) {
|
private boolean isSchemaPreexisting(Connection connection, String dbProductId) {
|
||||||
ScriptRunner runner = getScriptRunnerInstance(connection);
|
ScriptRunner runner = getScriptRunnerInstance(connection);
|
||||||
StringWriter localErrorWriter = new StringWriter();
|
runner.setErrorLogWriter(errorLogWriter);
|
||||||
runner.setErrorLogWriter(new PrintWriter(localErrorWriter));
|
|
||||||
|
|
||||||
String scriptPath = selectDbSchemaDetectionScript(dbProductId);
|
String scriptPath = selectDbSchemaDetectionScript(dbProductId);
|
||||||
try (InputStream resource = DbSchemaCreator.class.getResourceAsStream(scriptPath);
|
try (InputStream resource = DbSchemaCreator.class.getResourceAsStream(scriptPath);
|
||||||
|
@ -174,8 +173,8 @@ public class DbSchemaCreator {
|
||||||
} catch (RuntimeSqlException | IOException e) {
|
} catch (RuntimeSqlException | IOException e) {
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
LOGGER.debug("Schema does not exist.");
|
LOGGER.debug("Schema does not exist.");
|
||||||
if (!localErrorWriter.toString().trim().isEmpty()) {
|
if (!errorWriter.toString().trim().isEmpty()) {
|
||||||
LOGGER.debug(localErrorWriter.toString());
|
LOGGER.debug(errorWriter.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -33,6 +33,9 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery {
|
||||||
private final List<String> orderBy;
|
private final List<String> orderBy;
|
||||||
private final List<String> orderColumns;
|
private final List<String> orderColumns;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private TaskHistoryQueryColumnName columnName;
|
||||||
|
|
||||||
private String[] idIn;
|
private String[] idIn;
|
||||||
private String[] businessProcessIdIn;
|
private String[] businessProcessIdIn;
|
||||||
private String[] parentBusinessProcessIdIn;
|
private String[] parentBusinessProcessIdIn;
|
||||||
|
@ -657,8 +660,9 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery {
|
||||||
public List<String> listValues(
|
public List<String> listValues(
|
||||||
TaskHistoryQueryColumnName dbColumnName, SortDirection sortDirection) {
|
TaskHistoryQueryColumnName dbColumnName, SortDirection sortDirection) {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
|
this.columnName = dbColumnName;
|
||||||
this.orderBy.clear();
|
this.orderBy.clear();
|
||||||
this.addOrderCriteria(dbColumnName.toString(), sortDirection);
|
this.addOrderCriteria(columnName.toString(), sortDirection);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
taskanaHistoryEngine.openConnection();
|
taskanaHistoryEngine.openConnection();
|
||||||
|
|
|
@ -31,6 +31,9 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery {
|
||||||
|
|
||||||
private TaskanaHistoryEngineImpl taskanaHistoryEngine;
|
private TaskanaHistoryEngineImpl taskanaHistoryEngine;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private WorkbasketHistoryQueryColumnName columnName;
|
||||||
|
|
||||||
private List<String> orderBy;
|
private List<String> orderBy;
|
||||||
private List<String> orderColumns;
|
private List<String> orderColumns;
|
||||||
|
|
||||||
|
@ -498,9 +501,10 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery {
|
||||||
public List<String> listValues(
|
public List<String> listValues(
|
||||||
WorkbasketHistoryQueryColumnName dbColumnName, SortDirection sortDirection) {
|
WorkbasketHistoryQueryColumnName dbColumnName, SortDirection sortDirection) {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
|
this.columnName = dbColumnName;
|
||||||
List<String> cacheOrderBy = this.orderBy;
|
List<String> cacheOrderBy = this.orderBy;
|
||||||
this.orderBy.clear();
|
this.orderBy.clear();
|
||||||
this.addOrderCriteria(dbColumnName.toString(), sortDirection);
|
this.addOrderCriteria(columnName.toString(), sortDirection);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
taskanaHistoryEngine.openConnection();
|
taskanaHistoryEngine.openConnection();
|
||||||
|
@ -511,6 +515,7 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery {
|
||||||
return result;
|
return result;
|
||||||
} finally {
|
} finally {
|
||||||
this.orderBy = cacheOrderBy;
|
this.orderBy = cacheOrderBy;
|
||||||
|
this.columnName = null;
|
||||||
this.orderColumns.remove(orderColumns.size() - 1);
|
this.orderColumns.remove(orderColumns.size() - 1);
|
||||||
taskanaHistoryEngine.returnConnection();
|
taskanaHistoryEngine.returnConnection();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue