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 com.att.research.xacml.api.Identifier;
26 import java.io.Serializable;
28 import javax.persistence.Column;
29 import javax.persistence.Entity;
30 import javax.persistence.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.NamedQuery;
34 import javax.persistence.Table;
35 import javax.persistence.Transient;
41 * The Class PolicyAlgorithms.
44 @Table(name = "PolicyAlgorithms")
45 @NamedQuery(name = "PolicyAlgorithms.findAll", query = "SELECT d FROM PolicyAlgorithms d")
48 public class PolicyAlgorithms implements Serializable {
49 private static final long serialVersionUID = 1L;
51 public static final char STANDARD = 'S';
52 public static final char CUSTOM = 'C';
55 @GeneratedValue(strategy = GenerationType.AUTO)
59 @Column(name = "is_standard", nullable = false)
60 private char isStandard;
62 @Column(name = "xacml_id", nullable = false, unique = true, length = 255)
63 private String xacmlId;
65 @Column(name = "short_name", nullable = false, length = 64)
66 private String shortName;
69 * Instantiates a new policy algorithms.
71 * @param identifier the identifier
72 * @param standard the standard
74 public PolicyAlgorithms(Identifier identifier, char standard) {
75 this.isStandard = standard;
76 if (identifier != null) {
77 this.xacmlId = identifier.stringValue();
82 * Instantiates a new policy algorithms.
84 * @param identifier the identifier
86 public PolicyAlgorithms(Identifier identifier) {
87 this(identifier, PolicyAlgorithms.STANDARD);
91 * Instantiates a new policy algorithms.
93 public PolicyAlgorithms() {
94 this(null, PolicyAlgorithms.STANDARD);
98 * Checks if is standard.
100 * @return true, if is standard
103 public boolean isStandard() {
104 return this.isStandard == PolicyAlgorithms.STANDARD;
108 * Checks if is custom.
110 * @return true, if is custom
113 public boolean isCustom() {
114 return this.isStandard == PolicyAlgorithms.CUSTOM;