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.openecomp.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.JoinColumn;
31 import javax.persistence.Lob;
32 import javax.persistence.ManyToOne;
33 import javax.persistence.NamedQuery;
34 import javax.persistence.OneToOne;
35 import javax.persistence.Table;
37 import org.openecomp.policy.rest.jpa.Attribute;
41 * The persistent class for the ObadviceExpressions database table.
45 @Table(name="ObadviceExpressions")
46 @NamedQuery(name="ObadviceExpression.findAll", query="SELECT o FROM ObadviceExpression o")
47 public class ObadviceExpression implements Serializable {
48 private static final long serialVersionUID = 1L;
50 public static final String EXPRESSION_APPLY = "Apply";
51 public static final String EXPRESSION_SELECTOR = "Attribute Selector";
52 public static final String EXPRESSION_VALUE = "Attribute Value";
53 public static final String EXPRESSION_FUNCTION = "Function";
54 public static final String EXPRESSION_REFERENCE = "Varable Reference";
55 public static final String EXPRESSION_DESIGNATOR = "Attribute Designator";
58 @GeneratedValue(strategy = GenerationType.AUTO)
62 //unidirectional one-to-one association to Attribute
64 @JoinColumn(name="attribute_id")
65 private Attribute attribute;
67 @Column(name="type", nullable=false)
72 @Column(name="expression", nullable=false)
73 private byte[] expression;
76 //bi-directional many-to-one association to Obadvice
78 @JoinColumn(name="obadvice_id")
79 private Obadvice obadvice;
81 public ObadviceExpression() {
82 type = EXPRESSION_VALUE;
89 public void setId(int id) {
93 public Attribute getAttribute() {
94 return this.attribute;
97 public void setAttribute(Attribute attribute) {
98 this.attribute = attribute;
101 public String getType() {
105 public void setType(String type) {
109 public Obadvice getObadvice() {
110 return this.obadvice;
113 public void setObadvice(Obadvice obadvice) {
114 this.obadvice = obadvice;
117 public ObadviceExpression clone() {
118 ObadviceExpression expression = new ObadviceExpression();
120 expression.attribute = this.attribute;
121 expression.type = this.type;
122 expression.obadvice = this.obadvice;