Skip to content

Commit

Permalink
checkstyle cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Keelhaul committed Jan 23, 2025
1 parent beff4db commit 5cf46f0
Show file tree
Hide file tree
Showing 28 changed files with 305 additions and 283 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,18 @@ public List<String> addToIndex(Path denkxwebFile, Map<String, Boolean> reindexSe
*
* @param doc a {@link org.jdom2.Document} object.
* @param dataFolders a {@link java.util.Map} object.
* @param writeStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
* @param inWriteStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
* @param pageCountStart a int.
* @param downloadExternalImages
* @return an array of {@link java.lang.String} objects.
* @should index record correctly
* @should update record correctly
*/
public String[] index(Document doc, Map<String, Path> dataFolders, ISolrWriteStrategy writeStrategy, int pageCountStart,
public String[] index(Document doc, Map<String, Path> dataFolders, final ISolrWriteStrategy inWriteStrategy, int pageCountStart,
boolean downloadExternalImages) {
String[] ret = { STATUS_ERROR, null };
String pi = null;
ISolrWriteStrategy writeStrategy = inWriteStrategy;
try {
this.xp = new JDomXP(doc);
if (this.xp == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.io.File;
import java.io.IOException;
import java.io.ObjectStreamException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -433,7 +434,7 @@ static List<Object> getFileContents(Path folder) {
/**
*
* @param recordFile
* @return
* @return {@link Object}
* @throws IOException
*/
static Object readTextFile(Path recordFile) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,22 +559,21 @@ public void generatePageDocuments(final ISolrWriteStrategy writeStrategy, final
* @param eleImage
* @param iddoc
* @param pi
* @param order
* @param inOrder
* @param dataFolders
* @return {@link PhysicalElement}
* @throws FatalIndexerException
*/
PhysicalElement generatePageDocument(Element eleImage, String iddoc, String pi, Integer order, Map<String, Path> dataFolders) {
PhysicalElement generatePageDocument(Element eleImage, String iddoc, String pi, final Integer inOrder, Map<String, Path> dataFolders) {
if (eleImage == null) {
throw new IllegalArgumentException("eleImage may not be null");
}
if (dataFolders == null) {
throw new IllegalArgumentException("dataFolders may not be null");
}
if (order == null) {
// TODO page order within the metadata
order = 1;
}

int order = inOrder != null ? inOrder : 1;
// TODO page order within the metadata

// Create object for this page
PhysicalElement ret = createPhysicalElement(order, iddoc, String.valueOf(order));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public EadIndexer(Hotfolder hotfolder) {
}

/**
* <p>Constructor for EadIndexer.</p>
* <p>
* Constructor for EadIndexer.
* </p>
*
* @param hotfolder a {@link io.goobi.viewer.indexer.helper.Hotfolder} object
* @param httpConnector a {@link io.goobi.viewer.indexer.helper.HttpConnector} object
Expand Down Expand Up @@ -171,13 +173,13 @@ public List<String> addToIndex(Path eadFile, Map<String, Boolean> reindexSetting
*
* @param eadFile {@link java.nio.file.Path}
* @param dataFolders a {@link java.util.Map} object.
* @param writeStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
* @param inWriteStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
* @return an array of {@link java.lang.String} objects.
* @should index record correctly
* @should update record correctly
* @should set access conditions correctly
*/
public String[] index(Path eadFile, Map<String, Path> dataFolders, ISolrWriteStrategy writeStrategy) {
public String[] index(Path eadFile, Map<String, Path> dataFolders, final ISolrWriteStrategy inWriteStrategy) {
String[] ret = { null, null };

if (eadFile == null || !Files.exists(eadFile)) {
Expand All @@ -188,6 +190,7 @@ public String[] index(Path eadFile, Map<String, Path> dataFolders, ISolrWriteStr
}

logger.debug("Indexing EAD file '{}'...", eadFile.getFileName());
ISolrWriteStrategy writeStrategy = inWriteStrategy;
try {
initJDomXP(eadFile);
IndexObject indexObj = new IndexObject(getNextIddoc());
Expand Down Expand Up @@ -368,7 +371,9 @@ protected List<IndexObject> indexAllChildren(IndexObject parentIndexObject, int
}

/**
* <p>indexChild.</p>
* <p>
* indexChild.
* </p>
*
* @param node a {@link org.jdom2.Element} object
* @param parentIndexObject a {@link io.goobi.viewer.indexer.model.IndexObject} object
Expand Down Expand Up @@ -522,7 +527,8 @@ public IndexObject indexChild(Element node, IndexObject parentIndexObject, int d

// The following steps must be performed after adding child metadata and marking own metadata for skipping

// Add grouped metadata as separate documents (must be done after mapping page docs to this docstrct and after adding grouped metadata from child elements)
// Add grouped metadata as separate documents (must be done after mapping page docs to this docstrct
// and after adding grouped metadata from child elements)
addGroupedMetadataDocs(writeStrategy, indexObj, indexObj.getGroupedMetadataFields(), indexObj.getIddoc());

// Apply field modifications that should happen at the very end
Expand Down Expand Up @@ -609,7 +615,9 @@ private Element findStructNode() {
}

/**
* <p>getSourceDocFormat.</p>
* <p>
* getSourceDocFormat.
* </p>
*
* @return a {@link io.goobi.viewer.indexer.helper.JDomXP.FileFormat} object
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ int addGroupedMetadataDocs(GroupedMetadata gmd, ISolrWriteStrategy writeStrategy
/**
*
* @param dataFolders
* @paramNames
* @param paramNames
* @param pi
* @throws IOException
* @should throw IllegalArgumentException if pi null
Expand Down Expand Up @@ -2368,7 +2368,6 @@ static void checkReindexSettings(Map<String, Path> dataFolders, Map<String, Bool
* existing page PDFs; in the second case, only do so if {@link Configuration#isForcePrerenderPdfs()} is true
*
* @param pi The identifier of the process to create pdfs for
* @param hasNewMediaFiles if the data repository has been updated with new media files
*/
void prerenderPagePdfsIfRequired(String pi) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public List<String> addToIndex(Path lidoFile, Map<String, Boolean> reindexSettin
*
* @param doc a {@link org.jdom2.Document} object.
* @param dataFolders a {@link java.util.Map} object.
* @param writeStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
* @param inWriteStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
* @param pageCountStart a int.
* @param imageXPaths a {@link java.util.List} object.
* @param downloadExternalImages a boolean.
Expand All @@ -235,10 +235,11 @@ public List<String> addToIndex(Path lidoFile, Map<String, Boolean> reindexSettin
* @should update record correctly
* @return an array of {@link java.lang.String} objects.
*/
public String[] index(Document doc, Map<String, Path> dataFolders, ISolrWriteStrategy writeStrategy, int pageCountStart,
public String[] index(Document doc, Map<String, Path> dataFolders, ISolrWriteStrategy inWriteStrategy, int pageCountStart,
List<String> imageXPaths, boolean downloadExternalImages, boolean useOldImageFolderIfAvailable) {
String[] ret = { STATUS_ERROR, null };
String pi = null;
ISolrWriteStrategy writeStrategy = inWriteStrategy;
try {
this.xp = new JDomXP(doc);
if (this.xp == null) {
Expand Down Expand Up @@ -294,7 +295,8 @@ public String[] index(Document doc, Map<String, Path> dataFolders, ISolrWriteStr
// Set access conditions
indexObj.writeAccessConditions(null);

// Add THUMBNAIL,THUMBPAGENO,THUMBPAGENOLABEL (must be done AFTER writeDateMondified(), writeAccessConditions() and generatePageDocuments()!)
// Add THUMBNAIL,THUMBPAGENO,THUMBPAGENOLABEL
// (must be done AFTER writeDateMondified(), writeAccessConditions() and generatePageDocuments()!)
List<LuceneField> thumbnailFields = mapPagesToDocstruct(indexObj, writeStrategy, 0);
if (thumbnailFields != null) {
indexObj.getLuceneFields().addAll(thumbnailFields);
Expand Down Expand Up @@ -375,7 +377,7 @@ public String[] index(Document doc, Map<String, Path> dataFolders, ISolrWriteStr
* @param indexObj
* @param writeStrategy
* @param depth
* @return
* @return List<LuceneField>
* @throws FatalIndexerException
*/
protected static List<LuceneField> mapPagesToDocstruct(IndexObject indexObj, ISolrWriteStrategy writeStrategy, int depth)
Expand Down Expand Up @@ -408,7 +410,8 @@ protected static List<LuceneField> mapPagesToDocstruct(IndexObject indexObj, ISo
// Add thumbnail information from the representative page
if (!thumbnailSet && StringUtils.isNotEmpty(filePathBanner) && pageFileName.equals(filePathBanner)) {
ret.add(new LuceneField(SolrConstants.THUMBNAIL, pageFileName));
// THUMBNAILREPRESENT is just used to identify the presence of a custom representation thumbnail to the indexer, it is not used in the viewer
// THUMBNAILREPRESENT is just used to identify the presence of a custom representation thumbnail to the indexer,
// it is not used in the viewer
ret.add(new LuceneField(SolrConstants.THUMBNAILREPRESENT, pageFileName));
ret.add(new LuceneField(SolrConstants.THUMBPAGENO, String.valueOf(page.getDoc().getFieldValue(SolrConstants.ORDER))));
ret.add(new LuceneField(SolrConstants.THUMBPAGENOLABEL, (String) page.getDoc().getFieldValue(SolrConstants.ORDERLABEL)));
Expand Down Expand Up @@ -528,7 +531,8 @@ protected static List<LuceneField> mapPagesToDocstruct(IndexObject indexObj, ISo
? (String) firstPage.getDoc().getFieldValue(SolrConstants.FILENAME + SolrConstants.SUFFIX_HTML_SANDBOXED)
: (String) firstPage.getDoc().getFieldValue(SolrConstants.FILENAME);
ret.add(new LuceneField(SolrConstants.THUMBNAIL, pageFileName));
// THUMBNAILREPRESENT is just used to identify the presence of a custom representation thumbnail to the indexer, it is not used in the viewer
// THUMBNAILREPRESENT is just used to identify the presence of a custom representation thumbnail to the indexer,
// it is not used in the viewer
ret.add(new LuceneField(SolrConstants.THUMBNAILREPRESENT, pageFileName));
ret.add(new LuceneField(SolrConstants.THUMBPAGENO, String.valueOf(firstPage.getDoc().getFieldValue(SolrConstants.ORDER))));
ret.add(new LuceneField(SolrConstants.THUMBPAGENOLABEL, (String) firstPage.getDoc().getFieldValue(SolrConstants.ORDERLABEL)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class MetsIndexer extends Indexer {

private String selectedPreferredImageFileGroup = null;
private List<String> availablePreferredImageFileGroups = SolrIndexerDaemon.getInstance().getConfiguration().getMetsPreferredImageFileGroups();
volatile String useFileGroupGlobal = null;
private volatile String useFileGroupGlobal = null;

/**
* Constructor.
Expand Down Expand Up @@ -2402,4 +2402,13 @@ public String getAnchorPi() {

return null;
}

/**
* For tests.
*
* @param useFileGroupGlobal the useFileGroupGlobal to set
*/
void setUseFileGroupGlobal(String useFileGroupGlobal) {
this.useFileGroupGlobal = useFileGroupGlobal;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public List<String> addToIndex(Path sourceFile, Map<String, Boolean> reindexSett

/**
* @param sourceFile
* @return {@link SolrInputDocument}
* @throws IOException
* @throws FatalIndexerException
* @throws SolrServerException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* </p>
*
*/
public class Version {
public final class Version {

private static final Logger logger = LogManager.getLogger(Version.class);

Expand Down Expand Up @@ -73,7 +73,7 @@ private Version() {

/**
*
* @return
* @return {@link String}
*/
private static String getManifestStringFromJar() {
Class clazz = Version.class;
Expand All @@ -100,7 +100,7 @@ private static String getManifestStringFromJar() {
*
* @param label
* @param infoText
* @return
* @return {@link String}
*/
private static String getInfo(String label, String infoText) {
String regex = label + ": (.*)";
Expand Down
Loading

0 comments on commit 5cf46f0

Please sign in to comment.