1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package ch.hortis.sonar.model;
21
22 import javax.persistence.*;
23
24 @Entity
25 @Table(name = "rule_failure_params")
26 public class RuleFailureParam {
27
28 public static final int PARAM_KEY_COLUMN_SIZE = 100;
29
30 @Id
31 @Column(name = "id")
32 @SequenceGenerator(name= "RULE_FAILURE_PARAMS_SEQ", sequenceName = "RULE_FAILURE_PARAMS_SEQ")
33 @GeneratedValue(strategy = GenerationType.AUTO, generator = "RULE_FAILURE_PARAMS_SEQ")
34 private Integer id;
35
36 @Column(name = "param_key", updatable = false, nullable = false, length = PARAM_KEY_COLUMN_SIZE)
37 private String key;
38
39 @Column(name = "value", updatable = false, nullable = true, precision = 30, scale = 20)
40 private Double value;
41
42 @Column(name = "value2", updatable = false, nullable = true, precision = 30, scale = 20)
43 private Double value2;
44
45 @ManyToOne(fetch = FetchType.LAZY)
46 @JoinColumn(name = "rule_failure_id")
47 private RuleFailure ruleFailure;
48
49 @Column(name = "snapshot_id")
50 protected Integer snapshotId;
51
52 public RuleFailureParam(String key, Double value, Double value2) {
53 setKey(key);
54 this.value = value;
55 this.value2 = value2;
56 }
57
58 public RuleFailureParam() {
59 }
60
61 public Integer getId() {
62 return id;
63 }
64
65 public void setId( Integer id ) {
66 this.id = id;
67 }
68
69 public void setSnapshot(Snapshot snapshot) {
70 this.snapshotId = snapshot.getId();
71 }
72
73 public RuleFailure getRuleFailure() {
74 return ruleFailure;
75 }
76
77 public void setRuleFailure(RuleFailure ruleFailure) {
78 this.ruleFailure = ruleFailure;
79 }
80
81 public String getKey() {
82 return key;
83 }
84
85 public void setKey( String key ) {
86 if ( key.length() > PARAM_KEY_COLUMN_SIZE ) {
87 throw new IllegalArgumentException("RuleFailureParam key " + key + " size too long :" + key.length());
88 }
89 this.key = key;
90 }
91
92 public Double getValue() {
93 return value;
94 }
95
96 public void setValue( Double value ) {
97 this.value = value;
98 }
99
100 public Double getValue2() {
101 return value2;
102 }
103
104 public void setValue2( Double value2 ) {
105 this.value2 = value2;
106 }
107 }