package com.vci.client.framework.delegate; import java.util.ArrayList; import com.vci.client.ClientSession; import com.vci.client.common.objects.UserEntityObject; import com.vci.client.common.objects.UserObject; 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; import com.vci.corba.framework.data.OperateInfo; import com.vci.corba.framework.data.UserInfo; /** *

Title: 功能模块

*

Description: 功能模块客户端方法调用

*

Copyright: Copyright {c} 2011

*

Company: VCI

* @author ligang * @time 2011-6-16 * @version 1.0 */ public class FunctionClientDelegate extends ClientBaseDelegate { public FunctionClientDelegate(UserEntityObject userEntityObject) { super(userEntityObject); } public FunctionClientDelegate() { } /** * 保存模块 * @param object * @return * @throws VCIException */ public String saveModule(FunctionObject object) throws VCIException{ String res = ""; try{ res = ClientSession.getFrameworkService().saveModule(changeFunObjectToInfo(object),userEntityInfo); }catch (VCIError e) { e.printStackTrace(); throw new VCIException(String.valueOf(e.code), e.messages); } return res; } /** * 判断第一级数据有没有重名的 * add by caill * */ public boolean firstLevel(String plName) throws VCIException{ try{ return ClientSession.getFrameworkService().firstLevel(plName); }catch (VCIError e) { e.printStackTrace(); throw new VCIException(String.valueOf(e.code), e.messages); } } /** * 覆盖重名的第一级数据 * add by caill * */ public String changeFirstLevel(FunctionObject functionObject,String plName) throws VCIException{ String fParentId=""; try { fParentId= ClientSession.getFrameworkService().changeFirstLevel(changeFunObjectToInfo(functionObject), plName); } catch (VCIError e) { // TODO Auto-generated catch block e.printStackTrace(); } return fParentId; } /** * 判断第二级数据有没有重名的 * add by caill * */ public boolean secondLevel(String plName,String fParentId) throws VCIException{ try{ return ClientSession.getFrameworkService().secondLevel(plName,fParentId); }catch (VCIError e) { e.printStackTrace(); throw new VCIException(String.valueOf(e.code), e.messages); } } /** * 覆盖重名的第二级数据 * add by caill * */ public String changeSecondLevel(FunctionObject functionObject,String plName,String fParentId) throws VCIException{ String sParentId=""; try { sParentId= ClientSession.getFrameworkService().changeSecondLevel(changeFunObjectToInfo(functionObject), plName,fParentId); } catch (VCIError e) { // TODO Auto-generated catch block e.printStackTrace(); } return sParentId; } /** * 判断第三级数据有没有重名的 * add by caill * */ /*public boolean thirdLevel(String plName,String sParentId) throws VCIException{ try{ return ClientSession.getFrameworkService().thirdLevel(plName,sParentId); }catch (VCIError e) { e.printStackTrace(); throw new VCIException(String.valueOf(e.code), e.messages); } }*/ /** * 覆盖重名的第三级数据 * add by caill * */ /* public String changeThirdLevel(FunctionObject functionObject,String plName,String sParentId) throws VCIException{ String tParentId=""; try { tParentId= ClientSession.getFrameworkService().changeThirdLevel(changeFunObjectToInfo(functionObject), plName,sParentId); } catch (VCIError e) { // TODO Auto-generated catch block e.printStackTrace(); } return tParentId; } */ /** * 导入模块对象 * add by caill * */ public boolean importModules(FunctionObject[] funObject,int count) throws VCIException{ boolean b=false; int len = funObject.length; ArrayList funInfoList = new ArrayList(); for(int i = count ; i根据模块名称查询出当前模块对象的信息

* * @author 李刚 * @time 2013-2-4 * @param moduleName * @return * @throws VCIException */ public FunctionObject getModuleByName(String moduleName)throws VCIException{ FunctionObject obj = null; try { FunctionInfo info = ClientSession.getFrameworkService().getModuleByName(moduleName); obj = changeFunInfoToObject(info); }catch (VCIError e) { throw new VCIException(String.valueOf(e.code),e.messages); } return obj; } /** * 通过模块ID检查该模块子级对象是模块还是操作 * @param moduleId * @return 0表示没有模块也没有操作,1表示有模块,2表示有操作 * @throws VCIException */ public int checkChildObject(String moduleId) throws VCIException { long res = 0; try{ res = ClientSession.getFrameworkService().checkChildObject(moduleId); }catch (VCIError e) { e.printStackTrace(); throw new VCIException(String.valueOf(e.code),e.messages); } return (int)res; } /** * *

根据模块CLASS信息查询出当前模块对象的信息

* * @author llb * @time 2013-2-4 * @param classPath * @return * @throws VCIException */ public FunctionObject getModuleByClass(String classPath)throws VCIException{ FunctionObject obj = null; try { FunctionInfo info = ClientSession.getFrameworkService().getModuleByClass(classPath); obj = changeFunInfoToObject(info); }catch (VCIError e) { throw new VCIException(String.valueOf(e.code),e.messages); } return obj; } /** * *

根据模块funcOid信息查询出模块对象的信息

* * @author xchao * @time 2014-6-6 * @param funcOid * @return * @throws VCIException */ public FunctionObject getFunctionObjectById(String funcOid)throws VCIException{ FunctionObject obj = null; try { FunctionInfo info = ClientSession.getFrameworkService().getFunctionObjectById(funcOid); obj = changeFunInfoToObject(info); }catch (VCIError e) { throw new VCIException(String.valueOf(e.code),e.messages); } return obj; } /** *

Description: plfunction表对象和cobra对象的转换

* *@author xf *@time 2012-5-16 *@return FunctionObject * @param info * @return */ public FunctionObject changeFunInfoToObject(FunctionInfo info) { FunctionObject object = new FunctionObject(); object.setId(info.id); //object.setLayer(info.layer); object.setName(info.name); object.setParentId(info.parentId); object.setResourceC(info.resourceC); object.setSuffixC(info.suffixC); object.setResourceB(info.resourceB); object.setSuffixB(info.suffixB); object.setDesc(info.desc); //object.setModuleNo(info.moduleNo); object.setSequence(info.seq); object.setImage(info.image); object.setIsValid(info.isValid); object.setAliasName(info.aliasName); object.setResourceDotNet(info.resourceDotNet); object.setResourceMobile(info.resourceMobile); return object ; } /** *

Description: plfunction中cobra对象和前端对象的转换

* *@author xf *@time 2012-5-15 *@return FunctionObject * @param info * @return */ public FunctionInfo changeFunObjectToInfo(FunctionObject object) { FunctionInfo info = new FunctionInfo(); info.id = object.getId() == null ? "" : object.getId(); //info.layer = object.getLayer(); info.name = object.getName() == null ? "" : object.getName(); info.parentId = object.getParentId() == null ? "" : object.getParentId(); info.resourceC = object.getResourceC() == null ? "" : object.getResourceC(); info.suffixC = object.getSuffixC() == null ? "" : object.getSuffixC(); info.resourceB = object.getResourceB() == null ? "" : object.getResourceB(); info.suffixB = object.getSuffixB() == null ? "" : object.getSuffixB(); info.desc = object.getDesc() == null ? "" : object.getDesc(); info.seq = object.getSequence(); //info.moduleNo = object.getModuleNo(); info.image = object.getImage() == null ? "" : object.getImage(); info.isValid = object.getIsValid(); info.aliasName = object.getAliasName() == null ? "" : object.getAliasName(); info.resourceDotNet = object.getResourceDotNet() == null ? "" : object.getResourceDotNet(); info.resourceMobile = object.getResourceMobile() == null ? "" : object.getResourceMobile(); return info; } }