package com.vci.client.framework.delegate;
|
|
import com.vci.client.ClientSession;
|
import com.vci.client.common.objects.UserEntityObject;
|
import com.vci.client.framework.rightConfig.object.FuncOperationObject;
|
import com.vci.client.framework.rightConfig.object.FunctionObject;
|
import com.vci.client.ui.exception.VCIException;
|
import com.vci.corba.common.VCIError;
|
import com.vci.corba.framework.data.FuncOperationInfo;
|
import com.vci.corba.framework.data.FunctionInfo;
|
|
public class FuncOperationClientDelegate extends ClientBaseDelegate {
|
|
public FuncOperationClientDelegate(UserEntityObject userEntityObject){
|
super(userEntityObject);
|
}
|
|
public FuncOperationClientDelegate(){
|
|
}
|
|
/**
|
* 获取模块下的操作,如果操作ID为空,则获取模块下的全部操作
|
* @param functionId 模块ID
|
* @param operateId 操作ID
|
* @param onlyIsValid onlyIsValid 参数表示是否仅仅返回是生效的操作 true:是 false :不是(此时返回模块下全部的操作,仅在定义模块下的操作时需要返回全部的操作,其它情况需要均只需要返回生效的操作)
|
* @return
|
* @throws VCIException
|
*/
|
public FuncOperationObject[] getFuncOperationByModuleId(String functionId,String operateId, boolean onlyIsValid) throws VCIException {
|
FuncOperationObject[] objs = null;
|
try{
|
FuncOperationInfo[] infos = ClientSession.getFrameworkService().getFuncOperationByModule(functionId,operateId, onlyIsValid);
|
objs = new FuncOperationObject[infos.length];
|
for(int i = 0;i < infos.length ;i++){
|
objs[i] = changeFuncOperationInfoToObj(infos[i]);
|
}
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code), e.messages);
|
}
|
return objs;
|
}
|
/**
|
* 保存模块下的操作
|
* @param funcOperationObjs
|
* @return
|
* @throws VCIException
|
*/
|
public boolean saveFuncOperation(FuncOperationObject[] funcOperationObjs) throws VCIException {
|
boolean res = true;
|
try{
|
FuncOperationInfo[] funcOperationInfos = new FuncOperationInfo[funcOperationObjs.length];
|
for(int i = 0;i < funcOperationObjs.length;i++){
|
funcOperationInfos[i] = changeFuncOperationObjToInfo(funcOperationObjs[i]);
|
}
|
res = ClientSession.getFrameworkService().saveFuncOperation(funcOperationInfos, userEntityInfo);
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code),e.messages);
|
}
|
return res;
|
}
|
|
public boolean updateFuncOperation(String id , String alias, boolean isSelected) throws VCIException {
|
boolean res = false;
|
try{
|
res = ClientSession.getFrameworkService().updateFuncOperation(id, alias, isSelected, userEntityInfo);
|
}catch(VCIError e){
|
throw new VCIException(String.valueOf(e.code), e.messages);
|
}
|
return res;
|
}
|
/**
|
* 移除模块下的操作
|
* @param funcOperationObj
|
* @return
|
* @throws VCIException
|
*/
|
public boolean deleteFuncOperation(FuncOperationObject funcOperationObj) throws VCIException{
|
boolean res = true;
|
try{
|
res = ClientSession.getFrameworkService().deleteFuncOperation(changeFuncOperationObjToInfo(funcOperationObj), userEntityInfo);
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code), e.messages);
|
}
|
return res;
|
}
|
|
/**
|
* 根据操作的标识和模块ID获取挂接关系对象
|
* @param functionId
|
* @param identify
|
* @return
|
* @throws VCIException
|
*/
|
public FuncOperationObject getFuncOperationByIdentify(String functionId,String identify) throws VCIException {
|
try{
|
FuncOperationInfo info = ClientSession.getFrameworkService().getFuncOperationByIdentify(functionId,identify);
|
return changeFuncOperationInfoToObj(info);
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code), e.messages);
|
}
|
}
|
|
private FuncOperationObject changeFuncOperationInfoToObj(FuncOperationInfo info){
|
FuncOperationObject obj = new FuncOperationObject();
|
obj.setId(info.id);
|
obj.setFuncId(info.funcId);
|
obj.setOperId(info.operId);
|
obj.setOperName(info.operName);
|
obj.setOperIndentify(info.operIndentify);
|
obj.setOperAlias(info.operAlias);
|
obj.setOperDesc(info.operDesc);
|
obj.setNumber(info.number);
|
obj.setIsValid(info.isValid);
|
return obj;
|
}
|
|
private FuncOperationInfo changeFuncOperationObjToInfo(FuncOperationObject obj){
|
FuncOperationInfo info = new FuncOperationInfo();
|
info.id = obj.getId() == null ? "" : obj.getId();
|
info.funcId = obj.getFuncId() == null ? "" : obj.getFuncId();
|
info.operId = obj.getOperId() == null ? "" : obj.getOperId();
|
info.operName = obj.getOperName() == null ? "" : obj.getOperName();
|
info.operIndentify = obj.getOperIndentify() == null ? "" : obj.getOperIndentify();
|
info.operAlias = obj.getOperAlias() == null ? "" : obj.getOperAlias();
|
info.operDesc = obj.getOperDesc() == null ? "" : obj.getOperDesc();
|
info.number = obj.getNumber();
|
info.isValid = obj.getIsValid();
|
return info;
|
}
|
/**
|
* 导入操作和模块关系对象
|
* add by caill
|
* */
|
public String saveFunOper(FuncOperationObject funcOperationObject) throws VCIException{
|
|
try {
|
ClientSession.getFrameworkService().saveFunOper(changeFuncOperationObjToInfo(funcOperationObject));
|
} catch (VCIError e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
return null;
|
}
|
/**
|
* 保存操作类型
|
* add by caill
|
* */
|
public boolean saveFuncOperation2(FuncOperationObject funcOperationObject) throws VCIException{
|
|
try {
|
ClientSession.getFrameworkService().saveFuncOperation2(changeFuncOperationObjToInfo(funcOperationObject),userEntityInfo);
|
} catch (VCIError e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
return true;
|
}
|
/**
|
* 覆盖操作类型
|
* add by caill
|
* */
|
public String updateOperation(FuncOperationObject funcOperationObject,String dataOperName,String plFuncOid) throws VCIException{
|
|
try {
|
ClientSession.getFrameworkService().updateOperation(changeFuncOperationObjToInfo(funcOperationObject),userEntityInfo,dataOperName,plFuncOid);
|
} catch (VCIError e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
return null;
|
}
|
/**
|
* 查询同一模块中是否已经存在相同的操作类型
|
* add by caill
|
* */
|
public boolean selSameOper(String dataOperName,String plFuncOid) throws VCIException{
|
boolean same=false;
|
try {
|
same=ClientSession.getFrameworkService().selSameOper(dataOperName,plFuncOid);
|
} catch (VCIError e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
return same;
|
}
|
}
|