When you use a Java class to provide data for a
report, you need to specify the name for the class. For example, with the Java
class sample provided, the class name is
JavaBeanConnectivityTest. If the class
is contained within a package, it is necessary to include the path to the
class.
To specify the method in the Java class, specify
the table name so that it contains the name of the method. For example:
String tableName = "getCustomerResultSet";
Example:
This example adds a table specified by a Java
class to a report:
void addTableToReport(ReportClientDocument rcd) throws ReportSDKException, ReportSDKServerException
{
String tableName = "getCustomerResultSet";
String className = "JavaBeanConnectivityTest";
PropertyBag logonProperties = new PropertyBag();
logonProperties.putStringValue("Java Bean Classes", className);
PropertyBag connectionAttributes = new PropertyBag();
connectionAttributes.putStringValue("QE_DatabaseType", "Java Beans Connectivity");
connectionAttributes.putStringValue("Database DLL", "crdb_javabeans.dll");
connectionAttributes.put("QE_LogonProperties", logonProperties);
connectionAttributes.putStringValue("QE_ServerDescription", className);
connectionAttributes.putBooleanValue("QE_SQLDB", true);
IProcedure newTable = new Procedure();
newTable.setAlias(tableName);
newTable.setName(tableName);
newTable.getConnectionInfo().setKind(ConnectionInfoKind.CRQE);
newTable.getConnectionInfo().setAttributes(connectionAttributes);
TableLinks requiredLink = new TableLinks();
rcd.getDatabaseController().addTable(newTable, requiredLink);
}This list includes the classes used by the sample
code:
com.crystaldecisions.sdk.occa.report.application.ReportClientDocument
com.crystaldecisions.sdk.occa.report.data.ConnectionInfoKind
com.crystaldecisions.sdk.occa.report.data.Procedure
com.crystaldecisions.sdk.occa.report.data.IProcedure
com.crystaldecisions.sdk.occa.report.data.TableLinks
com.crystaldecisions.sdk.occa.report.lib.PropertyBag
com.crystaldecisions.sdk.occa.report.lib.PropertyBagHelper
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException
com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException