package com.vci.client.uif.actions.client;
|
|
import java.util.Map;
|
|
import com.vci.client.bof.ClientBusinessObject;
|
import com.vci.client.bof.ClientLinkObject;
|
import com.vci.client.uif.engine.client.TransferBusinessObjectDialog;
|
import com.vci.client.uif.engine.common.DefaultTableNode;
|
import com.vci.corba.omd.lcm.TransitionVO;
|
import com.vci.mw.ClientContextVariable;
|
|
/**
|
* 跃迁操作
|
* 参数信息:
|
* oid(跃迁对象的oid)
|
* btmname(跃迁对象的类型)
|
* name(跃迁对象的名称、用于显示信息)
|
* @author VCI-STGK006
|
*
|
*/
|
public class TransferAction extends AbstractBusionessOperationAction {
|
|
/**
|
* 方法类
|
*/
|
protected UIFUtils operation =
|
new UIFUtils();
|
|
public TransferAction(){
|
super();
|
}
|
|
@Override
|
public String getKey() {
|
return TRANSFER;
|
}
|
|
@Override
|
public boolean checkHasRight(){
|
// 按BO进行数据权限检查
|
setDataRightCheckType(RightCheckConstants.RIGHT_CHECK_TYPE_B);
|
return super.checkHasRight();
|
}
|
|
@Override
|
public boolean doPost() {
|
//获得业务对象数据
|
Object[] objs = getDataModel().getSelectObjects();
|
if(objs == null || objs.length < 1){
|
return false;
|
}
|
Map<String, String> buttonmap = this.getButtonParams();
|
//modify 2014.03.09 start
|
DefaultTableNode dtn = (DefaultTableNode) objs[0];
|
ClientBusinessObject cbo = null;
|
try {
|
//判断主对象类型
|
if(dtn.getMaterObject() instanceof ClientBusinessObject){
|
//如果是业务类型
|
cbo = (ClientBusinessObject) dtn.getMaterObject();
|
if(cbo == null){
|
UIFUtils.showMessage(ClientContextVariable.getFrame(),
|
"uifmodel.plm.uif.actions.notexistmsg",
|
this.getParameterValue(ValueType.RuntimeData, "t_oid.name", 0));
|
return false;
|
}
|
} else if (dtn.getMaterObject() instanceof ClientLinkObject){
|
//如果是link类型
|
String oid = this.getParameterValue(ValueType.RuntimeData, "t_oid", 0);
|
String btmName = this.getParameterValue(ValueType.RuntimeData, "t_btwname", 0);
|
//如果操作所需参数不存在则直接停止操作
|
if(oid == null || oid.equals("") ||btmName == null || btmName.equals("")){
|
UIFUtils.showMessage(ClientContextVariable.getFrame(),
|
"uifmodel.plm.uif.actions.syserror.parmerror.bo");
|
return false;
|
}
|
//需要重新下载cbo对象
|
cbo = operation
|
.reloadClientBusinessObject(ClientContextVariable.getFrame(), oid, btmName);
|
System.out.println("** TS:" + cbo.getBusinessObject().ts);
|
//对象不存在或者已经被删除
|
if(cbo.getBusinessObject().oid == null || cbo.getBusinessObject().oid.equals("")){
|
UIFUtils.showMessage(ClientContextVariable.getFrame(),
|
"uifmodel.plm.uif.actions.notexistmsg",
|
this.getParameterValue(ValueType.RuntimeData, "t_oid.name", 0));
|
return false;
|
}
|
}
|
|
TransitionVO vo = new TransitionVO();
|
// String boLcStatus = cbo.getLcStatus();
|
// if(boLcStatus == null || boLcStatus==""){
|
// UIFUtils.showMessage(ClientContextVariable.getFrame(),
|
// "uifmodel.plm.uif.actions.syserror.parmerror.nostate");
|
// return false;
|
// }
|
// LifeCyle curLC = null;
|
// try {
|
// curLC = LifeCycleStart.getService().getLifeCycle(cbo.getBusinessObject().lctId);
|
// } catch (Exception e) {
|
// e.getMessage();
|
// }
|
// if(curLC == null){
|
// //TODO:提示出来
|
// UIFUtils.showMessage(ClientContextVariable.getFrame(), "uifmodel.plm.uif.actions.syserror.parmerror.noconfigure");
|
// return false;
|
// }
|
//如果配置了button参数,按参数执行
|
if(buttonmap.get("connect") != null ){
|
vo.connect = buttonmap.get("connect");
|
// for (int l = 0; l < curLC.routes.length; ++l) {
|
// TransitionVO route = curLC.routes[l];
|
// if (route.source.equals(boLcStatus)){
|
// if(buttonmap.get("connect").equals(route.connect)){
|
// vo = route;
|
// break;
|
// }
|
// }
|
// }
|
// if(vo == null){
|
// UIFUtils.showMessage(ClientContextVariable.getFrame(),
|
// "uifmodel.plm.uif.actions.syserror.parmerror.nodo",
|
// buttonmap.get("connect"));
|
// return false;
|
//
|
// }
|
}else if(buttonmap.get("destination") != null ){
|
vo.destination = buttonmap.get("destination");
|
// for (int l = 0; l < curLC.routes.length; ++l) {
|
// TransitionVO route = curLC.routes[l];
|
// if (route.source.equals(boLcStatus)){
|
// if(buttonmap.get("destination").equals(route.destination)){
|
// vo = route;
|
// break;
|
// }
|
// }
|
// }
|
// if(vo == null){
|
// UIFUtils.showMessage(ClientContextVariable.getFrame(),
|
// "uifmodel.plm.uif.actions.syserror.parmerror.notostate",
|
// buttonmap.get("destination"));
|
// return false;
|
// }
|
}else{
|
//如果button没有参数,打开跃迁选择窗口
|
TransferBusinessObjectDialog dialog =
|
new TransferBusinessObjectDialog(ClientContextVariable.getFrame(), cbo);
|
if(!dialog.isOk()){
|
return false;
|
}
|
//获得选择的TransitionVO信息,期中存储了跃迁时需要执行的事件transitionVOEvents
|
vo = dialog.getTransitionVO();
|
}
|
//跃迁
|
boolean result = operation.transferBusinessObject(
|
ClientContextVariable.getFrame(), cbo, vo);
|
return result;
|
} catch (Exception e){
|
UIFUtils.showErrorMessage(
|
ClientContextVariable.getFrame(),
|
"uifmodel.plm.uif.actions.transfererror", e);
|
return false;
|
}
|
//modify 2014.03.09 end
|
}
|
}
|