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=========================================================
20 package org.onap.policy.rest.jpa;
22 import java.io.Serializable;
24 import javax.persistence.Column;
25 import javax.persistence.Entity;
26 import javax.persistence.GeneratedValue;
27 import javax.persistence.GenerationType;
28 import javax.persistence.Id;
29 import javax.persistence.NamedQuery;
30 import javax.persistence.Table;
31 import javax.persistence.Transient;
33 import com.att.research.xacml.api.Identifier;
36 @Table(name="RuleAlgorithms")
37 @NamedQuery(name="RuleAlgorithms.findAll", query="SELECT d FROM RuleAlgorithms d")
38 public class RuleAlgorithms implements Serializable {
39 private static final long serialVersionUID = 1L;
41 public static final char STANDARD = 'S';
42 public static final char CUSTOM = 'C';
45 @GeneratedValue(strategy = GenerationType.AUTO)
49 @Column(name="is_standard", nullable=false)
50 private char isStandard;
52 @Column(name="xacml_id", nullable=false, unique=true, length=255)
53 private String xacmlId;
55 @Column(name="short_name", nullable=false, length=64)
56 private String shortName;
58 public RuleAlgorithms(Identifier id, char standard) {
60 this.xacmlId = id.stringValue();
62 this.isStandard = standard;
64 public RuleAlgorithms(Identifier id) {
65 this(id, RuleAlgorithms.STANDARD);
68 public RuleAlgorithms() {
69 this(null, RuleAlgorithms.STANDARD);
76 public void setId(int id) {
80 public char getIsStandard() {
81 return this.isStandard;
84 public void setIsStandard(char isStandard) {
85 this.isStandard = isStandard;
89 public boolean isStandard() {
90 return this.isStandard == RuleAlgorithms.STANDARD;
94 public boolean isCustom() {
95 return this.isStandard == RuleAlgorithms.CUSTOM;
98 public String getXacmlId() {
102 public void setXacmlId(String xacmlId) {
103 this.xacmlId = xacmlId;
106 public String getShortName() {
110 public void setShortName(String shortName) {
111 this.shortName = shortName;