So I've made progress but am stumped. I created a customcomponent and used a
rule to make one of the displayPropertyKeys a hyperlink.
I am basically using the JasperReportExample. I created a hyperlink as one of
the property keys. this will fire off the method that starts the jasper reports
process:
public WOActionResults printBrief() {
Brief theBrief = (Brief)object();
Callable<File> reportTask =
Reports.createBriefReportTask(theBrief);
CCAjaxLongResponsePage nextPage =
pageWithName(CCAjaxLongResponsePage.class);
// Push the task into the long response page
nextPage.setTask(reportTask);
// Controller for handling the Callable result in the long
response page
FileTaskDownloadController nextPageController = new
FileTaskDownloadController();
// Hyperlink text on the "Your file is downloaded page" to get
back here
nextPageController.setReturnLinkText("Reports Menu");
// The filename for the download
nextPageController.setDownloadFileNameForClient("BriefReport.pdf");
nextPage.setNextPageForResultController(nextPageController);
NSLog.out.appendln("*** nextPage = ***** " + nextPage);
return nextPage;
}
Here is the Reports method:
public static Callable<File> createBriefReportTask(Brief b) {
String reportDescription = "Printed Brief";
HashMap<String, Object> parameters = new HashMap<String,
Object>();
parameters.put("reportDescription", reportDescription);
parameters.put("userName", "User From session");
EOQualifier qualifier = ERXQ.equals(Brief.JOB_NUMBER_KEY,
b.jobNumber());
ERXFetchSpecification<Brief> fs = new
ERXFetchSpecification<Brief>(Brief.ENTITY_NAME, qualifier, null);
ERJRFetchSpecificationReportTask reportTask = new
ERJRFetchSpecificationReportTask(fs, jasperCompiledReportFileName, parameters);
return reportTask;
}
indeed it goes out and starts to create the pdf. I see the the pdf in
/var/folders/2d/23408oihsdvh08r23/T/Brief3234987239872398472.pdf
However, just when DownloadIsComplete's appendToResponse method is called I get
errors:
Apr 03 15:33:34 ASBriefsD2W[57285] WARN NSLog -
<com.webobjects.appserver._private.WOComponentRequestHandler>: Exception
occurred while handling request:
java.lang.NullPointerException
[2012-4-3 15:33:34 EDT] <WorkerThread0> java.lang.NullPointerException
at
com.as.application.ui.components.PageWrapper.bodyClass(PageWrapper.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.webobjects.foundation.NSKeyValueCoding$ValueAccessor$1.methodValue(NSKeyValueCoding.java:636)
at
com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(NSKeyValueCoding.java:1134)
at
com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.valueForKey(NSKeyValueCoding.java:1324)
at
com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java:1736)
at
com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValueCoding.java:447)
at
com.webobjects.foundation.NSKeyValueCodingAdditions$DefaultImplementation.valueForKeyPath(NSKeyValueCodingAdditions.java:212)
at
com.webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java:1804)
at
com.webobjects.appserver._private.WOKeyValueAssociation.valueInComponent(WOKeyValueAssociation.java:50)
at
com.webobjects.appserver._private.WOHTMLDynamicElement.stringValueInContext(WOHTMLDynamicElement.java:537)
at
com.webobjects.appserver._private.WOHTMLDynamicElement.classInContext(WOHTMLDynamicElement.java:542)
at
com.webobjects.appserver._private.WOHTMLDynamicElement._appendClassAndIdToResponse(WOHTMLDynamicElement.java:518)
I can provide more but I have to start somewhere.
I don't know what else to says other than 'HELP'!!! i'm drowning.
Ted
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]