@Test public void doNotProceed_shouldNotDeclareRecord() { EcmFile file = new EcmFile(); file.setContainer(new AcmContainer()); rmaConfig.setDeclareFileRecordOnDeclareRequest(false); expect(mockService.getRmaConfig()).andReturn(rmaConfig); expect(mockAuthentication.getDetails()).andReturn("details").anyTimes(); replayAll(); EcmFileDeclareRequestEvent event = new EcmFileDeclareRequestEvent(file, mockAuthentication); unit.onApplicationEvent(event); verifyAll(); }
@Override public void onApplicationEvent(EcmFileDeclareRequestEvent ecmFileDeclareRequestEvent) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean proceed = rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareFileRecordOnDeclareRequest(); if (!proceed) { return; } if (!ecmFileDeclareRequestEvent.isSucceeded()) { log.trace("Returning - file declaration request was not successful"); } try { getAlfrescoRecordsService().declareFileAsRecord(ecmFileDeclareRequestEvent.getSource().getContainer(), ecmFileDeclareRequestEvent.getEventDate(), ecmFileDeclareRequestEvent.getParentObjectName(), rmaConfig.getDefaultOriginatorOrg(), ecmFileDeclareRequestEvent.getUserId(), ecmFileDeclareRequestEvent.getEcmFileId(), ecmFileDeclareRequestEvent.getSource().getStatus(), ecmFileDeclareRequestEvent.getObjectId()); } catch (AlfrescoServiceException e) { log.error("Could not declare file as record: {}", e.getMessage(), e); } }
AcmFileDeclareRequestListener implements ApplicationListener<EcmFileDeclareRequestEvent> { @Override public void onApplicationEvent(EcmFileDeclareRequestEvent ecmFileDeclareRequestEvent) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean proceed = rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareFileRecordOnDeclareRequest(); if (!proceed) { return; } if (!ecmFileDeclareRequestEvent.isSucceeded()) { log.trace("Returning - file declaration request was not successful"); } try { getAlfrescoRecordsService().declareFileAsRecord(ecmFileDeclareRequestEvent.getSource().getContainer(), ecmFileDeclareRequestEvent.getEventDate(), ecmFileDeclareRequestEvent.getParentObjectName(), rmaConfig.getDefaultOriginatorOrg(), ecmFileDeclareRequestEvent.getUserId(), ecmFileDeclareRequestEvent.getEcmFileId(), ecmFileDeclareRequestEvent.getSource().getStatus(), ecmFileDeclareRequestEvent.getObjectId()); } catch (AlfrescoServiceException e) { log.error("Could not declare file as record: {}", e.getMessage(), e); } } }
AcmFileDeclareRequestListener implements ApplicationListener<EcmFileDeclareRequestEvent> { @Override public void onApplicationEvent(EcmFileDeclareRequestEvent ecmFileDeclareRequestEvent) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean proceed = rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareFileRecordOnDeclareRequest(); if (!proceed) { return; } if (!ecmFileDeclareRequestEvent.isSucceeded()) { log.trace("Returning - file declaration request was not successful"); } try { getAlfrescoRecordsService().declareFileAsRecord(ecmFileDeclareRequestEvent.getSource().getContainer(), ecmFileDeclareRequestEvent.getEventDate(), ecmFileDeclareRequestEvent.getParentObjectName(), rmaConfig.getDefaultOriginatorOrg(), ecmFileDeclareRequestEvent.getUserId(), ecmFileDeclareRequestEvent.getEcmFileId(), ecmFileDeclareRequestEvent.getSource().getStatus(), ecmFileDeclareRequestEvent.getObjectId()); } catch (AlfrescoServiceException e) { log.error("Could not declare file as record: {}", e.getMessage(), e); } }  }
AcmFileDeclareRequestListener implements ApplicationListener<EcmFileDeclareRequestEvent> { @Override public void onApplicationEvent(EcmFileDeclareRequestEvent ecmFileDeclareRequestEvent) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean proceed = rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareFileRecordOnDeclareRequest(); if (!proceed) { return; } if (!ecmFileDeclareRequestEvent.isSucceeded()) { log.trace("Returning - file declaration request was not successful"); } try { getAlfrescoRecordsService().declareFileAsRecord(ecmFileDeclareRequestEvent.getSource().getContainer(), ecmFileDeclareRequestEvent.getEventDate(), ecmFileDeclareRequestEvent.getParentObjectName(), rmaConfig.getDefaultOriginatorOrg(), ecmFileDeclareRequestEvent.getUserId(), ecmFileDeclareRequestEvent.getEcmFileId(), ecmFileDeclareRequestEvent.getSource().getStatus(), ecmFileDeclareRequestEvent.getObjectId()); } catch (AlfrescoServiceException e) { log.error("Could not declare file as record: {}", e.getMessage(), e); } }  @Override void onApplicationEvent(EcmFileDeclareRequestEvent ecmFileDeclareRequestEvent); AlfrescoRecordsService getAlfrescoRecordsService(); void setAlfrescoRecordsService(AlfrescoRecordsService alfrescoRecordsService); }
AcmFileDeclareRequestListener implements ApplicationListener<EcmFileDeclareRequestEvent> { @Override public void onApplicationEvent(EcmFileDeclareRequestEvent ecmFileDeclareRequestEvent) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean proceed = rmaConfig.getIntegrationEnabled() && rmaConfig.getDeclareFileRecordOnDeclareRequest(); if (!proceed) { return; } if (!ecmFileDeclareRequestEvent.isSucceeded()) { log.trace("Returning - file declaration request was not successful"); } try { getAlfrescoRecordsService().declareFileAsRecord(ecmFileDeclareRequestEvent.getSource().getContainer(), ecmFileDeclareRequestEvent.getEventDate(), ecmFileDeclareRequestEvent.getParentObjectName(), rmaConfig.getDefaultOriginatorOrg(), ecmFileDeclareRequestEvent.getUserId(), ecmFileDeclareRequestEvent.getEcmFileId(), ecmFileDeclareRequestEvent.getSource().getStatus(), ecmFileDeclareRequestEvent.getObjectId()); } catch (AlfrescoServiceException e) { log.error("Could not declare file as record: {}", e.getMessage(), e); } }  @Override void onApplicationEvent(EcmFileDeclareRequestEvent ecmFileDeclareRequestEvent); AlfrescoRecordsService getAlfrescoRecordsService(); void setAlfrescoRecordsService(AlfrescoRecordsService alfrescoRecordsService);  }