SorterModel.java

package com.mycim.valueobject.sorter;

import com.mycim.framework.utils.lang.StringUtils;
import com.mycim.valueobject.consts.SorterEnum;

public class SorterModel {
    private String sorterType;

    private String jobType;

    private String msg;

    private Boolean canCreate = false;

    public SorterModel() {
    }

    public SorterModel(String sorterType) {
        this.sorterType = sorterType;
    }

    public SorterModel(String sorterType, String jobType) {
        this.sorterType = sorterType;
        this.jobType = jobType;
    }

    public SorterModel(String sorterType, String jobType, String msg) {
        this.sorterType = sorterType;
        this.jobType = jobType;
        this.msg = msg;
    }

    public Boolean getCanCreate() {
        return StringUtils.equalsIgnoreCase(sorterType, SorterEnum.Type.INLINE.getName()) && StringUtils.isEmpty(msg);
    }

    public void setCanCreate(Boolean canCreate) {
        this.canCreate = canCreate;
    }

    public String getSorterType() {
        return sorterType;
    }

    public void setSorterType(String sorterType) {
        this.sorterType = sorterType;
    }

    public String getJobType() {
        return jobType;
    }

    public void setJobType(String jobType) {
        this.jobType = jobType;
    }

    @Override
    public String toString() {
        return "SorterModel{" + "sorterType='" + sorterType + '\'' + ", jobType='" + jobType + '\'' + ", msg='" + msg +
                '\'' + ", canCreate=" + canCreate + '}';
    }

    public String getMsg() {
        if (StringUtils.isEmpty(msg)) {
            return StringUtils.EMPTY;
        }
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void appendMsg(String msg) {
        setMsg(getMsg() + " " + msg);
    }

}