use of org.eclipse.sw360.datahandler.thrift.components.Release in project sw360portal by sw360.
the class DisplayProjectChanges method renderReleaseIdToUsage.
private void renderReleaseIdToUsage(StringBuilder display, User user) {
if (ensureSomethingTodoAndNoNullReleaseIdUsage()) {
Set<String> changedReleaseIds = Sets.intersection(additions.getReleaseIdToUsage().keySet(), deletions.getReleaseIdToUsage().keySet());
changedReleaseIds = Sets.intersection(changedReleaseIds, // remove projects already deleted in database
actual.getReleaseIdToUsage().keySet());
Set<String> removedReleaseIds = Sets.difference(deletions.getReleaseIdToUsage().keySet(), changedReleaseIds);
removedReleaseIds = Sets.intersection(removedReleaseIds, actual.getReleaseIdToUsage().keySet());
Set<String> addedReleaseIds = Sets.difference(additions.getReleaseIdToUsage().keySet(), changedReleaseIds);
LinkedReleaseRenderer renderer = new LinkedReleaseRenderer(display, tableClasses, idPrefix, user);
renderer.renderReleaseLinkList(display, deletions.getReleaseIdToUsage(), removedReleaseIds, "Removed Release Links");
renderer.renderReleaseLinkList(display, additions.getReleaseIdToUsage(), addedReleaseIds, "Added Release Links");
renderer.renderReleaseLinkListCompare(display, actual.getReleaseIdToUsage(), deletions.getReleaseIdToUsage(), additions.getReleaseIdToUsage(), changedReleaseIds);
}
}
use of org.eclipse.sw360.datahandler.thrift.components.Release in project sw360portal by sw360.
the class DisplayReleaseChanges method doStartTag.
public int doStartTag() throws JspException {
JspWriter jspWriter = pageContext.getOut();
StringBuilder display = new StringBuilder();
String namespace = getNamespace();
if (additions == null || deletions == null) {
return SKIP_BODY;
}
try {
for (Release._Fields field : Release._Fields.values()) {
switch(field) {
// ignored Fields
case ID:
case REVISION:
case TYPE:
case CREATED_BY:
case CREATED_ON:
case PERMISSIONS:
case DOCUMENT_STATE:
case COMPONENT_ID:
case VENDOR_ID:
case CLEARING_TEAM_TO_FOSSOLOGY_STATUS:
// Taken care of externally or in extra tables
case ATTACHMENTS:
case RELEASE_ID_TO_RELATIONSHIP:
case CLEARING_INFORMATION:
case COTS_DETAILS:
case ECC_INFORMATION:
break;
default:
FieldMetaData fieldMetaData = Release.metaDataMap.get(field);
displaySimpleFieldOrSet(display, actual, additions, deletions, field, fieldMetaData, "");
}
}
String renderString = display.toString();
if (Strings.isNullOrEmpty(renderString)) {
renderString = "<h4> No changes in basic fields </h4>";
} else {
renderString = String.format("<table class=\"%s\" id=\"%schanges\" >", tableClasses, idPrefix) + "<thead><tr><th colspan=\"4\"> Changes for Basic fields</th></tr>" + String.format("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr></thead><tbody>", FIELD_NAME, CURRENT_VAL, DELETED_VAL, SUGGESTED_VAL) + renderString + "</tbody></table>";
}
StringBuilder releaseRelationshipDisplay = new StringBuilder();
User user = getUserFromContext("Cannot render release changes without logged in user in request");
renderReleaseIdToRelationship(releaseRelationshipDisplay, user);
String clearingInformationDisplay = renderClearingInformation();
String eccInformationDisplay = renderEccInformation();
String cotsDetailDisplay = renderCOTSDetails();
jspWriter.print(renderString + releaseRelationshipDisplay.toString() + clearingInformationDisplay + eccInformationDisplay + cotsDetailDisplay);
} catch (Exception e) {
throw new JspException(e);
}
return SKIP_BODY;
}
use of org.eclipse.sw360.datahandler.thrift.components.Release in project sw360portal by sw360.
the class DisplayReleaseChanges method renderCOTSDetails.
private String renderCOTSDetails() {
if (!ensureSomethingTodoAndNoNull(Release._Fields.COTS_DETAILS)) {
return "";
}
StringBuilder display = new StringBuilder();
if (!actual.isSet(Release._Fields.COTS_DETAILS)) {
actual.cotsDetails = new COTSDetails();
}
for (COTSDetails._Fields field : COTSDetails._Fields.values()) {
FieldMetaData fieldMetaData = COTSDetails.metaDataMap.get(field);
displaySimpleFieldOrSet(display, actual.getCotsDetails(), additions.getCotsDetails(), deletions.getCotsDetails(), field, fieldMetaData, "");
}
return "<h3> Changes in COTS Details </h3>" + String.format("<table class=\"%s\" id=\"%schanges\" >", tableClasses, idPrefix) + String.format("<thead><tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr></thead><tbody>", FIELD_NAME, CURRENT_VAL, DELETED_VAL, SUGGESTED_VAL) + display.toString() + "</tbody></table>";
}
use of org.eclipse.sw360.datahandler.thrift.components.Release in project sw360portal by sw360.
the class DisplayReleaseChanges method renderClearingInformation.
private String renderClearingInformation() {
if (!ensureSomethingTodoAndNoNull(Release._Fields.CLEARING_INFORMATION)) {
return "";
}
StringBuilder display = new StringBuilder();
if (!actual.isSet(Release._Fields.CLEARING_INFORMATION)) {
actual.clearingInformation = new ClearingInformation();
}
for (ClearingInformation._Fields field : ClearingInformation._Fields.values()) {
FieldMetaData fieldMetaData = ClearingInformation.metaDataMap.get(field);
displaySimpleFieldOrSet(display, actual.getClearingInformation(), additions.getClearingInformation(), deletions.getClearingInformation(), field, fieldMetaData, "");
}
return "<h3> Changes in Clearing Information </h3>" + String.format("<table class=\"%s\" id=\"%schanges\" >", tableClasses, idPrefix) + String.format("<thead><tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr></thead><tbody>", FIELD_NAME, CURRENT_VAL, DELETED_VAL, SUGGESTED_VAL) + display.toString() + "</tbody></table>";
}
use of org.eclipse.sw360.datahandler.thrift.components.Release in project sw360portal by sw360.
the class LinkedReleaseRenderer method renderReleaseLinkList.
public <T> void renderReleaseLinkList(StringBuilder display, Map<String, T> releaseRelationshipMap, Set<String> releaseIds, String msg) {
if (releaseIds.isEmpty())
return;
StringBuilder candidate = new StringBuilder();
try {
ComponentService.Iface componentClient = new ThriftClients().makeComponentClient();
for (Release release : componentClient.getReleasesById(releaseIds, user)) {
candidate.append(String.format("<tr><td>%s</td><td>%s</td></tr>", release.getName(), releaseRelationshipMap.get(release.getId())));
}
} catch (TException ignored) {
}
String tableContent = candidate.toString();
if (!tableContent.isEmpty()) {
display.append(String.format("<table class=\"%s\" id=\"%s%s\" >", tableClasses, idPrefix, msg));
display.append(String.format("<thead><tr><th colspan=\"2\">%s</th></tr><tr><th>Release name</th><th>Release relationship</th></tr></thead><tbody>", msg));
display.append(tableContent);
display.append("</tbody></table>");
}
}
Aggregations