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;
|
|
/**
|
* <p>Title: 功能模块</p>
|
* <p>Description: 功能模块客户端方法调用</p>
|
* <p>Copyright: Copyright {c} 2011</p>
|
* <p>Company: VCI</p>
|
* @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<FunctionInfo> funInfoList = new ArrayList<FunctionInfo>();
|
for(int i = count ; i<len ; i++){
|
if(funObject[i].getParentId()!=null){
|
FunctionObject object = funObject[i];
|
FunctionInfo funInfo = changeFunObjectToInfo(object);
|
funInfoList.add(funInfo);
|
}
|
}
|
FunctionInfo[] funInfos = new FunctionInfo[funInfoList.size()];
|
for(int j=0;j<funInfoList.size();j++){
|
funInfos[j] = funInfoList.get(j);
|
}
|
|
try {
|
b = ClientSession.getFrameworkService().importModules(funInfos,userEntityInfo);
|
} catch (VCIError e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
|
return b;
|
}
|
|
/**
|
*
|
* 查询"功能模块管理"整个树结构并导出sql
|
* add by caill start 2015.12.8
|
* */
|
public String[][] getAllDatas(int size) throws VCIException{
|
String[][] res = new String[size][23];
|
try{
|
res = ClientSession.getFrameworkService().getAllDatas(size);
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code), e.messages);
|
}
|
return res;
|
}
|
/**
|
*
|
* 获得所有操作类型的数量
|
* add by caill start 2015.12.11
|
* */
|
public int getAllModelManagementNum() throws VCIException{
|
long res = 0;
|
try{
|
res = ClientSession.getFrameworkService().getAllModelManagementNum();
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code), e.messages);
|
}
|
return (int)res;
|
}
|
// add by caill end
|
/**
|
*
|
* 查询"功能模块管理"整个树结构并导出
|
* add by caill start
|
* */
|
public String[][] checkLevel() throws VCIException{
|
String[][] res = new String[3000][23];
|
try{
|
res = ClientSession.getFrameworkService().checkLevel();
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code), e.messages);
|
}
|
return res;
|
}
|
// add by caill end
|
/**
|
* 根据名称查询操作
|
* add by caill start
|
* */
|
public OperateInfo fetchOperateTypeByName(String name) throws VCIException{
|
try{
|
return ClientSession.getFrameworkService().fetchOperateTypeByName(name);
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code), e.messages);
|
}
|
|
}
|
/**
|
* 修改模块
|
* @param object
|
* @return
|
* @throws VCIException
|
*/
|
public String updateModule(FunctionObject object) throws VCIException{
|
String res = "";
|
try{
|
res = ClientSession.getFrameworkService().updateModule(changeFunObjectToInfo(object),userEntityInfo);
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code), e.messages);
|
}
|
return res;
|
}
|
|
/**
|
* 删除模块
|
* @param rmDataObject
|
* @return
|
* @throws VCIException
|
*/
|
public String deleteModule(String puid) throws VCIException{
|
String res = "";
|
try{
|
res = ClientSession.getFrameworkService().deleteModule(puid,userEntityInfo);
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code), e.messages);
|
}
|
return res;
|
}
|
|
/**
|
* 获取自动生成的编号
|
* @return
|
* @throws VCIException
|
*/
|
// public int getAutoModuleNo() throws VCIException {
|
// int res = 0;
|
// try{
|
// res = ClientSession.getFrameworkService().getAutoModuleNo();
|
// }catch (VCIError e) {
|
// e.printStackTrace();
|
// throw new VCIException(String.valueOf(e.code), e.messages);
|
// }
|
// return res;
|
// }
|
/**
|
* 通过模块ID获取子级列表
|
* @param parentId
|
* @param isAll 是否包括无效的模块,true则包括
|
* @return
|
* @throws VCIException
|
*/
|
public FunctionObject[] getModuleListByParentId(String parentId,boolean isAll) throws VCIException {
|
FunctionObject[] funcObjs = null;
|
try{
|
FunctionInfo[] funcInfos = ClientSession.getFrameworkService().getModuleListByParentId(parentId, isAll);
|
funcObjs = new FunctionObject[funcInfos.length];
|
for(int i = 0;i < funcInfos.length; i++){
|
funcObjs[i] = changeFunInfoToObject(funcInfos[i]);
|
}
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code),e.messages);
|
}
|
return funcObjs;
|
}
|
|
/**
|
* 获取父下所有子模块
|
* @param parentId
|
* @param isAll
|
* @return
|
* @throws VCIException
|
*/
|
public FunctionObject[] getChildrenFunctionsByParentId(String parentId, boolean isAll) throws VCIException {
|
FunctionObject[] funcObjs = null;
|
try{
|
FunctionInfo[] funcInfos = ClientSession.getFrameworkService().getChildrenFunctionsByParentId(parentId, isAll);
|
funcObjs = new FunctionObject[funcInfos.length];
|
for(int i = 0;i < funcInfos.length; i++){
|
funcObjs[i] = changeFunInfoToObject(funcInfos[i]);
|
}
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code),e.messages);
|
}
|
return funcObjs;
|
}
|
|
/**
|
* BS框架的模块信息
|
* @param parentId
|
* @param isAll
|
* @return
|
* @throws VCIException
|
*/
|
public FunctionObject[] getModuleListByParentIdForBS(String parentId,boolean isAll) throws VCIException {
|
FunctionObject[] funcObjs = null;
|
try{
|
FunctionInfo[] funcInfos = ClientSession.getFrameworkService().getModuleListByParentIdForBS(parentId, isAll);
|
funcObjs = new FunctionObject[funcInfos.length];
|
for(int i = 0;i < funcInfos.length; i++){
|
funcObjs[i] = changeFunInfoToObject(funcInfos[i]);
|
}
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code),e.messages);
|
}
|
return funcObjs;
|
}
|
/**
|
* CS框架的模块信息
|
* @param parentId
|
* @param isAll
|
* @return
|
* @throws VCIException
|
*/
|
public FunctionObject[] getModuleListByParentIdForCS(String parentId,boolean isAll) throws VCIException {
|
FunctionObject[] funcObjs = null;
|
try{
|
FunctionInfo[] funcInfos = ClientSession.getFrameworkService().getModuleListByParentIdForCS(parentId, isAll);
|
funcObjs = new FunctionObject[funcInfos.length];
|
for(int i = 0;i < funcInfos.length; i++){
|
funcObjs[i] = changeFunInfoToObject(funcInfos[i]);
|
}
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code),e.messages);
|
}
|
return funcObjs;
|
}
|
|
/**
|
* 获取用户有权限的子级模块列表
|
* @param parentId 模块ID
|
* @param userName 用户名
|
* @return
|
* @throws VCIException
|
*/
|
public FunctionObject[] getModuleListByRoleRight(String parentId,String userName) throws VCIException {
|
FunctionObject[] funcObjs = null;
|
try{
|
FunctionInfo[] funcInfos = ClientSession.getFrameworkService().getModuleListByRoleRight(parentId, userName);
|
funcObjs = new FunctionObject[funcInfos.length];
|
for(int i = 0;i < funcInfos.length; i++){
|
funcObjs[i] = changeFunInfoToObject(funcInfos[i]);
|
}
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code),e.messages);
|
}
|
return funcObjs;
|
}
|
/**
|
* BS框架获取用户有权限的子级模块列表
|
* @param parentId 模块ID
|
* @param userName 用户名
|
* @return
|
* @throws VCIException
|
*/
|
public FunctionObject[] getModuleListByRoleRightForBS(String parentId,String userName) throws VCIException {
|
FunctionObject[] funcObjs = null;
|
try{
|
FunctionInfo[] funcInfos = ClientSession.getFrameworkService().getModuleListByRoleRightForBS(parentId, userName);
|
funcObjs = new FunctionObject[funcInfos.length];
|
for(int i = 0;i < funcInfos.length; i++){
|
funcObjs[i] = changeFunInfoToObject(funcInfos[i]);
|
}
|
}catch (VCIError e) {
|
e.printStackTrace();
|
throw new VCIException(String.valueOf(e.code),e.messages);
|
}
|
return funcObjs;
|
}
|
|
/**
|
*
|
* <p>根据模块名称查询出当前模块对象的信息</p>
|
*
|
* @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;
|
}
|
/**
|
*
|
* <p>根据模块CLASS信息查询出当前模块对象的信息</p>
|
*
|
* @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;
|
|
}
|
|
/**
|
*
|
* <p>根据模块funcOid信息查询出模块对象的信息</p>
|
*
|
* @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;
|
}
|
|
/**
|
* <p>Description: plfunction表对象和cobra对象的转换</p>
|
*
|
*@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 ;
|
}
|
|
/**
|
* <p>Description: plfunction中cobra对象和前端对象的转换</p>
|
*
|
*@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;
|
}
|
|
}
|