package com.vci.server.query;
|
|
import org.omg.CORBA.IntHolder;
|
|
import com.vci.server.BaseService;
|
import com.vci.server.query.delegate.ObjectQueryServiceDelegate;
|
import com.vci.server.query.delegate.RefQueryDelegate;
|
import com.zeroc.Ice.Current;
|
import com.vci.common.ServiceNames;
|
import com.vci.common.exception.VciExceptionTool;
|
import com.vci.corba.common.VCIError;
|
import com.vci.corba.omd.data.BusinessObject;
|
import com.vci.corba.omd.data.LinkObject;
|
import com.vci.corba.query.ObjectQueryService;
|
import com.vci.corba.query.data.BOAndLO;
|
import com.vci.corba.query.data.BtmRefQueryOption;
|
import com.vci.corba.query.data.KV;
|
import com.vci.corba.query.data.RefPath;
|
|
/**
|
* 创建link的业务类型视图的查询策略
|
* 从linkTable和btmView查询,递归查询时不需要二次查询。
|
* @author zhouhui
|
*
|
*/
|
public class ObjectQueryServiceImpl extends BaseService implements ObjectQueryService{
|
|
@Override
|
public String getServiceName() {
|
return ServiceNames.OQSERVICE;
|
}
|
|
/**
|
* 根据查询模板名, 查询模板内容查询业务对象
|
*/
|
@Override
|
public BusinessObject[] findBTMObjects(String qtName, String qtText, Current current)
|
throws VCIError {
|
return ObjectQueryServiceDelegate.getInstance().findBTMObjects(qtName, qtText);
|
}
|
/**
|
* 根据查询模板名, 查询模板内容查询业务对象-V2版
|
*
|
* @param qtName 查询模板的名称(内部名称)
|
* @param qtText 查询模板结构化内容XML形式的字符串(需要在调用客户端进行转化)
|
* @param count 查询结果的总数,通过 count.value 获取
|
* @return 查询到的业务类型数据 <code>com.vci.corba.omd.BusinessObject</code>
|
* @since v1.1 2017.08.31
|
* @see com.vci.corba.omd.data.BusinessObject
|
*/
|
@Override
|
public FindBTMObjectsV2Result findBTMObjectsV2(String qtName, String qtText, Current current)
|
throws VCIError {
|
IntHolder count = new IntHolder();
|
BusinessObject[] bos = ObjectQueryServiceDelegate.getInstance().findBTMObjectsV2(qtName, qtText, count);
|
return new FindBTMObjectsV2Result(bos, count.value);
|
}
|
/**
|
* 查询模板数据查询业务对象-v3 : 查BO的同时,根据参照查询选项,查询参照数据
|
*
|
* @param qtName 查询模板的名称(内部名称)
|
* @param qtText 查询模板结构化内容XML形式的字符串(需要在调用客户端进行转化)
|
* @param count 查询结果的总数,通过 count.value 获取
|
* @return 查询到的业务类型数据 <code>com.vci.corba.omd.BusinessObject</code>
|
* @since 2017.12.20
|
* @author xiongchao
|
* @see com.vci.corba.omd.data.BusinessObject
|
*/
|
@Override
|
public FindBTMObjectsV3Result findBTMObjectsV3(String qtName, String qtText, BtmRefQueryOption[] btmRefQueryOptions, Current current)
|
throws VCIError {
|
IntHolder count = new IntHolder();
|
BusinessObject[] bos = ObjectQueryServiceDelegate.getInstance().findBTMObjectsV3(qtName, qtText, count, btmRefQueryOptions);
|
return new FindBTMObjectsV3Result(bos, count.value);
|
}
|
/**
|
* 根据查询模板名, 查询模板内容查询链接对象
|
*/
|
@Override
|
public LinkObject[] findLTObjects(String qtName, String qtText, Current current)
|
throws VCIError {
|
return ObjectQueryServiceDelegate.getInstance().findLTObjects(qtName, qtText);
|
}
|
/**
|
* 根据查询模板名, 查询模板内容查询链接对象-V2版
|
*
|
* @param qtName 查询模板的名称(内部名称)
|
* @param qtText 查询模板结构化内容XML形式的字符串(需要在调用客户端进行转化)
|
* @param count 查询结果的总数,通过 count.value 获取
|
* @return 查询到的业务类型数据 <code>com.vci.corba.omd.LinkObject</code>
|
* @since v1.1 2017.08.31
|
* @see com.vci.corba.omd.data.LinkObject
|
*/
|
@Override
|
public FindLTObjectsV2Result findLTObjectsV2(String qtName, String qtText, Current current)
|
throws VCIError {
|
|
IntHolder count = new IntHolder();
|
LinkObject[] los = ObjectQueryServiceDelegate.getInstance().findLTObjectsV2(qtName, qtText, count);
|
|
return new FindLTObjectsV2Result(los, count.value);
|
}
|
|
|
|
/**
|
* 根据查询模板获取linkObject 和 关联的businessObject
|
*/
|
@Override
|
public BOAndLO[] getBOAndLOS(String qtName, String qtText, String btmOId, Current current) throws VCIError {
|
return ObjectQueryServiceDelegate.getInstance().getBOAndLOS(qtName, qtText, btmOId);
|
}
|
|
/**
|
* 根据业务类型名, 版本条件查询业务对象
|
* version: 0:所有版次; 1:当前版本当前版次; 2:当前版本最新版次; 3:最新版本最新版次.
|
*/
|
@Override
|
public BusinessObject[] findBTMObjectsByTypeNameAndVersion(String typeName,
|
short version, Current current) throws VCIError {
|
return ObjectQueryServiceDelegate.getInstance().findBTMObjectsByTypeNameAndVersion(typeName, version);
|
}
|
|
/**
|
* 根据查询模板名, 查询模板内容返回查询总数
|
*/
|
@Override
|
public long findTotalCount(String qtName, String qtText, Current current) throws VCIError {
|
return ObjectQueryServiceDelegate.getInstance().findTotalCount(qtName, qtText);
|
}
|
|
/**
|
* 用标准sql查询数据
|
*/
|
@Override
|
public KV[][] queryBySql(String sql, Current current) throws VCIError {
|
return ObjectQueryServiceDelegate.getInstance().queryBySql(sql);
|
}
|
|
/**
|
* 用标准sql查询数据
|
*/
|
@Override
|
public String[][] queryBySqlWithoutKey(String sql, Current current) throws VCIError {
|
return ObjectQueryServiceDelegate.getInstance().queryBySqlWithoutKey(sql);
|
}
|
/**
|
* 使用标准sql查询数据(基于绑定变量的实现)
|
*/
|
@Override
|
public String[][] queryBySqlAndValuesWithoutKey(String sql, String[] paramValues, Current current) throws VCIError{
|
return ObjectQueryServiceDelegate.getInstance().queryBySqlAndValuesWithoutKey(sql, paramValues);
|
}
|
|
|
//@Override
|
public BOAndLO[] getBOsAndLOS(String qtName, String qtText, String btmOId, Current current)
|
throws VCIError {
|
//?????????????以前是啥????
|
return ObjectQueryServiceDelegate.getInstance().getBOAndLOS(qtName, qtText, btmOId);
|
}
|
|
// 参照查询接口方法 ===================================================================
|
|
/**
|
* 客户端Facade调用的参照查询接口
|
* <p>
|
* Client Facade Invoke reference Query Method
|
*
|
* @param RefPath
|
* [] 参照路径数组
|
* @return RefPath [] 参照路径数组
|
* @throws VCIError
|
* */
|
@Override
|
public RefPath[] getRefQueryResults(RefPath[] paths, Current current) throws VCIError {
|
// 数据库最大的限制数是1000
|
try {
|
return new RefQueryDelegate().limitNumQuery(paths, 1000);
|
} catch (Throwable e) {
|
throw new VCIError(RefQueryDelegate.class.getName(), new String[]{VciExceptionTool.getExceptionStr(e), VciExceptionTool.getExceptionDetail(e)});
|
}
|
}
|
|
@Override
|
public RefPath[] getRefResults(RefPath[] paths, String toType, Current current)
|
throws VCIError {
|
try {
|
return new RefQueryDelegate().limitNumQuery(paths, toType, 1000);
|
} catch (Throwable e) {
|
throw new VCIError(RefQueryDelegate.class.getName(), new String[]{VciExceptionTool.getExceptionStr(e), VciExceptionTool.getExceptionDetail(e)});
|
|
}
|
}
|
|
@Override
|
public RefPath[] getRefTypesResults(RefPath[] paths, String[] toTypes, Current current)
|
throws VCIError {
|
try {
|
return new RefQueryDelegate().limitNumQuery(paths, toTypes, 1000);
|
} catch (Throwable e) {
|
throw new VCIError(RefQueryDelegate.class.getName(), new String[]{VciExceptionTool.getExceptionStr(e), VciExceptionTool.getExceptionDetail(e)});
|
|
}
|
}
|
|
}
|