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){
}
```
### 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.
The leikaKey is mandatory, as well as (max.) one other search criterion for the area/region, like one of:
- ars amtlicher regionalschlüssel
- ags amtlicher gemeindeschlüssel
- areaId identifier of an area that can be retrieved via [finding areas](#finding-areas)
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:
- *areaId* = identifier of an area that can be retrieved via [findAreas(...)](#finding-areas) of the routing client
- ARS = *amtlicher Regionalschlüssel*
- 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
final RoutingClient routingClient = ClientFactory.routingClient(config);
final DestinationSearch search = DestinationSearch.Builder()
.withLeikaKey("99123456760610")
.withArs("064350014014")
.withLimit(5)
.withArs("147130000000") // example ars for "Leipzig"
.withLimit(3)
.build();
// get first 5 route results
// get first 3 route results
final List<Route> routes = routingClient.findDestinations(search);
LOGGER.info("Found {} routes for service identifier {}", routes.size(), leikaKey);
......
......@@ -34,10 +34,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -4,9 +4,9 @@ import dev.fitko.fitconnect.api.config.ApplicationConfig;
import dev.fitko.fitconnect.api.config.BuildInfo;
import dev.fitko.fitconnect.api.exceptions.InitializationException;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
......@@ -50,11 +50,7 @@ public final class ApplicationConfigLoader {
* @return ApplicationConfig
*/
public static ApplicationConfig loadConfigFromYaml(final String configYaml) {
final Yaml applicationPropertiesYaml = new Yaml(new Constructor(ApplicationConfig.class));
final ApplicationConfig applicationConfig = applicationPropertiesYaml.load(configYaml);
return applicationConfig;
return new Yaml().loadAs(configYaml, ApplicationConfig.class);
}
/**
......@@ -63,9 +59,7 @@ public final class ApplicationConfigLoader {
* @return {@link BuildInfo}
*/
public static BuildInfo loadBuildInfo() {
final Yaml buildInfoYaml = new Yaml(new Constructor(BuildInfo.class));
return buildInfoYaml.load(ApplicationConfigLoader.class.getClassLoader().getResourceAsStream(BUILD_INFO_PATH));
final InputStream resource = ApplicationConfigLoader.class.getClassLoader().getResourceAsStream(BUILD_INFO_PATH);
return new Yaml().loadAs(resource, BuildInfo.class);
}
}
......@@ -69,16 +69,16 @@
<jcommander.version>1.82</jcommander.version>
<apache-tika.version>2.7.0</apache-tika.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>
<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>
<mockito.version>5.1.1</mockito.version>
<wiremock.version>2.27.2</wiremock.version>
<hamcrest.version>1.3</hamcrest.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-failsafe-plugin.version>3.0.0-M9</maven-failsafe-plugin.version>
<maven-checkstyle-plugin.version>3.2.1</maven-checkstyle-plugin.version>
......