Example usage for org.aspectj.lang ProceedingJoinPoint proceed

List of usage examples for org.aspectj.lang ProceedingJoinPoint proceed

Introduction

In this page you can find the example usage for org.aspectj.lang ProceedingJoinPoint proceed.

Prototype

public Object proceed() throws Throwable;

Source Link

Document

Proceed with the next advice or target method invocation

Usage

From source file:com.denimgroup.threadfix.service.eventmodel.aspect.DefectEventTrackingAspect.java

License:Mozilla Public License

public Object emitUploadApplicationScanEvent(ProceedingJoinPoint joinPoint, boolean multipleScans)
        throws Throwable {
    Object proceed = joinPoint.proceed();
    try {/*from  w  ww.  j  ava  2 s .  c om*/
        List<Scan> scans;
        if (multipleScans) {
            scans = (List<Scan>) proceed;
        } else {
            scans = list();
            scans.add((Scan) proceed);
        }
        for (Scan scan : scans) {
            Set<Finding> findings = new HashSet<Finding>();
            findings.addAll(scan.getFindings());
            List<ScanRepeatFindingMap> scanRepeatFindingMaps = scan.getScanRepeatFindingMaps();
            if (scanRepeatFindingMaps != null) {
                for (ScanRepeatFindingMap scanRepeatFindingMap : scanRepeatFindingMaps) {
                    findings.add(scanRepeatFindingMap.getFinding());
                }
            }

            for (Finding finding : findings) {
                Vulnerability vulnerability = finding.getVulnerability();
                if (vulnerability != null) {
                    Defect defect = vulnerability.getDefect();
                    if ((defect != null) && (defect.isClosed())) {
                        Event event = generateDefectAppearedAfterClosedEvent(defect, scan, vulnerability);
                        publishEventTrackingEvent(event);
                    }
                }
            }
        }
    } catch (Exception e) {
        log.error("Error while logging Event: " + EventAction.DEFECT_APPEARED_AFTER_CLOSED
                + ", logging to database (visible under Error Messages)");
        exceptionLogService.storeExceptionLog(new ExceptionLog(e));
    }
    return proceed;
}

From source file:com.denimgroup.threadfix.service.eventmodel.aspect.DefectTrackerFormPopulationAspect.java

License:Mozilla Public License

@Around("execution(* com.denimgroup.threadfix.service.DefectTrackerService.getProjectMetadata(..))")
public Object emitEvent(ProceedingJoinPoint joinPoint) throws Throwable {
    LOG.debug("Emitting getProjectMetadata event.");

    ProjectMetadataSource metadataSource = (ProjectMetadataSource) joinPoint.getArgs()[0];

    AbstractDefectTracker tracker = null;

    if (metadataSource instanceof AbstractDefectTracker) {
        tracker = (AbstractDefectTracker) metadataSource;
        LOG.debug("Got AbstractDefectTracker from metadataSource");
    } else {/*w w  w.j  a v  a 2 s  .c om*/
        LOG.error("MetadataSource wasn't an AbstractDefectTracker. This shouldn't happen.");
        assert false : "Shouldn't be here, fix your code";
    }

    Object proceed = joinPoint.proceed();
    eventPublisher.publishEvent(new DefectTrackerProjectMetadataEvent(tracker, (ProjectMetadata) proceed));
    return proceed;
}

From source file:com.denimgroup.threadfix.service.eventmodel.aspect.PolicyEventTrackingAspect.java

License:Mozilla Public License

@Around("execution(* com.denimgroup.threadfix.service.PolicyStatusService.runStatusCheck(..)) && args(policy)")
public Object emitPolicyStatusCheckEvents(ProceedingJoinPoint joinPoint, Policy policy) throws Throwable {
    Object proceed = joinPoint.proceed();
    try {/*from w  ww  .j ava  2  s  . com*/
        List<PolicyStatus> policyStatuses = policy.getPolicyStatuses();
        emitPolicyStatusCheckEvents(policyStatuses);
    } catch (Exception e) {
        log.error(
                "Error while logging Policy Status Check Events, logging to database (visible under Error Messages)");
        exceptionLogService.storeExceptionLog(new ExceptionLog(e));
    }
    return proceed;
}

From source file:com.denimgroup.threadfix.service.eventmodel.aspect.PolicyEventTrackingAspect.java

License:Mozilla Public License

@Around("execution(* com.denimgroup.threadfix.service.PolicyStatusService.runStatusCheck(..)) && args(applicationId)")
public Object emitPolicyStatusCheckEvents(ProceedingJoinPoint joinPoint, int applicationId) throws Throwable {
    Object proceed = joinPoint.proceed();
    try {/*from   ww  w  .  j  a v  a  2 s. c om*/
        Application application = applicationService.loadApplication(applicationId);
        if (application != null) {
            List<PolicyStatus> policyStatuses = application.getPolicyStatuses();
            emitPolicyStatusCheckEvents(policyStatuses);
        }
    } catch (Exception e) {
        log.error(
                "Error while logging Policy Status Check Events, logging to database (visible under Error Messages)");
        exceptionLogService.storeExceptionLog(new ExceptionLog(e));
    }
    return proceed;
}

From source file:com.denimgroup.threadfix.service.eventmodel.aspect.PolicyEventTrackingAspect.java

License:Mozilla Public License

@Around("execution(* com.denimgroup.threadfix.service.PolicyStatusService.addStatus(..)) && args(policy, application)")
public Object emitPolicyAddStatusEvent(ProceedingJoinPoint joinPoint, Policy policy, Application application)
        throws Throwable {
    Object proceed = joinPoint.proceed();
    try {/*from w w  w.  j a v a2 s.com*/
        List<PolicyStatus> policyStatuses = policy.getPolicyStatuses();
        for (PolicyStatus policyStatus : policyStatuses) {
            if ((policyStatus.getApplication() != null)
                    && (policyStatus.getApplication().getId() == application.getId())) {
                emitPolicyStatusUpdateEvent(policyStatus);
            }
        }
    } catch (Exception e) {
        log.error(
                "Error while logging Policy Status Check Events, logging to database (visible under Error Messages)");
        exceptionLogService.storeExceptionLog(new ExceptionLog(e));
    }
    return proceed;
}

From source file:com.denimgroup.threadfix.service.eventmodel.aspect.PolicyEventTrackingAspect.java

License:Mozilla Public License

@Around("execution(* com.denimgroup.threadfix.data.dao.PolicyDao.delete(..)) && args(policy)")
public void updateEventForPolicyDeletion(ProceedingJoinPoint joinPoint, Policy policy) throws Throwable {
    List<Event> eventList = eventService.loadAllByPolicy(policy);

    for (Event event : eventList) {
        event.setPolicy(null);/*from ww w .j a  v a  2 s  . c o  m*/
        eventService.saveOrUpdate(event);
    }
    joinPoint.proceed();
}

From source file:com.denimgroup.threadfix.service.eventmodel.aspect.PolicyEventTrackingAspect.java

License:Mozilla Public License

@Around("execution(* com.denimgroup.threadfix.data.dao.PolicyStatusDao.delete(..)) && args(policyStatus)")
public void updateEventForPolicyStatusDeletion(ProceedingJoinPoint joinPoint, PolicyStatus policyStatus)
        throws Throwable {
    List<Event> eventList = eventService.loadAllByPolicyStatus(policyStatus);

    for (Event event : eventList) {
        event.setPolicyStatus(null);/*  www  . ja  v a  2s . c  o m*/
        eventService.saveOrUpdate(event);
    }
    joinPoint.proceed();
}

From source file:com.denimgroup.threadfix.service.eventmodel.aspect.VulnerabilityEventTrackingAspect.java

License:Mozilla Public License

protected Object emitStoreVulnerabilityEvent(ProceedingJoinPoint joinPoint, Vulnerability vulnerability,
        EventAction eventAction, Scan scan, Finding finding) throws Throwable {
    Object proceed = joinPoint.proceed();
    if (eventAction != null) {
        try {//  w  ww  .  j ava  2s.  c  o m
            Event event = generateStoreVulnerabilityEvent(vulnerability, eventAction, scan, finding);
            publishEventTrackingEvent(event);
        } catch (Exception e) {
            log.error("Error while logging Event: " + eventAction
                    + ", logging to database (visible under Error Messages)");
            exceptionLogService.storeExceptionLog(new ExceptionLog(e));
        }
    }
    return proceed;
}

From source file:com.denimgroup.threadfix.service.eventmodel.aspect.VulnerabilityEventTrackingAspect.java

License:Mozilla Public License

protected Object emitStoreVulnerabilitiesEvents(ProceedingJoinPoint joinPoint, List<Vulnerability> vulns,
        EventAction eventAction, Scan scan) throws Throwable {
    Object proceed = joinPoint.proceed();
    try {/*from  w  w  w . ja  va 2  s . co  m*/
        for (Vulnerability vulnerability : vulns) {
            Event event = generateStoreVulnerabilityEvent(vulnerability, eventAction, scan, null);
            publishEventTrackingEvent(event);
        }
    } catch (Exception e) {
        log.error("Error while logging Event: " + eventAction
                + ", logging to database (visible under Error Messages)");
        exceptionLogService.storeExceptionLog(new ExceptionLog(e));
    }
    return proceed;
}

From source file:com.denimgroup.threadfix.service.eventmodel.aspect.VulnerabilityEventTrackingAspect.java

License:Mozilla Public License

@Around("execution(* com.denimgroup.threadfix.service.VulnerabilityCommentService.addCommentToVuln(..)) && args(comment, vulnerabilityId)")
public Object emitVulnerabilityCommentEvent(ProceedingJoinPoint joinPoint, VulnerabilityComment comment,
        Integer vulnerabilityId) throws Throwable {
    Object proceed = joinPoint.proceed();
    try {//from  w w w.  j a  v a 2 s .c o  m
        if (proceed.equals(VulnerabilityCommentService.VALID)) {
            Event event = generateVulnerabilityCommentEvent(comment, vulnerabilityId);
            publishEventTrackingEvent(event);
        }
    } catch (Exception e) {
        log.error("Error while logging Event: " + EventAction.VULNERABILITY_COMMENT
                + ", logging to database (visible under Error Messages)");
        exceptionLogService.storeExceptionLog(new ExceptionLog(e));
    }
    return proceed;
}