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 RuleAlgorithms.
44 @Table(name = "RuleAlgorithms")
45 @NamedQuery(name = "RuleAlgorithms.findAll", query = "SELECT d FROM RuleAlgorithms d")
48 public class RuleAlgorithms 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 rule algorithms.
72 * @param standard the standard
74 public RuleAlgorithms(Identifier id, char standard) {
76 this.xacmlId = id.stringValue();
78 this.isStandard = standard;
82 * Instantiates a new rule algorithms.
86 public RuleAlgorithms(Identifier id) {
87 this(id, RuleAlgorithms.STANDARD);
91 * Instantiates a new rule algorithms.
93 public RuleAlgorithms() {
94 this(null, RuleAlgorithms.STANDARD);
98 public boolean isStandard() {
99 return this.isStandard == RuleAlgorithms.STANDARD;
103 public boolean isCustom() {
104 return this.isStandard == RuleAlgorithms.CUSTOM;