#22: Setup Medication Model
All checks were successful
Quality Check / Qualty Check (push) Successful in 9s
All checks were successful
Quality Check / Qualty Check (push) Successful in 9s
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
This commit is contained in:
parent
cda74bbf82
commit
60b3d587ea
1 changed files with 149 additions and 0 deletions
149
src/main/java/de/hitec/nhplus/medication/Medication.java
Normal file
149
src/main/java/de/hitec/nhplus/medication/Medication.java
Normal file
|
@ -0,0 +1,149 @@
|
|||
package de.hitec.nhplus.medication;
|
||||
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleListProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
import java.util.StringJoiner;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Medication {
|
||||
private SimpleIntegerProperty id;
|
||||
private final SimpleStringProperty name;
|
||||
private final SimpleStringProperty manufacturer;
|
||||
private final SimpleListProperty<String> ingredients;
|
||||
private final SimpleStringProperty possibleSideEffects;
|
||||
private final SimpleStringProperty administrationMethod;
|
||||
private final SimpleIntegerProperty currentStock;
|
||||
|
||||
public Medication(
|
||||
String name,
|
||||
String manufacturer,
|
||||
ObservableList<String> ingredients,
|
||||
String possibleSideEffects,
|
||||
String administrationMethod,
|
||||
int currentStock
|
||||
) {
|
||||
this.name = new SimpleStringProperty(name);
|
||||
this.manufacturer = new SimpleStringProperty(manufacturer);
|
||||
this.ingredients = new SimpleListProperty<>(ingredients);
|
||||
this.possibleSideEffects = new SimpleStringProperty(possibleSideEffects);
|
||||
this.administrationMethod = new SimpleStringProperty(administrationMethod);
|
||||
this.currentStock = new SimpleIntegerProperty(currentStock);
|
||||
}
|
||||
|
||||
public Medication(
|
||||
int id,
|
||||
String name,
|
||||
String manufacturer,
|
||||
ObservableList<String> ingredients,
|
||||
String possibleSideEffects,
|
||||
String administrationMethod,
|
||||
int currentStock
|
||||
) {
|
||||
this.id = new SimpleIntegerProperty(id);
|
||||
this.name = new SimpleStringProperty(name);
|
||||
this.manufacturer = new SimpleStringProperty(manufacturer);
|
||||
this.ingredients = new SimpleListProperty<>(ingredients);
|
||||
this.possibleSideEffects = new SimpleStringProperty(possibleSideEffects);
|
||||
this.administrationMethod = new SimpleStringProperty(administrationMethod);
|
||||
this.currentStock = new SimpleIntegerProperty(currentStock);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id.get();
|
||||
}
|
||||
|
||||
public SimpleIntegerProperty idProperty() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name.get();
|
||||
}
|
||||
|
||||
public SimpleStringProperty nameProperty() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name.set(name);
|
||||
}
|
||||
|
||||
public String getManufacturer() {
|
||||
return manufacturer.get();
|
||||
}
|
||||
|
||||
public SimpleStringProperty manufacturerProperty() {
|
||||
return manufacturer;
|
||||
}
|
||||
|
||||
public void setManufacturer(String manufacturer) {
|
||||
this.manufacturer.set(manufacturer);
|
||||
}
|
||||
|
||||
public ObservableList<String> getIngredients() {
|
||||
return ingredients.get();
|
||||
}
|
||||
|
||||
public SimpleListProperty<String> ingredientsProperty() {
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
public void setIngredients(ObservableList<String> ingredients) {
|
||||
this.ingredients.set(ingredients);
|
||||
}
|
||||
|
||||
public String getPossibleSideEffects() {
|
||||
return possibleSideEffects.get();
|
||||
}
|
||||
|
||||
public SimpleStringProperty possibleSideEffectsProperty() {
|
||||
return possibleSideEffects;
|
||||
}
|
||||
|
||||
public void setPossibleSideEffects(String possibleSideEffects) {
|
||||
this.possibleSideEffects.set(possibleSideEffects);
|
||||
}
|
||||
|
||||
public String getAdministrationMethod() {
|
||||
return administrationMethod.get();
|
||||
}
|
||||
|
||||
public SimpleStringProperty administrationMethodProperty() {
|
||||
return administrationMethod;
|
||||
}
|
||||
|
||||
public void setAdministrationMethod(String administrationMethod) {
|
||||
this.administrationMethod.set(administrationMethod);
|
||||
}
|
||||
|
||||
public int getCurrentStock() {
|
||||
return currentStock.get();
|
||||
}
|
||||
|
||||
public SimpleIntegerProperty currentStockProperty() {
|
||||
return currentStock;
|
||||
}
|
||||
|
||||
public void setCurrentStock(int currentStock) {
|
||||
this.currentStock.set(currentStock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringJoiner(System.lineSeparator())
|
||||
.add("MEDICATION")
|
||||
.add("ID: " + this.getId())
|
||||
.add("Name: " + this.getName())
|
||||
.add("Manufacturer: " + this.getManufacturer())
|
||||
.add("Ingredients: " + this.getIngredients()
|
||||
.stream()
|
||||
.collect(Collectors.joining(", ", "[", "]")))
|
||||
.add("Possible Side Effects: " + this.getPossibleSideEffects())
|
||||
.add("Administration Method: " + this.getAdministrationMethod())
|
||||
.add("Current Stock: " + this.getCurrentStock())
|
||||
.toString();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue