Introduce jacoco-maven-plugin
[cps.git] / cps-ri / src / main / java / org / onap / cps / spi / entities / Module.java
1 /*
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2020 Nordix Foundation
4  *  Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
5  *  ================================================================================
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  *  SPDX-License-Identifier: Apache-2.0
18  *  ============LICENSE_END=========================================================
19  */
20
21 package org.onap.cps.spi.entities;
22
23 import java.io.Serializable;
24 import javax.persistence.Column;
25 import javax.persistence.Entity;
26 import javax.persistence.FetchType;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.GenerationType;
29 import javax.persistence.Id;
30 import javax.persistence.JoinColumn;
31 import javax.persistence.ManyToOne;
32 import javax.persistence.Table;
33 import javax.validation.constraints.NotNull;
34 import lombok.AllArgsConstructor;
35 import lombok.Getter;
36 import lombok.NoArgsConstructor;
37 import lombok.Setter;
38
39
40 /**
41  * Entity to store a yang module.
42  */
43 @Getter
44 @Setter
45 @Entity
46 @AllArgsConstructor
47 @NoArgsConstructor
48 @Table(name = "module")
49 public class Module implements Serializable {
50
51     private static final long serialVersionUID = -748666970938314895L;
52
53     @Id
54     @GeneratedValue(strategy = GenerationType.IDENTITY)
55     private Integer id;
56
57     @NotNull
58     @Column
59     private String moduleContent;
60
61     @NotNull
62     @Column
63     private String revision;
64
65     @ManyToOne(fetch = FetchType.LAZY)
66     @JoinColumn(name = "dataspace_id", referencedColumnName = "ID")
67     private Dataspace dataspace;
68
69     @NotNull
70     @Column
71     private String namespace;
72
73     /**
74      * Initialize a module entity.
75      *
76      * @param namespace the module namespace.
77      * @param moduleContent the module content.
78      * @param revision the revision number of the module.
79      * @param dataspace the dataspace related to the module.
80      */
81     public Module(String namespace, String moduleContent, String revision, Dataspace dataspace) {
82         this.namespace = namespace;
83         this.moduleContent = moduleContent;
84         this.revision = revision;
85         this.dataspace = dataspace;
86     }
87 }