}
private void persistRawDocument(HDocument document, File rawFile,
String contentHash, DocumentType documentType,
Optional<String> params) {
HRawDocument rawDocument = new HRawDocument();
rawDocument.setDocument(document);
rawDocument.setContentHash(contentHash);
rawDocument.setType(documentType);
rawDocument.setUploadedBy(identity.getCredentials().getUsername());
filePersistService.persistRawDocumentContentFromFile(rawDocument,
rawFile);
if (params.isPresent()) {
rawDocument.setAdapterParameters(params.get());
}
documentDAO.addRawDocument(document, rawDocument);
documentDAO.flush();
}