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.annotations.Expose;
27 import com.vladmihalcea.hibernate.type.json.JsonStringType;
29 import java.io.Serializable;
30 import java.util.HashSet;
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;
40 import org.hibernate.annotations.Type;
41 import org.hibernate.annotations.TypeDef;
44 @Table(name = "micro_service_policies")
45 @TypeDef(name = "json", typeClass = JsonStringType.class)
46 public class MicroServicePolicy implements Serializable {
50 private static final long serialVersionUID = 6271238288583332616L;
54 @Column(nullable = false, name = "name", unique = true)
59 @Column(columnDefinition = "json", name = "properties")
60 private Map<String, Object> properties;
63 @Column(name = "shared", nullable = false)
64 private Boolean shared;
67 @Column(name = "policy_tosca", nullable = false)
68 private String policyTosca;
72 @Column(columnDefinition = "json", name = "json_representation", nullable = false)
73 private Map<String, Object> jsonRepresentation;
75 @ManyToMany(mappedBy = "microServicePolicies")
76 private Set<Loop> usedByLoops = new HashSet<>();
78 public String getName() {
82 public void setName(String name) {
86 public Map<String, Object> getProperties() {
90 public void setProperties(Map<String, Object> properties) {
91 this.properties = properties;
94 public Boolean getShared() {
98 public void setShared(Boolean shared) {
102 public String getPolicyTosca() {
106 public void setPolicyTosca(String policyTosca) {
107 this.policyTosca = policyTosca;
110 public Map<String, Object> getJsonRepresentation() {
111 return jsonRepresentation;
114 public void setJsonRepresentation(Map<String, Object> jsonRepresentation) {
115 this.jsonRepresentation = jsonRepresentation;
118 public Set<Loop> getUsedByLoops() {
122 public void setUsedByLoops(Set<Loop> usedBy) {
123 this.usedByLoops = usedBy;
127 public int hashCode() {
128 final int prime = 31;
130 result = prime * result + ((name == null) ? 0 : name.hashCode());
135 public boolean equals(Object obj) {
140 if (getClass() != obj.getClass())
142 MicroServicePolicy other = (MicroServicePolicy) obj;
144 if (other.name != null)
146 } else if (!name.equals(other.name))