# HG changeset patch # User Raimund Renkert # Date 1453902670 -3600 # Node ID cafeadbeed5b61ed07b647c525be6bd7dde08d82 # Parent 47dc3c4e42ddc533463d282daeceaa9d69b2215e Added model for filter queries. diff -r 47dc3c4e42dd -r cafeadbeed5b src/main/java/de/intevation/lada/model/stamm/Favorite.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/lada/model/stamm/Favorite.java Wed Jan 27 14:51:10 2016 +0100 @@ -0,0 +1,74 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ +package de.intevation.lada.model.stamm; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + + +/** + * The persistent class for the favorite database table. + * + */ +@Entity +@Table(name="favorite") +public class Favorite implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + private Integer id; + + //bi-directional many-to-one association to LadaUser + @ManyToOne + @JoinColumn(name="user_id") + private LadaUser ladaUser; + + //bi-directional many-to-one association to Query + @ManyToOne + private Query query; + + public Favorite() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public LadaUser getLadaUser() { + return this.ladaUser; + } + + public void setLadaUser(LadaUser ladaUser) { + this.ladaUser = ladaUser; + } + + public Query getQuery() { + return this.query; + } + + public void setQuery(Query query) { + this.query = query; + } + +} diff -r 47dc3c4e42dd -r cafeadbeed5b src/main/java/de/intevation/lada/model/stamm/Filter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/lada/model/stamm/Filter.java Wed Jan 27 14:51:10 2016 +0100 @@ -0,0 +1,96 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ +package de.intevation.lada.model.stamm; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +import com.fasterxml.jackson.annotation.JsonIgnore; + + +/** + * The persistent class for the filter database table. + * + */ +@Entity +public class Filter implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + private Integer id; + + @Column(name="data_index") + private String dataIndex; + + private String label; + + private Boolean multiselect; + + private String type; + + //bi-directional many-to-one association to Query + @ManyToOne + private Query query; + + public Filter() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDataIndex() { + return this.dataIndex; + } + + public void setDataIndex(String dataIndex) { + this.dataIndex = dataIndex; + } + + public String getLabel() { + return this.label; + } + + public void setLabel(String label) { + this.label = label; + } + + public Boolean getMultiselect() { + return this.multiselect; + } + + public void setMultiselect(Boolean multiselect) { + this.multiselect = multiselect; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + } + + @JsonIgnore + public Query getQuery() { + return this.query; + } + + @JsonIgnore + public void setQuery(Query query) { + this.query = query; + } +} diff -r 47dc3c4e42dd -r cafeadbeed5b src/main/java/de/intevation/lada/model/stamm/FilterValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/lada/model/stamm/FilterValue.java Wed Jan 27 14:51:10 2016 +0100 @@ -0,0 +1,89 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ +package de.intevation.lada.model.stamm; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + + +/** + * The persistent class for the filter_value database table. + * + */ +@Entity +@Table(name="filter_value") +public class FilterValue implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + private Integer id; + + private String value; + + //bi-directional many-to-one association to Filter + @ManyToOne + private Filter filter; + + //bi-directional many-to-one association to LadaUser + @ManyToOne + @JoinColumn(name="user_id") + private LadaUser ladaUser; + + @Column(name="query_id") + private Integer query; + + public FilterValue() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + public Filter getFilter() { + return this.filter; + } + + public void setFilter(Filter filter) { + this.filter = filter; + } + + public LadaUser getLadaUser() { + return this.ladaUser; + } + + public void setLadaUser(LadaUser ladaUser) { + this.ladaUser = ladaUser; + } + + public Integer getQuery() { + return this.query; + } + + public void setQuery(Integer query) { + this.query = query; + } + +} diff -r 47dc3c4e42dd -r cafeadbeed5b src/main/java/de/intevation/lada/model/stamm/LadaUser.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/lada/model/stamm/LadaUser.java Wed Jan 27 14:51:10 2016 +0100 @@ -0,0 +1,94 @@ +package de.intevation.lada.model.stamm; + +import java.io.Serializable; +import javax.persistence.*; +import java.util.List; + + +/** + * The persistent class for the lada_user database table. + * + */ +@Entity +@Table(name="lada_user") +@NamedQuery(name="LadaUser.findAll", query="SELECT l FROM LadaUser l") +public class LadaUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + private Integer id; + + private String name; + + //bi-directional many-to-one association to Favorite + @OneToMany(mappedBy="ladaUser") + private List favorites; + + //bi-directional many-to-one association to FilterValue + @OneToMany(mappedBy="ladaUser") + private List filterValues; + + public LadaUser() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public List getFavorites() { + return this.favorites; + } + + public void setFavorites(List favorites) { + this.favorites = favorites; + } + + public Favorite addFavorite(Favorite favorite) { + getFavorites().add(favorite); + favorite.setLadaUser(this); + + return favorite; + } + + public Favorite removeFavorite(Favorite favorite) { + getFavorites().remove(favorite); + favorite.setLadaUser(null); + + return favorite; + } + + public List getFilterValues() { + return this.filterValues; + } + + public void setFilterValues(List filterValues) { + this.filterValues = filterValues; + } + + public FilterValue addFilterValue(FilterValue filterValue) { + getFilterValues().add(filterValue); + filterValue.setLadaUser(this); + + return filterValue; + } + + public FilterValue removeFilterValue(FilterValue filterValue) { + getFilterValues().remove(filterValue); + filterValue.setLadaUser(null); + + return filterValue; + } + +} \ No newline at end of file diff -r 47dc3c4e42dd -r cafeadbeed5b src/main/java/de/intevation/lada/model/stamm/Query.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/lada/model/stamm/Query.java Wed Jan 27 14:51:10 2016 +0100 @@ -0,0 +1,163 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ +package de.intevation.lada.model.stamm; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.OneToMany; + +import com.fasterxml.jackson.annotation.JsonIgnore; + + +/** + * The persistent class for the query database table. + * + */ +@Entity +public class Query implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + private Integer id; + + private String description; + + private String name; + + private String sql; + + private String type; + + //bi-directional many-to-one association to Favorite + @OneToMany(fetch=FetchType.EAGER, mappedBy="query") + private List favorites; + + //bi-directional many-to-one association to Filter + @OneToMany(fetch=FetchType.EAGER, mappedBy="query") + private List filters; + + //bi-directional many-to-one association to Result + @OneToMany(fetch=FetchType.EAGER, mappedBy="query") + private List results; + + public Query() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSql() { + return this.sql; + } + + public void setSql(String sql) { + this.sql = sql; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + } + + @JsonIgnore + public List getFavorites() { + return this.favorites; + } + + @JsonIgnore + public void setFavorites(List favorites) { + this.favorites = favorites; + } + + public Favorite addFavorite(Favorite favorite) { + getFavorites().add(favorite); + favorite.setQuery(this); + + return favorite; + } + + public Favorite removeFavorite(Favorite favorite) { + getFavorites().remove(favorite); + favorite.setQuery(null); + + return favorite; + } + + public List getFilters() { + return this.filters; + } + + public void setFilters(List filters) { + this.filters = filters; + } + + public Filter addFilter(Filter filter) { + getFilters().add(filter); + filter.setQuery(this); + + return filter; + } + + public Filter removeFilter(Filter filter) { + getFilters().remove(filter); + filter.setQuery(null); + + return filter; + } + + public List getResults() { + return this.results; + } + + public void setResults(List results) { + this.results = results; + } + + public Result addResult(Result result) { + getResults().add(result); + result.setQuery(this); + + return result; + } + + public Result removeResult(Result result) { + getResults().remove(result); + result.setQuery(null); + + return result; + } + +} diff -r 47dc3c4e42dd -r cafeadbeed5b src/main/java/de/intevation/lada/model/stamm/Result.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/lada/model/stamm/Result.java Wed Jan 27 14:51:10 2016 +0100 @@ -0,0 +1,109 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ +package de.intevation.lada.model.stamm; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +import com.fasterxml.jackson.annotation.JsonIgnore; + + +/** + * The persistent class for the result database table. + * + */ +@Entity +@Table(name="result") +public class Result implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + private Integer id; + + @Column(name="data_index") + private String dataIndex; + + private Boolean flex; + + private String header; + + private Integer width; + + private Integer index; + + //bi-directional many-to-one association to Query + @ManyToOne + private Query query; + + public Result() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDataIndex() { + return this.dataIndex; + } + + public void setDataIndex(String dataIndex) { + this.dataIndex = dataIndex; + } + + public Boolean getFlex() { + return this.flex; + } + + public void setFlex(Boolean flex) { + this.flex = flex; + } + + public String getHeader() { + return this.header; + } + + public void setHeader(String header) { + this.header = header; + } + + public Integer getWidth() { + return this.width; + } + + public void setWidth(Integer width) { + this.width = width; + } + + public Integer getIndex() { + return index; + } + + public void setIndex(Integer index) { + this.index = index; + } + + @JsonIgnore + public Query getQuery() { + return this.query; + } + + @JsonIgnore + public void setQuery(Query query) { + this.query = query; + } + +}