row.add(s.replace("&", "&"));
row.add("<button onclick=\"if(confirm('Confirm unsubscribe consumer?')){window.location.href='unsubscribe.html?service=" + service + "&consumer=" + URL.encode(s) + "';}\">Unsubscribe</button>");
rows.add(row);
}
}
return new Page("<a href=\"services.html\">Services</a> > " + service
+ " > <a href=\"providers.html?service=" + service
+ "\">Providers</a> | Consumers | <a href=\"statistics.html?service=" + service
+ "\">Statistics</a> | <a href=\"charts.html?service=" + service
+ "\">Charts</a>", "Consumers (" + rows.size() + ")",
new String[] { "Consumer URL:", "Unsubscribe" }, rows);
} else if (host != null && host.length() > 0) {
List<List<String>> rows = new ArrayList<List<String>>();
List<URL> consumers = RegistryContainer.getInstance().getConsumersByHost(host);
if (consumers != null && consumers.size() > 0) {
for (URL u : consumers) {
List<String> row = new ArrayList<String>();
String s = u.toFullString();
row.add(s.replace("&", "&"));
row.add("<button onclick=\"if(confirm('Confirm unsubscribe consumer?')){window.location.href='unsubscribe.html?host=" + host + "&consumer=" + URL.encode(s) + "';}\">Unsubscribe</button>");
rows.add(row);
}
}
return new Page("<a href=\"hosts.html\">Hosts</a> > " + NetUtils.getHostName(host) + "/" + host + " > <a href=\"providers.html?host=" + host + "\">Providers</a> | Consumers", "Consumers (" + rows.size() + ")",
new String[] { "Consumer URL:", "Unsubscribe" }, rows);
} else if (application != null && application.length() > 0) {
List<List<String>> rows = new ArrayList<List<String>>();
List<URL> consumers = RegistryContainer.getInstance().getConsumersByApplication(application);
if (consumers != null && consumers.size() > 0) {
for (URL u : consumers) {
List<String> row = new ArrayList<String>();
String s = u.toFullString();
row.add(s.replace("&", "&"));
row.add("<button onclick=\"if(confirm('Confirm unsubscribe consumer?')){window.location.href='unsubscribe.html?application=" + application + "&consumer=" + URL.encode(s) + "';}\">Unsubscribe</button>");
rows.add(row);
}
}
return new Page("<a href=\"applications.html\">Applications</a> > " + application + " > <a href=\"providers.html?application=" + application + "\">Providers</a> | Consumers | <a href=\"dependencies.html?application=" + application + "\">Depends On</a> | <a href=\"dependencies.html?application=" + application + "&reverse=true\">Used By</a>", "Consumers (" + rows.size() + ")",
new String[] { "Consumer URL:", "Unsubscribe" }, rows);
} else {
throw new IllegalArgumentException("Please input service or host or application parameter.");
}
}