Skip to content

Commit

Permalink
getSatzType() aufgeteilt zw. Satz und Datensatz
Browse files Browse the repository at this point in the history
  • Loading branch information
Oli B committed Jun 20, 2024
1 parent f3a8688 commit 5d754c8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
27 changes: 27 additions & 0 deletions lib/src/main/java/gdv/xport/satz/Datensatz.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import gdv.xport.io.PushbackLineNumberReader;
import gdv.xport.satz.feld.common.Kopffelder1bis7;
import gdv.xport.util.SatzTyp;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -265,6 +266,32 @@ private void validateSparte(int x) {
}
}

/**
* Liefert den Satz-Typ zurueck. Der Satz-Typ ist eine Zusammenfassung aus
* Satzart und Sparte.
*
* @return den Satz-Typ
*/
@Override
public SatzTyp getSatzTyp() {
if (StringUtils.isNotEmpty(getGdvSatzartName())) {
return SatzTyp.of(this.getGdvSatzartName());
} else {
if (this.hasWagnisart() && this.getWagnisart().matches("\\d")) {
return SatzTyp.of(this.getSatzart(), getSparte(),
Integer.parseInt(this.getWagnisart()));
} else if (this.hasKrankenFolgeNr() && this.getKrankenFolgeNr().matches("\\d")) {
return SatzTyp.of(this.getSatzart(), getSparte(),
Integer.parseInt(this.getKrankenFolgeNr()));
} else if (this.hasBausparenArt() && this.getBausparenArt().matches("\\d")) {
return SatzTyp.of(this.getSatzart(), getSparte(),
Integer.parseInt(this.getBausparenArt()));
} else {
return SatzTyp.of(this.getSatzart(), getSparte());
}
}
}

/**
* Liefert den Inhalt des Sparten-Felds an Byte-Adresse 11.
*
Expand Down
23 changes: 2 additions & 21 deletions lib/src/main/java/gdv/xport/satz/Satz.java
Original file line number Diff line number Diff line change
Expand Up @@ -710,33 +710,14 @@ public int getSatzart() {

/**
* Liefert den Satz-Typ zurueck. Der Satz-Typ ist eine Zusammenfassung aus
* Satzart und Sparte.
* Satzart und Sparte (in {@link Datensatz#}).
*
* @return den Satz-Typ
* @since 1.0
*/
@JsonIgnore
public SatzTyp getSatzTyp() {
if (StringUtils.isNotEmpty(this.gdvSatzartName)) {
return SatzTyp.of(this.gdvSatzartName);
} else {
if (hasSparte()) {
if (this.hasWagnisart() && this.getWagnisart().matches("\\d")) {
return SatzTyp.of(this.getSatzart(), getSparte(),
Integer.parseInt(this.getWagnisart()));
} else if (this.hasKrankenFolgeNr() && this.getKrankenFolgeNr().matches("\\d")) {
return SatzTyp.of(this.getSatzart(), getSparte(),
Integer.parseInt(this.getKrankenFolgeNr()));
} else if (this.hasBausparenArt() && this.getBausparenArt().matches("\\d")) {
return SatzTyp.of(this.getSatzart(), getSparte(),
Integer.parseInt(this.getBausparenArt()));
} else {
return SatzTyp.of(this.getSatzart(), getSparte());
}
} else {
return SatzTyp.of(this.getSatzart());
}
}
return SatzTyp.of(this.getSatzart());
}

/**
Expand Down

0 comments on commit 5d754c8

Please sign in to comment.