|
| 1 | +package org.gbif.common.messaging.api.messages; |
| 2 | + |
| 3 | +import org.gbif.api.model.pipelines.PipelinesWorkflow; |
| 4 | +import org.gbif.api.model.pipelines.StepType; |
| 5 | + |
| 6 | +import java.util.Collections; |
| 7 | +import java.util.List; |
| 8 | +import java.util.Set; |
| 9 | +import java.util.UUID; |
| 10 | + |
| 11 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 12 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 13 | +import com.fasterxml.jackson.databind.ObjectMapper; |
| 14 | + |
| 15 | +import lombok.SneakyThrows; |
| 16 | + |
| 17 | +public class DataWarehouseMessage extends PipelinesHdfsViewMessage { |
| 18 | + |
| 19 | + public DataWarehouseMessage() {} |
| 20 | + |
| 21 | + @JsonCreator |
| 22 | + public DataWarehouseMessage( |
| 23 | + @JsonProperty("datasetUuid") UUID datasetUuid, |
| 24 | + @JsonProperty("attempt") int attempt, |
| 25 | + @JsonProperty("pipelineSteps") Set<String> pipelineSteps, |
| 26 | + @JsonProperty("runner") String runner, |
| 27 | + @JsonProperty("executionId") Long executionId) { |
| 28 | + super(datasetUuid, attempt, pipelineSteps, runner, executionId); |
| 29 | + } |
| 30 | + |
| 31 | + @SneakyThrows |
| 32 | + public static void main(String[] args) { |
| 33 | + DataWarehouseMessage message = new DataWarehouseMessage(UUID.fromString("a92f4b3c-ae5c-45af-8dac-4a6a88d35ddd"), 25, Collections.singleton("DATA_WAREHOUSE"), "DISTRIBUTED" ,814400L); |
| 34 | + ObjectMapper mapper = new ObjectMapper(); |
| 35 | + System.out.println(mapper.writeValueAsString(message)); |
| 36 | + PipelinesWorkflow.Graph<StepType> workflow = PipelinesWorkflow.getOccurrenceWorkflow(); |
| 37 | + List<PipelinesWorkflow.Graph<StepType>.Edge> edges = workflow.getNodeEdges(StepType.HDFS_VIEW); |
| 38 | + System.out.println(edges); |
| 39 | + } |
| 40 | +} |
0 commit comments