package com.vci.server.query.util;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.Map;
|
|
import org.dom4j.DocumentException;
|
|
import com.vci.server.base.utility.OQueryHelper;
|
import com.vci.server.query.delegate.ObjectQueryServiceDelegate;
|
import com.vci.common.qt.object.Condition;
|
import com.vci.common.qt.object.OrderInfo;
|
import com.vci.common.qt.object.PageInfo;
|
import com.vci.common.qt.object.QTConstants;
|
import com.vci.common.qt.object.QueryTemplate;
|
import com.vci.corba.common.VCIError;
|
import com.vci.corba.omd.data.BusinessObject;
|
import com.vci.corba.query.data.BOAndLO;
|
|
public class DataModelServerProcessor implements IDataModelServerProcessor {
|
|
/**
|
* 根据输入参数自定义查询模板,根据自定义的查询模板获取符合条件的业务对象查询结果
|
* @param btmName,业务类型名称
|
* @param clauseList,返回的字段列表,暂时默认支持*
|
* @param queryChildrenFlag,是否查询子业务类型的数据
|
* @param rightFlag,是否根据数据授权过滤,true:进行数据授权过滤,false:不进行数据授权过滤
|
* @param queryCondition,查询条件map,即需要附加到业务类型的查询语句的查询条件
|
* @param version,1:当前版本当前版次;2代表当前版本最新版次;3:代表最新版本最新版次;4代表当前发布有效版
|
* @param pageInfo,分页信息,不需要分页时将其设为null即可,其包含两个属性:pageNO:页数和rowCount:当前页显示条数
|
* @param orderInfoList,排序信息,不需要是将其设置为null, 其包含三个属性:level:排序优先级,数越小越优先; orderField:排序字段名称;orderMode:属性ASC或DESC;
|
* @return
|
* @throws VCIError
|
* @throws DocumentException
|
*/
|
@Override
|
public BusinessObject[] getBusinessObjectByCondition(String btmName, List<String> clauseList, boolean queryChildrenFlag, boolean rightFlag,
|
Map<String, String> queryCondition, int version, PageInfo pageInfo, List<OrderInfo> orderInfoList) throws VCIError {
|
BusinessObject[] bos = null;
|
try{
|
QueryTemplate qt2 = new QueryTemplate();
|
qt2.setId("btmQuery");
|
qt2.setBtmType(btmName);
|
qt2.setType("btm");
|
clauseList = new ArrayList<String>();
|
clauseList.add("*");
|
qt2.setClauseList(clauseList);
|
qt2.setQueryChildrenFlag(queryChildrenFlag);
|
qt2.setRightFlag(rightFlag);
|
qt2.setVersion(version);
|
if (pageInfo != null && pageInfo.getPageNO() > 0 && pageInfo.getRowCount() > 0) {
|
qt2.setPageInfo(pageInfo);
|
}
|
if (orderInfoList != null && orderInfoList.size() > 0) {
|
qt2.setOrderInfoList(orderInfoList);
|
}
|
|
if (queryCondition != null && queryCondition.size() > 0) {
|
Condition cond = OQueryHelper.getCondition(queryCondition);
|
qt2.setCondition(cond);
|
}
|
bos = ObjectQueryServiceDelegate.getInstance().findBTMObjects(qt2);
|
}
|
catch(VCIError vcie)
|
{
|
throw vcie;
|
}
|
catch(java.lang.Exception se)
|
{
|
VCIError vcierror = new VCIError("",new String[]{se.getMessage()});
|
throw vcierror;
|
}
|
return bos;
|
}
|
|
/**
|
* 自定义查询模板,根据查询条件查询符合条件的业务对象和链接类型查询结果
|
* @param linkName,link名称
|
* @param clauseList,返回的字段列表,暂时默认支持*
|
* @param queryISLeaf,是否查询叶子节点,true代表查询,false代表不查询
|
* @param rightFlag,是否根据数据授权过滤,true:进行数据授权过滤,false:不进行数据授权过滤
|
* @param direction,查询方向,true代表正向查询,false代表反向查询
|
* @param queryCondition,是否查询子业务类型的数据
|
* @param version,1:当前版本当前版次;2代表当前版本最新版次;3:代表最新版本最新版次;4代表当前发布有效版
|
* @param pageInfo,分页信息,不需要分页时将其设为null即可,其包含两个属性:pageNO:页数和rowCount:当前页显示条数
|
* @param level,查询的层级,-1代表所有,其他数字代码查询的具体层数
|
* @param orderInfoList,排序信息,不需要是将其设置为null, 其包含三个属性:level:排序优先级,数越小越优先; orderField:排序字段名称;orderMode:属性ASC或DESC;
|
* @param recReturnMode,是否去重,true代表去重,false代表不去重
|
* @param objId,源对象ID
|
* @param btmType,查询目标对象的业务类型
|
* @return
|
* @throws VCIError
|
*/
|
@Override
|
public BOAndLO[] getBOLOsByCondition(String linkName, List<String> clauseList, boolean queryISLeaf, boolean rightFlag, boolean direction,
|
Map<String, String> queryCondition, int version, PageInfo pageInfo, int level, List<OrderInfo> orderInfoList, boolean recReturnMode, String objId, String btmType) throws VCIError {
|
BOAndLO[] bolos = null;
|
try
|
{
|
QueryTemplate qt2 = new QueryTemplate();
|
qt2.setId("ltQuery");
|
qt2.setLinkType(linkName);
|
qt2.setType("link");
|
clauseList = new ArrayList<String>();
|
clauseList.add("*");
|
qt2.setClauseList(clauseList);
|
qt2.setQueryISLeaf(queryISLeaf);
|
qt2.setRightFlag(rightFlag);
|
|
if(direction){
|
qt2.setDirection(QTConstants.DIRECTION_POSITIVE);
|
}else{
|
qt2.setDirection(QTConstants.DIRECTION_OPPOSITE);
|
}
|
if (pageInfo != null && pageInfo.getPageNO() > 0 && pageInfo.getRowCount() > 0) {
|
qt2.setPageInfo(pageInfo);
|
}
|
if (orderInfoList != null && orderInfoList.size() > 0) {
|
qt2.setOrderInfoList(orderInfoList);
|
}
|
if (queryCondition != null && queryCondition.size() > 0) {
|
Condition cond = OQueryHelper.getConditionForLink(qt2.getDirection(), objId, btmType, queryCondition);
|
qt2.setCondition(cond);
|
}
|
|
qt2.setVersion(version);
|
qt2.setPageInfo(pageInfo);
|
qt2.setLevel(level);
|
if (recReturnMode) {
|
qt2.setRecReturnMode(1);
|
} else {
|
qt2.setRecReturnMode(2);
|
}
|
|
bolos = ObjectQueryServiceDelegate.getInstance().getBOAndLOS(qt2, "");
|
}
|
catch(VCIError vcie)
|
{
|
throw vcie;
|
}
|
catch(java.lang.Exception se)
|
{
|
VCIError vcierror = new VCIError("",new String[]{se.getMessage()});
|
throw vcierror;
|
}
|
return bolos;
|
}
|
}
|