Hide logout option for externally authenticated users in JasperReport Server

Hide logout option for externally authenticated users in Jasper Report Server

  • An external user is a user outside of an organization who does not directly login to Jasper Reports Server.
  • JasperReports Server does not store the passwords of external users, and is not impacted by changes to user passwords or user password policies on the external authority only the login name is stored in an external user account.
  • In JasperReports Server if you want to hide logout option for externally authenticated users, following are the steps to achieve it :



Used Jasper Report Server Version : 6.4.0

  1. Goto to path : \WEB-INF\decorators\
  2. Open the decorator.jsp file
  3. Comment below code :
  4.         <authz:authorize ifNotGranted="ROLE_ANONYMOUS">
            <li id="main_logOut" class="last" role="menuitem">
            <a id="main_logOut_link" tabindex="-1">
            <spring:message code="menu.logout"/>
            </a>
            </li>
            </authz:authorize>
         


  5. Add below code before commented code which check for externally authenticated user and hides the logout option for it :

  6. <c:set var="isExternallyDefinedUser" value="<%= ((com.jaspersoft.jasperserver.api.metadata.user.domain.User)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).isExternallyDefined()%>"/>
    
    <c:if test="${!isExternallyDefinedUser}">
    
    <authz:authorize ifNotGranted="ROLE_ANONYMOUS">
    
    <li id="main_logOut" class="last" role="menuitem">
    
    <a id="main_logOut_link" tabindex="-1">
    
    <spring:message code="menu.logout"/>
    
    </a>
    
    </li>
    
    </authz:authorize>
    
    </c:if>
    


  7. Save decorator.jsp file

To test hide logout option for externally authenticated user :

  1. Custom authentication
  2. Manually update “externallydefined” flag in database and test.

We can test hide logout option for externally authenticated user by second mentioned way :

  1. Connect to Jasperserver postgres database.
  2. Check users present in jasperserver by executing below query :

Select * from jiuser;

  1. You will get all users details which are present in jasper server , check the id of user to which you want to make it as externally defined user.
  2. Let us assume if you want to make testuser as externally defined user and its id is 65874 then to make is as externally defined user execute below query which set the “externallydefined” flag/value to “t”.

Verify the set flag value by executing Select * from jiuser;

  1. Now restart the jasperserver and its repository(postgres).
  2. Login to jasper server with superuser access through browser.
  3. Goto->Mange->Users and select testuser.
  4. Click on Login as User button.



Picture1

9.You will directly logged with testuser which don’t having the logout option .

 

Picture2

 

Thanks,

Sayali Mahale | Helical IT Solutions

Date Field Format Customisation in Adhoc View on Japser UI

Date Field Format Customisation in Adhoc View on Japser UI

Often while working with Adhoc Reports on jasper we get limited option for the availble date format in jasper. There are number of ways to fix this but one I am going to discuss here is by adding date format options in the backend of Jasperserver.

How we can add the different date formats in the Jasper UI itself is what I am going to describe in this blog. Here we are going to add the date format for “06/24/2016 11:15:25 a.m”.

1.First navigate to the path:
apache-tomcat\webapps\jasperserver-pro\WEB-INF\bundles\adhoc_masks.properties
where jasperserver is installed.
2. Open the file adhoc_mask.properties.
3. Edit the file content which appear somewhat like this:-

blog 1

4. Add “ADH_100_MASK_timestamp_5 = MM/dd/yyyy HH:mm:ss a” at required location.
5. In similar fashion we can customise the UI for the required date formats.
6. After making the changes save the file and restart the server. As new changes get reflected only after restarting the server.
7. Once the server gets restarted in the jasperserver you can notice the new option for date format by clicking on the date field in adhoc view, which we have just added in the backend file.

blog 2

Similarly we can edit the formatting of integer and decimal. Adding the format options in this way gives you more generalised approach to handle data formatting related tasks in jasper adhoc.

Thanks
Nisha Sahu

USING PARMETERS IN iREPORT

USING PARMETERS IN iREPORT

 

Most basic knowledge any new learner would have of word parameter -“ parameter is a limit or boundary which defines the scope of a particular process or activity ”. And technically we can define it as – “A numerical or other measurable factor forming one of a set that defines a system or sets the conditions of its operation. ” Or call it “filter” in simple words.

But in jasper-reports they represent the best way communication channel between the report engine and the execution environment (which is your application). After designing the report and checking its preview, what designer will provide as solution to the user for his desired criteria for report generation at run time, the answer is parameter. So, here are basic steps using which you can add parameters to your report to enhance its reporting experience for user. Add parameter to the report from report inspector, and manage its addition and removal from the report .

1Fig 1.1

Right click on the “parameter 1” as shown in Fig 1.1, and rename the parameter as per your convenience. Now, pay attention to its properties to modify it .

2Fig 1.2

In properties you will notice fields as shown in Fig 1.2 , after naming it and defining its class in “parameter class” which is basically its data type, you need to provide “default value expression ” which gets executed only when value of parameter is not provided by the user at run time. Check box of “use as prompt” for pop up to get value from user , which will appear as shown in Fig 1.3.

3

Fig: 1.3

Next question is how parameter gets executed in SQL query of report?

 

Parameters can be used in SQL queries to filter records in a where condition or to add/replace pieces of raw SQL or even to pass the entire SQL string to execute.

In the first case the parameters are used as standard SQL parameters, in example:
SELECT * FROM DEPARTMENT WHERE DEPARTMENT_ID = $P{parameter1}
Syntax of parameter in query : $P{parameter1}
In above example the entered  value get evaluated to display the details of row containing values of DEPARTMENT_ID entered by user through parameter. Result will get displayed as Fig: 1.4
In this user will be solely responsible for the correct execution of report as only entered value will be used in the execution of query.

4Fig 1.4

Thanks,

Nisha Sahu

 

 

Use BuiltIn parameters in Jasper Reports

Use BuiltIn parameters in Jasper Reports

Jasper provides few builtIn parameters which can be used in JRXML.
Click on this link for more information
Following are few builtin parameters

  1. LoggedInUserFullName :
    • Type of this parameter is ‘String’.
    • This parameter gives you full name of loggedin user.
  2. LoggedInUsername :
    • Type of this parameter is ‘String’.
    • This parameter gives you user name of loggedin user.
    • Example: If you want to show username and fullname of person at the bottum of your page then you can use this on your page footer
    "Last printed by " + $P{LoggedInUserFullName} + " on "  + new java.util.Date() 
    
  3. LoggedInUserTenantId :
    • Type of this parameter is ‘String’. Not applicable for Community Edition.
    • This is used to get organization of logged in user.
  4. LoggedInUserRoles :
    • Type of this parameter is ‘Collection<String>’.
    • This parameter gives you all roles of loggedin user.
    • Example : if you want to show only reports to user who has role ‘ROLE_ADMINISTRATOR’ then you can use this in print when expression
    ($P{LoggedInUserRoles}.toString().contains("ROLE_ADMINISTRATOR")) ? new Boolean(true) : new Boolean(false)
    
  5. LoggedInUserAttribute_<attribute name> :
    • Type of this parameter is ‘String’.
    • This built in parameter is used to get value of specific profile attribute by passing the name of profile attribute name.
    • Eample: lets say one of your profile attribute name is city and profile attribute value is Maxico.
      If you want to get value of city (value Maxico) in your JRXML then do this
      -> replace “_<attribute name>” to profile attribute name
      ie. LoggedInUserAttribute_city

As we know, we can add comma separated value to profile attribute but we can not directly use this profile attribute in JRXML as list. In order to use comma separated profile attribute as a list in your JRXML then refer this

Convert Comma Separated Profile Attribute to list in Jasper Reports

Jasper Server External Database Authentication

                                                                 JasperServer External Database Authentication

Jasper Report Server can be configured to perform authentication and authorization using external table.

Purpose
This kind of authentication can be used when an application is using any other database to store users, roles and organization data, and if it wants jasper server to sync-up data and create same users, roles and organization information what it has stored in database. It also can be used to set up environment for SSO.
We need to configure jasper server to use this authentication process.

Steps to configure Jasper server

STEP-1
Copy <JS_INSTALL>/samples/externalAuth-sample-config/sample-applicationContext-externalAuth-db.xml to /WEB-INF directory.

STEP-2
Rename copied file to applicationContext-externalAuth-db-mt.xml.
Now, edit and configure beans of applicationContext-externalAuth-db-mt.xml.

STEP-3
Find below mentioned bean tag and configure according to your requirement. This tag is used for database parameters. Here, I am using mysql for external database authentication.

<bean id=”externalDataSource” class=”org.springframework.jdbc.datasource.DriverManagerDataSource”>

        <property name=”driverClassName” value=”com.mysql.jdbc.Driver”/>

        <property name=”url” value=”jdbc:mysql://localhost:3306/jasper_external”/>

        <property name=”username” value=”user”/>

        <property name=”password” value=”****”/>

NOTE: For testing purpose, you can create same database structure as jasper server use for authentication.

STEP-4
Find “externalUserTenantDetailsService” bean tag and configure: E.g.

<bean id=”externalUserTenantDetailsService”    class=”com.jaspersoft.jasperserver.multipleTenancy.security.externalAuth.db.MTExternalJDBCUserDetailsService”>

        <property name=”dataSource” ref=”externalDataSource”/>

        <property name=”usersByUsernameAndTenantNameQuery” value=”SELECT u.username, u.password, t.org_name FROM h_users u LEFT JOIN organization t ON u.org_id = t.id WHERE username =?”/>

        <property name=”authoritiesByUsernameQuery” value=”SELECT u.username, r.role_name FROM h_users u, user_role ur, role r WHERE u.id = ur.user_id and ur.role_id=r.id and u.username = ?”/>

        <property name=”multiTenancyConfiguration”><ref bean=”multiTenancyConfiguration”/></property>

    </bean>

NOTE: You can change table name, column names but sequence of column should not be changed in written query. Here, you can see I am using h_users table (custom table) instead jiuser (which is used by jasperserver) and column names are also different e.g. role_name.
This bean is responsible for queries which will be executed by jasperserver to use authentication.

STEP-5
Retrieving roles from database:
Configure “mtExternalUserSetupProcessor” bean to map the external information to roles in jasperserver.
• defaultInternalRoles property – A list of internal roles assigned to the external user by default.
• organizationRoleMap property – A list of key/value pairs that maps external role names to internal ones.

For commercial JasperReports Server deployments, you need to choose the level at which the role is assigned:

• To map to an internal role at the organization level, append |* to the name of the internal role, for example, ROLE_EXTERNAL_USER|*. Roles mapped at the organization level do not have administrative privileges.
• To map to an internal role at the system (null) level, do not modify the internal role name, for example, ROLE_EXTERNAL_ADMINISTRATOR. Roles at the system level are usually reserved for special users such as the system administrator and allow access to the repository folder of all other organizations.

The following example shows how to configure organizationrolemap:


<property name=”organizationRoleMap”>
    <map>                <entry>                                <key>                                                <value>ROLE_ADMIN</value>

                                </key>

                                <value>ROLE_ADMINISTRATOR|*</value>

                </entry>

</map>

</property>

STEP-6
Restart Jasper server.

 

Thanks

Sharad

Create a row grouping in Table Component (Jasper Report)

Create a row grouping in Table Component (Jasper)

Consider an example currently you are showing the data as shown in below using tabular component.
Example:

State Person Name Tax Amount
Iowa PQR 10,000
Iowa XYZ 15,248
Utah ABC 14,245
Utah DEF 13,256
Wisconsin GHI 12,789
Wisconsin JKL 11,100

But If you want to show the data as shown in the table.

State Person Name Tax Amount
Iowa
PQR 10,000
XYZ 15,248
Total 25,248
Utah
ABC 14,245
DEF 13,256
Total 27,501
Wisconsin
GHI 12,789
JKL 11,100
Total 23,889

For this you need to follow these simple steps.

  1. Create a group in the Groups property of data set (This data set is used by table component).
    Say Country is the name of the group and then put the expression.
  2. Note : Sometime in the Jasper Studio 6.0.1 the name of the group does not change in that case you need to keep the by default name to the group.

  3. After creating the Group you can see the two new bands added to table component. You can see in the figure.
  4. groupShow

  5. Create a cell in Group header and put group expression in it (in my case $F{country}).
  6. In order to calculate the total group wise you need to create a variable with reset type your group name (Country) otherwise you will not get the correct result.
  7. Put this variable (say total) in the group footer.

Note: You can create multiple group in a table.

Welcome Page Customization For JasperSoft on the Basis of Roles

On Welcome page of Jaspersoft, Login is based on Some Roles assigned to particular user ,as per that we have an access on Jaspersoft. If anyone wants to create their own user with Roles, they simply do it by making following changes in particular files.

Let us consider that we are creating following three different Users and Roles with some http://helicaltech.com/wp-admin/post.php?post=3624&action=editrequirement:

1)Create three different Users

i)Reports

ii)Dashboard

iii)Adhoc

2)Create three different Roles

i) ROLE_REPORT

ii)ROLE_ DASHBOARD

iii)ROLE_ ADHOC

3)Assign Role for each User As

i) For Report User Assign ROLE_ REPORTS

ii) For Dashboard User Assign ROLE_ DASHBOARD

iii) For Adhoc User Assign ROLE_ ADHOC

4) In MenuBar only View button should be their which contains only Repository option and for user other than above, it will show all Menus.

5)The Home page contains only three Containers which has only viewlist button at center

that is:

i)Reports

ii)Dashboards

iii) Ad Hoc Views

6) This three containers needs to be modified to display the text as:

i)Reports – Change the existing text to: Click on ‘View list’ to access all Reports in repository.

ii)Dashboards – Change text existing to: Click on ‘View list’ to access links to Dashboards.

iii)Ad Hoc Views – Change the existing text to: Click on ‘View list’ to access all AdHoc Views in Repository.

7) All text present in left side of Home Page will get removed.

Now we have do customization on JasperSoft to accomplish the requirement ,for that we requires to modify the following different files as below:

NOTE: After modifying the files, to see changes done on JasperSoft,it is important to firstly restart the tomcat-server, then and then only you are to able to see the changes.

1) To Grant the permissions for Users:

i)Navigate to the path : C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\WEB-INF\jsp\modules\home

/* If this condition is true it redirects to HomePage1.js */<authz:authorize ifAnyGranted=”ROLE_REPORTS,ROLE_ DASHBOARD,ROLE_ ADHOC”><c:set var=”ModuleName” value=”home/HomePage1“/></authz:authorize> 

/* Else it redirects to HomePage.js */

<authz:authorize ifNotGranted=”ROLE_REPORTS,ROLE_DASHBOARD,ROLE_ADHOC”>

<c:set var=”ModuleName” value=”home/HomePage“/>

</authz:authorize>

 

/*Insert this line to add variable created above*/

<t:putAttribute name=”moduleName”>${ModuleName}</t:putAttribute>

 

ii)In that homeForNonDemo.jsp contains code related to grant permissions for the user,so here we have to grant permissions to User Report,Dashboard,Adhoc as follows:

iii) Firstly restart the server, now you are able to logged onto server using different three  users that is Reports,dashboard,AdHoc.

 

2)To change the HomePage which contains HomeView:

i)After logged in with above users, it will redirects to HomePage1

ii)Goto C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-   pro\scripts\home

iii)In that create .js file same as HomePage.js,but make following changes in HomePage1.js, which we are already create as HomeView1.js as HomeView.js.

HomeView = require(“home/view/HomeView1“)

 

3)To change the HomeView which contains different views we have to change:

i)From HomePage1 it will redirects to HomeView1

ii)Navigate to path : C:\Jaspersoft\jasperreports-server-5.6\apache- tomcat\webapps\jasperserver-pro\scripts\home\view

iii)create HomeView1.js as HomeView,it is having Listview and WorkflowView,homeTemplate add the ListView1,WorkflowView1,homeTemplate1.js files created by us.

ListView = require(“home/view/ListView1“),WorkflowView = require(“home/view/WorkflowView1“),homeTemplate = require(“text!home/template/homeTemplate1.htm“),

 

4)To change the text which the container displays:

i)Goto C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\view

ii)In that ListView1.js file we need to modify the text as:

render: function () {var nothingToDisplayElement;if (this.collection.length > 0){//cleanup only for ‘nothing’ msg, no listeners to remove herethis.$el.html(“”);

this.collection.forEach(_.bind(function(model){

var name = model.get(‘name’);

               console.log(model);

                if (name == ‘dataSource’ || name == ‘domain’) {return;}

                if(name == ‘dashboard’) {

                model.set(‘description’,’Click on View list to access links to Dashboards in repository’);}

             if(name == ‘adhocView’) {

                model.set(‘description’,’Click on View list to access links to Ad hoc Views in repository’);}
if(name == ‘report’) {

                model.set(‘description’,’Click on View list to access links to Reports in repository’);}

var view = new this.initOptions.listElementView({ model: model });this.subviews.push(view);this.$el.append(view.render().$el);

},this)).

}else{

nothingToDisplayElement = _.template(nothingToDisplayTemplate, {message: this._msgNothingToDisplay});

this.$el.append(nothingToDisplayElement);

}

 

return this;

}

 

 

iv)It will change the containers display text.

5)To change the click event of the Viewlist presents on the container:

i)Navigate to C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\view

ii)Goto workflowView1,change the path of template and modify click event as:

template = require(“text!home/template/workflowTemplate1.htm“),events: {     “click .button.left”: “clickOnLeftButton”,”click .button.center“: “clickOnRightButton” },

iii)Now you are able to see Viewlist at Middle.

6)To remove ViewTutorial from Containers:

i)Goto to C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\Template

ii)In workflowTemplate.html comment or remove the text which shows the ViewTutorial as

<!–{{ if (tutorialControl) { }}<a href=”{{- tutorialControl.entity.url }}” target=”_blank” >{{- tutorialControl.label }}     </a>{{ } }}–>

 

7)To Remove Left Side text from Home Page:

i)Navigate to var C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\Template

ii) Having homeTemplate1.html in that comment or remove the following text as:

<h2 class=”homeSidebar-title” >{{- welcomeMessage }}</h2>

 

8)To display View Menu having only Repository option:

i)Goto /var/lib/tomcat7/webapps/jasperserver-pro/WEB-INF/decorators

ii) In decorators.jsp modify as follows and add assign menu.search,menu.all to administrator

<context name=”main_view_mutton” test=”checkAuthenticationRoles” testArgs=”ROLE_SUPERUSER,ROLE_ADMINISTRATOR,ROLE_REPORTS,ROLE_DASHBOARD,ROLE_ADHOC”> <selectAction labelKey=”menu.repository”>

 

9)To hide Library Menu From Jaspersoft for Above Roles As:

i)Goto C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\WEB-INF\decorators

ii) In decorator.jsp modify it as:

<js:authorize ifAllGranted=”ROLE_ADMINISTRATOR”><li id=”main_library” tabIndex=”-1″ class=”leaf”><p class=”wrap button”><span class=”icon”></span><spring:message code=”menu.library”/>

</p>

</li>

</js:authorize>

It means we are hiding the Library menu for Above Roles but it is Visible to Role Administrator.

10)To optimize your javascript code we need make change in js.config.properties file which is present at path:

C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\WEB-INF

But now we don’t know to create the optimized js code because of that we will keep it as false:

# Control default value of javascript optimization in runtimejavascript.optimize=false

 

 Thanks,
Sayali Mahale

White Labeling  of  JasperSoft

                                                            

White Labeling  of  Jaspersoft

A white-labeling is a service produced by one company for example Jaspersoft, that other companies reband to make it appear as if they had made it. Customers sometimes want to customize the look and feel of the Jasper Reports Server interface by performing customizations. As Jasper Report is open source tool we can customize it.

Jaspersoft Login Page

Such as:

  1. Branding on the  Browser tab and Title Bar
  2. Favicon
  3. Logo
  4. Welcome label
  5. Contact button
  6. About and Copyright
  7. Theme

Let us consider that we are making customization from Jaspersoft to Helical IT Solutions :

To customize Branding on the Browser tab and Title Bar

The Branding on the browser tab and title bar includes the:

  • The company name on the browser tab.
  • The company name on the title bar.

Important Note:
After making changes save the file and first of all Restart the Server then only you are able to see the changes.

To change the company name on browser tab and title Bar :
1) Open this file for editing:
C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\WEB-INF\decorators\decorator.js
2) Change the title as you want in <title> tag.

<html><head><title>Helical IT Solutions: <decorator:title /></title></head></html>

3) Log into the Server.

                                                                                                                                                                                          

To change Favicon

1) Rename your icon to favicon.ico.

2)Copy the icon to this location : C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps

3) Log into the Server.

                                                                                                                                                              

To change Logo

To change the Logo on all pages including Login Page:

1)Navigate to the path:

C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\themes

2)Copy the logo image logo.png with dimension as 141*28 pixels and give it the same name logo.png

3)Log into the server as superuser.

4)Goto View->Repository

5)In the folder panel on left side right click on root/Themes,and select Add Folder.

6)Name the new folder customizations

Capture1

7)Right-click the customizations folder, and select Add Folder,Name the new folder images

8) Add your logo to the images folder:

a. Right-click the images folder and select Add Resource > File > Image

Capture2

The Upload a File From Your Local Computer page appears.
b. Browse to your logo.
c. In the Name field, enter logo.png
d. In the Resource ID field, enter logo.png

Capture3

9)Click Submit .

10)The logo.png file appears in the
Themes > customizations > images folder in the repository.

Now the logo is available on server it appears in the web interface after you perform the procedure “To Add New Theme ” as mention.

                                                                                                                                                                                        

To customize Welcome label

1) Navigate to the path:

C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro \WEB-INF\bundles\

2)Open this file for editing:
jasperserver_messages.properties

3) Search for a Login page in file
Change LOGIN_WELCOME_OS property to Welcome to Helical IT Solutions

#Welcome Login PageLOGIN_WELCOME_OS=Welcome to Helical  IT Solutions# the following 2 strings belong to the same sentenceLOGIN_ONLINE_DEMO_PRE=For a quick look at the functionality, check outLOGIN_ONLINE_DEMO=our online demos.

                                                                                                                                                                

To customize the Contact JasperSoft Button URL And Label

1) Open this file for editing

C:\Jaspersoft\jasperreportsserver5.6\apachetomcat\webapps\jasperserver-pro scripts\
components.loginBox.js

2) Change the URL of the CONTACT_SALES_URL in the loginBox variable definition from the jaspersoft.com address to another address, for example, http://www.helicaltech.com

var loginBox = {LOGIN_BOX_TEMPLATE_DOM_ID: “login”,.. CONTACT_SALES_URL: “http://www.helicaltech.com”,_dom: null,

 

3)Open the following file for editing:

C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\WEB-INF\bundles\
jasperserver_messages.properties

4)Search for the BUTTON_CONTACT_SALES property and the definition from Contact JasperSoft to Contact Helical.
BUTTON_CONTACT_SALES=Contact Helical

                                                                                                                                                                                                                                           To customize About and Copyright

To hide the copyright and About link on all server pages, including the Login page:

1) On the file system of the server, navigate to the \themes directory in the server installation files. By default, this directory is in the following source code location:

C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\themes

2) Copy overrides_custom.css to a different location on your hard drive and open it in a CSS editor.

3) Add the following line to the file:

#about, #copyright{display:none;} 

                                                                                                                                                                                                                                            To Add New Theme

To activate the customizations theme :

1) Log into the server as superuser.

2) Click View > Repository

3) In the Folders panel, right-click the customizations folder in Themes,Add themes.css file.

5)Right click the customizations folder select Set as Active Theme.

6)Logout to the server, Restart it ,to see the changes.

 

Thanks ,
Sayali Mahale

Jaspersoft Ad hoc reports: Quick performance measurement & optimization tips

Measuring Ad-hoc performance

1. Log on JasperReports server as system admin (superuser by default).

2. Navigate to Manage > Server Setting > Ad hoc cache.

The Ad Hoc Cache page appears, displaying all the datasets that are in the cache, sorted by age.

Capture1

3. Ad Hoc performance can be quickly measured by checking values of Query/Fetch

  • Query (msec): Time from when query was sent to the db until the first row was received. If this is slow then we should apply proper indexes in DB.
  • Fetch (msec): Time from when first row was received until the last row was received. If this is slow there might be a network bottleneck.

Performance tuning in Ad Hoc

Setting query limit

  1. Log on JasperReports server as system admin (superuser by default).
  2. Navigate to Manage > Server settings > Ad Hoc Settings.
  3. There are two parameters there that are worth testing for possible performance gains:

a)      Ad Hoc Filter List of Values Row Limit

  • The maximum number of items that should be displayed in the Condition Editor when a user defines filters for an Ad Hoc report that is based on a Domain. If this limit is exceeded when users define filters, Jasperserver displays a message to that effect.
  • Setting this to a lower value can improve performance.

b)      Ad Hoc Dataset Row Limit

  • The maximum number of rows that an Ad Hoc report can return. JasperServer truncates the data when the limit is reached.
  • Setting this to a lower number may improve performance, but your reports may not reflect the full data set.

Capture2

 

 

(Hope this blog would help you find quicker ways to resolve Ad-hoc performance related issues.)

Best Regards,

Archana

 

 

 

First encounter with Visualise.js

First encounter with Visualise.js

As we all know, visualise.js is a javascript framework introduced in JasperServer 5.6, for integration of jasperserver reports & visualizations inside web applications. It is available only with commercial editions of JasperServer 5.6.

Prior to 5.6, there were 2 methods for embedding, the simple HTTP/iframe integration method and the REST web APIs. The iframe way, though simple, did not give much control and limited branding options as it accesses the jasperserver UI itself from within the iframe. It however supports integration of Adhoc/Self service BI. REST APIs provided greater control, leverage to the repository services, greater control on the look and feel. However, it meant more coding, limited interactivity. Visualise.js leverages the REST APIs of jasperServer and provides a simple javaScript API, that could be easily used along with CSS to create webpages that seamlessly integrate interactive reports, with a few lines of code.

The API ranges from basic APIs for authentication, report rendering, resource search, accessing input controls to accessing/control of report events, errors, report hyperlinks. It also provides a way to interact with the JIVE UI components which provides a way to achieve higher interactivity.

After having a look at what visualise has to offer, lets see what it takes to embed a simple report using visualise.js. Below is a code snippet that shows a javascript code that renders a report into a div tag inside the webpage. This report takes one parameter, the store id.

HTML Page contents


<script type="text/javascript" src="http://localhost:8081/jasperserver-pro/client/visualize.js"></script>
<div id="container">Embedded a Sample Report</div>
<div id="testreport"></div>

JavaScript code using visualize.js

visualize({
    auth: {
        name: "joeuser",
        password: "joeuser",
        organization: ""
    }
}, function (v) {
  // Report API
    v("#testreport").report({
        resource: "/public/MyReports/Test1",
        params:{"storeid":["19"]},
        error: handleError
    });
    //showing Error
    function handleError(err) {
        alert(err.message);
    }
});

1. Loading the visualise.js script

<script type="text/javascript" src="http://localhost:8081/jasperserver-pro/client/visualize.js"></script>

This is the script tag which loads the visualize.js script from the location where it is present on the running instance of your JasperServer 5.6 (commercial edition).

2. A HTML container for the report
The division with ID “testreport” is the container for the report. This element will be passed to the visualize.js function when a report is rendered.

3. Authentication with JasperServer
Visualise is the function in visualize.js that establishes a connection with the JRS instance which hosts the report to be embedded. Its first parameter is an object which contains the configuration information required for connectivity – the URL of the JRS instance(server) and the authentication properties (auth).
The above example only shows authentication properties. The server URL is not provided, it internally takes the same server from which we requested the visualize script.

4. Rendering the report
The code for rendering the report is present in the callback function defined in the visualize call. ‘v’ is the client to the JRS instance for which session has been established.

v("#testreport").report({
        resource: "/public/MyReports/Test1",
        params:{"storeid":["19"]},
        error: handleError
 });

As can be seen, the selector to the container element in the html (#testreport) has been passed. The parameters are pretty self explanatory. “handleError” is a function which would handle any errors generated by report API.

5. Passing parameters to the report
As seen above, the “params” key in the argument to the report function is used to pass all the parameters to the report. The value has to be an array, even for single values to be passed.

And it is done !!

Hope this gives you basic understanding about visualise.js. A few more blog posts to follow, exploring other APIs of visualise.js. Till then, happy embedding !!

Imp References –
http://community.jaspersoft.com/wiki/visualizejs-api-notes-and-samples

– Shraddha
Helical IT Solutions