Search in sources :

Example 1 with VulnerabilityWithReleaseRelations

use of org.eclipse.sw360.datahandler.thrift.vulnerabilities.VulnerabilityWithReleaseRelations in project sw360portal by sw360.

the class Sw360VulnerabilityService method getVulnerabilityWithReleaseRelationsByExternalId.

public Vulnerability getVulnerabilityWithReleaseRelationsByExternalId(String externalId, User sw360User) {
    try {
        VulnerabilityService.Iface sw360VulnerabilityClient = getThriftVulnerabilityClient();
        final VulnerabilityWithReleaseRelations vulWithRel = sw360VulnerabilityClient.getVulnerabilityWithReleaseRelationsByExternalId(externalId, sw360User);
        return vulWithRel.getVulnerability();
    } catch (TException e) {
        throw new RuntimeException(e);
    }
}
Also used : VulnerabilityWithReleaseRelations(org.eclipse.sw360.datahandler.thrift.vulnerabilities.VulnerabilityWithReleaseRelations) TException(org.apache.thrift.TException) VulnerabilityService(org.eclipse.sw360.datahandler.thrift.vulnerabilities.VulnerabilityService)

Example 2 with VulnerabilityWithReleaseRelations

use of org.eclipse.sw360.datahandler.thrift.vulnerabilities.VulnerabilityWithReleaseRelations in project sw360portal by sw360.

the class VulnerabilitiesPortlet method prepareDetailView.

private void prepareDetailView(RenderRequest request, RenderResponse response) throws IOException, PortletException {
    User user = UserCacheHolder.getUserFromRequest(request);
    String externalId = request.getParameter(VULNERABILITY_ID);
    if (externalId != null) {
        try {
            VulnerabilityService.Iface client = thriftClients.makeVulnerabilityClient();
            VulnerabilityWithReleaseRelations vulnerabilityWithReleaseRelations = client.getVulnerabilityWithReleaseRelationsByExternalId(externalId, user);
            if (vulnerabilityWithReleaseRelations != null) {
                Vulnerability vulnerability = vulnerabilityWithReleaseRelations.getVulnerability();
                List<Release> releases = getReleasesFromRelations(user, vulnerabilityWithReleaseRelations);
                request.setAttribute(VULNERABILITY, vulnerability);
                request.setAttribute(DOCUMENT_ID, externalId);
                request.setAttribute(USING_RELEASES, releases);
                addVulnerabilityBreadcrumb(request, response, vulnerability);
            }
        } catch (TException e) {
            log.error("Error fetching vulnerability from backend!", e);
        }
    }
}
Also used : VulnerabilityWithReleaseRelations(org.eclipse.sw360.datahandler.thrift.vulnerabilities.VulnerabilityWithReleaseRelations) TException(org.apache.thrift.TException) User(org.eclipse.sw360.datahandler.thrift.users.User) VulnerabilityService(org.eclipse.sw360.datahandler.thrift.vulnerabilities.VulnerabilityService) Vulnerability(org.eclipse.sw360.datahandler.thrift.vulnerabilities.Vulnerability) Release(org.eclipse.sw360.datahandler.thrift.components.Release)

Aggregations

TException (org.apache.thrift.TException)2 VulnerabilityService (org.eclipse.sw360.datahandler.thrift.vulnerabilities.VulnerabilityService)2 VulnerabilityWithReleaseRelations (org.eclipse.sw360.datahandler.thrift.vulnerabilities.VulnerabilityWithReleaseRelations)2 Release (org.eclipse.sw360.datahandler.thrift.components.Release)1 User (org.eclipse.sw360.datahandler.thrift.users.User)1 Vulnerability (org.eclipse.sw360.datahandler.thrift.vulnerabilities.Vulnerability)1