Search in sources :

Example 6 with SummaryType

use of org.eclipse.sw360.components.summary.SummaryType in project sw360portal by sw360.

the class ReleaseSummary method summary.

protected Release summary(SummaryType type, Release document, Function<String, Vendor> vendorProvider) {
    Release copy = new Release();
    if (type == SummaryType.DETAILED_EXPORT_SUMMARY) {
        setDetailedExportSummaryFields(document, copy);
    } else {
        setShortSummaryFields(document, copy);
        if (type != SummaryType.SHORT) {
            setAdditionalFieldsForSummariesOtherThanShortAndDetailedExport(document, copy);
        }
    }
    if (document.isSetVendorId()) {
        final String vendorId = document.getVendorId();
        if (!Strings.isNullOrEmpty(vendorId)) {
            Vendor vendor = vendorProvider.apply(vendorId);
            copy.setVendor(vendor);
        }
    }
    return copy;
}
Also used : Vendor(org.eclipse.sw360.datahandler.thrift.vendors.Vendor) Release(org.eclipse.sw360.datahandler.thrift.components.Release)

Aggregations

Release (org.eclipse.sw360.datahandler.thrift.components.Release)3 Vendor (org.eclipse.sw360.datahandler.thrift.vendors.Vendor)2 Strings (com.google.common.base.Strings)1 ImmutableList (com.google.common.collect.ImmutableList)1 java.util (java.util)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 VendorRepository (org.eclipse.sw360.datahandler.db.VendorRepository)1 ThriftUtils (org.eclipse.sw360.datahandler.thrift.ThriftUtils)1 ThriftUtils.copyField (org.eclipse.sw360.datahandler.thrift.ThriftUtils.copyField)1 Component (org.eclipse.sw360.datahandler.thrift.components.Component)1 Release._Fields (org.eclipse.sw360.datahandler.thrift.components.Release._Fields)1 License (org.eclipse.sw360.datahandler.thrift.licenses.License)1 LicenseType (org.eclipse.sw360.datahandler.thrift.licenses.LicenseType)1 ModerationRequest (org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest)1 ReleaseExporter (org.eclipse.sw360.exporter.ReleaseExporter)1