small enhancement
This commit is contained in:
parent
9796b1366c
commit
62a35e30c7
1 changed files with 38 additions and 0 deletions
|
@ -626,6 +626,44 @@ public class MongoPprUtils {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holt die Redeinformationen aus der Datenbank, die wichtig sind, um eine Liste der Reden eines Parlamentariers in HTML darzustellen
|
||||
* @param speakerId
|
||||
* @return
|
||||
*/
|
||||
public static List<SpeechOverview> getSpeechOverviewBySpeaker(Integer speakerId) {
|
||||
|
||||
List<SpeechOverview> result = new ArrayList<>();
|
||||
|
||||
MongoCollection<Document> collection = getSpeechCollection();
|
||||
|
||||
Document projection = new Document("speechKey", 1)
|
||||
.append("speakerId", 1)
|
||||
.append("dateTimeString", 1)
|
||||
.append("speakerName", 1)
|
||||
.append("fraction", 1)
|
||||
.append("agendaTitel", 1);
|
||||
|
||||
Bson filter = Filters.eq("speakerId", speakerId);
|
||||
|
||||
List<Document> docs = collection.find(filter)
|
||||
.projection(projection)
|
||||
.sort(Sorts.descending("dateTime"))
|
||||
.into(new ArrayList<>());
|
||||
|
||||
for (Document doc : docs) {
|
||||
result.add(new SpeechOverview(
|
||||
doc.getString("speechKey"),
|
||||
doc.getInteger("speakerId"),
|
||||
doc.getString("dateTimeString"),
|
||||
doc.getString("speakerName"),
|
||||
doc.getString("fraction"),
|
||||
doc.getString("agendaTitel")
|
||||
));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Füge Rede-Metadaten (welche in der Session-Collection stehen) der Rede hinzu.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue