package com.vci.server.portal.tools;
|
|
import java.text.DateFormat;
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
|
import com.vci.corba.portal.data.PLAction;
|
import com.vci.corba.portal.data.PLActionCls;
|
import com.vci.corba.portal.data.PLActionParam;
|
import com.vci.corba.portal.data.PLCommandParameter;
|
import com.vci.corba.portal.data.PLPageDefination;
|
import com.vci.corba.portal.data.PLUILayout;
|
import com.vci.corba.portal.data.PLTabButton;
|
import com.vci.corba.portal.data.PLTabPage;
|
import com.vci.corba.portal.data.PLTypeAction;
|
import com.vci.corba.portal.data.PortalVI;
|
import com.vci.server.portal.entity.PLActionClsEntity;
|
import com.vci.server.portal.entity.PLActionEntity;
|
import com.vci.server.portal.entity.PLActionParamEntity;
|
import com.vci.server.portal.entity.PLCommandParameterEntity;
|
import com.vci.server.portal.entity.PLPageDefinationEntity;
|
import com.vci.server.portal.entity.PLUILayoutEntity;
|
import com.vci.server.portal.entity.PLTabButtonEntity;
|
import com.vci.server.portal.entity.PLTabPageEntity;
|
import com.vci.server.portal.entity.PLTypeActionEntity;
|
import com.vci.server.portal.entity.PortalVIEntity;
|
|
public class ServerTool {
|
|
private static String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
private static DateFormat df = new SimpleDateFormat(DATE_FORMAT);
|
|
/**
|
* 根据corba视图对象(PortalVI)
|
* 返回Hibernate视图对象(PortalVIEntity)
|
* @param obj
|
* @return
|
*/
|
public static PortalVIEntity getPortalVIEntity(PortalVI obj){
|
if(obj == null){
|
return null;
|
}
|
PortalVIEntity ent = new PortalVIEntity();
|
ent.setId(obj.id);
|
ent.setTypeFlag(obj.typeFlag);
|
ent.setTypeName(obj.typeName);
|
ent.setViName(obj.viName);
|
ent.setViType(obj.viType);
|
ent.setPrm(obj.prm);
|
return ent;
|
}
|
|
/**
|
* 根据Hibernate视图对象(PortalVIEntity)
|
* 返回corba视图对象(PortalVI)
|
* @param ent
|
* @return
|
*/
|
public static PortalVI getPortalVI(PortalVIEntity ent){
|
if(ent == null){
|
return null;
|
}
|
PortalVI obj = new PortalVI();
|
String value = ent.getId();
|
obj.id = value == null ? "" : value;
|
|
obj.typeFlag = ent.getTypeFlag();
|
|
value = ent.getTypeName();
|
obj.typeName = value == null ? "" : value;
|
|
value = ent.getViName();
|
obj.viName = value == null ? "" : value;
|
|
obj.viType = ent.getViType();
|
|
value = ent.getPrm();
|
obj.prm = value == null ? "" : value;
|
|
return obj;
|
}
|
|
/**
|
* 获取初始值对象
|
* @param obj
|
* @return
|
*/
|
public static PortalVI getDefaultPortalVI(){
|
PortalVI obj = new PortalVI();
|
obj.id = "";
|
obj.typeFlag = 0;
|
obj.typeName = "";
|
obj.viName = "";
|
obj.viType = 0;
|
obj.prm = "";
|
|
return obj;
|
}
|
|
public static PLTypeActionEntity getPLTypeActionEntity(PLTypeAction obj){
|
if(obj == null){
|
return null;
|
}
|
PLTypeActionEntity ent = new PLTypeActionEntity();
|
ent.setPlOId(obj.plOId);
|
ent.setActionoId(obj.actionoId);
|
ent.setTypeName(obj.typeName);
|
return ent;
|
}
|
|
public static PLTypeAction getPLTypeAction(PLTypeActionEntity ent){
|
if(ent == null){
|
return null;
|
}
|
PLTypeAction obj = new PLTypeAction();
|
String plOid = ent.getPlOId();
|
obj.plOId = plOid==null?"":plOid;
|
String actionOid = ent.getActionoId();
|
obj.actionoId = actionOid==null?"":actionOid;
|
String typeName = ent.getTypeName();
|
obj.typeName = typeName==null?"":typeName;
|
return obj;
|
}
|
|
public static PLActionEntity getPLActionEntity(PLAction obj){
|
if(obj == null){
|
return null;
|
}
|
PLActionEntity ent = new PLActionEntity();
|
ent.setPlOId(obj.plOId);
|
ent.setPlCode(obj.plCode);
|
ent.setPlName(obj.plName);
|
ent.setPlBSUrl(obj.plBSUrl);
|
ent.setPlCSClass(obj.plCSClass);
|
ent.setPlDesc(obj.plDesc);
|
ent.setPlTypeType(obj.plTypeType);
|
ent.setPlCreateUser(obj.plCreateUser);
|
ent.setPlModifyUser(obj.plModifyUser);
|
ent.setPlLicensOrs(obj.plLicensOrs);
|
ent.setPlActionCls(obj.plActionCls);
|
return ent;
|
}
|
|
public static PLAction getPLAction(PLActionEntity ent){
|
if(ent == null){
|
return null;
|
}
|
PLAction obj = new PLAction();
|
|
String value = ent.getPlOId();
|
obj.plOId = value == null ? "" : value;
|
|
value = ent.getPlCode();
|
obj.plCode = value == null ? "" : value;
|
|
value = ent.getPlName();
|
obj.plName = value == null ? "" : value;
|
|
value = ent.getPlBSUrl();
|
obj.plBSUrl = value == null ? "" : value;
|
|
value = ent.getPlCSClass();
|
obj.plCSClass = value == null ? "" : value;
|
|
value = ent.getPlDesc();
|
obj.plDesc = value == null ? "" : value;
|
|
value = ent.getPlTypeType();
|
obj.plTypeType = value == null ? "" : value;
|
|
Date dateValue = ent.getPlCreateTime();
|
obj.plCreateTime = dateValue == null ? 0 : dateValue.getTime();
|
|
value = ent.getPlCreateUser();
|
obj.plCreateUser = value == null ? "" : value;
|
|
dateValue = ent.getPlModifyTime();
|
obj.plModifyTime = dateValue == null ? 0 : dateValue.getTime();
|
|
value = ent.getPlModifyUser();
|
obj.plModifyUser = value == null ? "" : value;
|
|
value = ent.getPlLicensOrs();
|
obj.plLicensOrs = value == null ? "" : value;
|
|
value = ent.getPlActionCls();
|
obj.plActionCls = value == null ? "" : value;
|
|
return obj;
|
}
|
|
public static PLAction getDefaultPLAction(){
|
PLAction obj = new PLAction();
|
obj.plOId = "";
|
obj.plCode = "";
|
obj.plName = "";
|
obj.plBSUrl = "";
|
obj.plCSClass = "";
|
obj.plTypeType = "";
|
obj.plCreateTime = 0;
|
obj.plCreateUser = "";
|
obj.plModifyTime = 0;
|
obj.plModifyUser = "";
|
obj.plLicensOrs = "";
|
|
return obj;
|
}
|
|
public static PLCommandParameterEntity getPLCommandParameterEntity(PLCommandParameter obj){
|
if(obj == null){
|
return null;
|
}
|
PLCommandParameterEntity ent = new PLCommandParameterEntity();
|
ent.setPlOId(obj.plOId);
|
ent.setPlCommandOId(obj.plCommandOId);
|
ent.setPlKey(obj.plKey);
|
ent.setPlValue(obj.plValue);
|
ent.setPlCreateUser(obj.plCreateUser);
|
ent.setPlModifyUser(obj.plModifyUser);
|
ent.setPlLicensOrs(obj.plLicensOrs);
|
return ent;
|
}
|
|
public static PLCommandParameter getPLCommandParameter(PLCommandParameterEntity ent){
|
if(ent == null){
|
return null;
|
}
|
PLCommandParameter obj = new PLCommandParameter();
|
String value = ent.getPlOId();
|
obj.plOId = value == null ? "" : value;
|
|
value = ent.getPlCommandOId();
|
obj.plCommandOId = value == null ? "" : value;
|
|
value = ent.getPlKey();
|
obj.plKey = value == null ? "" : value;
|
|
value = ent.getPlValue();
|
obj.plValue = value == null ? "" : value;
|
|
Date dateValue = ent.getPlCreateTime();
|
obj.plCreateTime = dateValue == null ? 0 : dateValue.getTime();
|
|
value = ent.getPlCreateUser();
|
obj.plCreateUser = value == null ? "" : value;
|
|
dateValue = ent.getPlModifyTime();
|
obj.plModifyTime = dateValue == null ? 0 : dateValue.getTime();
|
|
value = ent.getPlModifyUser();
|
obj.plModifyUser = value == null ? "" : value;
|
|
value = ent.getPlLicensOrs();
|
obj.plLicensOrs = value == null ? "" : value;
|
return obj;
|
}
|
|
public static PLCommandParameter getDefaultPLCommandParameter(){
|
PLCommandParameter obj = new PLCommandParameter();
|
obj.plOId = "";
|
obj.plCommandOId = "";
|
obj.plKey = "";
|
obj.plValue = "";
|
obj.plCreateTime = 0;
|
obj.plCreateUser = "";
|
obj.plModifyTime = 0;
|
obj.plModifyUser = "";
|
obj.plLicensOrs = "";
|
return obj;
|
}
|
|
public static PLUILayoutEntity getPLUILayoutEntity(PLUILayout obj){
|
if(obj == null){
|
return null;
|
}
|
PLUILayoutEntity ent = new PLUILayoutEntity();
|
ent.setPlOId(obj.plOId);
|
ent.setPlCode(obj.plCode);
|
ent.setPlName(obj.plName);
|
ent.setPlRelatedType(obj.plRelatedType);
|
ent.setPlStyle(obj.plStyle);
|
ent.setPlDesc(obj.plDesc);
|
ent.setPlIsShowForm(obj.plIsShowForm);
|
ent.setPlIsShowTab(obj.plIsShowTab);
|
ent.setPlIsShowNavigator(obj.plIsShowNavigator);
|
ent.setPlCreateUser(obj.plCreateUser);
|
ent.setPlModifyUser(obj.plModifyUser);
|
ent.setPlLicensOrs(obj.plLicensOrs);
|
return ent;
|
}
|
|
public static PLUILayout getPLUILayout(PLUILayoutEntity ent){
|
if(ent == null){
|
return null;
|
}
|
PLUILayout obj = new PLUILayout();
|
String value = ent.getPlOId();
|
obj.plOId = value == null ? "" : value;
|
|
value = ent.getPlCode();
|
obj.plCode = value == null ? "" : value;
|
|
value = ent.getPlName();
|
obj.plName = value == null ? "" : value;
|
|
value = ent.getPlRelatedType();
|
obj.plRelatedType = value == null ? "" : value;
|
|
value = ent.getPlStyle();
|
obj.plStyle = value == null ? "" : value;
|
|
value = ent.getPlDesc();
|
obj.plDesc = value == null ? "" : value;
|
|
Short intValue = ent.getPlIsShowForm();
|
obj.plIsShowForm = intValue == null ? 0 : intValue;
|
|
intValue = ent.getPlIsShowTab();
|
obj.plIsShowTab = intValue == null ? 0 : intValue;
|
|
intValue = ent.getPlIsShowNavigator();
|
obj.plIsShowNavigator = intValue == null ? 0 : intValue;
|
|
Date dateValue = ent.getPlCreateTime();
|
obj.plCreateTime = dateValue == null ? 0 : dateValue.getTime();
|
|
value = ent.getPlCreateUser();
|
obj.plCreateUser = value == null ? "" : value;
|
|
dateValue = ent.getPlModifyTime();
|
obj.plModifyTime = dateValue == null ? 0 : dateValue.getTime();
|
|
value = ent.getPlModifyUser();
|
obj.plModifyUser = value == null ? "" : value;
|
|
value = ent.getPlLicensOrs();
|
obj.plLicensOrs = value == null ? "" : value;
|
return obj;
|
}
|
|
public static PLUILayout getDefaultPLUILayout(){
|
PLUILayout obj = new PLUILayout();
|
obj.plOId = "";
|
obj.plCode = "";
|
obj.plName = "";
|
obj.plRelatedType = "";
|
obj.plDesc = "";
|
obj.plIsShowForm = 0;
|
obj.plIsShowTab = 0;
|
obj.plIsShowNavigator = 0;
|
obj.plCreateTime = 0;
|
obj.plCreateUser = "";
|
obj.plModifyTime = 0;
|
obj.plModifyUser = "";
|
obj.plLicensOrs = "";
|
return obj;
|
}
|
|
public static PLTabButtonEntity getPLTabButtonEntity(PLTabButton obj){
|
if(obj == null){
|
return null;
|
}
|
PLTabButtonEntity ent = new PLTabButtonEntity();
|
ent.setPlOId(obj.plOId);
|
ent.setPlTableOId(obj.plTableOId);
|
ent.setPlPageOId(obj.plPageOId);
|
ent.setPlActionOId(obj.plActionOId);
|
ent.setPlLabel(obj.plLabel);
|
ent.setPlDesc(obj.plDesc);
|
ent.setPlSeq(obj.plSeq);
|
ent.setPlAreaType(obj.plAreaType);
|
ent.setPlCreateUser(obj.plCreateUser);
|
ent.setPlModifyUser(obj.plModifyUser);
|
ent.setPlLicensOrs(obj.plLicensOrs);
|
ent.setPlParentOid(obj.plParentOid);
|
ent.setIconPath(obj.iconPath);
|
ent.setAuthorization(obj.authorization);
|
ent.setDisplayMode(obj.displayMode);
|
//add by caill
|
ent.setShow(obj.show);
|
return ent;
|
}
|
|
public static PLTabButton getPLTabButton(PLTabButtonEntity ent){
|
if(ent == null){
|
return null;
|
}
|
PLTabButton obj = new PLTabButton();
|
String value = ent.getPlOId();
|
obj.plOId = value == null ? "" : value;
|
|
value = ent.getPlTableOId();
|
obj.plTableOId = value == null ? "" : value;
|
|
value = ent.getPlPageOId();
|
obj.plPageOId = value == null ? "" : value;
|
|
value = ent.getPlActionOId();
|
obj.plActionOId = value == null ? "" : value;
|
|
value = ent.getPlLabel();
|
obj.plLabel = value == null ? "" : value;
|
|
value = ent.getPlAreaType();
|
obj.plAreaType = value == null ? "" : value;
|
|
value = ent.getPlDesc();
|
obj.plDesc = value == null ? "" : value;
|
|
Short intValue = ent.getPlSeq();
|
obj.plSeq = intValue == null ? 0 : intValue;
|
|
Date dateValue = ent.getPlCreateTime();
|
obj.plCreateTime = dateValue == null ? 0 : dateValue.getTime();
|
|
value = ent.getPlCreateUser();
|
obj.plCreateUser = value == null ? "" : value;
|
|
dateValue = ent.getPlModifyTime();
|
obj.plModifyTime = dateValue == null ? 0 : dateValue.getTime();
|
|
value = ent.getPlModifyUser();
|
obj.plModifyUser = value == null ? "" : value;
|
|
value = ent.getPlLicensOrs();
|
obj.plLicensOrs = value == null ? "" : value;
|
|
value = ent.getPlParentOid();
|
obj.plParentOid = value == null? "" : value;
|
|
value = ent.getIconPath();
|
obj.iconPath = value == null ? "" : value;
|
|
value = ent.getAuthorization();
|
obj.authorization = value == null ? "" : value;
|
|
value = ent.getDisplayMode();
|
obj.displayMode = value == null ? "" : value;
|
//add by caill
|
value = ent.getShow();
|
obj.show = value == null ? "" : value;
|
|
return obj;
|
}
|
|
public static PLTabButton getDefaultPLTabButton(){
|
PLTabButton obj = new PLTabButton();
|
obj.plOId = "";
|
obj.plTableOId = "";
|
obj.plPageOId = "";
|
obj.plActionOId = "";
|
obj.plLabel = "";
|
obj.plDesc = "";
|
obj.plSeq = 0;
|
obj.plCreateTime = 0;
|
obj.plCreateUser = "";
|
obj.plModifyTime = 0;
|
obj.plModifyUser = "";
|
obj.plLicensOrs = "";
|
return obj;
|
}
|
|
public static PLTabPageEntity getPLTabPageEntity(PLTabPage obj){
|
if(obj == null){
|
return null;
|
}
|
PLTabPageEntity ent = new PLTabPageEntity();
|
ent.setPlOId(obj.plOId);
|
ent.setPlCode(obj.plCode);
|
ent.setPlName(obj.plName);
|
ent.setPlIsOpen(obj.plIsOpen);
|
ent.setPlLabel(obj.plLabel);
|
ent.setPlDesc(obj.plDesc);
|
ent.setPlSeq(obj.plSeq);
|
ent.setPlContextOId(obj.plContextOId);
|
ent.setPlCreateUser(obj.plCreateUser);
|
ent.setPlModifyUser(obj.plModifyUser);
|
ent.setPlLicensOrs(obj.plLicensOrs);
|
ent.setPlOpenExpression(obj.plOpenExpression);
|
ent.setAreaType(obj.plAreaType);
|
ent.setPlUIParser(obj.plUIParser);
|
ent.setPlExtAttr(obj.plExtAttr);
|
return ent;
|
}
|
|
public static PLTabPage getPLTabPage(PLTabPageEntity ent){
|
if(ent == null){
|
return null;
|
}
|
PLTabPage obj = new PLTabPage();
|
String value = ent.getPlOId();
|
obj.plOId = value == null ? "" : value;
|
|
value = ent.getPlCode();
|
obj.plCode = value == null ? "" : value;
|
|
value = ent.getPlName();
|
obj.plName = value == null ? "" : value;
|
|
Short intValue = ent.getPlIsOpen();
|
obj.plIsOpen = intValue == null ? 0 : intValue;
|
|
value = ent.getPlLabel();
|
obj.plLabel = value == null ? "" : value;
|
|
value = ent.getPlDesc();
|
obj.plDesc = value == null ? "" : value;
|
|
intValue = ent.getPlSeq();
|
obj.plSeq = intValue == null ? 0 : intValue;
|
|
value = ent.getPlContextOId();
|
obj.plContextOId = value == null ? "" : value;
|
|
Date dateValue = ent.getPlCreateTime();
|
obj.plCreateTime = dateValue == null ? 0 : dateValue.getTime();
|
|
value = ent.getPlCreateUser();
|
obj.plCreateUser = value == null ? "" : value;
|
|
dateValue = ent.getPlModifyTime();
|
obj.plModifyTime = dateValue == null ? 0 : dateValue.getTime();
|
|
value = ent.getPlModifyUser();
|
obj.plModifyUser = value == null ? "" : value;
|
|
value = ent.getPlLicensOrs();
|
obj.plLicensOrs = value == null ? "" : value;
|
|
value = ent.getPlOpenExpression();
|
obj.plOpenExpression = value == null ? "" : value;
|
|
intValue = ent.getAreaType();
|
obj.plAreaType = intValue == null ? 0 : intValue;
|
|
value = ent.getPlUIParser();
|
obj.plUIParser = value == null ? "" : value;
|
|
value = ent.getPlExtAttr();
|
obj.plExtAttr = value == null ? "" : value;
|
|
return obj;
|
}
|
|
public static PLTabPage getDefaultPLTabPage(){
|
PLTabPage obj = new PLTabPage();
|
obj.plOId = "";
|
obj.plCode = "";
|
obj.plName = "";
|
obj.plIsOpen = 0;
|
obj.plLabel = "";
|
obj.plDesc = "";
|
obj.plSeq = 0;
|
obj.plContextOId = "";
|
obj.plCreateTime = 0;
|
obj.plCreateUser = "";
|
obj.plModifyTime = 0;
|
obj.plModifyUser = "";
|
obj.plLicensOrs = "";
|
obj.plUIParser = "";
|
obj.plExtAttr = "";
|
return obj;
|
}
|
|
public static PLPageDefinationEntity getPLPageDefinationEntity(PLPageDefination obj){
|
if(obj == null){
|
return null;
|
}
|
PLPageDefinationEntity ent = new PLPageDefinationEntity();
|
ent.setPlOId(obj.plOId);
|
ent.setPlTabPageOId(obj.plTabPageOId);
|
ent.setPlType(obj.plType);
|
ent.setPlDefination(obj.plDefination);
|
ent.setName(obj.name);
|
ent.setDesc(obj.desc);
|
ent.setSeq(obj.seq);
|
return ent;
|
}
|
|
public static PLPageDefination getPLPageDefination(PLPageDefinationEntity ent){
|
if(ent == null){
|
return null;
|
}
|
PLPageDefination obj = new PLPageDefination();
|
String value = ent.getPlOId();
|
obj.plOId = value == null ? "" : value;
|
|
value = ent.getPlTabPageOId();
|
obj.plTabPageOId = value == null ? "" : value;
|
|
Short intValue = ent.getPlType();
|
obj.plType = intValue == null ? 1 : intValue;
|
|
value = ent.getPlDefination();
|
obj.plDefination = value == null ? "" : value;
|
|
value = ent.getName();
|
obj.name = value == null ? "" : value;
|
|
value = ent.getDesc();
|
obj.desc = value == null ? "" : value;
|
|
intValue = ent.getSeq();
|
obj.seq = intValue == null ? 0 : intValue;
|
|
return obj;
|
}
|
|
public static PLPageDefination getDefaultPLPageDefination(){
|
PLPageDefination obj = new PLPageDefination();
|
obj.plOId = "";
|
obj.plTabPageOId = "";
|
obj.plType = 1;
|
obj.plDefination = "";
|
|
return obj;
|
}
|
|
/**
|
* 转换得到PLActionCls对象
|
* @param entity
|
* @return
|
*/
|
public static PLActionCls getPLActionCls(PLActionClsEntity entity) {
|
if(entity == null) {
|
return new PLActionCls();
|
}
|
PLActionCls action = new PLActionCls();
|
action.id = entity.getId() == null ? "" : entity.getId();
|
action.name = entity.getName() == null ? "" : entity.getName();
|
action.pid = entity.getPid() == null ? "" : entity.getPid();
|
action.description = entity.getDescription() == null ? "" : entity.getDescription();
|
action.creator = entity.getCreator() == null ? "" : entity.getCreator();
|
action.createTime = entity.getCreateTime() == null ? 0 : entity.getCreateTime().getTime();
|
action.serialno = entity.getSerialNo();
|
return action;
|
}
|
|
/**
|
* 转化得到PLActionClsEntity对象
|
* @param cls
|
* @return
|
*/
|
public static PLActionClsEntity getPLActionClsEntity(PLActionCls cls) {
|
PLActionClsEntity entity = new PLActionClsEntity();
|
entity.setOid(cls.id);
|
entity.setName(cls.name);
|
entity.setPid(cls.pid);
|
entity.setSerialNo(cls.serialno);
|
entity.setDescription(cls.description);
|
entity.setCreator(cls.creator);
|
entity.setCreateTime(new Date());
|
return entity;
|
}
|
|
/**
|
* 转化得到PLActionParam对象
|
* @param entity
|
* @return
|
*/
|
public static PLActionParam getPLActionParam(PLActionParamEntity entity) {
|
if(entity == null) {
|
return new PLActionParam();
|
}
|
PLActionParam param = new PLActionParam();
|
|
param.oid = entity.getOid() == null ? "" : entity.getOid();
|
param.name = entity.getName() == null ? "" : entity.getName();
|
param.defaultValue = entity.getDefaultValue() == null ? "" : entity.getDefaultValue();
|
param.description = entity.getDescription() == null ? "" : entity.getDescription();
|
param.action = entity.getAction() == null ? "" : entity.getAction();
|
|
return param;
|
}
|
|
/**
|
* 转化得到PLActionParamEntity对象
|
* @param param
|
* @return
|
*/
|
public static PLActionParamEntity getPLActionParmaEntity(PLActionParam param) {
|
PLActionParamEntity entity = new PLActionParamEntity();
|
|
entity.setOid(param.oid);
|
entity.setName(param.name);
|
entity.setDefaultValue(param.defaultValue);
|
entity.setDescription(param.description);
|
entity.setAction(param.action);
|
|
return entity;
|
}
|
}
|