1. Check out report and user options together
2. Jasper server configuration tips
3. js-export error on invalid timestamps.
1. Check out report and user options together
A. Check out the resource
B. Find the related labels
cd /cygdrive/c/SG_SVN/Trunk/SYN/Source/JasperReports/resource/resources/organizations/organization_1/reports/Operations_Reports/TradeReports
$ egrep /organizations/organization_1/reports/Operations_Reports/TradeReports/TradeDetailsReport *.xml | awk '{print $1}' | sed -e s/.xml://g
js-export.bat --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/AU_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/BKK --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/CN_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/HK_settlements___HK_trade --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/ID_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/JKT_Int_l_Client --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/KR_Market_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/KR_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/MSKR_KR_Agency --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/MY_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/PH_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/PK_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/Pakistan --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/Pakistan_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/SA_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/SES --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/SG_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/TH_Trades --uris=/organizations/organization_1/reports/Operations_Reports/TradeReports/TradeDetailsReport --output-dir tradedetails
C. modify the files to change the folders.
D. import reports.
E. delete the old reports.
2. Jasper server configuration tips ( http://www.raj2u.net/jasperserver-quick-how-to.html)
Edit the $JASPER_ROOT/WEB-INF/bundles/jasperserver_messages.properties and change your desired text as below.
#Welcome Login Page
LOGIN_WELCOME_OS=Welcome to JasperServer Reporting System!
# the following 2 strings belong to the same sentence
LOGIN_ONLINE_DEMO_PRE=JasperServer is an open source business intelligence suite ....
LOGIN_ONLINE_DEMO=JasperReports is a powerful open source Java reporting tool ...
Now, replace the $JASPER_ROOT/WEB-INF/jsp/login_welcome.jsp with the one i attached here. You may see the differences before replace. Once the file replaced, the login page will look like below.
You need to edit $JASPER_ROOT/WEB-INF/applicationContext.xml and $JASPER_ROOT/WEB-INF/applicationContext-report-scheduling.xml. Look for "export parameters" section:
<!-- export parameters -->
<bean id="xlsExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.XlsExportParametersBean">
<property name="detectCellType" value="true"/>
<property name="onePagePerSheet" value="false"/>
<property name="removeEmptySpaceBetweenRows" value="false"/>
<property name="removeEmptySpaceBetweenColumns" value="true"/>
<property name="whitePageBackground" value="false"/>
<property name="ignoreGraphics" value="false"/>
<property name="collapseRowSpan" value="true"/>
<property name="ignoreCellBorder" value="true"/>
<property name="fontSizeFixEnabled" value="true"/>
<property name="maximumRowsPerSheet" value="0"/>
<property name="xlsFormatPatternsMap" ref="formatPatternsMap"/>
</bean>
<bean id="csvExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.CsvExportParametersBean">
<property name="fieldDelimiter" value="|"/>
</bean>
<bean id="pdfExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.PdfExportParametersBean">
<property name="localizedFontMap" ref="localePdfFontMap"/>
</bean>
<util:map id="formatPatternsMap">
<!-- entry key="¤ #,##0.00" value="$ #,##0.00"/-->
</util:map>
<!-- end export parameters -->
You need to edit $JASPER_ROOT/WEB-INF/jsp/repository/repositoryExplorer.jsp and add the "authz:authorize ifAllGranted" to set the permission based on role. In example below, i have granted scheduling / run background to role "Administrator" only.
<authz:authorize ifAllGranted="ROLE_ADMINISTRATOR">
<td style="cursor: pointer;" width='50' height='50' onClick='' id='schedule_td' align="center">
<a href='#' class='normalpx' id='schedule_td_a'><img src="images/schedule_enabled.gif" border='0' title='<spring:message code="RM_BUTTON_SCHEDULE_REPORT" javaScriptEscape="true"/>' id='schedule' /></a>
</td>
<td style="cursor: pointer;" width='50' height='50' onClick='' id='send_output_td' align="center">
<a href='#' class='normalpx' id='send_output_td_a'><img src="images/send_output_enabled.gif" border='0' title='<spring:message code="RM_BUTTON_RUN_IN_BACKGROUND" javaScriptEscape="true"/>' id='send_output' /></a>
</td>
</authz:authorize>
JasperServer comes with an option to enable user to change their own password. This option is disabled by default, therefore if you need to enable it, open the $JASPER_ROOT/WEB-INF/jasperserver-servlet.xml, under the "jsCommContr" bean look for "allowUserPasswordChange" and set it "true"
Besides that, you also can enforce the "password expiration" policy by setting the value in "passwordExpirationInDays" properties.
<property name="allowUserPasswordChange" value="true" />
<property name="passwordExpirationInDays" value="90" />
Upon successful login, JasperServer can redirect user to a page based on their role. This setting can be found in $JASPER_ROOT/WEB-INF/jasperserver-servlet.xml file - look for "loginController" bean. In the example below, i've redirect the user with "ROLE_USER" role to "listReportsFlow"
<property name="homePageByRole">
<list>
<value>ROLE_ADMINISTRATOR|redirect:/flow.html?_flowId=repositoryExplorerFlow</value>
<value>ROLE_USER|redirect:/flow.html?_flowId=listReportsFlow</value>
</list>
</property>
JasperServer use Report Virtualizer to cache the report output pages before it render to display. In the other word, it will store the temporary data (cache) in a file instead of holding it in system memory.
This will definitely will improve the overall performance and avoid the Java "OutOfMemory" error. Eventually, if the "virtualizer" size is not enough to hold the cache, it will through the error, therefore we can increase the virtualizer size by editing the $JASPER_ROOT/WEB-INF/applicationContext.xml file
<!-- report virtualizers -->
<bean id="fileVirtualizerFactory" class="com.jaspersoft.jasperserver.api.engine.common.service.impl.FileVirtualizerFactory">
<property name="maxSize" value="600"></property>
<property name="directory" value="${java.io.tmpdir}"></property>
</bean>
Starting from JasperServer 3.5, the password encryption is enabled by default. Since there are quit number of encoding mechanism available, some of us want to change the default encoding to MD5 or SHA.
This might be necessary to follow the organization's standard / policy or to synchronize the user details from other system which store the password in MD5 / SHA. To change the encoding, edit the $JASPER_ROOT/WEB-INF/applicationContext-security.xml, look for "passwordEncoder" bean.
Original:
<bean id="passwordEncoder" class="com.jaspersoft.jasperserver.api.metadata.common.service.impl.PasswordCipherer" lazy-init="false">
<property name="allowEncoding"><value>true</value></property>
<property name="keyInPlainText"><value>false</value></property>
<property name="secretKey"><value>0xC8 0x43 0x29 0x49 0xAE 0x25 0x2F 0xA1 0xC1 0xF2 0xC8 0xD9 0x31 0x01 0x2C 0x52 0x54 0x0B 0x5E 0xEA 0x9E 0x37 0xA8 0x61</value></property>
<property name="secretKeyAlgorithm"><value>DESede</value></property>
<property name="cipherTransformation"><value>DESede/CBC/PKCS5Padding</value></property>
</bean>
MD5:
<bean id="passwordEncoder" class="org.acegisecurity.providers.encoding.Md5PasswordEncoder">
<property name="encodeHashAsBase64"><value>false</value></property>
</bean>
SHA:
<bean id="passwordEncoder" class="org.acegisecurity.providers.encoding.ShaPasswordEncoder">
<property name="encodeHashAsBase64"><value>false</value></property>
</bean>
Then, you need to update the password is database according to the new encoding. Below is the sample encrypted password for "mypassword"
MD5: 34819d7beeabb9260a5c854bc85b3e44
SHA: 91dfd9ddb4198affc5c194cd8ce6d338fde470e2
Nowadays, most of the SMTP server is configured to SMTP authentication, and some might required TLS (STARTTLS / SSL) connection like Gmail.
Add the following entries to the "reportSchedulerMailSender" bean in JASPER_ROOT/WEB-INF/applicationContext-report-scheduling.xml file
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop> //required if smtp authentication needed
<prop key="mail.smtp.starttls.enable">true</prop> //required if TLS conenction needed (eg: Gmail)
</props>
</property>
3. js-export error on invalid timestamps.
It's an known bug in MySql, which is not really an JS issue.
When working with MySQL over JDBC and the driver encounters a zero DATE, TIME, or DATETIME value (that is, e.g, ‚0000–00–00‘ for DATE), an exception is thrown:
java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 4 to TIMESTAMP.
In this case, using SQL commands like
SET GLOBAL sql_mode = 'NO_ZERO_DATE';
does not help much, because that works only in „strict SQL mode“, and needs to be set for every connection, or globally for the whole server.
What helps is setting JDBC driver's zeroDateTimeBehavior property to convertToNull:
What should happen when the driver encounters DATETIME values that are composed entirely of zeroes (used by MySQL to represent invalid dates)? Valid values are "exception", "round" and "convertToNull".
The way to set it depends on the way you configure JDBC driver. The most common case is to use connection URL parameters. In my case it reads:
jdbc:mysql://localhost/test?zeroDateTimeBehavior=convertToNull&autoReconnect=true&characterEncoding=UT
asdf