annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionFactory.java @ 1116:05e4ef0f9489

Improved stub for CrossSections (including Factory and Facet). flys-artifacts/trunk@2623 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 31 Aug 2011 12:23:05 +0000
parents
children fbe18ad4caff
rev   line source
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import java.math.BigDecimal;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import java.util.List;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 import java.util.Iterator;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 import de.intevation.flys.backend.SessionHolder;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import de.intevation.flys.model.CrossSection;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 import de.intevation.flys.model.Range;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import de.intevation.flys.model.River;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import org.hibernate.Session;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import org.hibernate.Query;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 /**
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 * Get Cross Sections.
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 */
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 public class CrossSectionFactory {
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 /**
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 * Get CrossSections for an instantiated River.
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 *
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 * @param river river object.
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 *
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 * @return List of Cross Sections of river.
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 */
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 public static List<CrossSection> getCrossSections(River river) {
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 return getCrossSections(river.getName());
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 }
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 /**
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 * Get Cross Sections for a river by name.
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 *
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 * @param river name of the river of interest.
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 *
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 * @return List of Cross Sections of river.
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 */
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 public static List<CrossSection> getCrossSections(String riverName) {
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 Session session = SessionHolder.HOLDER.get();
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 Query query = session.createQuery(
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 "from CrossSection where river.name = :rivername");
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 query.setParameter("rivername", riverName);
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 return query.list();
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 }
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 }
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49

http://dive4elements.wald.intevation.org