use of org.eclipse.sw360.components.summary.SummaryType in project sw360portal by sw360.
the class LicenseTypeSummary method summary.
@Override
protected LicenseType summary(SummaryType type, LicenseType document) {
// Copy required details
LicenseType copy = new LicenseType();
switch(type) {
case EXPORT_SUMMARY:
copyField(document, copy, _Fields.LICENSE_TYPE);
copyField(document, copy, _Fields.LICENSE_TYPE_ID);
copyField(document, copy, _Fields.ID);
default:
}
return copy;
}
use of org.eclipse.sw360.components.summary.SummaryType in project sw360portal by sw360.
the class ModerationRequestSummary method summary.
@Override
protected ModerationRequest summary(SummaryType type, ModerationRequest document) {
ModerationRequest copy = new ModerationRequest();
copyField(document, copy, ModerationRequest._Fields.ID);
copyField(document, copy, ModerationRequest._Fields.DOCUMENT_ID);
copyField(document, copy, ModerationRequest._Fields.DOCUMENT_TYPE);
copyField(document, copy, ModerationRequest._Fields.DOCUMENT_NAME);
copyField(document, copy, ModerationRequest._Fields.MODERATION_STATE);
copyField(document, copy, ModerationRequest._Fields.REQUESTING_USER);
copyField(document, copy, ModerationRequest._Fields.MODERATORS);
copyField(document, copy, ModerationRequest._Fields.TIMESTAMP);
copyField(document, copy, ModerationRequest._Fields.TIMESTAMP_OF_DECISION);
copyField(document, copy, ModerationRequest._Fields.REQUESTING_USER_DEPARTMENT);
copyField(document, copy, ModerationRequest._Fields.COMPONENT_TYPE);
return copy;
}
use of org.eclipse.sw360.components.summary.SummaryType in project sw360portal by sw360.
the class ComponentSummary method summary.
@Override
protected Component summary(SummaryType type, Component document) {
Component copy = new Component();
if (type == SummaryType.EXPORT_SUMMARY) {
List<Release> releases = releaseRepository.getReleasesFromComponentId(document.getId());
return makeExportSummary(document, releases);
} else if (type == SummaryType.DETAILED_EXPORT_SUMMARY) {
List<Release> releases = releaseRepository.getReleasesFromComponentId(document.getId());
final Map<String, Vendor> vendorsById = ThriftUtils.getIdMap(vendorRepository.getAll());
for (Release release : releases) {
if (!release.isSetVendor() && release.isSetVendorId()) {
release.setVendor(vendorsById.get(release.getVendorId()));
}
}
return makeDetailedExportSummary(document, releases);
} else if (type == SummaryType.HOME) {
copyField(document, copy, Component._Fields.ID);
copyField(document, copy, Component._Fields.DESCRIPTION);
}
copyField(document, copy, Component._Fields.ID);
copyField(document, copy, Component._Fields.NAME);
copyField(document, copy, Component._Fields.VENDOR_NAMES);
copyField(document, copy, Component._Fields.COMPONENT_TYPE);
if (type == SummaryType.SUMMARY) {
for (Component._Fields field : Component.metaDataMap.keySet()) {
copyField(document, copy, field);
}
}
return copy;
}
use of org.eclipse.sw360.components.summary.SummaryType in project sw360portal by sw360.
the class LicenseSummary method summary.
@Override
protected License summary(SummaryType type, License document) {
// Copy required details
License copy = new License();
switch(type) {
case EXPORT_SUMMARY:
copyField(document, copy, _Fields.GPLV2_COMPAT);
copyField(document, copy, _Fields.REVIEWDATE);
copyField(document, copy, _Fields.RISKS);
case SUMMARY:
copyField(document, copy, _Fields.LICENSE_TYPE);
default:
copyField(document, copy, _Fields.ID);
copy.setShortname(document.getId());
copyField(document, copy, _Fields.FULLNAME);
copyField(document, copy, _Fields.LICENSE_TYPE_DATABASE_ID);
}
return copy;
}
use of org.eclipse.sw360.components.summary.SummaryType in project sw360portal by sw360.
the class ReleaseSummary method makeSummary.
@Override
public List<Release> makeSummary(SummaryType type, Collection<Release> fullDocuments) {
if (fullDocuments == null)
return Collections.emptyList();
Set<String> vendorIds = fullDocuments.stream().map(Release::getVendorId).filter(Objects::nonNull).filter(s -> !s.isEmpty()).collect(Collectors.toSet());
Map<String, Vendor> vendorById = ThriftUtils.getIdMap(vendorRepository.get(vendorIds));
List<Release> documents = new ArrayList<>(fullDocuments.size());
for (Release fullDocument : fullDocuments) {
Release document = summary(type, fullDocument, vendorById::get);
if (document != null)
documents.add(document);
}
return documents;
}
Aggregations