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

com.dahuatech.icc.multiinone.event.vo.EventSubcribeRequest Maven / Gradle / Ivy

There is a newer version: 1.0.13.7
Show newest version
package com.dahuatech.icc.multiinone.event.vo;

import com.dahuatech.icc.event.enums.CategoryEnums;
import com.dahuatech.icc.multiinone.event.domain.EventVo;
import com.dahuatech.icc.multiinone.event.domain.MonitorVo;
import com.dahuatech.icc.multiinone.event.domain.SubscribeVo;
import com.dahuatech.icc.multiinone.exception.BusinessException;
import com.dahuatech.icc.multiinone.utils.CollectionsUtils;
import com.dahuatech.icc.multiinone.utils.StringUtils;
import com.dahuatech.icc.multiinone.vo.BaseRequest;

public class EventSubcribeRequest extends BaseRequest {

    private SubscribeVo subscribeVo;

    public SubscribeVo getSubscribeVo() {
        return subscribeVo;
    }

    public void setSubscribeVo(SubscribeVo subscribeVo) {
        this.subscribeVo = subscribeVo;
    }

    public void businessValid() {
        if(subscribeVo == null){
            throw new BusinessException("事件订阅信息为空");
        }
        if(subscribeVo.getParam() == null){
            throw new BusinessException("方法参数param为空");
        }
        if(CollectionsUtils.isEmpty(subscribeVo.getParam().getMonitors())){
            throw new BusinessException("监听组monitors为空");
        }
        for(MonitorVo monitorVo : subscribeVo.getParam().getMonitors()){
            if(StringUtils.isEmpty(monitorVo.getMonitor())){
                throw new BusinessException("监听地址url地址monitor为空");
            }
            if(!CollectionsUtils.isEmpty(monitorVo.getEvents())){
                for(EventVo eventVo : monitorVo.getEvents()){
                    if(StringUtils.isEmpty(eventVo.getCategory()) || !CategoryEnums.isRight(eventVo.getCategory())){
                        throw new BusinessException("事件大类category非法");
                    }
                }
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy