LotConstrainInfo.java

package com.mycim.valueobject.prp;

import com.mycim.framework.utils.lang.StringUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;

/**
 * @author andy
 */
public class LotConstrainInfo implements Serializable {

    public static final String PROCESS_RULE = "PROCESS_RULE";

    public static final String PRODUCT_RULE = "PRODUCT_RULE";

    public static final String LOT_RULE = "LOT_RULE";

    private static final long serialVersionUID = 2431532230045134663L;

    private static final String SEPARATOR = "|";

    private String constrainRule;

    private Long constrainRrn;

    private String constrainType;

    private String productId;

    private Long productRrn;

    private String processId;

    private String processRrn;

    private String lotId;

    private Long lotRrn;

    private String prevOperationIdStr;

    private String prevOperationRrnStr;

    private String prevEquipmentIdStr;

    private String prevEquipmentRrnStr;

    private String operationId;

    private Long operationRrn;

    private String equipmentRrn;

    private String equipmentId;

    private String createBy;

    private Date createTime;

    private String modifyBy;

    private Date modifyTime;

    private String remark;

    /**
     * @return the constrainRule
     */
    public String getConstrainRule() {
        if (StringUtils.isNotBlank(this.getLotId())) {
            this.constrainRule = LOT_RULE;
        } else if (StringUtils.isNotBlank(this.getProductId())) {
            this.constrainRule = PRODUCT_RULE;
        } else {
            this.constrainRule = PROCESS_RULE;
        }
        return constrainRule;
    }

    /**
     * @param constrainRule the constrainRule to set
     */
    public void setConstrainRule(String constrainRule) {
        this.constrainRule = constrainRule;
    }

    /**
     * @return the constrainRrn
     */
    public Long getConstrainRrn() {
        return constrainRrn;
    }

    /**
     * @param constrainRrn the constrainRrn to set
     */
    public void setConstrainRrn(Long constrainRrn) {
        this.constrainRrn = constrainRrn;
    }

    /**
     * @return the constrainType
     */
    public String getConstrainType() {
        return constrainType;
    }

    /**
     * @param constrainType the constrainType to set
     */
    public void setConstrainType(String constrainType) {
        this.constrainType = constrainType;
    }

    /**
     * @return the productId
     */
    public String getProductId() {
        return productId;
    }

    /**
     * @param productId the productId to set
     */
    public void setProductId(String productId) {
        this.productId = productId;
    }

    /**
     * @return the productRrn
     */
    public Long getProductRrn() {
        return productRrn;
    }

    /**
     * @param productRrn the productRrn to set
     */
    public void setProductRrn(Long productRrn) {
        this.productRrn = productRrn;
    }

    /**
     * @return the processId
     */
    public String getProcessId() {
        return processId;
    }

    /**
     * @param processId the processId to set
     */
    public void setProcessId(String processId) {
        this.processId = processId;
    }

    /**
     * @return the processRrn
     */
    public String getProcessRrn() {
        return processRrn;
    }

    /**
     * @param processRrn the processRrn to set
     */
    public void setProcessRrn(String processRrn) {
        this.processRrn = processRrn;
    }

    /**
     * @return the lotId
     */
    public String getLotId() {
        return lotId;
    }

    /**
     * @param lotId the lotId to set
     */
    public void setLotId(String lotId) {
        this.lotId = lotId;
    }

    /**
     * @return the lotRrn
     */
    public Long getLotRrn() {
        return lotRrn;
    }

    /**
     * @param lotRrn the lotRrn to set
     */
    public void setLotRrn(Long lotRrn) {
        this.lotRrn = lotRrn;
    }

    /**
     * @return the prevOperationIdStr
     */
    public String getPrevOperationIdStr() {
        return prevOperationIdStr;
    }

    /**
     * @param prevOperationIdStr the prevOperationIdStr to set
     */
    public void setPrevOperationIdStr(String prevOperationIdStr) {
        this.prevOperationIdStr = prevOperationIdStr;
    }

    /**
     * @return the prevOperationRrnStr
     */
    public String getPrevOperationRrnStr() {
        return prevOperationRrnStr;
    }

    /**
     * @param prevOperationRrnStr the prevOperationRrnStr to set
     */
    public void setPrevOperationRrnStr(String prevOperationRrnStr) {
        this.prevOperationRrnStr = prevOperationRrnStr;
    }

    /**
     * @return the prevEquipmentIdStr
     */
    public String getPrevEquipmentIdStr() {
        return prevEquipmentIdStr;
    }

    /**
     * @param prevEquipmentIdStr the prevEquipmentIdStr to set
     */
    public void setPrevEquipmentIdStr(String prevEquipmentIdStr) {
        this.prevEquipmentIdStr = prevEquipmentIdStr;
    }

    /**
     * @return the prevEquipmentRrnStr
     */
    public String getPrevEquipmentRrnStr() {
        return prevEquipmentRrnStr;
    }

    /**
     * @param prevEquipmentRrnStr the prevEquipmentRrnStr to set
     */
    public void setPrevEquipmentRrnStr(String prevEquipmentRrnStr) {
        this.prevEquipmentRrnStr = prevEquipmentRrnStr;
    }

    /**
     * @return the prevOperationIds
     */
    public Collection getPrevOperationIds() {
        if (StringUtils.isNotBlank(this.prevOperationIdStr)) {
            return StringUtils.splitAsList(this.prevOperationIdStr, SEPARATOR);
        }
        return new ArrayList();
    }

    /**
     * @return the prevOperationRrns
     */
    public Collection getPrevOperationRrns() {
        if (StringUtils.isNotBlank(this.prevOperationRrnStr)) {
            return StringUtils.splitAsList(this.prevOperationRrnStr, SEPARATOR);
        }
        return new ArrayList();
    }

    /**
     * @return the prevEquipmentIds
     */
    public Collection getPrevEquipmentIds() {
        if (StringUtils.isNotBlank(this.prevEquipmentIdStr)) {
            return StringUtils.splitAsList(this.prevEquipmentIdStr, SEPARATOR);
        }
        return new ArrayList();
    }

    /**
     * @return the prevEquipmentRrns
     */
    public Collection getPrevEquipmentRrns() {
        if (StringUtils.isNotBlank(this.prevEquipmentRrnStr)) {
            return StringUtils.splitAsList(this.prevEquipmentRrnStr, SEPARATOR);
        }
        return new ArrayList();
    }

    /**
     * @return the operationId
     */
    public String getOperationId() {
        return operationId;
    }

    /**
     * @param operationId the operationId to set
     */
    public void setOperationId(String operationId) {
        this.operationId = operationId;
    }

    /**
     * @return the operationRrn
     */
    public Long getOperationRrn() {
        return operationRrn;
    }

    /**
     * @param operationRrn the operationRrn to set
     */
    public void setOperationRrn(Long operationRrn) {
        this.operationRrn = operationRrn;
    }

    /**
     * @return the equipmentRrn
     */
    public String getEquipmentRrn() {
        return equipmentRrn;
    }

    /**
     * @param equipmentRrn the equipmentRrn to set
     */
    public void setEquipmentRrn(String equipmentRrn) {
        this.equipmentRrn = equipmentRrn;
    }

    /**
     * @return the equipmentRrns
     */
    public Collection getEquipmentRrns() {
        if (StringUtils.isNotBlank(this.equipmentRrn)) {
            return StringUtils.splitAsList(this.equipmentRrn, ",");
        }
        return new ArrayList();
    }

    /**
     * @return the equipmentId
     */
    public String getEquipmentId() {
        return equipmentId;
    }

    /**
     * @param equipmentId the equipmentId to set
     */
    public void setEquipmentId(String equipmentId) {
        this.equipmentId = equipmentId;
    }

    /**
     * @return
     */
    public Collection getEquipmentIds() {
        if (StringUtils.isNotBlank(this.equipmentId)) {
            return StringUtils.splitAsList(this.equipmentId, ",");
        }
        return new ArrayList();
    }

    /**
     * @return the createBy
     */
    public String getCreateBy() {
        return createBy;
    }

    /**
     * @param createBy the createBy to set
     */
    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * @return the modifyBy
     */
    public String getModifyBy() {
        if (StringUtils.isEmpty(modifyBy)) {
            return this.createBy;
        }
        return modifyBy;
    }

    /**
     * @param modifyBy the modifyBy to set
     */
    public void setModifyBy(String modifyBy) {
        this.modifyBy = modifyBy;
    }

    /**
     * @return the modifyTime
     */
    public Date getModifyTime() {
        if (this.modifyTime == null) {
            return this.createTime;
        }
        return modifyTime;
    }

    /**
     * @param modifyTime the modifyTime to set
     */
    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    /**
     * @return the remark
     */
    public String getRemark() {
        return remark;
    }

    /**
     * @param remark the remark to set
     */
    public void setRemark(String remark) {
        this.remark = remark;
    }

}