Search in sources :

Example 1 with ReleaseRepository

use of org.eclipse.sw360.datahandler.db.ReleaseRepository in project sw360portal by sw360.

the class ComponentSummary method makeExportSummary.

private Component makeExportSummary(Component document, List<Release> releases) {
    if (releaseRepository == null) {
        throw new IllegalStateException("Cannot make export summary without database connection!");
    }
    Component copy = new Component();
    copyField(document, copy, Component._Fields.ID);
    copyField(document, copy, Component._Fields.NAME);
    copyField(document, copy, Component._Fields.LANGUAGES);
    copyField(document, copy, Component._Fields.OPERATING_SYSTEMS);
    copyField(document, copy, Component._Fields.SOFTWARE_PLATFORMS);
    copyField(document, copy, Component._Fields.CREATED_BY);
    copyField(document, copy, Component._Fields.CREATED_ON);
    copyField(document, copy, Component._Fields.VENDOR_NAMES);
    for (Release release : releases) {
        Release exportRelease = new Release();
        copyField(release, exportRelease, Release._Fields.NAME);
        copyField(release, exportRelease, Release._Fields.VERSION);
        exportRelease.setComponentId("");
        copy.addToReleases(exportRelease);
    }
    return copy;
}
Also used : Component(org.eclipse.sw360.datahandler.thrift.components.Component) Release(org.eclipse.sw360.datahandler.thrift.components.Release)

Example 2 with ReleaseRepository

use of org.eclipse.sw360.datahandler.db.ReleaseRepository in project sw360portal by sw360.

the class LicenseDatabaseHandler method checkIfInUse.

public boolean checkIfInUse(String licenseId) {
    ReleaseRepository releaseRepository = new ReleaseRepository(db, new VendorRepository(db));
    final List<Release> usingReleases = releaseRepository.searchReleasesByUsingLicenseId(licenseId);
    return !usingReleases.isEmpty();
}
Also used : VendorRepository(org.eclipse.sw360.datahandler.db.VendorRepository) ReleaseRepository(org.eclipse.sw360.datahandler.db.ReleaseRepository) Release(org.eclipse.sw360.datahandler.thrift.components.Release)

Aggregations

Release (org.eclipse.sw360.datahandler.thrift.components.Release)2 ReleaseRepository (org.eclipse.sw360.datahandler.db.ReleaseRepository)1 VendorRepository (org.eclipse.sw360.datahandler.db.VendorRepository)1 Component (org.eclipse.sw360.datahandler.thrift.components.Component)1