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.CascadeType;
20 import javax.persistence.Column;
21 import javax.persistence.Entity;
22 import javax.persistence.FetchType;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.GenerationType;
25 import javax.persistence.Id;
26 import javax.persistence.JoinColumn;
27 import javax.persistence.JoinTable;
28 import javax.persistence.ManyToMany;
29 import javax.persistence.Table;
30 import javax.persistence.UniqueConstraint;
31 import java.io.Serializable;
32 import java.util.List;
33
34 import org.apache.logging.log4j.catalog.api.Product;
35
36
37
38
39 @Entity
40 @Table(name = "CATALOG_PRODUCT",
41 uniqueConstraints = { @UniqueConstraint(columnNames = { "NAME" })})
42 public class ProductModel implements Serializable {
43 private static final long serialVersionUID = -736368842796386523L;
44 @Id
45 @GeneratedValue(strategy= GenerationType.IDENTITY)
46 @Column(name = "ID")
47 private Long id;
48 @Column(name = "NAME")
49 private String name;
50 @Column(name = "DISPLAY_NAME")
51 private String displayName;
52 @Column(name = "DESCRIPTION")
53 private String description;
54 @Column(name = "CATALOG_ID")
55 private String catalogId;
56 @ManyToMany(fetch = FetchType.EAGER)
57 @JoinTable(name = "PRODUCT_EVENTS", joinColumns = { @JoinColumn(name = "PRODUCT_ID")},
58 inverseJoinColumns = { @JoinColumn(name = "EVENT_ID")})
59 private List<EventModel> events;
60
61 public ProductModel() {
62 catalogId = "DEFAULT";
63 }
64
65 public Long getId() {
66 return id;
67 }
68
69 public void setId(Long id) {
70 this.id = id;
71 }
72
73
74
75
76
77 public String getName() {
78 return name;
79 }
80
81
82
83
84
85 public void setName(String name) {
86 this.name = name;
87 }
88
89
90
91
92
93 public String getDisplayName() {
94 return displayName;
95 }
96
97
98
99
100
101 public void setDisplayName(String dislpayName) {
102 this.displayName = dislpayName;
103 }
104
105
106
107
108 public String getDescription() {
109 return description;
110 }
111
112
113
114
115
116 public void setDescription(String description) {
117 this.description = description;
118 }
119
120
121
122
123
124 public String getCatalogId() {
125 return catalogId;
126 }
127
128
129
130
131
132 public void setCatalogId(String catalogId) {
133 this.catalogId = catalogId;
134 }
135
136
137
138
139
140 public List<EventModel> getEvents() {
141 return events;
142 }
143
144
145
146
147
148 public void setEvents(List<EventModel> events) {
149 this.events = events;
150 }
151
152 }