Search in sources :

Example 1 with DefaultConditionSpecification

use of io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification in project cdap by caskdata.

the class DefaultConditionConfigurer method createSpecification.

private DefaultConditionSpecification createSpecification() {
    Set<String> datasets = new HashSet<>();
    Reflections.visit(condition, condition.getClass(), new PropertyFieldExtractor(properties), new DataSetFieldExtractor(datasets));
    return new DefaultConditionSpecification(condition.getClass().getName(), name, description, properties, datasets);
}
Also used : DefaultConditionSpecification(io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification) PropertyFieldExtractor(io.cdap.cdap.internal.specification.PropertyFieldExtractor) DataSetFieldExtractor(io.cdap.cdap.internal.specification.DataSetFieldExtractor) HashSet(java.util.HashSet)

Example 2 with DefaultConditionSpecification

use of io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification in project cdap by caskdata.

the class ConditionSpecificationCodec method deserialize.

@Override
public ConditionSpecification deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    JsonObject jsonObj = json.getAsJsonObject();
    String className = jsonObj.get("className").getAsString();
    String name = jsonObj.get("name").getAsString();
    String description = jsonObj.get("description").getAsString();
    Set<String> datasets = deserializeSet(jsonObj.get("datasets"), context, String.class);
    Map<String, String> properties = deserializeMap(jsonObj.get("properties"), context, String.class);
    return new DefaultConditionSpecification(className, name, description, properties, datasets);
}
Also used : JsonObject(com.google.gson.JsonObject) DefaultConditionSpecification(io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification)

Example 3 with DefaultConditionSpecification

use of io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification in project cdap by caskdata.

the class DefaultWorkflowConditionConfigurer method addWorkflowConditionNode.

@Override
public void addWorkflowConditionNode(Predicate<WorkflowContext> predicate, List<WorkflowNode> ifBranch, List<WorkflowNode> elseBranch) {
    ConditionSpecification spec = new DefaultConditionSpecification(predicate.getClass().getName(), predicate.getClass().getSimpleName(), "", new HashMap<String, String>(), new HashSet<String>());
    currentBranch.add(new WorkflowConditionNode(spec.getName(), spec, ifBranch, elseBranch));
}
Also used : DefaultConditionSpecification(io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification) DefaultConditionSpecification(io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification) ConditionSpecification(io.cdap.cdap.api.workflow.ConditionSpecification) WorkflowConditionNode(io.cdap.cdap.api.workflow.WorkflowConditionNode)

Example 4 with DefaultConditionSpecification

use of io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification in project cdap by caskdata.

the class DefaultWorkflowForkConfigurer method addWorkflowConditionNode.

@Override
public void addWorkflowConditionNode(Predicate<WorkflowContext> predicate, List<WorkflowNode> ifBranch, List<WorkflowNode> elseBranch) {
    ConditionSpecification spec = new DefaultConditionSpecification(predicate.getClass().getName(), predicate.getClass().getSimpleName(), "", new HashMap<String, String>(), new HashSet<String>());
    currentBranch.add(new WorkflowConditionNode(spec.getName(), spec, ifBranch, elseBranch));
}
Also used : DefaultConditionSpecification(io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification) DefaultConditionSpecification(io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification) ConditionSpecification(io.cdap.cdap.api.workflow.ConditionSpecification) WorkflowConditionNode(io.cdap.cdap.api.workflow.WorkflowConditionNode)

Example 5 with DefaultConditionSpecification

use of io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification in project cdap by caskdata.

the class DefaultWorkflowConfigurer method addWorkflowConditionNode.

@Override
public void addWorkflowConditionNode(Predicate<WorkflowContext> predicate, List<WorkflowNode> ifBranch, List<WorkflowNode> elseBranch) {
    ConditionSpecification spec = new DefaultConditionSpecification(predicate.getClass().getName(), predicate.getClass().getSimpleName(), "", new HashMap<String, String>(), new HashSet<String>());
    nodes.add(new WorkflowConditionNode(spec.getName(), spec, ifBranch, elseBranch));
}
Also used : DefaultConditionSpecification(io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification) DefaultConditionSpecification(io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification) ConditionSpecification(io.cdap.cdap.api.workflow.ConditionSpecification) WorkflowConditionNode(io.cdap.cdap.api.workflow.WorkflowConditionNode)

Aggregations

DefaultConditionSpecification (io.cdap.cdap.internal.workflow.condition.DefaultConditionSpecification)5 ConditionSpecification (io.cdap.cdap.api.workflow.ConditionSpecification)3 WorkflowConditionNode (io.cdap.cdap.api.workflow.WorkflowConditionNode)3 JsonObject (com.google.gson.JsonObject)1 DataSetFieldExtractor (io.cdap.cdap.internal.specification.DataSetFieldExtractor)1 PropertyFieldExtractor (io.cdap.cdap.internal.specification.PropertyFieldExtractor)1 HashSet (java.util.HashSet)1