All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.ideabuffer.process.api.model.processor.WhileProcessorModel Maven / Gradle / Ivy

There is a newer version: 1.1.16
Show newest version
package cn.ideabuffer.process.api.model.processor;

import cn.ideabuffer.process.api.model.ModelBuilderFactory;
import cn.ideabuffer.process.api.model.RuleModel;
import cn.ideabuffer.process.api.model.builder.BranchNodeModelBuilder;
import cn.ideabuffer.process.api.model.builder.RuleModelBuilder;
import cn.ideabuffer.process.api.model.node.BranchNodeModel;
import cn.ideabuffer.process.core.nodes.branch.BranchNode;
import cn.ideabuffer.process.core.processors.WhileProcessor;
import cn.ideabuffer.process.core.rule.Rule;
import org.jetbrains.annotations.NotNull;

/**
 * @author sangjian.sj
 * @date 2020/06/22
 */
public class WhileProcessorModel extends ProcessorModel {

    private static final long serialVersionUID = 7517527441917002800L;
    private RuleModel ruleModel;
    private BranchNodeModel branchModel;

    public WhileProcessorModel(@NotNull R processor) {
        super(processor);
    }

    public RuleModel getRuleModel() {
        return ruleModel;
    }

    public void setRuleModel(RuleModel ruleModel) {
        this.ruleModel = ruleModel;
    }

    public BranchNodeModel getBranchModel() {
        return branchModel;
    }

    public void setBranchModel(BranchNodeModel branchModel) {
        this.branchModel = branchModel;
    }

    @Override
    public void init() {
        super.init();
        ModelBuilderFactory factory = ModelBuilderFactory.getInstance();
        Rule rule = resource.getRule();
        RuleModelBuilder ruleModelBuilder = factory.getModelBuilder(rule);
        if (ruleModelBuilder != null) {
            this.ruleModel = ruleModelBuilder.build(rule);
        }
        BranchNode branch = resource.getBranch();
        BranchNodeModelBuilder trueBranchBuilder = factory.getModelBuilder(branch);
        if (trueBranchBuilder != null) {
            this.branchModel = trueBranchBuilder.build(branch);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy