class PDSCreateJobService {

    @UseCaseUserCreatesJob(@PDSStep(name="service call",description = "job will be created, serverId will be used to store new job",number=2))
    public PDSJobCreateResult createJob(PDSJobConfiguration configuration) {
        
        configurationValidator.assertPDSConfigurationValid(configuration);

        PDSJob job = new PDSJob();

        job.created = LocalDateTime.now();
        job.state = PDSJobStatusState.CREATED;
        job.owner = userContextService.getUserId();
        job.setServerId(serverConfigurationService.getServerId());
        
        try {
            job.jsonConfiguration=configuration.toJSON();
        } catch (PDSJSONConverterException e) {
            throw new PDSNotAcceptableException("Configuration conversion failure:"+e.getMessage());
        }
        job = repository.save(job);

        return new PDSJobCreateResult(job.getUUID());
    }

}