@Test public void doNotProceed_shouldNotDeclareRecords() { rmaConfig.setDeclareRecordsOnCaseClose(false); expect(mockService.getRmaConfig()).andReturn(rmaConfig); CaseEvent caseEvent = new CaseEvent(new CaseFile(), "ipAddress", "user", "eventType", new Date(), true, mockAuthentication); replayAll(); unit.onApplicationEvent(caseEvent); verifyAll(); }
@Override public void onApplicationEvent(CaseEvent event) { boolean checkIntegrationEnabled = alfrescoRecordsService.getRmaConfig().getDeclareRecordsOnCaseClose(); if (!checkIntegrationEnabled) { return; } boolean shouldDeclareRecords = shouldDeclareRecords(event); if (shouldDeclareRecords) { CaseFile caseFile = event.getCaseFile(); if (null != caseFile) { 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, caseFile.getContainer(), event.getEventDate(), caseFile.getCaseNumber()); } } }
AcmCaseFileClosedListener implements ApplicationListener<CaseEvent> { @Override public void onApplicationEvent(CaseEvent event) { boolean checkIntegrationEnabled = alfrescoRecordsService.getRmaConfig().getDeclareRecordsOnCaseClose(); if (!checkIntegrationEnabled) { return; } boolean shouldDeclareRecords = shouldDeclareRecords(event); if (shouldDeclareRecords) { CaseFile caseFile = event.getCaseFile(); if (null != caseFile) { 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, caseFile.getContainer(), event.getEventDate(), caseFile.getCaseNumber()); } } } }
AcmCaseFileClosedListener implements ApplicationListener<CaseEvent> { @Override public void onApplicationEvent(CaseEvent event) { boolean checkIntegrationEnabled = alfrescoRecordsService.getRmaConfig().getDeclareRecordsOnCaseClose(); if (!checkIntegrationEnabled) { return; } boolean shouldDeclareRecords = shouldDeclareRecords(event); if (shouldDeclareRecords) { CaseFile caseFile = event.getCaseFile(); if (null != caseFile) { 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, caseFile.getContainer(), event.getEventDate(), caseFile.getCaseNumber()); } } }  }
AcmCaseFileClosedListener implements ApplicationListener<CaseEvent> { @Override public void onApplicationEvent(CaseEvent event) { boolean checkIntegrationEnabled = alfrescoRecordsService.getRmaConfig().getDeclareRecordsOnCaseClose(); if (!checkIntegrationEnabled) { return; } boolean shouldDeclareRecords = shouldDeclareRecords(event); if (shouldDeclareRecords) { CaseFile caseFile = event.getCaseFile(); if (null != caseFile) { 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, caseFile.getContainer(), event.getEventDate(), caseFile.getCaseNumber()); } } }  @Override void onApplicationEvent(CaseEvent event); AlfrescoRecordsService getAlfrescoRecordsService(); void setAlfrescoRecordsService(AlfrescoRecordsService alfrescoRecordsService); AcmAuthenticationManager getAuthenticationManager(); void setAuthenticationManager(AcmAuthenticationManager authenticationManager); }
AcmCaseFileClosedListener implements ApplicationListener<CaseEvent> { @Override public void onApplicationEvent(CaseEvent event) { boolean checkIntegrationEnabled = alfrescoRecordsService.getRmaConfig().getDeclareRecordsOnCaseClose(); if (!checkIntegrationEnabled) { return; } boolean shouldDeclareRecords = shouldDeclareRecords(event); if (shouldDeclareRecords) { CaseFile caseFile = event.getCaseFile(); if (null != caseFile) { 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, caseFile.getContainer(), event.getEventDate(), caseFile.getCaseNumber()); } } }  @Override void onApplicationEvent(CaseEvent event); AlfrescoRecordsService getAlfrescoRecordsService(); void setAlfrescoRecordsService(AlfrescoRecordsService alfrescoRecordsService); AcmAuthenticationManager getAuthenticationManager(); void setAuthenticationManager(AcmAuthenticationManager authenticationManager);  }