Merge 1806 code of vid-common
[vid.git] / vid-app-common / src / main / java / org / onap / vid / model / CategoryParameter.java
1 package org.onap.vid.model;
2
3 //import org.hibernate.annotations.Table;
4
5 import javax.persistence.*;
6 import java.util.HashSet;
7 import java.util.Set;
8
9 //import javax.persistence.*;
10
11 @Entity
12 @Table(name = "vid_category_parameter", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
13 public class CategoryParameter extends VidBaseEntity {
14
15     public enum Family {
16         PARAMETER_STANDARDIZATION,
17         TENANT_ISOLATION
18     }
19
20     private String name;
21     private boolean idSupported;
22
23     @Column(name = "FAMILY")
24     @Enumerated(EnumType.STRING)
25     private String family;
26
27     public String getFamily() {
28         return family;
29     }
30
31     public void setFamily(String family) {
32         this.family = family;
33     }
34
35     private Set<CategoryParameterOption> options = new HashSet<>(0);
36
37     @Override
38     @Id
39     @GeneratedValue(strategy = GenerationType.IDENTITY)
40     @Column(name = "CATEGORY_ID")
41     public Long getId() {
42         return super.getId();
43     }
44
45     @Column(name = "NAME", unique = true, nullable = false, length=50)
46     public String getName() {
47         return name;
48     }
49
50     public void setName(String name) {
51         this.name = name;
52     }
53
54     @OneToMany(fetch = FetchType.EAGER, mappedBy = "categoryParameter")
55     public Set<CategoryParameterOption> getOptions() {
56         return options;
57     }
58
59     public void setOptions(Set<CategoryParameterOption> options) {
60         this.options = options;
61     }
62
63     public boolean addOption(CategoryParameterOption option) {
64         return options.add(option);
65     }
66
67     @Column(name = "ID_SUPPORTED")
68     public boolean isIdSupported() {
69         return idSupported;
70     }
71
72     public void setIdSupported(boolean idSupported) {
73         this.idSupported = idSupported;
74     }
75 }