06598f7ccce19e034075a24c79d1a6f5ddfc61ea
[dmaap/dbcapi.git] / src / main / java / org / onap / dmaap / dbcapi / model / DR_Pub.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * org.onap.dmaap
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
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.dmaap.dbcapi.model;
22
23 import javax.xml.bind.annotation.XmlRootElement;
24
25 import org.onap.dmaap.dbcapi.util.RandomString;
26
27 @XmlRootElement
28 public class DR_Pub extends DmaapObject {
29
30         private String dcaeLocationName;
31         private String username;
32         private String userpwd;
33         private String feedId;
34         private String pubId;
35
36         
37         public DR_Pub() {
38                 status = DmaapObject_Status.EMPTY;
39                 
40         }
41         
42         public DR_Pub( String dLN ) {
43                 this.dcaeLocationName = dLN;
44                 this.status = DmaapObject_Status.STAGED;
45         }
46         
47         public DR_Pub( String dLN, 
48                                         String uN,
49                                         String uP,
50                                         String fI,
51                                         String pI ) {
52                 this.dcaeLocationName = dLN;
53                 this.username = uN;
54                 this.userpwd = uP;
55                 this.feedId = fI;
56                 this.pubId = pI;
57                 this.status = DmaapObject_Status.VALID;
58         }
59
60
61         public DR_Pub( String dLN, 
62                                                         String uN,
63                                                         String uP,
64                                                         String fI ) {
65                 this.dcaeLocationName = dLN;
66                 this.username = uN;
67                 this.userpwd = uP;
68                 this.feedId = fI;
69                 this.pubId = fI + "." +  DR_Pub.nextKey();
70                 this.status = DmaapObject_Status.VALID; 
71         }
72                         
73
74         public String getDcaeLocationName() {
75                 return dcaeLocationName;
76         }
77
78         public void setDcaeLocationName(String dcaeLocationName) {
79                 this.dcaeLocationName = dcaeLocationName;
80         }
81
82         public String getUsername() {
83                 return username;
84         }
85
86         public void setUsername(String username) {
87                 this.username = username;
88         }
89
90         public String getUserpwd() {
91                 return userpwd;
92         }
93
94         public void setUserpwd(String userpwd) {
95                 this.userpwd = userpwd;
96         }
97
98         public String getFeedId() {
99                 return feedId;
100         }
101
102         public void setFeedId(String feedId) {
103                 this.feedId = feedId;
104         }
105
106         public String getPubId() {
107                 return pubId;
108         }
109
110         public void setPubId(String pubId) {
111                 this.pubId = pubId;
112         }
113         
114         public void setNextPubId() {
115                 this.pubId = this.feedId + "." +  DR_Pub.nextKey();
116         }
117
118         public DR_Pub setRandomUserName() {
119                 RandomString r = new RandomString(15);
120                 this.username = "tmp_" + r.nextString();        
121                 return this;
122         }
123         public DR_Pub setRandomPassword() {
124                 RandomString r = new RandomString(15);
125                 this.userpwd = r.nextString();
126                 return this;
127         }
128
129         public static String nextKey() {
130                 RandomString ri = new RandomString(5);
131                 return ri.nextString();
132                 
133         }
134         
135 }