class DocumentsServiceImpl extends AbstractProjectServiceImpl implements DocumentsService {

    @Override
    public ServiceResult<FileAndContents> getFileContents(long projectId, long documentConfigId) {
        return getProject(projectId).andOnSuccess(project -> {

            FileEntry fileEntry = getFileEntry(project, documentConfigId);

            return fileService.getFileByFileEntryId(fileEntry.getId())
                    .andOnSuccessReturn(inputStream -> new BasicFileAndContents(fileEntryMapper.mapToResource(fileEntry), inputStream));
        });
    }

}