@Override public DocumentVo insertFile(InputStream in, String fileName, UserVo owner) throws BusinessException { logger.debug("insert files for document entries"); Account actor = accountService.findByLsUuid(owner.getLsUuid()); fileName = fileName.replace("\\", "_"); fileName = fileName.replace(":", "_"); DocumentEntry createDocumentEntry = documentEntryService.createDocumentEntry(actor, in, fileName); return documentEntryTransformer.disassemble(createDocumentEntry); }
@Override public UploadRequestEntry createUploadRequestEntry( String uploadRequestUrlUuid, InputStream fi, String fileName, String password) throws BusinessException { // Retrieve upload request URL UploadRequestUrl requestUrl = find(uploadRequestUrlUuid, password); // HOOK : Extract owner for upload request URL Account owner = requestUrl.getUploadRequest().getOwner(); // Store the file into the owner account. DocumentEntry document = documentEntryService.createDocumentEntry(owner, fi, fileName); createBusinessCheck(requestUrl, document); Account actor = accountRepository.getUploadRequestSystemAccount(); // Create the link between the document and the upload request URL. UploadRequestEntry uploadRequestEntry = new UploadRequestEntry(document, requestUrl.getUploadRequest()); UploadRequestEntry requestEntry = uploadRequestEntryBusinessService.create(uploadRequestEntry); MailContainerWithRecipient mail = mailBuildingService.buildAckUploadRequest( (User) requestUrl.getUploadRequest().getOwner(), requestUrl, requestEntry); notifierService.sendNotification(mail); return requestEntry; }