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.openecomp.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;
72 public void setId(int id) {
76 public String getType() {
80 public void setType(String type) {
84 public Set<PIPConfiguration> getPipconfigurations() {
85 return this.pipconfigurations;
88 public void setPipconfigurations(Set<PIPConfiguration> pipconfigurations) {
89 this.pipconfigurations = pipconfigurations;
92 public PIPConfiguration addPipconfiguration(PIPConfiguration pipconfiguration) {
93 getPipconfigurations().add(pipconfiguration);
94 pipconfiguration.setPiptype(this);
96 return pipconfiguration;
99 public PIPConfiguration removePipconfiguration(PIPConfiguration pipconfiguration) {
100 getPipconfigurations().remove(pipconfiguration);
101 pipconfiguration.setPiptype(null);
103 return pipconfiguration;
107 public boolean isSQL() {
108 return this.type.equals(TYPE_SQL);
112 public boolean isLDAP() {
113 return this.type.equals(TYPE_LDAP);
117 public boolean isCSV() {
118 return this.type.equals(TYPE_CSV);
122 public boolean isHyperCSV() {
123 return this.type.equals(TYPE_HYPERCSV);
127 public boolean isCustom() {
128 return this.type.equals(TYPE_CUSTOM);