\r
package compbio.metadata;\r
\r
+import java.net.MalformedURLException;\r
import java.net.URL;\r
import java.util.ArrayList;\r
import java.util.HashSet;\r
import javax.xml.bind.annotation.XmlAccessorType;\r
import javax.xml.bind.annotation.XmlAttribute;\r
import javax.xml.bind.annotation.XmlElement;\r
+import javax.xml.bind.annotation.XmlTransient;\r
\r
import compbio.util.SysPrefs;\r
import compbio.util.Util;\r
@XmlAttribute\r
protected boolean isRequired;\r
@XmlElement\r
- protected URL furtherDetails;\r
+ protected String furtherDetails;\r
@XmlElement\r
protected String defaultValue;\r
+ @XmlTransient\r
+ private URL basicURL;\r
\r
Option() {\r
// Has to have no arg constructor for JAXB\r
}\r
\r
- public Option(String name, String description) {\r
+ public Option(String name, String description) throws MalformedURLException {\r
this.name = name;\r
this.description = description;\r
}\r
this.name = name;\r
}\r
\r
+ public void setBasicURL(URL url) {\r
+ this.basicURL = url;\r
+ }\r
+ public URL getBasicURL() throws MalformedURLException {\r
+ URL out = new URL ("http://unknown.jabaws.server.ac.uk");\r
+ if (null != basicURL) {\r
+ out = basicURL;\r
+ }\r
+ return out;\r
+ } \r
/**\r
* A long description of the Option\r
*/\r
\r
/**\r
* The URL where further details about the option can be found\r
+ * @throws MalformedURLException \r
*/\r
- public URL getFurtherDetails() {\r
+ public String getFurtherDetails() {\r
return furtherDetails;\r
}\r
\r
- public void setFurtherDetails(URL furtherDetails) {\r
+ public void setFurtherDetails(String furtherDetails) {\r
this.furtherDetails = furtherDetails;\r
}\r
\r
String value = "Option name: " + this.name + SysPrefs.newlinechar;\r
value += "Description: " + this.description + SysPrefs.newlinechar;\r
if (!Util.isEmpty(defaultValue)) {\r
- value += "Default value: " + this.defaultValue\r
- + SysPrefs.newlinechar;\r
+ value += "Default value: " + this.defaultValue + SysPrefs.newlinechar;\r
+ }\r
+ if (null != this.furtherDetails) {\r
+ value += "URL: " + this.basicURL + this.furtherDetails + SysPrefs.newlinechar;\r
+ } else {\r
+ value += "URL: unknown URL" + SysPrefs.newlinechar;\r
}\r
- value += "URL: " + this.furtherDetails + SysPrefs.newlinechar;\r
value += "Is required: " + this.isRequired + SysPrefs.newlinechar;\r
if (!this.optionNames.isEmpty()) {\r
Set<String> sortedPosval = new TreeSet<String>(this.optionNames);\r
- value += "Option Names: " + SysPrefs.newlinechar;\r
+ value += "Option(s): ";\r
+ String delim = "";\r
for (String val : sortedPosval) {\r
- value += val + SysPrefs.newlinechar;\r
+ value += delim + val;\r
+ delim = ", ";\r
}\r
+ value += SysPrefs.newlinechar;\r
}\r
return value;\r
}\r