@Test public void doNotProceed_shouldNotDeclareRecords() { rmaConfig.setDeclareRecordsOnCaseClose(false); expect(mockService.getRmaConfig()).andReturn(rmaConfig); CaseFileModifiedEvent caseEvent = new CaseFileModifiedEvent(new CaseFile()); caseEvent.setEventStatus("status.changed"); replayAll(); unit.onApplicationEvent(caseEvent); verifyAll(); }
@Override public void onApplicationEvent(CaseFileModifiedEvent event) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean checkIntegrationEnabled =rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareRecordsOnCaseClose(); if (!checkIntegrationEnabled) { return; } boolean shouldDeclareRecords = shouldDeclareRecords(event); if (shouldDeclareRecords) { CaseFile caseFile = (CaseFile) event.getSource(); String principal = event.getUserId(); AcmAuthentication authentication; if (null != caseFile) { 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()); } } }
AcmCaseFileStatusChangedListener implements ApplicationListener<CaseFileModifiedEvent>, InitializingBean { @Override public void onApplicationEvent(CaseFileModifiedEvent event) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean checkIntegrationEnabled =rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareRecordsOnCaseClose(); if (!checkIntegrationEnabled) { return; } boolean shouldDeclareRecords = shouldDeclareRecords(event); if (shouldDeclareRecords) { CaseFile caseFile = (CaseFile) event.getSource(); String principal = event.getUserId(); AcmAuthentication authentication; if (null != caseFile) { 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()); } } } }
AcmCaseFileStatusChangedListener implements ApplicationListener<CaseFileModifiedEvent>, InitializingBean { @Override public void onApplicationEvent(CaseFileModifiedEvent event) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean checkIntegrationEnabled =rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareRecordsOnCaseClose(); if (!checkIntegrationEnabled) { return; } boolean shouldDeclareRecords = shouldDeclareRecords(event); if (shouldDeclareRecords) { CaseFile caseFile = (CaseFile) event.getSource(); String principal = event.getUserId(); AcmAuthentication authentication; if (null != caseFile) { 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()); } } }  }
AcmCaseFileStatusChangedListener implements ApplicationListener<CaseFileModifiedEvent>, InitializingBean { @Override public void onApplicationEvent(CaseFileModifiedEvent event) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean checkIntegrationEnabled =rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareRecordsOnCaseClose(); if (!checkIntegrationEnabled) { return; } boolean shouldDeclareRecords = shouldDeclareRecords(event); if (shouldDeclareRecords) { CaseFile caseFile = (CaseFile) event.getSource(); String principal = event.getUserId(); AcmAuthentication authentication; if (null != caseFile) { 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(CaseFileModifiedEvent event); @Override void afterPropertiesSet(); AlfrescoRecordsService getAlfrescoRecordsService(); void setAlfrescoRecordsService(AlfrescoRecordsService alfrescoRecordsService); List<String> getCaseClosedStatuses(); void setCaseClosedStatuses(List<String> caseClosedStatuses); AcmAuthenticationManager getAuthenticationManager(); void setAuthenticationManager(AcmAuthenticationManager authenticationManager); }
AcmCaseFileStatusChangedListener implements ApplicationListener<CaseFileModifiedEvent>, InitializingBean { @Override public void onApplicationEvent(CaseFileModifiedEvent event) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean checkIntegrationEnabled =rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareRecordsOnCaseClose(); if (!checkIntegrationEnabled) { return; } boolean shouldDeclareRecords = shouldDeclareRecords(event); if (shouldDeclareRecords) { CaseFile caseFile = (CaseFile) event.getSource(); String principal = event.getUserId(); AcmAuthentication authentication; if (null != caseFile) { 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(CaseFileModifiedEvent event); @Override void afterPropertiesSet(); AlfrescoRecordsService getAlfrescoRecordsService(); void setAlfrescoRecordsService(AlfrescoRecordsService alfrescoRecordsService); List<String> getCaseClosedStatuses(); void setCaseClosedStatuses(List<String> caseClosedStatuses); AcmAuthenticationManager getAuthenticationManager(); void setAuthenticationManager(AcmAuthenticationManager authenticationManager);  }