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