JAL-3070 web service handle with UIinfo.hasParameters() == true => instanceof Service...
[jalview.git] / src / jalview / ws / api / UIinfo.java
1 package jalview.ws.api;
2
3 import jalview.ws.params.ParamDatastoreI;
4
5 /**
6  * Service UI Info { Action, Specific Name of Service, Brief Description }
7  */
8
9 public class UIinfo
10 {
11   private String ServiceType;
12
13   public UIinfo(String serviceType, String action, String name,
14           String description, String hosturl)
15   {
16     this.setServiceType(serviceType == null ? "" : serviceType);
17     this.Action = action == null ? "" : action;
18     this.description = description == null ? "" : description;
19     this.Name = name == null ? "" : name;
20     this.hostURL = hosturl;
21   }
22
23   /**
24    * The type of analysis the service performs
25    */
26   public String getServiceType()
27   {
28     return ServiceType;
29   }
30
31   public void setServiceType(String serviceType)
32   {
33     ServiceType = serviceType;
34   }
35
36   /**
37    * The action when the service performs the analysis
38    */
39   public String getAction()
40   {
41     return Action;
42   }
43
44   public void setAction(String action)
45   {
46     Action = action;
47   }
48
49   /**
50    * name shown to user
51    * 
52    * @return
53    */
54   public String getName()
55   {
56     return Name;
57   }
58
59   public void setName(String name)
60   {
61     Name = name;
62   }
63
64   /**
65    * Detailed description (may include references, URLs, html,etc)
66    * 
67    * @return
68    */
69   public String getDescription()
70   {
71     return description;
72   }
73
74   public void setDescription(String description)
75   {
76     this.description = description;
77   }
78
79   @Override
80   public boolean equals(Object object)
81   {
82     if (object == null || !(object instanceof UIinfo))
83     {
84       return false;
85     }
86     UIinfo other = (UIinfo) object;
87
88     return (ServiceType == null && other.getServiceType() == null
89             || ServiceType != null && other.getServiceType() != null
90                     && ServiceType.equals(other.getServiceType()))
91             && (hostURL == null && other.getHostURL() == null
92                     || hostURL != null && other.getHostURL() != null
93                             && hostURL.equals(other.getHostURL()))
94             && (Name == null && other.getName() == null
95                     || Name != null && other.getName() != null
96                             && Name.equals(other.getName()))
97             && (Action == null && other.getAction() == null
98                     || Action != null && other.getAction() != null
99                             && Action.equals(other.getAction()))
100             && (description == null && other.getDescription() == null
101                     || description != null && other.getDescription() != null
102                             && description.equals(other.getDescription()));
103   }
104
105   /**
106    * @return short description of what the service will do
107    */
108   public String getActionText()
109   {
110     return getAction() + " with " + getName();
111   }
112
113   String Action;
114
115   String Name;
116
117   String description;
118
119   String hostURL;
120
121   public String getHostURL()
122   {
123     return hostURL;
124   }
125
126   public ParamDatastoreI getParamStore()
127   {
128     // TODO Auto-generated method stub
129     return null;
130   }
131
132   /**
133    * 
134    * @return true if the service has parameters (ie is instance of
135    *         jalview.ws.api.ServiceWithParameters)
136    */
137   public boolean hasParameters()
138   {
139     // TODO Auto-generated method stub
140     return false;
141   }
142 }