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