use of org.molgenis.jobs.JobFactory in project molgenis by molgenis.
the class MetadataUpsertConfig method metadataUpsertJobExecutionJobFactory.
@Bean
public JobFactory<MetadataUpsertJobExecution> metadataUpsertJobExecutionJobFactory() {
return new JobFactory<>() {
@Override
public Job createJob(MetadataUpsertJobExecution metadataUpsertJobExecution) {
String entityTypeData = metadataUpsertJobExecution.getEntityTypeData();
EntityType entityType = entityTypeSerializer.deserializeEntityType(entityTypeData);
Action action = metadataUpsertJobExecution.getAction();
switch(action) {
case CREATE:
throw new UnsupportedOperationException();
case UPDATE:
return progress -> updateEntityType(entityType);
default:
throw new UnexpectedEnumException(action);
}
}
};
}
Aggregations