Mercurial > lada > lada-server
comparison src/main/java/de/intevation/lada/model/stammdaten/Query.java @ 1028:1c41c7b8f7c2 schema-update
Updated server application to new database model. THIS IS STILL WIP!!!
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 08 Jul 2016 15:32:36 +0200 |
parents | |
children | c0db68c9a87d |
comparison
equal
deleted
inserted
replaced
1027:9971471d562c | 1028:1c41c7b8f7c2 |
---|---|
1 package de.intevation.lada.model.stammdaten; | |
2 | |
3 import java.io.Serializable; | |
4 import java.util.List; | |
5 | |
6 import javax.persistence.Column; | |
7 import javax.persistence.Entity; | |
8 import javax.persistence.FetchType; | |
9 import javax.persistence.Id; | |
10 import javax.persistence.JoinColumn; | |
11 import javax.persistence.ManyToOne; | |
12 import javax.persistence.OneToMany; | |
13 import javax.persistence.OrderBy; | |
14 import javax.persistence.Transient; | |
15 | |
16 import com.fasterxml.jackson.annotation.JsonIgnore; | |
17 | |
18 | |
19 /** | |
20 * The persistent class for the query database table. | |
21 * | |
22 */ | |
23 @Entity | |
24 public class Query implements Serializable { | |
25 private static final long serialVersionUID = 1L; | |
26 | |
27 @Id | |
28 private Integer id; | |
29 | |
30 private String description; | |
31 | |
32 private String name; | |
33 | |
34 private String sql; | |
35 | |
36 @ManyToOne | |
37 @JoinColumn(name="type", insertable=false, updatable=false) | |
38 private QueryType type; | |
39 | |
40 @Column(name="type") | |
41 private Integer typeId; | |
42 | |
43 @Transient | |
44 private Boolean favorite; | |
45 | |
46 //bi-directional many-to-one association to Filter | |
47 @OneToMany(fetch=FetchType.EAGER, mappedBy="query") | |
48 private List<Filter> filters; | |
49 | |
50 //bi-directional many-to-one association to Result | |
51 @OneToMany(fetch=FetchType.EAGER, mappedBy="query") | |
52 @OrderBy("index") | |
53 private List<Result> results; | |
54 | |
55 public Query() { | |
56 } | |
57 | |
58 public Integer getId() { | |
59 return this.id; | |
60 } | |
61 | |
62 public void setId(Integer id) { | |
63 this.id = id; | |
64 } | |
65 | |
66 public String getDescription() { | |
67 return this.description; | |
68 } | |
69 | |
70 public void setDescription(String description) { | |
71 this.description = description; | |
72 } | |
73 | |
74 public String getName() { | |
75 return this.name; | |
76 } | |
77 | |
78 public void setName(String name) { | |
79 this.name = name; | |
80 } | |
81 | |
82 public String getSql() { | |
83 return this.sql; | |
84 } | |
85 | |
86 public void setSql(String sql) { | |
87 this.sql = sql; | |
88 } | |
89 | |
90 public String getType() { | |
91 return this.type.getType(); | |
92 } | |
93 | |
94 /** | |
95 * @return the typeId | |
96 */ | |
97 @JsonIgnore | |
98 public Integer getTypeId() { | |
99 return typeId; | |
100 } | |
101 | |
102 /** | |
103 * @param typeId the typeId to set | |
104 */ | |
105 @JsonIgnore | |
106 public void setTypeId(Integer typeId) { | |
107 this.typeId = typeId; | |
108 } | |
109 | |
110 /** | |
111 * @return the favorite | |
112 */ | |
113 public Boolean getFavorite() { | |
114 return favorite; | |
115 } | |
116 | |
117 /** | |
118 * @param favorite the favorite to set | |
119 */ | |
120 public void setFavorite(Boolean favorite) { | |
121 this.favorite = favorite; | |
122 } | |
123 | |
124 public List<Filter> getFilters() { | |
125 return this.filters; | |
126 } | |
127 | |
128 public void setFilters(List<Filter> filters) { | |
129 this.filters = filters; | |
130 } | |
131 | |
132 public Filter addFilter(Filter filter) { | |
133 getFilters().add(filter); | |
134 filter.setQuery(this); | |
135 | |
136 return filter; | |
137 } | |
138 | |
139 public Filter removeFilter(Filter filter) { | |
140 getFilters().remove(filter); | |
141 filter.setQuery(null); | |
142 | |
143 return filter; | |
144 } | |
145 | |
146 public List<Result> getResults() { | |
147 return this.results; | |
148 } | |
149 | |
150 public void setResults(List<Result> results) { | |
151 this.results = results; | |
152 } | |
153 | |
154 public Result addResult(Result result) { | |
155 getResults().add(result); | |
156 result.setQuery(this); | |
157 | |
158 return result; | |
159 } | |
160 | |
161 public Result removeResult(Result result) { | |
162 getResults().remove(result); | |
163 result.setQuery(null); | |
164 | |
165 return result; | |
166 } | |
167 } |