Hello,
I'm working at a java project that schedules reports to different smtp targets. The problem is, that the native java sdk object model is a bit different like the one of javascipt.. In *.csp the application is done, but not implementationable.
// the problem: The SmptOptions must be set, but the
//following statement couse an nullPointerExeption..
// .. but why ?? is DestinationPlugin == null after
// retrieving it ??
// SmtpOptions = ( ISMTPOptions ) DestinationPlugin.getScheduleOptions(); // null exeption
// I'm logged on the aps, got a session and infoObject(s)
// named myReport(s):
// set report schedule time
schedInfo = myReport.getSchedulingInfo();
schedInfo.setRightNow( true );
schedInfo.setType( CeScheduleType.ONCE );
// set the report schedule destination
System.out.print("attach smtp plugin:"
try
{
smtpPlugins = iStore.query("SELECT * From CI_SYSTEMOBJECTS WHERE SI_PARENTID = 29 AND SI_NAME = 'CrystalEnterprise.Smtp'"
}
catch (SDKException error)
{
System.out.println("FAILED reason:" + error.getMessage());
System.exit(1);
} System.out.println("OK"
if ( smtpPlugins.getResultSize() < 1 )
{
System.out.println("no smtp plugin found"
System.exit(1);
}
else smtpPlugin = (IInfoObject) smtpPlugins.get(0);
IPluginMgr pluginMgr = null;
IDestinationPlugin DestinationPlugin = null;
IPluginInfo pluginInfo = null;
ISMTPOptions SmtpOptions = null;
System.out.print("attach plugin manager:"
try
{
pluginMgr = session.getPluginManager();
DestinationPlugin = (IDestinationPlugin) pluginMgr.getPluginInterface("CrystalEnterprise.Smtp" , IPluginMgr.Category.DESKTOP );
}
catch (SDKException error)
{
System.out.println("FAILED reason:" + error.getMessage());
System.exit(1);
} System.out.println("OK"
if (DestinationPlugin == (IDestinationPlugin)null)
{ System.out.println("no report destinationPlugin found"
System.exit(1);
}
System.out.println("1"
SmtpOptions = ( ISMTPOptions ) DestinationPlugin.getScheduleOptions();
System.out.println("2"
SmtpOptions.setDomainName( CallParameter_SmtpDomain );
SmtpOptions.setServerName( CallParameter_SmtpServer );
SmtpOptions.setPort( 25 ); // standard smtport
SmtpOptions.setSMTPAuthenticationType( ISMTPOptions.CeSMTPAuthentication.NONE );
SmtpOptions.setSMTPUserName( CallParameter_SmtpServerUSER );
SmtpOptions.setSMTPPassword( CallParameter_SmtpServerPWD );
SmtpOptions.setSenderAddress( CallParameter_SmtpFROM_Address );
System.out.print("set smtp.toAdress:"
try
{
ToAdressList = SmtpOptions.getToAddresses();
}
catch (SDKException error)
{
System.out.println("FAILED reason:" + error.getMessage());
System.exit(1);
} ToAdressList.clear();
ToAdressList.add( CallParameter_SmtpTO_Address );
System.out.println("OK"
//SmtpOptions.CCAddresses.Add(cc);
SmtpOptions.setSubject( CallParameter_SmtpSubject );
SmtpOptions.setMessage( CallParameter_SmtpSubject );
//SmtpOptions.Attachments.Add(mimetype, EloReportTyp + "_" + EloReportID + extension);
/*
IDestination reportDest = schedInfo.getDestination();
System.out.print("submit smtp plugin data to schedule instance:"
try
{
reportDest.setFromPlugin(reportDestinationPlugin);
}
catch (SDKException error)
{
System.out.println("FAILED reason:" + error.getMessage());
System.exit(1);
} System.out.println("OK"
*/
.. one more question. Is it possible to use IReport for seperate scheduling tasks or is that the general Report interface ?
Regards
I'm working at a java project that schedules reports to different smtp targets. The problem is, that the native java sdk object model is a bit different like the one of javascipt.. In *.csp the application is done, but not implementationable.
// the problem: The SmptOptions must be set, but the
//following statement couse an nullPointerExeption..
// .. but why ?? is DestinationPlugin == null after
// retrieving it ??
// SmtpOptions = ( ISMTPOptions ) DestinationPlugin.getScheduleOptions(); // null exeption
// I'm logged on the aps, got a session and infoObject(s)
// named myReport(s):
// set report schedule time
schedInfo = myReport.getSchedulingInfo();
schedInfo.setRightNow( true );
schedInfo.setType( CeScheduleType.ONCE );
// set the report schedule destination
System.out.print("attach smtp plugin:"
try
{
smtpPlugins = iStore.query("SELECT * From CI_SYSTEMOBJECTS WHERE SI_PARENTID = 29 AND SI_NAME = 'CrystalEnterprise.Smtp'"
}
catch (SDKException error)
{
System.out.println("FAILED reason:" + error.getMessage());
System.exit(1);
} System.out.println("OK"
if ( smtpPlugins.getResultSize() < 1 )
{
System.out.println("no smtp plugin found"
System.exit(1);
}
else smtpPlugin = (IInfoObject) smtpPlugins.get(0);
IPluginMgr pluginMgr = null;
IDestinationPlugin DestinationPlugin = null;
IPluginInfo pluginInfo = null;
ISMTPOptions SmtpOptions = null;
System.out.print("attach plugin manager:"
try
{
pluginMgr = session.getPluginManager();
DestinationPlugin = (IDestinationPlugin) pluginMgr.getPluginInterface("CrystalEnterprise.Smtp" , IPluginMgr.Category.DESKTOP );
}
catch (SDKException error)
{
System.out.println("FAILED reason:" + error.getMessage());
System.exit(1);
} System.out.println("OK"
if (DestinationPlugin == (IDestinationPlugin)null)
{ System.out.println("no report destinationPlugin found"
System.exit(1);
}
System.out.println("1"
SmtpOptions = ( ISMTPOptions ) DestinationPlugin.getScheduleOptions();
System.out.println("2"
SmtpOptions.setDomainName( CallParameter_SmtpDomain );
SmtpOptions.setServerName( CallParameter_SmtpServer );
SmtpOptions.setPort( 25 ); // standard smtport
SmtpOptions.setSMTPAuthenticationType( ISMTPOptions.CeSMTPAuthentication.NONE );
SmtpOptions.setSMTPUserName( CallParameter_SmtpServerUSER );
SmtpOptions.setSMTPPassword( CallParameter_SmtpServerPWD );
SmtpOptions.setSenderAddress( CallParameter_SmtpFROM_Address );
System.out.print("set smtp.toAdress:"
try
{
ToAdressList = SmtpOptions.getToAddresses();
}
catch (SDKException error)
{
System.out.println("FAILED reason:" + error.getMessage());
System.exit(1);
} ToAdressList.clear();
ToAdressList.add( CallParameter_SmtpTO_Address );
System.out.println("OK"
//SmtpOptions.CCAddresses.Add(cc);
SmtpOptions.setSubject( CallParameter_SmtpSubject );
SmtpOptions.setMessage( CallParameter_SmtpSubject );
//SmtpOptions.Attachments.Add(mimetype, EloReportTyp + "_" + EloReportID + extension);
/*
IDestination reportDest = schedInfo.getDestination();
System.out.print("submit smtp plugin data to schedule instance:"
try
{
reportDest.setFromPlugin(reportDestinationPlugin);
}
catch (SDKException error)
{
System.out.println("FAILED reason:" + error.getMessage());
System.exit(1);
} System.out.println("OK"
*/
.. one more question. Is it possible to use IReport for seperate scheduling tasks or is that the general Report interface ?
Regards