Skip to content

Commit

Permalink
SatzXml initialisiert Sparte in Teildatensätze
Browse files Browse the repository at this point in the history
  • Loading branch information
Oli B committed Apr 21, 2024
1 parent be18941 commit 08d4aa3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/src/main/java/gdv/xport/satz/Teildatensatz.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ public void setSparte(final int x) {
numFeld.setInhalt(x);
}

@Override
public int getSparte() {
return getFeld(SPARTE, NumFeld.class).toInt();
}

/**
* Liefert das gewuenschte Feld.
* <p>
Expand Down
7 changes: 7 additions & 0 deletions lib/src/main/java/gdv/xport/satz/xml/SatzXml.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,17 @@ public void setFelder(Map<String, FeldXml> felder) {
for (int n = 1; n <= this.getNumberOfTeildatensaetze(); n++) {
TeildatensatzXml tdsXml = (TeildatensatzXml) this.getTeildatensatz(n);
tdsXml.updateWith(felder);
updateSparte(tdsXml);
//updateSatznummer(n, tdsXml);
}
}

private void updateSparte(TeildatensatzXml tdsXml) {
if (tdsXml.hasSparte()) {
tdsXml.setSparte(getSatzTyp().getSparte());
}
}

// private void updateSatznummer(int n, TeildatensatzXml tdsXml) {
// if (tdsXml.hasFeld(Bezeichner.SATZNUMMER) || tdsXml.hasFeld(Bezeichner.SATZ_NR_2)) {
// Feld feld = tdsXml.getFeld(Bezeichner.SATZNUMMER);
Expand Down
2 changes: 2 additions & 0 deletions lib/src/test/java/gdv/xport/satz/xml/SatzXmlTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ public void testSatz0220BausparenAntrag() throws XMLStreamException {
try {
SatzXml satz220 = new SatzXml(parser);
assertEquals(220, satz220.getSatzart());
Map<String, FeldXml> xmlFelder = XmlService.parseFelder(parser);
satz220.setFelder(xmlFelder);
assertEquals(580, satz220.getSparte());
assertEquals(1, satz220.getArt());
} finally {
Expand Down

0 comments on commit 08d4aa3

Please sign in to comment.