use of ugh.dl.Person in project goobi-workflow by intranda.
the class Metadaten method TransliterierenPerson.
public String TransliterierenPerson() {
Person md = this.curPerson.getP();
/*
* -------------------------------- wenn es ein russischer Autor ist, dessen Transliterierungen anlegen --------------------------------
*/
if (md.getRole().equals("Author")) {
Transliteration trans = new Transliteration();
try {
MetadataType mdtDin = this.myPrefs.getMetadataTypeByName("AuthorTransliteratedDIN");
MetadataType mdtIso = this.myPrefs.getMetadataTypeByName("AuthorTransliteratedISO");
Person mdDin = new Person(mdtDin);
Person mdIso = new Person(mdtIso);
mdDin.setFirstname(trans.transliterate_din(md.getFirstname()));
mdDin.setLastname(trans.transliterate_din(md.getLastname()));
mdIso.setFirstname(trans.transliterate_iso(md.getFirstname()));
mdIso.setLastname(trans.transliterate_iso(md.getLastname()));
mdDin.setRole("AuthorTransliteratedDIN");
mdIso.setRole("AuthorTransliteratedISO");
this.myDocStruct.addPerson(mdDin);
this.myDocStruct.addPerson(mdIso);
} catch (MetadataTypeNotAllowedException e) {
log.error("Fehler beim Hinzufügen der Transliterationen (MetadataTypeNotAllowedException): " + e.getMessage());
}
}
MetadatenalsBeanSpeichern(this.myDocStruct);
/* zum Schluss die Sperrung aktualisieren */
if (!SperrungAktualisieren()) {
return "metseditor_timeout";
}
return "";
}
use of ugh.dl.Person in project goobi-workflow by intranda.
the class Metadaten method saveGroup.
public String saveGroup() {
try {
MetadataGroup md = new MetadataGroup(this.myPrefs.getMetadataGroupTypeByName(this.tempGroupType));
for (MetadatumImpl mdi : selectedGroup.getMetadataList()) {
if (StringUtils.isNotBlank(mdi.getMd().getValue())) {
Metadata metadata = new Metadata(mdi.getMd().getType());
metadata.setValue(mdi.getMd().getValue());
md.addMetadata(metadata);
}
}
for (MetaPerson mp : selectedGroup.getPersonList()) {
Person p = new Person(mp.getP().getType());
p.setFirstname(mp.getP().getFirstname());
p.setLastname(mp.getP().getLastname());
p.setAutorityFile(mp.getP().getAuthorityID(), mp.getP().getAuthorityURI(), mp.getP().getAuthorityValue());
md.addPerson(p);
}
for (MetaCorporate mc : selectedGroup.getCorporateList()) {
Corporate corporate = new Corporate(mc.getCorporate().getType());
corporate.setMainName(mc.getCorporate().getMainName());
corporate.setSubNames(mc.getCorporate().getSubNames());
corporate.setPartName(mc.getCorporate().getPartName());
md.addCorporate(currentCorporate);
}
if (currentGroup != null) {
currentGroup.getMetadataGroup().addMetadataGroup(md);
} else {
this.myDocStruct.addMetadataGroup(md);
}
} catch (MetadataTypeNotAllowedException e) {
log.error("Error while adding metadata (MetadataTypeNotAllowedException): " + e.getMessage());
}
this.modeAddGroup = false;
for (MetadatumImpl mdi : selectedGroup.getMetadataList()) {
mdi.setValue("");
}
for (MetaPerson mp : selectedGroup.getPersonList()) {
mp.setVorname("");
mp.setNachname("");
}
for (MetaCorporate mc : selectedGroup.getCorporateList()) {
mc.setMainName("");
mc.getSubNames().clear();
mc.addSubName();
mc.setPartName("");
}
MetadatenalsBeanSpeichern(this.myDocStruct);
if (!SperrungAktualisieren()) {
return "metseditor_timeout";
}
MetadatenalsTree3Einlesen1(this.tree3, this.currentTopstruct, false);
return "";
}
use of ugh.dl.Person in project goobi-workflow by intranda.
the class Metadaten method AddMetadaFromOpacPpn.
/**
* eine PPN aus dem Opac abfragen und dessen Metadaten dem aktuellen Strukturelement zuweisen
* ================================================================
*/
public String AddMetadaFromOpacPpn() {
StringTokenizer tokenizer = new StringTokenizer(this.additionalOpacPpns, "\n");
while (tokenizer.hasMoreTokens()) {
String tok = tokenizer.nextToken();
try {
ConfigOpacCatalogue coc = ConfigOpac.getInstance().getCatalogueByName(getOpacKatalog());
IOpacPlugin iopac = (IOpacPlugin) PluginLoader.getPluginByTitle(PluginType.Opac, coc.getOpacType());
Fileformat addrdf = iopac.search(this.opacSuchfeld, tok, coc, this.myPrefs);
if (addrdf != null) {
// remove empty default elements
List<Metadata> metadataList = this.myDocStruct.getAllMetadata();
if (metadataList != null) {
List<Metadata> metadataListClone = new ArrayList<>(metadataList);
for (Metadata md : metadataListClone) {
if (md.getValue() == null || md.getValue().isEmpty()) {
this.myDocStruct.removeMetadata(md, true);
}
}
}
List<Person> personList = myDocStruct.getAllPersons();
if (personList != null) {
List<Person> personListClone = new ArrayList<>(personList);
for (Person p : personListClone) {
if (p.getFirstname().isEmpty() && p.getLastname().isEmpty()) {
myDocStruct.removePerson(p);
}
}
}
/* die Liste aller erlaubten Metadatenelemente erstellen */
List<String> erlaubte = new ArrayList<>();
for (MetadataType mt : this.myDocStruct.getAddableMetadataTypes(false)) {
erlaubte.add(mt.getName());
}
/*
* wenn der Metadatentyp in der Liste der erlaubten Typen, dann hinzufügen
*/
for (Metadata m : addrdf.getDigitalDocument().getLogicalDocStruct().getAllMetadata()) {
if (erlaubte.contains(m.getType().getName())) {
this.myDocStruct.addMetadata(m);
}
}
for (Person m : addrdf.getDigitalDocument().getLogicalDocStruct().getAllPersons()) {
if (erlaubte.contains(m.getType().getName())) {
this.myDocStruct.addPerson(m);
}
}
for (MetadataGroup m : addrdf.getDigitalDocument().getLogicalDocStruct().getAllMetadataGroups()) {
if (myDocStruct.getAddableMetadataGroupTypes().contains(m.getType())) {
myDocStruct.addMetadataGroup(m);
}
}
MetadatenalsTree3Einlesen1(this.tree3, this.currentTopstruct, false);
} else {
Helper.setMeldung(null, "Opac abgefragt: ", "kein Ergebnis");
}
} catch (Exception e) {
log.error("Error while importing from catalogue: " + e.getMessage());
}
}
MetadatenalsBeanSpeichern(this.myDocStruct);
this.modusAnsicht = "Metadaten";
return "";
}
use of ugh.dl.Person in project goobi-workflow by intranda.
the class MetaPersonTest method testIdentifier.
@Test
public void testIdentifier() throws MetadataTypeNotAllowedException {
Person p = new Person(prefs.getMetadataTypeByName(METADATA_TYPE));
MetaPerson mp = new MetaPerson(p, 0, prefs, docstruct, process, null);
assertNotNull(mp);
assertEquals(0, mp.getIdentifier());
mp.setIdentifier(1);
assertNotEquals(0, mp.getIdentifier());
}
use of ugh.dl.Person in project goobi-workflow by intranda.
the class MetaPersonTest method testAdditionalNameParts.
@Test
public void testAdditionalNameParts() throws MetadataTypeNotAllowedException {
Person p = new Person(prefs.getMetadataTypeByName(METADATA_TYPE));
MetaPerson mp = new MetaPerson(p, 0, prefs, docstruct, process, null);
assertNotNull(mp);
List<NamePart> fixture = mp.getAdditionalNameParts();
assertNull(fixture);
mp.addNamePart();
fixture = mp.getAdditionalNameParts();
assertEquals(1, mp.getAdditionalNameParts().size());
mp.setAdditionalNameParts(fixture);
assertEquals(1, mp.getAdditionalNameParts().size());
}
Aggregations