changeset 49:4a987b6be57e

Modified 'Ort' model and added new REST service for 'Ort' data.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 24 May 2013 11:56:50 +0200
parents afc3ef3dc3c3
children 79b44ead49b2
files src/main/java/de/intevation/lada/model/Ort.java src/main/java/de/intevation/lada/rest/OrteService.java
diffstat 2 files changed, 236 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/model/Ort.java	Fri May 24 11:56:50 2013 +0200
@@ -0,0 +1,174 @@
+package de.intevation.lada.model;
+
+// Generated 21.05.2013 16:58:30 by Hibernate Tools 3.4.0.CR1
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ * Ort generated by hbm2java
+ */
+@Entity
+@Table(name = "ort", schema = "public")
+public class Ort implements java.io.Serializable {
+
+	private int ortId;
+	private String OTyp;
+	private String bezeichnung;
+	private String beschreibung;
+	private Character unscharf;
+	private String nutsCode;
+	private String koordXExtern;
+	private String koordYExtern;
+	private Float hoeheLand;
+	private Date letzteAenderung;
+	private Double latitude;
+	private Double longitude;
+
+	public Ort() {
+	}
+
+	public Ort(int ortId) {
+		this.ortId = ortId;
+	}
+
+	public Ort(int ortId,  String OTyp, String bezeichnung,
+			String beschreibung, Character unscharf, String nutsCode,
+			String koordXExtern, String koordYExtern, Float hoeheLand,
+			Date letzteAenderung, Double latitude, Double longitude) {
+		this.ortId = ortId;
+		this.OTyp = OTyp;
+		this.bezeichnung = bezeichnung;
+		this.beschreibung = beschreibung;
+		this.unscharf = unscharf;
+		this.nutsCode = nutsCode;
+		this.koordXExtern = koordXExtern;
+		this.koordYExtern = koordYExtern;
+		this.hoeheLand = hoeheLand;
+		this.letzteAenderung = letzteAenderung;
+		this.latitude = latitude;
+		this.longitude = longitude;
+	}
+
+	@Id
+	@Column(name = "ort_id", unique = true, nullable = false)
+	public int getOrtId() {
+		return this.ortId;
+	}
+
+	public void setOrtId(int ortId) {
+		this.ortId = ortId;
+	}
+
+	@Column(name = "o_typ", length = 1)
+	public String getOTyp() {
+		return this.OTyp;
+	}
+
+	public void setOTyp(String OTyp) {
+		this.OTyp = OTyp;
+	}
+
+	@Column(name = "bezeichnung", length = 10)
+	public String getBezeichnung() {
+		return this.bezeichnung;
+	}
+
+	public void setBezeichnung(String bezeichnung) {
+		this.bezeichnung = bezeichnung;
+	}
+
+	@Column(name = "beschreibung", length = 100)
+	public String getBeschreibung() {
+		return this.beschreibung;
+	}
+
+	public void setBeschreibung(String beschreibung) {
+		this.beschreibung = beschreibung;
+	}
+
+	@Column(name = "unscharf", length = 1)
+	public Character getUnscharf() {
+		return this.unscharf;
+	}
+
+	public void setUnscharf(Character unscharf) {
+		this.unscharf = unscharf;
+	}
+
+	@Column(name = "nuts_code", length = 10)
+	public String getNutsCode() {
+		return this.nutsCode;
+	}
+
+	public void setNutsCode(String nutsCode) {
+		this.nutsCode = nutsCode;
+	}
+
+	@Column(name = "koord_x_extern", length = 22)
+	public String getKoordXExtern() {
+		return this.koordXExtern;
+	}
+
+	public void setKoordXExtern(String koordXExtern) {
+		this.koordXExtern = koordXExtern;
+	}
+
+	@Column(name = "koord_y_extern", length = 22)
+	public String getKoordYExtern() {
+		return this.koordYExtern;
+	}
+
+	public void setKoordYExtern(String koordYExtern) {
+		this.koordYExtern = koordYExtern;
+	}
+
+	@Column(name = "hoehe_land", precision = 8, scale = 8)
+	public Float getHoeheLand() {
+		return this.hoeheLand;
+	}
+
+	public void setHoeheLand(Float hoeheLand) {
+		this.hoeheLand = hoeheLand;
+	}
+
+	@Temporal(TemporalType.TIMESTAMP)
+	@Column(name = "letzte_aenderung", length = 29)
+	public Date getLetzteAenderung() {
+		return this.letzteAenderung;
+	}
+
+	public void setLetzteAenderung(Date letzteAenderung) {
+		this.letzteAenderung = letzteAenderung;
+	}
+
+	@Column(name = "latitude", precision = 17, scale = 17)
+	public Double getLatitude() {
+		return this.latitude;
+	}
+
+	public void setLatitude(Double latitude) {
+		this.latitude = latitude;
+	}
+
+	@Column(name = "longitude", precision = 17, scale = 17)
+	public Double getLongitude() {
+		return this.longitude;
+	}
+
+	public void setLongitude(Double longitude) {
+		this.longitude = longitude;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/rest/OrteService.java	Fri May 24 11:56:50 2013 +0200
@@ -0,0 +1,62 @@
+package de.intevation.lada.rest;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+import de.intevation.lada.data.Repository;
+import de.intevation.lada.model.Ort;
+
+/**
+ * This class produces a RESTful service to read the contents of SProbenart table.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
+@Path("/ort")
+@RequestScoped
+public class OrteService
+{
+    /**
+     * The Repository for SProbenart.
+     */
+    @Inject @Named
+    private Repository repository;
+
+    /**
+     * The logger for this class
+     */
+    @Inject
+    private Logger logger;
+
+    /**
+     * Request all SProbenart objects.
+     *
+     * @return JSON Object via Rest service
+     */
+    @GET
+    @Produces("text/json")
+    public List<Ort> findAll() {
+        List<Ort> result = repository.findAll(Ort.class);
+        return result;
+    }
+
+    /**
+     * Request a single SProbenart via its id.
+     *
+     * @param id The mst_id
+     * @return JSON Object via REST service.
+     */
+    @GET
+    @Path("/{id}")
+    @Produces("text/json")
+    public Ort findById(@PathParam("id") String id) {
+        return repository.findById(Ort.class, id);
+    }
+}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)