/**
|
*
|
*/
|
package com.vci.client.framework.delegate;
|
|
import java.io.Serializable;
|
import java.text.ParseException;
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
|
import com.vci.corba.common.VCIError;
|
import com.vci.corba.workflow.data.QueryParamInfo;
|
import com.vci.corba.common.data.UserEntityInfo;
|
import com.vci.client.common.objects.UserEntityObject;
|
import com.vci.client.ui.exception.VCIException;
|
import com.vci.common.objects.QueryParam;
|
|
/**
|
* 客户端登录的用户信息转换
|
* @author 刘迪
|
*
|
*/
|
public class ClientBaseDelegate implements Serializable {
|
/**
|
*
|
*/
|
private static final long serialVersionUID = -6808139609741384733L;
|
protected UserEntityObject userEntityObject;
|
protected UserEntityInfo userEntityInfo;
|
|
public ClientBaseDelegate() {
|
|
}
|
|
public ClientBaseDelegate(UserEntityObject userEntityObject){
|
this.userEntityObject = userEntityObject;
|
this.userEntityInfo = UserEntityClientDelegate.changeUserEntityToInfo(userEntityObject);
|
}
|
public UserEntityObject getUserEntityObject() {
|
return userEntityObject;
|
}
|
public void setUserEntityObject(UserEntityObject userEntityObject) {
|
this.userEntityObject = userEntityObject;
|
this.userEntityInfo = UserEntityClientDelegate.changeUserEntityToInfo(userEntityObject);
|
}
|
public void setUserEntityInfo(UserEntityInfo userEntityInfo) {
|
this.userEntityInfo = userEntityInfo;
|
}
|
public UserEntityInfo getUserEntityInfo(){
|
return this.userEntityInfo;
|
}
|
|
public final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
private SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
|
private String defaultDateString = "1977-01-01 00:00:00";
|
|
public final String DATE_FORMAT_OLD = "yyyyMMdd HH:mm:ss";
|
private SimpleDateFormat sdf_old = new SimpleDateFormat(DATE_FORMAT_OLD);
|
|
public String getStringFromDate(Date date){
|
String res = defaultDateString;
|
try{
|
if(date != null){
|
res = sdf.format(date);
|
}
|
}catch(Exception ex){
|
ex.printStackTrace();
|
}
|
return res;
|
}
|
public Date getDateFromString(String string){
|
Date res = new Date();
|
try {
|
res = sdf.parse(defaultDateString);
|
} catch (ParseException e) {
|
e.printStackTrace();
|
}
|
try{
|
res = sdf.parse(string);
|
}catch(Exception ex){
|
try{
|
res = sdf_old.parse(string);
|
} catch (Exception ex1){
|
ex1.printStackTrace();
|
}
|
}
|
return res;
|
}
|
|
/**
|
*
|
* <p>Description: 将Corba的异常转换为客户端异常</p>
|
*
|
* @author Administrator
|
* @time 2011-7-18
|
* @param e
|
* @return
|
*/
|
public VCIException convertVCIErrorToVCIException(VCIError e) {
|
return new VCIException(String.valueOf(e.code), e.messages);
|
}
|
|
// protected QueryParamInfo convertQueryParam(QueryParam obj){
|
// QueryParamInfo info = new QueryParamInfo();
|
// info.customQueryString = obj.getCustomQueryString();
|
// info.pageIndex = obj.getPageIndex();
|
// info.pageSize = obj.getPageSize();
|
// return info;
|
// }
|
// protected QueryParam convertQueryParam(QueryParamInfo info){
|
// QueryParam obj = new QueryParam();
|
// obj.setCustomQueryString(info.customQueryString);
|
// obj.setPageIndex(info.pageIndex);
|
// obj.setPageSize(info.pageSize);
|
// return obj;
|
// }
|
}
|