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.onap.dmaap.dbcapi.model;
23 import javax.xml.bind.annotation.XmlRootElement;
25 import org.onap.dmaap.dbcapi.util.RandomString;
28 public class DR_Pub extends DmaapObject {
30 private String dcaeLocationName;
31 private String username;
32 private String userpwd;
33 private String feedId;
36 // NOTE: the following fields are optional in the API but not stored in the DB
37 private String feedName;
38 private String feedVersion;
42 status = DmaapObject_Status.EMPTY;
46 public DR_Pub( String dLN ) {
47 this.dcaeLocationName = dLN;
48 this.status = DmaapObject_Status.STAGED;
51 public DR_Pub( String dLN,
56 this.dcaeLocationName = dLN;
61 this.status = DmaapObject_Status.VALID;
65 public DR_Pub( String dLN,
69 this.dcaeLocationName = dLN;
73 this.pubId = fI + "." + DR_Pub.nextKey();
74 this.status = DmaapObject_Status.VALID;
78 public String getDcaeLocationName() {
79 return dcaeLocationName;
82 public void setDcaeLocationName(String dcaeLocationName) {
83 this.dcaeLocationName = dcaeLocationName;
86 public String getUsername() {
90 public void setUsername(String username) {
91 this.username = username;
94 public String getUserpwd() {
98 public void setUserpwd(String userpwd) {
99 this.userpwd = userpwd;
102 public String getFeedId() {
106 public void setFeedId(String feedId) {
107 this.feedId = feedId;
110 public String getPubId() {
114 public void setPubId(String pubId) {
118 public void setNextPubId() {
119 this.pubId = this.feedId + "." + DR_Pub.nextKey();
122 public String getFeedName() {
126 public void setFeedName(String feedName) {
127 this.feedName = feedName;
130 public String getFeedVersion() {
134 public void setFeedVersion(String feedVersion) {
135 this.feedVersion = feedVersion;
138 public DR_Pub setRandomUserName() {
139 RandomString r = new RandomString(15);
140 this.username = "tmp_" + r.nextString();
143 public DR_Pub setRandomPassword() {
144 RandomString r = new RandomString(15);
145 this.userpwd = r.nextString();
149 public static String nextKey() {
150 RandomString ri = new RandomString(5);
151 return ri.nextString();