1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.logging.log4j.catalog.jpa.model;
18
19 import javax.persistence.Column;
20 import javax.persistence.Entity;
21 import javax.persistence.GeneratedValue;
22 import javax.persistence.GenerationType;
23 import javax.persistence.Id;
24 import javax.persistence.JoinColumn;
25 import javax.persistence.ManyToOne;
26 import javax.persistence.Table;
27 import java.io.Serializable;
28
29
30
31
32 @Entity
33 @Table(name = "ATTRIBUTE_CONSTRAINT")
34 public class ConstraintModel implements Serializable {
35
36 private static final long serialVersionUID = 6836453963830996541L;
37
38 @Id
39 @GeneratedValue(strategy= GenerationType.IDENTITY)
40 @Column(name = "ID")
41 private Long id;
42 @ManyToOne
43 @JoinColumn(name = "ATTRIBUTE_ID")
44 private AttributeModel attribute;
45 @Column(name = "CONSTRAINT_TYPE")
46 private String constraintType;
47 @Column(name = "VALUE")
48 private String value;
49
50 public Long getId() {
51 return id;
52 }
53
54 public void setId(Long id) {
55 this.id = id;
56 }
57
58 public String getConstraintType() {
59 return constraintType;
60 }
61
62 public void setConstraintType(String constraintType) {
63 this.constraintType = constraintType;
64 }
65
66 public String getValue() {
67 return value;
68 }
69
70 public void setValue(String value) {
71 this.value = value;
72 }
73
74 public AttributeModel getAttribute() {
75 return attribute;
76 }
77
78 public void setAttribute(AttributeModel attribute) {
79 this.attribute = attribute;
80 if (attribute.getConstraints() != null && !attribute.getConstraints().contains(this)) {
81 attribute.getConstraints().add(this);
82 }
83
84 }
85 }