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.UserRole;
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 UserRole_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 userroleid;
    @JsonIgnore
    private String userrolename;
    @JsonIgnore
    private String srftempmode;
    @JsonProperty
    private String srfuf;
    @JsonProperty
    private String srfdeid;
    @JsonProperty(access=Access.WRITE_ONLY)
    private String srfsourcekey;
    @JsonIgnore
    private String userroletype;
    @JsonIgnore
    private String userdata;
    @JsonIgnore
    private String userdata2;
    @JsonIgnore
    private String memo;

    @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 userroleid;
    }
    @JsonProperty(value = "srfkey")
    public void setSrfkey(String userroleid){
        this.userroleid = userroleid;
    }

    @Size(min = 0, max = 200, message = "[用户角色名称]长度必须在[200]以内!")
    @JsonProperty(value = "srfmajortext")
    public String getSrfmajortext(){
        return userrolename;
    }

    @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;
    }

    @NotBlank(message = "[用户角色名称]不允许为空!")
    @Size(min = 0, max = 200, message = "[用户角色名称]长度必须在[200]以内!")
    @JsonProperty(value = "userrolename")
    public String getUserrolename(){
        return userrolename;
    }
    @JsonProperty(value = "userrolename")
    public void setUserrolename(String userrolename){
        this.userrolename = userrolename;
    }

    @Size(min = 0, max = 60, message = "[用户角色类型]长度必须在[60]以内!")
    @JsonProperty(value = "userroletype")
    public String getUserroletype(){
        return userroletype;
    }
    @JsonProperty(value = "userroletype")
    public void setUserroletype(String userroletype){
        this.userroletype = userroletype;
    }

    @Size(min = 0, max = 100, message = "[用户数据]长度必须在[100]以内!")
    @JsonProperty(value = "userdata")
    public String getUserdata(){
        return userdata;
    }
    @JsonProperty(value = "userdata")
    public void setUserdata(String userdata){
        this.userdata = userdata;
    }

    @Size(min = 0, max = 100, message = "[用户数据2]长度必须在[100]以内!")
    @JsonProperty(value = "userdata2")
    public String getUserdata2(){
        return userdata2;
    }
    @JsonProperty(value = "userdata2")
    public void setUserdata2(String userdata2){
        this.userdata2 = userdata2;
    }

    @Size(min = 0, max = 2000, message = "[备注]长度必须在[2000]以内!")
    @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 = "userroleid")
    public String getUserroleid(){
        return userroleid;
    }
    @JsonProperty(value = "userroleid")
    public void setUserroleid(String userroleid){
        this.userroleid = userroleid;
    }

    public  void fromUserRole(UserRole sourceEntity)  {
        this.fromUserRole(sourceEntity,true);
    }

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

    /**
	 * vo转换为do
	 * @param
	 * @return
	 */
    public  UserRole toUserRole()  {
        UserRole targetEntity =new UserRole();
        BeanCopier copier=BeanCopier.create(UserRole_EditForm_Main.class, UserRole.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;
    }

}
