class EuGrantTransferServiceImpl implements EuGrantTransferService {

    @Override
    public ServiceResult<FileEntryResource> findGrantAgreement(long applicationId) {
        return findGrantTransferByApplicationId(applicationId).andOnSuccess(grantTransfer ->
                ofNullable(grantTransfer.getGrantAgreement())
                        .map(FileEntry::getId)
                        .map(fileEntryService::findOne)
                        .orElse(serviceFailure(notFoundError(FileEntryResource.class, applicationId))));
    }

}