List of usage examples for org.aspectj.lang ProceedingJoinPoint proceed
public Object proceed() throws Throwable;
From source file:com.dcits.govsbu.southernbase.baseproject2.helper.aop.AuthorityHelperAOP.java
License:Apache License
@Around("actionMethod()") public Object authorityAroundService(ProceedingJoinPoint joinpoint) throws Throwable { ModelAndView result = null;/* w ww. ja v a 2 s .co m*/ try { // ? begin // long start = System.currentTimeMillis(); // ????TOKEN Object[] args = joinpoint.getArgs(); if (args.length > 0 && authorityHelper.isAdmin((String) args[0])) { // ???? TOKEN/mainInfo // return joinpoint.proceed(); result = ((ModelAndView) joinpoint.proceed()).addObject("token", args[0]); } else { result = new ModelAndView(AdminUrl.loginPage); result.addObject("message", Messages.USER_NOT_ADMIN); } // long end = System.currentTimeMillis(); // System.out.println("end! performance took " + (end-start) + " milliseconds"); // ? end } catch (Throwable e) { // e.printStackTrace(); result = new ModelAndView(AdminUrl.loginPage); result.addObject("message", Messages.AOP_HAS_ERROR); } return result; }
From source file:com.denimgroup.threadfix.service.eventmodel.aspect.ApplicationEventTrackingAspect.java
License:Mozilla Public License
@Around("execution(* com.denimgroup.threadfix.service.ApplicationService.storeApplication(..)) && args(application, eventAction)") public Object emitStoreApplicationEvent(ProceedingJoinPoint joinPoint, Application application, EventAction eventAction) throws Throwable { Object proceed = joinPoint.proceed(); try {//from w w w . ja v a2 s. co m if ((eventAction == EventAction.APPLICATION_CREATE) || (eventAction == EventAction.APPLICATION_EDIT)) { Event event = generateStoreApplicationEvent(application, eventAction); 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.ApplicationEventTrackingAspect.java
License:Mozilla Public License
@Around("execution(* com.denimgroup.threadfix.service.ScanMergeService.saveRemoteScanAndRun(..)) && args(channelId, fileNames, originalFileNames)") public Object processSaveRemoteScanAndRunEvent(ProceedingJoinPoint joinPoint, Integer channelId, List<String> fileNames, List<String> originalFileNames) throws Throwable { Object proceed = joinPoint.proceed(); emitUploadApplicationScanEvent((Scan) proceed); return proceed; }
From source file:com.denimgroup.threadfix.service.eventmodel.aspect.ApplicationEventTrackingAspect.java
License:Mozilla Public License
@Around("execution(* com.denimgroup.threadfix.service.ScanMergeService.saveRemoteScansAndRun(..)) && args(channelIds, fileNames, originalNames)") public Object processSaveRemoteScansAndRunEvent(ProceedingJoinPoint joinPoint, List<Integer> channelIds, List<String> fileNames, List<String> originalNames) throws Throwable { Object proceed = joinPoint.proceed(); for (Scan scan : (List<Scan>) proceed) { emitUploadApplicationScanEvent(scan); }//from w w w. j a v a2 s. c o m return proceed; }
From source file:com.denimgroup.threadfix.service.eventmodel.aspect.ApplicationEventTrackingAspect.java
License:Mozilla Public License
@Around("execution(* com.denimgroup.threadfix.service.ScanMergeService.processRemoteScan(..)) && args(scan)") public Object processProcessRemoteScanEvent(ProceedingJoinPoint joinPoint, Scan scan) throws Throwable { Object proceed = joinPoint.proceed(); emitUploadApplicationScanEvent((Scan) proceed); return proceed; }
From source file:com.denimgroup.threadfix.service.eventmodel.aspect.ApplicationEventTrackingAspect.java
License:Mozilla Public License
@Around("execution(* com.denimgroup.threadfix.service.ScanMergeService.processScan(..)) && args(channelId, fileNames, originalFileNames, statusId, userName)") public Object processProcessScanEvent(ProceedingJoinPoint joinPoint, Integer channelId, List<String> fileNames, List<String> originalFileNames, Integer statusId, String userName) throws Throwable { Object proceed = joinPoint.proceed(); emitUploadApplicationScanEvent((Scan) proceed); return proceed; }
From source file:com.denimgroup.threadfix.service.eventmodel.aspect.ApplicationEventTrackingAspect.java
License:Mozilla Public License
@Around("execution(* com.denimgroup.threadfix.data.dao.hibernate.HibernateScanDao.deleteFindingsAndScan(com.denimgroup.threadfix.data.entities.Scan)) && args(scan)") public void updateEventForScanDeletionAndEmitDeleteApplicationScanEvent(ProceedingJoinPoint joinPoint, Scan scan) throws Throwable { Application application = scan.getApplication(); String eventDescription = eventService.buildDeleteScanString(scan); Integer scanId = scan.getId(); joinPoint.proceed(); try {/*from w w w. ja v a2 s.c o m*/ Event event = generateDeleteScanEvent(application, eventDescription, scanId); publishEventTrackingEvent(event); } catch (Exception e) { log.error("Error while logging Event: " + EventAction.APPLICATION_SCAN_DELETED + ", logging to database (visible under Error Messages)"); exceptionLogService.storeExceptionLog(new ExceptionLog(e)); } }
From source file:com.denimgroup.threadfix.service.eventmodel.aspect.CommentSubmissionAspect.java
License:Mozilla Public License
@Around("execution(* com.denimgroup.threadfix.service.VulnerabilityCommentService.addCommentToVuln(..))") public Object emitEvent(ProceedingJoinPoint joinPoint) throws Throwable { VulnerabilityComment comment = (VulnerabilityComment) joinPoint.getArgs()[0]; Integer vulnerabilityId = (Integer) joinPoint.getArgs()[1]; Object proceed = joinPoint.proceed(); eventPublisher.publishEvent(new CommentSubmissionEvent(comment, vulnerabilityId)); return proceed; }
From source file:com.denimgroup.threadfix.service.eventmodel.aspect.DefectEventTrackingAspect.java
License:Mozilla Public License
@Around("execution(* com.denimgroup.threadfix.service.DefectService.createDefect(..))") public Object emitSubmitDefectEvent(ProceedingJoinPoint joinPoint) throws Throwable { Object proceed = joinPoint.proceed(); try {/*w w w. j av a2 s .c o m*/ Map<String, Object> map = (Map<String, Object>) proceed; if (map.get(DefectService.DEFECT) instanceof Defect) { Defect newDefect = (Defect) map.get(DefectService.DEFECT); Event event = generateSubmitDefectEvent(newDefect); publishEventTrackingEvent(event); } } catch (Exception e) { log.error("Error while logging Event: " + EventAction.DEFECT_SUBMIT + ", logging to database (visible under Error Messages)"); exceptionLogService.storeExceptionLog(new ExceptionLog(e)); } return proceed; }
From source file:com.denimgroup.threadfix.service.eventmodel.aspect.DefectEventTrackingAspect.java
License:Mozilla Public License
@Around("execution(* com.denimgroup.threadfix.service.DefectService.updateVulnsFromDefectTracker(..)) && args(applicationId, userId)") public Object emitUpdateDefectStatusEvent(ProceedingJoinPoint joinPoint, Integer applicationId, Integer userId) throws Throwable { Map<Integer, String> vulnerabilityDefectStatuses = new HashMap<Integer, String>(); Map<Integer, Boolean> vulnerabilityDefectClosed = new HashMap<Integer, Boolean>(); boolean errorLoggingEvent = false; Application application = null;//from w w w .java 2 s . com try { application = applicationService.loadApplication(applicationId); for (Vulnerability vuln : application.getVulnerabilities()) { Defect defect = vuln.getDefect(); if (defect != null) { vulnerabilityDefectStatuses.put(vuln.getId(), defect.getStatus()); vulnerabilityDefectClosed.put(vuln.getId(), defect.isClosed()); } } } catch (Exception e) { errorLoggingEvent = true; log.error("Error while logging Event: " + EventAction.DEFECT_STATUS_UPDATED + ", logging to database (visible under Error Messages)"); exceptionLogService.storeExceptionLog(new ExceptionLog(e)); } Object proceed = joinPoint.proceed(); Set<Defect> checkedDefects = set(); try { if (!errorLoggingEvent && (application != null)) { for (Vulnerability vuln : application.getVulnerabilities()) { Defect defect = vuln.getDefect(); if ((defect != null) && !checkedDefects.contains(defect)) { User user = null; try { user = userService.loadUser(userId); } catch (Exception e) { } String newStatus = defect.getStatus(); String oldStatus = vulnerabilityDefectStatuses.get(vuln.getId()); if (!newStatus.equals(oldStatus)) { Event event = generateUpdateDefectStatusEvent(defect, user); publishEventTrackingEvent(event); } Boolean isClosed = defect.isClosed(); Boolean wasClosed = vulnerabilityDefectClosed.get(vuln.getId()); if (isClosed && !wasClosed) { Event event = generateCloseDefectEvent(defect, user); publishEventTrackingEvent(event); } checkedDefects.add(defect); } } } } catch (Exception e) { log.error("Error while logging Event: " + EventAction.DEFECT_STATUS_UPDATED + ", logging to database (visible under Error Messages)"); exceptionLogService.storeExceptionLog(new ExceptionLog(e)); } return proceed; }