Skip to content

Commit acbd0c3

Browse files
Fix Codacy errors
1 parent 0c280e7 commit acbd0c3

File tree

4 files changed

+56
-34
lines changed

4 files changed

+56
-34
lines changed

Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/GalleryPanel.java

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
import org.apache.logging.log4j.Logger;
3838
import org.kitodo.api.dataeditor.rulesetmanagement.RulesetManagementInterface;
3939
import org.kitodo.api.dataformat.LogicalDivision;
40-
import org.kitodo.api.dataformat.PhysicalDivision;
4140
import org.kitodo.api.dataformat.MediaVariant;
41+
import org.kitodo.api.dataformat.PhysicalDivision;
4242
import org.kitodo.api.dataformat.View;
4343
import org.kitodo.data.database.beans.Folder;
4444
import org.kitodo.data.database.beans.Process;
@@ -528,15 +528,20 @@ public GalleryMediaContent getGalleryMediaContent(PhysicalDivision physicalDivis
528528
}
529529

530530
/**
531-
* Get a List of all PhysicalDivisions and the LogicalDivisions they are assigned to
532-
* which are displayed between two selected PhysicalDivisions. This method selects the Stripes that are affected by the selection and delegates
533-
* the selection of the contained PhysicalDivisions.
531+
* Get a List of all PhysicalDivisions and the LogicalDivisions they are
532+
* assigned to which are displayed between two selected PhysicalDivisions.
533+
* This method selects the Stripes that are affected by the selection and
534+
* delegates the selection of the contained PhysicalDivisions.
535+
*
534536
* @param first
535-
* First selected PhysicalDivision. A Pair of the PhysicalDivision and the LogicalDivision to which the PhysicalDivision is assigned.
537+
* First selected PhysicalDivision. A Pair of the
538+
* PhysicalDivision and the LogicalDivision to which the
539+
* PhysicalDivision is assigned.
536540
* @param last
537-
* Last selected PhysicalDivision. A Pair of the PhysicalDivision and the Logical Division to which the PhysicalDivision is assigned.
538-
* @return
539-
* A List of all selected PhysicalDivisions
541+
* Last selected PhysicalDivision. A Pair of the PhysicalDivision
542+
* and the Logical Division to which the PhysicalDivision is
543+
* assigned.
544+
* @return A List of all selected PhysicalDivisions
540545
*/
541546
private List<Pair<PhysicalDivision, LogicalDivision>> getMediaWithinRange(Pair<PhysicalDivision, LogicalDivision> first,
542547
Pair<PhysicalDivision, LogicalDivision> last) {
@@ -582,18 +587,23 @@ This stripe is displayed last, but is actually the logical structure (first stri
582587
}
583588

584589
/**
585-
* Get a List of all PhysicalDivisions and the LogicalDivisions they are assigned to
586-
* which are displayed between two selected PhysicalDivisions. This method selected the PhysicalDivisions between and including the two indices.
590+
* Get a List of all PhysicalDivisions and the LogicalDivisions they are
591+
* assigned to which are displayed between two selected PhysicalDivisions.
592+
* This method selected the PhysicalDivisions between and including the two
593+
* indices.
594+
*
587595
* @param firstIndices
588-
* First selected PhysicalDivision.
589-
* A Pair of indices of the PhysicalDivision and the LogicalDivision to which the PhysicalDivision is assigned.
596+
* First selected PhysicalDivision. A Pair of indices of the
597+
* PhysicalDivision and the LogicalDivision to which the
598+
* PhysicalDivision is assigned.
590599
* @param lastIndices
591-
* Last selected PhysicalDivision.
592-
* A Pair of indices of the PhysicalDivision and the Logical Division to which the PhysicalDivision is assigned.
600+
* Last selected PhysicalDivision. A Pair of indices of the
601+
* PhysicalDivision and the Logical Division to which the
602+
* PhysicalDivision is assigned.
593603
* @param galleryStripes
594-
* A List of GalleryStripes which contain the two selected PhysicalDivisions and all in between
595-
* @return
596-
* A List of all selected PhysicalDivisions
604+
* A List of GalleryStripes which contain the two selected
605+
* PhysicalDivisions and all in between
606+
* @return A List of all selected PhysicalDivisions
597607
*/
598608
private List<Pair<PhysicalDivision, LogicalDivision>> getMediaWithinRangeFromSelectedStripes(
599609
Pair<Integer, Integer> firstIndices, Pair<Integer, Integer> lastIndices, List<GalleryStripe> galleryStripes) {
@@ -720,7 +730,8 @@ public boolean isSelected(GalleryMediaContent galleryMediaContent, GalleryStripe
720730

721731
private void selectMedia(String physicalDivisionOrder, String stripeIndex, String selectionType) {
722732
PhysicalDivision selectedPhysicalDivision = null;
723-
for (PhysicalDivision physicalDivision : this.dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted()) {
733+
for (PhysicalDivision physicalDivision : this.dataEditor.getWorkpiece()
734+
.getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted()) {
724735
if (Objects.equals(physicalDivision.getOrder(), Integer.parseInt(physicalDivisionOrder))) {
725736
selectedPhysicalDivision = physicalDivision;
726737
break;
@@ -832,7 +843,8 @@ private void defaultSelect(GalleryMediaContent currentSelection, GalleryStripe p
832843
}
833844

834845
dataEditor.getSelectedMedia().clear();
835-
dataEditor.getSelectedMedia().add(new ImmutablePair<>(currentSelection.getView().getPhysicalDivision(), parentStripe.getStructure()));
846+
dataEditor.getSelectedMedia().add(
847+
new ImmutablePair<>(currentSelection.getView().getPhysicalDivision(), parentStripe.getStructure()));
836848
}
837849

838850
private void rangeSelect(GalleryMediaContent currentSelection, GalleryStripe parentStripe) {
@@ -867,11 +879,14 @@ private void multiSelect(GalleryMediaContent currentSelection, GalleryStripe par
867879
}
868880

869881
/**
870-
* Get the index of this GalleryMediaContent's PhysicalDivision out of all PhysicalDivisions
871-
* which are assigned to more than one LogicalDivision.
882+
* Get the index of this GalleryMediaContent's PhysicalDivision out of all
883+
* PhysicalDivisions which are assigned to more than one LogicalDivision.
872884
*
873-
* @param galleryMediaContent object to find the index for
874-
* @return index of the GalleryMediaContent's PhysicalDivision if present in the List of several assignments, or -1 if not present in the list.
885+
* @param galleryMediaContent
886+
* object to find the index for
887+
* @return index of the GalleryMediaContent's PhysicalDivision if present in
888+
* the List of several assignments, or -1 if not present in the
889+
* list.
875890
*/
876891
public int getSeveralAssignmentsIndex(GalleryMediaContent galleryMediaContent) {
877892
if (Objects.nonNull(galleryMediaContent.getView()) && Objects.nonNull(galleryMediaContent.getView().getPhysicalDivision())) {

Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,8 @@ private TreeNode updatePhysSelectionInLogTreeRecursive(PhysicalDivision selected
874874
&& ((StructureTreeNode) treeNode.getData()).getDataObject().equals(parentElement)
875875
&& currentTreeNode.getData() instanceof StructureTreeNode
876876
&& ((StructureTreeNode) currentTreeNode.getData()).getDataObject() instanceof View
877-
&& ((View) ((StructureTreeNode) currentTreeNode.getData()).getDataObject()).getPhysicalDivision().equals(selectedPhysicalDivision)) {
877+
&& ((View) ((StructureTreeNode) currentTreeNode.getData()).getDataObject()).getPhysicalDivision()
878+
.equals(selectedPhysicalDivision)) {
878879
currentTreeNode.setSelected(true);
879880
matchingTreeNode = currentTreeNode;
880881
} else {
@@ -1472,11 +1473,14 @@ public void setActiveTabs(String activeTabs) {
14721473
}
14731474

14741475
/**
1475-
* Get the index of this StructureTreeNode's PhysicalDivision out of all PhysicalDivisions
1476-
* which are assigned to more than one LogicalDivision.
1476+
* Get the index of this StructureTreeNode's PhysicalDivision out of all
1477+
* PhysicalDivisions which are assigned to more than one LogicalDivision.
14771478
*
1478-
* @param treeNode object to find the index for
1479-
* @return index of the StructureTreeNode's PhysicalDivision if present in the List of several assignments, or -1 if not present in the list.
1479+
* @param treeNode
1480+
* object to find the index for
1481+
* @return index of the StructureTreeNode's PhysicalDivision if present in
1482+
* the List of several assignments, or -1 if not present in the
1483+
* list.
14801484
*/
14811485
public int getMultipleAssignmentsIndex(StructureTreeNode treeNode) {
14821486
if (treeNode.getDataObject() instanceof View

Kitodo/src/main/java/org/kitodo/production/metadata/MetadataEditor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,15 @@ public static LogicalDivision addLogicalDivision(String type, Workpiece workpiec
298298
* @param parent parent of the new PhysicalDivision
299299
* @param position position relative to the parent element
300300
*/
301-
public static PhysicalDivision addPhysicalDivision(String type, Workpiece workpiece, PhysicalDivision parent, InsertionPosition position) {
301+
public static PhysicalDivision addPhysicalDivision(String type, Workpiece workpiece, PhysicalDivision parent,
302+
InsertionPosition position) {
302303
LinkedList<PhysicalDivision> grandparents = getAncestorsOfPhysicalDivision(parent, workpiece.getPhysicalStructure());
303304
List<PhysicalDivision> siblings = new LinkedList<>();
304305
if (grandparents.isEmpty()) {
305306
if (position.equals(InsertionPosition.AFTER_CURRENT_ELEMENT)
306307
|| position.equals(InsertionPosition.BEFORE_CURRENT_ELEMENT)) {
307-
Helper.setErrorMessage("No parent found for currently selected physical division to which new physical division can be appended!");
308+
Helper.setErrorMessage("No parent found for currently selected physical "
309+
+ "division to which new physical division can be appended!");
308310
}
309311
} else {
310312
siblings = grandparents.getLast().getChildren();

Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
import org.apache.logging.log4j.Logger;
3939
import org.kitodo.api.command.CommandResult;
4040
import org.kitodo.api.dataformat.LogicalDivision;
41-
import org.kitodo.api.dataformat.PhysicalDivision;
4241
import org.kitodo.api.dataformat.MediaVariant;
42+
import org.kitodo.api.dataformat.PhysicalDivision;
4343
import org.kitodo.api.dataformat.View;
4444
import org.kitodo.api.dataformat.Workpiece;
4545
import org.kitodo.api.filemanagement.FileManagementInterface;
@@ -1087,7 +1087,8 @@ public void searchForMedia(Process process, Workpiece workpiece) throws InvalidI
10871087
}
10881088
List<String> canonicals = getCanonicalFileNamePartsAndSanitizeAbsoluteURIs(workpiece, subfolders,
10891089
process.getProcessBaseUri());
1090-
addNewURIsToExistingPhysicalDivisions(mediaToAdd, workpiece.getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(), canonicals);
1090+
addNewURIsToExistingPhysicalDivisions(mediaToAdd,
1091+
workpiece.getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(), canonicals);
10911092
mediaToAdd.keySet().removeAll(canonicals);
10921093
addNewMediaToWorkpiece(canonicals, mediaToAdd, workpiece);
10931094
renumberPhysicalDivisions(workpiece, true);
@@ -1161,8 +1162,8 @@ private List<String> getCanonicalFileNamePartsAndSanitizeAbsoluteURIs(Workpiece
11611162
/**
11621163
* Adds new media variants found to existing physical divisions.
11631164
*/
1164-
private void addNewURIsToExistingPhysicalDivisions(Map<String, Map<Subfolder, URI>> mediaToAdd, List<PhysicalDivision> physicalDivisions,
1165-
List<String> canonicals) {
1165+
private void addNewURIsToExistingPhysicalDivisions(Map<String, Map<Subfolder, URI>> mediaToAdd,
1166+
List<PhysicalDivision> physicalDivisions, List<String> canonicals) {
11661167

11671168
for (int i = 0; i < canonicals.size(); i++) {
11681169
String canonical = canonicals.get(i);

0 commit comments

Comments
 (0)