diff --git a/Kitodo-API/src/main/java/org/kitodo/serviceloader/KitodoServiceLoader.java b/Kitodo-API/src/main/java/org/kitodo/serviceloader/KitodoServiceLoader.java index 99fadd6c95f..6f18b1826c6 100644 --- a/Kitodo-API/src/main/java/org/kitodo/serviceloader/KitodoServiceLoader.java +++ b/Kitodo-API/src/main/java/org/kitodo/serviceloader/KitodoServiceLoader.java @@ -400,7 +400,7 @@ private void loadModulesIntoClasspath() { // create a single URL class loader with all jars // such that plugins can load classes from each other - if (jarsToBeAdded.size() > 0) { + if (!jarsToBeAdded.isEmpty()) { for (URL url : jarsToBeAdded) { logger.info("Loading module jar file from path " + url.toString()); diff --git a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/DivXmlElementAccess.java b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/DivXmlElementAccess.java index c0cad752e5c..7ebd2327d83 100644 --- a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/DivXmlElementAccess.java +++ b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/DivXmlElementAccess.java @@ -147,7 +147,7 @@ public DivXmlElementAccess() { private boolean fileXmlElementAccessIsLinkedToChildren(FileXmlElementAccess fileXmlElementAccess, List divs, Map> physicalDivisionsMap) { - if (divs.size() == 0) { + if (divs.isEmpty()) { return false; } boolean test = false; diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/type/ProcessType.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/type/ProcessType.java index 4e54f2e2fb7..69cdc014caf 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/type/ProcessType.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/type/ProcessType.java @@ -61,7 +61,7 @@ Map getJsonObject(Process process) { jsonObject.put(ProcessTypeField.BATCHES.getKey(), addObjectRelation(process.getBatches(), true)); jsonObject.put(ProcessTypeField.COMMENTS.getKey(), addObjectRelation(process.getComments())); jsonObject.put(ProcessTypeField.COMMENTS_MESSAGE.getKey(), getProcessComments(process)); - jsonObject.put(ProcessTypeField.HAS_CHILDREN.getKey(), process.getChildren().size() > 0); + jsonObject.put(ProcessTypeField.HAS_CHILDREN.getKey(), !process.getChildren().isEmpty()); jsonObject.put(ProcessTypeField.PARENT_ID.getKey(), processParentId); jsonObject.put(ProcessTypeField.TASKS.getKey(), addObjectRelation(process.getTasks(), true)); jsonObject.put(ProcessTypeField.METADATA.getKey(), process.getMetadata()); diff --git a/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/CommandService.java b/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/CommandService.java index ce7c1901517..b35a374dbf4 100644 --- a/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/CommandService.java +++ b/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/CommandService.java @@ -38,7 +38,7 @@ CommandResult runCommand(String script) throws IOException { CommandResult commandResult = command.runCommand(script); List commandResultMessages = commandResult.getMessages(); - if (commandResultMessages.size() > 0 && commandResultMessages.get(0).contains("IOException")) { + if (!commandResultMessages.isEmpty() && commandResultMessages.get(0).contains("IOException")) { throw new IOException(commandResultMessages.get(1)); } return commandResult; diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/CalendarForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/CalendarForm.java index 6b3bbadceff..e8e52aa3177 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/CalendarForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/CalendarForm.java @@ -620,7 +620,7 @@ public void removeBlock(Block block) { if (index > 0) { index--; } - if (course.size() > 0) { + if (!course.isEmpty()) { navigate(course.get(index)); } } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java index 1c28c04a9b8..581e07eead6 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java @@ -132,7 +132,7 @@ public List getSelectedProcesses() { logger.error(e.getMessage()); } } - if (selectedProcessesOrProcessDTOs.size() > 0) { + if (!selectedProcessesOrProcessDTOs.isEmpty()) { if (selectedProcessesOrProcessDTOs.get(0) instanceof ProcessDTO) { // list contains ProcessDTO instances try { diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/FileUploadDialog.java b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/FileUploadDialog.java index 8f74d05c0c9..9874bde64cb 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/FileUploadDialog.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/FileUploadDialog.java @@ -92,7 +92,7 @@ public void handleFileUpload(FileUploadEvent event) { } } - if (createProcessForm.getProcesses().size() > 0 && additionalImport) { + if (!createProcessForm.getProcesses().isEmpty() && additionalImport) { extendsMetadataTableOfMetadataTab(processes); } else { this.createProcessForm.setProcesses(processes); @@ -116,7 +116,7 @@ private TempProcess extractParentRecordFromFile(UploadedFile uploadedFile, Docum Collection higherLevelIdentifier = this.createProcessForm.getRulesetManagement() .getFunctionalKeys(FunctionalMetadata.HIGHERLEVEL_IDENTIFIER); - if (higherLevelIdentifier.size() > 0) { + if (!higherLevelIdentifier.isEmpty()) { ImportService importService = ServiceManager.getImportService(); String parentID = importService.getParentID(internalDocument, higherLevelIdentifier.toArray()[0].toString(), importConfiguration.getParentElementTrimMode()); diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/TitleRecordLinkTab.java b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/TitleRecordLinkTab.java index 68fe0b8ea6d..ac258eebefe 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/TitleRecordLinkTab.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/TitleRecordLinkTab.java @@ -160,7 +160,7 @@ public void createInsertionPositionSelectionTree() throws DAOException, DataExce priorityList); logicalStructure.setExpanded(true); - if (selectableInsertionPositions.size() > 0) { + if (!selectableInsertionPositions.isEmpty()) { selectedInsertionPosition = (String) ((LinkedList) selectableInsertionPositions).getLast() .getValue(); } else { diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddDocStrucTypeDialog.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddDocStrucTypeDialog.java index 05ebbc55fb5..3e7d37b1815 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddDocStrucTypeDialog.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddDocStrucTypeDialog.java @@ -130,7 +130,7 @@ public void addDocStruc(boolean preview) { } if (preview && (!(StringUtils.isEmpty(selectFirstPageOnAddNode) || StringUtils.isEmpty(this.selectLastPageOnAddNode)) - || Objects.nonNull(this.preselectedViews) && this.preselectedViews.size() > 0)) { + || Objects.nonNull(this.preselectedViews) && !this.preselectedViews.isEmpty())) { dataEditor.getGalleryPanel().setGalleryViewMode(PREVIEW_MODE); } else { dataEditor.getGalleryPanel().setGalleryViewMode(LIST_MODE); @@ -393,7 +393,7 @@ public List getSelectPageOnAddNodeItems() { } private List getViewsToAdd() { - if (Objects.nonNull(preselectedViews) && preselectedViews.size() > 0) { + if (Objects.nonNull(preselectedViews) && !preselectedViews.isEmpty()) { return preselectedViews; } try { diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddPhysicalDivisionDialog.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddPhysicalDivisionDialog.java index 2835ccbd92f..ea2908602e9 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddPhysicalDivisionDialog.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddPhysicalDivisionDialog.java @@ -82,7 +82,7 @@ private void preparePossiblePositions() { Helper.getTranslation("dataEditor.position.asLastChildOfCurrentElement"))); List parents = MetadataEditor.getAncestorsOfPhysicalDivision(selectedPhysicalDivision.get(), dataEditor.getWorkpiece().getPhysicalStructure()); - if (parents.size() > 0) { + if (!parents.isEmpty()) { possiblePositions.add(new SelectItem(InsertionPosition.BEFORE_CURRENT_ELEMENT, Helper.getTranslation("dataEditor.position.beforeCurrentElement"))); possiblePositions.add(new SelectItem(InsertionPosition.AFTER_CURRENT_ELEMENT, diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/GalleryPanel.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/GalleryPanel.java index ee1994b8d46..c4f4db35d31 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/GalleryPanel.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/GalleryPanel.java @@ -130,7 +130,7 @@ public String getGalleryViewMode() { * @return value of lastSelection */ public Pair getLastSelection() { - if (dataEditor.getSelectedMedia().size() > 0) { + if (!dataEditor.getSelectedMedia().isEmpty()) { return dataEditor.getSelectedMedia().get(dataEditor.getSelectedMedia().size() - 1); } else if (dataEditor.getSelectedStructure().isPresent() && !dataEditor.getSelectedStructure().get().getViews().isEmpty()) { @@ -148,7 +148,7 @@ public Pair getLastSelection() { * @return boolean */ public boolean isLastSelection(GalleryMediaContent galleryMediaContent, GalleryStripe galleryStripe) { - if (isSelected(galleryMediaContent, galleryStripe) && dataEditor.getSelectedMedia().size() > 0 + if (isSelected(galleryMediaContent, galleryStripe) && !dataEditor.getSelectedMedia().isEmpty() && Objects.nonNull(galleryMediaContent)) { return Objects.equals(galleryMediaContent.getView().getPhysicalDivision(), dataEditor.getSelectedMedia().get(dataEditor.getSelectedMedia().size() - 1).getKey()); @@ -337,7 +337,7 @@ private void updateStructure(GalleryMediaContent galleryMediaContent, LogicalDiv } void updateSelection(PhysicalDivision physicalDivision, LogicalDivision structuralElement) { - if (physicalDivision.getMediaFiles().size() > 0) { + if (!physicalDivision.getMediaFiles().isEmpty()) { // Update structured view if (this.galleryViewMode.equals(GalleryViewMode.LIST)) { @@ -708,7 +708,7 @@ private List> getMediaWithinRangeFromSel countDown = true; } - if (galleryStripes.size() == 0) { + if (galleryStripes.isEmpty()) { return new LinkedList<>(); } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java index cf129a4dfc5..74887942d25 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java @@ -1276,7 +1276,7 @@ void reorderPhysicalDivisions(LogicalDivision toElement, insertionIndex = -1; } - if (insertionIndex < 0 || toElement.getViews().size() == 0) { + if (insertionIndex < 0 || toElement.getViews().isEmpty()) { // no insertion position was specified or the element does not contain any pages yet physicalInsertionIndex = toElement.getOrder() - 1; } else { diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/ProcessHelper.java b/Kitodo/src/main/java/org/kitodo/production/helper/ProcessHelper.java index 8008d59b9db..5989a243daa 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/ProcessHelper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/ProcessHelper.java @@ -329,7 +329,7 @@ private static String getTitleFromWorkpiece(Process process) { private static String getTitleFromParents(List parentTempProcesses, RulesetManagementInterface rulesetManagement, String acquisitionStage, List priorityList) { - if (parentTempProcesses.size() == 0) { + if (parentTempProcesses.isEmpty()) { return StringUtils.EMPTY; } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java b/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java index 657f46d50dd..19f3229fdab 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java @@ -1114,7 +1114,7 @@ public boolean searchForMedia(Process process, Workpiece workpiece) List canonicals = getCanonicalFileNamePartsAndSanitizeAbsoluteURIs(workpiece, subfolders, process.getProcessBaseUri()); - if (currentMedia.size() == 0 && canonicals.size() > 0) { + if (currentMedia.isEmpty() && !canonicals.isEmpty()) { throw new MediaNotFoundException(); } diff --git a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/SearchResultPage.java b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/SearchResultPage.java index e6d46e72091..03ba47e43c8 100644 --- a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/SearchResultPage.java +++ b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/SearchResultPage.java @@ -82,7 +82,7 @@ public void filterByProject() { */ public String getFirstSearchResultProcessTitle() { List tableDataByColumn = getTableDataByColumn(searchResultTable, 3); - if (tableDataByColumn.size() == 0 || tableDataByColumn.contains("No records found.")) { + if (tableDataByColumn.isEmpty() || tableDataByColumn.contains("No records found.")) { return null; } return tableDataByColumn.get(0); diff --git a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/TasksPage.java b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/TasksPage.java index 756b57a1d17..ce685271918 100644 --- a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/TasksPage.java +++ b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/TasksPage.java @@ -201,7 +201,7 @@ public void clickTaskTableColumnHeaderForSorting(int column) { */ public String getFirstRowTaskTitle() { List taskTitles = getTableDataByColumn(taskTable, 1); - if (taskTitles.size() > 0) { + if (!taskTitles.isEmpty()) { return taskTitles.get(0); } return "";