use of org.eclipse.sw360.datahandler.thrift.ThriftClients in project sw360portal by sw360.
the class DisplayVendorEdit method doStartTag.
public int doStartTag() throws JspException {
JspWriter jspWriter = pageContext.getOut();
namespace = getNamespace();
StringBuilder display = new StringBuilder();
try {
if (vendor == null && !Strings.isNullOrEmpty(vendorId)) {
VendorService.Iface client;
try {
client = new ThriftClients().makeVendorClient();
vendor = client.getByID(vendorId);
} catch (TException ignored) {
}
}
if (vendor != null) {
printFullVendor(display, vendor);
} else {
printEmptyVendor(display);
}
jspWriter.print(display.toString());
} catch (Exception e) {
throw new JspException(e);
}
return SKIP_BODY;
}
use of org.eclipse.sw360.datahandler.thrift.ThriftClients in project sw360portal by sw360.
the class LinkedReleaseRenderer method renderReleaseLinkListCompare.
public <T> void renderReleaseLinkListCompare(StringBuilder display, Map<String, T> oldReleaseRelationshipMap, Map<String, T> deleteReleaseRelationshipMap, Map<String, T> updateReleaseRelationshipMap, Set<String> releaseIds) {
if (releaseIds.isEmpty())
return;
StringBuilder candidate = new StringBuilder();
try {
ComponentService.Iface componentClient = new ThriftClients().makeComponentClient();
final HashSet<String> changedIds = new HashSet<>();
for (String releaseId : releaseIds) {
T oldReleaseRelationship = oldReleaseRelationshipMap.get(releaseId);
T updateReleaseRelationship = updateReleaseRelationshipMap.get(releaseId);
if (!oldReleaseRelationship.equals(updateReleaseRelationship)) {
changedIds.add(releaseId);
}
}
for (Release release : componentClient.getReleasesById(changedIds, user)) {
String releaseId = release.getId();
T oldReleaseRelationship = oldReleaseRelationshipMap.get(releaseId);
T deleteReleaseRelationship = deleteReleaseRelationshipMap.get(releaseId);
T updateReleaseRelationship = updateReleaseRelationshipMap.get(releaseId);
candidate.append(String.format("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>", release.getName(), oldReleaseRelationship, deleteReleaseRelationship, updateReleaseRelationship));
}
} catch (TException ignored) {
}
String tableContent = candidate.toString();
if (!tableContent.isEmpty()) {
display.append(String.format("<table class=\"%s\" id=\"%sUpdated\" >", tableClasses, idPrefix));
display.append("<thead><tr><th colspan=\"4\">Updated Release Links</th></tr><tr><th>Release name</th><th>Current Release relationship</th><th>Deleted Release relationship</th><th>Suggested release relationship</th></tr></thead><tbody>");
display.append(tableContent);
display.append("</tbody></table>");
}
}
Aggregations