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

com.feingto.cloud.dto.monitor.Condition Maven / Gradle / Ivy

There is a newer version: 2.3.5.RELEASE
Show newest version
package com.feingto.cloud.dto.monitor;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 规则条件表达式
 *
 * @author longfei
 */
@Data
@Accessors(chain = true)
public class Condition implements Serializable {
    private static final long serialVersionUID = 4950188917289587920L;

    private List conditions = new ArrayList<>();

    private List groups = new ArrayList<>();

    private List rules = new ArrayList<>();

    /**
     * 操作符(AND 或者 OR)
     */
    private RuleGroup.UnionOperator op;

    /**
     * 备注
     */
    private String remark;

    public static Condition convertCondition(Condition condition) {
        condition.getConditions().forEach(Condition::convertCondition);
        for (RuleGroup ruleGroup : condition.getGroups()) {
            ruleGroup.getRules().forEach(Condition::clearLabel);
        }
        condition.getRules().forEach(Condition::clearLabel);
        return condition;
    }

    private static void clearLabel(Rule rule) {
        rule.setPropertyLabel(null);
        rule.setElementLabel(null);
        rule.setOpLabel(null);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy