Remove major and minor code smells in dr-node
[dmaap/datarouter.git] / datarouter-node / src / main / java / org / onap / dmaap / datarouter / node / DestInfo.java
index 8aa339f..f5fa6e9 100644 (file)
 package org.onap.dmaap.datarouter.node;
 
 /**
- * Information for a delivery destination that doesn't change from message to message
+ * Information for a delivery destination that doesn't change from message to message.
  */
 public class DestInfo {
+
     private String name;
     private String spool;
     private String subid;
@@ -40,44 +41,33 @@ public class DestInfo {
     private boolean privilegedSubscriber;
     private boolean decompress;
     private boolean followRedirects;
-    private String aafInstance;
+
     /**
      * Create a destination information object.
      *
-     * @param    name    n:fqdn or s:subid
-     * @param    spool    The directory where files are spooled.
-     * @param    subid    The subscription ID (if applicable).
-     * @param    logdata    Text to be included in log messages
-     * @param    url    The URL to deliver to.
-     * @param    authuser    The auth user for logging.
-     * @param    authentication    The credentials.
-     * @param    metaonly    Is this a metadata only delivery?
-     * @param    use100    Should I use expect 100-continue?
-     * @param    privilegedSubscriber   Can we wait to receive a file processed acknowledgement before deleting file
-     * @param    followRedirects Is follow redirect of destination enabled?
-     * @param    decompress     To see if the they want there information compressed or decompressed
+     * @param destInfoBuilder DestInfo Object Builder
      */
-    public DestInfo(String name, String spool, String subid, String logdata, String url, String authuser, String authentication, boolean metaonly, boolean use100, boolean privilegedSubscriber, boolean followRedirects, boolean decompress) {
-        this.name = name;
-        this.spool = spool;
-        this.subid = subid;
-        this.logdata = logdata;
-        this.url = url;
-        this.authuser = authuser;
-        this.authentication = authentication;
-        this.metaonly = metaonly;
-        this.use100 = use100;
-        this.privilegedSubscriber = privilegedSubscriber;
-        this.followRedirects = followRedirects;
-        this.decompress = decompress;
+    public DestInfo(DestInfoBuilder destInfoBuilder) {
+        this.name = destInfoBuilder.getName();
+        this.spool = destInfoBuilder.getSpool();
+        this.subid = destInfoBuilder.getSubid();
+        this.logdata = destInfoBuilder.getLogdata();
+        this.url = destInfoBuilder.getUrl();
+        this.authuser = destInfoBuilder.getAuthuser();
+        this.authentication = destInfoBuilder.getAuthentication();
+        this.metaonly = destInfoBuilder.isMetaonly();
+        this.use100 = destInfoBuilder.isUse100();
+        this.privilegedSubscriber = destInfoBuilder.isPrivilegedSubscriber();
+        this.followRedirects = destInfoBuilder.isFollowRedirects();
+        this.decompress = destInfoBuilder.isDecompress();
     }
 
     /**
      * Create a destination information object.
      *
-     * @param    name    n:fqdn or s:subid
-     * @param    spool    The directory where files are spooled.
-     * @param    subscription    The subscription.
+     * @param name n:fqdn or s:subid
+     * @param spool The directory where files are spooled.
+     * @param subscription The subscription.
      */
     public DestInfo(String name, String spool, NodeConfig.ProvSubscription subscription) {
         this.name = name;
@@ -94,8 +84,8 @@ public class DestInfo {
         this.decompress = subscription.isDecompress();
     }
 
-    public boolean equals(Object o) {
-        return ((o instanceof DestInfo) && ((DestInfo) o).spool.equals(spool));
+    public boolean equals(Object object) {
+        return ((object instanceof DestInfo) && ((DestInfo) object).spool.equals(spool));
     }
 
     public int hashCode() {
@@ -103,7 +93,7 @@ public class DestInfo {
     }
 
     /**
-     * Get the name of this destination
+     * Get the name of this destination.
      */
     public String getName() {
         return (name);
@@ -147,7 +137,7 @@ public class DestInfo {
     }
 
     /**
-     * Get the user for authentication
+     * Get the user for authentication.
      *
      * @return The name of the user for logging
      */
@@ -156,7 +146,7 @@ public class DestInfo {
     }
 
     /**
-     * Get the authentication header
+     * Get the authentication header.
      *
      * @return The string to use to authenticate to the recipient.
      */
@@ -165,7 +155,7 @@ public class DestInfo {
     }
 
     /**
-     * Is this a metadata only delivery?
+     * Is this a metadata only delivery.
      *
      * @return True if this is a metadata only delivery
      */
@@ -174,7 +164,7 @@ public class DestInfo {
     }
 
     /**
-     * Should I send expect 100-continue header?
+     * Should I send expect 100-continue header.
      *
      * @return True if I should.
      */
@@ -183,23 +173,23 @@ public class DestInfo {
     }
 
     /**
-     * Should we wait to receive a file processed acknowledgement before deleting file
+     * Should we wait to receive a file processed acknowledgement before deleting file.
      */
     public boolean isPrivilegedSubscriber() {
         return (privilegedSubscriber);
     }
 
     /**
-    * Should I follow redirects?
-    *
-    * @return True if I should.
-    */
+     * Should I follow redirects.
+     *
+     * @return True if I should.
+     */
     public boolean isFollowRedirects() {
         return (followRedirects);
     }
 
     /**
-     * Should i decompress the file before sending it on
+     * Should i decompress the file before sending it on.
      *
      * @return True if I should.
      */