feat: new changes for design module
[dcaegen2/services.git] / components / datalake-handler / feeder / src / main / java / org / onap / datalake / feeder / domain / Portal.java
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : DataLake
4  * ================================================================================
5  * Copyright 2019 China Mobile
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
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20
21 package org.onap.datalake.feeder.domain;
22
23 import com.fasterxml.jackson.annotation.JsonBackReference;
24 import lombok.Getter;
25 import lombok.Setter;
26 import org.onap.datalake.feeder.dto.PortalConfig;
27
28 import javax.persistence.*;
29
30 /**
31  * Domain class representing portal
32  *
33  * @author guochunmeng
34  */
35
36 @Getter
37 @Setter
38 @Entity
39 @Table(name = "portal")
40 public class Portal {
41
42     @Id
43     @Column(name = "`name`")
44     private String name;
45
46     @Column(name = "`enabled`")
47     private Boolean enabled;
48
49     @Column(name = "`host`")
50     private String host;
51
52     @Column(name = "`port`")
53     private Integer port;
54
55     @Column(name = "`login`")
56     private String login;
57
58     @Column(name = "`pass`")
59     private String pass;
60
61     @ManyToOne(fetch=FetchType.EAGER)
62     @JoinColumn(name = "related_db")
63     @JsonBackReference
64     private Db db;
65
66     public PortalConfig getPortalConfig() {
67         PortalConfig portalConfig = new PortalConfig();
68
69         portalConfig.setName(getName());
70         portalConfig.setLogin(getLogin());
71         portalConfig.setPass(getPass());
72         portalConfig.setEnabled(getEnabled());
73         portalConfig.setHost(getHost());
74         portalConfig.setPort(getPort());
75         portalConfig.setDb(getDb().getName());
76
77         return portalConfig;
78     }
79 }