iHub API reference
This section lists all the methods in the iHub API in alphabetical order. Each method entry includes a general description of the method, the JavaScript and Java syntaxes, the result the method returns, and examples.
appendToJobStatus( )
Appends a specified string to the status of the current job. iHub writes status messages for each report-generation job.
JavaScript syntax
appendToJobStatus(statusString)
Java syntax
public void appendToJobStatus( String statusString )
Argument
statusString
The string to add to the job status.
Usage
Provide information for debugging purposes. For example, to verify that an event handler is executed, write a message indicating that the event method is called.
JavaScript example
reportContext.getAppContext().get("ServerContext")
.appendToJobStatus("This message appears when beforeFactory is called.\n");
Java example
IServerContext scontext;
scontext = (IServerContext) reportContext.getAppContext().get("ServerContext");
scontext.appendToJobStatus("This message appears when beforeFactory is called.\n");
getAuthenticationId( )
Retrieves the current user’s authentication ID.
JavaScript syntax
getAuthenticationId()
Java syntax
public String getAuthenticationId()
Usage
Use in cases when the report application needs to pass the ID to another application, such as IDAPI calls to iHub.
Returns
An authentication ID in String format.
JavaScript example
reportContext.getAppContext().get("ServerContext")
.getAuthenticationId();
Java example
IServerContext scontext;
scontext = (IServerContext) reportContext.getAppContext().get("ServerContext");
scontext.getAuthenticationId();
getServerWorkingDirectory( )
Retrieves the path to the folder in the file system where temporary files are stored.
JavaScript syntax
getServerWorkingDirectory()
Java syntax
public String getServerWorkingDirectory()
Usage
Use to read or write information from and to the file system.
Returns
The full path to the iHub working directory.
JavaScript example
reportContext.getAppContext().get("ServerContext")
.getServerWorkingDirectory();
Java example
IServerContext scontext;
scontext = (IServerContext) reportContext.getAppContext().get("ServerContext");
scontext.getServerWorkingDirectory();
getUserName( )
Retrieves the current user name.
JavaScript syntax
getUserName()
Java syntax
public String getUserName()
Usage
Use in cases when an application requires different code for different users.
Returns
The current user name.
JavaScript example
reportContext.getAppContext().get("ServerContext").getUserName()
Java example
IServerContext scontext;
scontext = (IServerContext) reportContext.getAppContext().get("ServerContext");
String currentUser = scontext.getUserName();
getUserAgentString( )
Identifies the browser used to view a report.
JavaScript syntax
getUserAgentString()
Java syntax
public String getUserAgentString()
Usage
Use in cases when an application requires different code for different browsers. The browser information is available only when the report is rendered, so use getUserAgentString( ) in a report element’s onRender event.
Returns
The browser type in String format. For Internet Explorer, for example, getUserAgentString( ) might return a string, such as:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1;
MS-RTC LM 8)
JavaScript example
reportContext.getAppContext().get("ServerContext")
.getUserAgentString();
Java example
IServerContext scontext;
scontext = (IServerContext) reportContext.getAppContext().get("ServerContext");
scontext.getUserAgentString();
getUserRoles( )
Retrieves the roles assigned to the current user.
JavaScript syntax
getUserRoles()
Java syntax
public List<String> getUserRoles()
Usage
Use in cases when an application requires different code for different iHub security roles.
Returns
The current user’s security roles.
JavaScript example
reportContext.getAppContext().get("ServerContext").getUserRoles();
Java example
IServerContext scontext;
scontext = (IServerContext) reportContext.getAppContext().get("ServerContext");
List<String> userRoles = scontext.getUserRoles();
getVolumeName( )
Retrieves the name of the iHub volume on which the report runs.
JavaScript syntax
getVolumeName()
Java syntax
public String getVolumeName()
Usage
Use in cases when an application running in a multi-volume environment requires volume information.
Returns
The name of the iHub volume running a report.
JavaScript example
reportContext.getAppContext().get("ServerContext")
.getVolumeName();
Java example
IServerContext scontext;
scontext = (IServerContext) reportContext.getAppContext().get("ServerContext");
scontext.getVolumeName();
setHeadline( )
Sets the headline of a generated report. A headline appears in a job completion notice that iHub writes to a channel.
JavaScript syntax
setHeadline(headline)
Java syntax
public void setHeadline( String headline )
Argument
headline
A string that represents the headline of a completed job.
Usage
Use to specify a headline based on the contents of a report, or on the value of a report parameter.
JavaScript example
reportContext.getAppContext().get("ServerContext")
.setHeadline("Sales Report for " + params["Region"].value);
Java example
String region = (String)reportContext.getParameterValue("Region")
IServerContext scontext;
scontext = (IServerContext) reportContext.getAppContext().get("ServerContext");
scontext.setHeadline("Sales Report for " + region);
setVersionName( )
Sets the version name of a generated report.
JavaScript syntax
setVersionName(versionName)
Java syntax
public void setVersionName( String versionName )
Argument
versionName
A string that represents the report’s version name.
Usage
Use to specify a version name that includes dynamic data, such as the contents of a report, the value of a report parameter, or the report-generation date.
JavaScript example
reportContext.getAppContext().get("ServerContext")
.setVersionName("Version " + new Date());
Java example
IServerContext scontext;
scontext = (IServerContext) reportContext.getAppContext().get("ServerContext");
scontext.setVersionName("Version " + new Date());