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

com.dahuatech.icc.brm.model.v202010.organization.BrmOrganizationDeleteRequest Maven / Gradle / Ivy

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

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 java.util.List;

/**
 * 组织删除,method=delete,必填字段使用Builder
 *
 * @author 232676
 * @since 1.0.0 2020/11/3 11:22
 */
public class BrmOrganizationDeleteRequest
    extends AbstractIccRequest {

  /** 组织编码数组 */
  private List orgCodes;

  private BrmOrganizationDeleteRequest(Builder builder) {
    super(BrmConstant.url(BrmConstant.BRM_URL_ORGAN_DEL_DELETE), Method.DELETE);
    this.orgCodes = builder.orgCodes;
    putBodyParameter("orgCodes", orgCodes);
  }

    public BrmOrganizationDeleteRequest(){
        super(BrmConstant.url(BrmConstant.BRM_URL_ORGAN_DEL_DELETE), Method.DELETE);
    }

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

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

  public List getOrgCodes() {
    return orgCodes;
  }

  public void setOrgCodes(List orgCodes) {
    this.orgCodes = orgCodes;
  }

  public static class Builder {
    /** 组织编码数组 */
    private List orgCodes;

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

    public BrmOrganizationDeleteRequest build() throws ClientException {
      return new BrmOrganizationDeleteRequest(this);
    }
  }

    public void businessValid() {
        if(orgCodes == null){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "orgCodes");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy