package com.sa.ibiz.demo.demoapp.controller.demo.vo;

import java.sql.Timestamp;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.util.StringUtils;
import com.sa.ibiz.demo.demo.domain.UserRoleDataDetail;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.Map;
import java.util.Date;
import org.springframework.cglib.beans.BeanCopier;
import javax.validation.constraints.Size;
import java.util.UUID;
import org.springframework.cglib.beans.BeanCopier;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sa.ibiz.demo.ibizutil.security.AuthenticationUser;
import java.math.BigInteger;
import com.alibaba.fastjson.JSONObject;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserRoleDataDetail_EditForm_Main{

    @JsonProperty(access=Access.WRITE_ONLY)
    private Map<String,String> srfparentdata;
    @JsonIgnore
    private Timestamp updatedate;
    @JsonProperty(access=Access.WRITE_ONLY)
    private String srforikey;
    @JsonIgnore
    private String userroledatadetailid;
    @JsonIgnore
    private String userroledatadetailname;
    @JsonIgnore
    private String srftempmode;
    @JsonProperty
    private String srfuf;
    @JsonProperty
    private String srfdeid;
    @JsonProperty(access=Access.WRITE_ONLY)
    private String srfsourcekey;
    @JsonIgnore
    private String userroledataid;
    @JsonIgnore
    private String querymodelname;
    @JsonIgnore
    private Integer isexclude;
    @JsonIgnore
    private String memo;
    @JsonIgnore
    private String querymodelid;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
    @JsonProperty(value = "srfupdatedate")
    public Timestamp getSrfupdatedate(){
        return updatedate;
    }
    @JsonProperty(value = "srfupdatedate")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
    public void setSrfupdatedate(Timestamp updatedate){
        this.updatedate = updatedate;
    }

    @JsonProperty(value = "srforikey")
    public String getSrforikey(){
        return srforikey;
    }
    @JsonProperty(value = "srforikey")
    public void setSrforikey(String srforikey){
        this.srforikey = srforikey;
    }

    @Size(min = 0, max = 100, message = "[数据对象能力明细标识]长度必须在[100]以内!")
    @JsonProperty(value = "srfkey")
    public String getSrfkey(){
        return userroledatadetailid;
    }
    @JsonProperty(value = "srfkey")
    public void setSrfkey(String userroledatadetailid){
        this.userroledatadetailid = userroledatadetailid;
    }

    @Size(min = 0, max = 200, message = "[数据对象能力明细名称]长度必须在[200]以内!")
    @JsonProperty(value = "srfmajortext")
    public String getSrfmajortext(){
        return userroledatadetailname;
    }

    @JsonProperty(value = "srftempmode")
    public String getSrftempmode(){
        return srftempmode;
    }
    @JsonProperty(value = "srftempmode")
    public void setSrftempmode(String srftempmode){
        this.srftempmode = srftempmode;
    }

    @JsonProperty(value = "srfdeid")
    public String getSrfdeid(){
        return srfdeid;
    }
    @JsonProperty(value = "srfdeid")
    public void setSrfdeid(String srfdeid){
        this.srfdeid = srfdeid;
    }

    @Size(min = 0, max = 100, message = "[数据对象能力]长度必须在[100]以内!")
    @JsonProperty(value = "userroledataid")
    public String getUserroledataid(){
        //输出获取外键值方法-用于通过parentdata关系填充外键值id
        if(StringUtils.isEmpty(userroledataid) && this.getSrfparentdata() != null)
        {
            if(this.getSrfparentdata().containsKey("srfparentmode")&& this.getSrfparentdata().get("srfparentmode").equals("DER1N_USERROLEDATADETAIL_USERROLEDATA_USERROLEDATAID"))
                this.userroledataid=this.getSrfparentdata().get("srfparentkey");
        }
        return userroledataid;
    }
    @JsonProperty(value = "userroledataid")
    public void setUserroledataid(String userroledataid){
        this.userroledataid = userroledataid;
    }

    @NotBlank(message = "[查询模型]不允许为空!")
    @Size(min = 0, max = 200, message = "[查询模型]长度必须在[200]以内!")
    @JsonProperty(value = "querymodelname")
    public String getQuerymodelname(){
        return querymodelname;
    }
    @JsonProperty(value = "querymodelname")
    public void setQuerymodelname(String querymodelname){
        this.querymodelname = querymodelname;
    }

    @JsonProperty(value = "isexclude")
    public Integer getIsexclude(){
        return isexclude;
    }
    @JsonProperty(value = "isexclude")
    public void setIsexclude(Integer isexclude){
        this.isexclude = isexclude;
    }

    @Size(min = 0, max = 1000, message = "[备注]长度必须在[1000]以内!")
    @JsonProperty(value = "memo")
    public String getMemo(){
        return memo;
    }
    @JsonProperty(value = "memo")
    public void setMemo(String memo){
        this.memo = memo;
    }

    @Size(min = 0, max = 100, message = "[数据对象能力明细标识]长度必须在[100]以内!")
    @JsonProperty(value = "userroledatadetailid")
    public String getUserroledatadetailid(){
        return userroledatadetailid;
    }
    @JsonProperty(value = "userroledatadetailid")
    public void setUserroledatadetailid(String userroledatadetailid){
        this.userroledatadetailid = userroledatadetailid;
    }

    @Size(min = 0, max = 100, message = "[查询模型]长度必须在[100]以内!")
    @JsonProperty(value = "querymodelid")
    public String getQuerymodelid(){
        //输出获取外键值方法-用于通过parentdata关系填充外键值id
        if(StringUtils.isEmpty(querymodelid) && this.getSrfparentdata() != null)
        {
            if(this.getSrfparentdata().containsKey("srfparentmode")&& this.getSrfparentdata().get("srfparentmode").equals("DER1N_USERROLEDATADETAIL_QUERYMODEL_QUERYMODELID"))
                this.querymodelid=this.getSrfparentdata().get("srfparentkey");
        }
        return querymodelid;
    }
    @JsonProperty(value = "querymodelid")
    public void setQuerymodelid(String querymodelid){
        this.querymodelid = querymodelid;
    }

    public  void fromUserRoleDataDetail(UserRoleDataDetail sourceEntity)  {
        this.fromUserRoleDataDetail(sourceEntity,true);
    }

     /**
	 * do转换为vo
	 * @param sourceEntity do数据对象
	 * @return
	 */
    public  void fromUserRoleDataDetail(UserRoleDataDetail sourceEntity,boolean reset)  {
      BeanCopier copier=BeanCopier.create(UserRoleDataDetail.class, UserRoleDataDetail_EditForm_Main.class, false);
      copier.copy(sourceEntity,this,  null);
      this.toString();
	}

    /**
	 * vo转换为do
	 * @param
	 * @return
	 */
    public  UserRoleDataDetail toUserRoleDataDetail()  {
        UserRoleDataDetail targetEntity =new UserRoleDataDetail();
        BeanCopier copier=BeanCopier.create(UserRoleDataDetail_EditForm_Main.class, UserRoleDataDetail.class, false);
        copier.copy(this, targetEntity, null);
        return targetEntity;
	}

     /**
	 * 新建
	 * @param
	 * @return
	 */
    private boolean isCreate()
    {
    	if((StringUtils.isEmpty(this.srfuf))||this.srfuf.equals("0"))
	    	return true;
    	else
    	    return false;
    }
     /**
	 * 更新
	 * @param
	 * @return
	 */
    private boolean isUpdate()
    {
    	if((!StringUtils.isEmpty(this.srfuf))&&this.srfuf.equals("1"))
	    	return true;
    	else
    	    return false;
    }

}
