summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorParshad Patel <pars.patel@samsung.com>2019-04-18 18:21:19 +0900
committerParshad Patel <pars.patel@samsung.com>2019-04-18 18:30:56 +0900
commitf4088bd4e2a872f5a10b58df00d6811351f8c265 (patch)
treeaf2b6d6076d3460ab40aaf4c200cceb64b28e059 /src/main
parent40e1e60eb8d8cc18d8542dbd7c00f69a9cc3042d (diff)
Fix sonar issues in dmaap-dbcpi
Fix Constructor has 8 parameters, which is greater than 7 authorized issue Issue-ID: DMAAP-894 Change-Id: Icffd5a442dbd9eb910cbbe8a512ba5cae5383927 Signed-off-by: Parshad Patel <pars.patel@samsung.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java2
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/model/Dmaap.java82
2 files changed, 65 insertions, 19 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java b/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
index c853782..14bacc4 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
@@ -109,7 +109,7 @@ public class DatabaseClass extends BaseLoggingClass {
break;
}
- dmaap.init(new Dmaap("0", "", "", "", "", "", "", ""));
+ dmaap.init(new Dmaap.DmaapBuilder().setVer("0").setTnr("").setDn("").setDpu("").setLu("").setBat("").setNk("").setAko("").createDmaap());
// force initial read from DB, if it exists
@SuppressWarnings("unused")
Dmaap dmx = dmaap.get();
diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/Dmaap.java b/src/main/java/org/onap/dmaap/dbcapi/model/Dmaap.java
index ba7fd42..96248f3 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/model/Dmaap.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/model/Dmaap.java
@@ -22,8 +22,6 @@ package org.onap.dmaap.dbcapi.model;
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.log4j.Logger;
-
@XmlRootElement
public class Dmaap extends DmaapObject {
@@ -42,26 +40,74 @@ public class Dmaap extends DmaapObject {
}
- public Dmaap( String ver,
- String tnr,
- String dn,
- String dpu,
- String lu,
- String bat,
- String nk,
- String ako ) {
- this.version = ver;
- this.topicNsRoot = tnr;
- this.dmaapName = dn;
- this.drProvUrl = dpu;
- this.bridgeAdminTopic = bat;
- this.loggingUrl = lu;
- this.nodeKey = nk;
- this.accessKeyOwner = ako;
+ public Dmaap( DmaapBuilder builder ) {
+ this.version = builder.ver;
+ this.topicNsRoot = builder.tnr;
+ this.dmaapName = builder.dn;
+ this.drProvUrl = builder.dpu;
+ this.bridgeAdminTopic = builder.bat;
+ this.loggingUrl = builder.lu;
+ this.nodeKey = builder.nk;
+ this.accessKeyOwner = builder.ako;
this.setStatus( DmaapObject_Status.NEW );
}
+ public static class DmaapBuilder {
+ private String ver;
+ private String tnr;
+ private String dn;
+ private String dpu;
+ private String lu;
+ private String bat;
+ private String nk;
+ private String ako;
+
+ public DmaapBuilder setVer(String ver) {
+ this.ver = ver;
+ return this;
+ }
+
+ public DmaapBuilder setTnr(String tnr) {
+ this.tnr = tnr;
+ return this;
+ }
+
+ public DmaapBuilder setDn(String dn) {
+ this.dn = dn;
+ return this;
+ }
+
+ public DmaapBuilder setDpu(String dpu) {
+ this.dpu = dpu;
+ return this;
+ }
+
+ public DmaapBuilder setLu(String lu) {
+ this.lu = lu;
+ return this;
+ }
+
+ public DmaapBuilder setBat(String bat) {
+ this.bat = bat;
+ return this;
+ }
+
+ public DmaapBuilder setNk(String nk) {
+ this.nk = nk;
+ return this;
+ }
+
+ public DmaapBuilder setAko(String ako) {
+ this.ako = ako;
+ return this;
+ }
+
+ public Dmaap createDmaap() {
+ return new Dmaap(this);
+ }
+ }
+
public String getVersion() {
return version;
}