comparison flys-artifacts/doc/conf/meta-data.xml @ 1046:0a5eff5511b1

Fixed flys/issue262: Unified user and system datacage template flys-artifacts/trunk@2508 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 19 Aug 2011 09:48:13 +0000
parents
children 1f3e944a805c
comparison
equal deleted inserted replaced
1045:ba840385ad2e 1046:0a5eff5511b1
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 <dc:template xmlns:dc="http://www.intevation.org/2011/Datacage">
3 <datacage>
4 <dc:choose>
5 <dc:comment>
6 User specific part
7 ------------------
8 </dc:comment>
9 <dc:when test="dc:contains($parameters, 'user-id')">
10 <old_calculations>
11 <dc:context connection="user">
12 <dc:statement>SELECT u.id AS user_id, c.id AS collection_id
13 FROM collections c JOIN users u ON c.user_id = u.id
14 WHERE u.gid = CAST(${user-id} AS uuid)
15 ORDER BY c.creation DESC
16 </dc:statement>
17 <dc:elements>
18 <dc:context>
19 <dc:statement>SELECT id AS a_id, state AS a_state, gid AS a_gid, creation AS a_creation
20 FROM master_artifacts m
21 WHERE collection_id = ${collection_id} AND gid &lt;&gt; CAST(${artifact-id} AS uuid)
22 AND EXISTS (
23 SELECT id FROM artifact_data WHERE artifact_id = m.id AND k = 'river' AND v = ${river})
24 </dc:statement>
25 <dc:elements>
26 <dc:choose>
27 <dc:when test="$current-state-id = 'state.winfo.waterlevel'">
28 <dc:context>
29 <dc:statement>SELECT id AS out_id FROM outs WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
30 </dc:statement>
31 <dc:elements>
32 <dc:context>
33 <dc:statement>SELECT name AS facet_name, num as facet_num, description AS facet_description
34 FROM facets WHERE out_id = ${out_id} ORDER BY num ASC, name DESC
35 </dc:statement>
36 <longitudinal_section_columns>
37 <dc:attribute name="description" value="${river} ${a_creation}"/>
38 <dc:elements>
39 <dc:element name="${facet_name}">
40 <dc:attribute name="description" value="${facet_description}"/>
41 <dc:attribute name="num" value="${facet_num}"/>
42 <dc:attribute name="factory" value="TODO"/>
43 <dc:attribute name="artifact-id" value="${a_gid}"/>
44 </dc:element>
45 </dc:elements>
46 </longitudinal_section_columns>
47 </dc:context>
48 </dc:elements>
49 </dc:context>
50 </dc:when>
51 </dc:choose>
52 </dc:elements>
53 </dc:context>
54 </dc:elements>
55 </dc:context>
56 </old_calculations>
57 </dc:when>
58 <dc:comment>
59 System specific part
60 --------------------
61 </dc:comment>
62 <dc:otherwise>
63 <dc:context connection="system">
64 <dc:statement>
65 SELECT id AS river_id, name as river_name FROM rivers
66 WHERE name ILIKE ${river}
67 </dc:statement>
68 <dc:elements>
69 <river>
70 <dc:attribute name="name" value="${river_name}"/>
71 <dc:attribute name="db-id" value="${river_id}"/>
72 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
73 <discharge-table-nn>
74 <discharge-table-gauge>
75 <dc:context>
76 <dc:statement>
77 SELECT id AS gauge_id,
78 name AS gauge_name
79 FROM gauges WHERE river_id = ${river_id}
80 </dc:statement>
81 <dc:elements>
82 <gauge>
83 <dc:attribute name="name" value="${gauge_name}"/>
84 <dc:attribute name="db-id" value="${gauge_id}"/>
85 <dc:context>
86 <dc:statement>
87 SELECT description AS gauge_desc,
88 d.id AS discharge_id,
89 ti.start_time AS g_start,
90 ti.stop_time AS g_stop
91 FROM discharge_tables d JOIN time_intervals ti
92 ON d.time_interval_id = ti.id
93 WHERE d.gauge_id = ${gauge_id} AND d.kind = 1
94 </dc:statement>
95 <dc:elements>
96 <historical>
97 <dc:attribute name="name" value="${gauge_desc}"/>
98 <dc:attribute name="from" value="${g_start}"/>
99 <dc:attribute name="to" value="${g_stop}"/>
100 <dc:attribute name="db-id" value="${discharge_id}"/></historical>
101 </dc:elements>
102 </dc:context>
103 </gauge>
104 </dc:elements>
105 </dc:context>
106 </discharge-table-gauge>
107 <fixations>
108 <dc:attribute name="id" value="fixations-${river_id}"/>
109 <dc:context>
110 <dc:statement>
111 SELECT id AS fix_id,
112 description AS fix_description
113 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
114 </dc:statement>
115 <dc:elements>
116 <fixation>
117 <dc:attribute name="name" value="${fix_description}"/>
118 <dc:attribute name="db-id" value="${fix_id}"/>
119 <columns>
120 <dc:context>
121 <dc:statement>
122 SELECT id AS fix_column_id,
123 name AS fix_column_name
124 FROM wst_columns WHERE wst_id = ${fix_id}
125 ORDER by position
126 </dc:statement>
127 <dc:elements>
128 <column>
129 <dc:attribute name="name" value="${fix_column_name}"/>
130 <dc:attribute name="db-id" value="${fix_column_id}"/></column>
131 </dc:elements>
132 </dc:context>
133 </columns>
134 </fixation>
135 </dc:elements>
136 </dc:context>
137 </fixations>
138 <flood-protections>
139 <dc:attribute name="id" value="flood-protections-${river_id}"/>
140 <dc:context>
141 <dc:statement>
142 SELECT id AS prot_id,
143 description AS prot_description
144 FROM wsts WHERE kind = 5 AND river_id = ${river_id}
145 </dc:statement>
146 <dc:elements>
147 <flood-protection>
148 <dc:attribute name="name" value="${prot_description}"/>
149 <dc:attribute name="db-id" value="${prot_id}"/>
150 <columns>
151 <dc:context>
152 <dc:statement>
153 SELECT id AS prot_column_id,
154 name AS prot_column_name
155 FROM wst_columns WHERE wst_id = ${prot_id}
156 ORDER by position
157 </dc:statement>
158 <dc:elements>
159 <column>
160 <dc:attribute name="name" value="${prot_column_name}"/>
161 <dc:attribute name="db-id" value="${prot_column_id}"/></column>
162 </dc:elements>
163 </dc:context>
164 </columns>
165 </flood-protection>
166 </dc:elements>
167 </dc:context>
168 </flood-protections>
169 <flood-water-marks>
170 <dc:attribute name="id" value="flood-water-marks-${river_id}"/>
171 <dc:context>
172 <dc:statement>
173 SELECT id AS fw_id,
174 description AS fw_description
175 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
176 </dc:statement>
177 <dc:elements>
178 <flood-water-mark>
179 <dc:attribute name="name" value="${fw_description}"/>
180 <dc:attribute name="db-id" value="${fw_id}"/>
181 <columns>
182 <dc:context>
183 <dc:statement>
184 SELECT id AS fw_column_id,
185 name AS fw_column_name
186 FROM wst_columns WHERE wst_id = ${fw_id}
187 ORDER by position
188 </dc:statement>
189 <dc:elements>
190 <column>
191 <dc:attribute name="name" value="${fw_column_name}"/>
192 <dc:attribute name="db-id" value="${fw_column_id}"/></column>
193 </dc:elements>
194 </dc:context>
195 </columns>
196 </flood-water-mark>
197 </dc:elements>
198 </dc:context>
199 </flood-water-marks>
200 <water-levels>
201 <dc:attribute name="id" value="water-levels-${river_id}"/>
202 <dc:context>
203 <dc:statement>
204 SELECT id AS wl_id,
205 description AS wl_description
206 FROM wsts WHERE kind = 0 AND river_id = ${river_id}
207 </dc:statement>
208 <dc:elements>
209 <water-level>
210 <dc:attribute name="name" value="${wl_description}"/>
211 <dc:attribute name="db-id" value="${wl_id}"/>
212 <columns>
213 <dc:context>
214 <dc:statement>
215 SELECT id AS wl_column_id,
216 name AS wl_column_name
217 FROM wst_columns WHERE wst_id = ${wl_id}
218 ORDER by position
219 </dc:statement>
220 <dc:elements>
221 <column>
222 <dc:attribute name="name" value="${wl_column_name}"/>
223 <dc:attribute name="db-id" value="${wl_column_id}"/></column>
224 </dc:elements>
225 </dc:context>
226 </columns>
227 </water-level>
228 </dc:elements>
229 </dc:context>
230 </water-levels>
231 <extra-longitudinal-sections>
232 <dc:attribute name="id" value="extra-longitudinal-sections-${river_id}"/>
233 <dc:context>
234 <dc:statement>
235 SELECT id AS els_id,
236 description AS els_description
237 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
238 </dc:statement>
239 <dc:elements>
240 <extra-longitudinal-section>
241 <dc:attribute name="name" value="${els_description}"/>
242 <dc:attribute name="db-id" value="${els_id}"/>
243 <columns>
244 <dc:context>
245 <dc:statement>
246 SELECT id AS els_column_id,
247 name AS els_column_name
248 FROM wst_columns WHERE wst_id = ${els_id}
249 ORDER by position
250 </dc:statement>
251 <dc:elements>
252 <column>
253 <dc:attribute name="name" value="${els_column_name}"/>
254 <dc:attribute name="db-id" value="${els_column_id}"/></column>
255 </dc:elements>
256 </dc:context>
257 </columns>
258 </extra-longitudinal-section>
259 </dc:elements>
260 </dc:context>
261 </extra-longitudinal-sections>
262 </discharge-table-nn>
263 </dc:if>
264 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
265 <longitudinal-section>
266 <dc:call-macro name="longitudinal_section-recommended"/>
267 <fixations><dc:attribute name="ref" value="fixations-${river_id}"/></fixations>
268 <flood-protections><dc:attribute name="ref" value="flood-protections-${river_id}"/></flood-protections>
269 <flood-water-marks><dc:attribute name="ref" value="flood-water-marks-${river_id}"/></flood-water-marks>
270 <water-levels><dc:attribute name="ref" value="water-levels-${river_id}"/></water-levels>
271 <extra-longitudinal-sections><dc:attribute name="ref" value="extra-longitudinal-sections-${river_id}"/></extra-longitudinal-sections>
272 </longitudinal-section>
273 <dc:macro name="longitudinal_section-recommended">
274 <annotation>
275 <dc:attribute name="factory" value="annotations"/>
276 <dc:attribute name="db-ids" value="${river_id}"/>
277 </annotation>
278 </dc:macro>
279 </dc:if>
280 <dc:if test="dc:contains($artifact-outs, 'floodmap')">
281 <floodmap>
282 <dc:choose>
283 <dc:when test="dc:contains($parameters, 'recommended')">
284 <dc:call-macro name="flood-map-recommended"/>
285 </dc:when>
286 <dc:otherwise>
287 <dc:call-macro name="flood-map-complete"/>
288 </dc:otherwise>
289 </dc:choose>
290 </floodmap>
291 <dc:macro name="flood-map-recommended">
292 <dc:comment>
293 FIXME: Following two macros look identical to me.
294 </dc:comment>
295 <kilometrage>
296 <riveraxis>
297 <dc:attribute name="factory" value="riveraxis"/>
298 <dc:attribute name="db-ids" value="${river_id}"/>
299 </riveraxis>
300 </kilometrage>
301 <rastermap>
302 <background>
303 <dc:attribute name="factory" value="wmsbackground"/>
304 <dc:attribute name="db-ids" value="${river_id}"/>
305 </background>
306 </rastermap>
307 </dc:macro>
308 <dc:macro name="flood-map-complete">
309 <kilometrage>
310 <riveraxis>
311 <dc:attribute name="factory" value="riveraxis"/>
312 <dc:attribute name="db-ids" value="${river_id}"/>
313 </riveraxis>
314 </kilometrage>
315 <rastermap>
316 <background>
317 <dc:attribute name="factory" value="wmsbackground"/>
318 <dc:attribute name="db-ids" value="${river_id}"/>
319 </background>
320 </rastermap>
321 </dc:macro>
322 </dc:if>
323 </river>
324 </dc:elements>
325 </dc:context>
326 </dc:otherwise>
327 </dc:choose>
328 </datacage>
329 </dc:template>

http://dive4elements.wald.intevation.org