@Test public void doNotProceed_shouldNotDeclareRecords() { rmaConfig.setDeclareRecordsOnComplaintClose(false); expect(mockService.getRmaConfig()).andReturn(rmaConfig); ComplaintClosedEvent event = new ComplaintClosedEvent(new Complaint(), true, "user", new Date()); replayAll(); unit.onApplicationEvent(event); verifyAll(); }
@Override public void onApplicationEvent(ComplaintClosedEvent event) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean proceed = rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareRecordsOnComplaintClose(); if (!proceed) { return; } if (!event.isSucceeded()) { LOG.trace("Returning - closing complaint was not successful"); return; } Complaint complaint = (Complaint) event.getSource(); if (null != complaint) { String principal = event.getUserId(); AcmAuthentication authentication; try { authentication = authenticationManager.getAcmAuthentication( new UsernamePasswordAuthenticationToken(principal, principal)); } catch (AuthenticationServiceException e) { authentication = new AcmAuthentication(Collections.emptySet(), principal, "", true, principal); } getAlfrescoRecordsService().declareAllContainerFilesAsRecords(authentication, complaint.getContainer(), event.getEventDate(), complaint.getComplaintNumber()); } }
AcmComplaintClosedListener implements ApplicationListener<ComplaintClosedEvent> { @Override public void onApplicationEvent(ComplaintClosedEvent event) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean proceed = rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareRecordsOnComplaintClose(); if (!proceed) { return; } if (!event.isSucceeded()) { LOG.trace("Returning - closing complaint was not successful"); return; } Complaint complaint = (Complaint) event.getSource(); if (null != complaint) { String principal = event.getUserId(); AcmAuthentication authentication; try { authentication = authenticationManager.getAcmAuthentication( new UsernamePasswordAuthenticationToken(principal, principal)); } catch (AuthenticationServiceException e) { authentication = new AcmAuthentication(Collections.emptySet(), principal, "", true, principal); } getAlfrescoRecordsService().declareAllContainerFilesAsRecords(authentication, complaint.getContainer(), event.getEventDate(), complaint.getComplaintNumber()); } } }
AcmComplaintClosedListener implements ApplicationListener<ComplaintClosedEvent> { @Override public void onApplicationEvent(ComplaintClosedEvent event) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean proceed = rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareRecordsOnComplaintClose(); if (!proceed) { return; } if (!event.isSucceeded()) { LOG.trace("Returning - closing complaint was not successful"); return; } Complaint complaint = (Complaint) event.getSource(); if (null != complaint) { String principal = event.getUserId(); AcmAuthentication authentication; try { authentication = authenticationManager.getAcmAuthentication( new UsernamePasswordAuthenticationToken(principal, principal)); } catch (AuthenticationServiceException e) { authentication = new AcmAuthentication(Collections.emptySet(), principal, "", true, principal); } getAlfrescoRecordsService().declareAllContainerFilesAsRecords(authentication, complaint.getContainer(), event.getEventDate(), complaint.getComplaintNumber()); } }  }
AcmComplaintClosedListener implements ApplicationListener<ComplaintClosedEvent> { @Override public void onApplicationEvent(ComplaintClosedEvent event) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean proceed = rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareRecordsOnComplaintClose(); if (!proceed) { return; } if (!event.isSucceeded()) { LOG.trace("Returning - closing complaint was not successful"); return; } Complaint complaint = (Complaint) event.getSource(); if (null != complaint) { String principal = event.getUserId(); AcmAuthentication authentication; try { authentication = authenticationManager.getAcmAuthentication( new UsernamePasswordAuthenticationToken(principal, principal)); } catch (AuthenticationServiceException e) { authentication = new AcmAuthentication(Collections.emptySet(), principal, "", true, principal); } getAlfrescoRecordsService().declareAllContainerFilesAsRecords(authentication, complaint.getContainer(), event.getEventDate(), complaint.getComplaintNumber()); } }  @Override void onApplicationEvent(ComplaintClosedEvent event); AlfrescoRecordsService getAlfrescoRecordsService(); void setAlfrescoRecordsService(AlfrescoRecordsService alfrescoRecordsService); AcmAuthenticationManager getAuthenticationManager(); void setAuthenticationManager(AcmAuthenticationManager authenticationManager); }
AcmComplaintClosedListener implements ApplicationListener<ComplaintClosedEvent> { @Override public void onApplicationEvent(ComplaintClosedEvent event) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean proceed = rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareRecordsOnComplaintClose(); if (!proceed) { return; } if (!event.isSucceeded()) { LOG.trace("Returning - closing complaint was not successful"); return; } Complaint complaint = (Complaint) event.getSource(); if (null != complaint) { String principal = event.getUserId(); AcmAuthentication authentication; try { authentication = authenticationManager.getAcmAuthentication( new UsernamePasswordAuthenticationToken(principal, principal)); } catch (AuthenticationServiceException e) { authentication = new AcmAuthentication(Collections.emptySet(), principal, "", true, principal); } getAlfrescoRecordsService().declareAllContainerFilesAsRecords(authentication, complaint.getContainer(), event.getEventDate(), complaint.getComplaintNumber()); } }  @Override void onApplicationEvent(ComplaintClosedEvent event); AlfrescoRecordsService getAlfrescoRecordsService(); void setAlfrescoRecordsService(AlfrescoRecordsService alfrescoRecordsService); AcmAuthenticationManager getAuthenticationManager(); void setAuthenticationManager(AcmAuthenticationManager authenticationManager);  }