2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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 * ===================================================================
24 package org.onap.clamp.dao.model;
26 import com.google.gson.JsonObject;
27 import com.google.gson.annotations.Expose;
29 import java.io.Serializable;
31 import javax.persistence.Column;
32 import javax.persistence.Entity;
33 import javax.persistence.FetchType;
34 import javax.persistence.Id;
35 import javax.persistence.JoinColumn;
36 import javax.persistence.ManyToOne;
37 import javax.persistence.Table;
39 import org.hibernate.annotations.Type;
40 import org.hibernate.annotations.TypeDef;
41 import org.hibernate.annotations.TypeDefs;
42 import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
45 @Table(name = "operational_policies")
46 @TypeDefs({ @TypeDef(name = "json", typeClass = StringJsonUserType.class) })
47 public class OperationalPolicy implements Serializable {
51 private static final long serialVersionUID = 6117076450841538255L;
55 @Column(nullable = false, name = "name", unique = true)
60 @Column(columnDefinition = "json", name = "configurations_json")
61 private JsonObject configurationsJson;
63 @ManyToOne(fetch = FetchType.LAZY)
64 @JoinColumn(name = "loop_id", nullable = false)
67 public Loop getLoop() {
71 public void setLoop(Loop loop) {
75 public String getName() {
79 public void setName(String name) {
83 public JsonObject getConfigurationsJson() {
84 return configurationsJson;
87 public void setConfigurationsJson(JsonObject configurationsJson) {
88 this.configurationsJson = configurationsJson;
92 public int hashCode() {
95 result = prime * result + ((name == null) ? 0 : name.hashCode());
100 public boolean equals(Object obj) {
105 if (getClass() != obj.getClass())
107 OperationalPolicy other = (OperationalPolicy) obj;
109 if (other.name != null)
111 } else if (!name.equals(other.name))