Compare commits
10 Commits
c8e088fd1e
...
d7d32904da
| Author | SHA1 | Date | |
|---|---|---|---|
| d7d32904da | |||
| 126d12201b | |||
| 2c9492938e | |||
| be122fec9a | |||
| 9462bb0b94 | |||
| d7a8788209 | |||
| eeb4576fc1 | |||
| ffc79f6d84 | |||
| 13c8400c2f | |||
| 64e94406fa |
25
.idea/workspace.xml
generated
25
.idea/workspace.xml
generated
@@ -9,6 +9,7 @@
|
||||
</loaded-modules>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e0e5f782-08ef-4945-a944-b4866593efbf" name="Changes" comment="" />
|
||||
<list default="true" id="00dc40a5-3207-4d4d-ae00-ffe7eaa81775" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
||||
@@ -25,17 +26,12 @@
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="master" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 8
|
||||
"associatedIndex": 6
|
||||
}</component>
|
||||
<component name="ProjectId" id="2wRIijNOwoQxuuIt4B8RQT7LOP7" />
|
||||
<component name="ProjectId" id="2gUubiSM5Jut9YVYFBVLdNg69es" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
@@ -45,6 +41,9 @@
|
||||
"Maven.OMDSServiceDefinition clean package.executor": "Run",
|
||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "develop2",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Users/Lukas/IdeaProjects/omdsservicedefinitions",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"git-widget-placeholder": "feature/aenderungen",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
@@ -58,23 +57,25 @@
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunManager" selected="Maven.CodeGen OMDSServiceDefinition" />
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
<option value="bundled-jdk-9823dce3aa75-fbdcb00ec9e3-intellij.indexing.shared.core-IU-251.23774.435" />
|
||||
<option value="bundled-js-predefined-d6986cc7102b-f27c65a3e318-JavaScript-IU-251.23774.435" />
|
||||
<option value="bundled-jdk-9823dce3aa75-28b599e66164-intellij.indexing.shared.core-IU-242.24807.4" />
|
||||
<option value="bundled-js-predefined-d6986cc7102b-5c90d61e3bab-JavaScript-IU-242.24807.4" />
|
||||
</set>
|
||||
</attachedChunks>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="00dc40a5-3207-4d4d-ae00-ffe7eaa81775" name="Changes" comment="" />
|
||||
<created>1745998089296</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1745998089296</updated>
|
||||
<workItem from="1745998090566" duration="199000" />
|
||||
<workItem from="1745998342521" duration="1875000" />
|
||||
<updated>1715764550395</updated>
|
||||
<workItem from="1715764551681" duration="125000" />
|
||||
<workItem from="1744355646461" duration="35000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
1
OMDSServiceDefinition/.gitignore
vendored
1
OMDSServiceDefinition/.gitignore
vendored
@@ -2,4 +2,5 @@
|
||||
/docGen/
|
||||
/out
|
||||
/auxil
|
||||
/.idea/workspace.xml
|
||||
|
||||
|
||||
@@ -118,55 +118,98 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- <plugin>-->
|
||||
<!-- <!– Lizenz: Berkeley Software Distribution, frei –>-->
|
||||
<!-- <groupId>org.jvnet.jaxb</groupId>-->
|
||||
<!-- <artifactId>jaxb-maven-plugin</artifactId>-->
|
||||
<!-- <version>4.0.0</version>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>generate</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <extension>true</extension>-->
|
||||
<!-- <locale>en</locale>-->
|
||||
<!-- <schemaLanguage>XMLSCHEMA</schemaLanguage>-->
|
||||
<!-- <schemaDirectory >${project.basedir}/src/main/resources/def/${currentReleaseDir}</schemaDirectory>-->
|
||||
<!-- <schemaDirectory >${project.basedir}/src/main/resources/def/${currentReleaseDir}</schemaDirectory>-->
|
||||
<!-- <bindingDirectory>${project.basedir}/src/main/resources/def/${currentReleaseDir}</bindingDirectory>-->
|
||||
<!-- <schemaIncludes>-->
|
||||
<!-- <include>*.xsd</include>-->
|
||||
<!-- </schemaIncludes>-->
|
||||
<!-- <bindingIncludes>-->
|
||||
<!-- <include>*.xjb</include>-->
|
||||
<!-- </bindingIncludes>-->
|
||||
<!-- <args>-->
|
||||
<!-- <arg>-Xannotate</arg>-->
|
||||
<!-- <arg>-Xinheritance</arg>-->
|
||||
<!-- </args>-->
|
||||
|
||||
<!-- <plugins>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.jvnet.jaxb</groupId>-->
|
||||
<!-- <artifactId>jaxb-plugins</artifactId>-->
|
||||
<!-- <version>3.0.0</version>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.jvnet.jaxb</groupId>-->
|
||||
<!-- <artifactId>jaxb-plugin-annotate</artifactId>-->
|
||||
<!-- <version>3.0.0</version>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- </plugins>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- </plugin>-->
|
||||
|
||||
<plugin>
|
||||
<!-- Lizenz: Berkeley Software Distribution, frei -->
|
||||
<groupId>org.jvnet.jaxb</groupId>
|
||||
<artifactId>jaxb-maven-plugin</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-codegen-plugin</artifactId>
|
||||
<version>4.1.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
|
||||
<wsdlOptions>
|
||||
<wsdlOption>
|
||||
<wsdl>${project.basedir}/src/main/resources/def/${currentReleaseDir}/omds3Services.wsdl</wsdl>
|
||||
<extraargs>
|
||||
<extraarg>-xjc-Xannotate</extraarg>
|
||||
<extraarg>-client</extraarg>
|
||||
<extraarg>-impl</extraarg>
|
||||
<extraarg>-server</extraarg>
|
||||
<extraarg>-p</extraarg>
|
||||
<extraarg>at.vvo.omds.services</extraarg>
|
||||
</extraargs>
|
||||
<bindingFiles>
|
||||
<bindingFile>${project.basedir}/src/main/resources/def/${currentReleaseDir}/binding.xjb</bindingFile>
|
||||
</bindingFiles>
|
||||
</wsdlOption>
|
||||
</wsdlOptions>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
<goal>wsdl2java</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<extension>true</extension>
|
||||
<locale>en</locale>
|
||||
<schemaLanguage>XMLSCHEMA</schemaLanguage>
|
||||
<schemaDirectory >${project.basedir}/src/main/resources/def/${currentReleaseDir}</schemaDirectory>
|
||||
<schemaDirectory >${project.basedir}/src/main/resources/def/${currentReleaseDir}</schemaDirectory>
|
||||
<bindingDirectory>${project.basedir}/src/main/resources/def/${currentReleaseDir}</bindingDirectory>
|
||||
<schemaIncludes>
|
||||
<include>*.xsd</include>
|
||||
</schemaIncludes>
|
||||
<bindingIncludes>
|
||||
<include>*.xjb</include>
|
||||
</bindingIncludes>
|
||||
<args>
|
||||
<arg>-Xannotate</arg>
|
||||
<arg>-Xinheritance</arg>
|
||||
</args>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jvnet.jaxb</groupId>
|
||||
<artifactId>jaxb-plugins</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jvnet.jaxb</groupId>
|
||||
<artifactId>jaxb-plugin-annotate</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jvnet.jaxb</groupId>
|
||||
<artifactId>jaxb-plugin-annotate</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
<version>0.0.8</version>
|
||||
<configuration>
|
||||
<mainClass>${project.basedir}/src/main/java/at/vvo/omds/client/gui/AllinOneView.java</mainClass>
|
||||
<mainClass>at.vvo.omds.client.gui.MainView</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@@ -204,12 +247,77 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
|
||||
|
||||
<dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-controls -->
|
||||
<!-- MIT License https://openjdk.java.net/legal/gplv2+ce.html-->
|
||||
<!-- GPLv2+CE License https://openjdk.java.net/legal/gplv2+ce.html-->
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
<version>23.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.controlsfx/controlsfx -->
|
||||
<!-- The 3-Clause BSD License http://www.opensource.org/licenses/bsd-license.php -->
|
||||
<groupId>org.controlsfx</groupId>
|
||||
<artifactId>controlsfx</artifactId>
|
||||
<version>11.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.jvnet.jaxb2_commons/jaxb2-basics-annotate -->
|
||||
<!-- BSD 2-Clause License http://opensource.org/licenses/BSD-2-Clause-->
|
||||
<groupId>org.jvnet.jaxb2_commons</groupId>
|
||||
<artifactId>jaxb2-basics-annotate</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-maven-plugin -->
|
||||
<!-- The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt -->
|
||||
<groupId>com.sun.xml.ws</groupId>
|
||||
<artifactId>jaxws-maven-plugin</artifactId>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-restclient -->
|
||||
<!-- The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt -->
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-restclient</artifactId>
|
||||
<version>4.0.0-M3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
||||
<!-- The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt -->
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.20.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.eclipse.rdf4j/rdf4j-model -->
|
||||
<!-- Eclipse Distribution License v1.0 https://eclipse.org/org/documents/edl-v10.php-->
|
||||
<groupId>org.eclipse.rdf4j</groupId>
|
||||
<artifactId>rdf4j-model</artifactId>
|
||||
<version>5.1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.eclipse.rdf4j/rdf4j-rio-turtle -->
|
||||
<!-- Eclipse Distribution License v1.0 https://eclipse.org/org/documents/edl-v10.php-->
|
||||
<groupId>org.eclipse.rdf4j</groupId>
|
||||
<artifactId>rdf4j-rio-turtle</artifactId>
|
||||
<version>5.1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.eclipse.rdf4j/rdf4j-shacl -->
|
||||
<!-- Eclipse Distribution License v1.0 https://eclipse.org/org/documents/edl-v10.php-->
|
||||
<groupId>org.eclipse.rdf4j</groupId>
|
||||
<artifactId>rdf4j-shacl</artifactId>
|
||||
<version>5.1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.eclipse.rdf4j/rdf4j-rio-jsonld -->
|
||||
<!-- Eclipse Distribution License v1.0 https://eclipse.org/org/documents/edl-v10.php-->
|
||||
<groupId>org.eclipse.rdf4j</groupId>
|
||||
<artifactId>rdf4j-rio-jsonld</artifactId>
|
||||
<version>5.1.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter -->
|
||||
|
||||
@@ -37,8 +37,6 @@ public class BuildRequestHelper {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static XMLGregorianCalendar aktuellesDatum() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ss");
|
||||
try {
|
||||
|
||||
@@ -34,7 +34,6 @@ public class UnfallCalcService {
|
||||
response.getBerechnungsantwort().getVerkaufsprodukt().getPraemie().stream().findFirst()
|
||||
.ifPresent(praemieType -> verkaufsproduktUnfall.setPraemie(praemieType.getPraemieBto()));
|
||||
|
||||
|
||||
return verkaufsproduktUnfall;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package at.vvo.omds.client.api;
|
||||
|
||||
public interface UnterbausteinInterface extends ProduktbausteinInterface {
|
||||
|
||||
}
|
||||
@@ -1,748 +0,0 @@
|
||||
package at.vvo.omds.client.gui;
|
||||
|
||||
import at.vvo.omds.client.gui.api.apriori.AprioriAuskunftService;
|
||||
import at.vvo.omds.client.gui.api.calc.CalculateRequestAuskunftService;
|
||||
import at.vvo.omds.client.gui.api.SOAPConnector;
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.*;
|
||||
import at.vvo.omds.types.omds3.r2025_05.on2antrag.common.*;
|
||||
import com.sun.xml.messaging.saaj.SOAPExceptionImpl;
|
||||
import javafx.animation.PauseTransition;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.text.*;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Duration;
|
||||
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class AllinOneView extends Application {
|
||||
|
||||
Map<String, Integer> timesItemisIncludedById = new HashMap<>();
|
||||
List<TreeItem<Object>> isNotIncluded = new ArrayList<>();
|
||||
Map<TreeItem<Object>, Map<AttributType, String>> infoBoxFromItem = new HashMap<>();
|
||||
|
||||
TextFlow logFlow = new TextFlow();
|
||||
TreeHelper treeHelper = new TreeHelper();
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
AprioriAuskunftService s = new AprioriAuskunftService(new SOAPConnector());
|
||||
|
||||
stage.setTitle("OMDS Client");
|
||||
stage.getIcons().add(new Image(AllinOneView.class.getResourceAsStream("/logo/VVO_Logo_2024.png")));
|
||||
|
||||
final VBox[] controlBox = {new VBox()};
|
||||
DatePicker dp = new DatePicker();
|
||||
ChoiceBox<String> vpBox = new ChoiceBox<>();
|
||||
|
||||
vpBox.setValue("Verkaufsprodukt auswählen ");
|
||||
vpBox.setVisible(false);
|
||||
vpBox.setPadding(new Insets(0, 10, 0, 0));
|
||||
|
||||
AtomicReference<XMLGregorianCalendar> stichtag = new AtomicReference<>();
|
||||
AtomicReference<ProductsResponse> response = new AtomicReference<>();
|
||||
Button newCalcRequestButton = new Button("Calculate");
|
||||
HBox newCalcRequestControlBox = new HBox();
|
||||
newCalcRequestControlBox.setVisible(false);
|
||||
newCalcRequestControlBox.setPadding(new Insets(10, 10, 10, 10));
|
||||
newCalcRequestControlBox.getChildren().add(newCalcRequestButton);
|
||||
dp.setOnAction(e -> {
|
||||
try {
|
||||
stichtag.set(stichtagEvent(dp));
|
||||
if (stichtagEvent(dp) != null) {
|
||||
try {
|
||||
response.set(s.aprioriAuskunft(stichtag.get(), "042"));
|
||||
} catch (NoSuchElementException ex) {
|
||||
controlBox[0].getChildren().clear();
|
||||
controlBox[0].getChildren().add(dp);
|
||||
vpBox.getItems().clear();
|
||||
|
||||
Text text = new Text("Kein Verkaufsoffenes Produkt an dem Datum: " +
|
||||
stichtag.get().toString().substring(0, stichtag.get().toString().length() - 1) +
|
||||
System.lineSeparator());
|
||||
text.setFill(Paint.valueOf("#dd0000"));
|
||||
logFlow.getChildren().add(text);
|
||||
throw new NoSuchElementException(ex.getMessage());
|
||||
} catch (SOAPExceptionImpl ex) {
|
||||
HBox errorBox = new HBox();
|
||||
errorBox.setAlignment(Pos.CENTER);
|
||||
errorBox.setPadding(new Insets(10, 10, 10, 10));
|
||||
errorBox.getChildren().add(new Text("Keine Verbindung zum Server möglich!"));
|
||||
|
||||
controlBox[0].getChildren().add(errorBox);
|
||||
}
|
||||
newCalcRequestControlBox.setVisible(true);
|
||||
|
||||
if (response.get().getVerkaufsprodukt().size() > 1) {
|
||||
|
||||
if (!vpBox.getItems().isEmpty()) {
|
||||
vpBox.getItems().clear();
|
||||
}
|
||||
for (APrioriVerkaufsproduktType vp : response.get().getVerkaufsprodukt()) {
|
||||
vpBox.getItems().add(vp.getName());
|
||||
}
|
||||
vpBox.setVisible(true);
|
||||
vpBox.setOnAction(ee -> {
|
||||
for (int i = 0; i < response.get().getVerkaufsprodukt().size(); i++) {
|
||||
if (vpBox.getSelectionModel().getSelectedItem() != null && vpBox.getSelectionModel()
|
||||
.getSelectedItem().equals(response.get().getVerkaufsprodukt().get(i).getName())) {
|
||||
try {
|
||||
controlBox[0] = buttonAuskunft(response.get().getVerkaufsprodukt().get(i),
|
||||
controlBox[0], newCalcRequestButton, stichtag);
|
||||
controlBox[0].getChildren().add(newCalcRequestControlBox);
|
||||
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
controlBox[0] = buttonAuskunft(response.get().getVerkaufsprodukt().getFirst(),
|
||||
controlBox[0], newCalcRequestButton, stichtag);
|
||||
}
|
||||
if (!controlBox[0].getChildren().contains(newCalcRequestControlBox)) {
|
||||
controlBox[0].getChildren().add(newCalcRequestControlBox);
|
||||
}
|
||||
} else {
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||
alert.setTitle("Error");
|
||||
alert.setHeaderText("Invalid Date");
|
||||
alert.showAndWait();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
VBox.setVgrow(newCalcRequestControlBox, Priority.ALWAYS);
|
||||
newCalcRequestControlBox.setAlignment(Pos.BOTTOM_RIGHT);
|
||||
|
||||
HBox aprioriControlBox = new HBox();
|
||||
aprioriControlBox.setPadding(new Insets(10, 10, 0, 10));
|
||||
aprioriControlBox.getChildren().addAll(dp, vpBox);
|
||||
controlBox[0].getChildren().addAll(aprioriControlBox);
|
||||
|
||||
Scene scene = new Scene(controlBox[0], 900, 700);
|
||||
stage.setScene(scene);
|
||||
|
||||
stage.show();
|
||||
}
|
||||
|
||||
|
||||
public XMLGregorianCalendar stichtagEvent(DatePicker dp) throws DatatypeConfigurationException {
|
||||
if (dp.getValue() == null) {
|
||||
return null;
|
||||
}
|
||||
int day = dp.getValue().getDayOfMonth();
|
||||
int month = dp.getValue().getMonthValue();
|
||||
int year = dp.getValue().getYear();
|
||||
|
||||
return DatatypeFactory.newInstance().newXMLGregorianCalendarDate(year, month, day, 0);
|
||||
}
|
||||
|
||||
public VBox buttonAuskunft(APrioriVerkaufsproduktType verkaufsprodukt, VBox vbox, Button newCalcRequest,
|
||||
AtomicReference<XMLGregorianCalendar> stichtag) throws Exception {
|
||||
while (vbox.getChildren().size() > 1) {
|
||||
vbox.getChildren().removeLast();
|
||||
}
|
||||
|
||||
VBox treeBox = new VBox();
|
||||
VBox infoBox = new VBox();
|
||||
|
||||
ScrollPane logPane = new ScrollPane(logFlow);
|
||||
|
||||
if (!logFlow.getChildren().isEmpty()) treeHelper.setLogFlow(logFlow);
|
||||
TreeItem<Object> vkp = treeHelper.aprioriItemToCalcItem(new TreeItem<>(verkaufsprodukt));
|
||||
vkp.setExpanded(true);
|
||||
|
||||
treeHelper.messageToTree(verkaufsprodukt, vkp);
|
||||
|
||||
logFlow = treeHelper.getLogFlow();
|
||||
|
||||
TreeView<Object> tv = new TreeView<>(vkp);
|
||||
|
||||
tv.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
|
||||
if (newSelection != null) {
|
||||
if (!infoBox.getChildren().isEmpty()) {
|
||||
infoBox.getChildren().removeAll(infoBox.getChildren());
|
||||
}
|
||||
|
||||
ItemAttribute itemAttribute = new ItemAttribute();
|
||||
if (!infoBoxFromItem.isEmpty()) itemAttribute.setInfoBoxFromItem(infoBoxFromItem);
|
||||
itemAttribute.addItemInfo(newSelection, infoBox);
|
||||
infoBoxFromItem = itemAttribute.getInfoBoxFromItem();
|
||||
// addItemInfo(newSelection, infoBox);
|
||||
}else{
|
||||
infoBox.getChildren().removeAll(infoBox.getChildren());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
final TreeItem<Object> originalRoot = treeHelper.cloneTreeItem(tv.getRoot());
|
||||
tv.setCellFactory(tc -> new TreeCell<>() {
|
||||
@Override
|
||||
public void updateItem(Object item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item == null || empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
setStyle("");
|
||||
} else {
|
||||
HBox cellBox = new HBox();
|
||||
Button include = new Button("+");
|
||||
include.setStyle("-fx-margin: 5;");
|
||||
Label label = new Label(((ProduktbausteinType) item).getBezeichnung() + " ");
|
||||
Button remove = new Button("-");
|
||||
|
||||
remove.setVisible(true);
|
||||
remove.setFont(Font.font("System", FontWeight.BOLD, include.getFont().getSize() + 2));
|
||||
remove.setPadding(new Insets(0, 5, 0, 5));
|
||||
|
||||
include.setFont(Font.font("System", FontWeight.BOLD, include.getFont().getSize() + 2));
|
||||
include.setPadding(new Insets(0, 5, 0, 5));
|
||||
|
||||
if (!shouldBeIncluded(getTreeItem())) {
|
||||
label.setFont(Font.font("System", FontPosture.ITALIC, label.getFont().getSize()));
|
||||
label.setTextFill(Paint.valueOf("#A0A0A0"));
|
||||
if (!isNotIncluded.contains(getTreeItem())) {
|
||||
isNotIncluded.add(getTreeItem());
|
||||
}
|
||||
remove.setDisable(true);
|
||||
remove.setStyle("-fx-background-color: #CCCCCC");
|
||||
} else {
|
||||
label.setTextFill(Paint.valueOf("#000000"));
|
||||
remove.setVisible(true);
|
||||
|
||||
isNotIncluded.remove(getTreeItem());
|
||||
}
|
||||
|
||||
Region spacer = new Region();
|
||||
HBox.setHgrow(spacer, Priority.ALWAYS);
|
||||
Label spacer2 = new Label(" ");
|
||||
|
||||
label.setMaxWidth(Double.MAX_VALUE);
|
||||
|
||||
if (!(getTreeItem().getValue() instanceof VerkaufsproduktType)) {
|
||||
System.out.println(((ProduktbausteinType) getTreeItem().getValue()).getBezeichnung());
|
||||
System.out.println(timesItemisIncludedById.get(
|
||||
((ProduktbausteinType) getTreeItem().getValue()).getId()) != null);
|
||||
System.out.println("...");
|
||||
System.out.println(((ProduktbausteinType) getTreeItem().getValue()).getMaxVorkommen() != null
|
||||
&& ((ProduktbausteinType) getTreeItem().getValue()).getMaxVorkommen() >=
|
||||
timeItemIsIncludedByParent(getTreeItem().getParent(),
|
||||
((ProduktbausteinType) getTreeItem().getValue()).getId()));
|
||||
System.out.println("...");
|
||||
System.out.println(timeItemIsIncludedByParent(getTreeItem().getParent(),
|
||||
((ProduktbausteinType) getTreeItem().getValue()).getId()));
|
||||
System.out.println("...");
|
||||
System.out.println(((ProduktbausteinType) getTreeItem().getValue()).getMaxVorkommen() != null);
|
||||
System.out.println("-----------------------------------------------------------------------------");
|
||||
}
|
||||
if (getTreeItem().getValue() instanceof VerkaufsproduktType ||
|
||||
getTreeItem().getValue().getClass().equals(APrioriVerkaufsproduktType.class)) {
|
||||
cellBox.getChildren().addAll(label);
|
||||
} else if (timesItemisIncludedById.get(
|
||||
((ProduktbausteinType) getTreeItem().getValue()).getId()) != null
|
||||
&& ((ProduktbausteinType) getTreeItem().getValue()).getMaxVorkommen() != null
|
||||
&& ((ProduktbausteinType) getTreeItem().getValue()).getMaxVorkommen() <=
|
||||
timeItemIsIncludedByParent(getTreeItem().getParent(),
|
||||
((ProduktbausteinType) getTreeItem().getValue()).getId())) {
|
||||
include.setDisable(true);
|
||||
include.setStyle("-fx-background-color: #CCCCCC");
|
||||
cellBox.getChildren().addAll(label, spacer, include, spacer2, remove);
|
||||
} else {
|
||||
cellBox.getChildren().addAll(label, spacer, include, spacer2, remove);
|
||||
}
|
||||
|
||||
include.setOnAction(e -> {
|
||||
if (isNotIncluded.contains(getTreeItem())) {
|
||||
label.setFont(Font.font("System", label.getFont().getSize()));
|
||||
label.setTextFill(Paint.valueOf("#000000"));
|
||||
remove.setVisible(true);
|
||||
|
||||
timesItemisIncludedById.put(((ProduktbausteinType) getTreeItem().getValue()).getId(),
|
||||
(timesItemisIncludedById.get(
|
||||
((ProduktbausteinType) getTreeItem().getValue()).getId()) != null ?
|
||||
timesItemisIncludedById.get(
|
||||
((ProduktbausteinType) getTreeItem().getValue()).getId()) + 1 : 1));
|
||||
|
||||
isNotIncluded.remove(getTreeItem());
|
||||
includeAddedParent(getTreeItem());
|
||||
includeAddedChildren(getTreeItem());
|
||||
tv.setRoot(treeHelper.sortTree(tv.getRoot()));
|
||||
tv.refresh();
|
||||
|
||||
timesItemisIncludedById.clear();
|
||||
refreshTimesItemisIncludedById(tv.getRoot());
|
||||
} else {
|
||||
TreeItem<Object> parent = getTreeItem().getParent();
|
||||
TreeItem<Object> clone = null;
|
||||
try {
|
||||
clone = treeHelper.cloneTreeItem(
|
||||
treeHelper.findTreeItem((ProduktbausteinType) item, originalRoot));
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
parent.getChildren().add(clone);
|
||||
|
||||
refreshIsNotIncluded(clone, originalRoot);
|
||||
|
||||
timesItemisIncludedById.clear();
|
||||
refreshTimesItemisIncludedById(tv.getRoot());
|
||||
|
||||
tv.setRoot(treeHelper.sortTree(tv.getRoot()));
|
||||
tv.refresh();
|
||||
}
|
||||
});
|
||||
|
||||
remove.setOnAction(e -> {
|
||||
Map<String, Integer> countByParent = new HashMap<>();
|
||||
Map<String, Integer> countByAprioriParent = new HashMap<>();
|
||||
timesItemisIncludedById.clear();
|
||||
refreshTimesItemisIncludedById(tv.getRoot());
|
||||
timesItemisIncludedById.replace(((ProduktbausteinType) item).getId(),
|
||||
timesItemisIncludedById.get(((ProduktbausteinType) item).getId()) - 1);
|
||||
|
||||
if (countChildIds(countByParent, getTreeItem().getParent()).get
|
||||
(((ProduktbausteinType) item).getId()).equals(countChildIds(countByAprioriParent,
|
||||
treeHelper.findTreeItem(((ProduktbausteinType) item), originalRoot).getParent()).get(
|
||||
((ProduktbausteinType) item).getId()))) {
|
||||
label.setFont(Font.font("System", label.getFont().getSize()));
|
||||
label.setTextFill(Paint.valueOf("#A0A0A0"));
|
||||
remove.setVisible(false);
|
||||
|
||||
isNotIncluded.add(getTreeItem());
|
||||
includeAddedChildren(getTreeItem());
|
||||
|
||||
tv.setRoot(treeHelper.sortTree(tv.getRoot()));
|
||||
tv.refresh();
|
||||
} else {
|
||||
getTreeItem().getParent().getChildren().remove((getTreeItem()));
|
||||
}
|
||||
timesItemisIncludedById.clear();
|
||||
refreshTimesItemisIncludedById(tv.getRoot());
|
||||
});
|
||||
|
||||
if(((ProduktbausteinType) item).getMeldungen() != null && !((ProduktbausteinType) item).getMeldungen().isEmpty()) {
|
||||
AtomicBoolean symboleAdded = new AtomicBoolean(false);
|
||||
Text symbole = new Text("\u26A0 ");
|
||||
symbole.setFont(Font.font("System", FontWeight.BOLD, symbole.getFont().getSize() + 2));
|
||||
|
||||
|
||||
((ProduktbausteinType) item).getMeldungen().forEach(m -> {
|
||||
if(m.getErrorType().equals(BigInteger.ONE)) {
|
||||
symbole.setFill(Paint.valueOf("#aa3333"));
|
||||
symboleAdded.set(true);
|
||||
}
|
||||
if (m.getErrorType().equals(BigInteger.TWO) && !symboleAdded.get()) {
|
||||
symbole.setFill(Paint.valueOf("#ccbb00"));
|
||||
}
|
||||
});
|
||||
cellBox.getChildren().addFirst(symbole);
|
||||
}else {
|
||||
if (cellBox.getChildren().getFirst() instanceof Text && ((Text)cellBox.getChildren().getFirst()).getText().equals("\u26A0")) {
|
||||
cellBox.getChildren().removeFirst();
|
||||
}
|
||||
}
|
||||
setGraphic(cellBox);
|
||||
setText(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
newCalcRequest.setOnAction(e -> {
|
||||
try {
|
||||
treeHelper.setIsNotIncluded(isNotIncluded);
|
||||
TreeItem<Object> cleanedRoot = treeHelper.cleanTree(tv.getRoot());
|
||||
|
||||
CalculateRequestAuskunftService s = new CalculateRequestAuskunftService(new SOAPConnector());
|
||||
CalculateResponse calcResponse = s.aprioriAuskunft(new TreeView<>(cleanedRoot), stichtag.get());
|
||||
TreeItem<Object> newRoot = new TreeItem<>(cleanedRoot.getValue());
|
||||
treeHelper.setTimesItemisIncludedById(timesItemisIncludedById);
|
||||
treeHelper.calcMessageToTree(calcResponse.getBerechnungsantwort().getVerkaufsprodukt(), newRoot);
|
||||
timesItemisIncludedById = treeHelper.getTimesItemisIncludedById();
|
||||
newRoot.setExpanded(true);
|
||||
isNotIncluded.clear();
|
||||
if (!isMeldungVorhanden(calcResponse.getBerechnungsantwort().getVerkaufsprodukt())) {
|
||||
|
||||
Text text = new Text(LocalDateTime.now() + ": Gültiges Verkaufsprodukt " + System.lineSeparator());
|
||||
text.setFill(Paint.valueOf("#00bb33"));
|
||||
logFlow.getChildren().add(text);
|
||||
treeBox.setStyle("-fx-border-color: #00bb33");
|
||||
|
||||
PauseTransition pause = new PauseTransition(Duration.seconds(3));
|
||||
pause.setOnFinished(ep -> treeBox.setStyle("-fx-border-color: #000000"));
|
||||
pause.play();
|
||||
|
||||
}else {
|
||||
Text text = new Text(LocalDateTime.now() + ": Kein Gültiges Verkaufsprodukt " + System.lineSeparator());
|
||||
text.setFill(Paint.valueOf("#aa3333"));
|
||||
logFlow.getChildren().add(text);
|
||||
|
||||
}
|
||||
|
||||
newRoot = treeHelper.addAprioriToCalc(newRoot, originalRoot);
|
||||
newRoot = treeHelper.sortTree(newRoot);
|
||||
tv.setRoot(newRoot);
|
||||
timesItemisIncludedById.clear();
|
||||
|
||||
refreshTimesItemisIncludedById(tv.getRoot());
|
||||
|
||||
tv.refresh();
|
||||
|
||||
for (int j = 0; j < calcResponse.getBerechnungsantwort().getVerkaufsprodukt().getMeldungen().size(); j++) {
|
||||
Text text = new Text(LocalDateTime.now() + " :"
|
||||
+ calcResponse.getBerechnungsantwort().getVerkaufsprodukt().getMeldungen().get(j).getErrorMsg()
|
||||
+ System.lineSeparator());
|
||||
|
||||
if (calcResponse.getBerechnungsantwort().getVerkaufsprodukt().getMeldungen().get(j).getErrorType()
|
||||
.equals(BigInteger.ONE)) {
|
||||
text.setFill(Paint.valueOf("#dd0000"));
|
||||
} else if (calcResponse.getBerechnungsantwort().getVerkaufsprodukt().getMeldungen().get(j).getErrorType()
|
||||
.equals(BigInteger.TWO)) {
|
||||
text.setFill(Paint.valueOf("#bbbb00"));
|
||||
} else {
|
||||
text.setFill(Paint.valueOf("#000000"));
|
||||
}
|
||||
|
||||
logFlow.getChildren().add(text);
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (!treeBox.getChildren().isEmpty()) {
|
||||
treeBox.getChildren().clear();
|
||||
}
|
||||
|
||||
tv.setRoot(treeHelper.sortTree(tv.getRoot()));
|
||||
|
||||
VBox.setVgrow(tv, Priority.ALWAYS);
|
||||
tv.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
tv.setStyle("-fx-border-color: white;");
|
||||
|
||||
treeBox.getChildren().add(tv);
|
||||
treeBox.setPadding(new Insets(10));
|
||||
treeBox.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
HBox.setHgrow(treeBox, Priority.ALWAYS);
|
||||
treeBox.setStyle("-fx-border-color: black; -fx-background-color: white");
|
||||
|
||||
infoBox.setStyle("-fx-border-color: black; -fx-background-color: white");
|
||||
infoBox.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
HBox.setHgrow(infoBox, Priority.ALWAYS);
|
||||
|
||||
HBox splitBox = new HBox(treeBox, infoBox);
|
||||
splitBox.setSpacing(10);
|
||||
splitBox.setPadding(new Insets(20));
|
||||
splitBox.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
|
||||
VBox wrapper = new VBox(splitBox);
|
||||
wrapper.setAlignment(Pos.CENTER);
|
||||
VBox.setVgrow(splitBox, Priority.ALWAYS);
|
||||
|
||||
HBox logWrapper = new HBox();
|
||||
logWrapper.setPadding(new Insets(0, 20, 20, 20)); // Abstand zum Rand unten + Seite
|
||||
logWrapper.setAlignment(Pos.CENTER_LEFT);
|
||||
logWrapper.setMaxWidth(Double.MAX_VALUE);
|
||||
|
||||
logFlow.setDisable(true);
|
||||
logFlow.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
logFlow.setPadding(new Insets(20));
|
||||
logFlow.setStyle("-fx-border-color: black; -fx-background-color: white;");
|
||||
HBox.setMargin(logFlow, new Insets(10, 20, 10, 20));
|
||||
|
||||
logPane.setContent(logFlow);
|
||||
logPane.setFitToWidth(true);
|
||||
logPane.setFitToHeight(true);
|
||||
logPane.setMaxHeight(200);
|
||||
|
||||
HBox.setHgrow(logPane, Priority.ALWAYS);
|
||||
logWrapper.getChildren().add(logPane);
|
||||
|
||||
vbox.getChildren().addAll(wrapper, logWrapper);
|
||||
VBox.setVgrow(wrapper, Priority.ALWAYS);
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
||||
private boolean isMeldungVorhanden(ProduktbausteinType produkt) {
|
||||
if (produkt != null && produkt.getMeldungen() != null && !produkt.getMeldungen().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
for (ProduktbausteinType child : produkt.getBausteine()){
|
||||
if(isMeldungVorhanden(child)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// private void addMeldungen(TreeItem<Object> newRoot, TextFlow logFlow, Node tv) {
|
||||
// if (!((ProduktbausteinType)newRoot.getValue()).getMeldungen().isEmpty()) {
|
||||
// PauseTransition pause = new PauseTransition(Duration.seconds(5));
|
||||
//
|
||||
// pause.play();
|
||||
//
|
||||
// for (ServiceFault s : ((ProduktbausteinType)newRoot.getValue()).getMeldungen()) {
|
||||
// logFlow.getChildren().add(new Text(s.getErrorMsg() + System.lineSeparator()));
|
||||
//
|
||||
// if (tv != null) tv.setStyle("-fx-background-color: #aa3333");
|
||||
// }
|
||||
// }
|
||||
// if (!newRoot.getChildren().isEmpty()) {
|
||||
// for (TreeItem<Object> child : newRoot.getChildren()) {
|
||||
// addMeldungen(child, logFlow, child.getGraphic());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private void includeAddedParent(TreeItem<Object> treeItem) {
|
||||
if (treeItem.getParent() != null) {
|
||||
isNotIncluded.remove(treeItem.getParent());
|
||||
if (treeItem.getParent().getParent() != null) {
|
||||
includeAddedParent(treeItem.getParent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void includeAddedChildren(TreeItem<Object> parent) {
|
||||
for (int i = 0; i < parent.getChildren().size(); i++) {
|
||||
isNotIncluded.remove(parent.getChildren().get(i));
|
||||
|
||||
if (!shouldBeIncluded(parent.getChildren().get(i)) && !isNotIncluded.contains(parent.getChildren().get(i))) {
|
||||
isNotIncluded.add(parent.getChildren().get(i));
|
||||
} else {
|
||||
isNotIncluded.remove(parent.getChildren().get(i));
|
||||
}
|
||||
|
||||
if (!parent.getChildren().get(i).getChildren().isEmpty() && parent.getChildren().get(i).getChildren() != null) {
|
||||
includeAddedChildren(parent.getChildren().get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshIsNotIncluded(TreeItem<Object> clone, TreeItem<Object> originalRoot) {
|
||||
for (int i = 0; i < clone.getChildren().size(); i++) {
|
||||
if (isNotIncluded.contains(treeHelper.findTreeItem(
|
||||
((ProduktbausteinType) clone.getChildren().get(i).getValue()), originalRoot)) ||
|
||||
((ProduktbausteinType) clone.getChildren().get(i).getValue()).getMinVorkommen() == 0) {
|
||||
isNotIncluded.add(clone.getChildren().get(i));
|
||||
}
|
||||
if (clone.getChildren().get(i).getChildren() != null || !clone.getChildren().get(i).getChildren().isEmpty()) {
|
||||
refreshIsNotIncluded(clone.getChildren().get(i), originalRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldBeIncluded(TreeItem<Object> treeItem) {
|
||||
return !((isNotIncluded.contains(treeItem.getParent()) || isNotIncluded.contains(treeItem) ||
|
||||
(((ProduktbausteinType) treeItem.getValue()).getMinVorkommen() != null && ((ProduktbausteinType) treeItem.getValue()).getMinVorkommen() == 0 &&
|
||||
(timesItemisIncludedById.get(((ProduktbausteinType) treeItem.getValue()).getId()) == null ||
|
||||
timesItemisIncludedById.get(((ProduktbausteinType) treeItem.getValue()).getId()) == 0))) &&
|
||||
!(treeItem.getValue() instanceof VerkaufsproduktType));
|
||||
}
|
||||
|
||||
private Map<String, Integer> countChildIds(Map<String, Integer> count, TreeItem<Object> root) {
|
||||
if (root != null) {
|
||||
for (int i = 0; i < root.getChildren().size(); i++) {
|
||||
TreeItem<Object> item = root.getChildren().get(i);
|
||||
|
||||
if (count.get(((ProduktbausteinType) item.getValue()).getId()) == null) {
|
||||
count.put(((ProduktbausteinType) item.getValue()).getId(), 1);
|
||||
} else {
|
||||
count.replace(((ProduktbausteinType) item.getValue()).getId(),
|
||||
count.get(((ProduktbausteinType) item.getValue()).getId()) + 1);
|
||||
}
|
||||
|
||||
if (!item.getChildren().isEmpty()) {
|
||||
countChildIds(count, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
|
||||
}
|
||||
|
||||
private void refreshTimesItemisIncludedById(TreeItem<Object> root) {
|
||||
for (int i = 0; i < root.getChildren().size(); i++) {
|
||||
TreeItem<Object> item = root.getChildren().get(i);
|
||||
if (!isNotIncluded.contains(item)) {
|
||||
if (timesItemisIncludedById.get(((ProduktbausteinType) item.getValue()).getId()) == null) {
|
||||
timesItemisIncludedById.put(((ProduktbausteinType) item.getValue()).getId(), 1);
|
||||
} else {
|
||||
timesItemisIncludedById.replace(((ProduktbausteinType) item.getValue()).getId(),
|
||||
timesItemisIncludedById.get(((ProduktbausteinType) item.getValue()).getId()) + 1);
|
||||
}
|
||||
}
|
||||
if (!item.getChildren().isEmpty()) {
|
||||
refreshTimesItemisIncludedById(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int timeItemIsIncludedByParent(TreeItem<Object> parent, String itemId) {
|
||||
int erg = 0;
|
||||
for (int i = 0; i < parent.getChildren().size(); i++) {
|
||||
TreeItem<Object> item = parent.getChildren().get(i);
|
||||
if (((ProduktbausteinType) item.getValue()).getId().equals(itemId)) {
|
||||
if (!isNotIncluded.contains(item)) {
|
||||
erg++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return erg;
|
||||
}
|
||||
|
||||
// private TreeItem<Object> cloneTreeItem(TreeItem<Object> original) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
|
||||
// Object cloneOriginalValue;
|
||||
//
|
||||
// cloneOriginalValue = new ObjectFactoryFactory().create(((ProduktbausteinType) original.getValue()).getType());
|
||||
//
|
||||
// ((ProduktbausteinType) cloneOriginalValue).setId(((ProduktbausteinType) original.getValue()).getId());
|
||||
// ((ProduktbausteinType) cloneOriginalValue).setBezeichnung(((ProduktbausteinType) original.getValue()).getBezeichnung());
|
||||
// ((ProduktbausteinType) cloneOriginalValue).setFrom(((ProduktbausteinType) original.getValue()).getFrom());
|
||||
// ((ProduktbausteinType) cloneOriginalValue).setTo(((ProduktbausteinType) original.getValue()).getTo());
|
||||
// ((ProduktbausteinType) cloneOriginalValue).getAttribute().addAll(((ProduktbausteinType) original.getValue()).getAttribute());
|
||||
// ((ProduktbausteinType) cloneOriginalValue).getMeldungen().addAll(((ProduktbausteinType) original.getValue()).getMeldungen());
|
||||
// ((ProduktbausteinType) cloneOriginalValue).setMinOccurrences(((ProduktbausteinType) original.getValue()).getMinOccurrences());
|
||||
// ((ProduktbausteinType) cloneOriginalValue).setMaxOccurrences(((ProduktbausteinType) original.getValue()).getMaxOccurrences());
|
||||
// ((ProduktbausteinType) cloneOriginalValue).setType(((ProduktbausteinType) original.getValue()).getType());
|
||||
//
|
||||
//
|
||||
// TreeItem<Object> clonedItem = new TreeItem<>(cloneOriginalValue);
|
||||
//
|
||||
// for (TreeItem<Object> child : original.getChildren()) {
|
||||
// clonedItem.getChildren().add(cloneTreeItem(child));
|
||||
// }
|
||||
// return clonedItem;
|
||||
// }
|
||||
//
|
||||
// private TreeItem<Object> findTreeItem(ProduktbausteinType item, TreeItem<Object> root) {
|
||||
// if (((ProduktbausteinType) root.getValue()).getId().equals(item.getId())) {
|
||||
// return root;
|
||||
// }
|
||||
// for (TreeItem<Object> child : root.getChildren()) {
|
||||
// TreeItem<Object> found = findTreeItem(item, child);
|
||||
// if (found != null) return found;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public void messageToTree(APrioriProduktbausteinType produkt, TreeItem<Object> treeItem) throws Exception {
|
||||
// if (!produkt.getBausteine().isEmpty()) {
|
||||
// for (int i = 0; i < produkt.getBausteine().size(); i++) {
|
||||
// TreeItem<Object> up = aprioriToCalc(new TreeItem<>(produkt.getBausteine().get(i)));
|
||||
// up.setExpanded(true);
|
||||
// if (!produkt.getBausteine().get(i).getBausteine().isEmpty()) {
|
||||
// messageToTree(produkt.getBausteine().get(i), up);
|
||||
// }
|
||||
// treeItem.getChildren().add(up);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void calcMessageToTree(ProduktbausteinType produkt, TreeItem<Object> treeItem) {
|
||||
// if (!produkt.getBausteine().isEmpty()) {
|
||||
// for (int i = 0; i < produkt.getBausteine().size(); i++) {
|
||||
// TreeItem<Object> up = new TreeItem<>(produkt.getBausteine().get(i));
|
||||
// up.setExpanded(true);
|
||||
// if (!produkt.getBausteine().get(i).getBausteine().isEmpty()) {
|
||||
// calcMessageToTree(produkt.getBausteine().get(i), up);
|
||||
// }
|
||||
// treeItem.getChildren().add(up);
|
||||
// if (!timesItemisIncludedById.containsKey(((ProduktbausteinType) up.getValue()).getId())) {
|
||||
// timesItemisIncludedById.put(((ProduktbausteinType) up.getValue()).getId(), 1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// public TreeItem<Object> aprioriToCalc(TreeItem<Object> produkt) throws Exception {
|
||||
//
|
||||
// TreeItem<Object> ergItem = new TreeItem<>();
|
||||
// Object erg = new ObjectFactoryFactory().create(((APrioriProduktbausteinType) produkt.getValue()).getType());
|
||||
//
|
||||
// if (erg != null) {
|
||||
// if (ProduktbausteinType.class.isAssignableFrom(erg.getClass())) {
|
||||
// ((ProduktbausteinType) erg).setId(((APrioriProduktbausteinType) produkt.getValue()).getId());
|
||||
// ((ProduktbausteinType) erg).setBezeichnung(((APrioriProduktbausteinType) produkt.getValue()).getName());
|
||||
// ((ProduktbausteinType) erg).setFrom(((APrioriProduktbausteinType) produkt.getValue()).getFrom());
|
||||
// ((ProduktbausteinType) erg).setTo(((APrioriProduktbausteinType) produkt.getValue()).getTo());
|
||||
// ((ProduktbausteinType) erg).getMeldungen().addAll(((APrioriProduktbausteinType) produkt.getValue()).getMeldungen());
|
||||
// ((ProduktbausteinType) erg).getAttribute().addAll(((APrioriProduktbausteinType) produkt.getValue()).getAttribute());
|
||||
// ((ProduktbausteinType) erg).setMinOccurrences(((APrioriProduktbausteinType) produkt.getValue()).getMinOccurrences());
|
||||
// ((ProduktbausteinType) erg).setMaxOccurrences(((APrioriProduktbausteinType) produkt.getValue()).getMaxOccurrences());
|
||||
// ((ProduktbausteinType) erg).setType(((APrioriProduktbausteinType) produkt.getValue()).getType());
|
||||
//
|
||||
//
|
||||
// for (int i = 0; i < ((APrioriProduktbausteinType) produkt.getValue()).getBausteine().size(); i++) {
|
||||
// ((ProduktbausteinType) erg).getBausteine().add((ProduktbausteinType) aprioriToCalc(new TreeItem<>(((APrioriProduktbausteinType) produkt.getValue()).getBausteine().get(i))).getValue());
|
||||
// }
|
||||
//
|
||||
// for (int i = 0; i < produkt.getChildren().size(); i++) {
|
||||
// ergItem.getChildren().add(aprioriToCalc(produkt.getChildren().get(i)));
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// logFlow.getChildren().add(new Text("Objekt kann nicht erzeugt werden. Unbekannte Klasse " + ((APrioriProduktbausteinType) produkt.getValue()).getType()));
|
||||
// throw new Exception("Objekt kann nicht erzeugt werden. Unbekannte Klasse " + ((APrioriProduktbausteinType) produkt.getValue()).getType());
|
||||
//
|
||||
// }
|
||||
// ergItem.setValue(erg);
|
||||
// return ergItem;
|
||||
// }
|
||||
//
|
||||
// public TreeItem<Object> addAprioriToCalc(TreeItem<Object> calcItem, TreeItem<Object> aprioriItem) throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
|
||||
// for (TreeItem<Object> aprioriChild : aprioriItem.getChildren()) {
|
||||
//
|
||||
// List<TreeItem<Object>> matchingChildren = calcItem.getChildren().stream()
|
||||
// .filter(c -> ((ProduktbausteinType) c.getValue()).getId().equals(((ProduktbausteinType) aprioriChild.getValue()).getId()))
|
||||
// .toList();
|
||||
//
|
||||
// if (matchingChildren.isEmpty()) {
|
||||
// TreeItem<Object> newChild = cloneTreeItem(aprioriChild);
|
||||
// calcItem.getChildren().add(newChild);
|
||||
// addAprioriToCalc(newChild, aprioriChild);
|
||||
// } else {
|
||||
// for (TreeItem<Object> matchingChild : matchingChildren) {
|
||||
// addAprioriToCalc(matchingChild, aprioriChild);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return calcItem;
|
||||
// }
|
||||
//
|
||||
// private void sortTree(TreeItem<Object> parent) {
|
||||
// FXCollections.sort(parent.getChildren(), Comparator.comparing(
|
||||
// item -> ((ProduktbausteinType) item.getValue()).getBezeichnung().toLowerCase()
|
||||
// ));
|
||||
//
|
||||
// for (TreeItem<Object> child : parent.getChildren()) {
|
||||
// sortTree(child);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package at.vvo.omds.client.gui;
|
||||
|
||||
public class GuiProdukt {
|
||||
boolean notIncluded;
|
||||
Object produkt;
|
||||
|
||||
public GuiProdukt(Object produkt) {
|
||||
this.produkt = produkt;
|
||||
this.notIncluded = false;
|
||||
}
|
||||
|
||||
public GuiProdukt(Object produkt, boolean isNotIncluded) {
|
||||
this.produkt = produkt;
|
||||
this.notIncluded = isNotIncluded;
|
||||
}
|
||||
|
||||
public boolean isNotIncluded() {
|
||||
return notIncluded;
|
||||
}
|
||||
|
||||
public void setNotIncluded(boolean notIncluded) {
|
||||
this.notIncluded = notIncluded;
|
||||
}
|
||||
|
||||
public Object getProdukt() {
|
||||
return produkt;
|
||||
}
|
||||
|
||||
public void setProdukt(Object produkt) {
|
||||
this.produkt = produkt;
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,8 @@ package at.vvo.omds.client.gui;
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.*;
|
||||
import javafx.animation.PauseTransition;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.paint.Paint;
|
||||
@@ -17,55 +15,37 @@ import javafx.util.Duration;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class ItemAttribute {
|
||||
Map<TreeItem<Object>, Map<AttributType, String>> infoBoxFromItem = new HashMap<>();
|
||||
Map<TreeItem<GuiProdukt>, Map<AttributType, String>> infoBoxFromItem = new HashMap<>();
|
||||
List<VersichertesInteresseMitAttributMetadatenType> risikoobjekte = new ArrayList<>();
|
||||
|
||||
public Map<TreeItem<Object>, Map<AttributType, String>> getInfoBoxFromItem() {
|
||||
public List<VersichertesInteresseMitAttributMetadatenType> getRisikoobjekte() {
|
||||
return risikoobjekte;
|
||||
}
|
||||
|
||||
public void setRisikoobjekte(List<VersichertesInteresseMitAttributMetadatenType> risikoobjekte) {
|
||||
this.risikoobjekte = risikoobjekte;
|
||||
}
|
||||
|
||||
public Map<TreeItem<GuiProdukt>, Map<AttributType, String>> getInfoBoxFromItem() {
|
||||
return infoBoxFromItem;
|
||||
}
|
||||
public void setInfoBoxFromItem(Map<TreeItem<Object>, Map<AttributType, String>> infoBoxFromItem) {
|
||||
public void setInfoBoxFromItem(Map<TreeItem<GuiProdukt>, Map<AttributType, String>> infoBoxFromItem) {
|
||||
this.infoBoxFromItem = infoBoxFromItem;
|
||||
}
|
||||
|
||||
public VBox addItemInfo(TreeItem<Object> newSelection, VBox attributBox) {
|
||||
if (((ProduktbausteinType)newSelection.getValue()).getMeldungen() != null && !((ProduktbausteinType)newSelection.getValue()).getMeldungen().isEmpty()){
|
||||
attributBox.getChildren().removeIf(n -> n.getId().equals("faultsbox"));
|
||||
|
||||
VBox faultsBox = new VBox();
|
||||
for (ServiceFault sf : ((ProduktbausteinType)newSelection.getValue()).getMeldungen()) {
|
||||
HBox singleFaultBox = new HBox();
|
||||
singleFaultBox.setPadding(new Insets(10));
|
||||
|
||||
Text symbole = new Text("\u26A0 ");
|
||||
symbole.setFont(Font.font("System", FontWeight.BOLD, symbole.getFont().getSize() + 2));
|
||||
|
||||
|
||||
if (sf.getErrorType().equals(BigInteger.ONE)){
|
||||
symbole.setFill(Paint.valueOf("#aa3333"));
|
||||
} else if (sf.getErrorType().equals(BigInteger.TWO)) {
|
||||
symbole.setFill(Paint.valueOf("#ccbb00"));
|
||||
}
|
||||
Label errorText = new Label(sf.getErrorMsg() + System.lineSeparator());
|
||||
|
||||
singleFaultBox.getChildren().addAll(symbole, errorText);
|
||||
faultsBox.getChildren().add(singleFaultBox);
|
||||
}
|
||||
|
||||
attributBox.getChildren().addFirst(faultsBox);
|
||||
}
|
||||
|
||||
for(int j = 0; j < ((ProduktbausteinType)newSelection.getValue()).getAttribute().size(); j++) {
|
||||
public VBox addItemInfo(TreeItem<GuiProdukt> newSelection, VBox attributBox) {
|
||||
for(int j = 0; j < ((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().size(); j++) {
|
||||
VBox singleAttributBox = new VBox();
|
||||
singleAttributBox.setPadding(new Insets(10));
|
||||
|
||||
Label label = new Label(
|
||||
((ProduktbausteinType)newSelection.getValue()).getAttribute().get(j).getBezeichnung() + ": ");
|
||||
((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().get(j).getBezeichnung() + ": ");
|
||||
label.setId("label");
|
||||
TextField textField = new TextField();
|
||||
|
||||
|
||||
CheckBox checkBox = new CheckBox();
|
||||
|
||||
AttributStringType stringAttribut;
|
||||
@@ -73,14 +53,14 @@ public class ItemAttribute {
|
||||
AttributDezimalType attributDezimal;
|
||||
AttributIntType attributInt;
|
||||
|
||||
if (((ProduktbausteinType)newSelection.getValue()).getAttribute().get(j).getClass()
|
||||
if (((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().get(j).getClass()
|
||||
.equals(AttributBooleanType.class)) {
|
||||
attributDezimal = null;
|
||||
attributInt = null;
|
||||
stringAttribut = null;
|
||||
|
||||
attributBoolean = (AttributBooleanType) (
|
||||
(ProduktbausteinType)newSelection.getValue()).getAttribute().get(j);
|
||||
(ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().get(j);
|
||||
|
||||
if (infoBoxFromItem.get(newSelection) != null && infoBoxFromItem.get(newSelection).get(attributBoolean)
|
||||
!= null && !infoBoxFromItem.get(newSelection).get(attributBoolean).isEmpty()){
|
||||
@@ -90,13 +70,13 @@ public class ItemAttribute {
|
||||
checkBox.setSelected(true);
|
||||
}
|
||||
}
|
||||
} else if (((ProduktbausteinType)newSelection.getValue()).getAttribute().get(j).getClass()
|
||||
} else if (((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().get(j).getClass()
|
||||
.equals(AttributStringType.class)) {
|
||||
attributDezimal = null;
|
||||
attributBoolean = null;
|
||||
attributInt = null;
|
||||
|
||||
stringAttribut = (AttributStringType) ((ProduktbausteinType)newSelection.getValue()).getAttribute().get(j);
|
||||
stringAttribut = (AttributStringType) ((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().get(j);
|
||||
|
||||
if (stringAttribut.isPflichtfeld()) {
|
||||
label.setText(label.getText().substring(0, label.getText().length()-2) + "*: ");
|
||||
@@ -108,20 +88,20 @@ public class ItemAttribute {
|
||||
&& infoBoxFromItem.get(newSelection).get(stringAttribut) != null
|
||||
&& !infoBoxFromItem.get(newSelection).get(stringAttribut).isEmpty()){
|
||||
textField.setText(infoBoxFromItem.get(newSelection).get(stringAttribut));
|
||||
} else if (stringAttribut.getValue() != null) {
|
||||
} else if (stringAttribut.getValue() != null && !stringAttribut.getValue().equals("null")) {
|
||||
textField.setText(stringAttribut.getValue());
|
||||
} else if (stringAttribut.getValue() == null && stringAttribut.getDefault() != null) {
|
||||
} else if (stringAttribut.getDefault() != null) {
|
||||
textField.setText(stringAttribut.getDefault());
|
||||
}
|
||||
textField.setPromptText("Text eingeben");
|
||||
|
||||
} else if (((ProduktbausteinType)newSelection.getValue()).getAttribute().get(j).getClass()
|
||||
} else if (((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().get(j).getClass()
|
||||
.equals(AttributDezimalType.class)) {
|
||||
attributBoolean = null;
|
||||
attributInt = null;
|
||||
stringAttribut = null;
|
||||
|
||||
attributDezimal = (AttributDezimalType) ((ProduktbausteinType)newSelection.getValue()).getAttribute().get(j);
|
||||
attributDezimal = (AttributDezimalType) ((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().get(j);
|
||||
|
||||
if (attributDezimal.isPflichtfeld()) {
|
||||
label.setText(label.getText().substring(0, label.getText().length()-2) + "*: ");
|
||||
@@ -133,9 +113,9 @@ public class ItemAttribute {
|
||||
&& infoBoxFromItem.get(newSelection).get(attributDezimal) != null
|
||||
&& !infoBoxFromItem.get(newSelection).get(attributDezimal).isEmpty()){
|
||||
textField.setText(infoBoxFromItem.get(newSelection).get(attributDezimal));
|
||||
} else if (attributDezimal.getValue() != null) {
|
||||
} else if (attributDezimal.getValue() != null && !(attributDezimal.getValue().toString().equals("-1"))) {
|
||||
textField.setText(attributDezimal.getValue().toString());
|
||||
} else if (attributDezimal.getValue() == null && attributDezimal.getDefault() != null) {
|
||||
} else if (attributDezimal.getDefault() != null) {
|
||||
textField.setText(attributDezimal.getDefault().toString());
|
||||
}
|
||||
textField.setPromptText("Dezimalzahl eingeben");
|
||||
@@ -144,7 +124,7 @@ public class ItemAttribute {
|
||||
attributBoolean = null;
|
||||
stringAttribut = null;
|
||||
|
||||
attributInt = (AttributIntType) ((ProduktbausteinType)newSelection.getValue()).getAttribute().get(j);
|
||||
attributInt = (AttributIntType) ((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().get(j);
|
||||
|
||||
if (attributInt.isPflichtfeld()) {
|
||||
label.setText(label.getText().substring(0, label.getText().length()-2) + "*: ");
|
||||
@@ -156,9 +136,9 @@ public class ItemAttribute {
|
||||
&& infoBoxFromItem.get(newSelection).get(attributInt) != null
|
||||
&& !infoBoxFromItem.get(newSelection).get(attributInt).isEmpty()){
|
||||
textField.setText(infoBoxFromItem.get(newSelection).get(attributInt));
|
||||
} else if (attributInt.getValue() != null) {
|
||||
} else if (attributInt.getValue() != null && !attributInt.getValue().equals(-1)) {
|
||||
textField.setText(attributInt.getValue().toString());
|
||||
} else if (attributInt.getValue() == null && attributInt.getDefault() != null) {
|
||||
} else if (attributInt.getDefault() != null) {
|
||||
textField.setText(attributInt.getDefault().toString());
|
||||
}
|
||||
textField.setPromptText("Ganzzahl eingeben");
|
||||
@@ -183,7 +163,7 @@ public class ItemAttribute {
|
||||
infoBoxFromItem.computeIfAbsent(newSelection,
|
||||
k -> new HashMap<>()).put(attributBoolean, checkBox.isSelected() ? "true" : "false");
|
||||
attributBoolean.setValue(checkBox.isSelected());
|
||||
((ProduktbausteinType)newSelection.getValue()).getAttribute().set(finalJ, attributBoolean);
|
||||
((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().set(finalJ, attributBoolean);
|
||||
}
|
||||
});
|
||||
textField.focusedProperty().addListener((observableValue, oldVal, newVal) -> {
|
||||
@@ -236,7 +216,7 @@ public class ItemAttribute {
|
||||
}else {
|
||||
if (singleAttributBox.getChildren().size() > 2) singleAttributBox.getChildren().removeLast();
|
||||
attributDezimal.setValue(new BigDecimal(eingabe));
|
||||
((ProduktbausteinType)newSelection.getValue()).getAttribute().set(finalJ, attributDezimal);
|
||||
((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().set(finalJ, attributDezimal);
|
||||
}
|
||||
} else if (attributInt != null) {
|
||||
infoBoxFromItem.computeIfAbsent(newSelection,
|
||||
@@ -268,7 +248,7 @@ public class ItemAttribute {
|
||||
}else {
|
||||
if (singleAttributBox.getChildren().size() > 2) singleAttributBox.getChildren().removeLast();
|
||||
attributInt.setValue(Integer.parseInt(textField.getText()));
|
||||
((ProduktbausteinType)newSelection.getValue()).getAttribute().set(finalJ, attributInt);
|
||||
((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().set(finalJ, attributInt);
|
||||
}
|
||||
} else if (stringAttribut != null) {
|
||||
infoBoxFromItem.computeIfAbsent(newSelection,
|
||||
@@ -292,12 +272,12 @@ public class ItemAttribute {
|
||||
pause.play();
|
||||
|
||||
if (singleAttributBox.getChildren().size() > 2) singleAttributBox.getChildren().removeLast();
|
||||
((ProduktbausteinType)newSelection.getValue()).getAttribute().set(finalJ, attributInt);
|
||||
((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().set(finalJ, attributInt);
|
||||
|
||||
}else {
|
||||
if (singleAttributBox.getChildren().size() > 2) singleAttributBox.getChildren().removeLast();
|
||||
stringAttribut.setValue(textField.getText());
|
||||
((ProduktbausteinType)newSelection.getValue()).getAttribute().set(finalJ, stringAttribut);
|
||||
((ProduktbausteinType)newSelection.getValue().getProdukt()).getAttribute().set(finalJ, stringAttribut);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,40 +286,141 @@ public class ItemAttribute {
|
||||
if (attributBoolean != null) {
|
||||
singleAttributBox.getChildren().addAll(label, checkBox);
|
||||
}else {
|
||||
textField.setId("textField");
|
||||
singleAttributBox.getChildren().addAll(label, textField);
|
||||
}
|
||||
|
||||
singleAttributBox.setId("singleAttributBox");
|
||||
|
||||
attributBox.getChildren().add(singleAttributBox);
|
||||
}
|
||||
|
||||
// if (((ProduktbausteinType)newSelection.getValue()).getMeldungen() != null
|
||||
// && !((ProduktbausteinType)newSelection.getValue()).getMeldungen().isEmpty()) {
|
||||
// ((ProduktbausteinType)newSelection.getValue()).getMeldungen().forEach(n -> {
|
||||
// VBox meldung = new VBox();
|
||||
//
|
||||
// Label code = new Label();
|
||||
// Label text = new Label();
|
||||
// Label ref = new Label();
|
||||
//
|
||||
// if (n.getErrorCode() != null) {code = new Label("Error Code: " + n.getErrorCode().toString());}
|
||||
// if (n.getErrorMsg() != null) {text = new Label(n.getErrorMsg());}
|
||||
// if (n.getElementReference() != null) {ref = new Label(n.getElementReference());}
|
||||
//
|
||||
// if (n.getErrorType().equals(BigInteger.ONE)){
|
||||
// code.setStyle("-fx-text-fill: red;");
|
||||
// text.setStyle("-fx-text-fill: red;");
|
||||
// ref.setStyle("-fx-text-fill: red;");
|
||||
// }else if (n.getErrorType().equals(BigInteger.TWO)){
|
||||
// code.setStyle("-fx-text-fill: #bbbb00;");
|
||||
// text.setStyle("-fx-text-fill: #bbbb00;");
|
||||
// ref.setStyle("-fx-text-fill: #bbbb00;");
|
||||
// }
|
||||
//
|
||||
// meldung.getChildren().addAll(code, text, ref);
|
||||
// attributBox.getChildren().add(meldung);
|
||||
// });
|
||||
// }
|
||||
if (((ProduktbausteinType) newSelection.getValue().getProdukt()).isRisikoobjektErforderlich()) {
|
||||
|
||||
VBox risikoobjektAuswahlBox = new VBox();
|
||||
Label vpRo = new Label("Mit dem Baustein assoziierte Risikoobjekte: ");
|
||||
|
||||
for (int i = 0; i < risikoobjekte.size(); i++) {
|
||||
CheckBox checkBox = new CheckBox();
|
||||
checkBox.setText(risikoobjekte.get(i).toString());
|
||||
|
||||
if (risikoobjekte.get(i) instanceof FahrzeugType) {
|
||||
checkBox.setText(((FahrzeugType) risikoobjekte.get(i)).getHandelsbez() + " ("
|
||||
+ ((FahrzeugType) risikoobjekte.get(i)).getBaujahr() + ")");
|
||||
|
||||
int finalI = i;
|
||||
|
||||
if (((ProduktbausteinType) newSelection.getValue().getProdukt()).getVersicherteObjekte()
|
||||
.stream().anyMatch(v -> ((FahrzeugType) v).getHandelsbez()
|
||||
.equals(((FahrzeugType) risikoobjekte.get(finalI)).getHandelsbez()))) {
|
||||
checkBox.setSelected(true);
|
||||
}
|
||||
|
||||
checkBox.selectedProperty().addListener((observableValue, oldValue, newValue) -> {
|
||||
if (newValue) {
|
||||
((ProduktbausteinType) newSelection.getValue().getProdukt()).getVersicherteObjekte().add(risikoobjekte.get(finalI));
|
||||
} else {
|
||||
((ProduktbausteinType) newSelection.getValue().getProdukt()).getVersicherteObjekte().remove(finalI);
|
||||
}
|
||||
});
|
||||
}
|
||||
risikoobjektAuswahlBox.getChildren().add(checkBox);
|
||||
}
|
||||
|
||||
risikoobjektAuswahlBox.getChildren().addFirst(vpRo);
|
||||
risikoobjektAuswahlBox.setPadding(new Insets(10));
|
||||
risikoobjektAuswahlBox.setId("risikoobjektAuswahlBox");
|
||||
|
||||
attributBox.getChildren().removeIf(c -> c.getId() != null && c.getId().equals("risikoobjektAuswahlBox"));
|
||||
attributBox.getChildren().add(risikoobjektAuswahlBox);
|
||||
}
|
||||
|
||||
return addFaultsInfo((ProduktbausteinType) newSelection.getValue().getProdukt(), attributBox);
|
||||
}
|
||||
|
||||
public VBox addFaultsInfo(ProduktbausteinType produktbaustein, VBox attributBox) {
|
||||
if (produktbaustein.getMeldungen() != null && !produktbaustein.getMeldungen().isEmpty()) {
|
||||
attributBox.getChildren().removeIf(n -> n.getId() != null && n.getId().equals("faultsbox"));
|
||||
VBox faultsBox = new VBox();
|
||||
faultsBox.setId("faultsbox");
|
||||
|
||||
for (ServiceFault sf : produktbaustein.getMeldungen()) {
|
||||
HBox singleFaultBox = new HBox();
|
||||
|
||||
Text symbole = new Text("\u26A0 ");
|
||||
symbole.setFont(Font.font("System", FontWeight.BOLD, symbole.getFont().getSize() + 2));
|
||||
|
||||
if (sf.getErrorType().equals(BigInteger.ONE)) {
|
||||
symbole.setFill(Paint.valueOf("#aa3333"));
|
||||
} else if (sf.getErrorType().equals(BigInteger.TWO)) {
|
||||
symbole.setFill(Paint.valueOf("#ccbb00"));
|
||||
}
|
||||
Label errorText = new Label(sf.getErrorMsg() + System.lineSeparator());
|
||||
errorText.setId("errorText");
|
||||
|
||||
singleFaultBox.getChildren().addAll(symbole, errorText);
|
||||
singleFaultBox.setId("singleFaultBox");
|
||||
faultsBox.getChildren().add(singleFaultBox);
|
||||
}
|
||||
|
||||
if (!faultsBox.getChildren().isEmpty()) {
|
||||
if (produktbaustein.getAttribute().isEmpty()) {
|
||||
attributBox.getChildren().addAll(faultsBox);
|
||||
}else {
|
||||
List<Node> singleAttributBoxes = attributBox.getChildren().stream().filter(n -> n.getId() != null && n.getId().equals("singleAttributBox")).toList();
|
||||
Optional<Node> textField;
|
||||
Optional<Node> label;
|
||||
for (Node singleAttributBox : singleAttributBoxes) {
|
||||
textField = ((VBox)singleAttributBox).getChildren().stream().filter(n -> n.getId() != null && n.getId().equals("textField")).findFirst();
|
||||
label = ((VBox)singleAttributBox).getChildren().stream().filter(n -> n.getId() != null && n.getId().equals("label")).findFirst();
|
||||
List<Node> singleFaultBoxes = faultsBox.getChildren().stream().filter(n -> n.getId() != null && n.getId().equals("singleFaultBox")).toList();
|
||||
|
||||
if (textField.isPresent() && label.isPresent()) {
|
||||
|
||||
for (Node singleFaultBox : singleFaultBoxes) {
|
||||
Optional<Node> errorText = ((HBox)singleFaultBox).getChildren().stream().filter(c -> c.getId() != null && c.getId().equals("errorText")).findFirst();
|
||||
|
||||
if (errorText.isPresent() && ((Label)errorText.get()).getText().contains(((Label)label.get()).getText().replace(":","").replace("*",""))) {
|
||||
textField.get().setStyle("-fx-border-color: #dd0000");
|
||||
((VBox)singleAttributBox).getChildren().addLast(faultsBox);
|
||||
Optional<Node> finalTextField = textField;
|
||||
textField.get().focusedProperty().addListener(s -> finalTextField.get().setStyle(null));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return attributBox;
|
||||
}
|
||||
|
||||
public VBox addVpInfo(VBox attributBox, boolean meldungVorhanden, VerkaufsproduktType vp) {
|
||||
attributBox.getChildren().removeIf(c -> c.getId() != null && c.getId().equals("vpLabel"));
|
||||
|
||||
Label vpLabel = new Label();
|
||||
if (!meldungVorhanden) {
|
||||
vpLabel.setText("Gültiges Verkaufsprodukt " + System.lineSeparator());
|
||||
}else {
|
||||
vpLabel.setText("Kein Gültiges Verkaufsprodukt " + System.lineSeparator());
|
||||
}
|
||||
vpLabel.setPadding(new Insets(10));
|
||||
attributBox.getChildren().addFirst(vpLabel);
|
||||
|
||||
|
||||
// VBox vpMeldungenTexts = new VBox();
|
||||
// vp.getMeldungen().forEach( m -> {
|
||||
// Label vpMeldungText = new Label(m.getErrorMsg() + System.lineSeparator());
|
||||
// vpMeldungText.setPadding(new Insets(10));
|
||||
//
|
||||
// vpMeldungenTexts.getChildren().add(vpMeldungText);
|
||||
// });
|
||||
|
||||
attributBox.getChildren().removeIf(c -> c.getId() != null && c.getId().equals("vpMeldungenTexts"));
|
||||
// attributBox.getChildren().addAll(vpMeldungenTexts);
|
||||
|
||||
return attributBox;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,710 @@
|
||||
package at.vvo.omds.client.gui;
|
||||
|
||||
import at.vvo.omds.client.gui.api.apriori.AprioriAuskunftService;
|
||||
import at.vvo.omds.client.gui.api.calc.CalculateRequestAuskunftService;
|
||||
import at.vvo.omds.client.gui.api.SOAPConnector;
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.*;
|
||||
import at.vvo.omds.types.omds3.r2025_05.on2antrag.common.*;
|
||||
import com.sun.xml.messaging.saaj.SOAPExceptionImpl;
|
||||
import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.text.*;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Pair;
|
||||
import org.controlsfx.control.ToggleSwitch;
|
||||
import org.eclipse.rdf4j.model.Model;
|
||||
import org.eclipse.rdf4j.query.GraphQuery;
|
||||
import org.eclipse.rdf4j.query.QueryResults;
|
||||
import org.eclipse.rdf4j.repository.Repository;
|
||||
import org.eclipse.rdf4j.repository.RepositoryConnection;
|
||||
import org.eclipse.rdf4j.repository.sail.SailRepository;
|
||||
import org.eclipse.rdf4j.rio.RDFFormat;
|
||||
import org.eclipse.rdf4j.rio.Rio;
|
||||
import org.eclipse.rdf4j.sail.memory.MemoryStore;
|
||||
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class MainView extends Application {
|
||||
|
||||
Map<String, Integer> timesItemisIncludedById = new HashMap<>();
|
||||
Map<TreeItem<GuiProdukt>, Map<AttributType, String>> infoBoxFromItem = new HashMap<>();
|
||||
List<Plausi> plausiList = new ArrayList<>();
|
||||
|
||||
RisikoobjektView risikoobjektView = new RisikoobjektView();
|
||||
TreeHelper treeHelper = new TreeHelper();
|
||||
RDFHelper rdfHelper = new RDFHelper();
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
|
||||
stage.setTitle("OMDS Client");
|
||||
stage.getIcons().add(new Image(MainView.class.getResourceAsStream("/logo/VVO_Logo_2024.png")));
|
||||
|
||||
TabPane tabPane = new TabPane();
|
||||
Tab baumView = new Tab("Deckungsbaum");
|
||||
Tab risikoView = new Tab("Risikoobjekte");
|
||||
|
||||
baumView.setClosable(false);
|
||||
risikoView.setClosable(false);
|
||||
|
||||
tabPane.getTabs().addAll(baumView, risikoView);
|
||||
|
||||
BorderPane content = new BorderPane();
|
||||
StackPane view = new StackPane();
|
||||
GridPane risikoobjekt = risikoobjektView.risikoobjekte();
|
||||
VBox deckungsbaum = deckungsbaum();
|
||||
|
||||
content.setTop(tabPane);
|
||||
content.setCenter(view);
|
||||
|
||||
view.getChildren().addAll(risikoobjekt ,deckungsbaum);
|
||||
risikoobjekt.setVisible(false);
|
||||
|
||||
|
||||
tabPane.getSelectionModel().selectedItemProperty().addListener((obs, oldTab, newTab) -> {
|
||||
if (newTab == risikoView) {
|
||||
risikoobjekt.setVisible(true);
|
||||
deckungsbaum.setVisible(false);
|
||||
} else if (newTab == baumView) {
|
||||
risikoobjekt.setVisible(false);
|
||||
deckungsbaum.setVisible(true);
|
||||
}
|
||||
});
|
||||
|
||||
Scene scene = new Scene(content, 900, 600);
|
||||
stage.setScene(scene);
|
||||
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public VBox deckungsbaum(){
|
||||
AprioriAuskunftService s = new AprioriAuskunftService(new SOAPConnector());
|
||||
|
||||
final VBox[] controlBox = {new VBox()};
|
||||
DatePicker dp = new DatePicker();
|
||||
ChoiceBox<String> vpBox = new ChoiceBox<>();
|
||||
|
||||
vpBox.setValue("Verkaufsprodukt auswählen ");
|
||||
vpBox.setVisible(false);
|
||||
vpBox.setPadding(new Insets(0, 10, 0, 0));
|
||||
|
||||
AtomicReference<XMLGregorianCalendar> stichtag = new AtomicReference<>();
|
||||
AtomicReference<ProductsResponse> response = new AtomicReference<>();
|
||||
Button newCalcRequestButton = new Button("Calculate");
|
||||
HBox newCalcRequestControlBox = new HBox();
|
||||
newCalcRequestControlBox.setVisible(false);
|
||||
newCalcRequestControlBox.setPadding(new Insets(10, 10, 10, 10));
|
||||
newCalcRequestControlBox.getChildren().add(newCalcRequestButton);
|
||||
|
||||
HBox servBox = new HBox();
|
||||
ToggleSwitch serverBtn = new ToggleSwitch("Benutze RDF Messaging");
|
||||
serverBtn.setSelected(true);
|
||||
serverBtn.setDisable(true);
|
||||
|
||||
AtomicReference<List<APrioriVerkaufsproduktType>> responseproduct = new AtomicReference<>(new ArrayList<>());
|
||||
|
||||
dp.setOnAction(e -> {
|
||||
try {
|
||||
stichtag.set(stichtagEvent(dp));
|
||||
if (stichtagEvent(dp) != null) {
|
||||
try {
|
||||
Pair<List<APrioriVerkaufsproduktType>, List<Plausi>> aprioriPair = s.aprioriRDFAuskunft(stichtag.get(), "042");
|
||||
responseproduct.set(aprioriPair.getKey());
|
||||
plausiList = aprioriPair.getValue();
|
||||
|
||||
newCalcRequestControlBox.setVisible(true);
|
||||
|
||||
if (responseproduct.get().size() > 1) {
|
||||
if (!vpBox.getItems().isEmpty()) {
|
||||
vpBox.getItems().clear();
|
||||
}
|
||||
for (APrioriVerkaufsproduktType vp : responseproduct.get()) {
|
||||
vpBox.getItems().add(vp.getName());
|
||||
}
|
||||
vpBox.setVisible(true);
|
||||
vpBox.setOnAction(ee -> {
|
||||
for (int i = 0; i < responseproduct.get().size(); i++) {
|
||||
if (vpBox.getSelectionModel().getSelectedItem() != null && vpBox.getSelectionModel()
|
||||
.getSelectedItem().equals(responseproduct.get().get(i).getName())) {
|
||||
try {
|
||||
controlBox[0] = buttonAuskunft(responseproduct.get().get(i),
|
||||
controlBox[0], newCalcRequestButton, stichtag, serverBtn);
|
||||
controlBox[0].getChildren().add(newCalcRequestControlBox);
|
||||
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
controlBox[0] = buttonAuskunft(responseproduct.get().getFirst(),
|
||||
controlBox[0], newCalcRequestButton, stichtag, serverBtn);
|
||||
}
|
||||
} catch (Exception rdfex) {
|
||||
serverBtn.setSelected(false);
|
||||
|
||||
try {
|
||||
response.set(s.aprioriAuskunft(stichtag.get(), "042"));
|
||||
|
||||
newCalcRequestControlBox.setVisible(true);
|
||||
if (response.get() != null && response.get().getVerkaufsprodukt().size() > 1) {
|
||||
|
||||
if (!vpBox.getItems().isEmpty()) {
|
||||
vpBox.getItems().clear();
|
||||
}
|
||||
for (APrioriVerkaufsproduktType vp : response.get().getVerkaufsprodukt()) {
|
||||
vpBox.getItems().add(vp.getName());
|
||||
}
|
||||
vpBox.setVisible(true);
|
||||
vpBox.setOnAction(ee -> {
|
||||
for (int i = 0; i < response.get().getVerkaufsprodukt().size(); i++) {
|
||||
if (vpBox.getSelectionModel().getSelectedItem() != null && vpBox.getSelectionModel()
|
||||
.getSelectedItem().equals(response.get().getVerkaufsprodukt().get(i).getName())) {
|
||||
try {
|
||||
controlBox[0] = buttonAuskunft(response.get().getVerkaufsprodukt().get(i),
|
||||
controlBox[0], newCalcRequestButton, stichtag, serverBtn);
|
||||
controlBox[0].getChildren().add(newCalcRequestControlBox);
|
||||
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
controlBox[0] = buttonAuskunft(response.get().getVerkaufsprodukt().getFirst(),
|
||||
controlBox[0], newCalcRequestButton, stichtag, serverBtn);
|
||||
}
|
||||
} catch (NoSuchElementException ex) {
|
||||
controlBox[0].getChildren().clear();
|
||||
controlBox[0].getChildren().add(dp);
|
||||
vpBox.getItems().clear();
|
||||
|
||||
Label label = new Label("Kein Verkaufsoffenes Produkt an dem Datum: " +
|
||||
stichtag.get().toString().substring(0, stichtag.get().toString().length() - 1) +
|
||||
System.lineSeparator());
|
||||
controlBox[0].getChildren().add(3, label);
|
||||
throw new NoSuchElementException(ex.getMessage());
|
||||
} catch (SOAPExceptionImpl ex) {
|
||||
HBox errorBox = new HBox();
|
||||
errorBox.setAlignment(Pos.CENTER);
|
||||
errorBox.setPadding(new Insets(10, 10, 10, 10));
|
||||
errorBox.getChildren().add(new Text("Keine Verbindung zu einer Rdf oder SOAP Schnittstelle möglich!"));
|
||||
|
||||
controlBox[0].getChildren().add(errorBox);
|
||||
}
|
||||
}
|
||||
|
||||
if (!controlBox[0].getChildren().contains(newCalcRequestControlBox)) {
|
||||
controlBox[0].getChildren().add(newCalcRequestControlBox);
|
||||
}
|
||||
} else {
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||
alert.setTitle("Error");
|
||||
alert.setHeaderText("Invalid Date");
|
||||
alert.showAndWait();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
dp.setValue(LocalDate.now());
|
||||
|
||||
Platform.runLater(() -> {
|
||||
dp.getOnAction().handle(new ActionEvent(dp, null));
|
||||
});
|
||||
|
||||
VBox.setVgrow(newCalcRequestControlBox, Priority.ALWAYS);
|
||||
newCalcRequestControlBox.setAlignment(Pos.BOTTOM_RIGHT);
|
||||
newCalcRequestControlBox.setId("newCalcRequestControlBox");
|
||||
|
||||
servBox.getChildren().add(serverBtn);
|
||||
servBox.setAlignment(Pos.TOP_RIGHT);
|
||||
|
||||
HBox aprioriControlBox = new HBox();
|
||||
Region region = new Region();
|
||||
HBox.setHgrow(region, Priority.ALWAYS);
|
||||
aprioriControlBox.setPadding(new Insets(10, 10, 0, 10));
|
||||
aprioriControlBox.getChildren().addAll(dp, vpBox, region, servBox);
|
||||
|
||||
controlBox[0].getChildren().addAll(aprioriControlBox);
|
||||
|
||||
return controlBox[0];
|
||||
}
|
||||
|
||||
public XMLGregorianCalendar stichtagEvent(DatePicker dp) throws DatatypeConfigurationException {
|
||||
if (dp.getValue() == null) {
|
||||
return null;
|
||||
}
|
||||
int day = dp.getValue().getDayOfMonth();
|
||||
int month = dp.getValue().getMonthValue();
|
||||
int year = dp.getValue().getYear();
|
||||
|
||||
return DatatypeFactory.newInstance().newXMLGregorianCalendarDate(year, month, day, 0);
|
||||
}
|
||||
|
||||
public VBox buttonAuskunft(APrioriVerkaufsproduktType verkaufsprodukt, VBox vbox, Button newCalcRequest,
|
||||
AtomicReference<XMLGregorianCalendar> stichtag, ToggleSwitch serverBtn) throws Exception {
|
||||
while (vbox.getChildren().size() > 1) {
|
||||
vbox.getChildren().removeLast();
|
||||
}
|
||||
|
||||
VBox treeBox = new VBox();
|
||||
VBox infoBox = new VBox();
|
||||
|
||||
TreeItem<GuiProdukt> vkp = treeHelper.aprioriItemToCalcItem(new TreeItem<>(new GuiProdukt(verkaufsprodukt)));
|
||||
vkp.setExpanded(true);
|
||||
|
||||
treeHelper.aprioriProduktToTree(verkaufsprodukt, vkp);
|
||||
|
||||
TreeView<GuiProdukt> tv = new TreeView<>(vkp);
|
||||
|
||||
|
||||
tv.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
|
||||
if (newSelection != null) {
|
||||
if (!infoBox.getChildren().isEmpty()) {
|
||||
infoBox.getChildren().removeAll(infoBox.getChildren());
|
||||
}
|
||||
|
||||
if (isMeldungVorhanden((ProduktbausteinType) newSelection.getValue().getProdukt(), tv)){
|
||||
((ProduktbausteinType) newSelection.getValue().getProdukt()).getAttribute().removeIf(a -> a.getBezeichnung().equals("Praemie"));
|
||||
}
|
||||
ItemAttribute itemAttribute = new ItemAttribute();
|
||||
itemAttribute.setRisikoobjekte(risikoobjektView.getRisikoobjekte());
|
||||
if (!infoBoxFromItem.isEmpty()) itemAttribute.setInfoBoxFromItem(infoBoxFromItem);
|
||||
|
||||
itemAttribute.addItemInfo(newSelection, infoBox);
|
||||
if (newSelection.getValue().getProdukt() instanceof VerkaufsproduktType){
|
||||
itemAttribute.addVpInfo(infoBox, isMeldungVorhanden((ProduktbausteinType) newSelection.getValue().getProdukt(), tv), (VerkaufsproduktType) newSelection.getValue().getProdukt());
|
||||
}
|
||||
infoBoxFromItem = itemAttribute.getInfoBoxFromItem();
|
||||
}else{
|
||||
infoBox.getChildren().removeAll(infoBox.getChildren());
|
||||
}
|
||||
});
|
||||
|
||||
final TreeItem<GuiProdukt> originalRoot = treeHelper.cloneTreeItem(tv.getRoot());
|
||||
tv.setCellFactory(tc -> new TreeCell<>() {
|
||||
@Override
|
||||
public void updateItem(GuiProdukt item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item == null || empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
setStyle("");
|
||||
} else {
|
||||
HBox cellBox = new HBox();
|
||||
Button include = new Button("+");
|
||||
include.setStyle("-fx-margin: 5;");
|
||||
Label label = new Label(((ProduktbausteinType) item.getProdukt()).getBezeichnung() + " ");
|
||||
Button remove = new Button("-");
|
||||
|
||||
remove.setVisible(true);
|
||||
remove.setFont(Font.font("System", FontWeight.BOLD, include.getFont().getSize() + 2));
|
||||
remove.setPadding(new Insets(0, 5, 0, 5));
|
||||
|
||||
include.setFont(Font.font("System", FontWeight.BOLD, include.getFont().getSize() + 2));
|
||||
include.setPadding(new Insets(0, 5, 0, 5));
|
||||
|
||||
if (!shouldBeIncluded(getTreeItem())) {
|
||||
label.setFont(Font.font("System", FontPosture.ITALIC, label.getFont().getSize()));
|
||||
label.setTextFill(Paint.valueOf("#A0A0A0"));
|
||||
if (!(getTreeItem().getValue().isNotIncluded())) {
|
||||
getTreeItem().getValue().setNotIncluded(true);
|
||||
}
|
||||
remove.setDisable(true);
|
||||
remove.setStyle("-fx-background-color: #CCCCCC");
|
||||
} else {
|
||||
label.setTextFill(Paint.valueOf("#000000"));
|
||||
remove.setVisible(true);
|
||||
|
||||
getTreeItem().getValue().setNotIncluded(false);
|
||||
}
|
||||
|
||||
Region spacer = new Region();
|
||||
HBox.setHgrow(spacer, Priority.ALWAYS);
|
||||
Label spacer2 = new Label(" ");
|
||||
|
||||
label.setMaxWidth(Double.MAX_VALUE);
|
||||
|
||||
if (getTreeItem().getValue().getProdukt() instanceof VerkaufsproduktType ||
|
||||
getTreeItem().getValue().getClass().equals(APrioriVerkaufsproduktType.class)) {
|
||||
cellBox.getChildren().addAll(label);
|
||||
} else if (timesItemisIncludedById.get(
|
||||
((ProduktbausteinType) getTreeItem().getValue().getProdukt()).getId()) != null
|
||||
&& ((ProduktbausteinType) getTreeItem().getValue().getProdukt()).getMaxVorkommen() != null
|
||||
&& ((ProduktbausteinType) getTreeItem().getValue().getProdukt()).getMaxVorkommen() <=
|
||||
timeItemIsIncludedByParent(getTreeItem().getParent(),
|
||||
((ProduktbausteinType) getTreeItem().getValue().getProdukt()).getId())) {
|
||||
include.setDisable(true);
|
||||
include.setStyle("-fx-background-color: #CCCCCC");
|
||||
cellBox.getChildren().addAll(label, spacer, include, spacer2, remove);
|
||||
} else {
|
||||
cellBox.getChildren().addAll(label, spacer, include, spacer2, remove);
|
||||
}
|
||||
|
||||
include.setOnAction(e -> {
|
||||
if (getTreeItem().getValue().isNotIncluded()) {
|
||||
label.setFont(Font.font("System", label.getFont().getSize()));
|
||||
label.setTextFill(Paint.valueOf("#000000"));
|
||||
remove.setVisible(true);
|
||||
|
||||
timesItemisIncludedById.put(((ProduktbausteinType) getTreeItem().getValue().getProdukt()).getId(),
|
||||
(timesItemisIncludedById.get(
|
||||
((ProduktbausteinType) getTreeItem().getValue().getProdukt()).getId()) != null ?
|
||||
timesItemisIncludedById.get(
|
||||
((ProduktbausteinType) getTreeItem().getValue().getProdukt()).getId()) + 1 : 1));
|
||||
|
||||
getTreeItem().getValue().setNotIncluded(false);
|
||||
includeAddedParent(getTreeItem());
|
||||
includeAddedChildren(getTreeItem());
|
||||
tv.setRoot(treeHelper.sortTree(tv.getRoot()));
|
||||
tv.refresh();
|
||||
timesItemisIncludedById.clear();
|
||||
refreshTimesItemisIncludedById(tv.getRoot());
|
||||
} else {
|
||||
TreeItem<GuiProdukt> parent = getTreeItem().getParent();
|
||||
TreeItem<GuiProdukt> clone = null;
|
||||
try {
|
||||
clone = treeHelper.cloneTreeItem(
|
||||
treeHelper.findTreeItem((ProduktbausteinType) item.getProdukt(), tv.getRoot()));
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
parent.getChildren().add(clone);
|
||||
|
||||
timesItemisIncludedById.clear();
|
||||
refreshTimesItemisIncludedById(tv.getRoot());
|
||||
|
||||
tv.setRoot(treeHelper.sortTree(tv.getRoot()));
|
||||
tv.refresh();
|
||||
}
|
||||
|
||||
TreeItem<GuiProdukt> newRoot = checkPlausis(plausiList, tv.getRoot(), verkaufsprodukt);
|
||||
if (newRoot != null) {
|
||||
newRoot.setExpanded(true);
|
||||
tv.setRoot(newRoot);
|
||||
tv.refresh();
|
||||
}
|
||||
});
|
||||
|
||||
remove.setOnAction(e -> {
|
||||
Map<String, Integer> countByParent = new HashMap<>();
|
||||
Map<String, Integer> countByAprioriParent = new HashMap<>();
|
||||
timesItemisIncludedById.clear();
|
||||
refreshTimesItemisIncludedById(tv.getRoot());
|
||||
timesItemisIncludedById.replace(((ProduktbausteinType) item.getProdukt()).getId(),
|
||||
timesItemisIncludedById.get(((ProduktbausteinType) item.getProdukt()).getId()) - 1);
|
||||
|
||||
if (countChildIds(countByParent, getTreeItem().getParent()).get
|
||||
(((ProduktbausteinType) item.getProdukt()).getId()).equals(countChildIds(countByAprioriParent,
|
||||
treeHelper.findTreeItem(((ProduktbausteinType) item.getProdukt()), originalRoot).getParent()).get(
|
||||
((ProduktbausteinType) item.getProdukt()).getId()))) {
|
||||
label.setFont(Font.font("System", label.getFont().getSize()));
|
||||
label.setTextFill(Paint.valueOf("#A0A0A0"));
|
||||
remove.setVisible(false);
|
||||
|
||||
getTreeItem().getValue().setNotIncluded(true);
|
||||
includeAddedChildren(getTreeItem());
|
||||
|
||||
tv.setRoot(treeHelper.sortTree(tv.getRoot()));
|
||||
tv.refresh();
|
||||
} else {
|
||||
getTreeItem().getParent().getChildren().remove((getTreeItem()));
|
||||
}
|
||||
|
||||
TreeItem<GuiProdukt> newRoot = checkPlausis(plausiList, tv.getRoot(), verkaufsprodukt);
|
||||
if (newRoot != null) {
|
||||
newRoot.setExpanded(true);
|
||||
|
||||
tv.setRoot(newRoot);
|
||||
tv.refresh();
|
||||
}
|
||||
|
||||
timesItemisIncludedById.clear();
|
||||
refreshTimesItemisIncludedById(tv.getRoot());
|
||||
});
|
||||
|
||||
if(((ProduktbausteinType) item.getProdukt()).getMeldungen() != null && !((ProduktbausteinType) item.getProdukt()).getMeldungen().isEmpty()) {
|
||||
AtomicBoolean symboleAdded = new AtomicBoolean(false);
|
||||
Text symbole = new Text("\u26A0 ");
|
||||
symbole.setFont(Font.font("System", FontWeight.BOLD, symbole.getFont().getSize() + 2));
|
||||
|
||||
|
||||
((ProduktbausteinType) item.getProdukt()).getMeldungen().forEach(m -> {
|
||||
if(m.getErrorType().equals(BigInteger.ONE)) {
|
||||
symbole.setFill(Paint.valueOf("#aa3333"));
|
||||
symboleAdded.set(true);
|
||||
}
|
||||
if (m.getErrorType().equals(BigInteger.TWO) && !symboleAdded.get()) {
|
||||
symbole.setFill(Paint.valueOf("#ccbb00"));
|
||||
}
|
||||
});
|
||||
cellBox.getChildren().addFirst(symbole);
|
||||
}else {
|
||||
if (cellBox.getChildren().getFirst() instanceof Text && ((Text)cellBox.getChildren().getFirst()).getText().equals("\u26A0")) {
|
||||
cellBox.getChildren().removeFirst();
|
||||
}
|
||||
}
|
||||
setGraphic(cellBox);
|
||||
setText(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
newCalcRequest.setOnAction(e -> {
|
||||
try {
|
||||
TreeItem<GuiProdukt> cleanedRoot = treeHelper.cleanTree(tv.getRoot());
|
||||
|
||||
|
||||
CalculateRequestAuskunftService s = new CalculateRequestAuskunftService(new SOAPConnector());
|
||||
TreeItem<GuiProdukt> newRoot = new TreeItem<>(cleanedRoot.getValue());
|
||||
treeHelper.setTimesItemisIncludedById(timesItemisIncludedById);
|
||||
if (serverBtn.isSelected()) {
|
||||
VerkaufsproduktType calcResponse = s.calculateRDFAuskunft(new TreeView<>(cleanedRoot), stichtag.get());
|
||||
newRoot.getValue().setProdukt(calcResponse);
|
||||
treeHelper.produktToTree(calcResponse, newRoot);
|
||||
}else {
|
||||
CalculateResponse calcResponse = s.calculateAuskunft(new TreeView<>(cleanedRoot), stichtag.get());
|
||||
newRoot.getValue().setProdukt(calcResponse.getBerechnungsantwort().getVerkaufsprodukt());
|
||||
treeHelper.produktToTree(calcResponse.getBerechnungsantwort().getVerkaufsprodukt(), newRoot);
|
||||
}
|
||||
|
||||
timesItemisIncludedById = treeHelper.getTimesItemisIncludedById();
|
||||
newRoot.setExpanded(true);
|
||||
|
||||
TreeItem<GuiProdukt> finalRoot = checkPlausis(plausiList, newRoot, verkaufsprodukt);
|
||||
if (finalRoot != null) {
|
||||
finalRoot.setExpanded(true);
|
||||
tv.setRoot(finalRoot);
|
||||
} else {
|
||||
newRoot = treeHelper.addAprioriToCalc(newRoot, originalRoot);
|
||||
newRoot = treeHelper.sortTree(newRoot);
|
||||
tv.setRoot(newRoot);
|
||||
}
|
||||
|
||||
|
||||
|
||||
timesItemisIncludedById.clear();
|
||||
|
||||
refreshTimesItemisIncludedById(tv.getRoot());
|
||||
|
||||
tv.refresh();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
});
|
||||
|
||||
if (!treeBox.getChildren().isEmpty()) {
|
||||
treeBox.getChildren().clear();
|
||||
}
|
||||
|
||||
tv.setRoot(treeHelper.sortTree(tv.getRoot()));
|
||||
|
||||
VBox.setVgrow(tv, Priority.ALWAYS);
|
||||
tv.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
tv.setStyle("-fx-border-color: white;");
|
||||
|
||||
treeBox.getChildren().add(tv);
|
||||
treeBox.setPadding(new Insets(10));
|
||||
treeBox.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
HBox.setHgrow(treeBox, Priority.ALWAYS);
|
||||
treeBox.setStyle("-fx-border-color: black; -fx-background-color: white");
|
||||
|
||||
infoBox.setStyle("-fx-border-color: black; -fx-background-color: white");
|
||||
infoBox.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
HBox.setHgrow(infoBox, Priority.ALWAYS);
|
||||
|
||||
HBox splitBox = new HBox(treeBox, infoBox);
|
||||
splitBox.setId("splitBox");
|
||||
splitBox.setSpacing(10);
|
||||
splitBox.setPadding(new Insets(20));
|
||||
splitBox.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
|
||||
VBox wrapper = new VBox(splitBox);
|
||||
wrapper.setAlignment(Pos.CENTER);
|
||||
VBox.setVgrow(splitBox, Priority.ALWAYS);
|
||||
|
||||
HBox logWrapper = new HBox();
|
||||
logWrapper.setPadding(new Insets(0, 20, 20, 20)); // Abstand zum Rand unten + Seite
|
||||
logWrapper.setAlignment(Pos.CENTER_LEFT);
|
||||
logWrapper.setMaxWidth(Double.MAX_VALUE);
|
||||
|
||||
vbox.getChildren().addAll(wrapper);
|
||||
VBox.setVgrow(wrapper, Priority.ALWAYS);
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
||||
private void includeAddedParent(TreeItem<GuiProdukt> treeItem) {
|
||||
if (treeItem.getParent() != null) {
|
||||
treeItem.getParent().getValue().setNotIncluded(false);
|
||||
if (treeItem.getParent().getParent() != null) {
|
||||
includeAddedParent(treeItem.getParent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void includeAddedChildren(TreeItem<GuiProdukt> parent) {
|
||||
for (int i = 0; i < parent.getChildren().size(); i++) {
|
||||
parent.getChildren().get(i).getValue().setNotIncluded(false);
|
||||
if (!shouldBeIncluded(parent.getChildren().get(i)) && !(parent.getChildren().get(i).getValue().isNotIncluded())) {
|
||||
parent.getChildren().get(i).getValue().setNotIncluded(true);
|
||||
} else {
|
||||
parent.getChildren().get(i).getValue().setNotIncluded(false);
|
||||
}
|
||||
|
||||
if (!parent.getChildren().get(i).getChildren().isEmpty() && parent.getChildren().get(i).getChildren() != null) {
|
||||
includeAddedChildren(parent.getChildren().get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldBeIncluded(TreeItem<GuiProdukt> treeItem) {
|
||||
return !(((treeItem.getParent() != null && treeItem.getParent().getValue().isNotIncluded()) || treeItem.getValue().isNotIncluded() ||
|
||||
(((ProduktbausteinType) treeItem.getValue().getProdukt()).getMinVorkommen() != null && ((ProduktbausteinType) treeItem.getValue().getProdukt()).getMinVorkommen() == 0 &&
|
||||
(timesItemisIncludedById.get(((ProduktbausteinType) treeItem.getValue().getProdukt()).getId()) == null ||
|
||||
timesItemisIncludedById.get(((ProduktbausteinType) treeItem.getValue().getProdukt()).getId()) == 0))) &&
|
||||
!(treeItem.getValue().getProdukt() instanceof VerkaufsproduktType));
|
||||
}
|
||||
|
||||
private Map<String, Integer> countChildIds(Map<String, Integer> count, TreeItem<GuiProdukt> root) {
|
||||
if (root != null) {
|
||||
for (int i = 0; i < root.getChildren().size(); i++) {
|
||||
TreeItem<GuiProdukt> item = root.getChildren().get(i);
|
||||
|
||||
if (count.get(((ProduktbausteinType) item.getValue().getProdukt()).getId()) == null) {
|
||||
count.put(((ProduktbausteinType) item.getValue().getProdukt()).getId(), 1);
|
||||
} else {
|
||||
count.replace(((ProduktbausteinType) item.getValue().getProdukt()).getId(),
|
||||
count.get(((ProduktbausteinType) item.getValue().getProdukt()).getId()) + 1);
|
||||
}
|
||||
|
||||
if (!item.getChildren().isEmpty()) {
|
||||
countChildIds(count, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
|
||||
}
|
||||
|
||||
private void refreshTimesItemisIncludedById(TreeItem<GuiProdukt> root) {
|
||||
for (int i = 0; i < root.getChildren().size(); i++) {
|
||||
TreeItem<GuiProdukt> item = root.getChildren().get(i);
|
||||
if (!item.getValue().isNotIncluded()) {
|
||||
if (timesItemisIncludedById.get(((ProduktbausteinType) item.getValue().getProdukt()).getId()) == null) {
|
||||
timesItemisIncludedById.put(((ProduktbausteinType) item.getValue().getProdukt()).getId(), 1);
|
||||
} else {
|
||||
timesItemisIncludedById.replace(((ProduktbausteinType) item.getValue().getProdukt()).getId(),
|
||||
timesItemisIncludedById.get(((ProduktbausteinType) item.getValue().getProdukt()).getId()) + 1);
|
||||
}
|
||||
}
|
||||
if (!item.getChildren().isEmpty()) {
|
||||
refreshTimesItemisIncludedById(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int timeItemIsIncludedByParent(TreeItem<GuiProdukt> parent, String itemId) {
|
||||
int erg = 0;
|
||||
for (int i = 0; i < parent.getChildren().size(); i++) {
|
||||
TreeItem<GuiProdukt> item = parent.getChildren().get(i);
|
||||
if (((ProduktbausteinType) item.getValue().getProdukt()).getId().equals(itemId)) {
|
||||
if (!item.getValue().isNotIncluded()) {
|
||||
erg++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return erg;
|
||||
}
|
||||
public boolean isMeldungVorhanden(ProduktbausteinType produkt, TreeView<GuiProdukt> tv) {
|
||||
TreeHelper treeHelper = new TreeHelper();
|
||||
TreeItem<GuiProdukt> actual = treeHelper.findTreeItem(produkt, tv.getRoot());
|
||||
|
||||
if (actual != null && ((ProduktbausteinType)actual.getValue().getProdukt()).getMeldungen() != null && !((ProduktbausteinType)actual.getValue().getProdukt()).getMeldungen().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
for (ProduktbausteinType child : produkt.getBausteine()){
|
||||
if(isMeldungVorhanden(child, tv)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public TreeItem<GuiProdukt> checkPlausis(List<Plausi> plausiList, TreeItem<GuiProdukt> vp, APrioriProduktbausteinType verkaufsprodukt){
|
||||
Repository repo = new SailRepository(new MemoryStore());
|
||||
repo.init();
|
||||
|
||||
try (RepositoryConnection conn = repo.getConnection()) {
|
||||
Model model = rdfHelper.createRdfModel(vp);
|
||||
|
||||
conn.add(model);
|
||||
|
||||
plausiList.stream().filter(p -> p.getArt().equals("update")).forEach(p -> {
|
||||
String query = p.getQuery();
|
||||
|
||||
conn.prepareUpdate(query).execute();
|
||||
});
|
||||
|
||||
model.clear();
|
||||
conn.getStatements(null, null, null).forEach(model::add);
|
||||
|
||||
plausiList.stream().filter(p -> p.getArt().equals("graph")).forEach(p -> {
|
||||
String sparql = p.getQuery();
|
||||
|
||||
GraphQuery q = conn.prepareGraphQuery(sparql);
|
||||
Model validatedModel = QueryResults.asModel(q.evaluate());
|
||||
|
||||
model.addAll(validatedModel);
|
||||
});
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
Rio.write(model, baos, RDFFormat.JSONLD);
|
||||
|
||||
VerkaufsproduktType neuRoot = rdfHelper.calculateRequestToVerkaufsprodukt(baos.toString());
|
||||
TreeItem<GuiProdukt> newRoot = new TreeItem<>(new GuiProdukt(neuRoot));
|
||||
newRoot.setExpanded(true);
|
||||
|
||||
try {
|
||||
treeHelper.produktToTree(neuRoot, newRoot);
|
||||
|
||||
TreeItem<GuiProdukt> aprioriTree = new TreeItem<>();
|
||||
treeHelper.aprioriProduktToTree(verkaufsprodukt, aprioriTree);
|
||||
|
||||
return (treeHelper.sortTree(treeHelper.addAprioriToCalc(newRoot, aprioriTree)));
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
} catch(Exception ignored) {
|
||||
ignored.printStackTrace();
|
||||
System.out.println("CheckPlausi: " + ignored.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
package at.vvo.omds.client.gui;
|
||||
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.ProduktbausteinType;
|
||||
import at.vvo.omds.types.omds3.r2025_05.on2antrag.kfz.ObjectFactory;
|
||||
|
||||
public class ObjectFactoryFactory {
|
||||
public Object create(String classPath) {
|
||||
public ProduktbausteinType create(String classPath) {
|
||||
if (classPath != null) {
|
||||
if (classPath.toLowerCase().contains("kfz")){
|
||||
ObjectFactory of = new ObjectFactory();
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package at.vvo.omds.client.gui;
|
||||
|
||||
public class Plausi {
|
||||
String id;
|
||||
String beschreibung;
|
||||
String art;
|
||||
String query;
|
||||
|
||||
|
||||
public Plausi(String name, String beschreibung,String art, String query) {
|
||||
this.id = name;
|
||||
this.beschreibung = beschreibung;
|
||||
this.art = art;
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getBeschreibung() {
|
||||
return beschreibung;
|
||||
}
|
||||
|
||||
public void setBeschreibung(String beschreibung) {
|
||||
this.beschreibung = beschreibung;
|
||||
}
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query) {
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public String getArt() { return art; }
|
||||
|
||||
public void setArt(String art) { this.art = art; }
|
||||
}
|
||||
@@ -0,0 +1,661 @@
|
||||
package at.vvo.omds.client.gui;
|
||||
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.*;
|
||||
import at.vvo.omds.types.omds3.r2025_05.on2antrag.sachPrivat.RisikoGebaeudeType;
|
||||
import at.vvo.omds.types.omds3.r2025_05.on2antrag.sachPrivat.RisikoHaushaltType;
|
||||
import at.vvo.omds.types.omds3.r2025_05.on2antrag.sachPrivat.VersichertesObjektSachPrivatType;
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.util.Pair;
|
||||
import org.eclipse.rdf4j.model.impl.LinkedHashModel;
|
||||
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
|
||||
import org.eclipse.rdf4j.model.util.Models;
|
||||
import org.eclipse.rdf4j.model.util.Values;
|
||||
import org.eclipse.rdf4j.model.vocabulary.RDF;
|
||||
import org.eclipse.rdf4j.rio.RDFFormat;
|
||||
import org.eclipse.rdf4j.rio.Rio;
|
||||
import org.eclipse.rdf4j.model.*;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.client.RestClient;
|
||||
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
import java.io.Console;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
|
||||
import static org.eclipse.rdf4j.model.util.Values.iri;
|
||||
|
||||
public class RDFHelper {
|
||||
|
||||
private final RestClient restClient = RestClient.create();
|
||||
|
||||
public Pair<List<APrioriVerkaufsproduktType>, List<Plausi>> getAprioriRDF(JAXBElement<ProductsRequest> r) throws DatatypeConfigurationException, IOException {
|
||||
String response = restClient.post()
|
||||
.uri("http://localhost:9090/ProductsRequest")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.body(r.getValue())
|
||||
.retrieve()
|
||||
.toEntity(String.class)
|
||||
.getBody();
|
||||
|
||||
|
||||
List<Pair<String, AttributType>> attributeListe = getAttributesFromRequest(response);
|
||||
List<APrioriVerkaufsproduktType> result = productsRequestToVerkaufsprodukt(response, attributeListe);
|
||||
List<Plausi> result2 = productsRequestToPlausi(response);
|
||||
|
||||
return new Pair<>(result, result2);
|
||||
}
|
||||
|
||||
private List<Pair<String, AttributType>> getAttributesFromRequest(String response) throws IOException {
|
||||
Model model = Rio.parse(new StringReader(response), "", RDFFormat.JSONLD);
|
||||
List<Pair<String, AttributType>> erg = new ArrayList<>();
|
||||
|
||||
String baseIri = "http://vvo.pisanoapi.at/";
|
||||
|
||||
IRI bezIri = iri(baseIri + "bez");
|
||||
IRI produktIri = iri(baseIri + "ProdElement");
|
||||
IRI requiredIri = iri(baseIri + "required");
|
||||
IRI maxIri = iri(baseIri + "max");
|
||||
IRI minIri = iri(baseIri + "min");
|
||||
IRI defaultIri = iri(baseIri + "default");
|
||||
IRI valueIri = iri(baseIri + "value");
|
||||
IRI aenderbarIri = iri(baseIri + "aenderbar");
|
||||
|
||||
|
||||
for (Resource iri : Models.subjectIRIs(model)) {
|
||||
String bez = Models.objectLiteral(model.filter(iri, bezIri, null)).map(Literal::getLabel).orElse(null);
|
||||
String prodId = Models.objectResource(model.filter(iri, produktIri, null)).map(Resource::stringValue)
|
||||
.orElse(Models.objectLiteral(model.filter(iri, produktIri, null)).map(Literal::getLabel).orElse(null));
|
||||
Boolean required = Boolean.valueOf(Models.objectLiteral(model.filter(iri, requiredIri, null)).map(Literal::getLabel).orElse(null));
|
||||
Boolean aenderbar = Boolean.valueOf(Models.objectLiteral(model.filter(iri, aenderbarIri, null)).map(Literal::getLabel).orElse("true"));
|
||||
|
||||
if (iri.stringValue().contains("ElemBoolean")) {
|
||||
AttributBooleanType ab = new AttributBooleanType();
|
||||
|
||||
Boolean val = Boolean.valueOf(Models.objectLiteral(model.filter(iri, valueIri, null)).map(Literal::getLabel).orElse(null));
|
||||
Boolean def = Boolean.valueOf(Models.objectLiteral(model.filter(iri, defaultIri, null)).map(Literal::getLabel).orElse(null));
|
||||
|
||||
int start = iri.stringValue().lastIndexOf("ElemBoolean");
|
||||
ab.setId(BigInteger.valueOf(Long.valueOf(iri.stringValue().substring(start + "ElemBoolean".length()))));
|
||||
|
||||
ab.setBezeichnung(bez);
|
||||
ab.setDefault(def);
|
||||
ab.setPflichtfeld(required);
|
||||
ab.setValue(val);
|
||||
ab.setAenderbar(aenderbar);
|
||||
|
||||
Pair<String, AttributType> atPair = new Pair<>(prodId, ab);
|
||||
erg.add(atPair);
|
||||
} else if (iri.stringValue().contains("ElemInt")) {
|
||||
AttributIntType ai = new AttributIntType();
|
||||
|
||||
Integer val = Integer.parseInt(Models.objectLiteral(model.filter(iri, valueIri, null)).map(Literal::getLabel).orElse("-1"));
|
||||
Integer def = Integer.parseInt(Models.objectLiteral(model.filter(iri, defaultIri, null)).map(Literal::getLabel).orElse("-1"));
|
||||
Integer min = Integer.parseInt(Models.objectLiteral(model.filter(iri, minIri, null)).map(Literal::getLabel).orElse("-1"));
|
||||
Integer max = Integer.parseInt(Models.objectLiteral(model.filter(iri, maxIri, null)).map(Literal::getLabel).orElse("-1"));
|
||||
|
||||
int start = iri.stringValue().lastIndexOf("ElemInt");
|
||||
ai.setId(BigInteger.valueOf(Long.parseLong(iri.stringValue().substring(start + "ElemInt".length()))));
|
||||
|
||||
ai.setBezeichnung(bez);
|
||||
ai.setDefault(def);
|
||||
ai.setPflichtfeld(required);
|
||||
ai.setMax(max);
|
||||
ai.setMin(min);
|
||||
if (!val.equals(-1))ai.setValue(val);
|
||||
ai.setAenderbar(aenderbar);
|
||||
|
||||
Pair<String, AttributType> atPair = new Pair<>(prodId, ai);
|
||||
erg.add(atPair);
|
||||
} else if (iri.stringValue().contains("ElemDecimal")) {
|
||||
AttributDezimalType ad = new AttributDezimalType();
|
||||
|
||||
BigDecimal val = Models.objectLiteral(model.filter(iri, valueIri, null)).map(Literal::decimalValue).orElse(BigDecimal.valueOf(-1));
|
||||
BigDecimal def = Models.objectLiteral(model.filter(iri, defaultIri, null)).map(Literal::decimalValue).orElse(BigDecimal.valueOf(-1));
|
||||
BigDecimal min = Models.objectLiteral(model.filter(iri, minIri, null)).map(Literal::decimalValue).orElse(BigDecimal.valueOf(-1));
|
||||
BigDecimal max = Models.objectLiteral(model.filter(iri, maxIri, null)).map(Literal::decimalValue).orElse(BigDecimal.valueOf(-1));
|
||||
|
||||
int start = iri.stringValue().lastIndexOf("ElemDecimal");
|
||||
ad.setId(BigInteger.valueOf(Long.valueOf(iri.stringValue().substring(start + "ElemDecimal".length()))));
|
||||
|
||||
ad.setBezeichnung(bez);
|
||||
ad.setDefault(def);
|
||||
ad.setPflichtfeld(required);
|
||||
ad.setMax(max);
|
||||
ad.setMin(min);
|
||||
if (!val.equals(BigDecimal.valueOf(-1)))ad.setValue(val);
|
||||
ad.setAenderbar(aenderbar);
|
||||
|
||||
Pair<String, AttributType> atPair = new Pair<>(prodId, ad);
|
||||
erg.add(atPair);
|
||||
} else if (iri.stringValue().contains("ElemString")) {
|
||||
AttributStringType as = new AttributStringType();
|
||||
|
||||
String val = String.valueOf(Models.objectLiteral(model.filter(iri, valueIri, null)).map(Literal::getLabel).orElse(null));
|
||||
String def = String.valueOf(Models.objectLiteral(model.filter(iri, defaultIri, null)).map(Literal::getLabel).orElse(null));
|
||||
|
||||
int start = iri.stringValue().lastIndexOf("ElemString");
|
||||
as.setId(BigInteger.valueOf(Long.parseLong(iri.stringValue().substring(start + "ElemString".length()))));
|
||||
|
||||
as.setBezeichnung(bez);
|
||||
as.setDefault(def);
|
||||
as.setPflichtfeld(required);
|
||||
as.setValue(val);
|
||||
as.setAenderbar(aenderbar);
|
||||
|
||||
Pair<String, AttributType> atPair = new Pair<>(prodId, as);
|
||||
erg.add(atPair);
|
||||
}
|
||||
}
|
||||
|
||||
return erg;
|
||||
}
|
||||
|
||||
private List<Plausi> productsRequestToPlausi(String response) throws IOException {
|
||||
List<Plausi> result = new ArrayList<>();
|
||||
Model model = Rio.parse(new StringReader(response), "", RDFFormat.JSONLD);
|
||||
|
||||
for (Resource iri : Models.subjectIRIs(model)) {
|
||||
if (iri.stringValue().contains("Plausi")) {
|
||||
String id = iri.stringValue().replace("http://vvo.pisanoapi.at/Plausi", "");
|
||||
ValueFactory vf = SimpleValueFactory.getInstance();
|
||||
|
||||
String beschreibung = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/beschreibung"), null)).map(Literal::getLabel).orElse(null);
|
||||
|
||||
String query = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/query"), null)).map(Literal::getLabel).orElse(null);
|
||||
|
||||
String art = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/art"), null)).map(Literal::getLabel).orElse(null);
|
||||
|
||||
result.add(new Plausi(id, beschreibung, art, query));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<APrioriVerkaufsproduktType> productsRequestToVerkaufsprodukt(String productsRequest, List<Pair<String, AttributType>> attributeListe) throws IOException, DatatypeConfigurationException {
|
||||
Model model = Rio.parse(new StringReader(productsRequest), "", RDFFormat.JSONLD);
|
||||
|
||||
Map<String, APrioriProduktbausteinType> bausteine = new HashMap<>();
|
||||
Map<String, String> parents = new HashMap<>();
|
||||
|
||||
for (Resource iri : Models.subjectIRIs(model)) {
|
||||
if (iri.stringValue().contains("ProdElement")) {
|
||||
|
||||
String id = iri.stringValue();
|
||||
ValueFactory vf = SimpleValueFactory.getInstance();
|
||||
|
||||
int insId = Integer.parseInt(Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/ins_id"), null)).map(Literal::getLabel).orElse("-1"));
|
||||
int maxOccurrence = Integer.parseInt(Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/maxOccurrence"), null)).map(Literal::getLabel).orElse("-1"));
|
||||
int minOccurrence = Integer.parseInt(Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/minOccurrence"), null)).map(Literal::getLabel).orElse("-1"));
|
||||
String bez = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/bez"), null)).map(Literal::getLabel).orElse(null);
|
||||
String type = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/type"), null)).map(Literal::getLabel).orElse(null);
|
||||
String risikoobjektType = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/risikoobjektType"), null)).map(Literal::getLabel).orElse(null);
|
||||
String praemie = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/praemienfaktor"), null)).map(Literal::getLabel).orElse(null);
|
||||
XMLGregorianCalendar verkaufsoffenVon = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/salesFrom"), null)).map(Literal::getLabel).isPresent() ?
|
||||
DatatypeFactory.newInstance().newXMLGregorianCalendar( Models.objectLiteral(model.filter(
|
||||
iri, vf.createIRI("http://vvo.pisanoapi.at/salesFrom"), null))
|
||||
.map(Literal::getLabel).orElse(null)) : null;
|
||||
XMLGregorianCalendar verkaufsoffenBis = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/salesTo"), null)).map(Literal::getLabel).isPresent() ?
|
||||
DatatypeFactory.newInstance().newXMLGregorianCalendar( Models.objectLiteral(model.filter(
|
||||
iri, vf.createIRI("http://vvo.pisanoapi.at/salesTo"), null))
|
||||
.map(Literal::getLabel).orElse(null)) : null;
|
||||
|
||||
Optional<String> parentId = Models.objectResource(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/Parent"), null)).map(Resource::stringValue);
|
||||
|
||||
APrioriProduktbausteinType verkaufsproduktType;
|
||||
if (parentId.isPresent()) {
|
||||
verkaufsproduktType = new APrioriUnterbausteinType();
|
||||
} else {
|
||||
verkaufsproduktType = new APrioriVerkaufsproduktType();
|
||||
}
|
||||
|
||||
for (Pair<String, AttributType> attribute : attributeListe) {
|
||||
if (attribute.getKey().equals(id)){
|
||||
verkaufsproduktType.getAttribute().add(attribute.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
verkaufsproduktType.setId(iri.stringValue().substring("http://vvo.pisanoapi.at/ProdElement".length(), iri.stringValue().indexOf("-") > 0 ? iri.stringValue().indexOf("-") : iri.stringValue().length()));
|
||||
verkaufsproduktType.setName(bez);
|
||||
verkaufsproduktType.setType(type);
|
||||
verkaufsproduktType.setFrom(verkaufsoffenVon);
|
||||
verkaufsproduktType.setTo(verkaufsoffenBis);
|
||||
verkaufsproduktType.setMaxOccurrences(maxOccurrence);
|
||||
verkaufsproduktType.setMinOccurrences(minOccurrence);
|
||||
verkaufsproduktType.setRisikoobjektType(risikoobjektType);
|
||||
verkaufsproduktType.setPraemienfaktor(praemie);
|
||||
|
||||
parentId.ifPresent(p -> parents.put(id, p));
|
||||
bausteine.put(id, verkaufsproduktType);
|
||||
}
|
||||
}
|
||||
|
||||
List<APrioriVerkaufsproduktType> verkaufsprodukteList = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<String, APrioriProduktbausteinType> entry : bausteine.entrySet()){
|
||||
String id = entry.getKey();
|
||||
Object baustein = entry.getValue();
|
||||
String parentId = parents.get(id);
|
||||
|
||||
if (parentId != null && bausteine.containsKey(parentId)){
|
||||
bausteine.get(parentId).getBausteine().add((APrioriUnterbausteinType) baustein);
|
||||
}else {
|
||||
verkaufsprodukteList.add((APrioriVerkaufsproduktType) baustein);
|
||||
}
|
||||
}
|
||||
|
||||
return verkaufsprodukteList;
|
||||
}
|
||||
|
||||
public VerkaufsproduktType getCalculateRDF(String r) throws DatatypeConfigurationException, IOException {
|
||||
return calculateRequestToVerkaufsprodukt(restClient.post()
|
||||
.uri("http://localhost:9090/CalculateRequest")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.body(r)
|
||||
.retrieve()
|
||||
.toEntity(String.class)
|
||||
.getBody());
|
||||
}
|
||||
|
||||
public VerkaufsproduktType calculateRequestToVerkaufsprodukt(String calculateRequest) throws IOException, DatatypeConfigurationException {
|
||||
Model model = Rio.parse(new StringReader(calculateRequest), "", RDFFormat.JSONLD);
|
||||
|
||||
Map<String, ProduktbausteinType> bausteine = new LinkedHashMap<>();
|
||||
Map<String, String> parents = new HashMap<>();
|
||||
|
||||
List<Pair<String, AttributType>> attListe = getAttributesFromRequest(calculateRequest);
|
||||
List<Pair<String, FahrzeugType>> risikoObjektListe = getRisikoObjekteFromRequest(calculateRequest);
|
||||
|
||||
List<Resource> subjects = new ArrayList<>(Models.subjectIRIs(model));
|
||||
Collections.reverse(subjects);
|
||||
|
||||
for (Resource iri : subjects) {
|
||||
if (iri.stringValue().contains("Prod")) {
|
||||
String id = iri.stringValue();
|
||||
|
||||
ValueFactory vf = SimpleValueFactory.getInstance();
|
||||
|
||||
int insId = Integer.parseInt(Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/ins_id"), null)).map(Literal::getLabel).orElse("-1"));
|
||||
int maxOccurrence = Integer.parseInt(Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/maxOccurrence"), null)).map(Literal::getLabel).orElse("-1"));
|
||||
int minOccurrence = Integer.parseInt(Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/minOccurrence"), null)).map(Literal::getLabel).orElse("-1"));
|
||||
String bez = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/bez"), null)).map(Literal::getLabel).orElse(null);
|
||||
String type = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/type"), null)).map(Literal::getLabel).orElse(null);
|
||||
String risikoobjektType = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/risikoobjektType"), null)).map(Literal::getLabel).orElse(null);
|
||||
String praemie = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/praemienfaktor"), null)).map(Literal::getLabel).orElse(null);
|
||||
List<ServiceFault> meldungen = model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/Meldung"), null).objects().stream()
|
||||
.filter(s -> s instanceof IRI).map(s -> {
|
||||
IRI spezMeldung = (IRI) s;
|
||||
|
||||
String msg = Models.objectLiteral(model.filter(spezMeldung, vf.createIRI("http://vvo.pisanoapi.at/errorMsg"), null)).map(Literal::getLabel).orElse(null);
|
||||
String errorType = Models.objectLiteral(model.filter(spezMeldung, vf.createIRI("http://vvo.pisanoapi.at/errorType"), null)).map(Literal::getLabel).orElse(null);
|
||||
|
||||
ServiceFault serviceFault = new ServiceFault();
|
||||
|
||||
serviceFault.setErrorMsg(msg);
|
||||
serviceFault.setErrorType(BigInteger.valueOf(Integer.parseInt("1")));
|
||||
|
||||
return serviceFault;
|
||||
}).toList();
|
||||
XMLGregorianCalendar verkaufsoffenVon = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/salesFrom"), null)).map(Literal::getLabel).isPresent() ? DatatypeFactory.newInstance().newXMLGregorianCalendar(
|
||||
Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/salesFrom"), null)).map(Literal::getLabel).orElse(null)) : null;
|
||||
XMLGregorianCalendar verkaufsoffenBis = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/salesTo"), null)).map(Literal::getLabel).isPresent() ? DatatypeFactory.newInstance().newXMLGregorianCalendar(
|
||||
Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/salesTo"), null)).map(Literal::getLabel).orElse(null)) : null;
|
||||
List<String> fahrzeuge = model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/VersichertesInteresseType"), null).objects().stream()
|
||||
.filter(s -> s instanceof IRI).map(Value::stringValue).toList();
|
||||
|
||||
Optional<String> parentId = Models.objectResource(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/Parent"), null)).map(Resource::stringValue);
|
||||
if (parentId.isEmpty()) {
|
||||
parentId = Models.objectLiteral(model.filter(iri, vf.createIRI(
|
||||
"http://vvo.pisanoapi.at/Parent"), null)).map(Literal::getLabel);
|
||||
}
|
||||
|
||||
ObjectFactoryFactory off = new ObjectFactoryFactory();
|
||||
|
||||
ProduktbausteinType verkaufsproduktType = off.create(type);
|
||||
|
||||
verkaufsproduktType.setId(iri.stringValue().substring("http://vvo.pisanoapi.at/ProdElement".length(), iri.stringValue().indexOf("-") > 0 ? iri.stringValue().indexOf("-") : iri.stringValue().length()));
|
||||
verkaufsproduktType.setBezeichnung(bez);
|
||||
verkaufsproduktType.setTyp(type);
|
||||
verkaufsproduktType.setVerkaufsoffenVon(verkaufsoffenVon);
|
||||
verkaufsproduktType.setVerkaufsoffenBis(verkaufsoffenBis);
|
||||
verkaufsproduktType.setMaxVorkommen(maxOccurrence);
|
||||
verkaufsproduktType.setMinVorkommen(minOccurrence);
|
||||
verkaufsproduktType.setRisikoobjektErforderlich(risikoobjektType != null);
|
||||
verkaufsproduktType.setPraemienfaktor(praemie);
|
||||
|
||||
for (ServiceFault meldung : meldungen) {
|
||||
if (meldung != null) {
|
||||
ServiceFault tmp = new ServiceFault();
|
||||
tmp.setErrorMsg(meldung.getErrorMsg());
|
||||
tmp.setErrorType(meldung.getErrorType());
|
||||
verkaufsproduktType.getMeldungen().add(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
for (Pair<String, FahrzeugType> pair : risikoObjektListe) {
|
||||
for (String fahrzeugId : fahrzeuge) {
|
||||
if (pair.getKey().equals(fahrzeugId)) {
|
||||
verkaufsproduktType.getVersicherteObjekte().add(pair.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Pair<String, AttributType> pair : attListe) {
|
||||
if (pair.getKey().equals(id)) {
|
||||
verkaufsproduktType.getAttribute().add(pair.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
parentId.ifPresent(p -> parents.put(id, p));
|
||||
bausteine.put(id, verkaufsproduktType);
|
||||
}
|
||||
}
|
||||
|
||||
List<VerkaufsproduktType> verkaufsprodukteList = new ArrayList<>();
|
||||
|
||||
|
||||
for (Map.Entry<String, ProduktbausteinType> entry : bausteine.entrySet()){
|
||||
String id = entry.getKey();
|
||||
ProduktbausteinType baustein = entry.getValue();
|
||||
String parentId = parents.get(id);
|
||||
|
||||
if (parentId != null && bausteine.containsKey(parentId)){
|
||||
bausteine.get(parentId).getBausteine().add(baustein);
|
||||
}else {
|
||||
verkaufsprodukteList.add((VerkaufsproduktType) baustein);
|
||||
}
|
||||
}
|
||||
|
||||
return verkaufsprodukteList.getFirst();
|
||||
}
|
||||
|
||||
private List<Pair<String, FahrzeugType>> getRisikoObjekteFromRequest(String calculateRequest) throws IOException, DatatypeConfigurationException {
|
||||
Model model = Rio.parse(new StringReader(calculateRequest), "", RDFFormat.JSONLD);
|
||||
List<Pair<String, FahrzeugType>> erg = new ArrayList<>();
|
||||
|
||||
String baseIri = "http://vvo.pisanoapi.at/";
|
||||
IRI bezIri = iri(baseIri + "bez");
|
||||
IRI baujahrIri = iri(baseIri + "baujahr");
|
||||
IRI erstzulassungIri = iri(baseIri + "erstzulassung");
|
||||
IRI kenIri = iri(baseIri + "kennzeichen");
|
||||
IRI leistungIri = iri(baseIri + "leistung");
|
||||
IRI sonderIri = iri(baseIri + "sonderausstattung");
|
||||
IRI listenpreisIri = iri(baseIri + "listenpreis");
|
||||
|
||||
|
||||
for (Resource iri : Models.subjectIRIs(model)) {
|
||||
if (iri.stringValue().contains("Fahrzeug")) {
|
||||
String id = iri.stringValue();
|
||||
|
||||
String bez = Models.objectLiteral(
|
||||
model.filter(iri, bezIri, null)).map(Literal::getLabel).orElse(null);
|
||||
String ken = Models.objectLiteral(
|
||||
model.filter(iri, kenIri, null)).map(Literal::getLabel).orElse(null);
|
||||
BigDecimal listenpreis = BigDecimal.valueOf(
|
||||
Double.parseDouble(Models.objectLiteral(model.filter(iri, listenpreisIri, null))
|
||||
.map(Literal::getLabel).orElse("-1")));
|
||||
BigDecimal sonderausstattung = BigDecimal.valueOf(
|
||||
Double.parseDouble(Models.objectLiteral(model.filter(iri, sonderIri, null))
|
||||
.map(Literal::getLabel).orElse("-1")));
|
||||
|
||||
int leistung = Integer.parseInt(Models.objectLiteral(
|
||||
model.filter(iri, leistungIri, null)).map(Literal::getLabel).orElse("-1"));
|
||||
int baujahr = Integer.parseInt(Models.objectLiteral(
|
||||
model.filter(iri, baujahrIri, null)).map(Literal::getLabel).orElse("-1"));
|
||||
|
||||
XMLGregorianCalendar erstzulassung = Models.objectLiteral(model.filter(
|
||||
iri, erstzulassungIri, null)).map(Literal::getLabel).isPresent() ?
|
||||
DatatypeFactory.newInstance().newXMLGregorianCalendar(
|
||||
Models.objectLiteral(model.filter(iri, erstzulassungIri, null))
|
||||
.map(Literal::getLabel).orElse(null)) : null;
|
||||
|
||||
FahrzeugType fahrzeug = new FahrzeugType();
|
||||
|
||||
fahrzeug.setErstzulassdat(erstzulassung);
|
||||
fahrzeug.setBaujahr(baujahr);
|
||||
fahrzeug.setHandelsbez(bez);
|
||||
fahrzeug.setPolKennz(ken);
|
||||
fahrzeug.setLeistung(leistung);
|
||||
fahrzeug.setListenpreis(listenpreis);
|
||||
fahrzeug.setSonderausstattung(sonderausstattung);
|
||||
|
||||
erg.add(new Pair<>(id, fahrzeug));
|
||||
}
|
||||
}
|
||||
return erg;
|
||||
}
|
||||
|
||||
public Model createRdfModel(TreeItem<GuiProdukt> vp) {
|
||||
Model erg = new LinkedHashModel();
|
||||
String baseIri = "http://vvo.pisanoapi.at/";
|
||||
|
||||
Map<String, Integer> idCount = new LinkedHashMap<>();
|
||||
createIdCount(idCount, vp);
|
||||
|
||||
Map<TreeItem<GuiProdukt>, IRI> iriMap = new LinkedHashMap<>();
|
||||
createIriMap(vp, baseIri, idCount, iriMap);
|
||||
|
||||
addProduktToModel(vp, erg, baseIri, null, iriMap);
|
||||
|
||||
return erg;
|
||||
}
|
||||
|
||||
private void createIdCount(Map<String, Integer> idCount, TreeItem<GuiProdukt> vp) {
|
||||
if (!idCount.containsKey(((ProduktbausteinType) vp.getValue().getProdukt()).getId())) {
|
||||
idCount.put(((ProduktbausteinType) vp.getValue().getProdukt()).getId(), 1);
|
||||
}else {
|
||||
idCount.put(((ProduktbausteinType) vp.getValue().getProdukt()).getId(), idCount.get(((ProduktbausteinType) vp.getValue().getProdukt()).getId()) + 1);
|
||||
}
|
||||
|
||||
for (TreeItem<GuiProdukt> child : vp.getChildren()){
|
||||
createIdCount(idCount, child);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createIriMap(TreeItem<GuiProdukt> produkt, String baseIri, Map<String, Integer> idCount, Map<TreeItem<GuiProdukt>, IRI> iriMap) {
|
||||
IRI baseElemIri = iri(baseIri + "ProdElement");
|
||||
|
||||
for (int i = 1; i < idCount.get(((ProduktbausteinType)produkt.getValue().getProdukt()).getId())+1; i++) {
|
||||
IRI tmpIri = iri(baseElemIri + ((ProduktbausteinType) produkt.getValue().getProdukt()).getId() + "-" + i);
|
||||
|
||||
if (!iriMap.containsValue(tmpIri)) {
|
||||
iriMap.put(produkt, tmpIri);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (TreeItem<GuiProdukt> child : produkt.getChildren()){
|
||||
createIriMap(child, baseIri, idCount, iriMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addProduktToModel(TreeItem<GuiProdukt> guiProdukt, Model model, String baseIri, String parentId, Map<TreeItem<GuiProdukt>, IRI> iriMap) {
|
||||
ProduktbausteinType produkt = (ProduktbausteinType) guiProdukt.getValue().getProdukt();
|
||||
|
||||
IRI prodelemIri = iri(baseIri + "ProdElement");
|
||||
IRI insIdIri = iri(baseIri + "ins_id");
|
||||
IRI bezIri = iri(baseIri + "bez");
|
||||
IRI createdIri = iri(baseIri + "created");
|
||||
IRI salesFromIri = iri(baseIri + "salesFrom");
|
||||
IRI salesToIri = iri(baseIri + "salesTo");
|
||||
IRI minOccurrenceIri = iri(baseIri + "minOccurrence");
|
||||
IRI maxOccurrenceIri = iri(baseIri + "maxOccurrence");
|
||||
IRI typeIri = iri(baseIri + "type");
|
||||
IRI risikoobjektTypeIri = iri(baseIri + "risikoobjektType");
|
||||
IRI bausteinIri = iri(baseIri + "Baustein");
|
||||
IRI parentIri = iri(baseIri + "Parent");
|
||||
IRI praemieIri = iri(baseIri + "praemienfaktor");
|
||||
|
||||
IRI vpIri = iriMap.get(guiProdukt);
|
||||
|
||||
if (!guiProdukt.getValue().isNotIncluded()) {
|
||||
model.add(vpIri, RDF.TYPE, prodelemIri);
|
||||
model.add(vpIri, bezIri, Values.literal(produkt.getBezeichnung()));
|
||||
if (produkt.getVerkaufsoffenVon() != null)
|
||||
model.add(vpIri, salesFromIri, Values.literal(produkt.getVerkaufsoffenVon()));
|
||||
if (produkt.getVerkaufsoffenBis() != null)
|
||||
model.add(vpIri, salesToIri, Values.literal(produkt.getVerkaufsoffenBis()));
|
||||
if (produkt.getMinVorkommen() != null)
|
||||
model.add(vpIri, minOccurrenceIri, Values.literal(produkt.getMinVorkommen()));
|
||||
if (produkt.getMaxVorkommen() != null)
|
||||
model.add(vpIri, maxOccurrenceIri, Values.literal(produkt.getMaxVorkommen()));
|
||||
model.add(vpIri, typeIri, Values.literal(produkt.getTyp()));
|
||||
if (produkt.isRisikoobjektErforderlich()) model.add(vpIri, risikoobjektTypeIri, Values.literal("FahrzeugType"));
|
||||
if (produkt.getPraemienfaktor() != null) model.add(vpIri, praemieIri, Values.literal(produkt.getPraemienfaktor()));
|
||||
if (parentId != null) model.add(vpIri, parentIri, Values.iri(parentId));
|
||||
|
||||
}
|
||||
|
||||
for (AttributType attribut : produkt.getAttribute()){
|
||||
IRI atBez = iri(baseIri + "bez");
|
||||
IRI atRequiredIri = iri(baseIri + "required");
|
||||
IRI atProd = iri(baseIri + "ProdElement");
|
||||
IRI atValue = iri(baseIri + "value");
|
||||
IRI atMax = iri(baseIri + "max");
|
||||
IRI atMin = iri(baseIri + "min");
|
||||
IRI atDefault = iri(baseIri + "default");
|
||||
IRI atAenderbar = iri(baseIri + "aenderbar");
|
||||
|
||||
if (attribut instanceof AttributIntType){
|
||||
IRI specificAt = iri(baseIri + "ElemInt" + attribut.getId());
|
||||
|
||||
model.add(specificAt, RDF.TYPE, iri(baseIri + "ElemInt"));
|
||||
model.add(specificAt, atBez, Values.literal(attribut.getBezeichnung()));
|
||||
model.add(specificAt, atRequiredIri, Values.literal(((AttributIntType) attribut).isPflichtfeld()));
|
||||
if (((AttributIntType) attribut).getValue() != null) model.add(specificAt, atValue, Values.literal(((AttributIntType) attribut).getValue()));
|
||||
model.add(specificAt, atProd, vpIri);
|
||||
model.add(specificAt, atMax, Values.literal(((AttributIntType) attribut).getMax()));
|
||||
model.add(specificAt, atMin, Values.literal(((AttributIntType) attribut).getMin()));
|
||||
model.add(specificAt, atDefault, Values.literal(((AttributIntType) attribut).getDefault()));
|
||||
model.add(specificAt, atAenderbar, Values.literal(attribut.isAenderbar() != null ? attribut.isAenderbar().toString() : true));
|
||||
|
||||
} else if (attribut instanceof AttributBooleanType) {
|
||||
IRI specificAt = iri(baseIri + "ElemBoolean" + attribut.getId());
|
||||
|
||||
model.add(specificAt, RDF.TYPE, iri(baseIri + "ElemBoolean"));
|
||||
model.add(specificAt, atBez, Values.literal(attribut.getBezeichnung()));
|
||||
model.add(specificAt, atRequiredIri, Values.literal(((AttributBooleanType) attribut).isPflichtfeld()));
|
||||
if (((AttributBooleanType) attribut).isValue() != null) model.add(specificAt, atValue, Values.literal(((AttributBooleanType) attribut).isValue()));
|
||||
model.add(specificAt, atProd, vpIri);
|
||||
model.add(specificAt, atDefault, Values.literal(((AttributBooleanType) attribut).isDefault()));
|
||||
|
||||
} else if (attribut instanceof AttributStringType) {
|
||||
IRI specificAt = iri(baseIri + "ElemString" + attribut.getId());
|
||||
|
||||
model.add(specificAt, RDF.TYPE, iri(baseIri + "ElemString"));
|
||||
model.add(specificAt, atBez, Values.literal(attribut.getBezeichnung()));
|
||||
model.add(specificAt, atRequiredIri, Values.literal(((AttributStringType) attribut).isPflichtfeld()));
|
||||
if (((AttributStringType) attribut).getValue() != null) model.add(specificAt, atValue, Values.literal(((AttributStringType) attribut).getValue()));
|
||||
model.add(specificAt, atProd, vpIri);
|
||||
model.add(specificAt, atDefault, Values.literal(((AttributStringType) attribut).getDefault()));
|
||||
|
||||
} else if (attribut instanceof AttributDezimalType) {
|
||||
IRI specificAt = iri(baseIri + "ElemDecimal" + attribut.getId());
|
||||
|
||||
model.add(specificAt, RDF.TYPE, iri(baseIri + "ElemDecimal"));
|
||||
model.add(specificAt, atBez, Values.literal(attribut.getBezeichnung()));
|
||||
model.add(specificAt, atRequiredIri, Values.literal(((AttributDezimalType) attribut).isPflichtfeld()));
|
||||
if (((AttributDezimalType) attribut).getValue() != null) model.add(specificAt, atValue, Values.literal(((AttributDezimalType) attribut).getValue()));
|
||||
model.add(specificAt, atProd, vpIri);
|
||||
if (((AttributDezimalType) attribut).getMax() != null) model.add(specificAt, atMax, Values.literal(((AttributDezimalType) attribut).getMax()));
|
||||
if (((AttributDezimalType) attribut).getMin() != null) model.add(specificAt, atMin, Values.literal(((AttributDezimalType) attribut).getMin()));
|
||||
if (((AttributDezimalType) attribut).getDefault() != null) model.add(specificAt, atDefault, Values.literal(((AttributDezimalType) attribut).getDefault()));
|
||||
}
|
||||
}
|
||||
|
||||
int meldungId = 1;
|
||||
for (ServiceFault sf : produkt.getMeldungen()){
|
||||
IRI meldung = iri(baseIri + "Meldung");
|
||||
IRI spezMeldung = iri(baseIri + "Meldung" + meldungId);
|
||||
IRI meldungMsg = iri(baseIri + "errorMsg");
|
||||
IRI meldungType = iri(baseIri + "errorType");
|
||||
|
||||
model.add(vpIri, meldung, spezMeldung);
|
||||
model.add(spezMeldung, meldungMsg, Values.literal(sf.getErrorMsg()));
|
||||
model.add(spezMeldung, meldungType, Values.literal(sf.getErrorType()));
|
||||
|
||||
meldungId++;
|
||||
}
|
||||
|
||||
for (VersichertesInteresseType ro : produkt.getVersicherteObjekte()){
|
||||
if (ro instanceof FahrzeugType fa){
|
||||
IRI fahrzeugIri = iri(baseIri + "FahrzeugType");
|
||||
IRI faIri = iri(fahrzeugIri.stringValue() + fa.getHandelsbez() + fa.getBaujahr());
|
||||
IRI faBaujahrIri = iri(baseIri + "baujahr");
|
||||
IRI faBezIri = iri(baseIri + "bez");
|
||||
IRI faErstZuIri = iri(baseIri + "erstzulassung");
|
||||
IRI faKennIri = iri(baseIri + "kennzeichen");
|
||||
IRI faLpreisIri = iri(baseIri + "listenpreis");
|
||||
IRI faSonderIri = iri(baseIri + "sonderausstattung");
|
||||
IRI faLeistungIri = iri(baseIri + "leistung");
|
||||
IRI prodRoIri = iri(baseIri + "VersichertesInteresseType");
|
||||
|
||||
model.add(faIri, RDF.TYPE, fahrzeugIri);
|
||||
model.add(faIri, faBaujahrIri, Values.literal(fa.getBaujahr()));
|
||||
model.add(faIri, faBezIri, Values.literal(fa.getHandelsbez()));
|
||||
model.add(faIri, faErstZuIri, Values.literal(fa.getErstzulassdat()));
|
||||
model.add(faIri, faKennIri, Values.literal(fa.getPolKennz()));
|
||||
model.add(faIri, faLpreisIri, Values.literal(fa.getListenpreis()));
|
||||
model.add(faIri, faSonderIri, Values.literal(fa.getSonderausstattung()));
|
||||
model.add(faIri, faLeistungIri, Values.literal(fa.getLeistung()));
|
||||
|
||||
model.add(vpIri, prodRoIri, faIri);
|
||||
|
||||
} else if (ro instanceof VersicherteLiegenschaftType) {
|
||||
//To-Do
|
||||
} else if (ro instanceof RisikoGebaeudeType) {
|
||||
//To-Do
|
||||
}else if (ro instanceof RisikoHaushaltType) {
|
||||
//To-Do
|
||||
}else if (ro instanceof VersichertePersonType) {
|
||||
//To-Do
|
||||
}else if (ro instanceof VersichertesObjektSachPrivatType) {
|
||||
//To-Do
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < guiProdukt.getChildren().size(); i++) {
|
||||
IRI unterbausteinIri = iriMap.get(guiProdukt.getChildren().get(i));
|
||||
if (!guiProdukt.getValue().isNotIncluded()) {
|
||||
model.add(vpIri, bausteinIri, unterbausteinIri);
|
||||
}
|
||||
|
||||
String newParentId = vpIri.stringValue();
|
||||
addProduktToModel(guiProdukt.getChildren().get(i), model, baseIri, newParentId, iriMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
package at.vvo.omds.client.gui;
|
||||
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.FahrzeugType;
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.VersichertesInteresseMitAttributMetadatenType;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RisikoobjektView {
|
||||
List<VersichertesInteresseMitAttributMetadatenType> risikoobjekte = new ArrayList<>();
|
||||
VBox objekteListe = new VBox();
|
||||
ScrollPane objekteScroll = new ScrollPane();
|
||||
GridPane main = new GridPane();
|
||||
|
||||
public List<VersichertesInteresseMitAttributMetadatenType> getRisikoobjekte() {
|
||||
return risikoobjekte;
|
||||
}
|
||||
|
||||
public GridPane risikoobjekte() {
|
||||
VBox createObjekt = createRisikoobjekt();
|
||||
|
||||
objekteListe = risikoobjekteListe();
|
||||
|
||||
objekteScroll.setContent(objekteListe);
|
||||
objekteScroll.setFitToWidth(true);
|
||||
objekteScroll.setFitToHeight(false);
|
||||
objekteScroll.setStyle("-fx-background-color:transparent;");
|
||||
|
||||
main.add(createObjekt, 0, 0);
|
||||
main.add(objekteScroll, 1, 0);
|
||||
|
||||
GridPane.setHgrow(createObjekt, Priority.ALWAYS);
|
||||
GridPane.setVgrow(createObjekt, Priority.ALWAYS);
|
||||
GridPane.setHgrow(objekteScroll, Priority.ALWAYS);
|
||||
GridPane.setVgrow(objekteScroll, Priority.ALWAYS);
|
||||
|
||||
createObjekt.setPadding(new Insets(10, 10, 10, 5));
|
||||
createObjekt.setStyle("-fx-border-color: black; -fx-border-width: 1px;");
|
||||
|
||||
objekteScroll.setPadding(new Insets(10, 10, 10, 5));
|
||||
objekteScroll.setStyle("-fx-border-color: black; -fx-border-width: 1px;");
|
||||
|
||||
main.setAlignment(Pos.CENTER);
|
||||
main.setPadding(new Insets(10));
|
||||
main.setHgap(10);
|
||||
|
||||
return main;
|
||||
}
|
||||
|
||||
private VBox risikoobjekteListe() {
|
||||
VBox objekteListe = new VBox(10); // spacing
|
||||
objekteListe.setFillWidth(true);
|
||||
|
||||
if (risikoobjekte != null && !risikoobjekte.isEmpty()) {
|
||||
for (VersichertesInteresseMitAttributMetadatenType r : risikoobjekte) {
|
||||
|
||||
|
||||
HBox singleRisikoobjekt = new HBox(10);
|
||||
singleRisikoobjekt.setPadding(new Insets(5));
|
||||
singleRisikoobjekt.setAlignment(Pos.CENTER);
|
||||
|
||||
VBox objektInfo = new VBox(2);
|
||||
|
||||
if (r instanceof FahrzeugType fahrzeug) {
|
||||
Label handelsbezeichnung = new Label(fahrzeug.getHandelsbez());
|
||||
handelsbezeichnung.setFont(Font.font("System", FontWeight.BOLD, 14));
|
||||
|
||||
Label baujahr = new Label(fahrzeug.getBaujahr().toString());
|
||||
baujahr.setStyle("-fx-text-fill: #555555");
|
||||
|
||||
Label erstzulassung = new Label(fahrzeug.getErstzulassdat().toString()
|
||||
.substring(0, fahrzeug.getErstzulassdat().toString().length()-1));
|
||||
erstzulassung.setStyle("-fx-text-fill: #555555");
|
||||
|
||||
objektInfo.getChildren().addAll(handelsbezeichnung, baujahr, erstzulassung);
|
||||
|
||||
Pane separator = new Pane();
|
||||
separator.setPrefWidth(2);
|
||||
separator.setMaxWidth(2);
|
||||
separator.setStyle("-fx-background-color: black;");
|
||||
|
||||
Label symbole = new Label("\u26DF");
|
||||
symbole.setFont(Font.font(18));
|
||||
|
||||
VBox symbolBox = new VBox(symbole);
|
||||
|
||||
singleRisikoobjekt.getChildren().addAll(symbolBox, separator, objektInfo);
|
||||
singleRisikoobjekt.setAlignment(Pos.CENTER_LEFT);
|
||||
}
|
||||
|
||||
objekteListe.getChildren().add(singleRisikoobjekt);
|
||||
}
|
||||
}
|
||||
return objekteListe;
|
||||
}
|
||||
|
||||
private VBox createRisikoobjekt() {
|
||||
VBox createForm = new VBox();
|
||||
ChoiceBox<String> choiceBox = new ChoiceBox<>();
|
||||
|
||||
List<String> risikoobjektArten = new ArrayList<>();
|
||||
risikoobjektArten.add("Versichertes objekt SachPrivat");
|
||||
risikoobjektArten.add("Versicherte Liegenschaft");
|
||||
risikoobjektArten.add("Fahrzeug");
|
||||
risikoobjektArten.add("Risiko Gebaeude");
|
||||
risikoobjektArten.add("Versicherte Person");
|
||||
risikoobjektArten.add("Risiko Haushalt");
|
||||
|
||||
choiceBox.getSelectionModel().selectedItemProperty().addListener((obs, oldVal, newVal) -> {
|
||||
if (newVal != null) {
|
||||
int a = createForm.getChildren().size();
|
||||
for (int i = 1; i < a; i++) {
|
||||
createForm.getChildren().remove(i);
|
||||
}
|
||||
switch (newVal) {
|
||||
case "Versichertes objekt SachPrivat": {
|
||||
System.out.println("formular sach Privat");
|
||||
break;
|
||||
}
|
||||
case "Versicherte Liegenschaft": {
|
||||
System.out.println("create Versicherte Liegenschaft");
|
||||
break;
|
||||
}
|
||||
case "Fahrzeug": {
|
||||
FahrzeugType fahrzeug = new FahrzeugType();
|
||||
|
||||
VBox createFormBox = new VBox();
|
||||
|
||||
VBox baujahrBox = new VBox();
|
||||
Label label1 = new Label("Baujahr");
|
||||
TextField textField1 = new TextField();
|
||||
|
||||
textField1.setPromptText("Baujahr");
|
||||
baujahrBox.setPadding(new Insets(5));
|
||||
baujahrBox.getChildren().addAll(label1, textField1);
|
||||
|
||||
textField1.focusedProperty().addListener((observableValue, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
Label failedCheck = new Label("Es muss eine 4 stellige Jahreszahl mitgegeben werden");
|
||||
failedCheck.setId("failedCheck");
|
||||
failedCheck.setTextFill(Paint.valueOf("#DD0000"));
|
||||
if (textField1.getText().length() != 4) {
|
||||
textField1.setStyle("-fx-border-color: #dd0000");
|
||||
baujahrBox.getChildren().addAll(failedCheck);
|
||||
} else {
|
||||
textField1.setStyle("-fx-border-color: #555555");
|
||||
baujahrBox.getChildren().removeIf(c -> c.getId() != null && c.getId().equals("failedCheck"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
VBox handelsbezeichnungBox = new VBox();
|
||||
Label label2 = new Label("Handelsbezeichnung");
|
||||
TextField textField2 = new TextField();
|
||||
|
||||
textField2.setPromptText("Handelsbezeichnung");
|
||||
handelsbezeichnungBox.setPadding(new Insets(5));
|
||||
handelsbezeichnungBox.getChildren().addAll(label2, textField2);
|
||||
|
||||
VBox erstzulassungBox = new VBox();
|
||||
Label label3 = new Label("Erstzulassung");
|
||||
DatePicker datePicker = new DatePicker(LocalDate.now());
|
||||
|
||||
erstzulassungBox.setPadding(new Insets(5));
|
||||
erstzulassungBox.getChildren().addAll(label3, datePicker);
|
||||
|
||||
Button createBtn = new Button("Create");
|
||||
|
||||
createBtn.setOnAction(e -> {
|
||||
fahrzeug.setBaujahr(Integer.valueOf(textField1.getText()));
|
||||
fahrzeug.setHandelsbez(textField2.getText());
|
||||
try {
|
||||
int day = datePicker.getValue().getDayOfMonth();
|
||||
int month = datePicker.getValue().getMonthValue();
|
||||
int year = datePicker.getValue().getYear();
|
||||
|
||||
XMLGregorianCalendar erstzulassung = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(year, month, day, 0);
|
||||
|
||||
fahrzeug.setErstzulassdat(erstzulassung);
|
||||
} catch (DatatypeConfigurationException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
||||
risikoobjekte.add(fahrzeug);
|
||||
|
||||
objekteListe.getChildren().setAll(risikoobjekteListe().getChildren());
|
||||
|
||||
createFormBox.getChildren().clear();
|
||||
String select = choiceBox.getSelectionModel().getSelectedItem();
|
||||
choiceBox.getSelectionModel().clearSelection();
|
||||
choiceBox.getSelectionModel().select(select);
|
||||
|
||||
});
|
||||
|
||||
createFormBox.getChildren().addAll(baujahrBox, handelsbezeichnungBox, erstzulassungBox, createBtn);
|
||||
createForm.getChildren().add(createFormBox);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
choiceBox.getItems().addAll(risikoobjektArten);
|
||||
|
||||
createForm.getChildren().addAll(choiceBox);
|
||||
return createForm;
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,11 @@ import at.vvo.omds.types.omds3.r2025_05.common.APrioriProduktbausteinType;
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.ProduktbausteinType;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.text.TextFlow;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.*;
|
||||
|
||||
public class TreeHelper {
|
||||
Map<String, Integer> timesItemisIncludedById = new HashMap<>();
|
||||
List<TreeItem<Object>> isNotIncluded = new ArrayList<>();
|
||||
TextFlow logFlow = new TextFlow();
|
||||
|
||||
public Map<String, Integer> getTimesItemisIncludedById() {
|
||||
return timesItemisIncludedById;
|
||||
@@ -23,30 +18,14 @@ public class TreeHelper {
|
||||
this.timesItemisIncludedById = timesItemisIncludedById;
|
||||
}
|
||||
|
||||
public List<TreeItem<Object>> getIsNotIncluded() {
|
||||
return isNotIncluded;
|
||||
}
|
||||
|
||||
public void setIsNotIncluded(List<TreeItem<Object>> isNotIncluded) {
|
||||
this.isNotIncluded = isNotIncluded;
|
||||
}
|
||||
|
||||
public TextFlow getLogFlow() {
|
||||
return logFlow;
|
||||
}
|
||||
|
||||
public void setLogFlow(TextFlow logFlow) {
|
||||
this.logFlow = logFlow;
|
||||
}
|
||||
|
||||
public TreeItem<Object> cleanTree(TreeItem<Object> original) {
|
||||
if (isNotIncluded.contains(original)) {
|
||||
public TreeItem<GuiProdukt> cleanTree(TreeItem<GuiProdukt> original) {
|
||||
if (original.getValue().isNotIncluded()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
TreeItem<Object> newItem = new TreeItem<>(original.getValue());
|
||||
for (TreeItem<Object> child : original.getChildren()) {
|
||||
TreeItem<Object> cleanedChild = cleanTree(child);
|
||||
TreeItem<GuiProdukt> newItem = new TreeItem<>(original.getValue());
|
||||
for (TreeItem<GuiProdukt> child : original.getChildren()) {
|
||||
TreeItem<GuiProdukt> cleanedChild = cleanTree(child);
|
||||
if (cleanedChild != null) {
|
||||
newItem.getChildren().add(cleanedChild);
|
||||
}
|
||||
@@ -54,110 +33,125 @@ public class TreeHelper {
|
||||
return newItem;
|
||||
}
|
||||
|
||||
public TreeItem<Object> cloneTreeItem(TreeItem<Object> original) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
|
||||
Object cloneOriginalValue;
|
||||
public TreeItem<GuiProdukt> cloneTreeItem(TreeItem<GuiProdukt> original) {
|
||||
ProduktbausteinType cloneOriginalValue;
|
||||
|
||||
cloneOriginalValue = new ObjectFactoryFactory().create(((ProduktbausteinType) original.getValue()).getTyp());
|
||||
cloneOriginalValue = new ObjectFactoryFactory().create(((ProduktbausteinType) original.getValue().getProdukt()).getTyp());
|
||||
|
||||
((ProduktbausteinType) cloneOriginalValue).setId(
|
||||
((ProduktbausteinType) original.getValue()).getId());
|
||||
((ProduktbausteinType) cloneOriginalValue).setBezeichnung(
|
||||
((ProduktbausteinType) original.getValue()).getBezeichnung());
|
||||
((ProduktbausteinType) cloneOriginalValue).setVerkaufsoffenVon(
|
||||
((ProduktbausteinType) original.getValue()).getVerkaufsoffenVon());
|
||||
((ProduktbausteinType) cloneOriginalValue).setVerkaufsoffenBis(
|
||||
((ProduktbausteinType) original.getValue()).getVerkaufsoffenBis());
|
||||
((ProduktbausteinType) cloneOriginalValue).getAttribute().addAll(
|
||||
((ProduktbausteinType) original.getValue()).getAttribute());
|
||||
((ProduktbausteinType) cloneOriginalValue).getMeldungen().addAll(
|
||||
((ProduktbausteinType) original.getValue()).getMeldungen());
|
||||
((ProduktbausteinType) cloneOriginalValue).setMinVorkommen(
|
||||
((ProduktbausteinType) original.getValue()).getMinVorkommen());
|
||||
((ProduktbausteinType) cloneOriginalValue).setMaxVorkommen(
|
||||
((ProduktbausteinType) original.getValue()).getMaxVorkommen());
|
||||
((ProduktbausteinType) cloneOriginalValue).setTyp(
|
||||
((ProduktbausteinType) original.getValue()).getTyp());
|
||||
cloneOriginalValue.setId(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).getId());
|
||||
cloneOriginalValue.setBezeichnung(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).getBezeichnung());
|
||||
cloneOriginalValue.setVerkaufsoffenVon(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).getVerkaufsoffenVon());
|
||||
cloneOriginalValue.setVerkaufsoffenBis(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).getVerkaufsoffenBis());
|
||||
cloneOriginalValue.getAttribute().addAll(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).getAttribute());
|
||||
cloneOriginalValue.getMeldungen().addAll(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).getMeldungen());
|
||||
cloneOriginalValue.setMinVorkommen(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).getMinVorkommen());
|
||||
cloneOriginalValue.setMaxVorkommen(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).getMaxVorkommen());
|
||||
cloneOriginalValue.setTyp(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).getTyp());
|
||||
cloneOriginalValue.setRisikoobjektErforderlich(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).isRisikoobjektErforderlich());
|
||||
cloneOriginalValue.getVersicherteObjekte().addAll(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).getVersicherteObjekte());
|
||||
cloneOriginalValue.setPraemienfaktor(
|
||||
((ProduktbausteinType) original.getValue().getProdukt()).getPraemienfaktor());
|
||||
|
||||
TreeItem<GuiProdukt> clonedItem = new TreeItem<>(new GuiProdukt(cloneOriginalValue));
|
||||
|
||||
TreeItem<Object> clonedItem = new TreeItem<>(cloneOriginalValue);
|
||||
|
||||
for (TreeItem<Object> child : original.getChildren()) {
|
||||
for (TreeItem<GuiProdukt> child : original.getChildren()) {
|
||||
clonedItem.getChildren().add(cloneTreeItem(child));
|
||||
}
|
||||
clonedItem.setExpanded(true);
|
||||
|
||||
clonedItem.getValue().setNotIncluded(original.getValue().isNotIncluded());
|
||||
|
||||
return clonedItem;
|
||||
}
|
||||
|
||||
public TreeItem<Object> findTreeItem(ProduktbausteinType item, TreeItem<Object> root) {
|
||||
if (((ProduktbausteinType) root.getValue()).getId().equals(item.getId())) {
|
||||
public TreeItem<GuiProdukt> findTreeItem(ProduktbausteinType item, TreeItem<GuiProdukt> root) {
|
||||
if (((ProduktbausteinType) root.getValue().getProdukt()).getId().equals(item.getId())) {
|
||||
return root;
|
||||
}
|
||||
for (TreeItem<Object> child : root.getChildren()) {
|
||||
TreeItem<Object> found = findTreeItem(item, child);
|
||||
for (TreeItem<GuiProdukt> child : root.getChildren()) {
|
||||
TreeItem<GuiProdukt> found = findTreeItem(item, child);
|
||||
if (found != null) return found;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void messageToTree(APrioriProduktbausteinType produkt, TreeItem<Object> treeItem) throws Exception {
|
||||
public void aprioriProduktToTree(APrioriProduktbausteinType produkt, TreeItem<GuiProdukt> treeItem) throws Exception {
|
||||
if (!produkt.getBausteine().isEmpty()) {
|
||||
for (int i = 0; i < produkt.getBausteine().size(); i++) {
|
||||
TreeItem<Object> up = aprioriItemToCalcItem(new TreeItem<>(produkt.getBausteine().get(i)));
|
||||
TreeItem<GuiProdukt> up = aprioriItemToCalcItem(new TreeItem<>(new GuiProdukt(produkt.getBausteine().get(i))));
|
||||
up.getValue().setNotIncluded(true);
|
||||
up.setExpanded(true);
|
||||
if (!produkt.getBausteine().get(i).getBausteine().isEmpty()) {
|
||||
messageToTree(produkt.getBausteine().get(i), up);
|
||||
aprioriProduktToTree(produkt.getBausteine().get(i), up);
|
||||
}
|
||||
treeItem.getChildren().add(up);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void calcMessageToTree(ProduktbausteinType produkt, TreeItem<Object> treeItem) {
|
||||
if (!produkt.getBausteine().isEmpty()) {
|
||||
public void produktToTree(ProduktbausteinType produkt, TreeItem<GuiProdukt> treeItem) throws Exception {
|
||||
if (produkt != null && !produkt.getBausteine().isEmpty()) {
|
||||
for (int i = 0; i < produkt.getBausteine().size(); i++) {
|
||||
TreeItem<Object> up = new TreeItem<>(produkt.getBausteine().get(i));
|
||||
TreeItem<GuiProdukt> up = new TreeItem<>(new GuiProdukt(produkt.getBausteine().get(i)));
|
||||
up.setExpanded(true);
|
||||
|
||||
if (!produkt.getBausteine().get(i).getBausteine().isEmpty()) {
|
||||
calcMessageToTree(produkt.getBausteine().get(i), up);
|
||||
produktToTree(produkt.getBausteine().get(i), up);
|
||||
}
|
||||
treeItem.getChildren().add(up);
|
||||
if (!timesItemisIncludedById.containsKey(((ProduktbausteinType) up.getValue()).getId())) {
|
||||
timesItemisIncludedById.put(((ProduktbausteinType) up.getValue()).getId(), 1);
|
||||
if (!timesItemisIncludedById.containsKey(((ProduktbausteinType) up.getValue().getProdukt()).getId())) {
|
||||
timesItemisIncludedById.put(((ProduktbausteinType) up.getValue().getProdukt()).getId(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TreeItem<Object> aprioriItemToCalcItem(TreeItem<Object> produkt) throws Exception {
|
||||
public TreeItem<GuiProdukt> aprioriItemToCalcItem(TreeItem<GuiProdukt> produkt) throws Exception {
|
||||
|
||||
TreeItem<Object> ergItem = new TreeItem<>();
|
||||
Object erg = new ObjectFactoryFactory().create(((APrioriProduktbausteinType) produkt.getValue()).getType());
|
||||
TreeItem<GuiProdukt> ergItem = new TreeItem<>();
|
||||
ProduktbausteinType erg = new ObjectFactoryFactory().create(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getType());
|
||||
|
||||
if (erg != null) {
|
||||
if (ProduktbausteinType.class.isAssignableFrom(erg.getClass())) {
|
||||
((ProduktbausteinType) erg).setId(
|
||||
((APrioriProduktbausteinType) produkt.getValue()).getId());
|
||||
((ProduktbausteinType) erg).setBezeichnung(
|
||||
((APrioriProduktbausteinType) produkt.getValue()).getName());
|
||||
((ProduktbausteinType) erg).setVerkaufsoffenVon(
|
||||
((APrioriProduktbausteinType) produkt.getValue()).getFrom());
|
||||
((ProduktbausteinType) erg).setVerkaufsoffenBis(
|
||||
((APrioriProduktbausteinType) produkt.getValue()).getTo());
|
||||
((ProduktbausteinType) erg).getMeldungen().addAll(
|
||||
((APrioriProduktbausteinType) produkt.getValue()).getMeldungen());
|
||||
((ProduktbausteinType) erg).getAttribute().addAll(
|
||||
((APrioriProduktbausteinType) produkt.getValue()).getAttribute());
|
||||
((ProduktbausteinType) erg).setMinVorkommen(
|
||||
((APrioriProduktbausteinType) produkt.getValue()).getMinOccurrences());
|
||||
((ProduktbausteinType) erg).setMaxVorkommen(
|
||||
((APrioriProduktbausteinType) produkt.getValue()).getMaxOccurrences());
|
||||
((ProduktbausteinType) erg).setTyp(
|
||||
((APrioriProduktbausteinType) produkt.getValue()).getType());
|
||||
erg.setId(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getId());
|
||||
erg.setBezeichnung(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getName());
|
||||
erg.setVerkaufsoffenVon(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getFrom());
|
||||
erg.setVerkaufsoffenBis(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getTo());
|
||||
erg.getMeldungen().addAll(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getMeldungen());
|
||||
erg.getAttribute().addAll(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getAttribute());
|
||||
erg.setMinVorkommen(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getMinOccurrences());
|
||||
erg.setMaxVorkommen(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getMaxOccurrences());
|
||||
erg.setTyp(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getType());
|
||||
erg.setRisikoobjektErforderlich(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getRisikoobjektType() != null);
|
||||
erg.setPraemienfaktor(
|
||||
((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getPraemienfaktor());
|
||||
|
||||
|
||||
for (int i = 0; i < ((APrioriProduktbausteinType) produkt.getValue()).getBausteine().size(); i++) {
|
||||
((ProduktbausteinType) erg).getBausteine().add((ProduktbausteinType) aprioriItemToCalcItem(
|
||||
new TreeItem<>(((APrioriProduktbausteinType) produkt.getValue())
|
||||
.getBausteine().get(i))).getValue());
|
||||
for (int i = 0; i < ((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getBausteine().size(); i++) {
|
||||
erg.getBausteine().add((ProduktbausteinType) aprioriItemToCalcItem(
|
||||
new TreeItem<>(new GuiProdukt(((APrioriProduktbausteinType) produkt.getValue().getProdukt())
|
||||
.getBausteine().get(i)))).getValue().getProdukt());
|
||||
}
|
||||
|
||||
for (int i = 0; i < produkt.getChildren().size(); i++) {
|
||||
@@ -165,44 +159,42 @@ public class TreeHelper {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logFlow.getChildren().add(new Text("Objekt kann nicht erzeugt werden. Unbekannte Klasse "
|
||||
+ ((APrioriProduktbausteinType) produkt.getValue()).getType()));
|
||||
throw new Exception("Objekt kann nicht erzeugt werden. Unbekannte Klasse "
|
||||
+ ((APrioriProduktbausteinType) produkt.getValue()).getType());
|
||||
|
||||
+ ((APrioriProduktbausteinType) produkt.getValue().getProdukt()).getType());
|
||||
}
|
||||
ergItem.setValue(erg);
|
||||
ergItem.setValue(new GuiProdukt(erg));
|
||||
return ergItem;
|
||||
}
|
||||
|
||||
public TreeItem<Object> addAprioriToCalc(TreeItem<Object> calcItem, TreeItem<Object> aprioriItem)
|
||||
throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
|
||||
for (TreeItem<Object> aprioriChild : aprioriItem.getChildren()) {
|
||||
|
||||
List<TreeItem<Object>> matchingChildren = calcItem.getChildren().stream()
|
||||
.filter(c -> ((ProduktbausteinType) c.getValue()).getId()
|
||||
.equals(((ProduktbausteinType) aprioriChild.getValue()).getId()))
|
||||
.toList();
|
||||
|
||||
if (matchingChildren.isEmpty()) {
|
||||
TreeItem<Object> newChild = cloneTreeItem(aprioriChild);
|
||||
calcItem.getChildren().add(newChild);
|
||||
addAprioriToCalc(newChild, aprioriChild);
|
||||
} else {
|
||||
for (TreeItem<Object> matchingChild : matchingChildren) {
|
||||
addAprioriToCalc(matchingChild, aprioriChild);
|
||||
public TreeItem<GuiProdukt> addAprioriToCalc(TreeItem<GuiProdukt> calcItem, TreeItem<GuiProdukt> aprioriItem) {
|
||||
for (TreeItem<GuiProdukt> aprioriChild : aprioriItem.getChildren()) {
|
||||
boolean isInCalc = false;
|
||||
int i = 0;
|
||||
for (TreeItem<GuiProdukt> calcChild : calcItem.getChildren()) {
|
||||
if (((ProduktbausteinType) calcChild.getValue().getProdukt()).getId().equals(
|
||||
((ProduktbausteinType) aprioriChild.getValue().getProdukt()).getId())
|
||||
&& !calcChild.getValue().isNotIncluded()) {
|
||||
isInCalc = true;
|
||||
if (!aprioriChild.getChildren().isEmpty()) {
|
||||
addAprioriToCalc(calcChild, aprioriChild);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (!isInCalc) {
|
||||
TreeItem<GuiProdukt> missingCalcItem = cloneTreeItem(aprioriChild);
|
||||
calcItem.getChildren().add(missingCalcItem);
|
||||
}
|
||||
}
|
||||
return calcItem;
|
||||
}
|
||||
|
||||
public TreeItem<Object> sortTree(TreeItem<Object> parent) {
|
||||
public TreeItem<GuiProdukt> sortTree(TreeItem<GuiProdukt> parent) {
|
||||
FXCollections.sort(parent.getChildren(), Comparator.comparing(
|
||||
item -> ((ProduktbausteinType) item.getValue()).getBezeichnung().toLowerCase()
|
||||
item -> ((ProduktbausteinType)item.getValue().getProdukt()).getBezeichnung()
|
||||
));
|
||||
|
||||
for (TreeItem<Object> child : parent.getChildren()) {
|
||||
for (TreeItem<GuiProdukt> child : parent.getChildren()) {
|
||||
sortTree(child);
|
||||
}
|
||||
return parent;
|
||||
|
||||
@@ -45,6 +45,9 @@ public class SOAPConnector {
|
||||
|
||||
System.out.println("-----------------------------------------------------------------------------");
|
||||
printMessage(response);
|
||||
System.out.println("-----------------------------------------------------------------------------");
|
||||
printMessage(req);
|
||||
|
||||
CalculateResponse erg =
|
||||
(CalculateResponse) unmarshaller.unmarshal(response.getSOAPBody().extractContentAsDocument());
|
||||
soapConnection.close();
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package at.vvo.omds.client.gui.api.apriori;
|
||||
|
||||
import at.vvo.omds.client.gui.Plausi;
|
||||
import at.vvo.omds.client.gui.RDFHelper;
|
||||
import at.vvo.omds.client.gui.api.SOAPConnector;
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.APrioriVerkaufsproduktType;
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.ProductsRequest;
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.ProductsResponse;
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
import javafx.util.Pair;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class AprioriAuskunftService {
|
||||
@@ -34,4 +39,16 @@ public class AprioriAuskunftService {
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public Pair<List<APrioriVerkaufsproduktType>, List<Plausi>> aprioriRDFAuskunft(XMLGregorianCalendar stichtag, String vuNr) throws Exception {
|
||||
JAXBElement<ProductsRequest> r = BuildProductsRequest.aprioriRequest(stichtag, vuNr);
|
||||
|
||||
RDFHelper rdfHelper = new RDFHelper();
|
||||
Pair<List<APrioriVerkaufsproduktType>, List<Plausi>> response = rdfHelper.getAprioriRDF(r);
|
||||
|
||||
log.info("Got Response As below ========= : ");
|
||||
log.info("Status : {}", response.getKey().getFirst().getName());
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
package at.vvo.omds.client.gui.api.calc;
|
||||
|
||||
import at.vvo.omds.client.gui.GuiProdukt;
|
||||
import at.vvo.omds.client.gui.ObjectFactoryFactory;
|
||||
import at.vvo.omds.client.gui.RDFHelper;
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.*;
|
||||
import at.vvo.omds.types.omds3.r2025_05.on2antrag.common.*;
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.scene.control.TreeView;
|
||||
import org.eclipse.rdf4j.model.Model;
|
||||
import org.eclipse.rdf4j.rio.RDFFormat;
|
||||
import org.eclipse.rdf4j.rio.Rio;
|
||||
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
import javax.xml.namespace.QName;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
public class BuildCalculateRequestAuskunft {
|
||||
private static final at.vvo.omds.types.omds3.r2025_05.on2antrag.common.ObjectFactory OUOF =
|
||||
@@ -16,11 +22,11 @@ public class BuildCalculateRequestAuskunft {
|
||||
|
||||
private BuildCalculateRequestAuskunft(){}
|
||||
|
||||
static public JAXBElement<CalculateRequest> buildRequestFromTreeView(TreeView<Object> treeView, XMLGregorianCalendar vtBeg) {
|
||||
static public JAXBElement<CalculateRequest> buildRequestFromTreeView(TreeView<GuiProdukt> treeView, XMLGregorianCalendar vtBeg) {
|
||||
CalculateRequest request = OUOF.createCalculateRequest();
|
||||
VerkaufsproduktType verkaufsprodukt = TreeViewToVerkaufsprodukt(treeView, vtBeg);
|
||||
verkaufsprodukt.setVtgBeg(vtBeg);
|
||||
verkaufsprodukt.setTyp(((ProduktbausteinType)treeView.getRoot().getValue()).getTyp());
|
||||
verkaufsprodukt.setTyp(((ProduktbausteinType)treeView.getRoot().getValue().getProdukt()).getTyp());
|
||||
SpezBerechnungGenType berechnungsanfrage = new SpezBerechnungGenType();
|
||||
|
||||
berechnungsanfrage.setVerkaufsprodukt(verkaufsprodukt);
|
||||
@@ -31,28 +37,40 @@ public class BuildCalculateRequestAuskunft {
|
||||
return createCalculateRequest(request);
|
||||
}
|
||||
|
||||
static public String buildRDFRequestFromTreeView(TreeView<GuiProdukt> treeView, XMLGregorianCalendar vtBeg) {
|
||||
RDFHelper rdf = new RDFHelper();
|
||||
Model requestModel = rdf.createRdfModel(treeView.getRoot());
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
Rio.write(requestModel, baos, RDFFormat.JSONLD);
|
||||
|
||||
return baos.toString();
|
||||
}
|
||||
|
||||
public static JAXBElement<CalculateRequest> createCalculateRequest(CalculateRequest value) {
|
||||
return new JAXBElement<>(new QName("urn:at.vvo.omds.types.omds3types.v1-3-0.on2antrag.common","CalculateRequest"),
|
||||
CalculateRequest.class, null, value);
|
||||
}
|
||||
|
||||
public static ProduktbausteinType TreeItemToBaustein(TreeItem<Object> treeItem) {
|
||||
ProduktbausteinType baustein = (ProduktbausteinType) new ObjectFactoryFactory().create(
|
||||
((ProduktbausteinType)treeItem.getValue()).getTyp());
|
||||
public static ProduktbausteinType TreeItemToBaustein(TreeItem<GuiProdukt> treeItem) {
|
||||
ProduktbausteinType baustein = new ObjectFactoryFactory().create(
|
||||
((ProduktbausteinType)treeItem.getValue().getProdukt()).getTyp());
|
||||
|
||||
baustein.setBezeichnung(((ProduktbausteinType)treeItem.getValue()).getBezeichnung());
|
||||
baustein.setId(((ProduktbausteinType)treeItem.getValue()).getId());
|
||||
baustein.setVerkaufsoffenVon(((ProduktbausteinType)treeItem.getValue()).getVerkaufsoffenVon());
|
||||
baustein.setVerkaufsoffenBis(((ProduktbausteinType)treeItem.getValue()).getVerkaufsoffenBis());
|
||||
baustein.getAttribute().addAll(((ProduktbausteinType)treeItem.getValue()).getAttribute());
|
||||
baustein.setTyp(((ProduktbausteinType)treeItem.getValue()).getTyp());
|
||||
baustein.setMinVorkommen(((ProduktbausteinType)treeItem.getValue()).getMinVorkommen());
|
||||
baustein.setMaxVorkommen(((ProduktbausteinType)treeItem.getValue()).getMaxVorkommen());
|
||||
baustein.setBezeichnung(((ProduktbausteinType)treeItem.getValue().getProdukt()).getBezeichnung());
|
||||
baustein.setId(((ProduktbausteinType)treeItem.getValue().getProdukt()).getId());
|
||||
baustein.setVerkaufsoffenVon(((ProduktbausteinType)treeItem.getValue().getProdukt()).getVerkaufsoffenVon());
|
||||
baustein.setVerkaufsoffenBis(((ProduktbausteinType)treeItem.getValue().getProdukt()).getVerkaufsoffenBis());
|
||||
baustein.getAttribute().addAll(((ProduktbausteinType)treeItem.getValue().getProdukt()).getAttribute());
|
||||
baustein.setTyp(((ProduktbausteinType)treeItem.getValue().getProdukt()).getTyp());
|
||||
baustein.setMinVorkommen(((ProduktbausteinType)treeItem.getValue().getProdukt()).getMinVorkommen());
|
||||
baustein.setMaxVorkommen(((ProduktbausteinType)treeItem.getValue().getProdukt()).getMaxVorkommen());
|
||||
baustein.getVersicherteObjekte().addAll(((ProduktbausteinType) treeItem.getValue().getProdukt()).getVersicherteObjekte());
|
||||
baustein.setPraemienfaktor(((ProduktbausteinType)treeItem.getValue().getProdukt()).getPraemienfaktor());
|
||||
|
||||
return baustein;
|
||||
}
|
||||
|
||||
public static VerkaufsproduktType TreeViewToVerkaufsprodukt(TreeView<Object> treeView, XMLGregorianCalendar vtBeg) {
|
||||
public static VerkaufsproduktType TreeViewToVerkaufsprodukt(TreeView<GuiProdukt> treeView, XMLGregorianCalendar vtBeg) {
|
||||
VerkaufsproduktType verkaufsprodukt = (VerkaufsproduktType) TreeItemToBaustein(treeView.getRoot());
|
||||
verkaufsprodukt.setVtgBeg(vtBeg);
|
||||
|
||||
@@ -65,8 +83,8 @@ public class BuildCalculateRequestAuskunft {
|
||||
return verkaufsprodukt;
|
||||
}
|
||||
|
||||
public static ProduktbausteinType addUpFromTreeItem(TreeItem<Object> treeItem) {
|
||||
ProduktbausteinType baustein = (ProduktbausteinType) TreeItemToBaustein(treeItem);
|
||||
public static ProduktbausteinType addUpFromTreeItem(TreeItem<GuiProdukt> treeItem) {
|
||||
ProduktbausteinType baustein = TreeItemToBaustein(treeItem);
|
||||
|
||||
if (!treeItem.getChildren().isEmpty()) {
|
||||
for (int i = 0; i < treeItem.getChildren().size(); i++) {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package at.vvo.omds.client.gui.api.calc;
|
||||
|
||||
import at.vvo.omds.client.gui.GuiProdukt;
|
||||
import at.vvo.omds.client.gui.RDFHelper;
|
||||
import at.vvo.omds.client.gui.api.SOAPConnector;
|
||||
import at.vvo.omds.types.omds3.r2025_05.common.VerkaufsproduktType;
|
||||
import at.vvo.omds.types.omds3.r2025_05.on2antrag.common.CalculateRequest;
|
||||
import at.vvo.omds.types.omds3.r2025_05.on2antrag.common.CalculateResponse;
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
@@ -21,7 +24,7 @@ public class CalculateRequestAuskunftService {
|
||||
this.soapConnector = soapConnector;
|
||||
}
|
||||
|
||||
public CalculateResponse aprioriAuskunft(TreeView<Object> treeView, XMLGregorianCalendar vtBeg) throws Exception {
|
||||
public CalculateResponse calculateAuskunft(TreeView<GuiProdukt> treeView, XMLGregorianCalendar vtBeg) throws Exception {
|
||||
|
||||
String token = "<KEY>";
|
||||
JAXBElement<CalculateRequest> r = BuildCalculateRequestAuskunft.buildRequestFromTreeView(treeView, vtBeg);
|
||||
@@ -35,4 +38,16 @@ public class CalculateRequestAuskunftService {
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public VerkaufsproduktType calculateRDFAuskunft(TreeView<GuiProdukt> treeView, XMLGregorianCalendar vtBeg) throws Exception {
|
||||
|
||||
String request = BuildCalculateRequestAuskunft.buildRDFRequestFromTreeView(treeView, vtBeg);
|
||||
|
||||
RDFHelper rdfHelper = new RDFHelper();
|
||||
VerkaufsproduktType response = rdfHelper.getCalculateRDF(request);
|
||||
log.info("Got Response As below ========= : ");
|
||||
log.info("Status : {}", response.getBezeichnung());
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
xmlns:annox="urn:jaxb.jvnet.org:annox"
|
||||
xmlns:inheritance="urn:jaxb.jvnet.org:plugin:inheritance"
|
||||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jaxb https://jakarta.ee/xml/ns/jaxb/bindingschema_3_0.xsd"
|
||||
jaxb:extensionBindingPrefixes="xjc annox"
|
||||
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
|
||||
version="3.0">
|
||||
jaxb:extensionBindingPrefixes="xjc annox"
|
||||
|
||||
|
||||
|
||||
@@ -107,6 +107,24 @@
|
||||
</annox:annotate>
|
||||
</bindings>
|
||||
|
||||
|
||||
<jaxb:bindings node="//xs:complexType[@name='BasisProduktbaustein_Type']//xs:element[@name='Attribut']">
|
||||
<jaxb:property name="Attribute">
|
||||
<jaxb:javadoc><![CDATA[<p>Die Liste der Attribute für diesen Deckungsbaustein.</p>]]></jaxb:javadoc>
|
||||
</jaxb:property>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings node="//xs:complexType[@name='BasisProduktbaustein_Type']//xs:element[@name='Meldungen']">
|
||||
<jaxb:property name="Meldungen">
|
||||
<jaxb:javadoc><![CDATA[<p>Die Liste der Meldungen für diesen Deckungsbaustein.</p>]]></jaxb:javadoc>
|
||||
</jaxb:property>
|
||||
</jaxb:bindings>
|
||||
|
||||
<jaxb:bindings node="//xs:complexType[@name='Produktbaustein_Type']//xs:element[@name='Baustein']">
|
||||
<jaxb:property name="Bausteine">
|
||||
<jaxb:javadoc><![CDATA[<p>Die Liste der Unterbausteine für diesen Deckungsbaustein.</p>]]></jaxb:javadoc>
|
||||
</jaxb:property>
|
||||
</jaxb:bindings>
|
||||
|
||||
<jaxb:bindings node="//xs:complexType[@name='APrioriProduktbaustein_Type']//xs:element[@name='Klausel']">
|
||||
<jaxb:property name="Klauseln">
|
||||
<jaxb:javadoc><![CDATA[<p>Die Liste der Klauseln für diesen Deckungsbaustein.</p>]]></jaxb:javadoc>
|
||||
@@ -407,26 +425,26 @@
|
||||
</annox:annotate>
|
||||
</bindings>
|
||||
|
||||
<jaxb:bindings node="//xs:complexType[@name='ProduktbausteinAuskunft_Type']//xs:element[@name='Klausel']">
|
||||
<jaxb:property name="Klauseln">
|
||||
<jaxb:javadoc><![CDATA[<p>Die Klauseln des Deckungsbausteins.</p>]]></jaxb:javadoc>
|
||||
</jaxb:property>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings node="//xs:complexType[@name='ProduktbausteinAuskunft_Type']//xs:element[@name='Baustein']">
|
||||
<jaxb:property name="Bausteine">
|
||||
<jaxb:javadoc><![CDATA[<p>Die Unterbausteine des Deckungsbausteins.</p>]]></jaxb:javadoc>
|
||||
</jaxb:property>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings node="//xs:complexType[@name='ProduktbausteinAuskunft_Type']//xs:element[@name='Attribut']">
|
||||
<jaxb:property name="Attribute">
|
||||
<jaxb:javadoc><![CDATA[<p>Die Attribute des Deckungsbausteins.</p>]]></jaxb:javadoc>
|
||||
</jaxb:property>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings node="//xs:complexType[@name='ProduktbausteinAuskunft_Type']//xs:element[@name='Meldung']">
|
||||
<jaxb:property name="Meldungen">
|
||||
<jaxb:javadoc><![CDATA[<p>Die Meldungen des Deckungsbausteins.</p>]]></jaxb:javadoc>
|
||||
</jaxb:property>
|
||||
</jaxb:bindings>
|
||||
<!-- <jaxb:bindings node="//xs:complexType[@name='ProduktbausteinAuskunft_Type']//xs:element[@name='Klausel']">-->
|
||||
<!-- <jaxb:property name="Klauseln">-->
|
||||
<!-- <jaxb:javadoc><![CDATA[<p>Die Klauseln des Deckungsbausteins.</p>]]></jaxb:javadoc>-->
|
||||
<!-- </jaxb:property>-->
|
||||
<!-- </jaxb:bindings>-->
|
||||
<!-- <jaxb:bindings node="//xs:complexType[@name='ProduktbausteinAuskunft_Type']//xs:element[@name='Baustein']">-->
|
||||
<!-- <jaxb:property name="Bausteine">-->
|
||||
<!-- <jaxb:javadoc><![CDATA[<p>Die Unterbausteine des Deckungsbausteins.</p>]]></jaxb:javadoc>-->
|
||||
<!-- </jaxb:property>-->
|
||||
<!-- </jaxb:bindings>-->
|
||||
<!-- <jaxb:bindings node="//xs:complexType[@name='ProduktbausteinAuskunft_Type']//xs:element[@name='Attribut']">-->
|
||||
<!-- <jaxb:property name="Attribute">-->
|
||||
<!-- <jaxb:javadoc><![CDATA[<p>Die Attribute des Deckungsbausteins.</p>]]></jaxb:javadoc>-->
|
||||
<!-- </jaxb:property>-->
|
||||
<!-- </jaxb:bindings>-->
|
||||
<!-- <jaxb:bindings node="//xs:complexType[@name='ProduktbausteinAuskunft_Type']//xs:element[@name='Meldung']">-->
|
||||
<!-- <jaxb:property name="Meldungen">-->
|
||||
<!-- <jaxb:javadoc><![CDATA[<p>Die Meldungen des Deckungsbausteins.</p>]]></jaxb:javadoc>-->
|
||||
<!-- </jaxb:property>-->
|
||||
<!-- </jaxb:bindings>-->
|
||||
</jaxb:bindings><!-- Ende Antrag Common -->
|
||||
|
||||
<!-- Antrag Kfz -->
|
||||
@@ -588,7 +606,7 @@
|
||||
<!-- </jaxb:bindings>-->
|
||||
|
||||
<!-- Antrag Rechtsschutz Namespace urn:at.vvo.omds.types.omds3.v1-4-0.on2antrag.rs -->
|
||||
<!--
|
||||
|
||||
<jaxb:bindings schemaLocation="omds3_ON2_Antrag_Rechtsschutz.xsd" node="/xs:schema" >
|
||||
<jaxb:schemaBindings>
|
||||
<jaxb:package name="at.vvo.omds.types.omds3.r2025_05.on2antrag.rs"/>
|
||||
@@ -634,7 +652,7 @@
|
||||
</annox:annotate>
|
||||
</bindings>
|
||||
</jaxb:bindings>
|
||||
-->
|
||||
|
||||
|
||||
<!-- Antrag Sach-Privat Namespace urn:at.vvo.omds.types.omds3.v1-4-0.on2antrag.sachprivat -->
|
||||
<jaxb:bindings schemaLocation="omds3_ON2_Antrag_SachPrivat.xsd" node="/xs:schema" >
|
||||
|
||||
@@ -1720,13 +1720,17 @@
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="Baustein" type="Produktbaustein_Type" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:element name="Aktion" type="Aktion_Type" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:element name="VersicherteObjekte" type="VersichertesInteresse_Type" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="MinVorkommen" type="xsd:int" />
|
||||
<xsd:attribute name="MaxVorkommen" type="xsd:int" />
|
||||
<xsd:attribute name="VerkaufsoffenVon" type="xsd:date" ><xsd:annotation><xsd:documentation>Verkaufsoffen von</xsd:documentation></xsd:annotation></xsd:attribute>
|
||||
<xsd:attribute name="VerkaufsoffenBis" type="xsd:date" ><xsd:annotation><xsd:documentation>Verkaufsoffen bis</xsd:documentation></xsd:annotation></xsd:attribute>
|
||||
<xsd:attribute name="Typ" type="xsd:string" />
|
||||
</xsd:extension>
|
||||
<xsd:attribute name="RisikoobjektErforderlich" type="xsd:boolean" default="false"/>
|
||||
<xsd:attribute name="Praemienfaktor" type="xsd:string" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="ProduktbausteinGenerisch_Type" abstract="true">
|
||||
@@ -1760,6 +1764,12 @@
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="Aktion_Type">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="Aktion_Code" type="xsd:short"/>
|
||||
<xsd:element name="Beschreibung" type="xsd:string"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="Kombinationen_Type">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Typ für eine Liste zulässiger Kombinationen von Produktbaustein-Ids als Restriktion.</xsd:documentation>
|
||||
@@ -3247,7 +3257,7 @@
|
||||
<xsd:documentation>Basisklasse für alle Fahrzeuge in der Kfz-Versicherung</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="VersichertesInteresse_Type">
|
||||
<xsd:extension base="VersichertesInteresseMitAttributMetadaten_Type">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="Zulassungsdaten" type="Zulassungsdaten_Type" minOccurs="0">
|
||||
<xsd:annotation>
|
||||
@@ -5055,7 +5065,9 @@
|
||||
<xsd:attribute name="minOccurrences" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="maxOccurrences" type="xsd:int" />
|
||||
<xsd:attribute name="type" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
<xsd:attribute name="risikoobjekt_type" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="praemienfaktor" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
<xsd:annotation><xsd:documentation>Es gibt zwei Implementierungen für a priori: Verkaufsprodukt und Unterbaustein</xsd:documentation></xsd:annotation>
|
||||
<xsd:complexType name="APrioriUnterbaustein_Type">
|
||||
<xsd:complexContent>
|
||||
|
||||
@@ -9,7 +9,7 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %-12c{1}:%-3L - %m%n
|
||||
|
||||
# Log-Level fuer Projekt
|
||||
log4j.logger.at.vvo=INFO
|
||||
log4j.logger.at.vvo=DEBUG
|
||||
|
||||
# Wenn gewünscht, z.B. ändern auf Debug
|
||||
#log4j.logger.at.vvo=DEBUG
|
||||
BIN
OMDSServiceDefinition/src/main/resources/logo/VVO_Logo_2024.png
Normal file
BIN
OMDSServiceDefinition/src/main/resources/logo/VVO_Logo_2024.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Reference in New Issue
Block a user