From b55e5a627787b62c0cb587a9fda29d2f2afcac2c Mon Sep 17 00:00:00 2001 From: Matthias Ronge Date: Fri, 25 Jun 2021 12:08:54 +0200 Subject: [PATCH 1/8] Rename 'media unit' to 'physical division'/'physical structure' --- .../org/kitodo/api/dataformat/Division.java | 12 +- .../api/dataformat/LogicalDivision.java | 4 +- .../kitodo/api/dataformat/MediaVariant.java | 2 +- .../{MediaUnit.java => PhysicalDivision.java} | 24 +- .../java/org/kitodo/api/dataformat/View.java | 42 +-- .../org/kitodo/api/dataformat/Workpiece.java | 55 ++-- .../entities/PhysicalStructMapType.java | 8 +- .../access/AreaXmlElementAccess.java | 10 +- .../access/DivXmlElementAccess.java | 34 +-- .../access/FileXmlElementAccess.java | 80 ++--- .../access/MediaUnitMetsReferrerStorage.java | 6 +- .../access/MetsXmlElementAccess.java | 92 +++--- .../access/UseXmlAttributeAccess.java | 2 +- .../access/MetsXmlElementAccessIT.java | 64 ++-- .../metadata/MetadataValidation.java | 36 +-- .../production/forms/ProcessListBaseView.java | 6 +- .../createprocess/ProcessSimpleMetadata.java | 4 +- .../dataeditor/AddDocStrucTypeDialog.java | 32 +- ...og.java => AddPhysicalDivisionDialog.java} | 50 ++-- .../dataeditor/ChangeDocStrucTypeDialog.java | 2 +- .../forms/dataeditor/DataEditorForm.java | 86 +++--- .../forms/dataeditor/EditPagesDialog.java | 28 +- .../forms/dataeditor/GalleryMediaContent.java | 12 +- .../forms/dataeditor/GalleryPanel.java | 178 ++++++------ .../forms/dataeditor/MetadataPanel.java | 18 +- .../forms/dataeditor/PaginationPanel.java | 66 ++--- .../forms/dataeditor/StructurePanel.java | 275 +++++++++--------- .../forms/dataeditor/StructureTreeNode.java | 18 +- .../helper/SearchResultGeneration.java | 6 +- .../LegacyFileSetDocStructHelper.java | 24 +- .../LegacyInnerPhysicalDocStructHelper.java | 32 +- ...yInnerPhysicalDocStructTypePageHelper.java | 4 +- .../LegacyLogicalDocStructHelper.java | 10 +- .../LegacyMetsModsDigitalDocumentHelper.java | 4 +- .../LegacyReferenceHelper.java | 4 +- .../production/metadata/MetadataEditor.java | 93 +++--- .../process/NewspaperProcessesGenerator.java | 2 +- .../services/data/FolderService.java | 10 +- .../dataeditor/DataEditorService.java | 5 +- .../production/services/file/FileService.java | 90 +++--- .../services/schema/SchemaService.java | 42 +-- .../resources/messages/errors_en.properties | 2 +- .../resources/messages/messages_de.properties | 4 +- .../resources/messages/messages_en.properties | 4 +- .../dialogs/addDocStrucType.xhtml | 12 +- .../metadataEditor/dialogs/addMediaUnit.xhtml | 30 +- .../metadataEditor/physicalStructure.xhtml | 8 +- .../main/webapp/pages/metadataEditor.xhtml | 2 +- .../services/dataformat/MetsServiceIT.java | 8 +- 49 files changed, 823 insertions(+), 819 deletions(-) rename Kitodo-API/src/main/java/org/kitodo/api/dataformat/{MediaUnit.java => PhysicalDivision.java} (83%) rename Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/{AddMediaUnitDialog.java => AddPhysicalDivisionDialog.java} (75%) diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Division.java b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Division.java index 6bb9b5128bd..74c5c73e7be 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Division.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Division.java @@ -30,7 +30,7 @@ * * @param * There are two versions of it, an {@link LogicalDivision} - * and a {@link MediaUnit}. + * and a {@link PhysicalDivision}. */ public abstract class Division> { /** @@ -57,7 +57,7 @@ public abstract class Division> { * For logical structures meaningless, only used internally. * *

- * For media units, the display or playback order of several media + * For physical divisions, the display or playback order of several media * units referenced from one logical division is determined by * this attribute, not by the order of the references. */ @@ -72,8 +72,8 @@ public abstract class Division> { * mapped to a machine-readable value. * *

- * For media units, a human readable label for the - * order of this media unit. This need not be directly related to the + * For physical divisions, a human readable label for the + * order of this physical division. This need not be directly related to the * order number. Examples of order labels could be “I, II, III, IV, V, - , * 1, 2, 3”, meanwhile the order would be “1, 2, 3, 4, 5, 6, 7, 8, 9”. */ @@ -191,7 +191,7 @@ public void setOrder(int order) { } /** - * Returns the order label for this media unit. + * Returns the order label for this physical division. * * @return the order label */ @@ -200,7 +200,7 @@ public String getOrderlabel() { } /** - * Sets the order label for this media unit. + * Sets the order label for this physical division. * * @param orderlabel * order label to set diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/LogicalDivision.java b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/LogicalDivision.java index c5a9d09ab33..24f958ec825 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/LogicalDivision.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/LogicalDivision.java @@ -21,7 +21,7 @@ * representation of a digital medium. The logical division can be * imagined as a table of contents and is used to display the table of contents * in the viewer. It uses {@link View}s to refer to elements of the - * {@link MediaUnit} of the digital medium, or can {@link #link} to other + * {@link PhysicalDivision} of the digital medium, or can {@link #link} to other * processes. */ public class LogicalDivision extends Division { @@ -31,7 +31,7 @@ public class LogicalDivision extends Division { private LinkedMetsResource link; /** - * The views on {@link MediaUnit}s that this logical division + * The views on {@link PhysicalDivision}s that this logical division * level comprises. */ private final LinkedList views; diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaVariant.java b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaVariant.java index f1fd581dbad..a33b998f07c 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaVariant.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaVariant.java @@ -14,7 +14,7 @@ import java.util.Objects; /** - * A variant of the {@code MediaUnit}s for a particular use. By use is meant a + * A variant of the {@code PhysicalDivision}s for a particular use. By use is meant a * technical form of use. Therefore, the variant has as technical property the * Internet MIME type. Examples of variants include thumbnails, full resolution * images, file ready to print, OCR results, etc. For Production, a variant is diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaUnit.java b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/PhysicalDivision.java similarity index 83% rename from Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaUnit.java rename to Kitodo-API/src/main/java/org/kitodo/api/dataformat/PhysicalDivision.java index c7cce247068..2e113f6b86f 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/MediaUnit.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/PhysicalDivision.java @@ -23,10 +23,10 @@ import org.kitodo.api.dataformat.mets.KitodoUUID; /** - * A tree-shaped description of the media unit of the digital representation of + * A tree-shaped description of the physical division of the digital representation of * a digital medium. Each leaf of the physical structure tree represents a * single medium, possibly in several forms of digital representation. For - * books, this is typically flat, meaning the {@link Workpiece#getMediaUnit()} + * books, this is typically flat, meaning the {@link Workpiece#getPhysicalStructure()} * represents the book, and its immediate children represent the individual * views (front cover, inside cover, first page, second page, third page, …) For * other media, this may well be more complex, such as an archival box @@ -35,18 +35,18 @@ * *

* Media files that represent different representations of the same medium can - * be attached to a media unit. This can be still images in different + * be attached to a physical division. This can be still images in different * resolutions with equal image content, but also the photography of the side of * a record along with its digitized soundtrack. */ -public class MediaUnit extends Division { - // TODO: we probably need a way to configure MediaUnit types to be considered for renumbering/pagination! +public class PhysicalDivision extends Division { + // TODO: we probably need a way to configure PhysicalDivision types to be considered for renumbering/pagination! public static final String TYPE_PAGE = "page"; public static final String TYPE_TRACK = "track"; public static final String TYPE_OTHER = "other"; /** - * Each media unit can be available in different variants, for each of which + * Each physical division can be available in different variants, for each of which * a media file is available. This is in this map. */ private Map mediaFiles = new HashMap<>(); @@ -62,9 +62,9 @@ public class MediaUnit extends Division { private transient List logicalDivisions; /** - * Creates a new MediaUnit. + * Creates a new PhysicalDivision. */ - public MediaUnit() { + public PhysicalDivision() { logicalDivisions = new LinkedList<>(); } @@ -103,7 +103,7 @@ public void setDivId(String divId) { /** * The list is available to assist to render the front-end by holding the - * elements of the logical structure that reference this media unit. It is + * elements of the logical structure that reference this physical division. It is * transient, meaning that its content is not saved and is not restored when * it is loaded. * @@ -135,11 +135,11 @@ public boolean equals(Object o) { if (!super.equals(o)) { return false; } - if (!(o instanceof MediaUnit)) { + if (!(o instanceof PhysicalDivision)) { return false; } - MediaUnit mediaUnit = (MediaUnit) o; - return Objects.equals(mediaFiles, mediaUnit.mediaFiles); + PhysicalDivision physicalDivision = (PhysicalDivision) o; + return Objects.equals(mediaFiles, physicalDivision.mediaFiles); } @Override diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/View.java b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/View.java index 0ac27f28e5c..12aca7ecca2 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/View.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/View.java @@ -14,48 +14,48 @@ import java.util.Objects; /** - * A view on a media unit. The individual levels of the + * A view on a physical division. The individual levels of the * {@link LogicalDivision} refer to {@code View}s on - * {@link MediaUnit}s. At the moment, each {@code View} refers to exactly one - * {@code MediaUnit} as a whole. + * {@link PhysicalDivision}s. At the moment, each {@code View} refers to exactly one + * {@code PhysicalDivision} as a whole. */ public class View { /** - * Creates a new view with a media unit. + * Creates a new view with a physical division. * - * @param mediaUnit - * media unit to set in the view - * @return a new view with a media unit + * @param physicalDivision + * physical division to set in the view + * @return a new view with a physical division */ - public static View of(MediaUnit mediaUnit) { + public static View of(PhysicalDivision physicalDivision) { View view = new View(); - view.setMediaUnit(mediaUnit); + view.setPhysicalDivision(physicalDivision); return view; } /** * Media unit in view. */ - private MediaUnit mediaUnit; + private PhysicalDivision physicalDivision; /** - * Returns the media unit in the view. + * Returns the physical division in the view. * - * @return the media unit + * @return the physical division */ - public MediaUnit getMediaUnit() { - return mediaUnit; + public PhysicalDivision getPhysicalDivision() { + return physicalDivision; } /** - * Inserts a media unit into the view. + * Inserts a physical division into the view. * - * @param mediaUnit - * media unit to insert + * @param physicalDivision + * physical division to insert */ - public void setMediaUnit(MediaUnit mediaUnit) { - this.mediaUnit = mediaUnit; + public void setPhysicalDivision(PhysicalDivision physicalDivision) { + this.physicalDivision = physicalDivision; } @Override @@ -67,14 +67,14 @@ public boolean equals(Object o) { return false; } View view = (View) o; - return Objects.equals(mediaUnit, view.mediaUnit); + return Objects.equals(physicalDivision, view.physicalDivision); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; - hashCode = prime * hashCode + ((mediaUnit == null) ? 0 : mediaUnit.hashCode()); + hashCode = prime * hashCode + ((physicalDivision == null) ? 0 : physicalDivision.hashCode()); return hashCode; } } diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Workpiece.java b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Workpiece.java index c89fec00bf8..602c2e10e9d 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Workpiece.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Workpiece.java @@ -41,10 +41,10 @@ public class Workpiece { private String id; /** - * The media unit that belongs to this workpiece. The media unit can have + * The physical division that belongs to this workpiece. The physical division can have * children, such as a bound book that can have pages. */ - private MediaUnit mediaUnit = new MediaUnit(); + private PhysicalDivision physicalStructure = new PhysicalDivision(); /** * The logical logical division. @@ -99,12 +99,12 @@ public void setId(String id) { } /** - * Returns the media unit of this workpiece. + * Returns the physical structure of this workpiece. * - * @return the media units + * @return the physical structure */ - public MediaUnit getMediaUnit() { - return mediaUnit; + public PhysicalDivision getPhysicalStructure() { + return physicalStructure; } /** @@ -117,13 +117,13 @@ public LogicalDivision getLogicalStructure() { } /** - * Sets the media unit of the workpiece. + * Sets the physical structure of the workpiece. * - * @param mediaUnit - * media unit to set + * @param physicalStructure + * physical structure to set */ - public void setMediaUnit(MediaUnit mediaUnit) { - this.mediaUnit = mediaUnit; + public void setPhysicalStructure(PhysicalDivision physicalDivision) { + this.physicalStructure = physicalDivision; } /** @@ -161,7 +161,7 @@ public boolean equals(Object o) { return Objects.equals(creationDate, workpiece.creationDate) && Objects.equals(editHistory, workpiece.editHistory) && Objects.equals(id, workpiece.id) - && Objects.equals(mediaUnit, workpiece.mediaUnit) + && Objects.equals(physicalStructure, workpiece.physicalStructure) && Objects.equals(logicalStructure, workpiece.logicalStructure); } @@ -179,31 +179,32 @@ public List getAllLogicalDivisions() { } /** - * Returns all child media units of the media unit of the workpiece with + * Returns all child physical divisions of the physical division of the workpiece with * type "page" sorted by their {@code order} as a flat list. The root media - * unit is not contained. The list isn’t backed by the media units, which + * unit is not contained. The list isn’t backed by the physical divisions, which * means that insertions and deletions in the list would not change the - * media units. Therefore a list that cannot be modified is returned. + * physical divisions. Therefore a list that cannot be modified is returned. * - * @return all media units with type "page", sorted by their {@code order} + * @return all physical divisions with type "page", sorted by their {@code order} */ - public List getAllMediaUnitChildrenFilteredByTypePageAndSorted() { - List mediaUnits = mediaUnit.getChildren().stream().flatMap(Workpiece::treeStream) - .filter(mediaUnitToCheck -> Objects.equals(mediaUnitToCheck.getType(), MediaUnit.TYPE_PAGE)) - .sorted(Comparator.comparing(MediaUnit::getOrder)).collect(Collectors.toList()); - return Collections.unmodifiableList(mediaUnits); + public List getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted() { + List physicalDivisions = physicalStructure.getChildren().stream() + .flatMap(Workpiece::treeStream) + .filter(physicalDivisionToCheck -> Objects.equals(physicalDivisionToCheck.getType(), PhysicalDivision.TYPE_PAGE)) + .sorted(Comparator.comparing(PhysicalDivision::getOrder)).collect(Collectors.toList()); + return Collections.unmodifiableList(physicalDivisions); } /** - * Returns all media units of the media unit of the workpiece as a flat - * list. The list isn’t backed by the media units, which means that - * insertions and deletions in the list would not change the media units. + * Returns all physical divisions of the physical division of the workpiece as a flat + * list. The list isn’t backed by the physical divisions, which means that + * insertions and deletions in the list would not change the physical divisions. * Therefore a list that cannot be modified is returned. * - * @return all media units as an unmodifiable list + * @return all physical divisions as an unmodifiable list */ - public List getAllMediaUnits() { - return Collections.unmodifiableList(treeStream(mediaUnit).collect(Collectors.toList())); + public List getAllPhysicalDivisions() { + return Collections.unmodifiableList(treeStream(physicalStructure).collect(Collectors.toList())); } /** diff --git a/Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/entities/PhysicalStructMapType.java b/Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/entities/PhysicalStructMapType.java index 8f6be036ebb..1471cd4249b 100644 --- a/Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/entities/PhysicalStructMapType.java +++ b/Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/entities/PhysicalStructMapType.java @@ -17,7 +17,7 @@ import java.util.NoSuchElementException; import java.util.Objects; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.config.KitodoConfig; import org.kitodo.config.enums.ParameterDataEditor; import org.kitodo.dataeditor.MetsKitodoObjectFactory; @@ -77,12 +77,12 @@ private List getDivTypesByFileTypes(List fileTypes) { private String getPhysicalDivTypeByFileType(FileType file) { if (file.getMIMETYPE().contains("image")) { - return MediaUnit.TYPE_PAGE; + return PhysicalDivision.TYPE_PAGE; } if (file.getMIMETYPE().contains("audio")) { - return MediaUnit.TYPE_TRACK; + return PhysicalDivision.TYPE_TRACK; } - return MediaUnit.TYPE_OTHER; + return PhysicalDivision.TYPE_OTHER; } private DivType getDivById(String id) { diff --git a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/AreaXmlElementAccess.java b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/AreaXmlElementAccess.java index d1bc90b6b5f..f7e6514dce0 100644 --- a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/AreaXmlElementAccess.java +++ b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/AreaXmlElementAccess.java @@ -14,11 +14,11 @@ import org.kitodo.api.dataformat.View; /** - * A view on a media unit. The individual levels of the {@link DivXmlElementAccess} refer + * A view on a physical division. The individual levels of the {@link DivXmlElementAccess} refer * to {@code View}s on {@link FileXmlElementAccess}s. At the moment, each {@code View} - * refers to exactly one {@code MediaUnit} as a whole. This concept level has + * refers to exactly one {@code PhysicalDivision} as a whole. This concept level has * been added here in order to be able to expand it in the future in order to be - * able to refer to individual parts of a {@code MediaUnit}. + * able to refer to individual parts of a {@code PhysicalDivision}. */ public class AreaXmlElementAccess { @@ -39,10 +39,10 @@ public AreaXmlElementAccess() { * called module-internally when loading a METS file. * * @param fileXmlElementAccess - * media unit in view + * physical division in view */ AreaXmlElementAccess(FileXmlElementAccess fileXmlElementAccess) { - view.setMediaUnit(fileXmlElementAccess.getMediaUnit()); + view.setPhysicalDivision(fileXmlElementAccess.getPhysicalDivision()); } View getView() { 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 3d1b21abc1c..31fc70155b5 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 @@ -35,7 +35,7 @@ import org.kitodo.api.MetadataEntry; import org.kitodo.api.MetadataGroup; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; import org.kitodo.api.dataformat.mets.KitodoUUID; import org.kitodo.dataformat.metskitodo.AmdSecType; @@ -94,15 +94,15 @@ public DivXmlElementAccess() { * @param mets * METS data structure from which it is possible to determine * what kind of metadata section is linked - * @param mediaUnitsMap - * From this map, the media units are read, which must be + * @param physicalDivisionsMap + * From this map, the physical divisions are read, which must be * referenced here by their ID. * @param parentOrder * This represents the value of the parent's {@code ORDER} attribute. It is not required for logical elements by the * mets standard but is used in Kitodo internal data format. It helps to display logical and physical elements in an * advanced combined tree. */ - DivXmlElementAccess(DivType div, Mets mets, Map> mediaUnitsMap, int parentOrder) { + DivXmlElementAccess(DivType div, Mets mets, Map> physicalDivisionsMap, int parentOrder) { super(); div.getCONTENTIDS().parallelStream().map(URI::create).forEachOrdered(super.getContentIds()::add); super.setLabel(div.getLABEL()); @@ -123,16 +123,16 @@ public DivXmlElementAccess() { } super.setOrderlabel(div.getORDERLABEL()); for (DivType child : div.getDiv()) { - getChildren().add(new DivXmlElementAccess(child, mets, mediaUnitsMap, getOrder())); + getChildren().add(new DivXmlElementAccess(child, mets, physicalDivisionsMap, getOrder())); } super.setType(div.getTYPE()); - List fileXmlElementAccesses = mediaUnitsMap.get(div.getID()); + List fileXmlElementAccesses = physicalDivisionsMap.get(div.getID()); if (Objects.nonNull(fileXmlElementAccesses)) { for (FileXmlElementAccess fileXmlElementAccess : fileXmlElementAccesses) { if (Objects.nonNull(fileXmlElementAccess) - && !fileXmlElementAccessIsLinkedToChildren(fileXmlElementAccess, div.getDiv(), mediaUnitsMap)) { + && !fileXmlElementAccessIsLinkedToChildren(fileXmlElementAccess, div.getDiv(), physicalDivisionsMap)) { super.getViews().add(new AreaXmlElementAccess(fileXmlElementAccess).getView()); - fileXmlElementAccess.getMediaUnit().getLogicalDivisions().add(this); + fileXmlElementAccess.getPhysicalDivision().getLogicalDivisions().add(this); } } } @@ -141,18 +141,18 @@ public DivXmlElementAccess() { private boolean fileXmlElementAccessIsLinkedToChildren(FileXmlElementAccess fileXmlElementAccess, List divs, - Map> mediaUnitsMap) { + Map> physicalDivisionsMap) { if (divs.size() == 0) { return false; } boolean test = false; for (DivType div : divs) { - List fileXmlElementAccesses = mediaUnitsMap.get(div.getID()); + List fileXmlElementAccesses = physicalDivisionsMap.get(div.getID()); if (Objects.nonNull(fileXmlElementAccesses) && fileXmlElementAccesses.contains(fileXmlElementAccess)) { return true; } if (div.getDiv().size() > 0 - && fileXmlElementAccessIsLinkedToChildren(fileXmlElementAccess, div.getDiv(), mediaUnitsMap)) { + && fileXmlElementAccessIsLinkedToChildren(fileXmlElementAccess, div.getDiv(), physicalDivisionsMap)) { test = true; } } @@ -227,8 +227,8 @@ static final Collection readMetadata(MdSecType mdSecType, MdSec mdSec) /** * Creates a METS {@code

} element from this structure. * - * @param mediaUnitIDs - * the assigned identifier for each media unit so that the link + * @param physicalDivisionIDs + * the assigned identifier for each physical division so that the link * pairs of the struct link section can be formed later * @param smLinkData * the link pairs of the struct link section are added to this @@ -237,7 +237,7 @@ static final Collection readMetadata(MdSecType mdSecType, MdSec mdSec) * the METS structure in which the metadata is added * @return a METS {@code
} element */ - DivType toDiv(Map mediaUnitIDs, LinkedList> smLinkData, Mets mets) { + DivType toDiv(Map physicalDivisionIDs, LinkedList> smLinkData, Mets mets) { DivType div = new DivType(); div.setID(metsReferrerId); if (!super.getContentIds().isEmpty()) { @@ -249,8 +249,8 @@ DivType toDiv(Map mediaUnitIDs, LinkedList Pair.of(metsReferrerId, mediaUnitId)).collect(Collectors.toList())); + smLinkData.addAll(super.getViews().stream().map(View::getPhysicalDivision).map(physicalDivisionIDs::get) + .map(physicalDivisionId -> Pair.of(metsReferrerId, physicalDivisionId)).collect(Collectors.toList())); Optional optionalDmdSec = createMdSec(super.getMetadata(), MdSec.DMD_SEC); if (optionalDmdSec.isPresent()) { @@ -269,7 +269,7 @@ DivType toDiv(Map mediaUnitIDs, LinkedList} + * Constructor for developing a physical division from a METS {@code
} * element. * * @param div @@ -62,7 +62,7 @@ public FileXmlElementAccess() { */ FileXmlElementAccess(DivType div, Mets mets, Map useXmlAttributeAccess) { this(); - mediaUnit.setDivId(div.getID()); + physicalDivision.setDivId(div.getID()); Map mediaFiles = new HashMap<>(); for (Fptr fptr : div.getFptr()) { Object fileId = fptr.getFILEID(); @@ -79,74 +79,74 @@ public FileXmlElementAccess() { throw new IllegalArgumentException("Corrupt file: not referenced in "); } FLocatXmlElementAccess fLocatXmlElementAccess = new FLocatXmlElementAccess(file); - mediaUnit.storeFileId(fLocatXmlElementAccess); + physicalDivision.storeFileId(fLocatXmlElementAccess); mediaFiles.put(mediaVariant, fLocatXmlElementAccess.getUri()); } } - mediaUnit.getMediaFiles().putAll(mediaFiles); + physicalDivision.getMediaFiles().putAll(mediaFiles); BigInteger order = div.getORDER(); if (Objects.nonNull(order)) { - mediaUnit.setOrder(order.intValue()); + physicalDivision.setOrder(order.intValue()); } - mediaUnit.setOrderlabel(div.getORDERLABEL()); - mediaUnit.setType(div.getTYPE()); + physicalDivision.setOrderlabel(div.getORDERLABEL()); + physicalDivision.setType(div.getTYPE()); for (Object mdSecType : div.getDMDID()) { - mediaUnit.getMetadata().addAll(DivXmlElementAccess.readMetadata((MdSecType) mdSecType, MdSec.DMD_SEC)); + physicalDivision.getMetadata().addAll(DivXmlElementAccess.readMetadata((MdSecType) mdSecType, MdSec.DMD_SEC)); } for (Object mdSecType : div.getADMID()) { - mediaUnit.getMetadata().addAll(DivXmlElementAccess.readMetadata((MdSecType) mdSecType, + physicalDivision.getMetadata().addAll(DivXmlElementAccess.readMetadata((MdSecType) mdSecType, DivXmlElementAccess.amdSecTypeOf(mets, (MdSecType) mdSecType))); } } - FileXmlElementAccess(MediaUnit mediaUnit) { - if (mediaUnit instanceof MediaUnitMetsReferrerStorage) { - this.mediaUnit = (MediaUnitMetsReferrerStorage) mediaUnit; + FileXmlElementAccess(PhysicalDivision physicalDivision) { + if (physicalDivision instanceof PhysicalDivisionMetsReferrerStorage) { + this.physicalDivision = (PhysicalDivisionMetsReferrerStorage) physicalDivision; } else { - this.mediaUnit = new MediaUnitMetsReferrerStorage(); - this.mediaUnit.getMediaFiles().putAll(mediaUnit.getMediaFiles()); - this.mediaUnit.getMetadata().addAll(mediaUnit.getMetadata()); - this.mediaUnit.setOrder(mediaUnit.getOrder()); - this.mediaUnit.setOrderlabel(mediaUnit.getOrderlabel()); - this.mediaUnit.setType(mediaUnit.getType()); + this.physicalDivision = new PhysicalDivisionMetsReferrerStorage(); + this.physicalDivision.getMediaFiles().putAll(physicalDivision.getMediaFiles()); + this.physicalDivision.getMetadata().addAll(physicalDivision.getMetadata()); + this.physicalDivision.setOrder(physicalDivision.getOrder()); + this.physicalDivision.setOrderlabel(physicalDivision.getOrderlabel()); + this.physicalDivision.setType(physicalDivision.getType()); } } - MediaUnit getMediaUnit() { - return mediaUnit; + PhysicalDivision getPhysicalDivision() { + return physicalDivision; } /** - * Creates a new METS {@code
} element for this media unit. + * Creates a new METS {@code
} element for this physical division. * * @param mediaFilesToIDFiles * map containing the corresponding XML file element for each - * media unit, necessary for linking - * @param mediaUnitIDs - * map with the assigned identifier for each media unit to form + * physical division, necessary for linking + * @param physicalDivisionIDs + * map with the assigned identifier for each physical division to form * the link pairs of the struct link section * @param mets * the METS structure in which the metadata is added - * @return a new {@code
} element for this media unit + * @return a new {@code
} element for this physical division */ DivType toDiv(Map mediaFilesToIDFiles, - Map mediaUnitIDs, MetsType mets) { + Map physicalDivisionIDs, MetsType mets) { DivType div = new DivType(); - String divId = mediaUnit.getDivId(); + String divId = physicalDivision.getDivId(); div.setID(divId); - mediaUnitIDs.put(mediaUnit, divId); - if (mediaUnit.getOrder() > 0) { - div.setORDER(BigInteger.valueOf(mediaUnit.getOrder())); + physicalDivisionIDs.put(physicalDivision, divId); + if (physicalDivision.getOrder() > 0) { + div.setORDER(BigInteger.valueOf(physicalDivision.getOrder())); } - div.setORDERLABEL(mediaUnit.getOrderlabel()); - div.setTYPE(mediaUnit.getType()); - for (Entry use : mediaUnit.getMediaFiles().entrySet()) { + div.setORDERLABEL(physicalDivision.getOrderlabel()); + div.setTYPE(physicalDivision.getType()); + for (Entry use : physicalDivision.getMediaFiles().entrySet()) { Fptr fptr = new Fptr(); fptr.setFILEID(mediaFilesToIDFiles.get(use.getValue())); div.getFptr().add(fptr); } - Optional optionalDmdSec = DivXmlElementAccess.createMdSec(mediaUnit.getMetadata(), MdSec.DMD_SEC); + Optional optionalDmdSec = DivXmlElementAccess.createMdSec(physicalDivision.getMetadata(), MdSec.DMD_SEC); String metsReferrerId = KitodoUUID.randomUUID(); if (optionalDmdSec.isPresent()) { MdSecType dmdSec = optionalDmdSec.get(); @@ -155,7 +155,7 @@ DivType toDiv(Map mediaFilesToIDFiles, mets.getDmdSec().add(dmdSec); div.getDMDID().add(dmdSec); } - Optional optionalAmdSec = DivXmlElementAccess.createAmdSec(mediaUnit.getMetadata(), metsReferrerId, + Optional optionalAmdSec = DivXmlElementAccess.createAmdSec(physicalDivision.getMetadata(), metsReferrerId, div); if (optionalAmdSec.isPresent()) { AmdSecType admSec = optionalAmdSec.get(); diff --git a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MediaUnitMetsReferrerStorage.java b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MediaUnitMetsReferrerStorage.java index f1f902cd2c5..29febd3c693 100644 --- a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MediaUnitMetsReferrerStorage.java +++ b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MediaUnitMetsReferrerStorage.java @@ -15,13 +15,13 @@ import java.util.HashMap; import java.util.Map; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; /** - * A memory brick to preserve the METS IDs of the media unit div and the media + * A memory brick to preserve the METS IDs of the physical division div and the media * files. */ -class MediaUnitMetsReferrerStorage extends MediaUnit { +class PhysicalDivisionMetsReferrerStorage extends PhysicalDivision { /** * Save the METS identifiers for the files. diff --git a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MetsXmlElementAccess.java b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MetsXmlElementAccess.java index 3c63ea9ecd6..1e2bfe7bbb2 100644 --- a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MetsXmlElementAccess.java +++ b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MetsXmlElementAccess.java @@ -37,7 +37,7 @@ import javax.xml.datatype.XMLGregorianCalendar; import org.apache.commons.lang3.tuple.Pair; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; import org.kitodo.api.dataformat.ProcessingNote; import org.kitodo.api.dataformat.Workpiece; @@ -62,20 +62,20 @@ * *

* A {@code Workpiece} has two essential characteristics: {@link FileXmlElementAccess}s and - * an outline {@link DivXmlElementAccess}. {@code MediaUnit}s are the types of every + * an outline {@link DivXmlElementAccess}. {@code PhysicalDivision}s are the types of every * single digital medium on a conceptual level, such as the individual pages of - * a book. Each {@code MediaUnit} can be in different {@link UseXmlAttributeAccess}s (for + * a book. Each {@code PhysicalDivision} can be in different {@link UseXmlAttributeAccess}s (for * example, in different resolutions or file formats). Each {@code MediaVariant} - * of a {@code MediaUnit} resides in a {@link FLocatXmlElementAccess} in the data store. + * of a {@code PhysicalDivision} resides in a {@link FLocatXmlElementAccess} in the data store. * *

* The {@code LogicalDivision} is a tree structure that can be finely * subdivided, e.g. a book, in which the chapters, in it individual elements * such as tables or figures. Each outline level points to the - * {@code MediaUnit}s that belong to it via {@link AreaXmlElementAccess}s. - * Currently, a {@code View} always contains exactly one {@code MediaUnit} unit, + * {@code PhysicalDivision}s that belong to it via {@link AreaXmlElementAccess}s. + * Currently, a {@code View} always contains exactly one {@code PhysicalDivision} unit, * here a simple expandability is provided, so that in a future version excerpts - * from {@code MediaUnit}s can be described. Each outline level can be described + * from {@code PhysicalDivision}s can be described. Each outline level can be described * with any {@link MetadataXmlElementsAccess}. * * @see "https://www.zvdd.de/fileadmin/AGSDD-Redaktion/METS_Anwendungsprofil_2.0.pdf" @@ -131,40 +131,40 @@ private MetsXmlElementAccess(Mets mets) { UseXmlAttributeAccess::getMediaVariant)) : new HashMap<>(); Optional optionalPhysicalStructMap = getStructMapsStreamByType(mets, "PHYSICAL").findFirst(); - Map divIDsToMediaUnits = new HashMap<>(); + Map divIDsToPhysicalDivisions = new HashMap<>(); if (optionalPhysicalStructMap.isPresent()) { DivType div = optionalPhysicalStructMap.get().getDiv(); FileXmlElementAccess fileXmlElementAccess = new FileXmlElementAccess(div, mets, useXmlAttributeAccess); - MediaUnit mediaUnit = fileXmlElementAccess.getMediaUnit(); - workpiece.setMediaUnit(mediaUnit); - divIDsToMediaUnits.put(div.getID(), fileXmlElementAccess); - readMeadiaUnitsTreeRecursive(div, mets, useXmlAttributeAccess, mediaUnit, divIDsToMediaUnits); + PhysicalDivision physicalDivision = fileXmlElementAccess.getPhysicalDivision(); + workpiece.setPhysicalStructure(physicalDivision); + divIDsToPhysicalDivisions.put(div.getID(), fileXmlElementAccess); + readMeadiaUnitsTreeRecursive(div, mets, useXmlAttributeAccess, physicalDivision, divIDsToPhysicalDivisions); } if (mets.getStructLink() == null) { mets.setStructLink(new StructLink()); } - Map> mediaUnitsMap = new HashMap<>(); + Map> physicalDivisionsMap = new HashMap<>(); for (Object smLinkOrSmLinkGrp : mets.getStructLink().getSmLinkOrSmLinkGrp()) { if (smLinkOrSmLinkGrp instanceof SmLink) { SmLink smLink = (SmLink) smLinkOrSmLinkGrp; - mediaUnitsMap.computeIfAbsent(smLink.getFrom(), any -> new LinkedList<>()); - mediaUnitsMap.get(smLink.getFrom()).add(divIDsToMediaUnits.get(smLink.getTo())); + physicalDivisionsMap.computeIfAbsent(smLink.getFrom(), any -> new LinkedList<>()); + physicalDivisionsMap.get(smLink.getFrom()).add(divIDsToPhysicalDivisions.get(smLink.getTo())); } } workpiece.setLogicalStructure(getStructMapsStreamByType(mets, "LOGICAL") - .map(structMap -> new DivXmlElementAccess(structMap.getDiv(), mets, mediaUnitsMap, 1)).collect(Collectors.toList()) + .map(structMap -> new DivXmlElementAccess(structMap.getDiv(), mets, physicalDivisionsMap, 1)).collect(Collectors.toList()) .iterator().next()); } private void readMeadiaUnitsTreeRecursive(DivType div, Mets mets, Map useXmlAttributeAccess, - MediaUnit mediaUnit, Map divIDsToMediaUnits) { + PhysicalDivision physicalDivision, Map divIDsToPhysicalDivisions) { for (DivType child : div.getDiv()) { FileXmlElementAccess fileXmlElementAccess = new FileXmlElementAccess(child, mets, useXmlAttributeAccess); - MediaUnit childMediaUnit = fileXmlElementAccess.getMediaUnit(); - mediaUnit.getChildren().add(childMediaUnit); - divIDsToMediaUnits.put(child.getID(), fileXmlElementAccess); - readMeadiaUnitsTreeRecursive(child, mets, useXmlAttributeAccess, childMediaUnit, divIDsToMediaUnits); + PhysicalDivision childPhysicalDivision = fileXmlElementAccess.getPhysicalDivision(); + physicalDivision.getChildren().add(childPhysicalDivision); + divIDsToPhysicalDivisions.put(child.getID(), fileXmlElementAccess); + readMeadiaUnitsTreeRecursive(child, mets, useXmlAttributeAccess, childPhysicalDivision, divIDsToPhysicalDivisions); } } @@ -245,13 +245,13 @@ private Mets toMets() { Map mediaFilesToIDFiles = new HashMap<>(); mets.setFileSec(generateFileSec(mediaFilesToIDFiles)); - Map mediaUnitIDs = new HashMap<>(); - mets.getStructMap().add(generatePhysicalStructMap(mediaFilesToIDFiles, mediaUnitIDs, mets)); + Map physicalDivisionIDs = new HashMap<>(); + mets.getStructMap().add(generatePhysicalStructMap(mediaFilesToIDFiles, physicalDivisionIDs, mets)); LinkedList> smLinkData = new LinkedList<>(); StructMapType logical = new StructMapType(); logical.setTYPE("LOGICAL"); - logical.setDiv(new DivXmlElementAccess(workpiece.getLogicalStructure()).toDiv(mediaUnitIDs, smLinkData, mets)); + logical.setDiv(new DivXmlElementAccess(workpiece.getLogicalStructure()).toDiv(physicalDivisionIDs, smLinkData, mets)); mets.getStructMap().add(logical); mets.setStructLink(createStructLink(smLinkData)); @@ -305,22 +305,22 @@ private static XMLGregorianCalendar convertDate(GregorianCalendar gregorianCalen * ZVDD DFG Viewer Application Profile, the files are declared in exactly * the opposite way as they are managed in Production. That is, there are * file groups, each file group accommodating the files of a media variant. - * Therefore, the media units are first resolved according to their media + * Therefore, the physical divisions are first resolved according to their media * variants, then the corresponding XML elements are generated. * * @param mediaFilesToIDFiles - * In this map, for each media unit, the corresponding XML file + * In this map, for each physical division, the corresponding XML file * element is added, so that it can be used for linking later. * @return */ private FileSec generateFileSec(Map mediaFilesToIDFiles) { FileSec fileSec = new FileSec(); - Map> useToMediaUnits = new HashMap<>(); + Map> useToPhysicalDivisions = new HashMap<>(); Map, String> fileIds = new HashMap<>(); - generateFileSecRecursive(workpiece.getMediaUnit(), useToMediaUnits, fileIds); + generateFileSecRecursive(workpiece.getPhysicalStructure(), useToPhysicalDivisions, fileIds); - for (Entry> fileGrpData : useToMediaUnits.entrySet()) { + for (Entry> fileGrpData : useToPhysicalDivisions.entrySet()) { FileGrp fileGrp = new FileGrp(); UseXmlAttributeAccess useXmlAttributeAccess = fileGrpData.getKey(); fileGrp.setUSE(useXmlAttributeAccess.getMediaVariant().getUse()); @@ -337,20 +337,20 @@ private FileSec generateFileSec(Map mediaFilesToIDFiles) { return fileSec; } - private void generateFileSecRecursive(MediaUnit mediaUnit, Map> useToMediaUnits, + private void generateFileSecRecursive(PhysicalDivision physicalDivision, Map> useToPhysicalDivisions, Map, String> fileIds) { - for (Entry variantEntry : mediaUnit.getMediaFiles().entrySet()) { + for (Entry variantEntry : physicalDivision.getMediaFiles().entrySet()) { UseXmlAttributeAccess use = new UseXmlAttributeAccess(variantEntry.getKey()); - useToMediaUnits.computeIfAbsent(use, any -> new HashSet<>()); + useToPhysicalDivisions.computeIfAbsent(use, any -> new HashSet<>()); URI uri = variantEntry.getValue(); - useToMediaUnits.get(use).add(uri); - if (mediaUnit instanceof MediaUnitMetsReferrerStorage) { - fileIds.put(Pair.of(use, uri), ((MediaUnitMetsReferrerStorage) mediaUnit).getFileId(uri)); + useToPhysicalDivisions.get(use).add(uri); + if (physicalDivision instanceof PhysicalDivisionMetsReferrerStorage) { + fileIds.put(Pair.of(use, uri), ((PhysicalDivisionMetsReferrerStorage) physicalDivision).getFileId(uri)); } } - for (MediaUnit child : mediaUnit.getChildren()) { - generateFileSecRecursive(child, useToMediaUnits, fileIds); + for (PhysicalDivision child : physicalDivision.getChildren()) { + generateFileSecRecursive(child, useToPhysicalDivisions, fileIds); } } @@ -362,28 +362,28 @@ private void generateFileSecRecursive(MediaUnit mediaUnit, Map mediaFilesToIDFiles, Map mediaUnitIDs, MetsType mets) { + Map mediaFilesToIDFiles, Map physicalDivisionIDs, MetsType mets) { StructMapType physical = new StructMapType(); physical.setTYPE("PHYSICAL"); physical.setDiv( - generatePhysicalStructMapRecursive(workpiece.getMediaUnit(), mediaFilesToIDFiles, mediaUnitIDs, mets)); + generatePhysicalStructMapRecursive(workpiece.getPhysicalStructure(), mediaFilesToIDFiles, physicalDivisionIDs, mets)); return physical; } - private DivType generatePhysicalStructMapRecursive(MediaUnit mediaUnit, Map mediaFilesToIDFiles, - Map mediaUnitIDs, MetsType mets) { - DivType div = new FileXmlElementAccess(mediaUnit).toDiv(mediaFilesToIDFiles, mediaUnitIDs, mets); - for (MediaUnit child : mediaUnit.getChildren()) { - div.getDiv().add(generatePhysicalStructMapRecursive(child, mediaFilesToIDFiles, mediaUnitIDs, mets)); + private DivType generatePhysicalStructMapRecursive(PhysicalDivision physicalDivision, Map mediaFilesToIDFiles, + Map physicalDivisionIDs, MetsType mets) { + DivType div = new FileXmlElementAccess(physicalDivision).toDiv(mediaFilesToIDFiles, physicalDivisionIDs, mets); + for (PhysicalDivision child : physicalDivision.getChildren()) { + div.getDiv().add(generatePhysicalStructMapRecursive(child, mediaFilesToIDFiles, physicalDivisionIDs, mets)); } return div; } diff --git a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/UseXmlAttributeAccess.java b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/UseXmlAttributeAccess.java index 6fa70147230..a984cc675aa 100644 --- a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/UseXmlAttributeAccess.java +++ b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/UseXmlAttributeAccess.java @@ -21,7 +21,7 @@ import org.kitodo.dataformat.metskitodo.MetsType.FileSec.FileGrp; /** - * A variant of the {@code MediaUnit}s for a particular use. By use is meant a + * A variant of the {@code PhysicalDivision}s for a particular use. By use is meant a * technical form of use. Therefore, the variant has as technical property the * Internet MIME type. Examples of variants include thumbnails, full resolution * images, file ready to print, OCR results, etc. For Production, a variant is diff --git a/Kitodo-DataFormat/src/test/java/org/kitodo/dataformat/access/MetsXmlElementAccessIT.java b/Kitodo-DataFormat/src/test/java/org/kitodo/dataformat/access/MetsXmlElementAccessIT.java index b75670d3c08..2d0b8e9fb75 100644 --- a/Kitodo-DataFormat/src/test/java/org/kitodo/dataformat/access/MetsXmlElementAccessIT.java +++ b/Kitodo-DataFormat/src/test/java/org/kitodo/dataformat/access/MetsXmlElementAccessIT.java @@ -33,7 +33,7 @@ import org.kitodo.api.MetadataEntry; import org.kitodo.api.MetadataGroup; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; import org.kitodo.api.dataformat.ProcessingNote; import org.kitodo.api.dataformat.View; @@ -56,7 +56,7 @@ public void testRead() throws Exception { .read(new FileInputStream(new File("src/test/resources/meta.xml"))); // METS file has 183 associated images - assertEquals(183, workpiece.getMediaUnit().getChildren().size()); + assertEquals(183, workpiece.getPhysicalStructure().getChildren().size()); // METS file has 17 unstructured images assertEquals(17, workpiece.getLogicalStructure().getViews().size()); @@ -69,7 +69,7 @@ public void testRead() throws Exception { // file URIs can be read assertEquals(new URI("images/ThomPhar_644901748_media/00000001.tif"), - workpiece.getMediaUnit().getChildren().get(0).getMediaFiles().entrySet().iterator().next().getValue()); + workpiece.getPhysicalStructure().getChildren().get(0).getMediaFiles().entrySet().iterator().next().getValue()); // pagination can be read assertEquals( @@ -88,7 +88,7 @@ public void testRead() throws Exception { "uncounted", "uncounted", "113", "114", "115", "116", "117", "118", "uncounted", "uncounted", "119", "120", "uncounted", "uncounted", "121", "122", "123", "124", "125", "126", "127", "128", "129", "130", "131", "132", "133", "134", "uncounted", "uncounted", "uncounted"), - workpiece.getMediaUnit().getChildren().stream().map(MediaUnit::getOrderlabel) + workpiece.getPhysicalStructure().getChildren().stream().map(PhysicalDivision::getOrderlabel) .collect(Collectors.toList())); } @@ -97,17 +97,17 @@ public void testSave() throws Exception { Workpiece workpiece = new Workpiece(); workpiece.setId("1"); - List pages = new ArrayList<>(); + List pages = new ArrayList<>(); // add partial orders for (int i = 1; i <= 4; i++) { - MediaUnit partialOrder = new MediaUnit(); + PhysicalDivision partialOrder = new PhysicalDivision(); MetadataEntry numImages = new MetadataEntry(); numImages.setKey("numImages"); numImages.setDomain(MdSec.TECH_MD); numImages.setValue("100"); partialOrder.getMetadata().add(numImages); - workpiece.getMediaUnit().getChildren().add(partialOrder); + workpiece.getPhysicalStructure().getChildren().add(partialOrder); } // add files @@ -116,19 +116,19 @@ public void testSave() throws Exception { local.setMimeType("image/tiff"); for (int i = 1; i <= 4; i++) { URI path = new URI(String.format("images/leaflet_media/%08d.tif", i)); - MediaUnit mediaUnit = new MediaUnit(); - mediaUnit.setOrder(i); - mediaUnit.getMediaFiles().put(local, path); - pages.add(mediaUnit); - workpiece.getMediaUnit().getChildren().add(mediaUnit); + PhysicalDivision physicalDivision = new PhysicalDivision(); + physicalDivision.setOrder(i); + physicalDivision.getMediaFiles().put(local, path); + pages.add(physicalDivision); + workpiece.getPhysicalStructure().getChildren().add(physicalDivision); } // create document structure workpiece.getLogicalStructure().setType("leaflet"); workpiece.getLogicalStructure().setLabel("The Leaflet"); - for (MediaUnit page : pages) { + for (PhysicalDivision page : pages) { View view = new View(); - view.setMediaUnit(page); + view.setPhysicalDivision(page); workpiece.getLogicalStructure().getViews().add(view); page.getLogicalDivisions().add(workpiece.getLogicalStructure()); } @@ -137,31 +137,31 @@ public void testSave() throws Exception { frontCover.setType("frontCover"); frontCover.setLabel("Front cover"); View view = new View(); - view.setMediaUnit(pages.get(0)); + view.setPhysicalDivision(pages.get(0)); frontCover.getViews().add(view); - view.getMediaUnit().getLogicalDivisions().add(frontCover); + view.getPhysicalDivision().getLogicalDivisions().add(frontCover); workpiece.getLogicalStructure().getChildren().add(frontCover); LogicalDivision inside = new LogicalDivision(); inside.setType("inside"); inside.setLabel("Inside"); view = new View(); - view.setMediaUnit(pages.get(1)); + view.setPhysicalDivision(pages.get(1)); inside.getViews().add(view); - view.getMediaUnit().getLogicalDivisions().add(inside); + view.getPhysicalDivision().getLogicalDivisions().add(inside); view = new View(); - view.setMediaUnit(pages.get(2)); + view.setPhysicalDivision(pages.get(2)); inside.getViews().add(view); - view.getMediaUnit().getLogicalDivisions().add(inside); + view.getPhysicalDivision().getLogicalDivisions().add(inside); workpiece.getLogicalStructure().getChildren().add(inside); LogicalDivision backCover = new LogicalDivision(); backCover.setType("backCover"); backCover.setLabel("Back cover"); view = new View(); - view.setMediaUnit(pages.get(3)); + view.setPhysicalDivision(pages.get(3)); backCover.getViews().add(view); - view.getMediaUnit().getLogicalDivisions().add(backCover); + view.getPhysicalDivision().getLogicalDivisions().add(backCover); workpiece.getLogicalStructure().getChildren().add(backCover); // add metadata @@ -202,12 +202,12 @@ public void testSave() throws Exception { MediaVariant max = new MediaVariant(); max.setUse("MAX"); max.setMimeType("image/jpeg"); - for (MediaUnit mediaUnit : workpiece.getMediaUnit().getChildren()) { - URI tiffFile = mediaUnit.getMediaFiles().get(local); + for (PhysicalDivision physicalDivision : workpiece.getPhysicalStructure().getChildren()) { + URI tiffFile = physicalDivision.getMediaFiles().get(local); if (tiffFile != null) { String jpgFile = tiffFile.toString().replaceFirst("^.*?(\\d+)\\.tif$", "images/max/$1.jpg"); URI path = new URI(jpgFile); - mediaUnit.getMediaFiles().put(max, path); + physicalDivision.getMediaFiles().put(max, path); } } @@ -228,16 +228,16 @@ public void testSave() throws Exception { Workpiece reread = new MetsXmlElementAccess().read(new FileInputStream(new File("src/test/resources/out.xml"))); assertEquals(1, reread.getEditHistory().size()); - List mediaUnits = reread.getMediaUnit().getChildren(); - assertEquals(8, mediaUnits.size()); + List physicalDivisions = reread.getPhysicalStructure().getChildren(); + assertEquals(8, physicalDivisions.size()); for (int i = 0; i <= 3; i++) { - MediaUnit mediaUnit = mediaUnits.get(i); - assertEquals(0, mediaUnit.getMediaFiles().size()); - assertEquals(1, mediaUnit.getMetadata().size()); + PhysicalDivision physicalDivision = physicalDivisions.get(i); + assertEquals(0, physicalDivision.getMediaFiles().size()); + assertEquals(1, physicalDivision.getMetadata().size()); } for (int i = 4; i <= 7; i++) { - MediaUnit mediaUnit = mediaUnits.get(i); - assertEquals(2, mediaUnit.getMediaFiles().size()); + PhysicalDivision physicalDivision = physicalDivisions.get(i); + assertEquals(2, physicalDivision.getMediaFiles().size()); } LogicalDivision logicalStructure = reread.getLogicalStructure(); assertEquals(1, logicalStructure.getChildren().get(0).getViews().size()); diff --git a/Kitodo-Validation/src/main/java/org/kitodo/validation/metadata/MetadataValidation.java b/Kitodo-Validation/src/main/java/org/kitodo/validation/metadata/MetadataValidation.java index f9712f72a4e..45a02ecd254 100644 --- a/Kitodo-Validation/src/main/java/org/kitodo/validation/metadata/MetadataValidation.java +++ b/Kitodo-Validation/src/main/java/org/kitodo/validation/metadata/MetadataValidation.java @@ -44,7 +44,7 @@ import org.kitodo.api.dataeditor.rulesetmanagement.SimpleMetadataViewInterface; import org.kitodo.api.dataeditor.rulesetmanagement.StructuralElementViewInterface; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; import org.kitodo.api.dataformat.Workpiece; import org.kitodo.api.dataformat.mets.MetsXmlElementAccessInterface; @@ -124,8 +124,8 @@ public ValidationResult validate(Workpiece workpiece, RulesetManagementInterface getMetadata(logicalDivision), ruleset, metadataLanguage, translations)); } - for (MediaUnit mediaUnit : workpiece.getAllMediaUnits()) { - results.addAll(checkMetadataRules(mediaUnit.toString(), mediaUnit.getType(), getMetadata(mediaUnit), + for (PhysicalDivision physicalDivision : workpiece.getAllPhysicalDivisions()) { + results.addAll(checkMetadataRules(physicalDivision.toString(), physicalDivision.getType(), getMetadata(physicalDivision), ruleset, metadataLanguage, translations)); } @@ -149,12 +149,12 @@ private static Collection getMetadata(LogicalDivision logicalDivision) return metadata; } - private static Collection getMetadata(MediaUnit mediaUnit) { - Collection metadata = new ArrayList<>(mediaUnit.getMetadata()); - if (Objects.nonNull(mediaUnit.getOrderlabel())) { + private static Collection getMetadata(PhysicalDivision physicalDivision) { + Collection metadata = new ArrayList<>(physicalDivision.getMetadata()); + if (Objects.nonNull(physicalDivision.getOrderlabel())) { MetadataEntry orderlabelEntry = new MetadataEntry(); orderlabelEntry.setKey("ORDERLABEL"); - orderlabelEntry.setValue(mediaUnit.getOrderlabel()); + orderlabelEntry.setValue(physicalDivision.getOrderlabel()); metadata.add(orderlabelEntry); } return metadata; @@ -177,7 +177,7 @@ private Collection checkMetadataRules(String elementString, } /** - * Reports structures that have no assigned media units. These structures + * Reports structures that have no assigned physical divisions. These structures * are undesirable because you cannot look at them. It is also checked if * the linked media are even referenced in the document. * @@ -201,8 +201,8 @@ private static ValidationResult checkForStructuresWithoutMedia(Workpiece workpie } if (!Workpiece.treeStream(workpiece.getLogicalStructure()) - .flatMap(structure -> structure.getViews().stream()).map(View::getMediaUnit) - .allMatch(workpiece.getAllMediaUnits()::contains)) { + .flatMap(structure -> structure.getViews().stream()).map(View::getPhysicalDivision) + .allMatch(workpiece.getAllPhysicalDivisions()::contains)) { messages.add(translations.get(MESSAGE_MEDIA_MISSING)); error = true; } @@ -223,15 +223,15 @@ private static ValidationResult checkForUnlinkedMedia(Workpiece workpiece, boolean warning = false; Collection messages = new HashSet<>(); - KeySetView unassignedMediaUnits = ConcurrentHashMap.newKeySet(); - unassignedMediaUnits.addAll(Workpiece.treeStream(workpiece.getMediaUnit()) - .filter(mediaUnit -> !mediaUnit.getMediaFiles().isEmpty()).collect(Collectors.toList())); + KeySetView unassignedPhysicalDivisions = ConcurrentHashMap.newKeySet(); + unassignedPhysicalDivisions.addAll(Workpiece.treeStream(workpiece.getPhysicalStructure()) + .filter(physicalDivision -> !physicalDivision.getMediaFiles().isEmpty()).collect(Collectors.toList())); Workpiece.treeStream(workpiece.getLogicalStructure()).flatMap(structure -> structure.getViews().stream()) - .map(View::getMediaUnit) - .forEach(unassignedMediaUnits::remove); - if (!unassignedMediaUnits.isEmpty()) { - for (MediaUnit mediaUnit : unassignedMediaUnits) { - messages.add(translations.get(MESSAGE_MEDIA_UNASSIGNED) + ' ' + mediaUnit); + .map(View::getPhysicalDivision) + .forEach(unassignedPhysicalDivisions::remove); + if (!unassignedPhysicalDivisions.isEmpty()) { + for (PhysicalDivision physicalDivision : unassignedPhysicalDivisions) { + messages.add(translations.get(MESSAGE_MEDIA_UNASSIGNED) + ' ' + physicalDivision); } warning = true; } 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 a33a5732263..b24b38bb905 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java @@ -23,7 +23,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.Workpiece; import org.kitodo.config.ConfigCore; import org.kitodo.config.enums.ParameterCore; @@ -126,8 +126,8 @@ public void showProcessMetadataStatistic() { new Object[] {ObjectType.PROCESS.getTranslationSingular(), selectedProcess.getId() }, logger, e); return; } - int numberOfProcessImages = (int) Workpiece.treeStream(workpiece.getMediaUnit()) - .filter(mediaUnit -> Objects.equals(mediaUnit.getType(), MediaUnit.TYPE_PAGE)).count(); + int numberOfProcessImages = (int) Workpiece.treeStream(workpiece.getPhysicalStructure()) + .filter(physicalDivision -> Objects.equals(physicalDivision.getType(), PhysicalDivision.TYPE_PAGE)).count(); this.numberOfGlobalImages += numberOfProcessImages; int numberOfProcessStructuralElements = (int) Workpiece.treeStream(workpiece.getLogicalStructure()).count(); this.numberOfGlobalStructuralElements += numberOfProcessStructuralElements; diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessSimpleMetadata.java b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessSimpleMetadata.java index c5c7600860a..c3c80f99e78 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessSimpleMetadata.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessSimpleMetadata.java @@ -22,13 +22,13 @@ import org.kitodo.api.dataeditor.rulesetmanagement.SimpleMetadataViewInterface; import org.kitodo.api.dataformat.Division; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.exceptions.NoSuchMetadataFieldException; abstract class ProcessSimpleMetadata extends ProcessDetail implements Serializable { static final List>> PARENT_CLASSES = Arrays.asList(LogicalDivision.class, - MediaUnit.class); + PhysicalDivision.class); /** * Container to store the ruleset settings. 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 fff50e4a6e3..fda70eb0d95 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 @@ -39,7 +39,7 @@ import org.apache.logging.log4j.Logger; import org.kitodo.api.dataeditor.rulesetmanagement.StructuralElementViewInterface; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; import org.kitodo.data.database.beans.Process; import org.kitodo.data.database.exceptions.DAOException; @@ -160,13 +160,13 @@ private void addMultiDocStruc() { private void addSingleDocStruc(boolean selectViews) { Optional selectedStructure = dataEditor.getSelectedStructure(); if (selectedStructure.isPresent()) { - LogicalDivision newStructure = MetadataEditor.addStructure(docStructAddTypeSelectionSelectedItem, + LogicalDivision newStructure = MetadataEditor.addLogicalDivision(docStructAddTypeSelectionSelectedItem, dataEditor.getWorkpiece(), selectedStructure.get(), selectedDocStructPosition, getViewsToAdd()); dataEditor.getSelectedMedia().clear(); if (selectViews) { for (View view : getViewsToAdd()) { - dataEditor.getSelectedMedia().add(new ImmutablePair<>(view.getMediaUnit(), newStructure)); + dataEditor.getSelectedMedia().add(new ImmutablePair<>(view.getPhysicalDivision(), newStructure)); } } dataEditor.refreshStructurePanel(); @@ -176,7 +176,7 @@ private void addSingleDocStruc(boolean selectViews) { this.dataEditor.getStructurePanel().setSelectedLogicalNode(selectedLogicalTreeNode); this.dataEditor.getMetadataPanel().showLogical(this.dataEditor.getSelectedStructure()); } - List> selectedMedia = this.dataEditor.getSelectedMedia().stream() + List> selectedMedia = this.dataEditor.getSelectedMedia().stream() .sorted(Comparator.comparingInt(p -> p.getLeft().getOrder())) .collect(Collectors.toList()); Collections.reverse(selectedMedia); @@ -404,7 +404,7 @@ public void prepare() { checkSelectedLogicalNode(); Optional selectedStructure = dataEditor.getSelectedStructure(); if (selectedStructure.isPresent()) { - this.parents = MetadataEditor.getAncestorsOfStructure(selectedStructure.get(), + this.parents = MetadataEditor.getAncestorsOfLogicalDivision(selectedStructure.get(), dataEditor.getWorkpiece().getLogicalStructure()); prepareDocStructPositionSelectionItems(parents.isEmpty()); prepareAddableMetadataForStructure(true); @@ -437,7 +437,7 @@ private void checkSelectedLogicalNode() { public void prepareDocStructTypes() { Optional selectedStructure = dataEditor.getSelectedStructure(); if (selectedStructure.isPresent()) { - this.parents = MetadataEditor.getAncestorsOfStructure(selectedStructure.get(), + this.parents = MetadataEditor.getAncestorsOfLogicalDivision(selectedStructure.get(), dataEditor.getWorkpiece().getLogicalStructure()); if (parents.isEmpty()) { docStructAddTypeSelectionItemsForParent = Collections.emptyList(); @@ -542,12 +542,12 @@ public void prepareAddableMetadataForStructure(boolean currentElement) { } private void prepareSelectPageOnAddNodeItems() { - List mediaUnits = dataEditor.getWorkpiece().getAllMediaUnitChildrenFilteredByTypePageAndSorted(); - selectPageOnAddNodeItems = new ArrayList<>(mediaUnits.size()); - for (int i = 0; i < mediaUnits.size(); i++) { - MediaUnit mediaUnit = mediaUnits.get(i); - String label = Objects.isNull(mediaUnit.getOrderlabel()) ? Integer.toString(mediaUnit.getOrder()) - : mediaUnit.getOrder() + " : " + mediaUnit.getOrderlabel(); + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(); + selectPageOnAddNodeItems = new ArrayList<>(physicalDivisions.size()); + for (int i = 0; i < physicalDivisions.size(); i++) { + PhysicalDivision physicalDivision = physicalDivisions.get(i); + String label = Objects.isNull(physicalDivision.getOrderlabel()) ? Integer.toString(physicalDivision.getOrder()) + : physicalDivision.getOrder() + " : " + physicalDivision.getOrderlabel(); selectPageOnAddNodeItems.add(new SelectItem(Integer.toString(i), label)); } } @@ -557,15 +557,15 @@ private void prepareSelectPageOnAddNodeItems() { */ public void preparePreselectedViews() { preselectedViews = new ArrayList<>(); - List> selectedMedia = dataEditor.getSelectedMedia(); - for (Pair pair : selectedMedia) { + List> selectedMedia = dataEditor.getSelectedMedia(); + for (Pair pair : selectedMedia) { for (View view : pair.getValue().getViews()) { - if (Objects.equals(view.getMediaUnit(), pair.getKey())) { + if (Objects.equals(view.getPhysicalDivision(), pair.getKey())) { preselectedViews.add(view); } } } - preselectedViews.sort(Comparator.comparingInt(view -> view.getMediaUnit().getOrder())); + preselectedViews.sort(Comparator.comparingInt(view -> view.getPhysicalDivision().getOrder())); } /** diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddMediaUnitDialog.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddPhysicalDivisionDialog.java similarity index 75% rename from Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddMediaUnitDialog.java rename to Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddPhysicalDivisionDialog.java index ae0caeb7b79..2835ccbd92f 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddMediaUnitDialog.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddPhysicalDivisionDialog.java @@ -22,12 +22,12 @@ import javax.faces.model.SelectItem; import org.kitodo.api.dataeditor.rulesetmanagement.StructuralElementViewInterface; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.production.helper.Helper; import org.kitodo.production.metadata.InsertionPosition; import org.kitodo.production.metadata.MetadataEditor; -public class AddMediaUnitDialog { +public class AddPhysicalDivisionDialog { private final DataEditorForm dataEditor; private List possiblePositions; private List possibleTypes; @@ -37,33 +37,33 @@ public class AddMediaUnitDialog { /** * Constructor. - * @param dataEditor Instance of DataEditorForm where this instance of AddMediaUnitDialog was created. + * @param dataEditor Instance of DataEditorForm where this instance of AddPhysicalDivisionDialog was created. */ - AddMediaUnitDialog(DataEditorForm dataEditor) { + AddPhysicalDivisionDialog(DataEditorForm dataEditor) { this.dataEditor = dataEditor; } /** - * Add a new MediaUnit. + * Add a new PhysicalDivision. */ - public void addMediaUnit() { - Optional selectedMediaUnit = dataEditor.getSelectedMediaUnit(); - if (selectedMediaUnit.isPresent()) { - MediaUnit mediaUnit = MetadataEditor.addMediaUnit(selectedType, dataEditor.getWorkpiece(), - selectedMediaUnit.get(), + public void addPhysicalDivision() { + Optional selectedPhysicalDivision = dataEditor.getSelectedPhysicalDivision(); + if (selectedPhysicalDivision.isPresent()) { + PhysicalDivision physicalDivision = MetadataEditor.addPhysicalDivision(selectedType, dataEditor.getWorkpiece(), + selectedPhysicalDivision.get(), selectedPosition); dataEditor.refreshStructurePanel(); - dataEditor.getStructurePanel().selectMediaUnit(mediaUnit); + dataEditor.getStructurePanel().selectPhysicalDivision(physicalDivision); } else { - Helper.setErrorMessage("No media unit selected!"); + Helper.setErrorMessage("No physical division selected!"); } } /** - * Prepare popup dialog by retrieving available insertion positions and media unit types for selected element. + * Prepare popup dialog by retrieving available insertion positions and physical division types for selected element. */ public void prepare() { - if (dataEditor.getSelectedMediaUnit().isPresent()) { + if (dataEditor.getSelectedPhysicalDivision().isPresent()) { preparePossiblePositions(); preparePossibleTypes(); } else { @@ -73,15 +73,15 @@ public void prepare() { } private void preparePossiblePositions() { - Optional selectedMediaUnit = dataEditor.getSelectedMediaUnit(); - if (selectedMediaUnit.isPresent()) { + Optional selectedPhysicalDivision = dataEditor.getSelectedPhysicalDivision(); + if (selectedPhysicalDivision.isPresent()) { possiblePositions = new ArrayList<>(); possiblePositions.add(new SelectItem(InsertionPosition.FIRST_CHILD_OF_CURRENT_ELEMENT, Helper.getTranslation("dataEditor.position.asFirstChildOfCurrentElement"))); possiblePositions.add(new SelectItem(InsertionPosition.LAST_CHILD_OF_CURRENT_ELEMENT, Helper.getTranslation("dataEditor.position.asLastChildOfCurrentElement"))); - List parents = MetadataEditor.getAncestorsOfMediaUnit(selectedMediaUnit.get(), - dataEditor.getWorkpiece().getMediaUnit()); + List parents = MetadataEditor.getAncestorsOfPhysicalDivision(selectedPhysicalDivision.get(), + dataEditor.getWorkpiece().getPhysicalStructure()); if (parents.size() > 0) { possiblePositions.add(new SelectItem(InsertionPosition.BEFORE_CURRENT_ELEMENT, Helper.getTranslation("dataEditor.position.beforeCurrentElement"))); @@ -92,29 +92,29 @@ private void preparePossiblePositions() { } /** - * Update list of available types that can be added to the currently selected media units in the currently selected + * Update list of available types that can be added to the currently selected physical divisions in the currently selected * position. */ public void preparePossibleTypes() { possibleTypes = new ArrayList<>(); - Optional selectedMediaUnit = dataEditor.getSelectedMediaUnit(); - if (selectedMediaUnit.isPresent()) { + Optional selectedPhysicalDivision = dataEditor.getSelectedPhysicalDivision(); + if (selectedPhysicalDivision.isPresent()) { StructuralElementViewInterface divisionView = null; if (InsertionPosition.FIRST_CHILD_OF_CURRENT_ELEMENT.equals(selectedPosition) || InsertionPosition.LAST_CHILD_OF_CURRENT_ELEMENT.equals(selectedPosition)) { divisionView = dataEditor.getRulesetManagement().getStructuralElementView( - selectedMediaUnit.orElseThrow(IllegalStateException::new).getType(), + selectedPhysicalDivision.orElseThrow(IllegalStateException::new).getType(), dataEditor.getAcquisitionStage(), dataEditor.getPriorityList() ); } else if (InsertionPosition.BEFORE_CURRENT_ELEMENT.equals(selectedPosition) || InsertionPosition.AFTER_CURRENT_ELEMENT.equals(selectedPosition)) { - LinkedList parents = MetadataEditor.getAncestorsOfMediaUnit( - selectedMediaUnit.get(), - dataEditor.getWorkpiece().getMediaUnit()); + LinkedList parents = MetadataEditor.getAncestorsOfPhysicalDivision( + selectedPhysicalDivision.get(), + dataEditor.getWorkpiece().getPhysicalStructure()); if (!parents.isEmpty()) { divisionView = dataEditor.getRulesetManagement().getStructuralElementView( parents.getLast().getType(), diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/ChangeDocStrucTypeDialog.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/ChangeDocStrucTypeDialog.java index 126c8e89500..e2716cb640d 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/ChangeDocStrucTypeDialog.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/ChangeDocStrucTypeDialog.java @@ -141,7 +141,7 @@ private Map getAllowedChildTypesFromIncludedStructuralParentElem } } else { LinkedList ancestors = MetadataEditor - .getAncestorsOfStructure(logicalDivision, logicalStructure); + .getAncestorsOfLogicalDivision(logicalDivision, logicalStructure); String parentType = ancestors.getLast().getType(); return getAllowedSubstructuralElements(parentType); } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java index 77ee2762bb9..d2048938948 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java @@ -38,7 +38,7 @@ import org.apache.logging.log4j.Logger; import org.kitodo.api.dataeditor.rulesetmanagement.RulesetManagementInterface; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; import org.kitodo.api.dataformat.Workpiece; import org.kitodo.api.validation.State; @@ -82,9 +82,9 @@ public class DataEditorForm implements RulesetSetupInterface, Serializable { private final AddMetadataDialog addMetadataDialog; /** - * Backing bean for the add MediaUnit dialog. + * Backing bean for the add PhysicalDivision dialog. */ - private final AddMediaUnitDialog addMediaUnitDialog; + private final AddPhysicalDivisionDialog addPhysicalDivisionDialog; /** * Backing bean for the change doc struc type dialog. @@ -165,7 +165,7 @@ public class DataEditorForm implements RulesetSetupInterface, Serializable { * This List of Pairs stores all selected physical elements and the logical elements in which the physical element was selected. * It is necessary to store the logical elements as well, because a physical element can be assigned to multiple logical elements. */ - private List> selectedMedia; + private List> selectedMedia; /** * The id of the template's task corresponding to the current task that is under edit. @@ -189,7 +189,7 @@ public DataEditorForm() { this.paginationPanel = new PaginationPanel(this); this.addDocStrucTypeDialog = new AddDocStrucTypeDialog(this); this.addMetadataDialog = new AddMetadataDialog(this); - this.addMediaUnitDialog = new AddMediaUnitDialog(this); + this.addPhysicalDivisionDialog = new AddPhysicalDivisionDialog(this); this.changeDocStrucTypeDialog = new ChangeDocStrucTypeDialog(this); this.editPagesDialog = new EditPagesDialog(this); acquisitionStage = "edit"; @@ -282,15 +282,15 @@ private void openMetsFile() throws IOException, InvalidImagesException { private void init() { final long begin = System.nanoTime(); - List severalAssignments = new LinkedList<>(); - initSeveralAssignments(workpiece.getMediaUnit(), severalAssignments); + List severalAssignments = new LinkedList<>(); + initSeveralAssignments(workpiece.getPhysicalStructure(), severalAssignments); structurePanel.getSeveralAssignments().addAll(severalAssignments); structurePanel.show(); structurePanel.getSelectedLogicalNode().setSelected(true); structurePanel.getSelectedPhysicalNode().setSelected(true); metadataPanel.showLogical(getSelectedStructure()); - metadataPanel.showPhysical(getSelectedMediaUnit()); + metadataPanel.showPhysical(getSelectedPhysicalDivision()); galleryPanel.show(); paginationPanel.show(); @@ -403,11 +403,11 @@ public String saveAndExit() { return save(true); } - private void initSeveralAssignments(MediaUnit mediaUnit, List severalAssignments) { - if (mediaUnit.getLogicalDivisions().size() > 1) { - severalAssignments.add(mediaUnit); + private void initSeveralAssignments(PhysicalDivision physicalDivision, List severalAssignments) { + if (physicalDivision.getLogicalDivisions().size() > 1) { + severalAssignments.add(physicalDivision); } - for (MediaUnit child : mediaUnit.getChildren()) { + for (PhysicalDivision child : physicalDivision.getChildren()) { initSeveralAssignments(child, severalAssignments); } } @@ -422,14 +422,14 @@ public void deleteStructure() { } /** - * Deletes the selected media unit from the media list. The associated files + * Deletes the selected physical division from the media list. The associated files * on the drive are not deleted. The next time the editor is started, files * that are not yet in the media list will be inserted there again. This * method is called by PrimeFaces to inform the application that the user - * clicked on the context menu entry to delete the media unit. + * clicked on the context menu entry to delete the physical division. */ - public void deleteMediaUnit() { - structurePanel.deleteSelectedMediaUnit(); + public void deletePhysicalDivision() { + structurePanel.deleteSelectedPhysicalDivision(); } @Override @@ -463,8 +463,8 @@ public AddMetadataDialog getAddMetadataDialog() { * * @return the backing bean for the add media dialog */ - public AddMediaUnitDialog getAddMediaUnitDialog() { - return addMediaUnitDialog; + public AddPhysicalDivisionDialog getAddPhysicalDivisionDialog() { + return addPhysicalDivisionDialog; } /** @@ -554,8 +554,8 @@ public Optional getSelectedStructure() { return structurePanel.getSelectedStructure(); } - Optional getSelectedMediaUnit() { - return structurePanel.getSelectedMediaUnit(); + Optional getSelectedPhysicalDivision() { + return structurePanel.getSelectedPhysicalDivision(); } /** @@ -595,12 +595,12 @@ void setProcess(Process process) { * * @return value of selectedMedia */ - public List> getSelectedMedia() { + public List> getSelectedMedia() { return selectedMedia; } /** - * Checks and returns if consecutive media units in one structure element are selected or not. + * Checks and returns if consecutive physical divisions in one structure element are selected or not. */ public boolean consecutivePagesSelected() { if (selectedMedia.isEmpty()) { @@ -612,21 +612,21 @@ public boolean consecutivePagesSelected() { && selectedMedia.stream().map(Pair::getValue).distinct().count() == 1; } - void setSelectedMedia(List> media) { + void setSelectedMedia(List> media) { this.selectedMedia = media; } /** - * Check if the passed MediaUnit is selected. - * @param mediaUnit MediaUnit object to check for selection - * @param logicalDivision object to check whether the MediaUnit is selected as a child of this LogicalDivision. - * A MediaUnit can be assigned to multiple logical divisionss but can be selected + * Check if the passed PhysicalDivision is selected. + * @param physicalDivision PhysicalDivision object to check for selection + * @param logicalDivision object to check whether the PhysicalDivision is selected as a child of this LogicalDivision. + * A PhysicalDivision can be assigned to multiple logical divisionss but can be selected * in one of these LogicalDivisions. - * @return boolean whether the MediaUnit is selected at the specified position + * @return boolean whether the PhysicalDivision is selected at the specified position */ - public boolean isSelected(MediaUnit mediaUnit, LogicalDivision logicalDivision) { - if (Objects.nonNull(mediaUnit) && Objects.nonNull(logicalDivision)) { - return selectedMedia.contains(new ImmutablePair<>(mediaUnit, logicalDivision)); + public boolean isSelected(PhysicalDivision physicalDivision, LogicalDivision logicalDivision) { + if (Objects.nonNull(physicalDivision) && Objects.nonNull(logicalDivision)) { + return selectedMedia.contains(new ImmutablePair<>(physicalDivision, logicalDivision)); } return false; } @@ -664,7 +664,7 @@ void switchStructure(Object treeNodeData, boolean updateGalleryAndPhysicalTree) } else if (structureTreeNode.getDataObject() instanceof View) { // Page selected in logical tree View view = (View) structureTreeNode.getDataObject(); - metadataPanel.showPageInLogical(view.getMediaUnit()); + metadataPanel.showPageInLogical(view.getPhysicalDivision()); if (updateGalleryAndPhysicalTree) { updateGallery(view); } @@ -675,23 +675,23 @@ void switchStructure(Object treeNodeData, boolean updateGalleryAndPhysicalTree) paginationPanel.preparePaginationSelectionSelectedItems(); } - void switchMediaUnit() throws NoSuchMetadataFieldException { + void switchPhysicalDivision() throws NoSuchMetadataFieldException { try { metadataPanel.preservePhysical(); } catch (InvalidMetadataValueException e) { logger.info(e.getLocalizedMessage(), e); } - Optional selectedMediaUnit = structurePanel.getSelectedMediaUnit(); + Optional selectedPhysicalDivision = structurePanel.getSelectedPhysicalDivision(); - metadataPanel.showPhysical(selectedMediaUnit); - if (selectedMediaUnit.isPresent()) { + metadataPanel.showPhysical(selectedPhysicalDivision); + if (selectedPhysicalDivision.isPresent()) { // update gallery - galleryPanel.updateSelection(selectedMediaUnit.get(), null); + galleryPanel.updateSelection(selectedPhysicalDivision.get(), null); // update logical tree for (GalleryMediaContent galleryMediaContent : galleryPanel.getMedias()) { if (Objects.nonNull(galleryMediaContent.getView()) - && Objects.equals(selectedMediaUnit.get(), galleryMediaContent.getView().getMediaUnit())) { + && Objects.equals(selectedPhysicalDivision.get(), galleryMediaContent.getView().getPhysicalDivision())) { structurePanel.updateLogicalNodeSelection(galleryMediaContent, null); break; } @@ -705,9 +705,9 @@ private void updatePhysicalStructureTree(View view) { } private void updateGallery(View view) { - MediaUnit mediaUnit = view.getMediaUnit(); - if (Objects.nonNull(mediaUnit)) { - galleryPanel.updateSelection(mediaUnit, structurePanel.getPageStructure(view, workpiece.getLogicalStructure())); + PhysicalDivision physicalDivision = view.getPhysicalDivision(); + if (Objects.nonNull(physicalDivision)) { + galleryPanel.updateSelection(physicalDivision, structurePanel.getPageStructure(view, workpiece.getLogicalStructure())); } } @@ -717,7 +717,7 @@ void assignView(LogicalDivision logicalDivision, View view, Integer index) { } else { logicalDivision.getViews().add(view); } - view.getMediaUnit().getLogicalDivisions().add(logicalDivision); + view.getPhysicalDivision().getLogicalDivisions().add(logicalDivision); } void unassignView(LogicalDivision logicalDivision, View view, boolean removeLast) { @@ -727,7 +727,7 @@ void unassignView(LogicalDivision logicalDivision, View view, boolean removeLast } else { logicalDivision.getViews().removeFirstOccurrence(view); } - view.getMediaUnit().getLogicalDivisions().remove(logicalDivision); + view.getPhysicalDivision().getLogicalDivisions().remove(logicalDivision); } /** diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/EditPagesDialog.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/EditPagesDialog.java index e5e3cdb134a..4f35efcdeae 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/EditPagesDialog.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/EditPagesDialog.java @@ -23,7 +23,7 @@ import javax.faces.model.SelectItem; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; import org.kitodo.production.metadata.MetadataEditor; @@ -32,23 +32,23 @@ public class EditPagesDialog { private final DataEditorForm dataEditor; /** - * Views on media units that are not associated with this structure. + * Views on physical divisions that are not associated with this structure. */ private List paginationSelectionItems; /** - * Views on media units that are not associated with this structure selected + * Views on physical divisions that are not associated with this structure selected * by the user to add them. */ private List paginationSelectionSelectedItems = new ArrayList<>(); /** - * Views on media units that are associated with this structure. + * Views on physical divisions that are associated with this structure. */ private List paginationSubSelectionItems; /** - * Views on media units that are associated with this structure selected by + * Views on physical divisions that are associated with this structure selected by * the user to remove them. */ private List paginationSubSelectionSelectedItems = new ArrayList<>(); @@ -206,8 +206,8 @@ List getViewsToAdd(int firstPage, int lastPage) { private List getViewsToAdd(List pages) { return pages.parallelStream() - .map(dataEditor.getWorkpiece().getAllMediaUnitChildrenFilteredByTypePageAndSorted()::get) - .map(MetadataEditor::getFirstViewForMediaUnit) + .map(dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted()::get) + .map(MetadataEditor::getFirstViewForPhysicalDivision) .collect(Collectors.toList()); } @@ -232,15 +232,15 @@ void prepare() { paginationSubSelectionItems = new ArrayList<>(); paginationSelectionItems = new ArrayList<>(); - List mediaUnits = dataEditor.getWorkpiece().getAllMediaUnitChildrenFilteredByTypePageAndSorted(); - int capacity = (int) Math.ceil(mediaUnits.size() / .75); + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(); + int capacity = (int) Math.ceil(physicalDivisions.size() / .75); Set assigneds = new HashSet<>(capacity); Set unassigneds = new HashSet<>(capacity); - for (int i = 0; i < mediaUnits.size(); i++) { - MediaUnit mediaUnit = mediaUnits.get(i); - View view = MetadataEditor.createUnrestrictedViewOn(mediaUnit); - String label = Objects.isNull(mediaUnit.getOrderlabel()) ? Integer.toString(mediaUnit.getOrder()) - : mediaUnit.getOrder() + " : " + mediaUnit.getOrderlabel(); + for (int i = 0; i < physicalDivisions.size(); i++) { + PhysicalDivision physicalDivision = physicalDivisions.get(i); + View view = MetadataEditor.createUnrestrictedViewOn(physicalDivision); + String label = Objects.isNull(physicalDivision.getOrderlabel()) ? Integer.toString(physicalDivision.getOrder()) + : physicalDivision.getOrder() + " : " + physicalDivision.getOrderlabel(); Integer id = i; SelectItem selectItem = new SelectItem(id, label); selectPageItems.add(selectItem); diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/GalleryMediaContent.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/GalleryMediaContent.java index 896d2ef0312..099203cd18c 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/GalleryMediaContent.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/GalleryMediaContent.java @@ -104,7 +104,7 @@ public StreamedContent getMediaViewData() { * @return the order number */ public String getOrder() { - return Integer.toString(view.getMediaUnit().getOrder()); + return Integer.toString(view.getPhysicalDivision().getOrder()); } /** @@ -113,7 +113,7 @@ public String getOrder() { * @return the order label */ public String getOrderlabel() { - return view.getMediaUnit().getOrderlabel(); + return view.getPhysicalDivision().getOrderlabel(); } /** @@ -193,13 +193,13 @@ public View getView() { } /** - * Check if the GalleryMediaContent's MediaUnit is assigned to several LogicalDivisions. + * Check if the GalleryMediaContent's PhysicalDivision is assigned to several LogicalDivisions. * - * @return {@code true} when the MediaUnit is assigned to more than one logical element + * @return {@code true} when the PhysicalDivision is assigned to more than one logical element */ public boolean isAssignedSeveralTimes() { - if (Objects.nonNull(view) && Objects.nonNull(view.getMediaUnit())) { - return view.getMediaUnit().getLogicalDivisions().size() > 1; + if (Objects.nonNull(view) && Objects.nonNull(view.getPhysicalDivision())) { + return view.getPhysicalDivision().getLogicalDivisions().size() > 1; } return false; } 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 f194edaa612..324e85094e8 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 @@ -37,7 +37,7 @@ import org.apache.logging.log4j.Logger; import org.kitodo.api.dataeditor.rulesetmanagement.RulesetManagementInterface; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; import org.kitodo.api.dataformat.View; import org.kitodo.data.database.beans.Folder; @@ -124,7 +124,7 @@ public String getGalleryViewMode() { * * @return value of lastSelection */ - public Pair getLastSelection() { + public Pair getLastSelection() { if (dataEditor.getSelectedMedia().size() > 0) { return dataEditor.getSelectedMedia().get(dataEditor.getSelectedMedia().size() - 1); } else { @@ -140,7 +140,7 @@ public Pair getLastSelection() { public boolean isLastSelection(GalleryMediaContent galleryMediaContent, GalleryStripe galleryStripe) { if (isSelected(galleryMediaContent, galleryStripe) && dataEditor.getSelectedMedia().size() > 0 && Objects.nonNull(galleryMediaContent)) { - return Objects.equals(galleryMediaContent.getView().getMediaUnit(), + return Objects.equals(galleryMediaContent.getView().getPhysicalDivision(), dataEditor.getSelectedMedia().get(dataEditor.getSelectedMedia().size() - 1).getKey()); } return false; @@ -218,9 +218,9 @@ public void onPageDrop(DragDropEvent event) { // move views List> viewsToBeMoved = new ArrayList<>(); - for (Pair selectedElement : dataEditor.getSelectedMedia()) { + for (Pair selectedElement : dataEditor.getSelectedMedia()) { for (View view : selectedElement.getValue().getViews()) { - if (Objects.equals(view.getMediaUnit(), selectedElement.getKey())) { + if (Objects.equals(view.getPhysicalDivision(), selectedElement.getKey())) { viewsToBeMoved.add(new ImmutablePair<>(view, selectedElement.getValue())); } } @@ -293,7 +293,7 @@ private int getMediaIndex(DragDropEvent event) { private void updateData(GalleryStripe toStripe, List> viewsToBeMoved, int toMediaIndex) { dataEditor.getStructurePanel().changeLogicalOrderFields(toStripe.getStructure(), viewsToBeMoved, toMediaIndex); - dataEditor.getStructurePanel().reorderMediaUnits(toStripe.getStructure(), viewsToBeMoved, toMediaIndex); + dataEditor.getStructurePanel().reorderPhysicalDivisions(toStripe.getStructure(), viewsToBeMoved, toMediaIndex); dataEditor.getStructurePanel().moveViews(toStripe.getStructure(), viewsToBeMoved, toMediaIndex); dataEditor.getStructurePanel().changePhysicalOrderFields(toStripe.getStructure(), viewsToBeMoved); } @@ -357,17 +357,17 @@ private void updateStructure(GalleryMediaContent galleryMediaContent, LogicalDiv dataEditor.getStructurePanel().updateNodeSelection(galleryMediaContent, structure); } - void updateSelection(MediaUnit mediaUnit, LogicalDivision structuralElement) { - if (mediaUnit.getMediaFiles().size() > 0) { + void updateSelection(PhysicalDivision physicalDivision, LogicalDivision structuralElement) { + if (physicalDivision.getMediaFiles().size() > 0) { // Update structured view if (this.galleryViewMode.equals(GalleryViewMode.LIST)) { for (GalleryStripe galleryStripe : getStripes()) { if (Objects.isNull(structuralElement) || Objects.equals(structuralElement, galleryStripe.getStructure())) { for (GalleryMediaContent galleryMediaContent : galleryStripe.getMedias()) { - if (Objects.equals(mediaUnit, galleryMediaContent.getView().getMediaUnit())) { + if (Objects.equals(physicalDivision, galleryMediaContent.getView().getPhysicalDivision())) { dataEditor.getSelectedMedia().clear(); - dataEditor.getSelectedMedia().add(new ImmutablePair<>(mediaUnit, galleryStripe.getStructure())); + dataEditor.getSelectedMedia().add(new ImmutablePair<>(physicalDivision, galleryStripe.getStructure())); break; } } @@ -377,10 +377,10 @@ void updateSelection(MediaUnit mediaUnit, LogicalDivision structuralElement) { // Update unstructured view else { for (GalleryMediaContent galleryMediaContent : getMedias()) { - if (Objects.equals(mediaUnit, galleryMediaContent.getView().getMediaUnit())) { + if (Objects.equals(physicalDivision, galleryMediaContent.getView().getPhysicalDivision())) { dataEditor.getSelectedMedia().clear(); dataEditor.getSelectedMedia().add(new ImmutablePair<>( - mediaUnit, getLogicalStructureOfMedia(galleryMediaContent).getStructure())); + physicalDivision, getLogicalStructureOfMedia(galleryMediaContent).getStructure())); break; } } @@ -391,23 +391,23 @@ void updateSelection(MediaUnit mediaUnit, LogicalDivision structuralElement) { void show() { Process process = dataEditor.getProcess(); Project project = process.getProject(); - List mediaUnits = dataEditor.getWorkpiece().getAllMediaUnitChildrenFilteredByTypePageAndSorted(); + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(); Folder previewSettings = project.getPreview(); - previewVariant = Objects.nonNull(previewSettings) ? getMediaVariant(previewSettings, mediaUnits) : null; + previewVariant = Objects.nonNull(previewSettings) ? getMediaVariant(previewSettings, physicalDivisions) : null; Folder mediaViewSettings = project.getMediaView(); - mediaViewVariant = Objects.nonNull(mediaViewSettings) ? getMediaVariant(mediaViewSettings, mediaUnits) : null; + mediaViewVariant = Objects.nonNull(mediaViewSettings) ? getMediaVariant(mediaViewSettings, physicalDivisions) : null; - medias = new ArrayList<>(mediaUnits.size()); + medias = new ArrayList<>(physicalDivisions.size()); stripes = new ArrayList<>(); previewImageResolver = new HashMap<>(); cachingUUID = UUID.randomUUID().toString(); previewFolder = new Subfolder(process, project.getPreview()); - for (MediaUnit mediaUnit : mediaUnits) { - View wholeMediaUnitView = new View(); - wholeMediaUnitView.setMediaUnit(mediaUnit); - GalleryMediaContent mediaContent = createGalleryMediaContent(wholeMediaUnitView); + for (PhysicalDivision physicalDivision : physicalDivisions) { + View wholePhysicalDivisionView = new View(); + wholePhysicalDivisionView.setPhysicalDivision(physicalDivision); + GalleryMediaContent mediaContent = createGalleryMediaContent(wholePhysicalDivisionView); medias.add(mediaContent); if (mediaContent.isShowingInPreview()) { previewImageResolver.put(mediaContent.getId(), mediaContent); @@ -426,9 +426,9 @@ void updateStripes() { addStripesRecursive(dataEditor.getWorkpiece().getLogicalStructure()); } - private static MediaVariant getMediaVariant(Folder folderSettings, List mediaUnits) { + private static MediaVariant getMediaVariant(Folder folderSettings, List physicalDivisions) { String use = folderSettings.getFileGroup(); - Optional optionalMediaVariant = mediaUnits.parallelStream().map(MediaUnit::getMediaFiles) + Optional optionalMediaVariant = physicalDivisions.parallelStream().map(PhysicalDivision::getMediaFiles) .flatMap(mediaFiles -> mediaFiles.entrySet().parallelStream()).map(Entry::getKey) .filter(mediaVariant -> use.equals(mediaVariant.getUse())).findAny(); if (optionalMediaVariant.isPresent()) { @@ -445,7 +445,7 @@ private void addStripesRecursive(LogicalDivision structure) { GalleryStripe galleryStripe = new GalleryStripe(this, structure); for (View view : structure.getViews()) { for (GalleryMediaContent galleryMediaContent : medias) { - if (Objects.equals(view.getMediaUnit(), galleryMediaContent.getView().getMediaUnit())) { + if (Objects.equals(view.getPhysicalDivision(), galleryMediaContent.getView().getPhysicalDivision())) { galleryStripe.getMedias().add(galleryMediaContent); if (galleryMediaContent.isShowingInPreview()) { previewImageResolver.put(galleryMediaContent.getId(), galleryMediaContent); @@ -463,14 +463,14 @@ private void addStripesRecursive(LogicalDivision structure) { } private GalleryMediaContent createGalleryMediaContent(View view) { - MediaUnit mediaUnit = view.getMediaUnit(); - URI previewUri = mediaUnit.getMediaFiles().get(previewVariant); + PhysicalDivision physicalDivision = view.getPhysicalDivision(); + URI previewUri = physicalDivision.getMediaFiles().get(previewVariant); URI resourcePreviewUri = null; if (Objects.nonNull(previewUri)) { resourcePreviewUri = previewUri.isAbsolute() ? previewUri : fileService.getResourceUriForProcessRelativeUri(dataEditor.getProcess(), previewUri); } - URI mediaViewUri = mediaUnit.getMediaFiles().get(mediaViewVariant); + URI mediaViewUri = physicalDivision.getMediaFiles().get(mediaViewVariant); URI resourceMediaViewUri = null; if (Objects.nonNull(mediaViewUri)) { resourceMediaViewUri = mediaViewUri.isAbsolute() ? mediaViewUri @@ -503,7 +503,7 @@ GalleryStripe getLogicalStructureOfMedia(GalleryMediaContent galleryMediaContent GalleryMediaContent getGalleryMediaContent(View view) { if (Objects.nonNull(view)) { for (GalleryMediaContent galleryMediaContent : this.medias) { - if (galleryMediaContent.getView().getMediaUnit().equals(view.getMediaUnit())) { + if (galleryMediaContent.getView().getPhysicalDivision().equals(view.getPhysicalDivision())) { return galleryMediaContent; } } @@ -512,14 +512,14 @@ GalleryMediaContent getGalleryMediaContent(View view) { } /** - * Get the GalleryMediaContent object of the passed MediaUnit. - * @param mediaUnit Object to find the GalleryMediaContent for + * Get the GalleryMediaContent object of the passed PhysicalDivision. + * @param physicalDivision Object to find the GalleryMediaContent for * @return GalleryMediaContent */ - public GalleryMediaContent getGalleryMediaContent(MediaUnit mediaUnit) { + public GalleryMediaContent getGalleryMediaContent(PhysicalDivision physicalDivision) { for (GalleryStripe galleryStripe : stripes) { for (GalleryMediaContent media : galleryStripe.getMedias()) { - if (Objects.equals(media.getView().getMediaUnit(), mediaUnit)) { + if (Objects.equals(media.getView().getPhysicalDivision(), physicalDivision)) { return media; } } @@ -528,18 +528,18 @@ public GalleryMediaContent getGalleryMediaContent(MediaUnit mediaUnit) { } /** - * Get a List of all MediaUnits and the LogicalDivisions they are assigned to - * which are displayed between two selected MediaUnits. This method selects the Stripes that are affected by the selection and delegates - * the selection of the contained MediaUnits. + * Get a List of all PhysicalDivisions and the LogicalDivisions they are assigned to + * which are displayed between two selected PhysicalDivisions. This method selects the Stripes that are affected by the selection and delegates + * the selection of the contained PhysicalDivisions. * @param first - * First selected MediaUnit. A Pair of the MediaUnit and the LogicalDivision to which the MediaUnit is assigned. + * First selected PhysicalDivision. A Pair of the PhysicalDivision and the LogicalDivision to which the PhysicalDivision is assigned. * @param last - * Last selected MediaUnit. A Pair of the MediaUnit and the Logical Division to which the MediaUnit is assigned. + * Last selected PhysicalDivision. A Pair of the PhysicalDivision and the Logical Division to which the PhysicalDivision is assigned. * @return - * A List of all selected MediaUnits + * A List of all selected PhysicalDivisions */ - private List> getMediaWithinRange(Pair first, - Pair last) { + private List> getMediaWithinRange(Pair first, + Pair last) { // Pairs of stripe index and media index Pair firstIndices = getIndices(first.getKey(), first.getValue()); Pair lastIndices = getIndices(last.getKey(), last.getValue()); @@ -582,20 +582,20 @@ This stripe is displayed last, but is actually the logical structure (first stri } /** - * Get a List of all MediaUnits and the LogicalDivisions they are assigned to - * which are displayed between two selected MediaUnits. This method selected the MediaUnits between and including the two indices. + * Get a List of all PhysicalDivisions and the LogicalDivisions they are assigned to + * which are displayed between two selected PhysicalDivisions. This method selected the PhysicalDivisions between and including the two indices. * @param firstIndices - * First selected MediaUnit. - * A Pair of indices of the MediaUnit and the LogicalDivision to which the MediaUnit is assigned. + * First selected PhysicalDivision. + * A Pair of indices of the PhysicalDivision and the LogicalDivision to which the PhysicalDivision is assigned. * @param lastIndices - * Last selected MediaUnit. - * A Pair of indices of the MediaUnit and the Logical Division to which the MediaUnit is assigned. + * Last selected PhysicalDivision. + * A Pair of indices of the PhysicalDivision and the Logical Division to which the PhysicalDivision is assigned. * @param galleryStripes - * A List of GalleryStripes which contain the two selected MediaUnits and all in between + * A List of GalleryStripes which contain the two selected PhysicalDivisions and all in between * @return - * A List of all selected MediaUnits + * A List of all selected PhysicalDivisions */ - private List> getMediaWithinRangeFromSelectedStripes( + private List> getMediaWithinRangeFromSelectedStripes( Pair firstIndices, Pair lastIndices, List galleryStripes) { boolean countDown = false; @@ -619,77 +619,77 @@ private List> getMediaWithinRangeFromSelectedSt } } - private List> getMediaForwards(Integer firstIndex, Integer lastIndex, + private List> getMediaForwards(Integer firstIndex, Integer lastIndex, List galleryStripes) { - List> mediaWithinRange = new LinkedList<>(); + List> mediaWithinRange = new LinkedList<>(); GalleryStripe firstStripe = galleryStripes.get(0); if (galleryStripes.size() == 1) { for (int i = firstIndex; i <= lastIndex; i++) { mediaWithinRange.add( - new ImmutablePair<>(firstStripe.getMedias().get(i).getView().getMediaUnit(), firstStripe.getStructure())); + new ImmutablePair<>(firstStripe.getMedias().get(i).getView().getPhysicalDivision(), firstStripe.getStructure())); } } else { for (int i = firstIndex; i <= firstStripe.getMedias().size() - 1; i++) { mediaWithinRange.add( - new ImmutablePair<>(firstStripe.getMedias().get(i).getView().getMediaUnit(), firstStripe.getStructure())); + new ImmutablePair<>(firstStripe.getMedias().get(i).getView().getPhysicalDivision(), firstStripe.getStructure())); } for (int i = 1; i <= galleryStripes.size() - 2; i++) { GalleryStripe galleryStripe = galleryStripes.get(i); for (GalleryMediaContent media : galleryStripe.getMedias()) { - mediaWithinRange.add(new ImmutablePair<>(media.getView().getMediaUnit(), galleryStripe.getStructure())); + mediaWithinRange.add(new ImmutablePair<>(media.getView().getPhysicalDivision(), galleryStripe.getStructure())); } } GalleryStripe lastStripe = galleryStripes.get(galleryStripes.size() - 1); for (int i = 0; i <= lastIndex; i++) { mediaWithinRange.add( - new ImmutablePair<>(lastStripe.getMedias().get(i).getView().getMediaUnit(), lastStripe.getStructure())); + new ImmutablePair<>(lastStripe.getMedias().get(i).getView().getPhysicalDivision(), lastStripe.getStructure())); } } return mediaWithinRange; } - private List> getMediaBackwards(Integer firstIndex, Integer lastIndex, + private List> getMediaBackwards(Integer firstIndex, Integer lastIndex, List galleryStripes) { - List> mediaWithinRange = new LinkedList<>(); + List> mediaWithinRange = new LinkedList<>(); GalleryStripe firstStripe = galleryStripes.get(0); if (galleryStripes.size() == 1) { for (int i = firstIndex; i >= lastIndex; i--) { mediaWithinRange.add( - new ImmutablePair<>(firstStripe.getMedias().get(i).getView().getMediaUnit(), firstStripe.getStructure())); + new ImmutablePair<>(firstStripe.getMedias().get(i).getView().getPhysicalDivision(), firstStripe.getStructure())); } } else { for (int i = firstIndex; i >= 0; i--) { mediaWithinRange.add( - new ImmutablePair<>(firstStripe.getMedias().get(i).getView().getMediaUnit(), firstStripe.getStructure())); + new ImmutablePair<>(firstStripe.getMedias().get(i).getView().getPhysicalDivision(), firstStripe.getStructure())); } for (int i = 1; i <= galleryStripes.size() - 2; i++) { GalleryStripe galleryStripe = galleryStripes.get(i); for (int j = galleryStripe.getMedias().size() - 1; j >= 0; j--) { mediaWithinRange.add(new ImmutablePair<>( - galleryStripe.getMedias().get(j).getView().getMediaUnit(), galleryStripe.getStructure())); + galleryStripe.getMedias().get(j).getView().getPhysicalDivision(), galleryStripe.getStructure())); } } GalleryStripe lastStripe = galleryStripes.get(galleryStripes.size() - 1); for (int i = lastStripe.getMedias().size() - 1; i >= lastIndex; i--) { mediaWithinRange.add( - new ImmutablePair<>(lastStripe.getMedias().get(i).getView().getMediaUnit(), lastStripe.getStructure())); + new ImmutablePair<>(lastStripe.getMedias().get(i).getView().getPhysicalDivision(), lastStripe.getStructure())); } } return mediaWithinRange; } - private Pair getIndices(MediaUnit mediaUnit, LogicalDivision structuralElement) { + private Pair getIndices(PhysicalDivision physicalDivision, LogicalDivision structuralElement) { for (GalleryStripe galleryStripe : stripes) { if (Objects.equals(galleryStripe.getStructure(), structuralElement)) { for (GalleryMediaContent media : galleryStripe.getMedias()) { - if (Objects.equals(media.getView().getMediaUnit(), mediaUnit)) { + if (Objects.equals(media.getView().getPhysicalDivision(), physicalDivision)) { return new ImmutablePair<>(stripes.indexOf(galleryStripe), galleryStripe.getMedias().indexOf(media)); } } @@ -706,23 +706,23 @@ private Pair getIndices(MediaUnit mediaUnit, LogicalDivision s */ public boolean isSelected(GalleryMediaContent galleryMediaContent, GalleryStripe galleryStripe) { if (Objects.nonNull(galleryMediaContent) && Objects.nonNull(galleryMediaContent.getView())) { - MediaUnit mediaUnit = galleryMediaContent.getView().getMediaUnit(); - if (Objects.nonNull(mediaUnit)) { + PhysicalDivision physicalDivision = galleryMediaContent.getView().getPhysicalDivision(); + if (Objects.nonNull(physicalDivision)) { if (Objects.nonNull(galleryStripe)) { - return dataEditor.isSelected(mediaUnit, galleryStripe.getStructure()); + return dataEditor.isSelected(physicalDivision, galleryStripe.getStructure()); } else { - return dataEditor.isSelected(mediaUnit, getLogicalStructureOfMedia(galleryMediaContent).getStructure()); + return dataEditor.isSelected(physicalDivision, getLogicalStructureOfMedia(galleryMediaContent).getStructure()); } } } return false; } - private void selectMedia(String mediaUnitOrder, String stripeIndex, String selectionType) { - MediaUnit selectedMediaUnit = null; - for (MediaUnit mediaUnit : this.dataEditor.getWorkpiece().getAllMediaUnitChildrenFilteredByTypePageAndSorted()) { - if (Objects.equals(mediaUnit.getOrder(), Integer.parseInt(mediaUnitOrder))) { - selectedMediaUnit = mediaUnit; + private void selectMedia(String physicalDivisionOrder, String stripeIndex, String selectionType) { + PhysicalDivision selectedPhysicalDivision = null; + for (PhysicalDivision physicalDivision : this.dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted()) { + if (Objects.equals(physicalDivision.getOrder(), Integer.parseInt(physicalDivisionOrder))) { + selectedPhysicalDivision = physicalDivision; break; } } @@ -732,10 +732,10 @@ private void selectMedia(String mediaUnitOrder, String stripeIndex, String selec } catch (InvalidMetadataValueException | NoSuchMetadataFieldException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } - if (Objects.nonNull(selectedMediaUnit)) { - this.dataEditor.getMetadataPanel().showPageInLogical(selectedMediaUnit); + if (Objects.nonNull(selectedPhysicalDivision)) { + this.dataEditor.getMetadataPanel().showPageInLogical(selectedPhysicalDivision); } else { - Helper.setErrorMessage("Selected MediaUnit is null!"); + Helper.setErrorMessage("Selected PhysicalDivision is null!"); } GalleryStripe parentStripe; @@ -745,7 +745,7 @@ private void selectMedia(String mediaUnitOrder, String stripeIndex, String selec parentStripe = null; } - GalleryMediaContent currentSelection = getGalleryMediaContent(selectedMediaUnit); + GalleryMediaContent currentSelection = getGalleryMediaContent(selectedPhysicalDivision); select(currentSelection, parentStripe, selectionType); if (GalleryViewMode.PREVIEW.equals(galleryViewMode)) { @@ -768,7 +768,7 @@ private void selectStructure(String stripeIndex) { */ public void select() { Map params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); - String mediaUnitOrder = params.get("page"); + String physicalDivisionOrder = params.get("page"); String stripeIndex = params.get("stripe"); String selectionType = params.get("selectionType"); int pageX = Integer.parseInt(params.get("pageX")); @@ -776,8 +776,8 @@ public void select() { boolean triggerContextMenu = Boolean.parseBoolean(params.get("triggerContextMenu")); String createEvent = "(function(){let e=new Event('mousedown');e.pageX=" + pageX + ";e.pageY=" + pageY + ";return e})()"; - if (StringUtils.isNotBlank(mediaUnitOrder)) { - selectMedia(mediaUnitOrder, stripeIndex, selectionType); + if (StringUtils.isNotBlank(physicalDivisionOrder)) { + selectMedia(physicalDivisionOrder, stripeIndex, selectionType); if (triggerContextMenu) { PrimeFaces.current().executeScript("PF('mediaContextMenu').show(" + createEvent + ")"); } @@ -832,7 +832,7 @@ private void defaultSelect(GalleryMediaContent currentSelection, GalleryStripe p } dataEditor.getSelectedMedia().clear(); - dataEditor.getSelectedMedia().add(new ImmutablePair<>(currentSelection.getView().getMediaUnit(), parentStripe.getStructure())); + dataEditor.getSelectedMedia().add(new ImmutablePair<>(currentSelection.getView().getPhysicalDivision(), parentStripe.getStructure())); } private void rangeSelect(GalleryMediaContent currentSelection, GalleryStripe parentStripe) { @@ -841,21 +841,21 @@ private void rangeSelect(GalleryMediaContent currentSelection, GalleryStripe par } if (dataEditor.getSelectedMedia().isEmpty()) { - dataEditor.getSelectedMedia().add(new ImmutablePair<>(currentSelection.getView().getMediaUnit(), parentStripe.getStructure())); + dataEditor.getSelectedMedia().add(new ImmutablePair<>(currentSelection.getView().getPhysicalDivision(), parentStripe.getStructure())); return; } - Pair firstSelectedMediaPair = dataEditor.getSelectedMedia().get(0); - Pair lastSelectedMediaPair = - new ImmutablePair<>(currentSelection.getView().getMediaUnit(), parentStripe.getStructure()); + Pair firstSelectedMediaPair = dataEditor.getSelectedMedia().get(0); + Pair lastSelectedMediaPair = + new ImmutablePair<>(currentSelection.getView().getPhysicalDivision(), parentStripe.getStructure()); dataEditor.getSelectedMedia().clear(); dataEditor.getSelectedMedia().addAll(getMediaWithinRange(firstSelectedMediaPair, lastSelectedMediaPair)); } private void multiSelect(GalleryMediaContent currentSelection, GalleryStripe parentStripe) { - Pair selectedMediaPair = new ImmutablePair<>( - currentSelection.getView().getMediaUnit(), parentStripe.getStructure()); + Pair selectedMediaPair = new ImmutablePair<>( + currentSelection.getView().getPhysicalDivision(), parentStripe.getStructure()); if (dataEditor.getSelectedMedia().contains(selectedMediaPair)) { if (dataEditor.getSelectedMedia().size() > 1) { @@ -867,15 +867,15 @@ private void multiSelect(GalleryMediaContent currentSelection, GalleryStripe par } /** - * Get the index of this GalleryMediaContent's MediaUnit out of all MediaUnits + * Get the index of this GalleryMediaContent's PhysicalDivision out of all PhysicalDivisions * which are assigned to more than one LogicalDivision. * * @param galleryMediaContent object to find the index for - * @return index of the GalleryMediaContent's MediaUnit if present in the List of several assignments, or -1 if not present in the list. + * @return index of the GalleryMediaContent's PhysicalDivision if present in the List of several assignments, or -1 if not present in the list. */ public int getSeveralAssignmentsIndex(GalleryMediaContent galleryMediaContent) { - if (Objects.nonNull(galleryMediaContent.getView()) && Objects.nonNull(galleryMediaContent.getView().getMediaUnit())) { - return dataEditor.getStructurePanel().getSeveralAssignments().indexOf(galleryMediaContent.getView().getMediaUnit()); + if (Objects.nonNull(galleryMediaContent.getView()) && Objects.nonNull(galleryMediaContent.getView().getPhysicalDivision())) { + return dataEditor.getStructurePanel().getSeveralAssignments().indexOf(galleryMediaContent.getView().getPhysicalDivision()); } return -1; } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/MetadataPanel.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/MetadataPanel.java index 75b5f63f49a..9417f7f7f3b 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/MetadataPanel.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/MetadataPanel.java @@ -22,7 +22,7 @@ import org.kitodo.api.Metadata; import org.kitodo.api.dataeditor.rulesetmanagement.StructuralElementViewInterface; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.exceptions.InvalidMetadataValueException; import org.kitodo.exceptions.NoSuchMetadataFieldException; import org.kitodo.production.forms.createprocess.ProcessFieldedMetadata; @@ -156,11 +156,11 @@ void showLogical(Optional optionalStructure) { } - void showPageInLogical(MediaUnit mediaUnit) { - if (Objects.nonNull(mediaUnit)) { + void showPageInLogical(PhysicalDivision physicalDivision) { + if (Objects.nonNull(physicalDivision)) { StructuralElementViewInterface divisionView = dataEditorForm.getRulesetManagement().getStructuralElementView( - mediaUnit.getType(), dataEditorForm.getAcquisitionStage(), dataEditorForm.getPriorityList()); - logicalMetadataTable = new ProcessFieldedMetadata(mediaUnit, divisionView); + physicalDivision.getType(), dataEditorForm.getAcquisitionStage(), dataEditorForm.getPriorityList()); + logicalMetadataTable = new ProcessFieldedMetadata(physicalDivision, divisionView); dataEditorForm.getAddDocStrucTypeDialog().prepareAddableMetadataForStructure(true, getPhysicalMetadataRows().getChildren()); } else { @@ -169,11 +169,11 @@ void showPageInLogical(MediaUnit mediaUnit) { } - void showPhysical(Optional optionalMediaUnit) { - if (optionalMediaUnit.isPresent() && Objects.nonNull(optionalMediaUnit.get().getType())) { + void showPhysical(Optional optionalPhysicalDivision) { + if (optionalPhysicalDivision.isPresent() && Objects.nonNull(optionalPhysicalDivision.get().getType())) { StructuralElementViewInterface divisionView = dataEditorForm.getRulesetManagement().getStructuralElementView( - optionalMediaUnit.get().getType(), dataEditorForm.getAcquisitionStage(), dataEditorForm.getPriorityList()); - physicalMetadataTable = new ProcessFieldedMetadata(optionalMediaUnit.get(), divisionView); + optionalPhysicalDivision.get().getType(), dataEditorForm.getAcquisitionStage(), dataEditorForm.getPriorityList()); + physicalMetadataTable = new ProcessFieldedMetadata(optionalPhysicalDivision.get(), divisionView); dataEditorForm.getAddDocStrucTypeDialog().prepareAddableMetadataForStructure(true); } else { physicalMetadataTable = ProcessFieldedMetadata.EMPTY; diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java index 3c4963723b2..3b45dbbdbc0 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java @@ -23,7 +23,7 @@ import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; import org.kitodo.config.ConfigCore; import org.kitodo.config.enums.ParameterCore; @@ -76,11 +76,11 @@ public void createPagination() { Helper.setErrorMessage(e.getLocalizedMessage()); } Paginator paginator = new Paginator(metsEditorDefaultPagination(1)); - List mediaUnits = dataEditor.getWorkpiece().getAllMediaUnitChildrenFilteredByTypePageAndSorted(); - for (int i = 1; i < mediaUnits.size(); i++) { - MediaUnit mediaUnit = mediaUnits.get(i - 1); - mediaUnit.setOrder(i); - mediaUnit.setOrderlabel(paginator.next()); + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(); + for (int i = 1; i < physicalDivisions.size(); i++) { + PhysicalDivision physicalDivision = physicalDivisions.get(i - 1); + physicalDivision.setOrder(i); + physicalDivision.setOrderlabel(paginator.next()); } dataEditor.refreshStructurePanel(); dataEditor.getGalleryPanel().show(); @@ -91,17 +91,17 @@ public void createPagination() { * This method is invoked if the generate dummy images button is clicked. */ public void generateDummyImagesButtonClick() { - List mediaUnits = dataEditor.getWorkpiece().getAllMediaUnitChildrenFilteredByTypePageAndSorted(); - int order = mediaUnits.isEmpty() ? 1 : mediaUnits.get(mediaUnits.size() - 1).getOrder() + 1; + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(); + int order = physicalDivisions.isEmpty() ? 1 : physicalDivisions.get(physicalDivisions.size() - 1).getOrder() + 1; boolean withAutomaticPagination = ConfigCore.getBooleanParameter(ParameterCore.WITH_AUTOMATIC_PAGINATION); Paginator orderlabel = new Paginator(metsEditorDefaultPagination(order)); for (int i = 1; i <= newPagesCountValue; i++) { - MediaUnit mediaUnit = new MediaUnit(); - mediaUnit.setOrder(order++); + PhysicalDivision physicalDivision = new PhysicalDivision(); + physicalDivision.setOrder(order++); if (withAutomaticPagination) { - mediaUnit.setOrderlabel(orderlabel.next()); + physicalDivision.setOrderlabel(orderlabel.next()); } - mediaUnits.add(mediaUnit); + physicalDivisions.add(physicalDivision); } } @@ -153,20 +153,20 @@ public List getPaginationSelectionSelectedItems() { * selected items to set */ public void setPaginationSelectionSelectedItems(List paginationSelectionSelectedItems) { - List mediaUnits = dataEditor.getWorkpiece().getAllMediaUnitChildrenFilteredByTypePageAndSorted(); + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(); int lastItemIndex = paginationSelectionSelectedItems.get(paginationSelectionSelectedItems.size() - 1); if (this.paginationSelectionSelectedItems.isEmpty() || !Objects.equals(this.paginationSelectionSelectedItems.get( this.paginationSelectionSelectedItems.size() - 1 ), lastItemIndex)) { dataEditor.getStructurePanel().updateNodeSelection( - dataEditor.getGalleryPanel().getGalleryMediaContent(mediaUnits.get(lastItemIndex)), - mediaUnits.get(lastItemIndex).getLogicalDivisions().get(0)); + dataEditor.getGalleryPanel().getGalleryMediaContent(physicalDivisions.get(lastItemIndex)), + physicalDivisions.get(lastItemIndex).getLogicalDivisions().get(0)); updateMetadataPanel(); } dataEditor.getSelectedMedia().clear(); for (int i : paginationSelectionSelectedItems) { - for (LogicalDivision logicalDivision : mediaUnits.get(i).getLogicalDivisions()) { - dataEditor.getSelectedMedia().add(new ImmutablePair<>(mediaUnits.get(i), logicalDivision)); + for (LogicalDivision logicalDivision : physicalDivisions.get(i).getLogicalDivisions()) { + dataEditor.getSelectedMedia().add(new ImmutablePair<>(physicalDivisions.get(i), logicalDivision)); } } this.paginationSelectionSelectedItems = paginationSelectionSelectedItems; @@ -305,12 +305,12 @@ public void setFictitiousCheckboxChecked(boolean fictitiousCheckboxChecked) { } private void preparePaginationSelectionItems() { - List mediaUnits = dataEditor.getWorkpiece().getAllMediaUnitChildrenFilteredByTypePageAndSorted(); - paginationSelectionItems = new ArrayList<>(mediaUnits.size()); - for (int i = 0; i < mediaUnits.size(); i++) { - MediaUnit mediaUnit = mediaUnits.get(i); - String label = Objects.isNull(mediaUnit.getOrderlabel()) ? Integer.toString(mediaUnit.getOrder()) - : mediaUnit.getOrder() + " : " + mediaUnit.getOrderlabel(); + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(); + paginationSelectionItems = new ArrayList<>(physicalDivisions.size()); + for (int i = 0; i < physicalDivisions.size(); i++) { + PhysicalDivision physicalDivision = physicalDivisions.get(i); + String label = Objects.isNull(physicalDivision.getOrderlabel()) ? Integer.toString(physicalDivision.getOrder()) + : physicalDivision.getOrder() + " : " + physicalDivision.getOrderlabel(); paginationSelectionItems.add(new SelectItem(i, label)); } } @@ -320,11 +320,11 @@ private void preparePaginationSelectionItems() { */ public void preparePaginationSelectionSelectedItems() { paginationSelectionSelectedItems = new ArrayList<>(); - List mediaUnits = dataEditor.getWorkpiece().getAllMediaUnitChildrenFilteredByTypePageAndSorted(); - for (Pair selectedElement : dataEditor.getSelectedMedia()) { - for (int i = 0; i < mediaUnits.size(); i++) { - MediaUnit mediaUnit = mediaUnits.get(i); - if (mediaUnit.equals(selectedElement.getKey())) { + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(); + for (Pair selectedElement : dataEditor.getSelectedMedia()) { + for (int i = 0; i < physicalDivisions.size(); i++) { + PhysicalDivision physicalDivision = physicalDivisions.get(i); + if (physicalDivision.equals(selectedElement.getKey())) { paginationSelectionSelectedItems.add(i); break; } @@ -376,14 +376,14 @@ public void startPaginationClick() { String initializer = paginationTypeSelectSelectedItem.format(selectPaginationModeSelectedItem.getValue(), paginationStartValue, fictitiousCheckboxChecked, pageSeparators.get(0).getSeparatorString()); Paginator paginator = new Paginator(initializer); - List mediaUnits = dataEditor.getWorkpiece().getAllMediaUnitChildrenFilteredByTypePageAndSorted(); + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(); if (selectPaginationScopeSelectedItem) { - for (int i = paginationSelectionSelectedItems.get(0); i < mediaUnits.size(); i++) { - mediaUnits.get(i).setOrderlabel(paginator.next()); + for (int i = paginationSelectionSelectedItems.get(0); i < physicalDivisions.size(); i++) { + physicalDivisions.get(i).setOrderlabel(paginator.next()); } } else { for (int i : paginationSelectionSelectedItems) { - mediaUnits.get(i).setOrderlabel(paginator.next()); + physicalDivisions.get(i).setOrderlabel(paginator.next()); } } paginationSelectionSelectedItems = new ArrayList<>(); @@ -403,7 +403,7 @@ private void updateMetadataPanel() { && ((StructureTreeNode) dataEditor.getStructurePanel().getSelectedLogicalNode().getData()) .getDataObject() instanceof View) { View view = (View) ((StructureTreeNode) dataEditor.getStructurePanel().getSelectedLogicalNode().getData()).getDataObject(); - dataEditor.getMetadataPanel().showPageInLogical(view.getMediaUnit()); + dataEditor.getMetadataPanel().showPageInLogical(view.getPhysicalDivision()); } } 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 c4ed2b49b17..921fc4bdf31 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 @@ -34,7 +34,7 @@ import org.apache.logging.log4j.Logger; import org.kitodo.api.dataeditor.rulesetmanagement.StructuralElementViewInterface; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; import org.kitodo.data.database.beans.Process; import org.kitodo.data.exceptions.DataException; @@ -91,12 +91,12 @@ public class StructurePanel implements Serializable { /** * HashMap containing the current expansion states of all TreeNodes in the physical structure tree. */ - private HashMap previousExpansionStatesPhysicalTree; + private HashMap previousExpansionStatesPhysicalTree; /** - * List of all mediaUnits assigned to multiple LogicalDivisions. + * List of all physicalDivisions assigned to multiple LogicalDivisions. */ - private List severalAssignments = new LinkedList<>(); + private List severalAssignments = new LinkedList<>(); /** * Variable used to set the correct order value when building the logical and physical trees from the PrimeFaces tree. @@ -136,12 +136,13 @@ void deleteSelectedStructure() { if (!getSelectedStructure().isPresent()) { /* * No element is selected or the selected element is not a structure - * but, for example, a media unit. + * but, for example, a physical division. */ return; } LogicalDivision selectedStructure = getSelectedStructure().get(); - LinkedList ancestors = MetadataEditor.getAncestorsOfStructure(selectedStructure, structure); + LinkedList ancestors = MetadataEditor.getAncestorsOfLogicalDivision(selectedStructure, + structure); if (ancestors.isEmpty()) { // The selected element is the root node of the tree. return; @@ -150,12 +151,12 @@ void deleteSelectedStructure() { Collection subViews = new ArrayList<>(); getAllSubViews(selectedStructure, subViews); - List multipleViews = subViews.stream().filter(v -> v.getMediaUnit().getLogicalDivisions().size() > 1) + List multipleViews = subViews.stream().filter(v -> v.getPhysicalDivision().getLogicalDivisions().size() > 1) .collect(Collectors.toList()); for (View view : multipleViews) { dataEditor.unassignView(selectedStructure, view, selectedStructure.getViews().getLast().equals(view)); - if (view.getMediaUnit().getLogicalDivisions().size() <= 1) { - severalAssignments.remove(view.getMediaUnit()); + if (view.getPhysicalDivision().getLogicalDivisions().size() <= 1) { + severalAssignments.remove(view.getPhysicalDivision()); } } subViews.removeAll(multipleViews); @@ -163,7 +164,7 @@ void deleteSelectedStructure() { LogicalDivision parent = ancestors.getLast(); parent.getViews().addAll(subViews); - parent.getViews().sort(Comparator.comparingInt(v -> v.getMediaUnit().getOrder())); + parent.getViews().sort(Comparator.comparingInt(v -> v.getPhysicalDivision().getOrder())); parent.getChildren().remove(selectedStructure); show(); @@ -179,19 +180,19 @@ private void getAllSubViews(LogicalDivision selectedStructure, Collection } } - void deleteSelectedMediaUnit() { - Optional selectedMediaUnit = getSelectedMediaUnit(); - if (!selectedMediaUnit.isPresent()) { + void deleteSelectedPhysicalDivision() { + Optional selectedPhysicalDivision = getSelectedPhysicalDivision(); + if (!selectedPhysicalDivision.isPresent()) { return; } - LinkedList ancestors = MetadataEditor.getAncestorsOfMediaUnit(selectedMediaUnit.get(), - dataEditor.getWorkpiece().getMediaUnit()); + LinkedList ancestors = MetadataEditor.getAncestorsOfPhysicalDivision(selectedPhysicalDivision.get(), + dataEditor.getWorkpiece().getPhysicalStructure()); if (ancestors.isEmpty()) { // The selected element is the root node of the tree. return; } - MediaUnit parent = ancestors.getLast(); - parent.getChildren().remove(selectedMediaUnit.get()); + PhysicalDivision parent = ancestors.getLast(); + parent.getChildren().remove(selectedPhysicalDivision.get()); show(); } @@ -244,20 +245,20 @@ Optional getSelectedStructure() { return Optional.ofNullable(dataObject instanceof LogicalDivision ? (LogicalDivision) dataObject : null); } - Optional getSelectedMediaUnit() { + Optional getSelectedPhysicalDivision() { StructureTreeNode structureTreeNode = (StructureTreeNode) selectedPhysicalNode.getData(); Object dataObject = structureTreeNode.getDataObject(); - return Optional.ofNullable(dataObject instanceof MediaUnit ? (MediaUnit) dataObject : null); + return Optional.ofNullable(dataObject instanceof PhysicalDivision ? (PhysicalDivision) dataObject : null); } /** - * Select given MediaUnit in physical structure tree. + * Select given PhysicalDivision in physical structure tree. * - * @param mediaUnit - * MediaUnit to be selected in physical structure tree + * @param physicalDivision + * PhysicalDivision to be selected in physical structure tree */ - void selectMediaUnit(MediaUnit mediaUnit) { - TreeNode matchingTreeNode = getMatchingTreeNode(getPhysicalTree(), mediaUnit); + void selectPhysicalDivision(PhysicalDivision physicalDivision) { + TreeNode matchingTreeNode = getMatchingTreeNode(getPhysicalTree(), physicalDivision); if (Objects.nonNull(matchingTreeNode)) { updatePhysicalNodeSelection(matchingTreeNode); matchingTreeNode.setSelected(true); @@ -266,19 +267,19 @@ void selectMediaUnit(MediaUnit mediaUnit) { } } - private TreeNode getMatchingTreeNode(TreeNode parent, MediaUnit mediaUnit) { + private TreeNode getMatchingTreeNode(TreeNode parent, PhysicalDivision physicalDivision) { TreeNode matchingTreeNode = null; for (TreeNode treeNode : parent.getChildren()) { if (Objects.nonNull(treeNode) && treeNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) treeNode.getData(); - if (structureTreeNode.getDataObject() instanceof MediaUnit) { - MediaUnit currentMediaUnit = (MediaUnit) structureTreeNode.getDataObject(); - if (Objects.nonNull(currentMediaUnit.getDivId()) - && currentMediaUnit.getDivId().equals(mediaUnit.getDivId())) { + if (structureTreeNode.getDataObject() instanceof PhysicalDivision) { + PhysicalDivision currentPhysicalDivision = (PhysicalDivision) structureTreeNode.getDataObject(); + if (Objects.nonNull(currentPhysicalDivision.getDivId()) + && currentPhysicalDivision.getDivId().equals(physicalDivision.getDivId())) { matchingTreeNode = treeNode; break; } else { - matchingTreeNode = getMatchingTreeNode(treeNode, mediaUnit); + matchingTreeNode = getMatchingTreeNode(treeNode, physicalDivision); if (Objects.nonNull(matchingTreeNode)) { break; } @@ -359,22 +360,22 @@ private void preservePhysical() { } } - private static MediaUnit preservePhysicalRecursive(TreeNode treeNode) { + private static PhysicalDivision preservePhysicalRecursive(TreeNode treeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) treeNode.getData(); - if (Objects.isNull(structureTreeNode) || !(structureTreeNode.getDataObject() instanceof MediaUnit)) { + if (Objects.isNull(structureTreeNode) || !(structureTreeNode.getDataObject() instanceof PhysicalDivision)) { return null; } - MediaUnit mediaUnit = (MediaUnit) structureTreeNode.getDataObject(); + PhysicalDivision physicalDivision = (PhysicalDivision) structureTreeNode.getDataObject(); - List childrenLive = mediaUnit.getChildren(); + List childrenLive = physicalDivision.getChildren(); childrenLive.clear(); for (TreeNode child : treeNode.getChildren()) { - MediaUnit possibleChildMediaUnit = preservePhysicalRecursive(child); - if (Objects.nonNull(possibleChildMediaUnit)) { - childrenLive.add(possibleChildMediaUnit); + PhysicalDivision possibleChildPhysicalDivision = preservePhysicalRecursive(child); + if (Objects.nonNull(possibleChildPhysicalDivision)) { + childrenLive.add(possibleChildPhysicalDivision); } } - return mediaUnit; + return physicalDivision; } /** @@ -422,7 +423,7 @@ public void show() { updateLogicalNodeExpansionStates(this.logicalTree, this.previousExpansionStatesLogicalTree); this.previousExpansionStatesPhysicalTree = getPhysicalTreeNodeExpansionStates(this.physicalTree); - this.physicalTree = buildMediaTree(dataEditor.getWorkpiece().getMediaUnit()); + this.physicalTree = buildMediaTree(dataEditor.getWorkpiece().getPhysicalStructure()); updatePhysicalNodeExpansionStates(this.physicalTree, this.previousExpansionStatesPhysicalTree); this.selectedLogicalNode = logicalTree.getChildren().get(logicalTree.getChildCount() - 1); @@ -535,7 +536,7 @@ private void orderChildrenAndViews(List children, List vi } if (Objects.nonNull(temporaryChild) && Objects.isNull(temporaryView) - || Objects.nonNull(temporaryChild) && temporaryChild.getOrder() <= temporaryView.getMediaUnit().getOrder()) { + || Objects.nonNull(temporaryChild) && temporaryChild.getOrder() <= temporaryView.getPhysicalDivision().getOrder()) { viewsShowingOnAChild.addAll(buildStructureTreeRecursively(temporaryChild, parent)); temporaryChildren.remove(0); } else { @@ -549,9 +550,9 @@ private void orderChildrenAndViews(List children, List vi } private String buildViewLabel(View view) { - String order = view.getMediaUnit().getOrder() + " : "; - if (Objects.nonNull(view.getMediaUnit().getOrderlabel())) { - return order + view.getMediaUnit().getOrderlabel(); + String order = view.getPhysicalDivision().getOrder() + " : "; + if (Objects.nonNull(view.getPhysicalDivision().getOrderlabel())) { + return order + view.getPhysicalDivision().getOrderlabel(); } else { return order + "uncounted"; } @@ -603,7 +604,7 @@ private DefaultTreeNode addTreeNode(String label, boolean undefined, boolean lin DefaultTreeNode parent) { DefaultTreeNode node = new DefaultTreeNode(new StructureTreeNode(label, undefined, linked, dataObject), parent); - if (dataObject instanceof MediaUnit && physicalNodeStateUnknown(this.previousExpansionStatesPhysicalTree, node) + if (dataObject instanceof PhysicalDivision && physicalNodeStateUnknown(this.previousExpansionStatesPhysicalTree, node) || dataObject instanceof LogicalDivision && logicalNodeStateUnknown(this.previousExpansionStatesLogicalTree, node)) { node.setExpanded(true); @@ -674,10 +675,10 @@ private void addParentLinksRecursive(Process child, DefaultTreeNode tree) { * Creates the media tree. * * @param mediaRoot - * root of media units to show on the tree + * root of physical divisions to show on the tree * @return the media tree */ - private DefaultTreeNode buildMediaTree(MediaUnit mediaRoot) { + private DefaultTreeNode buildMediaTree(PhysicalDivision mediaRoot) { DefaultTreeNode rootTreeNode = new DefaultTreeNode(); if (physicalNodeStateUnknown(this.previousExpansionStatesPhysicalTree, rootTreeNode)) { rootTreeNode.setExpanded(true); @@ -686,17 +687,17 @@ private DefaultTreeNode buildMediaTree(MediaUnit mediaRoot) { return rootTreeNode; } - private void buildMediaTreeRecursively(MediaUnit mediaUnit, DefaultTreeNode parentTreeNode) { + private void buildMediaTreeRecursively(PhysicalDivision physicalDivision, DefaultTreeNode parentTreeNode) { StructuralElementViewInterface divisionView = dataEditor.getRulesetManagement().getStructuralElementView( - mediaUnit.getType(), dataEditor.getAcquisitionStage(), dataEditor.getPriorityList()); - DefaultTreeNode treeNode = addTreeNode(Objects.equals(mediaUnit.getType(), MediaUnit.TYPE_PAGE) - ? divisionView.getLabel().concat(" " + mediaUnit.getOrderlabel()) : divisionView.getLabel(), - false, false, mediaUnit, parentTreeNode); + physicalDivision.getType(), dataEditor.getAcquisitionStage(), dataEditor.getPriorityList()); + DefaultTreeNode treeNode = addTreeNode(Objects.equals(physicalDivision.getType(), PhysicalDivision.TYPE_PAGE) + ? divisionView.getLabel().concat(" " + physicalDivision.getOrderlabel()) : divisionView.getLabel(), + false, false, physicalDivision, parentTreeNode); if (physicalNodeStateUnknown(this.previousExpansionStatesPhysicalTree, treeNode)) { treeNode.setExpanded(true); } - if (Objects.nonNull(mediaUnit.getChildren())) { - for (MediaUnit child : mediaUnit.getChildren()) { + if (Objects.nonNull(physicalDivision.getChildren())) { + for (PhysicalDivision child : physicalDivision.getChildren()) { buildMediaTreeRecursively(child, treeNode); } } @@ -734,7 +735,7 @@ public void treePhysicalSelect(NodeSelectEvent event) { * JSF at this point. */ try { - dataEditor.switchMediaUnit(); + dataEditor.switchPhysicalDivision(); previouslySelectedPhysicalNode = selectedPhysicalNode; } catch (NoSuchMetadataFieldException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); @@ -757,7 +758,7 @@ private void updatePhysicalNodeSelection(TreeNode treeNode) { } if (Objects.nonNull(physicalTree) && Objects.nonNull(treeNode)) { setSelectedPhysicalNode(treeNode); - this.dataEditor.getMetadataPanel().showPhysical(this.dataEditor.getSelectedMediaUnit()); + this.dataEditor.getMetadataPanel().showPhysical(this.dataEditor.getSelectedPhysicalDivision()); } } } @@ -788,7 +789,7 @@ void updateLogicalNodeSelection(GalleryMediaContent galleryMediaContent, Logical if (this.isSeparateMedia()) { selectedTreeNode = updateLogicalNodeSelectionRecursive(structure, logicalTree); } else { - selectedTreeNode = updatePhysSelectionInLogTreeRecursive(galleryMediaContent.getView().getMediaUnit(), structure, + selectedTreeNode = updatePhysSelectionInLogTreeRecursive(galleryMediaContent.getView().getPhysicalDivision(), structure, logicalTree); } if (Objects.nonNull(selectedTreeNode)) { @@ -864,7 +865,7 @@ private TreeNode updatePhysicalNodeSelectionRecursive(GalleryMediaContent galler return matchingTreeNode; } - private TreeNode updatePhysSelectionInLogTreeRecursive(MediaUnit selectedMediaUnit, LogicalDivision parentElement, + private TreeNode updatePhysSelectionInLogTreeRecursive(PhysicalDivision selectedPhysicalDivision, LogicalDivision parentElement, TreeNode treeNode) { TreeNode matchingTreeNode = null; for (TreeNode currentTreeNode : treeNode.getChildren()) { @@ -873,12 +874,12 @@ private TreeNode updatePhysSelectionInLogTreeRecursive(MediaUnit selectedMediaUn && ((StructureTreeNode) treeNode.getData()).getDataObject().equals(parentElement) && currentTreeNode.getData() instanceof StructureTreeNode && ((StructureTreeNode) currentTreeNode.getData()).getDataObject() instanceof View - && ((View) ((StructureTreeNode) currentTreeNode.getData()).getDataObject()).getMediaUnit().equals(selectedMediaUnit)) { + && ((View) ((StructureTreeNode) currentTreeNode.getData()).getDataObject()).getPhysicalDivision().equals(selectedPhysicalDivision)) { currentTreeNode.setSelected(true); matchingTreeNode = currentTreeNode; } else { currentTreeNode.setSelected(false); - matchingTreeNode = updatePhysSelectionInLogTreeRecursive(selectedMediaUnit, parentElement, currentTreeNode); + matchingTreeNode = updatePhysSelectionInLogTreeRecursive(selectedPhysicalDivision, parentElement, currentTreeNode); } if (Objects.nonNull(matchingTreeNode)) { break; @@ -890,15 +891,15 @@ private TreeNode updatePhysSelectionInLogTreeRecursive(MediaUnit selectedMediaUn private boolean treeNodeMatchesGalleryMediaContent(GalleryMediaContent galleryMediaContent, TreeNode treeNode) { if (treeNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) treeNode.getData(); - MediaUnit mediaUnit = null; - if (structureTreeNode.getDataObject() instanceof MediaUnit) { - mediaUnit = (MediaUnit) structureTreeNode.getDataObject(); + PhysicalDivision physicalDivision = null; + if (structureTreeNode.getDataObject() instanceof PhysicalDivision) { + physicalDivision = (PhysicalDivision) structureTreeNode.getDataObject(); } else if (structureTreeNode.getDataObject() instanceof View) { View view = (View) structureTreeNode.getDataObject(); - mediaUnit = view.getMediaUnit(); + physicalDivision = view.getPhysicalDivision(); } - if (Objects.nonNull(mediaUnit) && Objects.nonNull(galleryMediaContent.getView())) { - return Objects.equals(mediaUnit, galleryMediaContent.getView().getMediaUnit()); + if (Objects.nonNull(physicalDivision) && Objects.nonNull(galleryMediaContent.getView())) { + return Objects.equals(physicalDivision, galleryMediaContent.getView().getPhysicalDivision()); } } return false; @@ -961,8 +962,8 @@ public void onDragDrop(TreeDragDropEvent event) { if (dragNode.getDataObject() instanceof LogicalDivision && dropNode.getDataObject() instanceof LogicalDivision) { checkLogicalDragDrop(dragNode, dropNode); - } else if (dragNode.getDataObject() instanceof MediaUnit - && dropNode.getDataObject() instanceof MediaUnit) { + } else if (dragNode.getDataObject() instanceof PhysicalDivision + && dropNode.getDataObject() instanceof PhysicalDivision) { checkPhysicalDragDrop(dragNode, dropNode); } else if (dragNode.getDataObject() instanceof View && dropNode.getDataObject() instanceof LogicalDivision) { @@ -1034,19 +1035,19 @@ private void movePageNode(TreeDragDropEvent event, StructureTreeNode dropNode, S } /** - * Change the order of the MediaUnits in the workpiece. + * Change the order of the PhysicalDivisions in the workpiece. * When structure is saved to METS this is represented by the order of DIV elements in the physical structMap. - * @param toElement logical element where to which the MediaUnits are assigned - * @param elementsToBeMoved List of MediaUnits which are moved - * @param insertionIndex index at which the MediaUnits are added to the existing List of MediaUnits. + * @param toElement logical element where to which the PhysicalDivisions are assigned + * @param elementsToBeMoved List of PhysicalDivisions which are moved + * @param insertionIndex index at which the PhysicalDivisions are added to the existing List of PhysicalDivisions. * The value -1 represents the end of the list. */ - void reorderMediaUnits(LogicalDivision toElement, + void reorderPhysicalDivisions(LogicalDivision toElement, List> elementsToBeMoved, int insertionIndex) { int physicalInsertionIndex; - List mediaUnitsToBeMoved = elementsToBeMoved.stream() - .map(e -> e.getLeft().getMediaUnit()) + List physicalDivisionsToBeMoved = elementsToBeMoved.stream() + .map(e -> e.getLeft().getPhysicalDivision()) .collect(Collectors.toList()); if (insertionIndex > toElement.getViews().size()) { @@ -1058,32 +1059,32 @@ void reorderMediaUnits(LogicalDivision toElement, // no insertion position was specified or the element does not contain any pages yet physicalInsertionIndex = toElement.getOrder() - 1; } else { - // if 'insertionIndex' equals the size of the list, it means we want to append the moved pages _behind_ the media unit of + // if 'insertionIndex' equals the size of the list, it means we want to append the moved pages _behind_ the physical division of // the last view in the list of views of the 'toElement' if (insertionIndex == toElement.getViews().size()) { - physicalInsertionIndex = toElement.getViews().getLast().getMediaUnit().getOrder(); + physicalInsertionIndex = toElement.getViews().getLast().getPhysicalDivision().getOrder(); } else if (insertionIndex == 0) { // insert at first position directly after logical element physicalInsertionIndex = toElement.getOrder() - 1; } else { // insert at given index - physicalInsertionIndex = toElement.getViews().get(insertionIndex).getMediaUnit().getOrder() - 1; + physicalInsertionIndex = toElement.getViews().get(insertionIndex).getPhysicalDivision().getOrder() - 1; } } - if (physicalInsertionIndex > mediaUnitsToBeMoved.stream() - .map(MediaUnit::getOrder) + if (physicalInsertionIndex > physicalDivisionsToBeMoved.stream() + .map(PhysicalDivision::getOrder) .collect(Collectors.summarizingInt(Integer::intValue)) .getMin() - 1) { int finalInsertionIndex = physicalInsertionIndex; - physicalInsertionIndex -= (int) mediaUnitsToBeMoved.stream().filter(m -> m.getOrder() - 1 < finalInsertionIndex).count(); + physicalInsertionIndex -= (int) physicalDivisionsToBeMoved.stream().filter(m -> m.getOrder() - 1 < finalInsertionIndex).count(); } - dataEditor.getWorkpiece().getMediaUnit().getChildren().removeAll(mediaUnitsToBeMoved); - int numberOfChildren = dataEditor.getWorkpiece().getMediaUnit().getChildren().size(); + dataEditor.getWorkpiece().getPhysicalStructure().getChildren().removeAll(physicalDivisionsToBeMoved); + int numberOfChildren = dataEditor.getWorkpiece().getPhysicalStructure().getChildren().size(); if (physicalInsertionIndex < numberOfChildren) { - dataEditor.getWorkpiece().getMediaUnit().getChildren().addAll(physicalInsertionIndex, mediaUnitsToBeMoved); + dataEditor.getWorkpiece().getPhysicalStructure().getChildren().addAll(physicalInsertionIndex, physicalDivisionsToBeMoved); } else { - dataEditor.getWorkpiece().getMediaUnit().getChildren().addAll(mediaUnitsToBeMoved); + dataEditor.getWorkpiece().getPhysicalStructure().getChildren().addAll(physicalDivisionsToBeMoved); if (physicalInsertionIndex > numberOfChildren) { Helper.setErrorMessage("Could not append media at correct position. Index exceeded list."); } @@ -1097,7 +1098,7 @@ void reorderMediaUnits(LogicalDivision toElement, * @param elementsToBeMoved List of physical elements to be moved */ void changePhysicalOrderFields(LogicalDivision toElement, List> elementsToBeMoved) { - ServiceManager.getFileService().renumberMediaUnits(dataEditor.getWorkpiece(), false); + ServiceManager.getFileService().renumberPhysicalDivisions(dataEditor.getWorkpiece(), false); } /** @@ -1156,7 +1157,7 @@ void changeLogicalOrderFields(LogicalDivision toElement, List getOrdersAffectedByMove(List> views, LogicalDivision toElement) { Set ordersAffectedByMove = views.stream() - .map(e -> e.getLeft().getMediaUnit().getOrder()) + .map(e -> e.getLeft().getPhysicalDivision().getOrder()) .collect(Collectors.toSet()); ordersAffectedByMove.add(toElement.getOrder()); return ordersAffectedByMove.stream() @@ -1198,7 +1199,7 @@ void moveViews(LogicalDivision toElement, boolean removeLastOccurrenceOfView = toElement.equals(elementToBeMoved.getValue()) && insertionIndex < elementToBeMoved.getValue().getViews().lastIndexOf(elementToBeMoved.getKey()); dataEditor.unassignView(elementToBeMoved.getValue(), elementToBeMoved.getKey(), removeLastOccurrenceOfView); - elementToBeMoved.getKey().getMediaUnit().getLogicalDivisions().add(toElement); + elementToBeMoved.getKey().getPhysicalDivision().getLogicalDivisions().add(toElement); } } @@ -1212,7 +1213,7 @@ private void checkLogicalDragDrop(StructureTreeNode dragNode, StructureTreeNode LinkedList dragParents; if (divisionView.getAllowedSubstructuralElements().containsKey(dragStructure.getType())) { - dragParents = MetadataEditor.getAncestorsOfStructure(dragStructure, + dragParents = MetadataEditor.getAncestorsOfLogicalDivision(dragStructure, dataEditor.getWorkpiece().getLogicalStructure()); if (!dragParents.isEmpty()) { LogicalDivision parentStructure = dragParents.get(dragParents.size() - 1); @@ -1240,20 +1241,20 @@ private void checkLogicalDragDrop(StructureTreeNode dragNode, StructureTreeNode private void checkPhysicalDragDrop(StructureTreeNode dragNode, StructureTreeNode dropNode) { - MediaUnit dragUnit = (MediaUnit) dragNode.getDataObject(); - MediaUnit dropUnit = (MediaUnit) dropNode.getDataObject(); + PhysicalDivision dragUnit = (PhysicalDivision) dragNode.getDataObject(); + PhysicalDivision dropUnit = (PhysicalDivision) dropNode.getDataObject(); StructuralElementViewInterface divisionView = dataEditor.getRulesetManagement().getStructuralElementView( dropUnit.getType(), dataEditor.getAcquisitionStage(), dataEditor.getPriorityList()); - LinkedList dragParents; + LinkedList dragParents; if (divisionView.getAllowedSubstructuralElements().containsKey(dragUnit.getType())) { - dragParents = MetadataEditor.getAncestorsOfMediaUnit(dragUnit, dataEditor.getWorkpiece().getMediaUnit()); + dragParents = MetadataEditor.getAncestorsOfPhysicalDivision(dragUnit, dataEditor.getWorkpiece().getPhysicalStructure()); if (dragParents.isEmpty()) { Helper.setErrorMessage(Helper.getTranslation("dataEditor.noParentsError", Collections.singletonList(dragNode.getLabel()))); } else { - MediaUnit parentUnit = dragParents.get(dragParents.size() - 1); + PhysicalDivision parentUnit = dragParents.get(dragParents.size() - 1); if (parentUnit.getChildren().contains(dragUnit)) { preservePhysical(); } else { @@ -1271,10 +1272,10 @@ private void checkPhysicalDragDrop(StructureTreeNode dragNode, StructureTreeNode private void preserveLogicalAndPhysical() throws UnknownTreeNodeDataException { if (!this.logicalTree.getChildren().isEmpty()) { order = 1; - for (MediaUnit mediaUnit : dataEditor.getWorkpiece().getMediaUnit().getChildren()) { - mediaUnit.getLogicalDivisions().clear(); + for (PhysicalDivision physicalDivision : dataEditor.getWorkpiece().getPhysicalStructure().getChildren()) { + physicalDivision.getLogicalDivisions().clear(); } - dataEditor.getWorkpiece().getMediaUnit().getChildren().clear(); + dataEditor.getWorkpiece().getPhysicalStructure().getChildren().clear(); preserveLogicalAndPhysicalRecursive(this.logicalTree.getChildren().get(logicalTree.getChildCount() - 1)); } } @@ -1300,13 +1301,13 @@ private LogicalDivision preserveLogicalAndPhysicalRecursive(TreeNode treeNode) t } else if (((StructureTreeNode) child.getData()).getDataObject() instanceof View) { View view = (View) ((StructureTreeNode) child.getData()).getDataObject(); structure.getViews().add(view); - if (!dataEditor.getWorkpiece().getAllMediaUnits().contains(view.getMediaUnit())) { - view.getMediaUnit().setOrder(order); - dataEditor.getWorkpiece().getMediaUnit().getChildren().add(view.getMediaUnit()); + if (!dataEditor.getWorkpiece().getAllPhysicalDivisions().contains(view.getPhysicalDivision())) { + view.getPhysicalDivision().setOrder(order); + dataEditor.getWorkpiece().getPhysicalStructure().getChildren().add(view.getPhysicalDivision()); order++; } - if (!view.getMediaUnit().getLogicalDivisions().contains(structure)) { - view.getMediaUnit().getLogicalDivisions().add(structure); + if (!view.getPhysicalDivision().getLogicalDivisions().contains(structure)) { + view.getPhysicalDivision().getLogicalDivisions().add(structure); } } } @@ -1356,23 +1357,23 @@ private HashMap getLogicalTreeNodeExpansionStatesRecur return expansionStates; } - private HashMap getPhysicalTreeNodeExpansionStates(DefaultTreeNode tree) { + private HashMap getPhysicalTreeNodeExpansionStates(DefaultTreeNode tree) { if (Objects.nonNull(tree) && tree.getChildCount() == 1) { TreeNode treeRoot = tree.getChildren().get(0); - MediaUnit mediaUnit = getTreeNodeMediaUnit(treeRoot); - if (Objects.nonNull(mediaUnit)) { + PhysicalDivision physicalDivision = getTreeNodePhysicalDivision(treeRoot); + if (Objects.nonNull(physicalDivision)) { return getPhysicalTreeNodeExpansionStatesRecursively(treeRoot, new HashMap<>()); } } return new HashMap<>(); } - private HashMap getPhysicalTreeNodeExpansionStatesRecursively(TreeNode treeNode, - HashMap expansionStates) { + private HashMap getPhysicalTreeNodeExpansionStatesRecursively(TreeNode treeNode, + HashMap expansionStates) { if (Objects.nonNull(treeNode)) { - MediaUnit mediaUnit = getTreeNodeMediaUnit(treeNode); - if (Objects.nonNull(mediaUnit)) { - expansionStates.put(mediaUnit, treeNode.isExpanded()); + PhysicalDivision physicalDivision = getTreeNodePhysicalDivision(treeNode); + if (Objects.nonNull(physicalDivision)) { + expansionStates.put(physicalDivision, treeNode.isExpanded()); for (TreeNode childNode : treeNode.getChildren()) { expansionStates.putAll(getPhysicalTreeNodeExpansionStatesRecursively(childNode, expansionStates)); } @@ -1397,16 +1398,16 @@ private void updateNodeExpansionStatesRecursively(TreeNode treeNode, HashMap expansionStates) { + private void updatePhysicalNodeExpansionStates(DefaultTreeNode tree, HashMap expansionStates) { if (Objects.nonNull(tree) && Objects.nonNull(expansionStates) && !expansionStates.isEmpty()) { updatePhysicalNodeExpansionStatesRecursively(tree, expansionStates); } } - private void updatePhysicalNodeExpansionStatesRecursively(TreeNode treeNode, HashMap expansionStates) { - MediaUnit mediaUnit = getTreeNodeMediaUnit(treeNode); - if (Objects.nonNull(mediaUnit) && expansionStates.containsKey(mediaUnit)) { - treeNode.setExpanded(expansionStates.get(mediaUnit)); + private void updatePhysicalNodeExpansionStatesRecursively(TreeNode treeNode, HashMap expansionStates) { + PhysicalDivision physicalDivision = getTreeNodePhysicalDivision(treeNode); + if (Objects.nonNull(physicalDivision) && expansionStates.containsKey(physicalDivision)) { + treeNode.setExpanded(expansionStates.get(physicalDivision)); } for (TreeNode childNode : treeNode.getChildren()) { updatePhysicalNodeExpansionStatesRecursively(childNode, expansionStates); @@ -1418,9 +1419,9 @@ private boolean logicalNodeStateUnknown(HashMap expans return !Objects.nonNull(expansionStates) || (Objects.nonNull(element) && !expansionStates.containsKey(element)); } - private boolean physicalNodeStateUnknown(HashMap expanionStates, TreeNode treeNode) { - MediaUnit mediaUnit = getTreeNodeMediaUnit(treeNode); - return Objects.isNull(expanionStates) || (Objects.nonNull(mediaUnit) && !expanionStates.containsKey(mediaUnit)); + private boolean physicalNodeStateUnknown(HashMap expanionStates, TreeNode treeNode) { + PhysicalDivision physicalDivision = getTreeNodePhysicalDivision(treeNode); + return Objects.isNull(expanionStates) || (Objects.nonNull(physicalDivision) && !expanionStates.containsKey(physicalDivision)); } private LogicalDivision getTreeNodeStructuralElement(TreeNode treeNode) { @@ -1433,22 +1434,22 @@ private LogicalDivision getTreeNodeStructuralElement(TreeNode treeNode) { return null; } - private MediaUnit getTreeNodeMediaUnit(TreeNode treeNode) { + private PhysicalDivision getTreeNodePhysicalDivision(TreeNode treeNode) { if (treeNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) treeNode.getData(); - if (structureTreeNode.getDataObject() instanceof MediaUnit) { - return (MediaUnit) structureTreeNode.getDataObject(); + if (structureTreeNode.getDataObject() instanceof PhysicalDivision) { + return (PhysicalDivision) structureTreeNode.getDataObject(); } } return null; } /** - * Get List of MediaUnits assigned to multiple LogicalDivisions. + * Get List of PhysicalDivisions assigned to multiple LogicalDivisions. * * @return value of severalAssignments */ - List getSeveralAssignments() { + List getSeveralAssignments() { return severalAssignments; } @@ -1471,39 +1472,39 @@ public void setActiveTabs(String activeTabs) { } /** - * Get the index of this StructureTreeNode's MediaUnit out of all MediaUnits + * Get the index of this StructureTreeNode's PhysicalDivision out of all PhysicalDivisions * which are assigned to more than one LogicalDivision. * * @param treeNode object to find the index for - * @return index of the StructureTreeNode's MediaUnit if present in the List of several assignments, or -1 if not present in the list. + * @return index of the StructureTreeNode's PhysicalDivision if present in the List of several assignments, or -1 if not present in the list. */ public int getMultipleAssignmentsIndex(StructureTreeNode treeNode) { if (treeNode.getDataObject() instanceof View - && Objects.nonNull(((View) treeNode.getDataObject()).getMediaUnit())) { - return severalAssignments.indexOf(((View) treeNode.getDataObject()).getMediaUnit()); + && Objects.nonNull(((View) treeNode.getDataObject()).getPhysicalDivision())) { + return severalAssignments.indexOf(((View) treeNode.getDataObject()).getPhysicalDivision()); } return -1; } /** - * Check if the selected Node's MediaUnit is assigned to several LogicalDivisions. + * Check if the selected Node's PhysicalDivision is assigned to several LogicalDivisions. * - * @return {@code true} when the MediaUnit is assigned to more than one logical element + * @return {@code true} when the PhysicalDivision is assigned to more than one logical element */ public boolean isAssignedSeveralTimes() { if (Objects.nonNull(selectedLogicalNode) && selectedLogicalNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) selectedLogicalNode.getData(); if (structureTreeNode.getDataObject() instanceof View) { View view = (View) structureTreeNode.getDataObject(); - return view.getMediaUnit().getLogicalDivisions().size() > 1; + return view.getPhysicalDivision().getLogicalDivisions().size() > 1; } } return false; } /** - * Check if the selected Node's MediaUnit can be assigned to the next logical element in addition to the current assignment. - * @return {@code true} if the MediaUnit can be assigned to the next LogicalDivision + * Check if the selected Node's PhysicalDivision can be assigned to the next logical element in addition to the current assignment. + * @return {@code true} if the PhysicalDivision can be assigned to the next LogicalDivision */ public boolean isAssignableSeveralTimes() { if (Objects.nonNull(selectedLogicalNode) && selectedLogicalNode.getData() instanceof StructureTreeNode) { @@ -1528,20 +1529,20 @@ public boolean isAssignableSeveralTimes() { } /** - * Assign selected Node's MediaUnit to the next LogicalDivision. + * Assign selected Node's PhysicalDivision to the next LogicalDivision. */ public void assign() { if (isAssignableSeveralTimes()) { View view = (View) ((StructureTreeNode) selectedLogicalNode.getData()).getDataObject(); View viewToAssign = new View(); - viewToAssign.setMediaUnit(view.getMediaUnit()); + viewToAssign.setPhysicalDivision(view.getPhysicalDivision()); List logicalNodeSiblings = selectedLogicalNode.getParent().getParent().getChildren(); int logicalNodeIndex = logicalNodeSiblings.indexOf(selectedLogicalNode.getParent()); TreeNode nextSibling = logicalNodeSiblings.get(logicalNodeIndex + 1); StructureTreeNode structureTreeNodeSibling = (StructureTreeNode) nextSibling.getData(); LogicalDivision logicalDivision = (LogicalDivision) structureTreeNodeSibling.getDataObject(); dataEditor.assignView(logicalDivision, viewToAssign, 0); - severalAssignments.add(viewToAssign.getMediaUnit()); + severalAssignments.add(viewToAssign.getPhysicalDivision()); show(); dataEditor.getSelectedMedia().clear(); dataEditor.getGalleryPanel().updateStripes(); @@ -1549,7 +1550,7 @@ public void assign() { } /** - * Unassign the selected Node's MediaUnit from the LogicalDivision parent at the selected position. + * Unassign the selected Node's PhysicalDivision from the LogicalDivision parent at the selected position. * This does not remove it from other LogicalDivisions. */ public void unassign() { @@ -1562,8 +1563,8 @@ public void unassign() { LogicalDivision logicalDivision = (LogicalDivision) structureTreeNodeParent.getDataObject(); dataEditor.unassignView(logicalDivision, view, false); - if (view.getMediaUnit().getLogicalDivisions().size() <= 1) { - severalAssignments.remove(view.getMediaUnit()); + if (view.getPhysicalDivision().getLogicalDivisions().size() <= 1) { + severalAssignments.remove(view.getPhysicalDivision()); } show(); dataEditor.getGalleryPanel().updateStripes(); diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructureTreeNode.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructureTreeNode.java index a70baed1412..0d8428c2d47 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructureTreeNode.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructureTreeNode.java @@ -15,7 +15,7 @@ import java.util.Objects; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; public class StructureTreeNode implements Serializable { @@ -71,13 +71,13 @@ public boolean isUndefined() { } /** - * Return label of dataObject if dataObject is instance of MediaUnit or LogicalDivision. + * Return label of dataObject if dataObject is instance of PhysicalDivision or LogicalDivision. * * @return label */ public String getOrderLabel() { - if (this.dataObject instanceof MediaUnit) { - return ((MediaUnit) this.dataObject).getOrderlabel(); + if (this.dataObject instanceof PhysicalDivision) { + return ((PhysicalDivision) this.dataObject).getOrderlabel(); } else if (this.dataObject instanceof LogicalDivision) { return ((LogicalDivision) this.dataObject).getOrderlabel(); } else { @@ -86,17 +86,17 @@ public String getOrderLabel() { } /** - * Check if the StructureTreeNode's MediaUnit is assigned to several LogicalDivisions. + * Check if the StructureTreeNode's PhysicalDivision is assigned to several LogicalDivisions. * - * @return {@code true} when the MediaUnit is assigned to more than one logical element + * @return {@code true} when the PhysicalDivision is assigned to more than one logical element */ public boolean isAssignedSeveralTimes() { if (Objects.nonNull(this.dataObject)) { if (this.dataObject instanceof View) { View view = (View) this.dataObject; - return Objects.nonNull(view.getMediaUnit()) && view.getMediaUnit().getLogicalDivisions().size() > 1; - } else if (this.dataObject instanceof MediaUnit) { - return ((MediaUnit) this.dataObject).getLogicalDivisions().size() > 1; + return Objects.nonNull(view.getPhysicalDivision()) && view.getPhysicalDivision().getLogicalDivisions().size() > 1; + } else if (this.dataObject instanceof PhysicalDivision) { + return ((PhysicalDivision) this.dataObject).getLogicalDivisions().size() > 1; } } return false; diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java b/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java index 8f82c17e0ad..b79544d3b06 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java @@ -25,7 +25,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.RangeQueryBuilder; import org.elasticsearch.search.sort.SortOrder; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.Workpiece; import org.kitodo.data.elasticsearch.index.type.enums.ProcessTypeField; import org.kitodo.data.exceptions.DataException; @@ -171,8 +171,8 @@ private void prepareRow(int rowCounter, HSSFSheet sheet, ProcessDTO processDTO) try { metadataFilePath = ServiceManager.getFileService().getMetadataFilePath(processDTO); Workpiece workpiece = ServiceManager.getMetsService().loadWorkpiece(metadataFilePath); - numberOfProcessImages = (int) Workpiece.treeStream(workpiece.getMediaUnit()) - .filter(mediaUnit -> Objects.equals(mediaUnit.getType(), MediaUnit.TYPE_PAGE)).count(); + numberOfProcessImages = (int) Workpiece.treeStream(workpiece.getPhysicalStructure()) + .filter(physicalDivision -> Objects.equals(physicalDivision.getType(), PhysicalDivision.TYPE_PAGE)).count(); numberOfProcessStructuralElements = (int) Workpiece.treeStream(workpiece.getLogicalStructure()).count(); numberOfProcessMetadata = Math.toIntExact(MetsService.countLogicalMetadata(workpiece)); diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyFileSetDocStructHelper.java b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyFileSetDocStructHelper.java index 67e5a92aee3..b42ed8616a6 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyFileSetDocStructHelper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyFileSetDocStructHelper.java @@ -15,10 +15,10 @@ import java.util.Collections; import java.util.List; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; /** - * Connects a legacy file set its corresponding doc struct to a media units + * Connects a legacy file set its corresponding doc struct to a physical divisions * list. This is a soldering class to keep legacy code operational which is * about to be removed. Do not use this class. */ @@ -26,13 +26,13 @@ public class LegacyFileSetDocStructHelper implements LegacyDocStructHelperInterface { /** - * The media units list accessed via this soldering class. + * The physical divisions list accessed via this soldering class. */ - private List mediaUnits; + private List physicalDivisions; @Deprecated - public LegacyFileSetDocStructHelper(List mediaUnits) { - this.mediaUnits = mediaUnits; + public LegacyFileSetDocStructHelper(List physicalDivisions) { + this.physicalDivisions = physicalDivisions; } @Override @@ -47,9 +47,9 @@ public void addMetadata(LegacyMetadataHelper metadata) { @Override @Deprecated public List getAllChildren() { - List allChildren = new ArrayList<>(mediaUnits.size()); - for (MediaUnit mediaUnit : mediaUnits) { - allChildren.add(new LegacyInnerPhysicalDocStructHelper(mediaUnit)); + List allChildren = new ArrayList<>(physicalDivisions.size()); + for (PhysicalDivision physicalDivision : physicalDivisions) { + allChildren.add(new LegacyInnerPhysicalDocStructHelper(physicalDivision)); } return allChildren; } @@ -57,9 +57,9 @@ public List getAllChildren() { @Override @Deprecated public List getAllChildrenByTypeAndMetadataType(String page, String asterisk) { - List allChildren = new ArrayList<>(mediaUnits.size()); - for (MediaUnit mediaUnit : mediaUnits) { - allChildren.add(new LegacyInnerPhysicalDocStructHelper(mediaUnit)); + List allChildren = new ArrayList<>(physicalDivisions.size()); + for (PhysicalDivision physicalDivision : physicalDivisions) { + allChildren.add(new LegacyInnerPhysicalDocStructHelper(physicalDivision)); } return allChildren; } diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructHelper.java b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructHelper.java index bc2bc764b68..14f6afd4aea 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructHelper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructHelper.java @@ -19,13 +19,13 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; import org.kitodo.production.services.ServiceManager; import org.kitodo.production.services.dataformat.MetsService; /** - * Connects a legacy doc struct from the physical map to a media unit. This is a + * Connects a legacy doc struct from the physical map to a physical division. This is a * soldering class to keep legacy code operational which is about to be removed. * Do not use this class. */ @@ -46,22 +46,22 @@ public class LegacyInnerPhysicalDocStructHelper implements LegacyDocStructHelper } /** - * The media unit accessed via this soldering class. + * The physical division accessed via this soldering class. */ - private MediaUnit mediaUnit; + private PhysicalDivision physicalDivision; @Deprecated - public LegacyInnerPhysicalDocStructHelper(MediaUnit mediaUnit) { - this.mediaUnit = mediaUnit; + public LegacyInnerPhysicalDocStructHelper(PhysicalDivision physicalDivision) { + this.physicalDivision = physicalDivision; } @Override @Deprecated public void addMetadata(LegacyMetadataHelper metadata) { if (LegacyMetadataTypeHelper.SPECIAL_TYPE_ORDER.equals(metadata.getMetadataType())) { - mediaUnit.setOrder(Integer.parseInt(metadata.getValue())); + physicalDivision.setOrder(Integer.parseInt(metadata.getValue())); } else if (LegacyMetadataTypeHelper.SPECIAL_TYPE_ORDERLABEL.equals(metadata.getMetadataType())) { - mediaUnit.setOrderlabel(metadata.getValue()); + physicalDivision.setOrderlabel(metadata.getValue()); } else { logger.log(Level.TRACE, "addMetadata(metadata: {})", metadata); } @@ -82,30 +82,30 @@ public List getAllChildren() { public List getAllMetadata() { return Arrays.asList( new LegacyMetadataHelper(this, LegacyMetadataTypeHelper.SPECIAL_TYPE_ORDER, - Integer.toString(mediaUnit.getOrder())), + Integer.toString(physicalDivision.getOrder())), new LegacyMetadataHelper(this, LegacyMetadataTypeHelper.SPECIAL_TYPE_ORDERLABEL, - mediaUnit.getOrderlabel())); + physicalDivision.getOrderlabel())); } @Override @Deprecated public List getAllMetadataByType(LegacyMetadataTypeHelper metadataType) { if (metadataType == LegacyMetadataTypeHelper.SPECIAL_TYPE_ORDER) { - return Objects.nonNull(mediaUnit) + return Objects.nonNull(physicalDivision) ? Arrays.asList( - new LegacyMetadataHelper(this, metadataType, Integer.toString(mediaUnit.getOrder()))) + new LegacyMetadataHelper(this, metadataType, Integer.toString(physicalDivision.getOrder()))) : Collections.emptyList(); } else if (metadataType == LegacyMetadataTypeHelper.SPECIAL_TYPE_ORDERLABEL) { - return Objects.nonNull(mediaUnit) && Objects.nonNull(mediaUnit.getOrderlabel()) - ? Arrays.asList(new LegacyMetadataHelper(this, metadataType, mediaUnit.getOrderlabel())) + return Objects.nonNull(physicalDivision) && Objects.nonNull(physicalDivision.getOrderlabel()) + ? Arrays.asList(new LegacyMetadataHelper(this, metadataType, physicalDivision.getOrderlabel())) : Collections.emptyList(); } else { throw new UnsupportedOperationException("Not yet implemented"); } } - MediaUnit getMediaUnit() { - return mediaUnit; + PhysicalDivision getPhysicalDivision() { + return physicalDivision; } @Override diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructTypePageHelper.java b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructTypePageHelper.java index e128b6f2885..9996f42157c 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructTypePageHelper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructTypePageHelper.java @@ -11,7 +11,7 @@ package org.kitodo.production.helper.metadata.legacytypeimplementations; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; /** * Represents the only existing legacy doc struct type from the physical map @@ -33,7 +33,7 @@ private LegacyInnerPhysicalDocStructTypePageHelper() { @Override @Deprecated public String getName() { - return MediaUnit.TYPE_PAGE; + return PhysicalDivision.TYPE_PAGE; } @Override diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyLogicalDocStructHelper.java b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyLogicalDocStructHelper.java index 0c0226558c2..045d146b331 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyLogicalDocStructHelper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyLogicalDocStructHelper.java @@ -33,7 +33,7 @@ import org.kitodo.api.dataeditor.rulesetmanagement.RulesetManagementInterface; import org.kitodo.api.dataeditor.rulesetmanagement.StructuralElementViewInterface; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; import org.kitodo.production.metadata.MetadataEditor; @@ -120,9 +120,9 @@ public void saveMetadata(LegacyMetadataHelper metadata) { public LegacyReferenceHelper addReferenceTo(LegacyDocStructHelperInterface docStruct, String type) { View view = new View(); LegacyInnerPhysicalDocStructHelper target = (LegacyInnerPhysicalDocStructHelper) docStruct; - view.setMediaUnit(target.getMediaUnit()); + view.setPhysicalDivision(target.getPhysicalDivision()); logicalDivision.getViews().add(view); - view.getMediaUnit().getLogicalDivisions().add(logicalDivision); + view.getPhysicalDivision().getLogicalDivisions().add(logicalDivision); return new LegacyReferenceHelper(target); } @@ -201,8 +201,8 @@ public Collection getAllToReferences(String type) { Collection views = logicalDivision.getViews(); ArrayList allReferences = new ArrayList<>(views.size()); for (View view : views) { - MediaUnit mediaUnit = view.getMediaUnit(); - allReferences.add(new LegacyReferenceHelper(new LegacyInnerPhysicalDocStructHelper(mediaUnit))); + PhysicalDivision physicalDivision = view.getPhysicalDivision(); + allReferences.add(new LegacyReferenceHelper(new LegacyInnerPhysicalDocStructHelper(physicalDivision))); } return allReferences; default: diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyMetsModsDigitalDocumentHelper.java b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyMetsModsDigitalDocumentHelper.java index a62afa52e9f..d1e8926707d 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyMetsModsDigitalDocumentHelper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyMetsModsDigitalDocumentHelper.java @@ -129,7 +129,7 @@ public LegacyMetsModsDigitalDocumentHelper getDigitalDocument() { @Deprecated public LegacyFileSetDocStructHelper getFileSet() { - return new LegacyFileSetDocStructHelper(workpiece.getMediaUnit().getChildren()); + return new LegacyFileSetDocStructHelper(workpiece.getPhysicalStructure().getChildren()); } @Deprecated @@ -139,7 +139,7 @@ public LegacyDocStructHelperInterface getLogicalDocStruct() { @Deprecated public LegacyDocStructHelperInterface getPhysicalDocStruct() { - return new LegacyFileSetDocStructHelper(workpiece.getMediaUnit().getChildren()); + return new LegacyFileSetDocStructHelper(workpiece.getPhysicalStructure().getChildren()); } /** diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyReferenceHelper.java b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyReferenceHelper.java index b88424da973..5fc1450c059 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyReferenceHelper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyReferenceHelper.java @@ -12,14 +12,14 @@ package org.kitodo.production.helper.metadata.legacytypeimplementations; /** - * Connects a legacy reference to a media unit. This is a soldering class to + * Connects a legacy reference to a physical division. This is a soldering class to * keep legacy code operational which is about to be removed. Do not use this * class. */ public class LegacyReferenceHelper { /** - * The soldering class containing the media unit accessed via this soldering + * The soldering class containing the physical division accessed via this soldering * class. */ private LegacyInnerPhysicalDocStructHelper target; diff --git a/Kitodo/src/main/java/org/kitodo/production/metadata/MetadataEditor.java b/Kitodo/src/main/java/org/kitodo/production/metadata/MetadataEditor.java index e955f9de2f1..2903dbd91af 100644 --- a/Kitodo/src/main/java/org/kitodo/production/metadata/MetadataEditor.java +++ b/Kitodo/src/main/java/org/kitodo/production/metadata/MetadataEditor.java @@ -35,7 +35,7 @@ import org.kitodo.api.dataeditor.rulesetmanagement.SimpleMetadataViewInterface; import org.kitodo.api.dataformat.Division; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; import org.kitodo.api.dataformat.Workpiece; import org.kitodo.api.dataformat.mets.LinkedMetsResource; @@ -193,7 +193,7 @@ public static void addMultipleStructures(int number, String type, Workpiece work InsertionPosition position, String metadataKey, String metadataValue) { for (int i = 0; i < number; i++) { - LogicalDivision newStructure = addStructure(type, workpiece, structure, position, Collections.emptyList()); + LogicalDivision newStructure = addLogicalDivision(type, workpiece, structure, position, Collections.emptyList()); if (Objects.isNull(newStructure)) { continue; } @@ -213,7 +213,7 @@ public static void addMultipleStructures(int number, String type, Workpiece work * type of new structure * @param workpiece * workpiece to which the new structure is to be added - * @param structure + * @param logicalDivision * structure relative to which the new structure is to be * inserted * @param position @@ -222,9 +222,10 @@ public static void addMultipleStructures(int number, String type, Workpiece work * views to be assigned to the structure * @return the newly created structure */ - public static LogicalDivision addStructure(String type, Workpiece workpiece, LogicalDivision structure, + public static LogicalDivision addLogicalDivision(String type, Workpiece workpiece, LogicalDivision logicalDivision, InsertionPosition position, List viewsToAdd) { - LinkedList parents = getAncestorsOfStructure(structure, workpiece.getLogicalStructure()); + LinkedList parents = getAncestorsOfLogicalDivision(logicalDivision, + workpiece.getLogicalStructure()); List siblings = new LinkedList<>(); if (parents.isEmpty()) { if (position.equals(InsertionPosition.AFTER_CURRENT_ELEMENT) @@ -240,36 +241,36 @@ public static LogicalDivision addStructure(String type, Workpiece workpiece, Log newStructure.setType(type); switch (position) { case AFTER_CURRENT_ELEMENT: - siblings.add(siblings.indexOf(structure) + 1, newStructure); + siblings.add(siblings.indexOf(logicalDivision) + 1, newStructure); break; case BEFORE_CURRENT_ELEMENT: - siblings.add(siblings.indexOf(structure), newStructure); + siblings.add(siblings.indexOf(logicalDivision), newStructure); break; case CURRENT_POSITION: - OptionalInt minOrder = viewsToAdd.stream().mapToInt(v -> v.getMediaUnit().getOrder()).min(); + OptionalInt minOrder = viewsToAdd.stream().mapToInt(v -> v.getPhysicalDivision().getOrder()).min(); if (minOrder.isPresent()) { int structureOrder = minOrder.getAsInt(); - // new structure ORDER must be set to same min ORDER value of contained media units + // new structure ORDER must be set to same min ORDER value of contained physical divisions newStructure.setOrder(structureOrder); - List siblingOrderValues = Stream.concat(structure.getChildren().stream() + List siblingOrderValues = Stream.concat(logicalDivision.getChildren().stream() .map(Division::getOrder), Stream.of(structureOrder)).sorted().collect(Collectors.toList()); // new order must be set at correction location between existing siblings - structure.getChildren().add(siblingOrderValues.indexOf(structureOrder), newStructure); + logicalDivision.getChildren().add(siblingOrderValues.indexOf(structureOrder), newStructure); } break; case FIRST_CHILD_OF_CURRENT_ELEMENT: - structure.getChildren().add(0, newStructure); + logicalDivision.getChildren().add(0, newStructure); break; case LAST_CHILD_OF_CURRENT_ELEMENT: - structure.getChildren().add(newStructure); + logicalDivision.getChildren().add(newStructure); break; case PARENT_OF_CURRENT_ELEMENT: - newStructure.getChildren().add(structure); + newStructure.getChildren().add(logicalDivision); if (parents.isEmpty()) { workpiece.setLogicalStructure(newStructure); } else { - siblings.set(siblings.indexOf(structure), newStructure); + siblings.set(siblings.indexOf(logicalDivision), newStructure); } break; default: @@ -277,7 +278,7 @@ public static LogicalDivision addStructure(String type, Workpiece workpiece, Log } if (Objects.nonNull(viewsToAdd) && !viewsToAdd.isEmpty()) { for (View viewToAdd : viewsToAdd) { - List logicalDivisions = viewToAdd.getMediaUnit().getLogicalDivisions(); + List logicalDivisions = viewToAdd.getPhysicalDivision().getLogicalDivisions(); for (LogicalDivision elementToUnassign : logicalDivisions) { elementToUnassign.getViews().remove(viewToAdd); } @@ -290,43 +291,43 @@ public static LogicalDivision addStructure(String type, Workpiece workpiece, Log } /** - * Create a new MediaUnit and insert it into the passed workpiece. The position of insertion + * Create a new PhysicalDivision and insert it into the passed workpiece. The position of insertion * is determined by the passed parent and position. - * @param type type of new MediaUnit - * @param workpiece workpiece from which the root media unit is retrieved - * @param parent parent of the new MediaUnit + * @param type type of new PhysicalDivision + * @param workpiece workpiece from which the root physical division is retrieved + * @param parent parent of the new PhysicalDivision * @param position position relative to the parent element */ - public static MediaUnit addMediaUnit(String type, Workpiece workpiece, MediaUnit parent, InsertionPosition position) { - LinkedList grandparents = getAncestorsOfMediaUnit(parent, workpiece.getMediaUnit()); - List siblings = new LinkedList<>(); + public static PhysicalDivision addPhysicalDivision(String type, Workpiece workpiece, PhysicalDivision parent, InsertionPosition position) { + LinkedList grandparents = getAncestorsOfPhysicalDivision(parent, workpiece.getPhysicalStructure()); + List siblings = new LinkedList<>(); if (grandparents.isEmpty()) { if (position.equals(InsertionPosition.AFTER_CURRENT_ELEMENT) || position.equals(InsertionPosition.BEFORE_CURRENT_ELEMENT)) { - Helper.setErrorMessage("No parent found for currently selected media unit to which new media unit can be appended!"); + Helper.setErrorMessage("No parent found for currently selected physical division to which new physical division can be appended!"); } } else { siblings = grandparents.getLast().getChildren(); } - MediaUnit newMediaUnit = new MediaUnit(); - newMediaUnit.setType(type); + PhysicalDivision newPhysicalDivision = new PhysicalDivision(); + newPhysicalDivision.setType(type); switch (position) { case AFTER_CURRENT_ELEMENT: - siblings.add(siblings.indexOf(parent) + 1, newMediaUnit); + siblings.add(siblings.indexOf(parent) + 1, newPhysicalDivision); break; case BEFORE_CURRENT_ELEMENT: - siblings.add(siblings.indexOf(parent), newMediaUnit); + siblings.add(siblings.indexOf(parent), newPhysicalDivision); break; case FIRST_CHILD_OF_CURRENT_ELEMENT: - parent.getChildren().add(0, newMediaUnit); + parent.getChildren().add(0, newPhysicalDivision); break; case LAST_CHILD_OF_CURRENT_ELEMENT: - parent.getChildren().add(newMediaUnit); + parent.getChildren().add(newPhysicalDivision); break; default: throw new IllegalStateException("Used InsertionPosition not allowed."); } - return newMediaUnit; + return newPhysicalDivision; } /** @@ -352,16 +353,16 @@ private static Collection getViewsFromChildrenRecursive(LogicalDivision st } /** - * Creates a view on a media unit that is not further restricted; that is, - * the entire media unit is displayed. + * Creates a view on a physical division that is not further restricted; that is, + * the entire physical division is displayed. * - * @param mediaUnit - * media unit on which a view is to be formed - * @return the created media unit + * @param physicalDivision + * physical division on which a view is to be formed + * @return the created physical division */ - public static View createUnrestrictedViewOn(MediaUnit mediaUnit) { + public static View createUnrestrictedViewOn(PhysicalDivision physicalDivision) { View unrestrictedView = new View(); - unrestrictedView.setMediaUnit(mediaUnit); + unrestrictedView.setPhysicalDivision(physicalDivision); return unrestrictedView; } @@ -441,7 +442,7 @@ public static MdSec domainToMdSec(Domain domain) { * node to be searched recursively * @return the parent nodes (maybe empty) */ - public static LinkedList getAncestorsOfStructure(LogicalDivision searched, + public static LinkedList getAncestorsOfLogicalDivision(LogicalDivision searched, LogicalDivision position) { return getAncestorsRecursive(searched, position, null) .stream() @@ -458,10 +459,10 @@ public static LinkedList getAncestorsOfStructure(LogicalDivisio * node to be searched recursively * @return the parent nodes (maybe empty) */ - public static LinkedList getAncestorsOfMediaUnit(MediaUnit searched, MediaUnit position) { + public static LinkedList getAncestorsOfPhysicalDivision(PhysicalDivision searched, PhysicalDivision position) { return getAncestorsRecursive(searched, position, null) .stream() - .map(parent -> (MediaUnit) parent) + .map(parent -> (PhysicalDivision) parent) .collect(Collectors.toCollection(LinkedList::new)); } @@ -508,15 +509,15 @@ public static String getMetadataValue(LogicalDivision logicalDivision, String ke } /** - * Get the first view the given MediaUnit is assigned to. - * @param mediaUnit MediaUnit to get the view for + * Get the first view the given PhysicalDivision is assigned to. + * @param physicalDivision PhysicalDivision to get the view for * @return View or null if no View was found */ - public static View getFirstViewForMediaUnit(MediaUnit mediaUnit) { - List logicalDivisions = mediaUnit.getLogicalDivisions(); + public static View getFirstViewForPhysicalDivision(PhysicalDivision physicalDivision) { + List logicalDivisions = physicalDivision.getLogicalDivisions(); if (!logicalDivisions.isEmpty() && Objects.nonNull(logicalDivisions.get(0))) { for (View view : logicalDivisions.get(0).getViews()) { - if (Objects.nonNull(view) && Objects.equals(view.getMediaUnit(), mediaUnit)) { + if (Objects.nonNull(view) && Objects.equals(view.getPhysicalDivision(), physicalDivision)) { return view; } } diff --git a/Kitodo/src/main/java/org/kitodo/production/process/NewspaperProcessesGenerator.java b/Kitodo/src/main/java/org/kitodo/production/process/NewspaperProcessesGenerator.java index f4d30762b58..1011a2e7fcb 100644 --- a/Kitodo/src/main/java/org/kitodo/production/process/NewspaperProcessesGenerator.java +++ b/Kitodo/src/main/java/org/kitodo/production/process/NewspaperProcessesGenerator.java @@ -411,7 +411,7 @@ private static TitleGenerator initializeTitleGenerator(ConfigProject configProje List children = logicalStructure.getChildren(); metadata.put("firstchild", children.isEmpty() ? Collections.emptyMap() : getMetadataEntries(children.get(0).getMetadata())); - metadata.put("physSequence", getMetadataEntries(workpiece.getMediaUnit().getMetadata())); + metadata.put("physSequence", getMetadataEntries(workpiece.getPhysicalStructure().getMetadata())); String docType = null; for (ConfigOpacDoctype configOpacDoctype : ConfigOpac.getAllDoctypes()) { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java index 848d1050472..b3ae18487da 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java @@ -18,7 +18,7 @@ import java.util.Map.Entry; import java.util.Objects; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; import org.kitodo.data.database.beans.Folder; import org.kitodo.data.database.beans.Process; @@ -53,17 +53,17 @@ public List loadData(int first, int pageSize, String sortField, SortOrde } /** - * Returns the canonical part of the file name for a given media unit. + * Returns the canonical part of the file name for a given physical division. * * @param process * the process - * @param mediaUnit + * @param physicalDivision * Media unit for which the canonical part of the file name * should be returned * @return the canonical part of the file name */ - public static String getCanonical(Process process, MediaUnit mediaUnit) { - for (Entry entry : mediaUnit.getMediaFiles().entrySet()) { + public static String getCanonical(Process process, PhysicalDivision physicalDivision) { + for (Entry entry : physicalDivision.getMediaFiles().entrySet()) { for (Folder folder : process.getProject().getFolders()) { if (Objects.equals(folder.getFileGroup(), entry.getKey().getUse())) { Subfolder subfolder = new Subfolder(process, folder); diff --git a/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java b/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java index ffd77d9fd2a..d82ec4fac13 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java @@ -238,8 +238,9 @@ public static StructuralElementViewInterface getStructuralElementView(DataEditor StructureTreeNode structureTreeNode = (StructureTreeNode) selectedLogicalNode.getData(); if (structureTreeNode.getDataObject() instanceof View) { View view = (View) structureTreeNode.getDataObject(); - if (Objects.nonNull(view.getMediaUnit())) { - return dataEditor.getRulesetManagement().getStructuralElementView(view.getMediaUnit().getType(), + if (Objects.nonNull(view.getPhysicalDivision())) { + return dataEditor.getRulesetManagement().getStructuralElementView( + view.getPhysicalDivision().getType(), dataEditor.getAcquisitionStage(), dataEditor.getPriorityList()); } } 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 4e7ca56f371..813a8bc4dbb 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 @@ -38,7 +38,7 @@ import org.apache.logging.log4j.Logger; import org.kitodo.api.command.CommandResult; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; import org.kitodo.api.dataformat.View; import org.kitodo.api.dataformat.Workpiece; @@ -1087,30 +1087,30 @@ public void searchForMedia(Process process, Workpiece workpiece) throws InvalidI } List canonicals = getCanonicalFileNamePartsAndSanitizeAbsoluteURIs(workpiece, subfolders, process.getProcessBaseUri()); - addNewURIsToExistingMediaUnits(mediaToAdd, workpiece.getAllMediaUnitChildrenFilteredByTypePageAndSorted(), canonicals); + addNewURIsToExistingPhysicalDivisions(mediaToAdd, workpiece.getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(), canonicals); mediaToAdd.keySet().removeAll(canonicals); addNewMediaToWorkpiece(canonicals, mediaToAdd, workpiece); - renumberMediaUnits(workpiece, true); + renumberPhysicalDivisions(workpiece, true); if (ConfigCore.getBooleanParameter(ParameterCore.WITH_AUTOMATIC_PAGINATION)) { - repaginateMediaUnits(workpiece); + repaginatePhysicalDivisions(workpiece); } if (Workpiece.treeStream(workpiece.getLogicalStructure()) .allMatch(logicalDivision -> logicalDivision.getViews().isEmpty())) { - automaticallyAssignMediaUnitsToEffectiveRootRecursive(workpiece, workpiece.getLogicalStructure()); + automaticallyAssignPhysicalDivisionsToEffectiveRootRecursive(workpiece, workpiece.getLogicalStructure()); } if (logger.isTraceEnabled()) { logger.trace("Searching for media took {} ms", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - begin)); } } - private void automaticallyAssignMediaUnitsToEffectiveRootRecursive(Workpiece workpiece, + private void automaticallyAssignPhysicalDivisionsToEffectiveRootRecursive(Workpiece workpiece, LogicalDivision logicalDivision) { if (Objects.nonNull(logicalDivision.getType())) { - Workpiece.treeStream(workpiece.getMediaUnit()).filter(mediaUnit -> !mediaUnit.getMediaFiles().isEmpty()) + Workpiece.treeStream(workpiece.getPhysicalStructure()).filter(physicalDivision -> !physicalDivision.getMediaFiles().isEmpty()) .map(View::of).forEachOrdered(logicalDivision.getViews()::add); } else if (logicalDivision.getChildren().size() == 1) { - automaticallyAssignMediaUnitsToEffectiveRootRecursive(workpiece, + automaticallyAssignPhysicalDivisionsToEffectiveRootRecursive(workpiece, logicalDivision.getChildren().get(0)); } } @@ -1128,9 +1128,9 @@ private List getCanonicalFileNamePartsAndSanitizeAbsoluteURIs(Workpiece if (!baseUriString.endsWith("/")) { baseUriString = baseUriString.concat("/"); } - for (MediaUnit mediaUnit : workpiece.getAllMediaUnitChildrenFilteredByTypePageAndSorted()) { + for (PhysicalDivision physicalDivision : workpiece.getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted()) { String unitCanonical = ""; - for (Entry entry : mediaUnit.getMediaFiles().entrySet()) { + for (Entry entry : physicalDivision.getMediaFiles().entrySet()) { Subfolder subfolder = subfolders.get(entry.getKey().getUse()); if (Objects.isNull(subfolder)) { logger.warn("Missing subfolder for USE {}", entry.getKey().getUse()); @@ -1140,18 +1140,18 @@ private List getCanonicalFileNamePartsAndSanitizeAbsoluteURIs(Workpiece String fileUriString = mediaFile.toString(); if (fileUriString.startsWith(baseUriString)) { mediaFile = URI.create(fileUriString.substring(baseUriString.length())); - mediaUnit.getMediaFiles().put(entry.getKey(), mediaFile); + physicalDivision.getMediaFiles().put(entry.getKey(), mediaFile); } String fileCanonical = subfolder.getCanonical(mediaFile); if ("".equals(unitCanonical)) { unitCanonical = fileCanonical; } else if (!unitCanonical.equals(fileCanonical)) { - throw new InvalidImagesException("Ambiguous canonical file name part in the same media unit: \"" + throw new InvalidImagesException("Ambiguous canonical file name part in the same physical division: \"" + unitCanonical + "\" and \"" + fileCanonical + "\"!"); } } - if (mediaUnit.getMediaFiles().size() > 0 && "".equals(unitCanonical)) { - throw new InvalidImagesException("Missing canonical file name part in media unit " + mediaUnit); + if (physicalDivision.getMediaFiles().size() > 0 && "".equals(unitCanonical)) { + throw new InvalidImagesException("Missing canonical file name part in physical division " + physicalDivision); } canonicals.add(unitCanonical); } @@ -1159,17 +1159,17 @@ private List getCanonicalFileNamePartsAndSanitizeAbsoluteURIs(Workpiece } /** - * Adds new media variants found to existing media units. + * Adds new media variants found to existing physical divisions. */ - private void addNewURIsToExistingMediaUnits(Map> mediaToAdd, List mediaUnits, + private void addNewURIsToExistingPhysicalDivisions(Map> mediaToAdd, List physicalDivisions, List canonicals) { for (int i = 0; i < canonicals.size(); i++) { String canonical = canonicals.get(i); - MediaUnit mediaUnit = mediaUnits.get(i); + PhysicalDivision physicalDivision = physicalDivisions.get(i); if (mediaToAdd.containsKey(canonical)) { for (Entry entry : mediaToAdd.get(canonical).entrySet()) { - mediaUnit.getMediaFiles().put(createMediaVariant(entry.getKey().getFolder()), entry.getValue()); + physicalDivision.getMediaFiles().put(createMediaVariant(entry.getKey().getFolder()), entry.getValue()); } } } @@ -1191,30 +1191,30 @@ private void addNewMediaToWorkpiece(List canonicals, Map data) { - MediaUnit mediaUnit = new MediaUnit(); + private PhysicalDivision createPhysicalDivision(Map data) { + PhysicalDivision physicalDivision = new PhysicalDivision(); if (!data.entrySet().isEmpty()) { - mediaUnit.setType(MediaUnit.TYPE_PAGE); + physicalDivision.setType(PhysicalDivision.TYPE_PAGE); } for (Entry entry : data.entrySet()) { Folder folder = entry.getKey().getFolder(); MediaVariant mediaVariant = createMediaVariant(folder); - mediaUnit.getMediaFiles().put(mediaVariant, entry.getValue()); + physicalDivision.getMediaFiles().put(mediaVariant, entry.getValue()); } - return mediaUnit; + return physicalDivision; } /** @@ -1228,13 +1228,13 @@ private MediaVariant createMediaVariant(Folder folder) { } /** - * Renumbers the order of the media units. + * Renumbers the order of the physical divisions. */ - public void renumberMediaUnits(Workpiece workpiece, boolean sortByOrder) { + public void renumberPhysicalDivisions(Workpiece workpiece, boolean sortByOrder) { int order = 1; - for (MediaUnit mediaUnit : sortByOrder ? workpiece.getAllMediaUnitChildrenFilteredByTypePageAndSorted() - : workpiece.getMediaUnit().getAllChildren()) { - mediaUnit.setOrder(order++); + for (PhysicalDivision physicalDivision : sortByOrder ? workpiece.getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted() + : workpiece.getPhysicalStructure().getAllChildren()) { + physicalDivision.setOrder(order++); } } @@ -1243,8 +1243,8 @@ public void renumberMediaUnits(Workpiece workpiece, boolean sortByOrder) { * or if none of the media has been counted yet at all. New media found in * intermediate places are marked uncounted. */ - private void repaginateMediaUnits(Workpiece workpiece) { - List mediaUnits = workpiece.getAllMediaUnitChildrenFilteredByTypePageAndSorted(); + private void repaginatePhysicalDivisions(Workpiece workpiece) { + List physicalDivisions = workpiece.getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(); int first = 0; String value; switch (ConfigCore.getParameter(ParameterCore.METS_EDITOR_DEFAULT_PAGINATION)) { @@ -1258,26 +1258,26 @@ private void repaginateMediaUnits(Workpiece workpiece) { value = " - "; break; } - for (int i = mediaUnits.size() - 1; i >= 0; i--) { - MediaUnit mediaUnit = mediaUnits.get(i); - String orderlabel = mediaUnit.getOrderlabel(); - if (Objects.nonNull(orderlabel) && !mediaUnit.getMediaFiles().isEmpty()) { + for (int i = physicalDivisions.size() - 1; i >= 0; i--) { + PhysicalDivision physicalDivision = physicalDivisions.get(i); + String orderlabel = physicalDivision.getOrderlabel(); + if (Objects.nonNull(orderlabel) && !physicalDivision.getMediaFiles().isEmpty()) { first = i + 1; value = orderlabel; - mediaUnits.get(i).setType(MediaUnit.TYPE_PAGE); + physicalDivisions.get(i).setType(PhysicalDivision.TYPE_PAGE); break; } } Paginator paginator = new Paginator(value); if (first > 0) { paginator.next(); - for (int i = first; i < mediaUnits.size(); i++) { - mediaUnits.get(i).setOrderlabel(paginator.next()); + for (int i = first; i < physicalDivisions.size(); i++) { + physicalDivisions.get(i).setOrderlabel(paginator.next()); } } - for (MediaUnit mediaUnit : mediaUnits) { - if (Objects.isNull(mediaUnit.getOrderlabel())) { - mediaUnit.setOrderlabel(" - "); + for (PhysicalDivision physicalDivision : physicalDivisions) { + if (Objects.isNull(physicalDivision.getOrderlabel())) { + physicalDivision.setOrderlabel(" - "); } } } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/schema/SchemaService.java b/Kitodo/src/main/java/org/kitodo/production/services/schema/SchemaService.java index f49447a8326..ff2021d9652 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/schema/SchemaService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/schema/SchemaService.java @@ -25,7 +25,7 @@ import org.kitodo.api.MetadataEntry; import org.kitodo.api.dataeditor.rulesetmanagement.RulesetManagementInterface; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; import org.kitodo.api.dataformat.Workpiece; import org.kitodo.api.dataformat.mets.LinkedMetsResource; @@ -76,7 +76,7 @@ public void tempConvert(Workpiece workpiece, LegacyPrefsHelper prefs, // group paths! VariableReplacer vp = new VariableReplacer(workpiece, process, null); - addVirtualFileGroupsToMetsMods(workpiece.getMediaUnit(), process); + addVirtualFileGroupsToMetsMods(workpiece.getPhysicalStructure(), process); replaceFLocatForExport(workpiece, process, prefs.getRuleset()); // Replace rights and digiprov entries. @@ -127,13 +127,13 @@ private void set(Workpiece workpiece, MdSec domain, String key, String value) { } } - private void addVirtualFileGroupsToMetsMods(MediaUnit mediaUnit, Process process) { - String canonical = ServiceManager.getFolderService().getCanonical(process, mediaUnit); + private void addVirtualFileGroupsToMetsMods(PhysicalDivision physicalDivision, Process process) { + String canonical = ServiceManager.getFolderService().getCanonical(process, physicalDivision); if (Objects.nonNull(canonical)) { - removeFLocatsForUnwantedUses(process, mediaUnit, canonical); - addMissingUses(process, mediaUnit, canonical); + removeFLocatsForUnwantedUses(process, physicalDivision, canonical); + addMissingUses(process, physicalDivision, canonical); } - for (MediaUnit child : mediaUnit.getChildren()) { + for (PhysicalDivision child : physicalDivision.getChildren()) { addVirtualFileGroupsToMetsMods(child, process); } } @@ -142,8 +142,8 @@ private void replaceFLocatForExport(Workpiece workpiece, Process process, Rulese throws URISyntaxException { List folders = process.getProject().getFolders(); VariableReplacer variableReplacer = new VariableReplacer(workpiece, process, null); - for (MediaUnit mediaUnit : workpiece.getAllMediaUnits()) { - for (Entry mediaFileForMediaVariant : mediaUnit.getMediaFiles().entrySet()) { + for (PhysicalDivision physicalDivision : workpiece.getAllPhysicalDivisions()) { + for (Entry mediaFileForMediaVariant : physicalDivision.getMediaFiles().entrySet()) { for (Folder folder : folders) { if (folder.getFileGroup().equals(mediaFileForMediaVariant.getKey().getUse())) { int lastSeparator = mediaFileForMediaVariant.getValue().toString().lastIndexOf('/'); @@ -158,14 +158,14 @@ private void replaceFLocatForExport(Workpiece workpiece, Process process, Rulese } /** - * If the media unit contains a media variant that is unknown, has linking + * If the physical division contains a media variant that is unknown, has linking * mode NO or has linking mode EXISTING but the file does not exist, remove * it. */ private void removeFLocatsForUnwantedUses(Process process, - MediaUnit mediaUnit, + PhysicalDivision physicalDivision, String canonical) { - for (Iterator> mediaFilesForMediaVariants = mediaUnit.getMediaFiles().entrySet() + for (Iterator> mediaFilesForMediaVariants = physicalDivision.getMediaFiles().entrySet() .iterator(); mediaFilesForMediaVariants.hasNext();) { Entry mediaFileForMediaVariant = mediaFilesForMediaVariants.next(); String use = mediaFileForMediaVariant.getKey().getUse(); @@ -182,37 +182,37 @@ && new Subfolder(process, optionalFolderForUse.get()).getURIIfExists(canonical) } /** - * If the media unit is missing a variant that has linking mode ALL or has + * If the physical division is missing a variant that has linking mode ALL or has * linking mode EXISTING and the file does exist, add it. */ - private void addMissingUses(Process process, MediaUnit mediaUnit, + private void addMissingUses(Process process, PhysicalDivision physicalDivision, String canonical) { for (Folder folder : process.getProject().getFolders()) { Subfolder useFolder = new Subfolder(process, folder); - if (mediaUnit.getMediaFiles().entrySet().parallelStream().map(Entry::getKey).map(MediaVariant::getUse) + if (physicalDivision.getMediaFiles().entrySet().parallelStream().map(Entry::getKey).map(MediaVariant::getUse) .noneMatch(use -> use.equals(folder.getFileGroup())) && (folder.getLinkingMode().equals(LinkingMode.ALL) || (folder.getLinkingMode().equals(LinkingMode.EXISTING) && useFolder.getURIIfExists(canonical).isPresent()))) { - addUse(useFolder, canonical, mediaUnit); + addUse(useFolder, canonical, physicalDivision); } } } /** - * Adds a use to a media unit. + * Adds a use to a physical division. * * @param subfolder * subfolder for the use * @param canonical * the canonical part of the file name of the media file - * @param mediaUnit - * media unit to add to + * @param physicalDivision + * physical division to add to */ - private void addUse(Subfolder subfolder, String canonical, MediaUnit mediaUnit) { + private void addUse(Subfolder subfolder, String canonical, PhysicalDivision physicalDivision) { MediaVariant mediaVariant = new MediaVariant(); mediaVariant.setUse(subfolder.getFolder().getFileGroup()); mediaVariant.setMimeType(subfolder.getFolder().getMimeType()); URI mediaFile = subfolder.getRelativeFilePath(canonical); - mediaUnit.getMediaFiles().put(mediaVariant, mediaFile); + physicalDivision.getMediaFiles().put(mediaVariant, mediaFile); } /** diff --git a/Kitodo/src/main/resources/messages/errors_en.properties b/Kitodo/src/main/resources/messages/errors_en.properties index 01a693bc9c3..c536c761dfa 100644 --- a/Kitodo/src/main/resources/messages/errors_en.properties +++ b/Kitodo/src/main/resources/messages/errors_en.properties @@ -99,7 +99,7 @@ metadataFileNotFound=Metadata file not found \: {0} metadataInvalidData=The input "{0}" in field {1} is invalid. metadataMandatoryElement=Missing input for {0}. metadataMediaError=A structure has media assigned which aren't declared. -metadataMediaUnassigned=The media unit is not assigned to a structure\: +metadataMediaUnassigned=The physical division is not assigned to a structure\: metadataMissingIdentifier=Missing value for the identifier. errorMigrationDraft=Status needs to be 'Active' for migration. errorMultipleConfigurations=There are different configurations for separate structure in this workflow. diff --git a/Kitodo/src/main/resources/messages/messages_de.properties b/Kitodo/src/main/resources/messages/messages_de.properties index 7ff3d555aa2..e412745b413 100644 --- a/Kitodo/src/main/resources/messages/messages_de.properties +++ b/Kitodo/src/main/resources/messages/messages_de.properties @@ -23,7 +23,7 @@ ACTIVE=Aktiv activeUsers=Aktive Benutzer addElement=Element hinzuf\u00fcgen addLogicalDivision=Logisches Strukturelement hinzuf\u00fcgen -addMediaUnit=Physisches Strukturelement hinzuf\u00fcgen +addPhysicalDivision=Physisches Strukturelement hinzuf\u00fcgen addMessage=Nachricht hinzuf\u00FCgens addMessageForAll=Nachricht zu allen Prozessen hinzuf\u00FCgen addNewMetadataGroup=Neue Metadatengruppe hinzuf\u00FCgen @@ -828,7 +828,7 @@ removeFilter=Filter entfernen removeFromAssociatedBatch=Selektierte Vorg\u00E4nge von ihren zugewiesenen Batches entfernen removeFromBatch=Die Zuordnungs des Vorgangs zu Batch {0} wurde aufgehoben. removeLogicalDivision=Logisches Strukturelement entfernen -removeMediaUnit=Physisches Strukturelement entfernen +removePhysicalDivision=Physisches Strukturelement entfernen removeUser=Benutzer entfernen removeRole=Rolle entfernen renameBatch=Batch umbenennen diff --git a/Kitodo/src/main/resources/messages/messages_en.properties b/Kitodo/src/main/resources/messages/messages_en.properties index 0e3ec10e558..152ff956cab 100644 --- a/Kitodo/src/main/resources/messages/messages_en.properties +++ b/Kitodo/src/main/resources/messages/messages_en.properties @@ -25,7 +25,7 @@ addElement=Add element addLogicalDivision=Add logical structure element addLdapGroup=Add LDAP group addLdapServer=Add LDAP server -addMediaUnit=Add physical structure element +addPhysicalDivision=Add physical structure element addMessage=Add message addMessageForAll=Add message for all processes addNewMetadataGroup=Add new metadata group @@ -842,7 +842,7 @@ removeFilter=Remove filter from list removeFromAssociatedBatch=remove selected processes from assigned batches removeFromBatch=Removed process from batch {0}. removeLogicalDivision=Remove logical structure element -removeMediaUnit=Remove physical structure element +removePhysicalDivision=Remove physical structure element removeUser=Remove user removeRole=Remove role renameBatch=Rename batch diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addDocStrucType.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addDocStrucType.xhtml index 769117568a8..cd6f03b508b 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addDocStrucType.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addDocStrucType.xhtml @@ -142,23 +142,23 @@ - - + + + value="#{firstPhysicalDivision.order} : #{firstPhysicalDivision.orderlabel}"/> + value="#{lastPhysicalDivision.order} : #{lastPhysicalDivision.orderlabel}"/> diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addMediaUnit.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addMediaUnit.xhtml index ce3fc880fab..7136b86ebc5 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addMediaUnit.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addMediaUnit.xhtml @@ -18,8 +18,8 @@ xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:p="http://primefaces.org/ui"> - - + -

#{msgs.addMediaUnit}

+

#{msgs.addPhysicalDivision}

- - + value="#{DataEditorForm.addPhysicalDivisionDialog.selectedPosition}"> + +
- + value="#{DataEditorForm.addPhysicalDivisionDialog.selectedType}"> +
- + oncomplete="PF('dialogAddPhysicalDivision').hide();"/> + onclick="PF('dialogAddPhysicalDivision').hide();"/> diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/physicalStructure.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/physicalStructure.xhtml index dbf3d85dbb4..3286be82670 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/physicalStructure.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/physicalStructure.xhtml @@ -71,9 +71,9 @@ styleClass="plain" disabled="#{readOnly}" process="@this" - actionListener="#{DataEditorForm.addMediaUnitDialog.prepare}" - oncomplete="PF('dialogAddMediaUnit').show()" - update="dialogAddMediaUnitForm"/> + actionListener="#{DataEditorForm.addPhysicalDivisionDialog.prepare}" + oncomplete="PF('dialogAddPhysicalDivision').show()" + update="dialogAddPhysicalDivisionForm"/> - + diff --git a/Kitodo/src/test/java/org/kitodo/production/services/dataformat/MetsServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/dataformat/MetsServiceIT.java index 7dc58fbea42..60a01d46213 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/dataformat/MetsServiceIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/dataformat/MetsServiceIT.java @@ -19,7 +19,7 @@ import java.util.stream.Collectors; import org.junit.Test; -import org.kitodo.api.dataformat.MediaUnit; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.Workpiece; import org.kitodo.production.services.ServiceManager; @@ -34,7 +34,7 @@ public void testReadXML() throws Exception { .loadWorkpiece(new File("../Kitodo-DataFormat/src/test/resources/meta.xml").toURI()); // METS file has 183 associated images - assertEquals(183, workpiece.getMediaUnit().getChildren().size()); + assertEquals(183, workpiece.getPhysicalStructure().getChildren().size()); // METS file has 17 unstructured images assertEquals(17, workpiece.getLogicalStructure().getViews().size()); @@ -47,7 +47,7 @@ public void testReadXML() throws Exception { // file URIs can be read assertEquals(new URI("images/ThomPhar_644901748_media/00000001.tif"), - workpiece.getMediaUnit().getChildren().get(0).getMediaFiles().entrySet().iterator().next().getValue()); + workpiece.getPhysicalStructure().getChildren().get(0).getMediaFiles().entrySet().iterator().next().getValue()); // pagination can be read assertEquals( @@ -66,6 +66,6 @@ public void testReadXML() throws Exception { "uncounted", "uncounted", "113", "114", "115", "116", "117", "118", "uncounted", "uncounted", "119", "120", "uncounted", "uncounted", "121", "122", "123", "124", "125", "126", "127", "128", "129", "130", "131", "132", "133", "134", "uncounted", "uncounted", "uncounted"), - workpiece.getMediaUnit().getChildren().stream().map(MediaUnit::getOrderlabel).collect(Collectors.toList())); + workpiece.getPhysicalStructure().getChildren().stream().map(PhysicalDivision::getOrderlabel).collect(Collectors.toList())); } } From a2db6ed3a23073db788dd67f4d27bd07bf7898a6 Mon Sep 17 00:00:00 2001 From: Matthias Ronge Date: Fri, 25 Jun 2021 12:17:08 +0200 Subject: [PATCH 2/8] Fix checkstyle --- .../main/java/org/kitodo/api/dataformat/Workpiece.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Workpiece.java b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Workpiece.java index 602c2e10e9d..20134c25146 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Workpiece.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataformat/Workpiece.java @@ -122,15 +122,15 @@ public LogicalDivision getLogicalStructure() { * @param physicalStructure * physical structure to set */ - public void setPhysicalStructure(PhysicalDivision physicalDivision) { - this.physicalStructure = physicalDivision; + public void setPhysicalStructure(PhysicalDivision physicalStructure) { + this.physicalStructure = physicalStructure; } /** - * Sets the logical division of the workpiece. + * Sets the logical structure of the workpiece. * * @param logicalStructure - * logical division to set + * logical structure to set */ public void setLogicalStructure(LogicalDivision logicalStructure) { this.logicalStructure = logicalStructure; From 0c280e71c3e586b64cef5574d9da4803413aadde Mon Sep 17 00:00:00 2001 From: Matthias Ronge Date: Fri, 25 Jun 2021 12:51:50 +0200 Subject: [PATCH 3/8] Fix checkstyle --- .../java/org/kitodo/dataformat/access/FileXmlElementAccess.java | 2 +- .../java/org/kitodo/dataformat/access/MetsXmlElementAccess.java | 2 +- ...rerStorage.java => PhysicalDivisionMetsReferrerStorage.java} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/{MediaUnitMetsReferrerStorage.java => PhysicalDivisionMetsReferrerStorage.java} (100%) diff --git a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/FileXmlElementAccess.java b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/FileXmlElementAccess.java index 13faec936fe..98e1b58083f 100644 --- a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/FileXmlElementAccess.java +++ b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/FileXmlElementAccess.java @@ -21,8 +21,8 @@ import java.util.Optional; import org.kitodo.api.MdSec; -import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.mets.KitodoUUID; import org.kitodo.dataformat.metskitodo.AmdSecType; import org.kitodo.dataformat.metskitodo.DivType; diff --git a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MetsXmlElementAccess.java b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MetsXmlElementAccess.java index 1e2bfe7bbb2..61ad69da545 100644 --- a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MetsXmlElementAccess.java +++ b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MetsXmlElementAccess.java @@ -37,8 +37,8 @@ import javax.xml.datatype.XMLGregorianCalendar; import org.apache.commons.lang3.tuple.Pair; -import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.ProcessingNote; import org.kitodo.api.dataformat.Workpiece; import org.kitodo.api.dataformat.mets.MetsXmlElementAccessInterface; diff --git a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MediaUnitMetsReferrerStorage.java b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/PhysicalDivisionMetsReferrerStorage.java similarity index 100% rename from Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/MediaUnitMetsReferrerStorage.java rename to Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/PhysicalDivisionMetsReferrerStorage.java From acbd0c3e308f8c1a545fde4711dd877b3bd8c674 Mon Sep 17 00:00:00 2001 From: Matthias Ronge Date: Fri, 25 Jun 2021 15:14:28 +0200 Subject: [PATCH 4/8] Fix Codacy errors --- .../forms/dataeditor/GalleryPanel.java | 61 ++++++++++++------- .../forms/dataeditor/StructurePanel.java | 14 +++-- .../production/metadata/MetadataEditor.java | 6 +- .../production/services/file/FileService.java | 9 +-- 4 files changed, 56 insertions(+), 34 deletions(-) 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 324e85094e8..4023d35c962 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 @@ -37,8 +37,8 @@ import org.apache.logging.log4j.Logger; import org.kitodo.api.dataeditor.rulesetmanagement.RulesetManagementInterface; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; import org.kitodo.data.database.beans.Folder; import org.kitodo.data.database.beans.Process; @@ -528,15 +528,20 @@ public GalleryMediaContent getGalleryMediaContent(PhysicalDivision physicalDivis } /** - * Get a List of all PhysicalDivisions and the LogicalDivisions they are assigned to - * which are displayed between two selected PhysicalDivisions. This method selects the Stripes that are affected by the selection and delegates - * the selection of the contained PhysicalDivisions. + * Get a List of all PhysicalDivisions and the LogicalDivisions they are + * assigned to which are displayed between two selected PhysicalDivisions. + * This method selects the Stripes that are affected by the selection and + * delegates the selection of the contained PhysicalDivisions. + * * @param first - * First selected PhysicalDivision. A Pair of the PhysicalDivision and the LogicalDivision to which the PhysicalDivision is assigned. + * First selected PhysicalDivision. A Pair of the + * PhysicalDivision and the LogicalDivision to which the + * PhysicalDivision is assigned. * @param last - * Last selected PhysicalDivision. A Pair of the PhysicalDivision and the Logical Division to which the PhysicalDivision is assigned. - * @return - * A List of all selected PhysicalDivisions + * Last selected PhysicalDivision. A Pair of the PhysicalDivision + * and the Logical Division to which the PhysicalDivision is + * assigned. + * @return A List of all selected PhysicalDivisions */ private List> getMediaWithinRange(Pair first, Pair last) { @@ -582,18 +587,23 @@ This stripe is displayed last, but is actually the logical structure (first stri } /** - * Get a List of all PhysicalDivisions and the LogicalDivisions they are assigned to - * which are displayed between two selected PhysicalDivisions. This method selected the PhysicalDivisions between and including the two indices. + * Get a List of all PhysicalDivisions and the LogicalDivisions they are + * assigned to which are displayed between two selected PhysicalDivisions. + * This method selected the PhysicalDivisions between and including the two + * indices. + * * @param firstIndices - * First selected PhysicalDivision. - * A Pair of indices of the PhysicalDivision and the LogicalDivision to which the PhysicalDivision is assigned. + * First selected PhysicalDivision. A Pair of indices of the + * PhysicalDivision and the LogicalDivision to which the + * PhysicalDivision is assigned. * @param lastIndices - * Last selected PhysicalDivision. - * A Pair of indices of the PhysicalDivision and the Logical Division to which the PhysicalDivision is assigned. + * Last selected PhysicalDivision. A Pair of indices of the + * PhysicalDivision and the Logical Division to which the + * PhysicalDivision is assigned. * @param galleryStripes - * A List of GalleryStripes which contain the two selected PhysicalDivisions and all in between - * @return - * A List of all selected PhysicalDivisions + * A List of GalleryStripes which contain the two selected + * PhysicalDivisions and all in between + * @return A List of all selected PhysicalDivisions */ private List> getMediaWithinRangeFromSelectedStripes( Pair firstIndices, Pair lastIndices, List galleryStripes) { @@ -720,7 +730,8 @@ public boolean isSelected(GalleryMediaContent galleryMediaContent, GalleryStripe private void selectMedia(String physicalDivisionOrder, String stripeIndex, String selectionType) { PhysicalDivision selectedPhysicalDivision = null; - for (PhysicalDivision physicalDivision : this.dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted()) { + for (PhysicalDivision physicalDivision : this.dataEditor.getWorkpiece() + .getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted()) { if (Objects.equals(physicalDivision.getOrder(), Integer.parseInt(physicalDivisionOrder))) { selectedPhysicalDivision = physicalDivision; break; @@ -832,7 +843,8 @@ private void defaultSelect(GalleryMediaContent currentSelection, GalleryStripe p } dataEditor.getSelectedMedia().clear(); - dataEditor.getSelectedMedia().add(new ImmutablePair<>(currentSelection.getView().getPhysicalDivision(), parentStripe.getStructure())); + dataEditor.getSelectedMedia().add( + new ImmutablePair<>(currentSelection.getView().getPhysicalDivision(), parentStripe.getStructure())); } private void rangeSelect(GalleryMediaContent currentSelection, GalleryStripe parentStripe) { @@ -867,11 +879,14 @@ private void multiSelect(GalleryMediaContent currentSelection, GalleryStripe par } /** - * Get the index of this GalleryMediaContent's PhysicalDivision out of all PhysicalDivisions - * which are assigned to more than one LogicalDivision. + * Get the index of this GalleryMediaContent's PhysicalDivision out of all + * PhysicalDivisions which are assigned to more than one LogicalDivision. * - * @param galleryMediaContent object to find the index for - * @return index of the GalleryMediaContent's PhysicalDivision if present in the List of several assignments, or -1 if not present in the list. + * @param galleryMediaContent + * object to find the index for + * @return index of the GalleryMediaContent's PhysicalDivision if present in + * the List of several assignments, or -1 if not present in the + * list. */ public int getSeveralAssignmentsIndex(GalleryMediaContent galleryMediaContent) { if (Objects.nonNull(galleryMediaContent.getView()) && Objects.nonNull(galleryMediaContent.getView().getPhysicalDivision())) { 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 921fc4bdf31..ad884df04e8 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 @@ -874,7 +874,8 @@ private TreeNode updatePhysSelectionInLogTreeRecursive(PhysicalDivision selected && ((StructureTreeNode) treeNode.getData()).getDataObject().equals(parentElement) && currentTreeNode.getData() instanceof StructureTreeNode && ((StructureTreeNode) currentTreeNode.getData()).getDataObject() instanceof View - && ((View) ((StructureTreeNode) currentTreeNode.getData()).getDataObject()).getPhysicalDivision().equals(selectedPhysicalDivision)) { + && ((View) ((StructureTreeNode) currentTreeNode.getData()).getDataObject()).getPhysicalDivision() + .equals(selectedPhysicalDivision)) { currentTreeNode.setSelected(true); matchingTreeNode = currentTreeNode; } else { @@ -1472,11 +1473,14 @@ public void setActiveTabs(String activeTabs) { } /** - * Get the index of this StructureTreeNode's PhysicalDivision out of all PhysicalDivisions - * which are assigned to more than one LogicalDivision. + * Get the index of this StructureTreeNode's PhysicalDivision out of all + * PhysicalDivisions which are assigned to more than one LogicalDivision. * - * @param treeNode object to find the index for - * @return index of the StructureTreeNode's PhysicalDivision if present in the List of several assignments, or -1 if not present in the list. + * @param treeNode + * object to find the index for + * @return index of the StructureTreeNode's PhysicalDivision if present in + * the List of several assignments, or -1 if not present in the + * list. */ public int getMultipleAssignmentsIndex(StructureTreeNode treeNode) { if (treeNode.getDataObject() instanceof View diff --git a/Kitodo/src/main/java/org/kitodo/production/metadata/MetadataEditor.java b/Kitodo/src/main/java/org/kitodo/production/metadata/MetadataEditor.java index 2903dbd91af..be948ec63b8 100644 --- a/Kitodo/src/main/java/org/kitodo/production/metadata/MetadataEditor.java +++ b/Kitodo/src/main/java/org/kitodo/production/metadata/MetadataEditor.java @@ -298,13 +298,15 @@ public static LogicalDivision addLogicalDivision(String type, Workpiece workpiec * @param parent parent of the new PhysicalDivision * @param position position relative to the parent element */ - public static PhysicalDivision addPhysicalDivision(String type, Workpiece workpiece, PhysicalDivision parent, InsertionPosition position) { + public static PhysicalDivision addPhysicalDivision(String type, Workpiece workpiece, PhysicalDivision parent, + InsertionPosition position) { LinkedList grandparents = getAncestorsOfPhysicalDivision(parent, workpiece.getPhysicalStructure()); List siblings = new LinkedList<>(); if (grandparents.isEmpty()) { if (position.equals(InsertionPosition.AFTER_CURRENT_ELEMENT) || position.equals(InsertionPosition.BEFORE_CURRENT_ELEMENT)) { - Helper.setErrorMessage("No parent found for currently selected physical division to which new physical division can be appended!"); + Helper.setErrorMessage("No parent found for currently selected physical " + + "division to which new physical division can be appended!"); } } else { siblings = grandparents.getLast().getChildren(); 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 813a8bc4dbb..47f803d6283 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 @@ -38,8 +38,8 @@ import org.apache.logging.log4j.Logger; import org.kitodo.api.command.CommandResult; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.View; import org.kitodo.api.dataformat.Workpiece; import org.kitodo.api.filemanagement.FileManagementInterface; @@ -1087,7 +1087,8 @@ public void searchForMedia(Process process, Workpiece workpiece) throws InvalidI } List canonicals = getCanonicalFileNamePartsAndSanitizeAbsoluteURIs(workpiece, subfolders, process.getProcessBaseUri()); - addNewURIsToExistingPhysicalDivisions(mediaToAdd, workpiece.getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(), canonicals); + addNewURIsToExistingPhysicalDivisions(mediaToAdd, + workpiece.getAllPhysicalDivisionChildrenFilteredByTypePageAndSorted(), canonicals); mediaToAdd.keySet().removeAll(canonicals); addNewMediaToWorkpiece(canonicals, mediaToAdd, workpiece); renumberPhysicalDivisions(workpiece, true); @@ -1161,8 +1162,8 @@ private List getCanonicalFileNamePartsAndSanitizeAbsoluteURIs(Workpiece /** * Adds new media variants found to existing physical divisions. */ - private void addNewURIsToExistingPhysicalDivisions(Map> mediaToAdd, List physicalDivisions, - List canonicals) { + private void addNewURIsToExistingPhysicalDivisions(Map> mediaToAdd, + List physicalDivisions, List canonicals) { for (int i = 0; i < canonicals.size(); i++) { String canonical = canonicals.get(i); From a061136ad6ee2b836a9e782650e2558e7535b05b Mon Sep 17 00:00:00 2001 From: Matthias Ronge Date: Fri, 25 Jun 2021 15:30:41 +0200 Subject: [PATCH 5/8] Fix Codacy --- .../access/PhysicalDivisionMetsReferrerStorage.java | 6 +++--- .../kitodo/production/forms/dataeditor/GalleryPanel.java | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/PhysicalDivisionMetsReferrerStorage.java b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/PhysicalDivisionMetsReferrerStorage.java index 29febd3c693..a2f18921a2d 100644 --- a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/PhysicalDivisionMetsReferrerStorage.java +++ b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/PhysicalDivisionMetsReferrerStorage.java @@ -18,7 +18,7 @@ import org.kitodo.api.dataformat.PhysicalDivision; /** - * A memory brick to preserve the METS IDs of the physical division div and the media + * A memory brick to preserve the METS IDs of the physical div and the media * files. */ class PhysicalDivisionMetsReferrerStorage extends PhysicalDivision { @@ -30,7 +30,7 @@ class PhysicalDivisionMetsReferrerStorage extends PhysicalDivision { /** * Passthrough function for reading the file identifier to the URI. - * + * * @param fLocatXmlElementAccess * Access object on f locat * @return Access object on f locat @@ -42,7 +42,7 @@ FLocatXmlElementAccess storeFileId(FLocatXmlElementAccess fLocatXmlElementAccess /** * Returns the ID of file. - * + * * @param key * URI whose ID to return * @return the ID of file 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 4023d35c962..b20e54e45c5 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 @@ -853,7 +853,8 @@ private void rangeSelect(GalleryMediaContent currentSelection, GalleryStripe par } if (dataEditor.getSelectedMedia().isEmpty()) { - dataEditor.getSelectedMedia().add(new ImmutablePair<>(currentSelection.getView().getPhysicalDivision(), parentStripe.getStructure())); + dataEditor.getSelectedMedia().add( + new ImmutablePair<>(currentSelection.getView().getPhysicalDivision(), parentStripe.getStructure())); return; } From 9e735a4d7008a6f931687155fcf78793c4904c8e Mon Sep 17 00:00:00 2001 From: Matthias Ronge Date: Fri, 25 Jun 2021 15:31:31 +0200 Subject: [PATCH 6/8] Fix Checkstyle --- .../LegacyInnerPhysicalDocStructHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructHelper.java b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructHelper.java index 14f6afd4aea..5a6dce1eadd 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructHelper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/metadata/legacytypeimplementations/LegacyInnerPhysicalDocStructHelper.java @@ -19,8 +19,8 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.production.services.ServiceManager; import org.kitodo.production.services.dataformat.MetsService; From cf7f7c7bd585386275879dfb5b20f409cf734f68 Mon Sep 17 00:00:00 2001 From: Matthias Ronge Date: Mon, 30 Aug 2021 09:43:37 +0200 Subject: [PATCH 7/8] Fix Selenium test --- .../dialogs/{addMediaUnit.xhtml => addPhysicalDivision.xhtml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/{addMediaUnit.xhtml => addPhysicalDivision.xhtml} (100%) diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addMediaUnit.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addPhysicalDivision.xhtml similarity index 100% rename from Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addMediaUnit.xhtml rename to Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addPhysicalDivision.xhtml From 88a3c890578bbee7a5a829b4f2d6b3ee996b85f3 Mon Sep 17 00:00:00 2001 From: Matthias Ronge Date: Mon, 30 Aug 2021 09:51:27 +0200 Subject: [PATCH 8/8] Fix checkstyle issues --- .../java/org/kitodo/production/services/data/FolderService.java | 2 +- .../production/services/data/base/TitleSearchService.java | 2 +- .../org/kitodo/production/services/schema/SchemaService.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java index b3ae18487da..56ba34ec657 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java @@ -18,8 +18,8 @@ import java.util.Map.Entry; import java.util.Objects; -import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.data.database.beans.Folder; import org.kitodo.data.database.beans.Process; import org.kitodo.data.database.exceptions.DAOException; diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/base/TitleSearchService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/base/TitleSearchService.java index d9cd6d0fc13..3ba5322730d 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/base/TitleSearchService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/base/TitleSearchService.java @@ -93,7 +93,7 @@ protected List> findByTitleWithWildcard(String title) throws return findDocuments(getWildcardQueryTitle(title)); } - /** + /** * Get query to find object matching to given title with keyword (exactMatch). * * @param title diff --git a/Kitodo/src/main/java/org/kitodo/production/services/schema/SchemaService.java b/Kitodo/src/main/java/org/kitodo/production/services/schema/SchemaService.java index ff2021d9652..fdb8cb295ba 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/schema/SchemaService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/schema/SchemaService.java @@ -25,8 +25,8 @@ import org.kitodo.api.MetadataEntry; import org.kitodo.api.dataeditor.rulesetmanagement.RulesetManagementInterface; import org.kitodo.api.dataformat.LogicalDivision; -import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.MediaVariant; +import org.kitodo.api.dataformat.PhysicalDivision; import org.kitodo.api.dataformat.Workpiece; import org.kitodo.api.dataformat.mets.LinkedMetsResource; import org.kitodo.data.database.beans.Folder;