nonselectedUrls = parseUrlStrings(storedUrlList);
} catch (Exception ex)
{
- System.out.println(ex + "\nError parsing sequence links");
+ System.out
+ .println(ex.getMessage() + "\nError parsing sequence links");
}
}
nonselectedUrls = parseUrlList(storedUrlList);
} catch (Exception ex)
{
- System.out.println(ex + "\nError parsing sequence links");
+ System.out
+ .println(ex.getMessage() + "\nError parsing sequence links");
}
}
private HashMap<String, UrlLink> parseUrlList(Map<String, String> urlList)
{
HashMap<String, UrlLink> urls = new HashMap<String, UrlLink>();
+ if (urlList == null)
+ {
+ return urls;
+ }
+
Iterator<Map.Entry<String, String>> it = urlList.entrySet().iterator();
while (it.hasNext())
{
@Override
public boolean setDefaultUrl(String id)
{
- /*if (id == null)
- {
- defaultUrl = null;
- }*/
if (selectedUrls.containsKey(id))
{
defaultUrl = id;
public String chooseDefaultUrl()
{
// unilaterally set the default id to the EMBL_EBI link
-
- if (nonselectedUrls.containsKey(UrlConstants.DEFAULT_LABEL))
- {
- // default key must be selected so remove from nonselected list
- nonselectedUrls.remove(UrlConstants.DEFAULT_LABEL);
- }
-
- if (!selectedUrls.containsKey(UrlConstants.DEFAULT_LABEL))
+ if ((!nonselectedUrls.containsKey(UrlConstants.DEFAULT_LABEL))
+ && (!selectedUrls.containsKey(UrlConstants.DEFAULT_LABEL)))
{
selectedUrls.put(UrlConstants.DEFAULT_LABEL, new UrlLink(
UrlConstants.DEFAULT_STRING));
return UrlConstants.DEFAULT_LABEL;
}
+ @Override
+ public boolean contains(String id)
+ {
+ return (selectedUrls.containsKey(id) || nonselectedUrls.containsKey(id));
+ }
+
}