Patch set 2: changes to MR_Client
[dmaap/dbcapi.git] / src / main / java / org / onap / dmaap / dbcapi / model / MR_Client.java
index 580800c..f182fd6 100644 (file)
@@ -26,15 +26,25 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 import org.onap.dmaap.dbcapi.database.DatabaseClass;
 
+import io.swagger.annotations.ApiModelProperty;
+
 @XmlRootElement
 public class MR_Client extends DmaapObject {
 
+       @ApiModelProperty( value="a tag indicating a logical deployment site")
        private String dcaeLocationName;
+       @ApiModelProperty( value="the URL for a MR instance - typically in the same dcaeLocation - that this client should use to access the topic")
        private String  topicURL;
+       @ApiModelProperty( value="Fully Qualified Topic Name constructed by dbcapi")
        private String fqtn;
+       @ApiModelProperty( value="an AAF Role to be granted an appropriate Permission.  If specified, takes precedence over clientIdentity, for backwards compatibility.")
        private String clientRole;
+       @ApiModelProperty( value="one or more actions from the set (\"pub\", \"sub\", \"view\") for which this client needs Permission")
        private String[] action;
+       @ApiModelProperty( value="a unique identifier generated by dbcapi for this client")
        private String mrClientId;
+       @ApiModelProperty( value="an AAF identity to be associated to an appropriate topic Role")
+       private String clientIdentity;
        
 
        public MR_Client() {
@@ -97,7 +107,24 @@ public class MR_Client extends DmaapObject {
        public void setAction(String[] action) {
                this.action = action;
        }
-
+       
+       @ApiModelProperty( hidden=true )
+       public boolean isPublisher() {
+               return hasAction( "pub");
+       }
+       @ApiModelProperty( hidden=true )
+       public boolean isSubscriber() {
+               return hasAction( "sub");
+       }
+       
+       public boolean hasAction( String val ) {
+               for (String s: this.action) {
+                       if ( s!= null && s.equals(val)) {
+                               return true;
+                       }
+               }
+               return false;
+       }
        public String getMrClientId() {
                return mrClientId;
        }
@@ -115,5 +142,21 @@ public class MR_Client extends DmaapObject {
        public void setTopicURL(String topicURL) {
                this.topicURL = topicURL;
        }
+
+       public String getClientIdentity() {
+               return clientIdentity;
+       }
+
+       public void setClientIdentity(String clientIdentity) {
+               this.clientIdentity = clientIdentity;
+       }
+       public boolean hasClientIdentity() {
+               if ( this.clientIdentity == null || this.clientIdentity.isEmpty() ) {
+                       return false;
+               } else {
+                       return true;
+               }
+       }
+
        
 }