123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- import java.rmi.RemoteException;
- import java.util.Hashtable;
- import java.util.Set;
- import com.cognos.developer.schemas.bibus._3.BaseClass;
- import com.cognos.developer.schemas.bibus._3.BaseParameter;
- import com.cognos.developer.schemas.bibus._3.OrderEnum;
- import com.cognos.developer.schemas.bibus._3.PropEnum;
- import com.cognos.developer.schemas.bibus._3.QueryOptions;
- import com.cognos.developer.schemas.bibus._3.SearchPathMultipleObject;
- import com.cognos.developer.schemas.bibus._3.Sort;
- public class BaseReportAndParameters {
- ReportParameters myReportParameters = new ReportParameters();
- DrillThrough myDrillThrough = new DrillThrough();
-
- public BaseReportAndParameters() {
- }
-
- public Hashtable hashReportNameAndPara(CRNConnect conn, String mySearchPath) {
- Hashtable myHashTable = null;
- BaseClassWrapper[] myReport = null;
-
- BaseClass[] reportList = getCSObject(conn, mySearchPath);
- myReport = new BaseClassWrapper[reportList.length];
- if (reportList != null && reportList.length > 0) {
- myHashTable = new Hashtable();
- for (int num = 0; num < reportList.length; num++) {
- BaseParameter[] myBasePara = null;
- myReport[num] = new BaseClassWrapper(reportList[num]);
- String aReportName = myReport[num].toString();
- try {
-
- myBasePara = myReportParameters.getReportParameters(
- myReport[num], conn);
- } catch (RemoteException reEx) {
- System.out.println("Error getting '"
- + myReport[num].getBaseClassObject()
- .getSearchPath().getValue() + aReportName
- + "' parameters: "
- + reEx.getMessage());
- return null;
- }
- if (myBasePara.length > 0) {
- myHashTable.put(myReport[num], myBasePara);
- }
- }
- }
- return myHashTable;
- }
-
- public BaseClassWrapper[] getListOfPackages(CRNConnect myCon) {
- BaseClassWrapper[] listOfPackages = null;
-
- String mySearchPath = "/content//package";
- BaseClass[] packageList = getCSObject(myCon, mySearchPath);
- if (packageList != null && packageList.length > 0) {
- int numOfPackage = packageList.length;
- listOfPackages = new BaseClassWrapper[numOfPackage];
- for (int i = 0; i < numOfPackage; i++) {
- listOfPackages[i] = new BaseClassWrapper(packageList[i]);
- }
- }
- return listOfPackages;
- }
-
- public BaseClass[] getCSObject(CRNConnect con, String myPathStr) {
- SearchPathMultipleObject cmSearchPath = new SearchPathMultipleObject(
- myPathStr);
- BaseClass[] myCMObject = null;
- PropEnum props[] = new PropEnum[] { PropEnum.searchPath,
- PropEnum.defaultName };
- Sort sortOptions[] = { new Sort() };
- sortOptions[0].setOrder(OrderEnum.ascending);
- sortOptions[0].setPropName(PropEnum.defaultName);
- try {
- myCMObject = con.getCMService().query(cmSearchPath, props,
- sortOptions, new QueryOptions());
- } catch (RemoteException remoteEx) {
- System.out
- .println("Error retrieving object from Content Store according to specified search path: "
- + remoteEx.getMessage());
- }
- return myCMObject;
- }
-
- public BaseClassWrapper[] getReports(Hashtable myHash) {
- BaseClassWrapper[] listOfReport = null;
- Set setOfReport = myHash.keySet();
- Object[] myReports = setOfReport.toArray();
- if (myReports.length > 0) {
- listOfReport = new BaseClassWrapper[myReports.length];
- for (int n = 0; n < myReports.length; n++) {
- listOfReport[n] = (BaseClassWrapper) myReports[n];
- }
- }
- return listOfReport;
- }
- }
|