Skip to content

Commit

Permalink
applying spotless fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoni-Weisberg committed Oct 28, 2024
1 parent a0a8473 commit a143431
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,6 @@ public ArtifactSearchResultsDto searchArtifacts(Set<SearchFilter> filters, Order
}
orderByQuery.append(" ").append(orderDirection.name());


// Query for the artifacts
String artifactsQuerySql = sqlStatements.selectTableTemplate("a.*", "artifacts", "a",
where.toString(), orderByQuery.toString());
Expand Down Expand Up @@ -2793,7 +2792,6 @@ public GroupSearchResultsDto searchGroups(Set<SearchFilter> filters, OrderBy ord
List<SqlStatementVariableBinder> binders = new LinkedList<>();
String op;


StringBuilder where = new StringBuilder();
StringBuilder orderByQuery = new StringBuilder();

Expand Down Expand Up @@ -2858,14 +2856,13 @@ public GroupSearchResultsDto searchGroups(Set<SearchFilter> filters, OrderBy ord
}
orderByQuery.append(" ").append(orderDirection.name());


// Query for the group
String groupsQuerySql = sqlStatements.selectTableTemplate("*", "groups", "g",
where.toString(), orderByQuery.toString());
String groupsQuerySql = sqlStatements.selectTableTemplate("*", "groups", "g", where.toString(),
orderByQuery.toString());
Query groupsQuery = handle.createQuery(groupsQuerySql);
// Query for the total row count
String countQuerySql = sqlStatements.selectCountTableTemplate("g.groupId", "groups", "g",
where.toString());
where.toString());
Query countQuery = handle.createQuery(countQuerySql);

// Bind all query parameters
Expand Down Expand Up @@ -3388,7 +3385,6 @@ public BranchSearchResultsDto getBranches(GA ga, int offset, int limit) {
// Add order by to artifact query
orderByQuery.append(" ORDER BY b.branchId ASC");


// Query for the artifacts
String branchesQuerySql = sqlStatements.selectTableTemplate("*", "branches", "b",
where.toString(), orderByQuery.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,15 +669,17 @@ public String insertContentReference() {
*/
@Override
public String insertGroup() {
return "INSERT INTO " + groupsTable() + " (groupId, description, artifactsType, owner, createdOn, modifiedBy, modifiedOn, labels) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
return "INSERT INTO " + groupsTable()
+ " (groupId, description, artifactsType, owner, createdOn, modifiedBy, modifiedOn, labels) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
}

/**
* @see io.apicurio.registry.storage.impl.sql.SqlStatements#updateGroup()
*/
@Override
public String updateGroup() {
return "UPDATE " + groupsTable() + " SET description = ? , modifiedBy = ? , modifiedOn = ? , labels = ? WHERE groupId = ?";
return "UPDATE " + groupsTable()
+ " SET description = ? , modifiedBy = ? , modifiedOn = ? , labels = ? WHERE groupId = ?";
}

/**
Expand Down Expand Up @@ -818,7 +820,8 @@ public String importGlobalRule() {
*/
@Override
public String importGroup() {
return "INSERT INTO " + groupsTable() + " (groupId, description, artifactsType, owner, createdOn, modifiedBy, modifiedOn, labels) "
return "INSERT INTO " + groupsTable()
+ " (groupId, description, artifactsType, owner, createdOn, modifiedBy, modifiedOn, labels) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
}

Expand Down Expand Up @@ -1212,16 +1215,18 @@ public String deleteOutboxEvent() {
}

@Override
public String selectCountTableTemplate(String countBy, String tableName, String alias, String whereClause) {
public String selectCountTableTemplate(String countBy, String tableName, String alias,
String whereClause) {
return "SELECT COUNT(%s) FROM %s %s %s".formatted(countBy, tableName, alias, whereClause);
}

@Override
public String selectTableTemplate(String columns, String tableName, String alias, String whereClause, String orderBy) {
return "SELECT %s FROM %s %s %s %s LIMIT ? OFFSET ?".formatted(columns, tableName, alias, whereClause, orderBy);
public String selectTableTemplate(String columns, String tableName, String alias, String whereClause,
String orderBy) {
return "SELECT %s FROM %s %s %s %s LIMIT ? OFFSET ?".formatted(columns, tableName, alias, whereClause,
orderBy);
}


protected String groupsTable() {
return "groups";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ INSERT INTO branches (groupId, artifactId, branchId, description, systemDefined,
}

@Override
public String selectCountTableTemplate(String countBy, String tableName, String alias, String whereClause) {
public String selectCountTableTemplate(String countBy, String tableName, String alias,
String whereClause) {
return super.selectCountTableTemplate(countBy, "`" + tableName + "`", alias, whereClause);
}

@Override
public String selectTableTemplate(String columns, String tableName, String alias, String whereClause, String orderBy) {
public String selectTableTemplate(String columns, String tableName, String alias, String whereClause,
String orderBy) {
return super.selectTableTemplate(columns, "`" + tableName + "`", alias, whereClause, orderBy);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ public String selectBranchTipFilteredByState() {
}

@Override
public String selectTableTemplate(String columns, String tableName, String alias, String whereClause, String orderBy) {
return "SELECT %s FROM %s %s %s %s OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"
.formatted(columns, tableName, alias, whereClause, orderBy);
public String selectTableTemplate(String columns, String tableName, String alias, String whereClause,
String orderBy) {
return "SELECT %s FROM %s %s %s %s OFFSET ? ROWS FETCH NEXT ? ROWS ONLY".formatted(columns, tableName,
alias, whereClause, orderBy);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ public interface SqlStatements {

String selectCountTableTemplate(String countBy, String tableName, String alias, String whereClause);

String selectTableTemplate(String columns, String tableName, String alias, String whereClause, String orderBy);
String selectTableTemplate(String columns, String tableName, String alias, String whereClause,
String orderBy);
}

0 comments on commit a143431

Please sign in to comment.