2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
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=========================================================
22 package org.onap.policy.rest.jpa;
24 import java.io.Serializable;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.GeneratedValue;
30 import javax.persistence.GenerationType;
31 import javax.persistence.Id;
32 import javax.persistence.NamedQuery;
33 import javax.persistence.OneToMany;
34 import javax.persistence.Table;
35 import javax.persistence.Transient;
38 import lombok.NoArgsConstructor;
42 * The persistent class for the PipType database table.
46 @Table(name = "PipType")
47 @NamedQuery(name = "PipType.findAll", query = "SELECT p FROM PipType p")
51 public class PipType implements Serializable {
52 private static final long serialVersionUID = 1L;
54 public static final String TYPE_SQL = "SQL";
55 public static final String TYPE_LDAP = "LDAP";
56 public static final String TYPE_CSV = "CSV";
57 public static final String TYPE_HYPERCSV = "Hyper-CSV";
58 public static final String TYPE_CUSTOM = "Custom";
61 @GeneratedValue(strategy = GenerationType.AUTO)
65 @Column(name = "type", nullable = false, length = 45)
68 // bi-directional many-to-one association to PipConfiguration
69 @OneToMany(mappedBy = "piptype")
70 private Set<PipConfiguration> pipconfigurations;
73 * Adds the pipconfiguration.
75 * @param pipconfiguration the pipconfiguration
76 * @return the PIP configuration
78 public PipConfiguration addPipconfiguration(PipConfiguration pipconfiguration) {
79 getPipconfigurations().add(pipconfiguration);
80 pipconfiguration.setPiptype(this);
82 return pipconfiguration;
86 * Removes the pipconfiguration.
88 * @param pipconfiguration the pipconfiguration
89 * @return the PIP configuration
91 public PipConfiguration removePipconfiguration(PipConfiguration pipconfiguration) {
92 getPipconfigurations().remove(pipconfiguration);
93 pipconfiguration.setPiptype(null);
95 return pipconfiguration;
101 * @return true, if is sql
104 public boolean isSql() {
105 return this.type.equals(TYPE_SQL);
111 * @return true, if is ldap
114 public boolean isLdap() {
115 return this.type.equals(TYPE_LDAP);
121 * @return true, if is csv
124 public boolean isCsv() {
125 return this.type.equals(TYPE_CSV);
129 * Checks if is hyper CSV.
131 * @return true, if is hyper CSV
134 public boolean isHyperCsv() {
135 return this.type.equals(TYPE_HYPERCSV);
139 * Checks if is custom.
141 * @return true, if is custom
144 public boolean isCustom() {
145 return this.type.equals(TYPE_CUSTOM);