Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.TreeMap;

import org.kitodo.api.Metadata;
import org.kitodo.api.MetadataGroup;
import org.kitodo.api.dataeditor.rulesetmanagement.ComplexMetadataViewInterface;
import org.kitodo.api.dataeditor.rulesetmanagement.Domain;
import org.kitodo.api.dataeditor.rulesetmanagement.MetadataViewInterface;
Expand Down Expand Up @@ -379,6 +380,24 @@ private MetadataViewInterface rowToView(AuxiliaryTableRow row) {
: new KeyView(row.getKey(), rule.getRuleForKey(row.getId(), division), settings, priorityList);
}

/**
* Creates a metadata view for one line of the auxiliary table.
* This method takes metadata groups into account that are not defined in the ruleset.
*
* @param row row to make a view for
* @param index index of the metadata object in the row
* @return metadata view
*/
private MetadataViewInterface rowToView(AuxiliaryTableRow row, int index) {
if (row.getKey().isUndefined()) {
Collection<Metadata> metadataObjects = row.getDataObjects(index);
if (!metadataObjects.isEmpty() && metadataObjects.iterator().next() instanceof MetadataGroup) {
return getNestedKeyView(row.getId());
}
}
return rowToView(row);
}

/**
* Creates a key view for a grouped key. This is the case when when
* {@code <key>} elements occur within another {@code <key>} element in the
Expand Down Expand Up @@ -424,7 +443,7 @@ public List<MetadataViewWithValuesInterface> getSortedVisibleMetadata(Collection
excludedDataObjects.addAll(auxiliaryTableRow.getDataObjects(0));
} else {
for (int i = 0; i < auxiliaryTableRow.getNumberOfTypeViewsToGenerate(); i++) {
Optional<MetadataViewInterface> definedTypeView = Optional.of(rowToView(auxiliaryTableRow));
Optional<MetadataViewInterface> definedTypeView = Optional.of(rowToView(auxiliaryTableRow, i));
sortedVisibleMetadata.add(new FormRow(definedTypeView, auxiliaryTableRow.getDataObjects(i)));
}
}
Expand Down
Loading