Skip to content

Commit 84dfb9d

Browse files
committed
Simplify logic
1 parent 08089bd commit 84dfb9d

3 files changed

Lines changed: 5 additions & 18 deletions

File tree

Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessFieldedMetadata.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ public void preserve() throws InvalidMetadataValueException, NoSuchMetadataField
681681
String id = row.getMetadataID();
682682
if (row instanceof ProcessSimpleMetadata && specialFields.contains(id)
683683
&& ((ProcessSimpleMetadata) row).getSettings()
684-
.getDomain().orElse(Domain.DESCRIPTION).equals(Domain.METS_DIV) && !untyped) {
684+
.getDomain().orElse(Domain.DESCRIPTION).equals(Domain.METS_DIV)) {
685685
updateDivisionFromProcessDetail(id, (ProcessSimpleMetadata) row);
686686
} else {
687687
if (!untyped) {
@@ -729,17 +729,8 @@ private void resetDivision() {
729729
* Restricts the visible metadata fields of this element to structural metadata only.
730730
*/
731731
public void filterToStructuralFields() {
732-
treeNode.getChildren().removeIf(child -> {
733-
ProcessDetail row = (ProcessDetail) child.getData();
734-
String key = row.getMetadataID();
735-
736-
return !isStructuralKey(key);
737-
});
738-
}
739-
740-
private boolean isStructuralKey(String key) {
741-
return METADATA_KEY_LABEL.equals(key)
742-
|| METADATA_KEY_ORDERLABEL.equals(key);
732+
treeNode.getChildren().removeIf(child ->
733+
!specialFields.contains(((ProcessDetail) child.getData()).getMetadataID()));
743734
}
744735

745736
private boolean isDivisionUntyped() {

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,9 @@ void showLogical(Optional<LogicalDivision> optionalStructure) {
164164
}
165165

166166
private boolean isDivisionUntyped(LogicalDivision division) {
167-
if (division instanceof LogicalDivision logicalDivision) {
168-
return Objects.isNull(logicalDivision.getType()) || logicalDivision.getType().isBlank();
169-
}
170-
return false;
167+
return Objects.isNull(division.getType()) || division.getType().isBlank();
171168
}
172169

173-
174170
void showPageInLogical(PhysicalDivision physicalDivision) {
175171
if (Objects.nonNull(physicalDivision)) {
176172
logicalMetadataTable = createProcessFieldedMetadata(physicalDivision);

Kitodo/src/main/java/org/kitodo/production/helper/ProcessHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ public static void addAllowedMetadataRecursive(Division<?> division, Collection<
461461
RulesetManagementInterface rulesetManagement, String acquisitionStage,
462462
List<Locale.LanguageRange> priorityList) {
463463
String type = division.getType();
464-
if (Objects.nonNull(type) && !type.isEmpty()) {
464+
if (Objects.nonNull(type) && !type.isBlank()) {
465465
StructuralElementViewInterface divisionView = rulesetManagement.getStructuralElementView(type,
466466
acquisitionStage, priorityList);
467467
for (MetadataViewInterface metadataView : divisionView.getAllowedMetadata()) {

0 commit comments

Comments
 (0)