So this is kind of a round about way that has worked for me... i still feel like there should be a property or maybe there is and im missing it to get the package used in a given report.... this is the work around I came up with that seems to be working....(fingers crossed lol)....
String sReportSpec = null;
PropEnum props[] = new PropEnum[]{PropEnum.searchPath, PropEnum.defaultName, PropEnum.specification};
SearchPathMultipleObject spMulti = new SearchPathMultipleObject();
spMulti.set_value(this.getReportPath());
BaseClass[] repPth = cognosConnection.getCmService().query(spMulti, props, new Sort[]{}, new QueryOptions());
// There should be only one report with the specified searchPath
if (repPth != null && repPth.length > 0) {
// extract the report spec
sReportSpec = (((Report) repPth[0]).getSpecification().getValue());
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = builderFactory.newDocumentBuilder();
InputStream is = new ByteArrayInputStream(sReportSpec.getBytes("UTF-8"));
this.xmlDoc = builder.parse(is);
}
if (this.xmlDoc != null) {
XPath xpath3 = XPathFactory.newInstance().newXPath();
String xpathExpression_Item = "/report/modelPath";
XPathExpression expr3 = xpath3.compile(xpathExpression_Item);
NodeList modelPathList = (NodeList) expr3.evaluate(xmlDoc, XPathConstants.NODESET);
String innerText = modelPathList.item(0).getTextContent();
String sub1 = innerText.substring(innerText.lastIndexOf("/package[@name='") + 16);
int endIndex = sub1.indexOf("']");
this.ContainingPackage = sub1.substring(0,endIndex);
}
Quote from: AussiePete2011 on 12 Oct 2011 02:58:53 PM
Hi there
IBM have a solution already
http://www-01.ibm.com/support/docview.wss?uid=swg24021211
See what you think
Cheers
Peter
Some additional samples:
http://www-304.ibm.com/support/docview.wss?uid=swg21341149
http://www-304.ibm.com/support/docview.wss?uid=swg21374788