@SuppressWarnings("deprecation") public class ImportController extends AbstractFormController { private String view; private String successView; @Autowired protected UserService userService; @Autowired private ManageDeviceService manageDeviceService; public String getView() { return view; } public void setView(String view) { this.view = view; } public String getSuccessView() { return successView; } public void setSuccessView(String successView) { this.successView = successView; } @Override protectedpublic ModelAndView processFormSubmission(final HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { final ModelAndView mav = new ModelAndView(getView()); FileUploadCommand file = (FileUploadCommand)command; MultipartFile multipartFile = file.getFile(); if(multipartFile!=null && multipartFile.getSize()>0) { Workbook workbook = Workbook.getWorkbook(multipartFile.getInputStream()); DataCollector dataCollector = new XLSDataCollector(workbook, true); final List<Application> applications = manageDeviceService.loadApplications (dataCollector.getDataCollection()); List<ApplicationImporterError> importationErrors = manageDeviceService.validateApplications(applications); savedApplications.add(manageDeviceService.getApplicationById(application.getId(), true)); } return mav; } @Override protectedpublic ModelAndView showForm(HttpServletRequest request, HttpServletResponse arg1, BindException errors) throws Exception { return new ModelAndView(getView()); } } /** * @param applications * @param competentBody * @return * @throws Exception */ private List<Application> saveApplications(List<Application> applications,User user) throws Exception { return manageDeviceService.saveImportedApplications (applications, user); } /** * @param session * @return */ protectedpublic User getUser(HttpSession session) { User user = (User) session.getAttribute(Const.SESSION_USER); if (user == null) { user = new User(); } return user; } } @SuppressWarnings("deprecation") public class ImportController extends AbstractFormController { private String view; private String successView; @Autowired protected UserService userService; @Autowired private ManageDeviceService manageDeviceService; public String getView() { return view; } public void setView(String view) { this.view = view; } public String getSuccessView() { return successView; } public void setSuccessView(String successView) { this.successView = successView; } @Override protected ModelAndView processFormSubmission(final HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { final ModelAndView mav = new ModelAndView(getView()); FileUploadCommand file = (FileUploadCommand)command; MultipartFile multipartFile = file.getFile(); if(multipartFile!=null && multipartFile.getSize()>0) { Workbook workbook = Workbook.getWorkbook(multipartFile.getInputStream()); DataCollector dataCollector = new XLSDataCollector(workbook, true); final List<Application> applications = manageDeviceService.loadApplications (dataCollector.getDataCollection()); List<ApplicationImporterError> importationErrors = manageDeviceService.validateApplications(applications); savedApplications.add(manageDeviceService.getApplicationById(application.getId(), true)); } return mav; } @Override protected ModelAndView showForm(HttpServletRequest request, HttpServletResponse arg1, BindException errors) throws Exception { return new ModelAndView(getView()); } } /** * @param applications * @param competentBody * @return * @throws Exception */ private List<Application> saveApplications(List<Application> applications,User user) throws Exception { return manageDeviceService.saveImportedApplications (applications, user); } /** * @param session * @return */ protected User getUser(HttpSession session) { User user = (User) session.getAttribute(Const.SESSION_USER); if (user == null) { user = new User(); } return user; } } @SuppressWarnings("deprecation") public class ImportController extends AbstractFormController { private String view; private String successView; @Autowired protected UserService userService; @Autowired private ManageDeviceService manageDeviceService; public String getView() { return view; } public void setView(String view) { this.view = view; } public String getSuccessView() { return successView; } public void setSuccessView(String successView) { this.successView = successView; } @Override public ModelAndView processFormSubmission(final HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { final ModelAndView mav = new ModelAndView(getView()); FileUploadCommand file = (FileUploadCommand)command; MultipartFile multipartFile = file.getFile(); if(multipartFile!=null && multipartFile.getSize()>0) { Workbook workbook = Workbook.getWorkbook(multipartFile.getInputStream()); DataCollector dataCollector = new XLSDataCollector(workbook, true); final List<Application> applications = manageDeviceService.loadApplications (dataCollector.getDataCollection()); List<ApplicationImporterError> importationErrors = manageDeviceService.validateApplications(applications); savedApplications.add(manageDeviceService.getApplicationById(application.getId(), true)); } return mav; } @Override public ModelAndView showForm(HttpServletRequest request, HttpServletResponse arg1, BindException errors) throws Exception { return new ModelAndView(getView()); } } /** * @param applications * @param competentBody * @return * @throws Exception */ private List<Application> saveApplications(List<Application> applications,User user) throws Exception { return manageDeviceService.saveImportedApplications (applications, user); } /** * @param session * @return */ public User getUser(HttpSession session) { User user = (User) session.getAttribute(Const.SESSION_USER); if (user == null) { user = new User(); } return user; } } I see, the method before(JoinPoint _jp) is not invoked when I just paste the URL in the browser .... http://127.0.0.1:7001/devices/manage/import.do
I see, the method before(JoinPoint _jp) is not invoked when I just paste the URL in the browser .... http://127.0.0.1:7001/devices/manage/import.do
@Aspect public class DeviceAspect extends ServiceSupport { @Pointcut("execution(* fo.belecam.services.client.ManageLicenseService.*(..))") public void manage() { } @Pointcut("execution(* fo.belecam.services.client.AwardService.*(..))") public void award() { } @Pointcut("execution(* fo.belecam.services.client.DeviceService.*(..))") public void handleDeviceServiceMethod() { } @Pointcut("execution(* fo.belecam.controller.manage.ImportController.*(..))") public void handleImportController() { } @Before("fo.belecam.services.aop.DeviceAspect.handleImportController() || fo.belecam.services.aop.DeviceAspect.handleDeviceServiceMethod() || fo.belecam.services.aop.DeviceAspect.manage() || fo.belecam.services.aop.DeviceAspect.award()") @After ("fo.belecam.services.aop.DeviceAspect.handleImportController() || fo.belecam.services.aop.DeviceAspect.handleDeviceServiceMethod() || fo.belecam.services.aop.DeviceAspect.manage() || fo.belecam.services.aop.DeviceAspect.award()") public void before(JoinPoint _jp) { User user = getUser(); if(user == null || user.getUserRole() != UserRole.MANAGER) { throw new NoSufficientRoleException(user == null ? null : user.getUserRole(), UserRole.MANAGER); } } } @Aspect public class DeviceAspect extends ServiceSupport { @Pointcut("execution(* fo.belecam.services.client.ManageLicenseService.*(..))") public void manage() { } @Pointcut("execution(* fo.belecam.services.client.AwardService.*(..))") public void award() { } @Pointcut("execution(* fo.belecam.services.client.DeviceService.*(..))") public void handleDeviceServiceMethod() { } @Pointcut("execution(* fo.belecam.controller.manage.ImportController.*(..))") public void handleImportController() { } @Before("fo.belecam.services.aop.DeviceAspect.handleImportController() || fo.belecam.services.aop.DeviceAspect.handleDeviceServiceMethod() || fo.belecam.services.aop.DeviceAspect.manage() || fo.belecam.services.aop.DeviceAspect.award()") public void before(JoinPoint _jp) { User user = getUser(); if(user == null || user.getUserRole() != UserRole.MANAGER) { throw new NoSufficientRoleException(user == null ? null : user.getUserRole(), UserRole.MANAGER); } } } @Aspect public class DeviceAspect extends ServiceSupport { @Pointcut("execution(* fo.belecam.services.client.ManageLicenseService.*(..))") public void manage() { } @Pointcut("execution(* fo.belecam.services.client.AwardService.*(..))") public void award() { } @Pointcut("execution(* fo.belecam.services.client.DeviceService.*(..))") public void handleDeviceServiceMethod() { } @Pointcut("execution(* fo.belecam.controller.manage.ImportController.*(..))") public void handleImportController() { } @Before("fo.belecam.services.aop.DeviceAspect.handleImportController() || fo.belecam.services.aop.DeviceAspect.handleDeviceServiceMethod() || fo.belecam.services.aop.DeviceAspect.manage() || fo.belecam.services.aop.DeviceAspect.award()") @After ("fo.belecam.services.aop.DeviceAspect.handleImportController() || fo.belecam.services.aop.DeviceAspect.handleDeviceServiceMethod() || fo.belecam.services.aop.DeviceAspect.manage() || fo.belecam.services.aop.DeviceAspect.award()") public void before(JoinPoint _jp) { User user = getUser(); if(user == null || user.getUserRole() != UserRole.MANAGER) { throw new NoSufficientRoleException(user == null ? null : user.getUserRole(), UserRole.MANAGER); } } } Loading
Loading
Loading
Loading
Loading
Loading
default