use of de.unigoettingen.sub.search.opac.ConfigOpacDoctype in project goobi-workflow by intranda.
the class ProzesskopieForm method createNewFileformat.
/* =============================================================== */
private void createNewFileformat() throws TypeNotAllowedForParentException, TypeNotAllowedAsChildException {
Prefs myPrefs = this.prozessKopie.getRegelsatz().getPreferences();
try {
DigitalDocument dd = new DigitalDocument();
Fileformat ff = new XStream(myPrefs);
ff.setDigitalDocument(dd);
/* BoundBook hinzufügen */
DocStructType dst = myPrefs.getDocStrctTypeByName("BoundBook");
DocStruct dsBoundBook = dd.createDocStruct(dst);
dd.setPhysicalDocStruct(dsBoundBook);
ConfigOpacDoctype configOpacDoctype = co.getDoctypeByName(this.docType);
/* Monographie */
if (!configOpacDoctype.isPeriodical() && !configOpacDoctype.isMultiVolume()) {
DocStructType dsty = myPrefs.getDocStrctTypeByName(configOpacDoctype.getRulesetType());
DocStruct ds = dd.createDocStruct(dsty);
dd.setLogicalDocStruct(ds);
this.myRdf = ff;
} else /* periodica */
if (configOpacDoctype.isPeriodical() || configOpacDoctype.isMultiVolume()) {
DocStructType anchor = myPrefs.getDocStrctTypeByName(configOpacDoctype.getRulesetType());
DocStruct ds = dd.createDocStruct(anchor);
dd.setLogicalDocStruct(ds);
DocStructType dstyvolume = myPrefs.getDocStrctTypeByName(configOpacDoctype.getRulesetChildType());
DocStruct dsvolume = dd.createDocStruct(dstyvolume);
ds.addChild(dsvolume);
this.myRdf = ff;
}
// } catch (TypeNotAllowedForParentException e) {
// log.error(e);
// } catch (TypeNotAllowedAsChildException e) {
// log.error(e);
} catch (PreferencesException e) {
log.error(e);
}
}
use of de.unigoettingen.sub.search.opac.ConfigOpacDoctype in project kitodo-production by kitodo.
the class NewspaperProcessesGenerator method initializeTitleGenerator.
/**
* Initializes the title generator.
*
* @param configProject
* the config project
* @param allowedMetadata
* allowed Metadata views
* @return the initialized title generator
*/
private static TitleGenerator initializeTitleGenerator(ConfigProject configProject, Workpiece workpiece, Collection<MetadataViewInterface> allowedMetadata) throws DoctypeMissingException {
LogicalDivision logicalStructure = workpiece.getLogicalStructure();
Map<String, Map<String, String>> metadata = new HashMap<>(4);
Map<String, String> topstruct = getMetadataEntries(logicalStructure.getMetadata());
metadata.put("topstruct", topstruct);
List<LogicalDivision> children = logicalStructure.getChildren();
metadata.put("firstchild", children.isEmpty() ? Collections.emptyMap() : getMetadataEntries(children.get(0).getMetadata()));
metadata.put("physSequence", getMetadataEntries(workpiece.getPhysicalStructure().getMetadata()));
String docType = null;
for (ConfigOpacDoctype configOpacDoctype : ConfigOpac.getAllDoctypes()) {
if (configOpacDoctype.getRulesetType().equals(logicalStructure.getType())) {
docType = configOpacDoctype.getTitle();
break;
}
}
List<AdditionalField> projectAdditionalFields = configProject.getAdditionalFields();
ProcessFieldedMetadata table = new ProcessFieldedMetadata();
for (AdditionalField additionalField : projectAdditionalFields) {
if (isDocTypeAndNotIsNotDoctype(additionalField, docType)) {
String value = metadata.getOrDefault(additionalField.getDocStruct(), Collections.emptyMap()).get(additionalField.getMetadata());
List<MetadataViewInterface> filteredViews = allowedMetadata.stream().filter(v -> v.getId().equals(additionalField.getMetadata())).collect(Collectors.toList());
if (!filteredViews.isEmpty()) {
MetadataEntry metadataEntry = new MetadataEntry();
metadataEntry.setValue(value);
if (filteredViews.get(0).isComplex()) {
table.createMetadataGroupPanel((ComplexMetadataViewInterface) filteredViews.get(0), Collections.singletonList(metadataEntry));
} else {
table.createMetadataEntryEdit((SimpleMetadataViewInterface) filteredViews.get(0), Collections.singletonList(metadataEntry));
}
}
}
}
return new TitleGenerator(topstruct.getOrDefault("TSL_ATS", ""), table.getRows());
}
Aggregations