class PDSFileUploadJobService {

    @UseCaseUserUploadsJobData(@PDSStep(name="service call",description = "uploaded file be stored in job workspace upload location. Also checksum is validated",number=2))
    public void upload(UUID jobUUID, String fileName, MultipartFile file, String checkSum) {
        notNull(jobUUID, "job uuid may not be null");
        notNull(file, "file may not be null");
        notNull(checkSum, "checkSum may not be null");
        validateFileName(fileName);

        PDSJob job = assertJobFound(jobUUID,repository);
        assertJobIsInState(job,PDSJobStatusState.CREATED);

        File jobFolder = workspaceService.getUploadFolder(jobUUID);
        File uploadFile = new File(jobFolder, fileName);

        try {
            FileUtils.copyInputStreamToFile(file.getInputStream(), uploadFile);
            LOG.debug("Uploaded file {} for job {} to {}",fileName,jobUUID, uploadFile.getAbsolutePath());
        } catch (IOException e) {
            LOG.error("Was not able to store {} for job {}, reason:", fileName, jobUUID, e.getMessage());
            throw new IllegalArgumentException("Cannot store given file", e);
        }

        assertCheckSumCorrect(checkSum, uploadFile.toPath());
    }

}