Introduce new entities
[clamp.git] / src / main / java / org / onap / clamp / dao / model / OperationalPolicy.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.Map;
31
32 import javax.persistence.Column;
33 import javax.persistence.Entity;
34 import javax.persistence.FetchType;
35 import javax.persistence.Id;
36 import javax.persistence.JoinColumn;
37 import javax.persistence.ManyToOne;
38 import javax.persistence.Table;
39
40 import org.hibernate.annotations.Type;
41 import org.hibernate.annotations.TypeDef;
42
43 @Entity
44 @Table(name = "operational_policies")
45 @TypeDef(name = "json", typeClass = JsonStringType.class)
46 public class OperationalPolicy implements Serializable {
47     /**
48      *
49      */
50     private static final long serialVersionUID = 6117076450841538255L;
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 = "configurations_json")
60     private Map<String, Object> configurationsJson;
61
62     @ManyToOne(fetch = FetchType.LAZY)
63     @JoinColumn(name = "loop_id", nullable = false)
64     private Loop loop;
65
66     public Loop getLoop() {
67         return loop;
68     }
69
70     public void setLoop(Loop loop) {
71         this.loop = loop;
72     }
73
74     public String getName() {
75         return name;
76     }
77
78     public void setName(String name) {
79         this.name = name;
80     }
81
82     public Map<String, Object> getConfigurationsJson() {
83         return configurationsJson;
84     }
85
86     public void setConfigurationsJson(Map<String, Object> configurationsJson) {
87         this.configurationsJson = configurationsJson;
88     }
89
90 }