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

com.dahuatech.icc.brm.model.v202010.role.BrmRoleDeleteRequest Maven / Gradle / Ivy

The newest version!
package com.dahuatech.icc.brm.model.v202010.role;

import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.brm.constant.BrmConstant;
import com.dahuatech.icc.brm.constant.ParamConstant;
import com.dahuatech.icc.brm.exception.BusinessException;
import com.dahuatech.icc.common.ParamValidEnum;
import com.dahuatech.icc.exception.ClientException;
import com.dahuatech.icc.oauth.http.AbstractIccRequest;
import com.dahuatech.icc.util.CollectionUtil;

import java.util.List;

/**
 * 角色删除
 *
 * @author 237417
 * @since 2021/02/23
 */
public class BrmRoleDeleteRequest extends AbstractIccRequest {

    /** 需要删除的角色ID集合 */
    private List ids;
    /*--------以上必填-----*/


    public BrmRoleDeleteRequest(Builder builder) {
        super(BrmConstant.url(BrmConstant.BRM_URL_ROLE_DEL_POST), Method.POST);
        this.ids = builder.ids;
        putBodyParameter("ids",ids);
    }

    public BrmRoleDeleteRequest(){
        super(BrmConstant.url(BrmConstant.BRM_URL_ROLE_DEL_POST), Method.POST);
    }

    public static Builder builder() {
        return new Builder();
    }

    @Override
    public Class getResponseClass() {
        return BrmRoleDeleteResponse.class;
    }

    public List getIds() {
        return ids;
    }

    public void setIds(List ids) {
        this.ids = ids;
        putBodyParameter("ids",ids);
    }

    @Override
    public String toString() {
        return "BrmRoleDeleteRequest{" +
                "ids=" + ids +
                '}';
    }

    public static class Builder {
        /** 需要删除的角色ID集合 */
        private List ids;
        /*--------以上必填-----*/

        public Builder ids(List ids) {
            this.ids = ids;
            return this;
        }

        public BrmRoleDeleteRequest build() throws ClientException {
            return new BrmRoleDeleteRequest(this);
        }
    }
    public void businessValid() {
        if(CollectionUtil.isEmpty(ids)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "ids");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy