Sonar cleanup
This commit is contained in:
@@ -79,8 +79,8 @@ public class TaskExecution {
|
||||
this.taskName = taskName;
|
||||
this.exitMessage = exitMessage;
|
||||
this.parameters = parameters;
|
||||
setStartTime(startTime);
|
||||
setEndTime(endTime);
|
||||
this.startTime = (Date)startTime.clone();
|
||||
this.endTime = (endTime != null) ? (Date)endTime.clone() : null;
|
||||
}
|
||||
|
||||
public long getExecutionId() {
|
||||
|
||||
@@ -95,7 +95,7 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao {
|
||||
private static final String RUNNING_TASK_EXECUTION_COUNT_BY_NAME = "SELECT COUNT(*) FROM " +
|
||||
"%PREFIX%EXECUTION where TASK_NAME = ? AND END_TIME IS NULL ";
|
||||
|
||||
final String FIND_TASK_NAMES = "SELECT distinct TASK_NAME from %PREFIX%EXECUTION order by TASK_NAME";
|
||||
private static final String FIND_TASK_NAMES = "SELECT distinct TASK_NAME from %PREFIX%EXECUTION order by TASK_NAME";
|
||||
|
||||
private static final String DEFAULT_TABLE_PREFIX = "TASK_";
|
||||
|
||||
@@ -255,7 +255,7 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao {
|
||||
}
|
||||
factoryBean.setSortKeys(orderMap);
|
||||
factoryBean.setDataSource(dataSource);
|
||||
PagingQueryProvider pagingQueryProvider = null;
|
||||
PagingQueryProvider pagingQueryProvider;
|
||||
try {
|
||||
pagingQueryProvider = factoryBean.getObject();
|
||||
pagingQueryProvider.init(dataSource);
|
||||
@@ -268,7 +268,7 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao {
|
||||
getQuery(query),
|
||||
queryParam,
|
||||
new TaskExecutionRowMapper());
|
||||
return new PageImpl<TaskExecution>(resultList, pageable, totalCount);
|
||||
return new PageImpl<>(resultList, pageable, totalCount);
|
||||
}
|
||||
|
||||
private String getQuery(String base) {
|
||||
@@ -323,14 +323,13 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao {
|
||||
@Override
|
||||
public TaskExecution mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
long id = rs.getLong("TASK_EXECUTION_ID");
|
||||
TaskExecution taskExecution=new TaskExecution(id,
|
||||
return new TaskExecution(id,
|
||||
(Integer) rs.getObject("EXIT_CODE"),
|
||||
rs.getString("TASK_NAME"),
|
||||
rs.getTimestamp("START_TIME"),
|
||||
rs.getTimestamp("END_TIME"),
|
||||
rs.getString("EXIT_MESSAGE"),
|
||||
getTaskParameters(id));
|
||||
return taskExecution;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public class MapTaskExecutionDao implements TaskExecutionDao {
|
||||
filteredSet.add(entry.getValue());
|
||||
}
|
||||
}
|
||||
return getPageFromList(new ArrayList<TaskExecution>(filteredSet), pageable,
|
||||
return getPageFromList(new ArrayList<>(filteredSet), pageable,
|
||||
getTaskExecutionCountByTaskName(taskName));
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class MapTaskExecutionDao implements TaskExecutionDao {
|
||||
for (Map.Entry<Long, TaskExecution> entry : taskExecutions.entrySet()) {
|
||||
result.add(entry.getValue().getTaskName());
|
||||
}
|
||||
return new ArrayList<String>(result);
|
||||
return new ArrayList<>(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,7 +141,7 @@ public class MapTaskExecutionDao implements TaskExecutionDao {
|
||||
}
|
||||
|
||||
private TreeSet<TaskExecution> getTaskExecutionTreeSet() {
|
||||
return new TreeSet<TaskExecution>(new Comparator<TaskExecution>() {
|
||||
return new TreeSet<>(new Comparator<TaskExecution>() {
|
||||
@Override
|
||||
public int compare(TaskExecution e1, TaskExecution e2) {
|
||||
int result = e1.getStartTime().compareTo(e2.getStartTime());
|
||||
@@ -156,7 +156,7 @@ public class MapTaskExecutionDao implements TaskExecutionDao {
|
||||
private Page getPageFromList(List<TaskExecution> executionList, Pageable pageable, long maxSize){
|
||||
int toIndex = (pageable.getOffset() + pageable.getPageSize() > executionList.size()) ?
|
||||
executionList.size() : pageable.getOffset() + pageable.getPageSize();
|
||||
return new PageImpl<TaskExecution>(
|
||||
return new PageImpl<>(
|
||||
executionList.subList(pageable.getOffset(), toIndex),
|
||||
pageable, maxSize);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ import org.springframework.batch.item.database.Order;
|
||||
*/
|
||||
public class SqlPagingQueryUtils {
|
||||
|
||||
private SqlPagingQueryUtils(){}
|
||||
|
||||
/**
|
||||
* Generate SQL query string using a LIMIT clause
|
||||
*
|
||||
@@ -42,7 +44,7 @@ public class SqlPagingQueryUtils {
|
||||
sql.append(" FROM ").append(provider.getFromClause());
|
||||
sql.append(provider.getWhereClause() == null ? "" : " WHERE " + provider.getWhereClause());
|
||||
sql.append(" ORDER BY ").append(buildSortClause(provider));
|
||||
sql.append(" " + limitClause);
|
||||
sql.append(" ").append(limitClause);
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user