public final class ReportUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static Date |
add(Date inputDate,
int addType,
int addAmount)
Adds given number of days/months/years to given date and returns the
resulting date
|
static String |
amountInWords(BigDecimal amount)
Converts given amount to words with default decimal precision of 2.
|
static String |
cancelledWatermarkAbsolutePath()
Gives the absolute path of the 'CANCELLED' Watermark image
|
static Object |
fetchFromDBSql(Connection connection,
String sqlQuery)
Executes given SQL query (which is expected to return a single object)
and returns the output.
|
static String |
formatNumber(BigDecimal number,
int fractionDigits,
boolean useGrouping)
Formats a given number with given number of fraction digits
e.g. |
static String |
getCityName() |
static Date |
getDate(int year,
int month,
int date) |
static InputStream |
getImageAsStream(String imageName)
Returns input stream for given image file.
|
static InputStream |
getTemplateAsStream(String templateName)
Returns input stream for given report template.
|
static Properties |
loadReportConfig()
Loads the report configuration file from classpath
(/config/reports.properties)
|
static String |
logoBasePath()
Gives the absolute path of the logo image
|
static Date |
now() |
static Date |
today() |
static Date |
tomorrow() |
public static InputStream getImageAsStream(String imageName)
imageName - Name of image to be readpublic static String getCityName()
public static InputStream getTemplateAsStream(String templateName)
templateName - Report template to be readpublic static Properties loadReportConfig()
public static Object fetchFromDBSql(Connection connection, String sqlQuery) throws SQLException
connection - Connection to be used for executing the query. Can be passed
as $P{REPORT_CONNECTION} in case of a jasper reportsqlQuery - Query to be executed to get the dataSQLExceptionpublic static Date getDate(int year, int month, int date)
year - month - date - public static Date today()
public static Date now()
public static Date tomorrow()
public static Date add(Date inputDate, int addType, int addAmount)
inputDate - Input dateaddType - type to be added
(Calendar.DAY_OF_MONTH/Calendar.MONTH/Calendar.YEAR)addAmount - Number of days/months/years to be added to the input datepublic static String amountInWords(BigDecimal amount)
amount - Amount to be converted to wordspublic static String formatNumber(BigDecimal number, int fractionDigits, boolean useGrouping)
number - The number to be formattedfractionDigits - Number of fraction digits to be used for formattinguseGrouping - Flag indicating whether grouping is to be used while
formatting the numberpublic static String logoBasePath()
public static String cancelledWatermarkAbsolutePath()
Copyright © 2015–2016 eGovernments Foundation. All rights reserved.