Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 48 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>11.0.0</version>
</dependency>
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphiql-spring-boot-starter</artifactId>
<version>11.0.0</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-extended-scalars</artifactId>
<version>16.0.1</version>
</dependency>

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
Expand Down Expand Up @@ -141,10 +158,6 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
Expand Down Expand Up @@ -188,6 +201,37 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.github.kobylynskyi</groupId>
<artifactId>graphql-codegen-maven-plugin</artifactId>
<version>5.5.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<graphqlSchemaPaths>
<graphqlSchemaPath>${project.basedir}/src/main/resources/graphql/schema.graphqls
</graphqlSchemaPath>
</graphqlSchemaPaths>
<outputDir>${project.build.directory}/generated-sources/graphql</outputDir>
<apiPackageName>no.entur.mummu.graphql.api</apiPackageName>
<modelPackageName>no.entur.mummu.graphql.model</modelPackageName>
<customTypesMapping>
<DateTime>java.util.Date</DateTime>
</customTypesMapping>
<parentInterfaces>
<queryResolver>graphql.kickstart.tools.GraphQLQueryResolver</queryResolver>
<mutationResolver>graphql.kickstart.tools.GraphQLMutationResolver</mutationResolver>
<subscriptionResolver>graphql.kickstart.tools.GraphQLSubscriptionResolver
</subscriptionResolver>
<resolver><![CDATA[graphql.kickstart.tools.GraphQLResolver<{{TYPE}}>]]></resolver>
</parentInterfaces>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
100 changes: 100 additions & 0 deletions src/main/java/no/entur/mummu/graphql/QueriesResolver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package no.entur.mummu.graphql;

import no.entur.mummu.graphql.api.StopPlaceRegisterResolver;
import no.entur.mummu.graphql.model.AuthorizationCheck;
import no.entur.mummu.graphql.model.FareZone;
import no.entur.mummu.graphql.model.GroupOfStopPlaces;
import no.entur.mummu.graphql.model.GroupOfTariffZones;
import no.entur.mummu.graphql.model.Parking;
import no.entur.mummu.graphql.model.PathLink;
import no.entur.mummu.graphql.model.ScopingMethodEnumerationType;
import no.entur.mummu.graphql.model.StopPlace;
import no.entur.mummu.graphql.model.StopPlaceInterface;
import no.entur.mummu.graphql.model.StopPlaceRegister;
import no.entur.mummu.graphql.model.StopPlaceType;
import no.entur.mummu.graphql.model.Tag;
import no.entur.mummu.graphql.model.TariffZone;
import no.entur.mummu.graphql.model.TopographicPlace;
import no.entur.mummu.graphql.model.TopographicPlaceType;
import no.entur.mummu.graphql.model.VersionValidity;
import no.entur.mummu.graphql.model.ZoneTopologyEnumerationType;
import no.entur.mummu.services.NetexEntitiesIndexLoader;
import org.entur.netex.index.api.NetexEntitiesIndex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

@Component
public class QueriesResolver implements StopPlaceRegisterResolver {
private final NetexEntitiesIndex netexEntitiesIndex;

@Autowired
public QueriesResolver(
NetexEntitiesIndexLoader loader
) {
this.netexEntitiesIndex = loader.getNetexEntitiesIndex();
}

@Override
public List<StopPlaceInterface> stopPlace(StopPlaceRegister stopPlaceRegister, Integer page, Integer size, Boolean allVersions, String id, Integer version, VersionValidity versionValidity, List<StopPlaceType> stopPlaceType, List<String> countyReference, List<String> countryReference, List<String> tags, List<String> municipalityReference, String query, String importedId, Date pointInTime, String key, Boolean withoutLocationOnly, Boolean withoutQuaysOnly, Boolean withDuplicatedQuayImportedIds, Boolean withNearbySimilarDuplicates, Boolean hasParking, Boolean onlyMonomodalStopPlaces, List<String> values, Boolean withTags, String code) throws Exception {
var index = netexEntitiesIndex.getStopPlaceIndex();
var stopPlace = index.getLatestVersion(id);
return List.of(
StopPlace.builder()
.setId(stopPlace.getId())
.build()
);
}

@Override
public List<StopPlaceInterface> stopPlaceBBox(StopPlaceRegister stopPlaceRegister, Integer page, Integer size, String lonMin, String latMin, String lonMax, String latMax, String ignoreStopPlaceId, Boolean includeExpired, Date pointInTime) throws Exception {
return null;
}

@Override
public List<TopographicPlace> topographicPlace(StopPlaceRegister stopPlaceRegister, String id, Boolean allVersions, TopographicPlaceType topographicPlaceType, String query) throws Exception {
return null;
}

@Override
public List<PathLink> pathLink(StopPlaceRegister stopPlaceRegister, String id, Boolean allVersions, String stopPlaceId) throws Exception {
return null;
}

@Override
public List<Parking> parking(StopPlaceRegister stopPlaceRegister, Integer page, Integer size, String id, Integer version, String stopPlaceId, Boolean allVersions) throws Exception {
return null;
}

@Override
public AuthorizationCheck checkAuthorized(StopPlaceRegister stopPlaceRegister, String id) throws Exception {
return null;
}

@Override
public List<Tag> tags(StopPlaceRegister stopPlaceRegister, String name) throws Exception {
return null;
}

@Override
public List<GroupOfStopPlaces> groupOfStopPlaces(StopPlaceRegister stopPlaceRegister, Integer page, Integer size, String id, String query, String stopPlaceId) throws Exception {
return null;
}

@Override
public List<GroupOfTariffZones> groupOfTariffZones(StopPlaceRegister stopPlaceRegister, Integer page, Integer size, String id, String query, String tariffZoneId) throws Exception {
return null;
}

@Override
public List<TariffZone> tariffZones(StopPlaceRegister stopPlaceRegister, Integer page, Integer size, String query) throws Exception {
return null;
}

@Override
public List<FareZone> fareZones(StopPlaceRegister stopPlaceRegister, Integer page, Integer size, String query, String id, String authorityRef, ScopingMethodEnumerationType scopingMethod, ZoneTopologyEnumerationType zoneTopology) throws Exception {
return null;
}
}
Loading