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;
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.GenerationType;
29 import javax.persistence.Id;
30 import javax.persistence.NamedQuery;
31 import javax.persistence.Table;
32 import javax.persistence.Transient;
34 import com.att.research.xacml.api.Identifier;
37 @Table(name="PolicyAlgorithms")
38 @NamedQuery(name="PolicyAlgorithms.findAll", query="SELECT d FROM PolicyAlgorithms d")
39 public class PolicyAlgorithms implements Serializable {
40 private static final long serialVersionUID = 1L;
42 public static final char STANDARD = 'S';
43 public static final char CUSTOM = 'C';
46 @GeneratedValue(strategy = GenerationType.AUTO)
50 @Column(name="is_standard", nullable=false)
51 private char isStandard;
53 @Column(name="xacml_id", nullable=false, unique=true, length=255)
54 private String xacmlId;
56 @Column(name="short_name", nullable=false, length=64)
57 private String shortName;
59 public PolicyAlgorithms(Identifier identifier, char standard) {
60 this.isStandard = standard;
61 if (identifier != null) {
62 this.xacmlId = identifier.stringValue();
66 public PolicyAlgorithms(Identifier identifier) {
67 this(identifier, PolicyAlgorithms.STANDARD);
70 public PolicyAlgorithms() {
71 this(null, PolicyAlgorithms.STANDARD);
78 public void setId(int id) {
82 public char getIsStandard() {
83 return this.isStandard;
86 public void setIsStandard(char isStandard) {
87 this.isStandard = isStandard;
91 public boolean isStandard() {
92 return this.isStandard == PolicyAlgorithms.STANDARD;
96 public boolean isCustom() {
97 return this.isStandard == PolicyAlgorithms.CUSTOM;
100 public String getXacmlId() {
104 public void setXacmlId(String xacmlId) {
105 this.xacmlId = xacmlId;
108 public String getShortName() {
112 public void setShortName(String shortName) {
113 this.shortName = shortName;