Skip to content

Commit 5cf46f0

Browse files
committed
checkstyle cleanup
1 parent beff4db commit 5cf46f0

28 files changed

+305
-283
lines changed

goobi-viewer-indexer/src/main/java/io/goobi/viewer/indexer/DenkXwebIndexer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,18 @@ public List<String> addToIndex(Path denkxwebFile, Map<String, Boolean> reindexSe
195195
*
196196
* @param doc a {@link org.jdom2.Document} object.
197197
* @param dataFolders a {@link java.util.Map} object.
198-
* @param writeStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
198+
* @param inWriteStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
199199
* @param pageCountStart a int.
200200
* @param downloadExternalImages
201201
* @return an array of {@link java.lang.String} objects.
202202
* @should index record correctly
203203
* @should update record correctly
204204
*/
205-
public String[] index(Document doc, Map<String, Path> dataFolders, ISolrWriteStrategy writeStrategy, int pageCountStart,
205+
public String[] index(Document doc, Map<String, Path> dataFolders, final ISolrWriteStrategy inWriteStrategy, int pageCountStart,
206206
boolean downloadExternalImages) {
207207
String[] ret = { STATUS_ERROR, null };
208208
String pi = null;
209+
ISolrWriteStrategy writeStrategy = inWriteStrategy;
209210
try {
210211
this.xp = new JDomXP(doc);
211212
if (this.xp == null) {

goobi-viewer-indexer/src/main/java/io/goobi/viewer/indexer/DocUpdateIndexer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.io.File;
1919
import java.io.IOException;
20+
import java.io.ObjectStreamException;
2021
import java.nio.file.DirectoryStream;
2122
import java.nio.file.Files;
2223
import java.nio.file.Path;
@@ -433,7 +434,7 @@ static List<Object> getFileContents(Path folder) {
433434
/**
434435
*
435436
* @param recordFile
436-
* @return
437+
* @return {@link Object}
437438
* @throws IOException
438439
*/
439440
static Object readTextFile(Path recordFile) throws IOException {

goobi-viewer-indexer/src/main/java/io/goobi/viewer/indexer/DublinCoreIndexer.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -559,22 +559,21 @@ public void generatePageDocuments(final ISolrWriteStrategy writeStrategy, final
559559
* @param eleImage
560560
* @param iddoc
561561
* @param pi
562-
* @param order
562+
* @param inOrder
563563
* @param dataFolders
564564
* @return {@link PhysicalElement}
565565
* @throws FatalIndexerException
566566
*/
567-
PhysicalElement generatePageDocument(Element eleImage, String iddoc, String pi, Integer order, Map<String, Path> dataFolders) {
567+
PhysicalElement generatePageDocument(Element eleImage, String iddoc, String pi, final Integer inOrder, Map<String, Path> dataFolders) {
568568
if (eleImage == null) {
569569
throw new IllegalArgumentException("eleImage may not be null");
570570
}
571571
if (dataFolders == null) {
572572
throw new IllegalArgumentException("dataFolders may not be null");
573573
}
574-
if (order == null) {
575-
// TODO page order within the metadata
576-
order = 1;
577-
}
574+
575+
int order = inOrder != null ? inOrder : 1;
576+
// TODO page order within the metadata
578577

579578
// Create object for this page
580579
PhysicalElement ret = createPhysicalElement(order, iddoc, String.valueOf(order));

goobi-viewer-indexer/src/main/java/io/goobi/viewer/indexer/EadIndexer.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ public EadIndexer(Hotfolder hotfolder) {
8585
}
8686

8787
/**
88-
* <p>Constructor for EadIndexer.</p>
88+
* <p>
89+
* Constructor for EadIndexer.
90+
* </p>
8991
*
9092
* @param hotfolder a {@link io.goobi.viewer.indexer.helper.Hotfolder} object
9193
* @param httpConnector a {@link io.goobi.viewer.indexer.helper.HttpConnector} object
@@ -171,13 +173,13 @@ public List<String> addToIndex(Path eadFile, Map<String, Boolean> reindexSetting
171173
*
172174
* @param eadFile {@link java.nio.file.Path}
173175
* @param dataFolders a {@link java.util.Map} object.
174-
* @param writeStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
176+
* @param inWriteStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
175177
* @return an array of {@link java.lang.String} objects.
176178
* @should index record correctly
177179
* @should update record correctly
178180
* @should set access conditions correctly
179181
*/
180-
public String[] index(Path eadFile, Map<String, Path> dataFolders, ISolrWriteStrategy writeStrategy) {
182+
public String[] index(Path eadFile, Map<String, Path> dataFolders, final ISolrWriteStrategy inWriteStrategy) {
181183
String[] ret = { null, null };
182184

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

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

370373
/**
371-
* <p>indexChild.</p>
374+
* <p>
375+
* indexChild.
376+
* </p>
372377
*
373378
* @param node a {@link org.jdom2.Element} object
374379
* @param parentIndexObject a {@link io.goobi.viewer.indexer.model.IndexObject} object
@@ -522,7 +527,8 @@ public IndexObject indexChild(Element node, IndexObject parentIndexObject, int d
522527

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

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

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

611617
/**
612-
* <p>getSourceDocFormat.</p>
618+
* <p>
619+
* getSourceDocFormat.
620+
* </p>
613621
*
614622
* @return a {@link io.goobi.viewer.indexer.helper.JDomXP.FileFormat} object
615623
*/

goobi-viewer-indexer/src/main/java/io/goobi/viewer/indexer/Indexer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,7 @@ int addGroupedMetadataDocs(GroupedMetadata gmd, ISolrWriteStrategy writeStrategy
14541454
/**
14551455
*
14561456
* @param dataFolders
1457-
* @paramNames
1457+
* @param paramNames
14581458
* @param pi
14591459
* @throws IOException
14601460
* @should throw IllegalArgumentException if pi null
@@ -2368,7 +2368,6 @@ static void checkReindexSettings(Map<String, Path> dataFolders, Map<String, Bool
23682368
* existing page PDFs; in the second case, only do so if {@link Configuration#isForcePrerenderPdfs()} is true
23692369
*
23702370
* @param pi The identifier of the process to create pdfs for
2371-
* @param hasNewMediaFiles if the data repository has been updated with new media files
23722371
*/
23732372
void prerenderPagePdfsIfRequired(String pi) {
23742373
try {

goobi-viewer-indexer/src/main/java/io/goobi/viewer/indexer/LidoIndexer.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public List<String> addToIndex(Path lidoFile, Map<String, Boolean> reindexSettin
226226
*
227227
* @param doc a {@link org.jdom2.Document} object.
228228
* @param dataFolders a {@link java.util.Map} object.
229-
* @param writeStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
229+
* @param inWriteStrategy a {@link io.goobi.viewer.indexer.model.writestrategy.ISolrWriteStrategy} object.
230230
* @param pageCountStart a int.
231231
* @param imageXPaths a {@link java.util.List} object.
232232
* @param downloadExternalImages a boolean.
@@ -235,10 +235,11 @@ public List<String> addToIndex(Path lidoFile, Map<String, Boolean> reindexSettin
235235
* @should update record correctly
236236
* @return an array of {@link java.lang.String} objects.
237237
*/
238-
public String[] index(Document doc, Map<String, Path> dataFolders, ISolrWriteStrategy writeStrategy, int pageCountStart,
238+
public String[] index(Document doc, Map<String, Path> dataFolders, ISolrWriteStrategy inWriteStrategy, int pageCountStart,
239239
List<String> imageXPaths, boolean downloadExternalImages, boolean useOldImageFolderIfAvailable) {
240240
String[] ret = { STATUS_ERROR, null };
241241
String pi = null;
242+
ISolrWriteStrategy writeStrategy = inWriteStrategy;
242243
try {
243244
this.xp = new JDomXP(doc);
244245
if (this.xp == null) {
@@ -294,7 +295,8 @@ public String[] index(Document doc, Map<String, Path> dataFolders, ISolrWriteStr
294295
// Set access conditions
295296
indexObj.writeAccessConditions(null);
296297

297-
// Add THUMBNAIL,THUMBPAGENO,THUMBPAGENOLABEL (must be done AFTER writeDateMondified(), writeAccessConditions() and generatePageDocuments()!)
298+
// Add THUMBNAIL,THUMBPAGENO,THUMBPAGENOLABEL
299+
// (must be done AFTER writeDateMondified(), writeAccessConditions() and generatePageDocuments()!)
298300
List<LuceneField> thumbnailFields = mapPagesToDocstruct(indexObj, writeStrategy, 0);
299301
if (thumbnailFields != null) {
300302
indexObj.getLuceneFields().addAll(thumbnailFields);
@@ -375,7 +377,7 @@ public String[] index(Document doc, Map<String, Path> dataFolders, ISolrWriteStr
375377
* @param indexObj
376378
* @param writeStrategy
377379
* @param depth
378-
* @return
380+
* @return List<LuceneField>
379381
* @throws FatalIndexerException
380382
*/
381383
protected static List<LuceneField> mapPagesToDocstruct(IndexObject indexObj, ISolrWriteStrategy writeStrategy, int depth)
@@ -408,7 +410,8 @@ protected static List<LuceneField> mapPagesToDocstruct(IndexObject indexObj, ISo
408410
// Add thumbnail information from the representative page
409411
if (!thumbnailSet && StringUtils.isNotEmpty(filePathBanner) && pageFileName.equals(filePathBanner)) {
410412
ret.add(new LuceneField(SolrConstants.THUMBNAIL, pageFileName));
411-
// THUMBNAILREPRESENT is just used to identify the presence of a custom representation thumbnail to the indexer, it is not used in the viewer
413+
// THUMBNAILREPRESENT is just used to identify the presence of a custom representation thumbnail to the indexer,
414+
// it is not used in the viewer
412415
ret.add(new LuceneField(SolrConstants.THUMBNAILREPRESENT, pageFileName));
413416
ret.add(new LuceneField(SolrConstants.THUMBPAGENO, String.valueOf(page.getDoc().getFieldValue(SolrConstants.ORDER))));
414417
ret.add(new LuceneField(SolrConstants.THUMBPAGENOLABEL, (String) page.getDoc().getFieldValue(SolrConstants.ORDERLABEL)));
@@ -528,7 +531,8 @@ protected static List<LuceneField> mapPagesToDocstruct(IndexObject indexObj, ISo
528531
? (String) firstPage.getDoc().getFieldValue(SolrConstants.FILENAME + SolrConstants.SUFFIX_HTML_SANDBOXED)
529532
: (String) firstPage.getDoc().getFieldValue(SolrConstants.FILENAME);
530533
ret.add(new LuceneField(SolrConstants.THUMBNAIL, pageFileName));
531-
// THUMBNAILREPRESENT is just used to identify the presence of a custom representation thumbnail to the indexer, it is not used in the viewer
534+
// THUMBNAILREPRESENT is just used to identify the presence of a custom representation thumbnail to the indexer,
535+
// it is not used in the viewer
532536
ret.add(new LuceneField(SolrConstants.THUMBNAILREPRESENT, pageFileName));
533537
ret.add(new LuceneField(SolrConstants.THUMBPAGENO, String.valueOf(firstPage.getDoc().getFieldValue(SolrConstants.ORDER))));
534538
ret.add(new LuceneField(SolrConstants.THUMBPAGENOLABEL, (String) firstPage.getDoc().getFieldValue(SolrConstants.ORDERLABEL)));

goobi-viewer-indexer/src/main/java/io/goobi/viewer/indexer/MetsIndexer.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public class MetsIndexer extends Indexer {
125125

126126
private String selectedPreferredImageFileGroup = null;
127127
private List<String> availablePreferredImageFileGroups = SolrIndexerDaemon.getInstance().getConfiguration().getMetsPreferredImageFileGroups();
128-
volatile String useFileGroupGlobal = null;
128+
private volatile String useFileGroupGlobal = null;
129129

130130
/**
131131
* Constructor.
@@ -2402,4 +2402,13 @@ public String getAnchorPi() {
24022402

24032403
return null;
24042404
}
2405+
2406+
/**
2407+
* For tests.
2408+
*
2409+
* @param useFileGroupGlobal the useFileGroupGlobal to set
2410+
*/
2411+
void setUseFileGroupGlobal(String useFileGroupGlobal) {
2412+
this.useFileGroupGlobal = useFileGroupGlobal;
2413+
}
24052414
}

goobi-viewer-indexer/src/main/java/io/goobi/viewer/indexer/UsageStatisticsIndexer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public List<String> addToIndex(Path sourceFile, Map<String, Boolean> reindexSett
8484

8585
/**
8686
* @param sourceFile
87+
* @return {@link SolrInputDocument}
8788
* @throws IOException
8889
* @throws FatalIndexerException
8990
* @throws SolrServerException

goobi-viewer-indexer/src/main/java/io/goobi/viewer/indexer/Version.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* </p>
4040
*
4141
*/
42-
public class Version {
42+
public final class Version {
4343

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

@@ -73,7 +73,7 @@ private Version() {
7373

7474
/**
7575
*
76-
* @return
76+
* @return {@link String}
7777
*/
7878
private static String getManifestStringFromJar() {
7979
Class clazz = Version.class;
@@ -100,7 +100,7 @@ private static String getManifestStringFromJar() {
100100
*
101101
* @param label
102102
* @param infoText
103-
* @return
103+
* @return {@link String}
104104
*/
105105
private static String getInfo(String label, String infoText) {
106106
String regex = label + ": (.*)";

0 commit comments

Comments
 (0)