use of org.metahut.octopus.api.dto.MetaDatasetResponseDTO in project octopus by MetaHut.
the class MonitorLogToDTOConverter method queryMeta.
@Named("querySchemaMeta")
public MetaSchemaResponseDTO queryMeta(MonitorLog source) {
MetaDatasetResponseDTO dataset = metaService.queryDatasetByCode(source.getDatasetCode());
MetaSchemaResponseDTO metaSchemaResponseDTO = new MetaSchemaResponseDTO();
metaSchemaResponseDTO.setDatasource(dataset.getDatasource());
metaSchemaResponseDTO.setDatabase(dataset.getDatabase());
metaSchemaResponseDTO.setDataset(new MetaDatasetSingleResponseDTO(dataset.getCode(), dataset.getName()));
if (SubjectCategoryEnum.TABLE.name().equals(source.getSubjectCategory())) {
return metaSchemaResponseDTO;
}
Optional<MetaSchemaSingleResponseDTO> first = dataset.getSchemas().stream().filter(schema -> source.getSubjectCode().equals(schema.getCode())).findFirst();
if (!first.isPresent()) {
metaSchemaResponseDTO.setCode("undefined");
metaSchemaResponseDTO.setName("undefined");
return metaSchemaResponseDTO;
}
MetaSchemaSingleResponseDTO metaSchemaSingleResponseDTO = first.get();
metaSchemaResponseDTO.setCode(metaSchemaSingleResponseDTO.getCode());
metaSchemaResponseDTO.setName(metaSchemaSingleResponseDTO.getName());
return metaSchemaResponseDTO;
}
use of org.metahut.octopus.api.dto.MetaDatasetResponseDTO in project octopus by MetaHut.
the class FlowDefinitionFromDTOConverter method createSchedule.
@BeforeMapping
public void createSchedule(MonitorFlowDefinitionCreateOrUpdateRequestDTO source) {
if (StringUtils.isBlank(source.getSchedulerCode())) {
// TODO name parameter need to be optimized
MetaDatasetResponseDTO dataset = metaService.queryDatasetByCode(source.getDatasetCode());
StringJoiner taskName = new StringJoiner(NAME_SPLICE_SYMBOL).add(dataset.getDatasource().getCode()).add(source.getDatasetCode()).add(String.valueOf(source.getCode()));
String schedulerCode = schedulerService.createMetricsProductionTaskAndAddSchedule(taskName.toString(), source.getCode(), source.getCrontab());
source.setSchedulerCode(schedulerCode);
}
}
Aggregations