Cannot Resolve Symbol
Guys,
Iam new to java and only understand j of java.
I have a java code and i know all my problmes are solved if i get that code runnig, but i get error when i try to complie it using " javac FileName.java" its a cannot resolve error.
What am i doing worng?
How can i get my code to execute?
please help me!!
Code Begins Here
import com.cognos.developer.schemas.bibus._2.*;
import java.io.*;
public class BurstAndSaveReport
{
public CognosReportNetServiceLocator service = null;
public CognosReportNetPortType oCrn= null;
public String m_endPoint = null;
public void connectToReportServer (String endpoint)
{
// Default URL for CRN Content Manager
String m_endPoint = endpoint;
service = new CognosReportNetServiceLocator();
try
{
oCrn = service.getCognosReportNetPort(new java.net.URL(m_endPoint));
}
catch(Exception e)
{ System.out.println(e.getMessage()); }
}
/**
* Query for saved output.
*
*@paramsearchP- The searchPath to the report to query for
*@paramreportName - the name of the report only
*@paramsavePath - The path to the local file system.
*/
public void querySavedReports(String searchP,String reportName,String savePath, boolean latestVersion)
{
PropEnum props[] = {PropEnum.defaultName,
PropEnum.searchPath,
PropEnum.burstKey,
PropEnum.data, PropEnum.dataSize};
//Set the search path "searchP" to an existing report
if ( latestVersion == true){
searchP += "/reportVersion[last()]//output";
} else {
searchP += "/reportVersion//output";
}
try
{
BaseClass bc[] = oCrn.query(searchP,props, new Sort[]{}, new QueryOptions());
if (bc == null || bc.length <= 0)
{
System.out.println("E: The Report " +searchP+" has no saved outputs.");
System.exit(1);
}
/* for each report output found, save the report to the local file system. */
for (int i=0; i<bc.length ; i++)
{
//Print the name just top confirm that it is not useful in this case
//and it is almost the same for each output
System.out.println(bc.getDefaultName().getValue());
Output reportOutput = (Output)bc;
//The burstKey property is the one that differenciate the outputs
if (reportOutput.getBurstKey().getValue() != null){
String savedOutputName = reportOutput.getDefaultName().getValue();
String fileName = savePath+reportName+i+".html";
System.out.println("Report output: " + savedOutputName +" saved as " + reportName+i+ " to local system.");
File oFile = new File(fileName);
FileOutputStream fos = new FileOutputStream(oFile);
fos.write(reportOutput.getData().getValue());
fos.flush();
fos.close();
}
else{
System.out.println("E: The report has no Burst Options set.");
}
}
}
catch (Exception e)
{
System.out.println(e);
}
}
/**
* Logon to CRN.
*
*@paramnamespace - Namespace id
*@paramuid - User id
*@parampwd - password
*/
public String quickLogon(String namespace, String uid, String pwd)
{
try
{
StringBuffer credentialXML = new StringBuffer();
credentialXML.append("><credential>");
credentialXML.append("<namespace>").append(namespace).append("</namespace>");
credentialXML.append("<username>").append(uid).append("</username>");
credentialXML.append("<password>").append(pwd).append("</password>");
credentialXML.append("</credential>");
String encodedCredentials = credentialXML.toString();
oCrn.logon(encodedCredentials, new String[]{}/* this parameter does nothing, but is required */);
}
catch(Exception e)
{
System.out.println(e);
}
return ("Logon successful as " + uid);
}
/**
* Execute a report.
*
*@parampathThis is the search path to the report.
*@paramformatThe array that contains the format options (PDF,HTML,etc...)
*/
public void executeReport(String path,String[] format)
{
ParameterValue pv[] = new ParameterValue[]{};
RunOption ro[] = new RunOption[3];
RunOptionBoolean saveOutput = new RunOptionBoolean();
RunOptionStringArray rosa = new RunOptionStringArray();
RunOptionBoolean burstable = new RunOptionBoolean();
ReportServiceResponse res = null;
// Define that the report to save the output.
saveOutput.setName(RunOptionEnum.saveOutput);
saveOutput.setValue(true);
// What format do we want the report in: PDF? HTML? XML?
rosa.setName(RunOptionEnum.outputFormat);
rosa.setValue(format);
// Define that the report can be burst.
burstable.setName(RunOptionEnum.burst);
burstable.setValue(true);
// Fill the array with the run options.
ro[0] = rosa;
ro[1] = saveOutput;
ro[2] = burstable;
try
{
// Get the initial response.
res = oCrn.execute(path,pv,ro);
// If it has not yet completed, keep waiting until it is done.
// In this case, we wait forever.
while (res.getStatus() != AsynchStatusEnum.complete && res.getStatus() != AsynchStatusEnum.responseReady)
{
res = oCrn.wait(res.getPrimaryRequest());
}
oCrn.release(res.getPrimaryRequest());
// Return the final response.
}
catch (Exception e)
{
System.out.println(e);
}
}
public static void main(String[] args)
{
// CRN endpoint
String endpoint = "http://dev1.wills.com:8042/cognos8/cgi-bin/cognos.cg";
// local file location where the output will be saved
String savePath = "C:\\temp\\";
// search Path to an existing report
String searchPath = "/content/folder[@name='Report Development']/folder[@name='HE Sell Thru']/folder[@name='HE Reporting']/folder[@name='Now Working On']/folder[@name='YYYYMMDD Reports']/report[@name='Regional Manager Report-Changed 06/01/06 eve']";
// name of the report
String reportName = "Regional Manager Report-Changed 06/01/06 eve";
// latestVersion set to true if it retrieves the latest version of the report;
// otherwise, it retrieves all versions of the report
boolean latestVersion = true;
BurstAndSaveReport burst = new BurstAndSaveReport();
// connect to CRN
burst.connectToReportServer(endpoint);
System.out.println("Connect to server done");
// use anononymous logon, uncomment if logon is needed.
burst.quickLogon(nameSpaceID, userName, passWord);
System.out.println("Login complete");
// execute the report and save the output in the content store.
burst.executeReport(searchPath,new String[]{"HTML"});
System.out.println("Burst done");
// query the content store for the saved output, write each output to the local file system
burst.querySavedReports(searchPath,reportName,savePath,latestVersion);
System.out.println("Save done");
}
}

