Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add info spots #27

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.rutebanken.tiamat.model;

public enum DisplayTypeEnumeration {
ELECTRIC_TFT("electricTFT"),
BATTERY_ONE_ROW("batteryOneRow"),
BATTERY_MULTI_ROW("batteryMultiRow"),
BATTERY_E_INK("batteryEInk"),
CHARGEABLE_E_INK("chargeableEInk"),
NONE("none");

private final String value;

DisplayTypeEnumeration(String v) {
value = v;
}

public String value() {
return value;
}

public static DisplayTypeEnumeration fromValue(String v) {

for (DisplayTypeEnumeration c : DisplayTypeEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}

throw new IllegalArgumentException(v);
}
}
164 changes: 164 additions & 0 deletions src/main/java/org/rutebanken/tiamat/model/InfoSpot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
package org.rutebanken.tiamat.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Entity
@Table(
uniqueConstraints = {
@UniqueConstraint(name = "info_spot_netex_id_version_constraint", columnNames = {"netexId", "version"})}
)
public class InfoSpot extends DataManagedObjectStructure implements Serializable {

protected String label;
protected String purpose;
protected String description;
@Enumerated(EnumType.STRING)
protected PosterPlaceTypeEnumeration posterPlaceType;
@Enumerated(EnumType.STRING)
protected PosterSizeEnumeration posterPlaceSize;
protected Boolean backlight;
protected String maintenance;
protected String zoneLabel;
protected String railInformation;
protected String floor;
protected Boolean speechProperty;
@Enumerated(EnumType.STRING)
protected DisplayTypeEnumeration displayType;

@ElementCollection(targetClass = StopPlaceReference.class, fetch = FetchType.EAGER)
@CollectionTable(name = "info_spot_stop_place")
private Set<StopPlaceReference> stopPlaces = new HashSet<>();

@ElementCollection(targetClass = InfoSpotPoster.class, fetch = FetchType.EAGER)
@CollectionTable(name = "info_spot_poster")
private Set<InfoSpotPoster> posters = new HashSet<>();

public String getLabel() {
return label;
}

public void setLabel(String label) {
this.label = label;
}

public String getPurpose() {
return purpose;
}

public void setPurpose(String purpose) {
this.purpose = purpose;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public PosterPlaceTypeEnumeration getPosterPlaceType() {
return posterPlaceType;
}

public void setPosterPlaceType(PosterPlaceTypeEnumeration posterPlaceType) {
this.posterPlaceType = posterPlaceType;
}

public PosterSizeEnumeration getPosterPlaceSize() {
return posterPlaceSize;
}

public void setPosterPlaceSize(PosterSizeEnumeration posterPlaceSize) {
this.posterPlaceSize = posterPlaceSize;
}

public Boolean getBacklight() {
return backlight;
}

public void setBacklight(Boolean backlight) {
this.backlight = backlight;
}

public String getMaintenance() {
return maintenance;
}

public void setMaintenance(String maintenance) {
this.maintenance = maintenance;
}

public String getZoneLabel() {
return zoneLabel;
}

public void setZoneLabel(String zoneLabel) {
this.zoneLabel = zoneLabel;
}

public String getRailInformation() {
return railInformation;
}

public void setRailInformation(String railInformation) {
this.railInformation = railInformation;
}

public String getFloor() {
return floor;
}

public void setFloor(String floor) {
this.floor = floor;
}

public Boolean getSpeechProperty() {
return speechProperty;
}

public void setSpeechProperty(Boolean speechProperty) {
this.speechProperty = speechProperty;
}

public DisplayTypeEnumeration getDisplayType() {
return displayType;
}

public void setDisplayType(DisplayTypeEnumeration displayType) {
this.displayType = displayType;
}

public Set<StopPlaceReference> getStopPlaces() {
return stopPlaces;
}

public void setStopPlaces(Set<StopPlaceReference> stopPlaces) {
this.stopPlaces = stopPlaces;
}

public Set<InfoSpotPoster> getPosters() {
return posters;
}

public void setPosters(Set<InfoSpotPoster> posters) {
this.posters = posters;
}
}
48 changes: 48 additions & 0 deletions src/main/java/org/rutebanken/tiamat/model/InfoSpotPoster.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package org.rutebanken.tiamat.model;

import javax.persistence.Embeddable;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;

@Embeddable
public class InfoSpotPoster {

private String label;
private String posterType;
private String lines;

@Enumerated(EnumType.STRING)
private PosterSizeEnumeration posterSize;

public String getLabel() {
return label;
}

public void setLabel(String label) {
this.label = label;
}

public String getPosterType() {
return posterType;
}

public void setPosterType(String posterType) {
this.posterType = posterType;
}

public String getLines() {
return lines;
}

public void setLines(String lines) {
this.lines = lines;
}

public PosterSizeEnumeration getPosterSize() {
return posterSize;
}

public void setPosterSize(PosterSizeEnumeration posterSize) {
this.posterSize = posterSize;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.rutebanken.tiamat.model;

public enum PosterPlaceTypeEnumeration {
STATIC("static"),
DYNAMIC("dynamic"),
SOUND_BEACON("soundBeacon");

private final String value;

PosterPlaceTypeEnumeration(String v) {
value = v;
}

public String value() {
return value;
}

public static PosterPlaceTypeEnumeration fromValue(String v) {

for (PosterPlaceTypeEnumeration c : PosterPlaceTypeEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}

throw new IllegalArgumentException(v);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.rutebanken.tiamat.model;

public enum PosterSizeEnumeration {
A3("a3"),
A4("a4"),
CM80x120("cm80x120");

private final String value;

PosterSizeEnumeration(String v) {
value = v;
}

public String value() {
return value;
}

public static PosterSizeEnumeration fromValue(String v) {

for (PosterSizeEnumeration c : PosterSizeEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}

throw new IllegalArgumentException(v);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.rutebanken.tiamat.repository;

import org.rutebanken.tiamat.model.InfoSpot;

public interface InfoSpotRepository extends InfoSpotRepositoryCustom, EntityInVersionRepository<InfoSpot> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.rutebanken.tiamat.repository;

import org.rutebanken.tiamat.model.InfoSpot;

public interface InfoSpotRepositoryCustom extends DataManagedObjectStructureRepository<InfoSpot> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.rutebanken.tiamat.repository;

import java.util.Set;
import javax.transaction.Transactional;
import org.apache.commons.lang3.NotImplementedException;
import org.springframework.stereotype.Repository;

@Repository
@Transactional
public class InfoSpotRepositoryImpl implements InfoSpotRepositoryCustom {

@Override
public String findFirstByKeyValues(String key, Set<String> originalIds) {
throw new NotImplementedException("findFirstByKeyValues not implemented for " + this.getClass().getSimpleName());
}
}
23 changes: 23 additions & 0 deletions src/main/java/org/rutebanken/tiamat/rest/graphql/GraphQLNames.java
Original file line number Diff line number Diff line change
Expand Up @@ -511,4 +511,27 @@ public class GraphQLNames {
public static final String LINE_SIGNAGE = "lineSignage";
public static final String MAIN_LINE_SIGN = "mainLineSign";
public static final String REPLACES_RAIL_SIGN = "replacesRailSign";

public static final String OUTPUT_TYPE_INFO_SPOT = "InfoSpot";
public static final String INPUT_TYPE_INFO_SPOT = OUTPUT_TYPE_INFO_SPOT + INPUT_TYPE_POSTFIX;

public static final String INFO_SPOTS = "infoSpots";
public static final String MUTATE_INFO_SPOT = "mutateInfoSpot";

public static final String POSTER = "poster";
public static final String PURPOSE = "purpose";
public static final String POSTER_PLACE_TYPE = "posterPlaceType";
public static final String POSTER_PLACE_SIZE = "posterPlaceSize";
public static final String BACKLIGHT = "backlight";
public static final String MAINTENANCE = "maintenance";
public static final String ZONE_LABEL = "zoneLabel";
public static final String RAIL_INFORMATION = "railInformation";
public static final String FLOOR = "floor";
public static final String SPEECH_PROPERTY = "speechProperty";
public static final String DISPLAY_TYPE = "displayType";
public static final String ON_STOP_PLACE = "onStopPlace";

public static final String POSTER_TYPE = "posterType";
public static final String POSTER_SIZE = "posterSize";
public static final String LINES = "lines";
}
Loading
Loading