{
Map.Entry<String, String> pair = it.next();
urls.put(pair.getKey(),
- new UrlLink(pair.getKey(), pair.getValue(),
- pair.getKey()));
+ new UrlLink(pair.getKey(), pair.getValue(), pair.getKey()));
}
upgradeOldLinks(urls);
return urls;
*/
private void upgradeOldLinks(HashMap<String, UrlLink> urls)
{
+ boolean upgrade = false;
// upgrade old SRS link
if (urls.containsKey(SRS_LABEL))
{
urls.remove(SRS_LABEL);
+ upgrade = true;
+ }
+ // upgrade old EBI link - easier just to remove and re-add than faffing
+ // around checking exact url
+ if (urls.containsKey(UrlConstants.DEFAULT_LABEL))
+ {
+ // note because this is called separately for selected and nonselected
+ // urls, the default url will not always be present
+ urls.remove(UrlConstants.DEFAULT_LABEL);
+ upgrade = true;
+ }
+ if (upgrade)
+ {
UrlLink link = new UrlLink(UrlConstants.DEFAULT_STRING);
link.setLabel(UrlConstants.DEFAULT_LABEL);
urls.put(UrlConstants.DEFAULT_LABEL, link);
}
if (link.getIsSelected())
{
- selurls.put(link.getId(),
- new UrlLink(link.getDescription(), link.getUrl(), link.getDescription()));
+ selurls.put(link.getId(), new UrlLink(link.getDescription(),
+ link.getUrl(), link.getDescription()));
}
else
{
- unselurls
- .put(link.getId(),
- new UrlLink(link.getDescription(), link.getUrl(), link
- .getDescription()));
+ unselurls.put(link.getId(), new UrlLink(link.getDescription(),
+ link.getUrl(), link.getDescription()));
}
// sort out primary and selected ids
if (link.getIsPrimary())
@Override
public boolean contains(String id)
{
- return (selectedUrls.containsKey(id) || nonselectedUrls.containsKey(id));
+ return (selectedUrls.containsKey(id)
+ || nonselectedUrls.containsKey(id));
}
}