2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.rest.jpa;
23 import java.io.Serializable;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.GenerationType;
30 import javax.persistence.Id;
31 import javax.persistence.NamedQuery;
32 import javax.persistence.OneToMany;
33 import javax.persistence.Table;
34 import javax.persistence.Transient;
38 * The persistent class for the PIPType database table.
42 @Table(name="PIPType")
43 @NamedQuery(name="PIPType.findAll", query="SELECT p FROM PIPType p")
44 public class PIPType implements Serializable {
45 private static final long serialVersionUID = 1L;
47 public static final String TYPE_SQL = "SQL";
48 public static final String TYPE_LDAP = "LDAP";
49 public static final String TYPE_CSV = "CSV";
50 public static final String TYPE_HYPERCSV = "Hyper-CSV";
51 public static final String TYPE_CUSTOM = "Custom";
54 @GeneratedValue(strategy=GenerationType.AUTO)
58 @Column(name="type", nullable=false, length=45)
61 //bi-directional many-to-one association to PIPConfiguration
62 @OneToMany(mappedBy="piptype")
63 private Set<PIPConfiguration> pipconfigurations;
73 public void setId(int id) {
77 public String getType() {
81 public void setType(String type) {
85 public Set<PIPConfiguration> getPipconfigurations() {
86 return this.pipconfigurations;
89 public void setPipconfigurations(Set<PIPConfiguration> pipconfigurations) {
90 this.pipconfigurations = pipconfigurations;
93 public PIPConfiguration addPipconfiguration(PIPConfiguration pipconfiguration) {
94 getPipconfigurations().add(pipconfiguration);
95 pipconfiguration.setPiptype(this);
97 return pipconfiguration;
100 public PIPConfiguration removePipconfiguration(PIPConfiguration pipconfiguration) {
101 getPipconfigurations().remove(pipconfiguration);
102 pipconfiguration.setPiptype(null);
104 return pipconfiguration;
108 public boolean isSQL() {
109 return this.type.equals(TYPE_SQL);
113 public boolean isLDAP() {
114 return this.type.equals(TYPE_LDAP);
118 public boolean isCSV() {
119 return this.type.equals(TYPE_CSV);
123 public boolean isHyperCSV() {
124 return this.type.equals(TYPE_HYPERCSV);
128 public boolean isCustom() {
129 return this.type.equals(TYPE_CUSTOM);