return URLUtil.getURLContent(getBioPortalSearchUrl(entityName, bpSearchData));
}
public String getBioPortalSearchContentDetails(String projectName, BioPortalSearchData bpSearchData,
BioPortalReferenceData bpRefData) {
BioportalConcept bpc = new BioportalConcept();
String encodedConceptId = bpRefData.getConceptId();
try {
encodedConceptId = URLEncoder.encode(bpRefData.getConceptId(), "UTF-8");
} catch (UnsupportedEncodingException e1) {
Log.getLogger().log(Level.WARNING, "Error at encoding BP search url", e1);
}
String urlString = bpSearchData.getBpRestBaseUrl() + BioPortalServerConstants.CONCEPTS_REST + "/"
+ bpRefData.getOntologyVersionId() + "/?conceptid=" + encodedConceptId;
urlString = BioPortalUtil.addRestCallSuffixToUrl(urlString, bpSearchData.getBpRestCallSuffix());
URL url = null;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
Log.getLogger().log(Level.WARNING, "Invalid BP search URL: " + urlString, e);
}
if (url == null) {
return "";
}
StringBuffer buffer = new StringBuffer();
buffer.append("<html><body>");
buffer.append("<table width=\"100%\" class=\"servicesT\" style=\"border-collapse:collapse;border-width:0px;padding:5px\"><tr>");
buffer.append("<td class=\"servHd\" style=\"background-color:#8E798D;color:#FFFFFF;\">Property</td>");
buffer.append("<td class=\"servHd\" style=\"background-color:#8E798D;color:#FFFFFF;\">Value</td>");
String oddColor = "#F4F2F3";
String evenColor = "#E6E6E5";
ClassBean cb = bpc.getConceptProperties(url);
if (cb == null) {
return "<html><body><i>Details could not be retrieved.</i></body></html>";
}
Map<Object, Object> relationsMap = cb.getRelations();