Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/BedHeightType.java @ 2809:f283212966e8
Finished work on MINFO bed heights (single).
flys-backend/trunk@4221 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 12 Apr 2012 10:42:46 +0000 |
parents | |
children | 3de4ac5ccee8 |
comparison
equal
deleted
inserted
replaced
2808:b57c95094b68 | 2809:f283212966e8 |
---|---|
1 package de.intevation.flys.model; | |
2 | |
3 import java.io.Serializable; | |
4 | |
5 import javax.persistence.Entity; | |
6 import javax.persistence.Id; | |
7 import javax.persistence.Table; | |
8 import javax.persistence.GeneratedValue; | |
9 import javax.persistence.Column; | |
10 import javax.persistence.SequenceGenerator; | |
11 import javax.persistence.GenerationType; | |
12 | |
13 import org.apache.log4j.Logger; | |
14 | |
15 | |
16 @Entity | |
17 @Table(name = "bed_height_type") | |
18 public class BedHeightType | |
19 implements Serializable | |
20 { | |
21 private static Logger log = Logger.getLogger(BedHeightType.class); | |
22 | |
23 private Integer id; | |
24 private String name; | |
25 private String description; | |
26 | |
27 | |
28 public BedHeightType() { | |
29 } | |
30 | |
31 public BedHeightType(String name, String description) { | |
32 this.name = name; | |
33 this.description = description; | |
34 } | |
35 | |
36 @Id | |
37 @SequenceGenerator( | |
38 name = "SEQUENCE_BED_HEIGHT_TYPE_ID_SEQ", | |
39 sequenceName = "BED_HEIGHT_TYPE_SEQ", | |
40 allocationSize = 1) | |
41 @GeneratedValue( | |
42 strategy = GenerationType.SEQUENCE, | |
43 generator = "SEQUENCE_BED_HEIGHT_TYPE_ID_SEQ") | |
44 @Column(name = "id") | |
45 public Integer getId() { | |
46 return id; | |
47 } | |
48 | |
49 public void setId(Integer id) { | |
50 this.id = id; | |
51 } | |
52 | |
53 @Column(name = "name") | |
54 public String getName() { | |
55 return name; | |
56 } | |
57 | |
58 public void setName(String name) { | |
59 this.name = name; | |
60 } | |
61 | |
62 @Column(name = "description") | |
63 public String getDescription() { | |
64 return description; | |
65 } | |
66 | |
67 public void setDescription(String description) { | |
68 this.description = description; | |
69 } | |
70 | |
71 | |
72 public static String getBedHeightName(String description) { | |
73 if (description.equals("Flächenpeilung")) { | |
74 return "FP"; | |
75 } | |
76 else if ("Querprofile".equals(description)) { | |
77 return "QP"; | |
78 } | |
79 else if ("TIN".equals(description)) { | |
80 return "TIN"; | |
81 } | |
82 else if ("Flächen- u. Querprofilpeilungen".equals(description)) { | |
83 return "FP-QP"; | |
84 } | |
85 else { | |
86 log.warn("Unknown bed height type: " + description); | |
87 return null; | |
88 } | |
89 } | |
90 } | |
91 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |