Introduce new entities
[clamp.git] / src / main / java / org / onap / clamp / dao / model / MicroServicePolicy.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  *
22  */
23
24 package org.onap.clamp.dao.model;
25
26 import com.google.gson.annotations.Expose;
27 import com.vladmihalcea.hibernate.type.json.JsonStringType;
28
29 import java.io.Serializable;
30 import java.util.HashSet;
31 import java.util.Map;
32 import java.util.Set;
33
34 import javax.persistence.Column;
35 import javax.persistence.Entity;
36 import javax.persistence.Id;
37 import javax.persistence.ManyToMany;
38 import javax.persistence.Table;
39
40 import org.hibernate.annotations.Type;
41 import org.hibernate.annotations.TypeDef;
42
43 @Entity
44 @Table(name = "micro_service_policies")
45 @TypeDef(name = "json", typeClass = JsonStringType.class)
46 public class MicroServicePolicy implements Serializable {
47     /**
48      *
49      */
50     private static final long serialVersionUID = 6271238288583332616L;
51
52     @Expose
53     @Id
54     @Column(nullable = false, name = "name", unique = true)
55     private String name;
56
57     @Expose
58     @Type(type = "json")
59     @Column(columnDefinition = "json", name = "properties")
60     private Map<String, Object> properties;
61
62     @Expose
63     @Column(name = "shared", nullable = false)
64     private Boolean shared;
65
66     @Expose
67     @Column(name = "policy_tosca", nullable = false)
68     private String policyTosca;
69
70     @Expose
71     @Type(type = "json")
72     @Column(columnDefinition = "json", name = "json_representation", nullable = false)
73     private Map<String, Object> jsonRepresentation;
74
75     @ManyToMany(mappedBy = "microServicePolicies")
76     private Set<Loop> usedByLoops = new HashSet<>();
77
78     public String getName() {
79         return name;
80     }
81
82     public void setName(String name) {
83         this.name = name;
84     }
85
86     public Map<String, Object> getProperties() {
87         return properties;
88     }
89
90     public void setProperties(Map<String, Object> properties) {
91         this.properties = properties;
92     }
93
94     public Boolean getShared() {
95         return shared;
96     }
97
98     public void setShared(Boolean shared) {
99         this.shared = shared;
100     }
101
102     public String getPolicyTosca() {
103         return policyTosca;
104     }
105
106     public void setPolicyTosca(String policyTosca) {
107         this.policyTosca = policyTosca;
108     }
109
110     public Map<String, Object> getJsonRepresentation() {
111         return jsonRepresentation;
112     }
113
114     public void setJsonRepresentation(Map<String, Object> jsonRepresentation) {
115         this.jsonRepresentation = jsonRepresentation;
116     }
117
118     public Set<Loop> getUsedByLoops() {
119         return usedByLoops;
120     }
121
122     public void setUsedByLoops(Set<Loop> usedBy) {
123         this.usedByLoops = usedBy;
124     }
125
126 }