package com.vci.client.uif.actions.client;
|
|
import com.vci.client.bof.ClientBusinessObject;
|
import com.vci.client.bof.ClientLinkObject;
|
import com.vci.client.fm.FileObject;
|
import com.vci.client.uif.engine.common.IDataNode;
|
import com.vci.mw.ClientContextVariable;
|
|
/**
|
* 文档文件上传按钮
|
* @author VCI-STGK006
|
*
|
*/
|
public class ChooseDocAction extends DoseNotSelectDataHasRightCheckAction {
|
|
/**
|
* 文件上传下载方法
|
*/
|
private FileOperation fopreation = new FileOperation();
|
|
public ChooseDocAction(){
|
super();
|
}
|
|
@Override
|
public String getKey() {
|
return CHOOSE_DOC;
|
}
|
|
@Override
|
public boolean checkHasRight(){
|
// 按BO进行数据权限检查
|
setDataRightCheckType(RightCheckConstants.RIGHT_CHECK_TYPE_B);
|
return super.checkHasRight();
|
}
|
|
|
@Override
|
public boolean doPost() {
|
try {
|
//显示创建窗口
|
Object obj = getRegionPanel().getSourceData();
|
String fromoid = "";
|
if(obj instanceof IDataNode){
|
if(((IDataNode) obj).getMaterObject() instanceof ClientBusinessObject){
|
ClientBusinessObject cbo = (ClientBusinessObject) ((IDataNode) obj).getMaterObject();
|
fromoid = cbo.getBusinessObject().oid;
|
} else if (((IDataNode) obj).getMaterObject() instanceof ClientLinkObject) {
|
ClientLinkObject clo = (ClientLinkObject) ((IDataNode) obj).getMaterObject();
|
fromoid = clo.getLinkObject().toOid;
|
}
|
}
|
if(fromoid == null ||fromoid.equals("")){
|
UIFUtils.showErrorMessage(ClientContextVariable.getFrame(),
|
"uifmodel.plm.uif.actions.uploadfileerror", new Exception("文件上传失败:需要添加附件的对象不存在!"));
|
return false;
|
}
|
FileObject[] fos = fopreation.selectUploadFile(
|
ClientContextVariable.getFrame(), "", null, true, 9, fromoid);
|
if(fos != null && fos.length > 0){
|
UIFUtils.showMessage(ClientContextVariable.getFrame(),
|
"uifmodel.plm.uif.actions.uploadfilesuccessmsg");
|
}
|
return true;
|
} catch (Exception e){
|
UIFUtils.showErrorMessage(ClientContextVariable.getFrame(),
|
"uifmodel.plm.uif.actions.uploadfileerror", e);
|
return false;
|
}
|
}
|
}
|