use of org.molgenis.api.metadata.v3.job.MetadataUpsertJobExecutionMetadata.Action in project molgenis by molgenis.
the class MetadataApiJobServiceImpl method scheduleUpsert.
private MetadataUpsertJobExecution scheduleUpsert(Action action, EntityType entityType) {
MetadataUpsertJobExecution jobExecution = metadataUpsertJobExecutionFactory.create();
jobExecution.setAction(action);
jobExecution.setEntityTypeData(entityTypeSerializer.serializeEntityType(entityType));
jobExecutor.submit(jobExecution);
return jobExecution;
}
use of org.molgenis.api.metadata.v3.job.MetadataUpsertJobExecutionMetadata.Action 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