package com.huawei.sdprpt.report.utils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.rmi.RemoteException;
import java.util.Locale;
import sun.misc.BASE64Decoder;
import com.cognos.developer.schemas.bibus._3.AsynchDetailReportOutput;
import com.cognos.developer.schemas.bibus._3.AsynchOptionEnum;
import com.cognos.developer.schemas.bibus._3.AsynchOptionInt;
import com.cognos.developer.schemas.bibus._3.AsynchReply;
import com.cognos.developer.schemas.bibus._3.AsynchReplyStatusEnum;
import com.cognos.developer.schemas.bibus._3.AsynchSecondaryRequest;
import com.cognos.developer.schemas.bibus._3.BaseClass;
import com.cognos.developer.schemas.bibus._3.ContentManagerServiceStub;
import com.cognos.developer.schemas.bibus._3.Graphic;
import com.cognos.developer.schemas.bibus._3.Option;
import com.cognos.developer.schemas.bibus._3.Output;
import com.cognos.developer.schemas.bibus._3.OutputEncapsulationEnum;
import com.cognos.developer.schemas.bibus._3.ParameterValue;
import com.cognos.developer.schemas.bibus._3.PropEnum;
import com.cognos.developer.schemas.bibus._3.QueryOptions;
import com.cognos.developer.schemas.bibus._3.RunOptionBoolean;
import com.cognos.developer.schemas.bibus._3.RunOptionEnum;
import com.cognos.developer.schemas.bibus._3.RunOptionLanguageArray;
import com.cognos.developer.schemas.bibus._3.RunOptionOutputEncapsulation;
import com.cognos.developer.schemas.bibus._3.RunOptionStringArray;
import com.cognos.developer.schemas.bibus._3.SearchPathMultipleObject;
import com.cognos.developer.schemas.bibus._3.SearchPathSingleObject;
import com.cognos.developer.schemas.bibus._3.Sort;
import com.huawei.bme.commons.util.debug.DebugLog;
import com.huawei.bme.commons.util.debug.LogFactory;
/**
* TODO 添加类的一句话简单描述。
*
* TODO 详细描述
*
* TODO 示例代码
*
*
*
*
* @author lWX162655
* @version ONIP BME V300R001 2013-7-31
* @since ONIP BME V300R001C00
*/
public class RunReport {
/**
* 运行报表
*
* @param connect
* 报表服务器连接AL
* @param reportSearchPath
* 报表搜索路径
* @param reportType
* 报表类型:1:XLS 2:HTML
* @param parameters
* 报表参数helper
* @return
* @throws IOException
*/
/**
* 调测日志记录器。
*/
private static final DebugLog DEBUGGER = LogFactory
.getDebugLog(RunReport.class);
public String run(CognosLog connect, String reportSearchPath,
String reportType, ParameterValue[] parameters,
String partOfFileoutPutName, String compagers, String savePath)
throws IOException {
String output = null;
if ((connect != null) && (reportSearchPath != null)) {
/*
* 通过reportSearchPath【报表存放路劲】获得报表对象
*/
BaseClass[] reportDomain = getRoportModel(reportSearchPath,
connect.getCMService());
if (reportDomain.length > 0) {
ParameterValue[] emptyParameterValues = new ParameterValue[] {}; // 空参
ParameterValue[] reportParameterValues = null;//
if (parameters != null) {
// 设置报表参数
reportParameterValues = parameters;
}
// 如果传入的参数数组为空则数组为null
if ((reportParameterValues == null)
|| (reportParameterValues.length <= 0)) {
// emptyParameterValues 上面定义的一组空参(执行报表必须要有参数数组,数组内容可为空)
reportParameterValues = emptyParameterValues;
}
// 执行报表
/*
* reportSearchPath:报表存放地址 connect:连接对象
* reportType:报表文件类型(html,excel) reportParameterValues: