use of org.eclipse.sw360.datahandler.thrift.components.Release._Fields in project sw360portal by sw360.
the class DisplayProjectChanges 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 (Project._Fields field : Project._Fields.values()) {
switch(field) {
// ignored Fields
case ID:
case REVISION:
case TYPE:
case CREATED_BY:
case CREATED_ON:
case PERMISSIONS:
case RELEASE_CLEARING_STATE_SUMMARY:
case DOCUMENT_STATE:
// Taken care of externally
case ATTACHMENTS:
// Done in extra tables
case LINKED_PROJECTS:
case RELEASE_ID_TO_USAGE:
break;
default:
FieldMetaData fieldMetaData = Project.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 linkedProjectsDisplay = new StringBuilder();
User user = getUserFromContext("Cannot render project changes without logged in user in request");
renderLinkedProjects(linkedProjectsDisplay, user);
StringBuilder releaseUsageDisplay = new StringBuilder();
renderReleaseIdToUsage(releaseUsageDisplay, user);
jspWriter.print(renderString + linkedProjectsDisplay.toString() + releaseUsageDisplay.toString());
} catch (Exception e) {
throw new JspException(e);
}
return SKIP_BODY;
}
use of org.eclipse.sw360.datahandler.thrift.components.Release._Fields 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._Fields 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._Fields 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._Fields 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>";
}
Aggregations