Skip to content

Commit

Permalink
Merge pull request #4520 from matthias-ronge/rename-logical_part-of-i…
Browse files Browse the repository at this point in the history
…ssue-3159

Rename “included structural element” to “logical division”
  • Loading branch information
Kathrin-Huber authored Aug 30, 2021
2 parents 328feff + b45e8d4 commit dfcb2fd
Show file tree
Hide file tree
Showing 63 changed files with 810 additions and 830 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* be described with metadata.
*
* @param <T>
* There are two versions of it, an {@link IncludedStructuralElement}
* There are two versions of it, an {@link LogicalDivision}
* and a {@link MediaUnit}.
*/
public abstract class Division<T extends Division<T>> {
Expand Down Expand Up @@ -58,7 +58,7 @@ public abstract class Division<T extends Division<T>> {
*
* <p>
* <i>For media units</i>, the display or playback order of several media
* units referenced from one included structural element is determined by
* units referenced from one logical division is determined by
* this attribute, not by the order of the references.
*/
private int order;
Expand Down Expand Up @@ -144,7 +144,7 @@ public List<URI> getContentIds() {
}

/**
* Returns the label of this included structural element.
* Returns the label of this logical division.
*
* @return the label
*/
Expand All @@ -153,7 +153,7 @@ public String getLabel() {
}

/**
* Sets the label of this included structural element.
* Sets the label of this logical division.
*
* @param label
* label to set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,47 @@
import org.kitodo.api.dataformat.mets.LinkedMetsResource;

/**
* A tree-shaped description of the included structural element of the digital
* representation of a digital medium. The included structural element can be
* A tree-shaped description of the logical division of the digital
* 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
* processes.
*/
public class IncludedStructuralElement extends Division<IncludedStructuralElement> {
public class LogicalDivision extends Division<LogicalDivision> {
/**
* Specifies the link if there is one.
*/
private LinkedMetsResource link;

/**
* The views on {@link MediaUnit}s that this included structural element
* The views on {@link MediaUnit}s that this logical division
* level comprises.
*/
private final LinkedList<View> views;

/**
* Creates a new included structural element.
* Creates a new logical division.
*/
public IncludedStructuralElement() {
public LogicalDivision() {
views = new LinkedList<>();
}

/**
* Creates a new subclass of included structural element from an existing
* included structural element.
* Creates a new subclass of logical division from an existing
* logical division.
*
* @param source
* included structural element that serves as data source
* logical division that serves as data source
*/
protected IncludedStructuralElement(IncludedStructuralElement source) {
protected LogicalDivision(LogicalDivision source) {
super(source);
link = source.link;
views = source.views;
}

/**
* Returns the link of this included structural element.
* Returns the link of this logical division.
*
* @return the link
*/
Expand All @@ -66,7 +66,7 @@ public LinkedMetsResource getLink() {
}

/**
* Sets the link of this included structural element.
* Sets the link of this logical division.
*
* @param link
* link to set
Expand All @@ -76,7 +76,7 @@ public void setLink(LinkedMetsResource link) {
}

/**
* Returns the views associated with this included structural element.
* Returns the views associated with this logical division.
*
* @return the views
*/
Expand All @@ -97,10 +97,10 @@ public boolean equals(Object o) {
if (!super.equals(o)) {
return false;
}
if (!(o instanceof IncludedStructuralElement)) {
if (!(o instanceof LogicalDivision)) {
return false;
}
IncludedStructuralElement other = (IncludedStructuralElement) o;
LogicalDivision other = (LogicalDivision) o;
return Objects.equals(link, other.link)
&& Objects.equals(views, other.views);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ public class MediaUnit extends Division<MediaUnit> {
private String metsDivReferrerId;

/**
* List of IncludedStructuralElements this view is assigned to.
* List of LogicalDivisions this view is assigned to.
*/
private transient List<IncludedStructuralElement> includedStructuralElements;
private transient List<LogicalDivision> logicalDivisions;

/**
* Creates a new MediaUnit.
*/
public MediaUnit() {
includedStructuralElements = new LinkedList<>();
logicalDivisions = new LinkedList<>();
}


Expand Down Expand Up @@ -103,14 +103,14 @@ public void setDivId(String divId) {

/**
* The list is available to assist to render the front-end by holding the
* elements of the root element that reference this media unit. It is
* elements of the logical structure that reference this media unit. It is
* transient, meaning that its content is not saved and is not restored when
* it is loaded.
*
* @return a list that you can use
*/
public List<IncludedStructuralElement> getIncludedStructuralElements() {
return includedStructuralElements;
public List<LogicalDivision> getLogicalDivisions() {
return logicalDivisions;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/**
* A view on a media unit. The individual levels of the
* {@link IncludedStructuralElement} refer to {@code View}s on
* {@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.
*/
Expand Down
36 changes: 18 additions & 18 deletions Kitodo-API/src/main/java/org/kitodo/api/dataformat/Workpiece.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public class Workpiece {
private MediaUnit mediaUnit = new MediaUnit();

/**
* The logical included structural element.
* The logical logical division.
*/
private IncludedStructuralElement rootElement = new IncludedStructuralElement();
private LogicalDivision logicalStructure = new LogicalDivision();

/**
* Returns the creation date of the workpiece.
Expand Down Expand Up @@ -108,12 +108,12 @@ public MediaUnit getMediaUnit() {
}

/**
* Returns the root element of the included structural element.
* Returns the root element of the logical division.
*
* @return root element of the included structural element
* @return root element of the logical division
*/
public IncludedStructuralElement getRootElement() {
return rootElement;
public LogicalDivision getLogicalStructure() {
return logicalStructure;
}

/**
Expand All @@ -127,18 +127,18 @@ public void setMediaUnit(MediaUnit mediaUnit) {
}

/**
* Sets the included structural element of the workpiece.
* Sets the logical division of the workpiece.
*
* @param rootElement
* included structural element to set
* @param logicalStructure
* logical division to set
*/
public void setRootElement(IncludedStructuralElement rootElement) {
this.rootElement = rootElement;
public void setLogicalStructure(LogicalDivision logicalStructure) {
this.logicalStructure = logicalStructure;
}

@Override
public String toString() {
return id + ", " + rootElement;
return id + ", " + logicalStructure;
}

@Override
Expand All @@ -162,20 +162,20 @@ public boolean equals(Object o) {
&& Objects.equals(editHistory, workpiece.editHistory)
&& Objects.equals(id, workpiece.id)
&& Objects.equals(mediaUnit, workpiece.mediaUnit)
&& Objects.equals(rootElement, workpiece.rootElement);
&& Objects.equals(logicalStructure, workpiece.logicalStructure);
}

/**
* Returns all included structural elements of the root element of the
* Returns all logical divisions of the logical structure of the
* workpiece as a flat list. The list isn’t backed by the included
* structural elements, which means that insertions and deletions in the
* list would not change the included structural elements. Therefore a list
* list would not change the logical divisions. Therefore a list
* that cannot be modified is returned.
*
* @return all included structural elements as an unmodifiable list
* @return all logical divisions as an unmodifiable list
*/
public List<IncludedStructuralElement> getAllIncludedStructuralElements() {
return Collections.unmodifiableList(treeStream(rootElement).collect(Collectors.toList()));
public List<LogicalDivision> getAllLogicalDivisions() {
return Collections.unmodifiableList(treeStream(logicalStructure).collect(Collectors.toList()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,34 @@ public class DivisionTest {
*/
@Test
public void getAllChildrenTest() {
IncludedStructuralElement parent = new IncludedStructuralElement();
LogicalDivision parent = new LogicalDivision();
parent.setLabel("Parent");

IncludedStructuralElement childOne = new IncludedStructuralElement();
LogicalDivision childOne = new LogicalDivision();
childOne.setLabel("Child 1");
parent.getChildren().add(childOne);

IncludedStructuralElement childOneOne = new IncludedStructuralElement();
LogicalDivision childOneOne = new LogicalDivision();
childOneOne.setLabel("Child 1.1");
childOne.getChildren().add(childOneOne);

IncludedStructuralElement childOneTwo = new IncludedStructuralElement();
LogicalDivision childOneTwo = new LogicalDivision();
childOneTwo.setLabel("Child 1.2");
childOne.getChildren().add(childOneTwo);

IncludedStructuralElement childTwo = new IncludedStructuralElement();
LogicalDivision childTwo = new LogicalDivision();
childTwo.setLabel("Child 2");
parent.getChildren().add(childTwo);

IncludedStructuralElement childTwoOne = new IncludedStructuralElement();
LogicalDivision childTwoOne = new LogicalDivision();
childTwoOne.setLabel("Child 2.1");
childTwo.getChildren().add(childTwoOne);

IncludedStructuralElement childTwoTwo = new IncludedStructuralElement();
LogicalDivision childTwoTwo = new LogicalDivision();
childTwoTwo.setLabel("Child 2.2");
childTwo.getChildren().add(childTwoTwo);

List<String> allChildren = parent.getAllChildren().stream().map(IncludedStructuralElement::getLabel)
List<String> allChildren = parent.getAllChildren().stream().map(LogicalDivision::getLabel)
.collect(Collectors.toList());

assertFalse(allChildren.contains("Parent"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.kitodo.api.Metadata;
import org.kitodo.api.MetadataEntry;
import org.kitodo.api.MetadataGroup;
import org.kitodo.api.dataformat.IncludedStructuralElement;
import org.kitodo.api.dataformat.LogicalDivision;
import org.kitodo.api.dataformat.MediaUnit;
import org.kitodo.api.dataformat.View;
import org.kitodo.api.dataformat.mets.KitodoUUID;
Expand All @@ -52,7 +52,7 @@
* The tree-like outline structure for digital representation. This structuring
* structure can be subdivided into arbitrary finely granular.
*/
public class DivXmlElementAccess extends IncludedStructuralElement {
public class DivXmlElementAccess extends LogicalDivision {
/**
* The qualified name of the Kitodo metadata format, needed to assemble the
* metadata entries in METS using JAXB.
Expand All @@ -78,10 +78,10 @@ public DivXmlElementAccess() {
/**
* Creates a new DivXmlElementAccess for an existing structure.
*/
DivXmlElementAccess(IncludedStructuralElement includedStructuralElement) {
super(includedStructuralElement);
metsReferrerId = includedStructuralElement instanceof DivXmlElementAccess
? ((DivXmlElementAccess) includedStructuralElement).metsReferrerId
DivXmlElementAccess(LogicalDivision logicalDivision) {
super(logicalDivision);
metsReferrerId = logicalDivision instanceof DivXmlElementAccess
? ((DivXmlElementAccess) logicalDivision).metsReferrerId
: KitodoUUID.randomUUID();
}

Expand Down Expand Up @@ -132,7 +132,7 @@ public DivXmlElementAccess() {
if (Objects.nonNull(fileXmlElementAccess)
&& !fileXmlElementAccessIsLinkedToChildren(fileXmlElementAccess, div.getDiv(), mediaUnitsMap)) {
super.getViews().add(new AreaXmlElementAccess(fileXmlElementAccess).getView());
fileXmlElementAccess.getMediaUnit().getIncludedStructuralElements().add(this);
fileXmlElementAccess.getMediaUnit().getLogicalDivisions().add(this);
}
}
}
Expand Down Expand Up @@ -268,8 +268,8 @@ DivType toDiv(Map<MediaUnit, String> mediaUnitIDs, LinkedList<Pair<String, Strin
if (Objects.nonNull(super.getLink())) {
MptrXmlElementAccess.addMptrToDiv(super.getLink(), div);
}
for (IncludedStructuralElement subincludedStructuralElement : super.getChildren()) {
div.getDiv().add(new DivXmlElementAccess(subincludedStructuralElement).toDiv(mediaUnitIDs, smLinkData, mets));
for (LogicalDivision subLogicalDivision : super.getChildren()) {
div.getDiv().add(new DivXmlElementAccess(subLogicalDivision).toDiv(mediaUnitIDs, smLinkData, mets));
}
return div;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
* of a {@code MediaUnit} resides in a {@link FLocatXmlElementAccess} in the data store.
*
* <p>
* The {@code IncludedStructuralElement} is a tree structure that can be finely
* 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.
Expand Down Expand Up @@ -151,7 +151,7 @@ private MetsXmlElementAccess(Mets mets) {
mediaUnitsMap.get(smLink.getFrom()).add(divIDsToMediaUnits.get(smLink.getTo()));
}
}
workpiece.setRootElement(getStructMapsStreamByType(mets, "LOGICAL")
workpiece.setLogicalStructure(getStructMapsStreamByType(mets, "LOGICAL")
.map(structMap -> new DivXmlElementAccess(structMap.getDiv(), mets, mediaUnitsMap, 1)).collect(Collectors.toList())
.iterator().next());
}
Expand Down Expand Up @@ -251,7 +251,7 @@ private Mets toMets() {
LinkedList<Pair<String, String>> smLinkData = new LinkedList<>();
StructMapType logical = new StructMapType();
logical.setTYPE("LOGICAL");
logical.setDiv(new DivXmlElementAccess(workpiece.getRootElement()).toDiv(mediaUnitIDs, smLinkData, mets));
logical.setDiv(new DivXmlElementAccess(workpiece.getLogicalStructure()).toDiv(mediaUnitIDs, smLinkData, mets));
mets.getStructMap().add(logical);

mets.setStructLink(createStructLink(smLinkData));
Expand Down
Loading

0 comments on commit dfcb2fd

Please sign in to comment.