Skip to content

Commit

Permalink
Fix checkstyle (Kitodo - Core)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-ronge committed Oct 30, 2024
1 parent 621dc51 commit 0de38bf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public class IndexingForm {
}
}

/**
* Sets the number of database objects.
*/
public static void setNumberOfDatabaseObjects() {
for (Entry<ObjectType, IndexingRow> entry : indexingRows.entrySet()) {
long count = 0;
Expand Down Expand Up @@ -186,7 +189,8 @@ public void startAllIndexing() {
* @return the overall progress of the indexing process
*/
public int getAllIndexingProgress() {
long numerator = 0, denominator = 0;
long numerator = 0;
long denominator = 0;
for (IndexingRow indexingRow : indexingRows.values()) {
if (indexingRow.getIndexed() >= 0) {
numerator += indexingRow.getIndexed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,13 @@ public void restrictToRoles(List<Role> roles) {
restrictions.add(restriction.toString());
}

/**
* Adds search restrictions entered by the user in the filter input.
*
* @param filterString
* user input
* @see "https://github.com/kitodo/kitodo-production/wiki/Suche-und-Filter"
*/
public void restrictWithUserFilterString(String filterString) {
int userFilterCount = 0;
for (var groupFilter : UserSpecifiedFilterParser.parse(filterString).entrySet()) {
Expand Down Expand Up @@ -380,6 +387,13 @@ private void innerFormQuery(StringBuilder query) {
}
}

/**
* Returns the query parameters.
*
* @return the query parameters
* @throws IllegalStateException
* if index queries still need to be made for parameterization
*/
public Map<String, Object> getQueryParameters() {
if (!indexQueries.isEmpty()) {
throw new IllegalStateException("index searches not yet performed");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ static List<UserSpecifiedFilter> parseFilters(String filter) {
}
} else {
// add characters but, no spaces at the beginning
if (tokenCollector.length() > 0 || glyph > ' ')
if (tokenCollector.length() > 0 || glyph > ' ') {
tokenCollector.appendCodePoint(glyph);
}
}
}
trimRight(tokenCollector);
Expand Down Expand Up @@ -115,8 +116,9 @@ private static List<UserSpecifiedFilter> parseParentheses(StringBuilder input) {
}
} else {
// add characters but, no spaces at the beginning
if (tokenCollector.length() > 0 || glyph > ' ')
if (tokenCollector.length() > 0 || glyph > ' ') {
tokenCollector.appendCodePoint(glyph);
}
}
}
if (tokenCollector.length() > 0) {
Expand Down Expand Up @@ -162,8 +164,7 @@ private static UserSpecifiedFilter parseQueryPart(StringBuilder item) {
// index search
return new IndexQueryPart(FilterField.MISC, item.toString());
} else {
// if there is a colon
// disassemble the string
// if there is a colon: disassemble the string
String column = item.substring(0, colon).toLowerCase();
String value = item.substring(colon + 1);
// is the first one a known search field?
Expand All @@ -188,8 +189,7 @@ private static UserSpecifiedFilter parseQueryPart(StringBuilder item) {
if (idSearch.matches()) {
return new DatabaseQueryPart(filterField, idSearch.group(1), idSearch.group(2));
} else {
// if the search field allows an additional colon, then
// search for it
// if the search allows an additional colon, search for it
if (filterField.isDivisible()) {
// the field allows another colon: then search for it
int anotherColon = value.indexOf(":");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
package org.kitodo.production.services.index;

import java.util.Collection;
import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletionStage;

import org.apache.logging.log4j.LogManager;
Expand Down

0 comments on commit 0de38bf

Please sign in to comment.