finished auther javadoc attribution

This commit is contained in:
vysitor 2025-03-23 21:44:29 +01:00
parent 039aad9937
commit 90a5bfead2
10 changed files with 34 additions and 27 deletions

View file

@ -41,6 +41,7 @@ public abstract class PPRUtils {
/**
* Von Valentin angelegt, von allen verändert
* Alle Informationen lesen...
* - Parlamentarier
* - Reden
@ -61,21 +62,16 @@ public abstract class PPRUtils {
Logger.warn("Members already in the DB. Skipping...");
}
// Reden und Kommentare einlesen und persistieren - TODO
// Reden und Kommentare einlesen und persistieren
readSpeechesAndComments(xmlFactory, mongoFactory);
// Fotos hochladen - TODO
// Fotos hochladen
readPhotos(mongoFactory);
// NLP-Analyse (Text und Video)
// TODO: Anpassung notwendig, Daten aus dem NEtz statt aus resources holen
// Achtung: läuft nicht unter Windows. Verwende Linux (nativ oder im Virtual Box)
// NlpUtils.createNlpData();
}
/**
* Fotos hochladen - TODO
* Fotos hochladen
* @param mongoFactory Factory für die MongoDB-Objekte
*/
public static void readPhotos(MongoObjectFactory mongoFactory) {
@ -83,7 +79,7 @@ public abstract class PPRUtils {
}
/**
* Reden und Kommentare einlesen - TODO
* Reden und Kommentare einlesen
* @param xmlFactory Factory für die XML-Objekte
* @param mongoFactory Factory für die MongoDB-Objekte
*/
@ -99,7 +95,6 @@ public abstract class PPRUtils {
public static void readAndPersistMdbs(String mdbUrl, FileObjectFactory xmlFactory, MongoObjectFactory mongoFactory) {
org.w3c.dom.Document mdbRoot = getMdbFromRemoteXmlZipfile(mdbUrl);
Element rootElement = mdbRoot.getDocumentElement();
// TODO: optional! persist the metadata of the <VERSION>1723434311</VERSION> element
List<Node> mdbNodes = XmlUtils.getChildrenByName(rootElement, "MDB");
@ -114,12 +109,9 @@ public abstract class PPRUtils {
}
}
// TODO: persist each speaker!
// TODO: guard: if not in the DB already
}
// TODO - HERE
private static boolean mdbActiveInWp(Speaker speaker, Integer legislaturPeriode) {
List<Integer> wps = speaker.getMemberships().stream()
.map(Membership::getWp)
@ -156,7 +148,7 @@ public abstract class PPRUtils {
zipInputStream.closeEntry();
}
if (xmlOutputStream.size() == 0 || dtdOutputStream.size() == 0) { // TODO
if (xmlOutputStream.size() == 0 || dtdOutputStream.size() == 0) {
// throw new FileNotFoundException("XML or DTD not found in the ZIP archive");
}
InputStream xmlInputStreamFinal = new ByteArrayInputStream(xmlOutputStream.toByteArray());
@ -171,7 +163,6 @@ public abstract class PPRUtils {
return doc;
} catch (IOException e) {
// TODO
throw new RuntimeException(e);
}
}
@ -209,8 +200,6 @@ public abstract class PPRUtils {
});
}
// TODO: altes Zeug, sortieren...
/**
* Alle Parteien (aus einer Liste der MdBs) herausfinden.
* null-Einträge durch einen Platzhalter ersetzen, damit später keine null pointer exceptions auftretten

View file

@ -5,7 +5,9 @@ import org.texttechnologylab.project.gruppe_05_1.domain.speaker.Speaker;
import org.texttechnologylab.project.gruppe_05_1.xml.mdb.*;
import org.texttechnologylab.project.gruppe_05_1.xml.speaker.Speaker_File_Impl;
import org.w3c.dom.Node;
/**
* implementiert von Valentin
*/
public class FileObjectFactory {
private static FileObjectFactory oFactory = null;

View file

@ -1,7 +1,9 @@
package org.texttechnologylab.project.gruppe_05_1.xml;
import org.w3c.dom.Node;
/**
* implementiert von Valentin
*/
public interface XmlOperations {
FileObjectFactory factory = FileObjectFactory.getFactory();
Object fromXmlNode(Node node);

View file

@ -5,7 +5,9 @@ import org.texttechnologylab.project.gruppe_05_1.util.GeneralUtils;
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
import org.texttechnologylab.project.gruppe_05_1.xml.XmlOperations;
import org.w3c.dom.Node;
/**
* implementiert von Valentin
*/
public class BiografischeAngaben_File_Impl extends BiografischeAngaben implements XmlOperations {
@Override
public BiografischeAngaben fromXmlNode(Node node) {

View file

@ -5,7 +5,9 @@ import org.texttechnologylab.project.gruppe_05_1.util.GeneralUtils;
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
import org.texttechnologylab.project.gruppe_05_1.xml.XmlOperations;
import org.w3c.dom.Node;
/**
* implementiert von Valentin
*/
public class Institution_File_Impl extends Institution implements XmlOperations {
@Override
public Institution fromXmlNode(Node node) {

View file

@ -8,7 +8,9 @@ import org.w3c.dom.Node;
import java.util.ArrayList;
import java.util.List;
/**
* implementiert von Valentin
*/
public class MdbDocument_File_Impl extends MdbDocument implements XmlOperations {
@Override
public MdbDocument fromXmlNode(Node node) {

View file

@ -5,7 +5,9 @@ import org.texttechnologylab.project.gruppe_05_1.util.GeneralUtils;
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
import org.texttechnologylab.project.gruppe_05_1.xml.XmlOperations;
import org.w3c.dom.Node;
/**
* implementiert von Valentin
*/
public class MdbName_File_Impl extends MdbName implements XmlOperations {
@Override
public MdbName fromXmlNode(Node node) {

View file

@ -9,7 +9,9 @@ import org.w3c.dom.Node;
import java.util.ArrayList;
import java.util.List;
/**
* implementiert von Valentin
*/
public class Mdb_File_Impl extends Mdb implements XmlOperations {
@Override
public Mdb fromXmlNode(Node node) {

View file

@ -9,7 +9,9 @@ import org.w3c.dom.Node;
import java.util.ArrayList;
import java.util.List;
/**
* implementiert von Valentin
*/
public class Wahlperiode_File_Impl extends Wahlperiode implements XmlOperations {
@Override
public Wahlperiode fromXmlNode(Node node) {

View file

@ -11,7 +11,9 @@ import org.w3c.dom.Node;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
/**
* implementiert von Valentin
*/
public class Speaker_File_Impl extends Speaker implements XmlOperations {
@Override
public Speaker fromXmlNode(Node node) {
@ -32,7 +34,7 @@ public class Speaker_File_Impl extends Speaker implements XmlOperations {
mdbNameList.add(mdbName);
}
mdbNameList.sort((n1, n2 )-> n2.getHistorieVon().compareTo(n1.getHistorieVon())); // Descending order
MdbName newestMdbName = mdbNameList.get(0); // TODO
MdbName newestMdbName = mdbNameList.get(0);
speaker.setName(newestMdbName.getNachname());
speaker.setFirstName(newestMdbName.getVorname());
speaker.setAkademischertitel(newestMdbName.getAkadTitel());