JAL-3070 web service handle with UIinfo.hasParameters() == true => instanceof Service...
[jalview.git] / src / jalview / ws / api / UIinfo.java
index cd156f2..01fb809 100644 (file)
@@ -1,18 +1,41 @@
 package jalview.ws.api;
 
+import jalview.ws.params.ParamDatastoreI;
+
 /**
  * Service UI Info { Action, Specific Name of Service, Brief Description }
  */
 
 public class UIinfo
 {
-  public UIinfo(String action, String name, String description)
+  private String ServiceType;
+
+  public UIinfo(String serviceType, String action, String name,
+          String description, String hosturl)
   {
+    this.setServiceType(serviceType == null ? "" : serviceType);
     this.Action = action == null ? "" : action;
     this.description = description == null ? "" : description;
     this.Name = name == null ? "" : name;
+    this.hostURL = hosturl;
+  }
+
+  /**
+   * The type of analysis the service performs
+   */
+  public String getServiceType()
+  {
+    return ServiceType;
   }
 
+  public void setServiceType(String serviceType)
+  {
+    ServiceType = serviceType;
+  }
+
+  /**
+   * The action when the service performs the analysis
+   */
   public String getAction()
   {
     return Action;
@@ -23,6 +46,11 @@ public class UIinfo
     Action = action;
   }
 
+  /**
+   * name shown to user
+   * 
+   * @return
+   */
   public String getName()
   {
     return Name;
@@ -33,6 +61,11 @@ public class UIinfo
     Name = name;
   }
 
+  /**
+   * Detailed description (may include references, URLs, html,etc)
+   * 
+   * @return
+   */
   public String getDescription()
   {
     return description;
@@ -52,8 +85,15 @@ public class UIinfo
     }
     UIinfo other = (UIinfo) object;
 
-    return (Name == null && other.getName() == null || Name != null
-            && other.getName() != null && Name.equals(other.getName()))
+    return (ServiceType == null && other.getServiceType() == null
+            || ServiceType != null && other.getServiceType() != null
+                    && ServiceType.equals(other.getServiceType()))
+            && (hostURL == null && other.getHostURL() == null
+                    || hostURL != null && other.getHostURL() != null
+                            && hostURL.equals(other.getHostURL()))
+            && (Name == null && other.getName() == null
+                    || Name != null && other.getName() != null
+                            && Name.equals(other.getName()))
             && (Action == null && other.getAction() == null
                     || Action != null && other.getAction() != null
                             && Action.equals(other.getAction()))
@@ -62,9 +102,41 @@ public class UIinfo
                             && description.equals(other.getDescription()));
   }
 
+  /**
+   * @return short description of what the service will do
+   */
+  public String getActionText()
+  {
+    return getAction() + " with " + getName();
+  }
+
   String Action;
 
   String Name;
 
   String description;
+
+  String hostURL;
+
+  public String getHostURL()
+  {
+    return hostURL;
+  }
+
+  public ParamDatastoreI getParamStore()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /**
+   * 
+   * @return true if the service has parameters (ie is instance of
+   *         jalview.ws.api.ServiceWithParameters)
+   */
+  public boolean hasParameters()
+  {
+    // TODO Auto-generated method stub
+    return false;
+  }
 }
\ No newline at end of file