@Test public void onEcmNodeDeleted_ifFileIsDeletedInContentRepository_thenDeleteItFromArkcase() { auditPropertyEntityAdapter.setUserId(nodeDeletedEvent.getUserId()); EcmFile file = new EcmFile(); file.setFileId(111L); when(ecmFileDao.findByCmisFileId(nodeDeletedEvent.getNodeId())).thenReturn(Arrays.asList(file)); unit.onEcmNodeDeleted(nodeDeletedEvent); verify(ecmFileDao, times(1)).findByCmisFileId(nodeDeletedEvent.getNodeId()); verify(acmFolderDao, times(0)).findByCmisFolderId(nodeDeletedEvent.getNodeId()); }
public void onEcmNodeDeleted(EcmEvent ecmEvent) { getAuditPropertyEntityAdapter().setUserId(ecmEvent.getUserId()); EcmFile deleteFile = getFolderAndFilesUtils().lookupArkCaseFile(ecmEvent.getNodeId()); if (deleteFile != null) { try { String message = String.format(DELETE_MESSAGE, deleteFile.getObjectType().toLowerCase()); getFileService().removeLockAndSendMessage(deleteFile.getId(), message); getFileService().deleteFileFromArkcase(deleteFile.getId()); log.info("Deleted file with CMIS ID [{}]", ecmEvent.getNodeId()); } catch (PersistenceException e) { log.error("Could not delete file with id [{}], {} ", deleteFile.getId(), e.getMessage(), e); } } else { AcmFolder deleteFolder = getFolderAndFilesUtils().lookupArkCaseFolder(ecmEvent.getNodeId()); if (deleteFolder != null) { String message = String.format(DELETE_MESSAGE, deleteFolder.getObjectType().toLowerCase()); getFolderService().removeLockAndSendMessage(deleteFolder.getId(), message); getFolderService().deleteFolderContent(deleteFolder, AuthenticationUtils.getUsername()); log.info("Deleted folder with CMIS ID [{}]", ecmEvent.getNodeId()); } } }
EcmNodeDeletedEventHandler implements ApplicationListener<EcmEvent> { public void onEcmNodeDeleted(EcmEvent ecmEvent) { getAuditPropertyEntityAdapter().setUserId(ecmEvent.getUserId()); EcmFile deleteFile = getFolderAndFilesUtils().lookupArkCaseFile(ecmEvent.getNodeId()); if (deleteFile != null) { try { String message = String.format(DELETE_MESSAGE, deleteFile.getObjectType().toLowerCase()); getFileService().removeLockAndSendMessage(deleteFile.getId(), message); getFileService().deleteFileFromArkcase(deleteFile.getId()); log.info("Deleted file with CMIS ID [{}]", ecmEvent.getNodeId()); } catch (PersistenceException e) { log.error("Could not delete file with id [{}], {} ", deleteFile.getId(), e.getMessage(), e); } } else { AcmFolder deleteFolder = getFolderAndFilesUtils().lookupArkCaseFolder(ecmEvent.getNodeId()); if (deleteFolder != null) { String message = String.format(DELETE_MESSAGE, deleteFolder.getObjectType().toLowerCase()); getFolderService().removeLockAndSendMessage(deleteFolder.getId(), message); getFolderService().deleteFolderContent(deleteFolder, AuthenticationUtils.getUsername()); log.info("Deleted folder with CMIS ID [{}]", ecmEvent.getNodeId()); } } } }
EcmNodeDeletedEventHandler implements ApplicationListener<EcmEvent> { public void onEcmNodeDeleted(EcmEvent ecmEvent) { getAuditPropertyEntityAdapter().setUserId(ecmEvent.getUserId()); EcmFile deleteFile = getFolderAndFilesUtils().lookupArkCaseFile(ecmEvent.getNodeId()); if (deleteFile != null) { try { String message = String.format(DELETE_MESSAGE, deleteFile.getObjectType().toLowerCase()); getFileService().removeLockAndSendMessage(deleteFile.getId(), message); getFileService().deleteFileFromArkcase(deleteFile.getId()); log.info("Deleted file with CMIS ID [{}]", ecmEvent.getNodeId()); } catch (PersistenceException e) { log.error("Could not delete file with id [{}], {} ", deleteFile.getId(), e.getMessage(), e); } } else { AcmFolder deleteFolder = getFolderAndFilesUtils().lookupArkCaseFolder(ecmEvent.getNodeId()); if (deleteFolder != null) { String message = String.format(DELETE_MESSAGE, deleteFolder.getObjectType().toLowerCase()); getFolderService().removeLockAndSendMessage(deleteFolder.getId(), message); getFolderService().deleteFolderContent(deleteFolder, AuthenticationUtils.getUsername()); log.info("Deleted folder with CMIS ID [{}]", ecmEvent.getNodeId()); } } }  }
EcmNodeDeletedEventHandler implements ApplicationListener<EcmEvent> { public void onEcmNodeDeleted(EcmEvent ecmEvent) { getAuditPropertyEntityAdapter().setUserId(ecmEvent.getUserId()); EcmFile deleteFile = getFolderAndFilesUtils().lookupArkCaseFile(ecmEvent.getNodeId()); if (deleteFile != null) { try { String message = String.format(DELETE_MESSAGE, deleteFile.getObjectType().toLowerCase()); getFileService().removeLockAndSendMessage(deleteFile.getId(), message); getFileService().deleteFileFromArkcase(deleteFile.getId()); log.info("Deleted file with CMIS ID [{}]", ecmEvent.getNodeId()); } catch (PersistenceException e) { log.error("Could not delete file with id [{}], {} ", deleteFile.getId(), e.getMessage(), e); } } else { AcmFolder deleteFolder = getFolderAndFilesUtils().lookupArkCaseFolder(ecmEvent.getNodeId()); if (deleteFolder != null) { String message = String.format(DELETE_MESSAGE, deleteFolder.getObjectType().toLowerCase()); getFolderService().removeLockAndSendMessage(deleteFolder.getId(), message); getFolderService().deleteFolderContent(deleteFolder, AuthenticationUtils.getUsername()); log.info("Deleted folder with CMIS ID [{}]", ecmEvent.getNodeId()); } } }  void onEcmNodeDeleted(EcmEvent ecmEvent); @Override void onApplicationEvent(EcmEvent ecmEvent); AcmFolderService getFolderService(); void setFolderService(AcmFolderService folderService); AuditPropertyEntityAdapter getAuditPropertyEntityAdapter(); void setAuditPropertyEntityAdapter(AuditPropertyEntityAdapter auditPropertyEntityAdapter); EcmFileService getFileService(); void setFileService(EcmFileService fileService); FolderAndFilesUtils getFolderAndFilesUtils(); void setFolderAndFilesUtils(FolderAndFilesUtils folderAndFilesUtils); }
EcmNodeDeletedEventHandler implements ApplicationListener<EcmEvent> { public void onEcmNodeDeleted(EcmEvent ecmEvent) { getAuditPropertyEntityAdapter().setUserId(ecmEvent.getUserId()); EcmFile deleteFile = getFolderAndFilesUtils().lookupArkCaseFile(ecmEvent.getNodeId()); if (deleteFile != null) { try { String message = String.format(DELETE_MESSAGE, deleteFile.getObjectType().toLowerCase()); getFileService().removeLockAndSendMessage(deleteFile.getId(), message); getFileService().deleteFileFromArkcase(deleteFile.getId()); log.info("Deleted file with CMIS ID [{}]", ecmEvent.getNodeId()); } catch (PersistenceException e) { log.error("Could not delete file with id [{}], {} ", deleteFile.getId(), e.getMessage(), e); } } else { AcmFolder deleteFolder = getFolderAndFilesUtils().lookupArkCaseFolder(ecmEvent.getNodeId()); if (deleteFolder != null) { String message = String.format(DELETE_MESSAGE, deleteFolder.getObjectType().toLowerCase()); getFolderService().removeLockAndSendMessage(deleteFolder.getId(), message); getFolderService().deleteFolderContent(deleteFolder, AuthenticationUtils.getUsername()); log.info("Deleted folder with CMIS ID [{}]", ecmEvent.getNodeId()); } } }  void onEcmNodeDeleted(EcmEvent ecmEvent); @Override void onApplicationEvent(EcmEvent ecmEvent); AcmFolderService getFolderService(); void setFolderService(AcmFolderService folderService); AuditPropertyEntityAdapter getAuditPropertyEntityAdapter(); void setAuditPropertyEntityAdapter(AuditPropertyEntityAdapter auditPropertyEntityAdapter); EcmFileService getFileService(); void setFileService(EcmFileService fileService); FolderAndFilesUtils getFolderAndFilesUtils(); void setFolderAndFilesUtils(FolderAndFilesUtils folderAndFilesUtils);  }