Browse Source

Stationshistorie NullPointer abgefangen, Datenvalidierung;

Hauptdiagnosefeld auf Fallübersichtsseite vergrößert
testBranch
Johannes 10 years ago
parent
commit
5a07665b75
3 changed files with 45 additions and 3 deletions
  1. +43
    -1
      src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java
  2. +1
    -1
      src/main/java/de/uniluebeck/mi/projmi6/db/MySqlConnectionFactory.java
  3. +1
    -1
      src/main/resources/fall.fxml

+ 43
- 1
src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java View File

@@ -166,9 +166,14 @@ public class StationsHistorieController {


@FXML @FXML
private void clickedSave() { private void clickedSave() {


if (getState() == State.CREATE) { if (getState() == State.CREATE) {
StationsHistorie stationsHistorie = new StationsHistorie(); StationsHistorie stationsHistorie = new StationsHistorie();
copyFieldDataIntoStationsHistorie(stationsHistorie); copyFieldDataIntoStationsHistorie(stationsHistorie);
if(!validateData(stationsHistorie)){
return;
}
try { try {
DBHandler.setStationsHistorie(stationsHistorie, false); DBHandler.setStationsHistorie(stationsHistorie, false);
} catch (SQLException e) { } catch (SQLException e) {
@@ -177,6 +182,9 @@ public class StationsHistorieController {
mainController.refreshCaseData(); mainController.refreshCaseData();
} else { } else {
copyFieldDataIntoStationsHistorie(stationsHistorieSelected); copyFieldDataIntoStationsHistorie(stationsHistorieSelected);
if(!validateData(stationsHistorieSelected)){
return;
}
try { try {
DBHandler.setStationsHistorie(stationsHistorieSelected, true); DBHandler.setStationsHistorie(stationsHistorieSelected, true);
} catch (SQLException e) { } catch (SQLException e) {
@@ -290,11 +298,45 @@ public class StationsHistorieController {
stationsHistorie.setEntlassungsDatum(dtTmEntlassung.getDateTime()); stationsHistorie.setEntlassungsDatum(dtTmEntlassung.getDateTime());
stationsHistorie.setStation(cmbStation.getValue()); stationsHistorie.setStation(cmbStation.getValue());
stationsHistorie.setFallID(mainController.getFallController().getFall().getFallID()); stationsHistorie.setFallID(mainController.getFallController().getFall().getFallID());
stationsHistorie.setStationKey(cmbStation.getValue().getStation());
if(cmbStation.getValue()!= null){
stationsHistorie.setStationKey(cmbStation.getValue().getStation());
}else{
stationsHistorie.setStationKey(null);
}
stationsHistorie.setErsteller(mainController.getCurrentMitarbeiter().getMitarbID()); stationsHistorie.setErsteller(mainController.getCurrentMitarbeiter().getMitarbID());
stationsHistorie.setBearbeiter(mainController.getCurrentMitarbeiter().getMitarbID()); stationsHistorie.setBearbeiter(mainController.getCurrentMitarbeiter().getMitarbID());
} }



private void showMessage(String title, String message) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Ung\u00fcltige Daten!");
alert.setHeaderText(title);
alert.setContentText(message);
alert.initModality(Modality.APPLICATION_MODAL);
alert.showAndWait();
}


private boolean validateData(StationsHistorie stationsHistorie){
if(stationsHistorie.getStationKey()==null){
showMessage("Keine Station ausgew\00e4hlt!", "Bitte Station und nicht nur Abteilung ausw\00e4hlen!");
return false;
}
if(stationsHistorie.getAufnahmeDatum()==null){
showMessage("Aufnahmedatum fehlt!", "Bitte den Beginn des Stationsaufenthalts angeben!");
return false;
}
if(stationsHistorie.getEntlassungsDatum() != null &&
stationsHistorie.getAufnahmeDatum().isAfter(stationsHistorie.getEntlassungsDatum())){
showMessage("Aufnahmedatum liegt hinter Entlassungsdatum!", "Bitte die eingegebenen Daten nocheinmal kontrollieren!");
return false;
}


return true;
}

private void clearFields(){ private void clearFields(){


statHistCreateTime.setText(""); statHistCreateTime.setText("");


+ 1
- 1
src/main/java/de/uniluebeck/mi/projmi6/db/MySqlConnectionFactory.java View File

@@ -8,7 +8,7 @@ import java.sql.SQLException;
* MySQL Connection Factory. * MySQL Connection Factory.
*/ */
public class MySqlConnectionFactory { public class MySqlConnectionFactory {
public static final String URL = "jdbc:mysql://141.83.20.84:3306/pmiw15g06_v01";
public static final String URL = "jdbc:mysql://localhost:3306/pmiw15g06_v01";
public static final String USER = "pmiw15g06"; public static final String USER = "pmiw15g06";
public static final String PASS = "AX3yQSYJSH43PrSz"; public static final String PASS = "AX3yQSYJSH43PrSz";
public static final String DRIVER = "com.mysql.jdbc.Driver"; public static final String DRIVER = "com.mysql.jdbc.Driver";


+ 1
- 1
src/main/resources/fall.fxml View File

@@ -40,7 +40,7 @@
<ComboBox fx:id="fallKasse" prefWidth="250.0" GridPane.columnIndex="1" GridPane.rowIndex="6"/> <ComboBox fx:id="fallKasse" prefWidth="250.0" GridPane.columnIndex="1" GridPane.rowIndex="6"/>


<Label text="Hauptdiagnose:" GridPane.rowIndex="7"/> <Label text="Hauptdiagnose:" GridPane.rowIndex="7"/>
<ComboBox fx:id="fallHauptdiagnose" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
<ComboBox fx:id="fallHauptdiagnose" prefWidth="350.0" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
</children> </children>
<columnConstraints> <columnConstraints>
<ColumnConstraints percentWidth="30" minWidth="200"/> <ColumnConstraints percentWidth="30" minWidth="200"/>


Loading…
Cancel
Save