com.crystaldecisions.report.web.viewer
Class ReportServerControl

java.lang.Object
  extended bycom.crystaldecisions.report.web.ServerControl
      extended bycom.crystaldecisions.report.web.viewer.ReportServerControl
Direct Known Subclasses:
CrystalReportViewerBase, ReportExportControl

public class ReportServerControl
extends ServerControl

This class allows you to manage how reports interact with the server. There are methods for manipulating the report's logons, parameters, and selection formulas.

The following example includes methods from the ReportServerControl class, the com.crystaldecisions.sdk.occa.report.data.Fields class, the com.crystaldecisions.sdk.occa.report.data.ParameterField class, the com.crystaldecisions.sdk.occa.report.data.ParameterFieldDiscreteValue class, the com.crystaldecisions.sdk.occa.report.data.Values class, and the CrystalReportViewer class.

Example:

Java Report Parameters Example


Constructor Summary
ReportServerControl()
           
 
Method Summary
 void addReportPartBookmarkNavigationEventListener(IReportPartBookmarkNavigationEventListener listener)
          Adds a listener for ReportPartBookmarkNavigationEventArgs.
 void addReportSourceChangeEventListener(ReportSourceChangeEventListener listener)
          Adds a listener for report source changes.
 void dispose()
          Disposes of the ReportServerControl.
 ConnectionInfos getDatabaseLogonInfos()
          Returns the information required to log on to the database.
 java.lang.Object getEnterpriseLogon()
          Returns the information required to log on to Crystal Enterprise.
 Fields getParameterFields()
          Returns the parameter fields for the report.
 IReportSource getReportSource()
          Returns the report source object.
 java.lang.String getReportSourceClassFactoryName()
          Returns the name of the report source class factory for the report.
 java.lang.String getSelectionFormula()
          Returns the selection formula value for the report.
 java.lang.String getStyleSheetFileName()
          Returns the file name of the cascading style sheet applied to the report.
 boolean isEnableLogonPrompt()
          Returns whether or not logon prompting for the report is enabled.
 boolean isEnableParameterPrompt()
          Returns whether or not parameter prompting for the report is enabled.
 boolean isReuseParameterValuesOnRefresh()
          Gets whether the current parameter values will be used when the viewer is refreshed.
 void navigateTo(java.lang.String sDataContext, java.lang.String sObjectName)
          Navigates to a particular report object in the current report.
 void refresh()
          Refreshes the ReportServerControl object.
 void removeReportPartBookmarkNavigationEventListener()
          Removes a DrillDownSubreportEventListener.
 void removeReportPartBookmarkNavigationEventListenerr()
          Deprecated.  
 void removeReportSourceChangeEventListener()
          Removes a report source change event listener.
 void setDatabaseLogonInfos(ConnectionInfos newDatabaseLogonInfos)
          Sets the information required to log on to the database.
 void setEnableLogonPrompt(boolean newEnableLogonPrompt)
          Sets whether or not the logon prompt is enabled for the report.
 void setEnableParameterPrompt(boolean newEnableParameterPrompt)
          Sets whether or not the parameter prompt is enabled for the report.
 void setEnterpriseLogon(java.lang.Object newEnterpriseLogon)
          Sets the information required to log on to Crystal Enterprise.
 void setParameterFields(Fields newParameterFields)
          Sets the parameter fields for the report.
 void setReportSource(java.lang.Object reportSource)
          Sets the report instance that the viewer will render in HTML.
 void setReportSourceClassFactoryName(java.lang.String newReportClassFactoryName)
          Sets the report source class factory name.
 void setReuseParameterValuesOnRefresh(boolean newReuseParameterValuesOnRefresh)
          Sets whether or not to re-prompt parameters on refresh.
 void setSelectionFormula(java.lang.String newSelectionFormula)
          Sets the selection formula that will be used when the report is displayed.
 void setStyleSheetFileName(java.lang.String newStyleSheetFileName)
          Sets the style sheet that will be used to display the report content.
 void setURI(java.lang.String newURI)
          Sets the Universal Resource Identifier for the report.
 void setViewTimeSelectionFormula(java.lang.String newSelectionFormula)
          Reserved for future use.
 
Methods inherited from class com.crystaldecisions.report.web.ServerControl
deserializeBase64ToObject, getHeight, getHtmlContent, getLeft, getName, getTop, getURI, getViewState, getWidth, isIgnoreViewStateOnLoad, isOwnForm, isOwnPage, processHttpRequest, setHeight, setIgnoreViewStateOnLoad, setLeft, setName, setOwnForm, setOwnPage, setTop, setViewState, setWidth
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportServerControl

public ReportServerControl()
Method Detail

addReportPartBookmarkNavigationEventListener

public void addReportPartBookmarkNavigationEventListener(IReportPartBookmarkNavigationEventListener listener)
                                                  throws java.util.TooManyListenersException

Adds a listener for ReportPartBookmarkNavigationEventArgs. Please note that report parts are not available without the advanced viewers available with the Report Application Server. For more information, see the Crystal Reports for BEA WebLogic Workshop Developer's Guide.

Parameters:
listener - The DrillDownSubreportEventListener.
Throws:
TooManyListenersException - This is thrown if you attempt to add more than one listener on a particular listener source concurrently.

addReportSourceChangeEventListener

public void addReportSourceChangeEventListener(ReportSourceChangeEventListener listener)

Adds a listener for report source changes.

Parameters:
listener - The listener for report source changes.

dispose

public void dispose()

Disposes of the ReportServerControl.


getDatabaseLogonInfos

public ConnectionInfos getDatabaseLogonInfos()
                                      throws ReportSDKExceptionBase

Returns the information required to log on to the database.

Note: The viewer sets the value of this property after you set the report source for the report.

Note: This method is only available after the processHttpRequest method or getHtmlContent method has been called.

Returns:
The information required to log on to the database as a com.crystaldecisions.sdk.occa.report.data.ConnectionInfo object.
Throws:
ReportSDKExceptionBase - This exception is thrown if the process is unsuccessful..
See Also:
setDatabaseLogonInfos, setEnableLogonPrompt

getEnterpriseLogon

public java.lang.Object getEnterpriseLogon()

Returns the information required to log on to Crystal Enterprise.

Note: This can be a Crystal Enterprise session or a Crystal Enterprise Token.

Returns:
The information required to log on to Crystal Enterprise as an Object.
See Also:
setEnterpriseLogon

getParameterFields

public Fields getParameterFields()
                          throws ReportSDKExceptionBase

Returns the parameter fields for the report.

Note: This method is only available after the processHttpRequest method or getHtmlContent method has been called.

Returns:
The parameter fields for the report as a com.crystaldecisions.sdk.occa.report.data.Fields object.
Throws:
ReportSDKExceptionBase - This exception is thrown if the process is unsuccessful..
See Also:
isEnableParameterPrompt, setEnableParameterPrompt, setParameterFields

getReportSource

public IReportSource getReportSource()
                              throws ReportSDKExceptionBase

Returns the report source object.

Returns:
The report source object.
Throws:
ReportSDKExceptionBase - This exception is thrown if the process is unsuccessful..
See Also:
setReportSource

getReportSourceClassFactoryName

public java.lang.String getReportSourceClassFactoryName()

Returns the name of the report source class factory for the report.

Returns:
The name of the report source class factory for the report as a String.

getSelectionFormula

public java.lang.String getSelectionFormula()
                                     throws ReportSDKExceptionBase

Returns the selection formula value for the report.

Note: This method is only available after the processHttpRequest method or getHtmlContent method has been called.

Returns:
The selection formula value for the report as a String.
Throws:
ReportSDKExceptionBase - This exception is thrown if the process is unsuccessful..
See Also:
setSelectionFormula

getStyleSheetFileName

public java.lang.String getStyleSheetFileName()

Returns the file name of the cascading style sheet applied to the report.

Returns:
The file name of the cascading style sheet applied to the report as a String.
See Also:
setStyleSheetFileName

isEnableLogonPrompt

public boolean isEnableLogonPrompt()

Returns whether or not logon prompting for the report is enabled.

Returns:
true if logon prompting is enabled, otherwise false.
See Also:
getDatabaseLogonInfos, setDatabaseLogonInfos, setEnableLogonPrompt

isEnableParameterPrompt

public boolean isEnableParameterPrompt()

Returns whether or not parameter prompting for the report is enabled.

Returns:
true if parameter prompting is enabled, otherwise false.
See Also:
getParameterFields, setEnableParameterPrompt, setParameterFields

isReuseParameterValuesOnRefresh

public boolean isReuseParameterValuesOnRefresh()

Gets whether the current parameter values will be used when the viewer is refreshed.

Returns:
true if the current parameter values will be used when the viewer is refreshed and false otherwise.
See Also:
getParameterFields, isEnableParameterPrompt, setEnableParameterPrompt, setParameterFields, setReuseParameterValuesOnRefresh

navigateTo

public void navigateTo(java.lang.String sDataContext,
                       java.lang.String sObjectName)

Navigates to a particular report object in the current report.

Note: The data context represents the whole group tree or a sub tree in the group tree. DataContext can be specified using either strings or integers to narrow down the search for the report object.

Example 1:

"/Country[USA]/Region[CA]" or "2-1". Each of these examples navigates to the California region, which is found by going to the third node in the first group level and then the second node in the second group level.

Example 2:

"/Country[USA]/Region[*]" or "2-*".Each of these examples navigates to all regions in the USA, which is found by going to the third node in the first group level and then the second group level.

Note: The wild card (*) can only be set for the last level.

Parameters:
sDataContext - A String that specifies the data subtree of the report.
sObjectName - A String that specifies the name of the report object.

refresh

public void refresh()

Refreshes the ReportServerControl object.


removeReportPartBookmarkNavigationEventListener

public void removeReportPartBookmarkNavigationEventListener()

Removes a DrillDownSubreportEventListener.


removeReportPartBookmarkNavigationEventListenerr

public void removeReportPartBookmarkNavigationEventListenerr()
Deprecated.  

Removes a DrillDownSubreportEventListener.


removeReportSourceChangeEventListener

public void removeReportSourceChangeEventListener()

Removes a report source change event listener.


setDatabaseLogonInfos

public void setDatabaseLogonInfos(ConnectionInfos newDatabaseLogonInfos)

Sets the information required to log on to the database.

Parameters:
newDatabaseLogonInfos - A com.crystaldecisions.sdk.occa.report.data.ConnectionInfo object that specifies the information required to log on to the database.
See Also:
getDatabaseLogonInfos

setEnableLogonPrompt

public void setEnableLogonPrompt(boolean newEnableLogonPrompt)

Sets whether or not the logon prompt is enabled for the report.

Parameters:
newEnableLogonPrompt - true to enable logon prompt for the report.
See Also:
isEnableLogonPrompt, getDatabaseLogonInfos, setDatabaseLogonInfos

setEnableParameterPrompt

public void setEnableParameterPrompt(boolean newEnableParameterPrompt)

Sets whether or not the parameter prompt is enabled for the report.

Parameters:
newEnableParameterPrompt - true to enable parameter prompt for this report.

setEnterpriseLogon

public void setEnterpriseLogon(java.lang.Object newEnterpriseLogon)

Sets the information required to log on to Crystal Enterprise.

Note: This can be a Crystal Enterprise session or a Crystal Enterprise Token.

Parameters:
newEnterpriseLogon - An Object that specifies the information required to log on to Crystal Enterprise.
See Also:
getEnterpriseLogon

setParameterFields

public void setParameterFields(Fields newParameterFields)

Sets the parameter fields for the report.

Note: If the value of the ParameterFields property is not set at design time, you can prompt the user for parameter fields before the report is run by setting the setEnableParameterPrompt method to true.

The viewer sets the value of this property after you set the report source for the report.

Parameters:
newParameterFields - A com.crystaldecisions.sdk.occa.report.data.Fields object that specifies the new parameter fields for the report.
See Also:
getParameterFields, isEnableParameterPrompt, setEnableParameterPrompt

setReportSource

public void setReportSource(java.lang.Object reportSource)
                     throws ReportSDKExceptionBase

Sets the report instance that the viewer will render in HTML.

Example 1:


 CrystalReportViewer viewer = new CrystalReportViewer();
 IReportSourceFactory reportSourceFactory = (IReportSourceFactory) enterpriseSession.getService("PSReportFactory");
 Object reportSource = reportSourceFactory.openReportSource(report,Locale.ENGLISH);
 viewer.setOwnForm(true);
 viewer.setOwnPage(true);
 viewer.setName("Viewer1");
 viewer.setReportSource(reportSource);
 

Example 2:


 CrystalReportViewer viewer = new CrystalReportViewer();
 IReportAppFactory reportAppFactory = (IReportAppFactory) enterpriseSession.getService("RASReportFactory");
 ReportClientDocument clientDoc = reportAppFactory.openDocument(report,0,Locale.ENGLISH);
 viewer.setOwnForm(true);
 viewer.setOwnPage(true);
 viewer.setName("Viewer2");
 viewer.setReportSource(clientDoc.getReportSource());
 

Parameters:
reportSource - An Object representing the report instance that the viewer will render in HTML.
Throws:
ReportSDKExceptionBase - This exception is thrown if the process is unsuccessful.
See Also:
getReportSource

setReportSourceClassFactoryName

public void setReportSourceClassFactoryName(java.lang.String newReportClassFactoryName)

Sets the report source class factory name.

Parameters:
newReportClassFactoryName - A String that specifies the report class factory name.

setReuseParameterValuesOnRefresh

public void setReuseParameterValuesOnRefresh(boolean newReuseParameterValuesOnRefresh)

Sets whether or not to re-prompt parameters on refresh.

Parameters:
newReuseParameterValuesOnRefresh - true to re-prompt parameters on refresh.
See Also:
isReuseParameterValuesOnRefresh

setSelectionFormula

public void setSelectionFormula(java.lang.String newSelectionFormula)

Sets the selection formula that will be used when the report is displayed.

Note:The default value is an empty string.

Parameters:
newSelectionFormula - A String that specifies the selection formula to use when the report is displayed.
See Also:
getSelectionFormula

setStyleSheetFileName

public void setStyleSheetFileName(java.lang.String newStyleSheetFileName)

Sets the style sheet that will be used to display the report content. The file should be located in the directory crystalreportviewers\css on the machine where the RAS server is running. The cascading style sheet that you use needs to contain the same classes as the default style sheet.

Parameters:
newStyleSheetFileName - A String that specifies the file name for the style sheet (for example stylesheet.css).

setURI

public void setURI(java.lang.String newURI)
Description copied from class: ServerControl

Sets the Universal Resource Identifier for the report.

Overrides:
setURI in class ServerControl
Parameters:
newURI - A String that specifies the Universal Resource Identifier for the report.
See Also:
getURI

setViewTimeSelectionFormula

public void setViewTimeSelectionFormula(java.lang.String newSelectionFormula)

Reserved for future use.