Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • fit-connect/sdk-java
1 result
Show changes
Commits on Source (12)
...@@ -136,24 +136,53 @@ for (final Area area : areas){ ...@@ -136,24 +136,53 @@ for (final Area area : areas){
} }
``` ```
### Finding Destinations by service identifier and region ### Finding Destinations
For searching a destination the `DestinationSearch.Builder` is used pass a search request to the routing client. For searching a destination the `DestinationSearch.Builder` is used pass a search request to the routing client.
The leikaKey is mandatory, as well as (max.) one other search criterion for the area/region, like one of: The `leikaKey` is mandatory, as well as (max.) one other search criterion for the area/region, like one of:
- ars amtlicher regionalschlüssel - *areaId* = identifier of an area that can be retrieved via [findAreas(...)](#finding-areas) of the routing client
- ags amtlicher gemeindeschlüssel - ARS = *amtlicher Regionalschlüssel*
- areaId identifier of an area that can be retrieved via [finding areas](#finding-areas) - AGS = *amtlicher Gemeindeschlüssel*
__Note:__ Both, the `leikaKey` service-identifier and the region keys `ars/ags`cannot be retrieved via the routing client, but can be found here:
- [https://fimportal.de/](https://fimportal.de/) catalog for finding leikaKey service identifier
- [https://opengovtech.de/](https://opengovtech.de/ars/) for looking up regional keys
#### Find destination by service identifier and *areaId*
```java
final RoutingClient routingClient = ClientFactory.routingClient(config);
final DestinationSearch search = DestinationSearch.Builder()
.withLeikaKey("99123456760610")
.withAreaId("48566") // areaId of "Leipzig"
.withLimit(3)
.build();
// get first 3 route results
final List<Route> routes = routingClient.findDestinations(search);
LOGGER.info("Found {} routes for service identifier {}", routes.size(), leikaKey);
for (final Route route : routes){
LOGGER.info("Route {} with destinationId {} found", route.getName(), route.getDestinationId());
}
```
#### Find destination by service identifier and region key (ARS/AGS)
Besides the areaId another search criterion for the area/region can be used as well:
```java ```java
final RoutingClient routingClient = ClientFactory.routingClient(config); final RoutingClient routingClient = ClientFactory.routingClient(config);
final DestinationSearch search = DestinationSearch.Builder() final DestinationSearch search = DestinationSearch.Builder()
.withLeikaKey("99123456760610") .withLeikaKey("99123456760610")
.withArs("064350014014") .withArs("147130000000") // example ars for "Leipzig"
.withLimit(5) .withLimit(3)
.build(); .build();
// get first 5 route results // get first 3 route results
final List<Route> routes = routingClient.findDestinations(search); final List<Route> routes = routingClient.findDestinations(search);
LOGGER.info("Found {} routes for service identifier {}", routes.size(), leikaKey); LOGGER.info("Found {} routes for service identifier {}", routes.size(), leikaKey);
......
...@@ -34,10 +34,6 @@ ...@@ -34,10 +34,6 @@
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -4,9 +4,9 @@ import dev.fitko.fitconnect.api.config.ApplicationConfig; ...@@ -4,9 +4,9 @@ import dev.fitko.fitconnect.api.config.ApplicationConfig;
import dev.fitko.fitconnect.api.config.BuildInfo; import dev.fitko.fitconnect.api.config.BuildInfo;
import dev.fitko.fitconnect.api.exceptions.InitializationException; import dev.fitko.fitconnect.api.exceptions.InitializationException;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
...@@ -50,11 +50,7 @@ public final class ApplicationConfigLoader { ...@@ -50,11 +50,7 @@ public final class ApplicationConfigLoader {
* @return ApplicationConfig * @return ApplicationConfig
*/ */
public static ApplicationConfig loadConfigFromYaml(final String configYaml) { public static ApplicationConfig loadConfigFromYaml(final String configYaml) {
return new Yaml().loadAs(configYaml, ApplicationConfig.class);
final Yaml applicationPropertiesYaml = new Yaml(new Constructor(ApplicationConfig.class));
final ApplicationConfig applicationConfig = applicationPropertiesYaml.load(configYaml);
return applicationConfig;
} }
/** /**
...@@ -63,9 +59,7 @@ public final class ApplicationConfigLoader { ...@@ -63,9 +59,7 @@ public final class ApplicationConfigLoader {
* @return {@link BuildInfo} * @return {@link BuildInfo}
*/ */
public static BuildInfo loadBuildInfo() { public static BuildInfo loadBuildInfo() {
final InputStream resource = ApplicationConfigLoader.class.getClassLoader().getResourceAsStream(BUILD_INFO_PATH);
final Yaml buildInfoYaml = new Yaml(new Constructor(BuildInfo.class)); return new Yaml().loadAs(resource, BuildInfo.class);
return buildInfoYaml.load(ApplicationConfigLoader.class.getClassLoader().getResourceAsStream(BUILD_INFO_PATH));
} }
} }
...@@ -69,16 +69,16 @@ ...@@ -69,16 +69,16 @@
<jcommander.version>1.82</jcommander.version> <jcommander.version>1.82</jcommander.version>
<apache-tika.version>2.7.0</apache-tika.version> <apache-tika.version>2.7.0</apache-tika.version>
<spring-web.version>5.3.25</spring-web.version> <spring-web.version>5.3.25</spring-web.version>
<snakeyaml.version>1.33</snakeyaml.version> <snakeyaml.version>2.0</snakeyaml.version>
<open-csv.version>5.7.1</open-csv.version> <open-csv.version>5.7.1</open-csv.version>
<json-schema-validator.version>1.0.77</json-schema-validator.version> <json-schema-validator.version>1.0.78</json-schema-validator.version>
<junit.version>5.9.2</junit.version> <junit.version>5.9.2</junit.version>
<mockito.version>5.1.1</mockito.version> <mockito.version>5.1.1</mockito.version>
<wiremock.version>2.27.2</wiremock.version> <wiremock.version>2.27.2</wiremock.version>
<hamcrest.version>1.3</hamcrest.version> <hamcrest.version>1.3</hamcrest.version>
<awaitility-version>4.2.0</awaitility-version> <awaitility-version>4.2.0</awaitility-version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version> <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.0.0-M9</maven-surefire-plugin.version> <maven-surefire-plugin.version>3.0.0-M9</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M9</maven-failsafe-plugin.version> <maven-failsafe-plugin.version>3.0.0-M9</maven-failsafe-plugin.version>
<maven-checkstyle-plugin.version>3.2.1</maven-checkstyle-plugin.version> <maven-checkstyle-plugin.version>3.2.1</maven-checkstyle-plugin.version>
......