如果您的應用程式需要其他延展性以及修改報表的功能,您可以將報表伺服器升級至 RAS,並將些微變更的應用程式快速轉換到現有程式碼。Crystal Enterprise 使用 RAS 物件模型。RAS 提供其他延展性和 Java 報表元件 未提供的報表修改功能。
若要將 Web 應用程式移轉成使用 RAS,您必須先取得並安裝一套 RAS。一旦正確地安裝和設定了 RAS 之後,就可以移轉 Web 應用程式。
從 Java 報表元件 到 RAS 的移轉路徑,是根據應用程式是否使用 ReportClientDocument 類別而有所不同。
如果 Web 應用程式使用 ReportClientDocument 類別來取得報表來源,則您必須將 JSP 匯入陳述式變更為使用 RAS 命名空間,而非 Java 報表元件 命名空間。
例如,將 com.crystaldecisions.reports.sdk.*
變更為 com.crystaldecisions.sdk.occa.report.application.*
。
ReportClientDocument clientDoc = new ReportClientDocument();
clientDoc.setReportAppServer("SERVERNAME");
注意: 建議您使用 ReportClientDocument 類別,來檢視或匯出報表。
如果 Web 應用程式不使用 ReportClientDocument 物件,則您必須將程式碼變更為使用適當的 RAS 類別,以代替 Java 報表元件 類別。執行這項作業的程式碼,會依據您所使用的是 Managed 還是 Unmanaged RAS 而有所不同。
IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
Object reportSource = rptSrcFactory.createReportSource(report, request.getLocale());
在類似 Crystal Enterprise Professional 的 Managed 環境中,請移除匯入 com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory
的匯入陳述式。您還必須將原始的 Java 報表元件 程式碼變更成以下:
IReportSourceFactory2 rptSrcFactory = (IReportSourceFactory2)enterpriseSession.getService("RASReportFactory");
Object reportSource = rptSrcFactory.createReportSource(report, request.getLocale());
注意: 以上的程式碼假設您已建立有效的 enterpriseSession 物件。
在類似 Crystal Enterprise Embedded 版 的 Unmanaged 環境中,請移除匯入 com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory
的匯入陳述式。然後您必須加入匯入陳述式,來匯入 com.crystaldecisions.sdk.occa.report.application.reportsourcefactory.RasReportSourceFactory
。此外,還必須將原始的 Java 報表元件 程式碼變更成以下:
IReportSourceFactory2 rptSrcFactory = new RasReportSourceFactory();
Object reportSource = rptSrcFactory.createReportSource(report, request.getLocale());
在 Unmanaged 環境中,您還必須指定 RAS 伺服器的位置。如需有關指定 RAS 位置的詳細資訊,請參閱《報表應用程式伺服器 Java SDK 指南》。
Business Objects http://www.taiwan.businessobjects.com/ 支援服務 http://www.businessobjects.com/services/support/ |