14ac6af1de485b62a8da20dcc9c720e23fd7738d
[ccsdk/cds.git] /
1 /*
2  * Copyright © 2018 IBM Intellectual Property.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.ccsdk.apps.controllerblueprints.service.domain;
18
19 import com.fasterxml.jackson.annotation.JsonManagedReference;
20 import org.hibernate.annotations.Proxy;
21 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
22
23 import javax.persistence.*;
24 import java.io.Serializable;
25 import java.util.ArrayList;
26 import java.util.List;
27 import java.util.UUID;
28
29 /**
30  * CbaContent.java Purpose: Provide Configuration Generator for CbaContent Entity
31  *
32  * @author Ruben Chang
33  * @version 1.0
34  */
35
36 @EntityListeners({AuditingEntityListener.class})
37 @Entity
38 @Table(name = "CBA_CONTENT")
39 @Proxy(lazy=false)
40 public class CbaContent implements Serializable {
41
42     private static final long serialVersionUID = 1L;
43
44     public CbaContent() {
45         this.cbaUUID = UUID.randomUUID().toString();
46     }
47
48     @Id
49     @Column(name = "cba_uuid", nullable = false)
50     private String cbaUUID;
51
52     @Lob
53     @Column(name = "cba_file")
54     private byte[] cbaFile;
55
56     @Column(name = "cba_name")
57     private String cbaName;
58
59     @Column(name = "cba_version")
60     private String cbaVersion;
61
62     @Column(name = "cba_state")
63     private int cbaState;
64
65     @Column(name="cba_description")
66     private String cbaDescription;
67
68     @OneToMany(mappedBy = "configModelCBA", fetch = FetchType.EAGER, orphanRemoval = true, cascade = CascadeType.ALL)
69     @JsonManagedReference
70     private List<ConfigModel> models = new ArrayList<>();
71
72     public String getCbaUUID() {
73         return cbaUUID;
74     }
75
76     public void setCbaUUID(String cbaUUID) {
77         this.cbaUUID = cbaUUID;
78     }
79
80     public String getCbaName() {
81         return cbaName;
82     }
83
84     public void setCbaName(String cbaName) {
85         this.cbaName = cbaName;
86     }
87
88     public String getCbaVersion() {
89         return cbaVersion;
90     }
91
92     public void setCbaVersion(String cbaVersion) {
93         this.cbaVersion = cbaVersion;
94     }
95
96     public List<ConfigModel> getModels() {
97         return models;
98     }
99
100     public void setModels(List<ConfigModel> models) { this.models = models; }
101
102     public int getCbaState() { return cbaState; }
103
104     public void setCbaState(int cbaState) { this.cbaState = cbaState; }
105
106     public String getCbaDescription() { return cbaDescription; }
107
108     public void setCbaDescription(String cbaDescription) { this.cbaDescription = cbaDescription; }
109
110     public byte[] getCbaFile() { return cbaFile; }
111
112     public void setCbaFile(byte[] cbaFile) { this.cbaFile = cbaFile; }
113
114 }