Class ReportService
- Author:
- Ralph Soika
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomputeDynamicDate
(String xmlDate) This method parses axml tag and computes a dynamic date by parsing the attributes: DAY_OF_MONTH DAY_OF_YEAR MONTH YEAR ADD (FIELD,OFFSET) customNumberFormat
(String pattern, String locale, double value) This method converts a double value into a custom number format including an optional locale.Returns a list of all reports sorted by name.findReport
(String reportID) Returns a Report Entity by its identifier.getDataSource
(ItemCollection reportEntity, int pageSize, int pageIndex, String sortBy, boolean sortReverse, Map<String, String> params) Returns the data source defined by a report.replaceDateString
(String content) This method replaces all occurrences of<date>
tags with the corresponding dynamic date.transformDataSource
(ItemCollection report, List<ItemCollection> data, String fileName) Transforms a datasource based on the XSL template from a report into a FileData object.void
updateReport
(ItemCollection aReport) updates a Entity Report Object.
-
Constructor Details
-
ReportService
public ReportService()
-
-
Method Details
-
findReport
Returns a Report Entity by its identifier. The identifier can either be the $uniqueId of the report or the report name. The method returns null if no report with the given identifier exists.- Parameters:
reportID
- - name of the report or its $uniqueId.- Returns:
- ItemCollection representing the Report
-
findAllReports
Returns a list of all reports sorted by name.- Returns:
- list of ItemCollection objects.
-
updateReport
updates a Entity Report Object. The Entity representing a report must have at least the attributes : txtQuery, numMaxCount, numStartPost, txtName. txtName is the unique key to be use to get a query. The method checks if a report with the same key allready exists. If so this report will be updated. If no report exists the new report will be created- Parameters:
report
-- Throws:
InvalidItemValueException
AccessDeniedException
-
getDataSource
public List<ItemCollection> getDataSource(ItemCollection reportEntity, int pageSize, int pageIndex, String sortBy, boolean sortReverse, Map<String, String> params) throws QueryExceptionReturns the data source defined by a report.The method executes the lucene search query defined by the Report. The values of the returned entities will be cloned and formated in case a itemList is provided.
The method parses the attribute txtname for a formating expression to format the item value. E.g.:
datDate<format locale="de" label="Date">yy-dd-mm</format>
Optional the lucene search query my contain params which will be replaced by a given param Map:
($created:{date_from})
In this example the literal ?{date_from} will be replaced with the given value provided in the param map.
- Parameters:
reportName
- - name of the report to be executedstartPos
- - optional start position to query entitiesmaxcount
- - optional max count of entities to queryparams
- - optional parameter list to be mapped to the JQPL statementitemList
- - optional attribute list of items to be returned- Returns:
- collection of entities
- Throws:
QueryException
-
transformDataSource
public FileData transformDataSource(ItemCollection report, List<ItemCollection> data, String fileName) throws jakarta.xml.bind.JAXBException, IOException, TransformerException Transforms a datasource based on the XSL template from a report into a FileData object.- Parameters:
report
- - the report definitiondata
- - the data sourcefileName
-- Returns:
- FileData object containing the transformed data source.
- Throws:
jakarta.xml.bind.JAXBException
TransformerException
IOException
-
computeDynamicDate
This method parses axml tag and computes a dynamic date by parsing the attributes: DAY_OF_MONTH DAY_OF_YEAR MONTH YEAR ADD (FIELD,OFFSET) e.g.
<date DAY_OF_MONTH="1" MONTH="2" />
results in 1. February of the current year
<date DAY_OF_MONTH="ACTUAL_MAXIMUM" MONTH="12" ADD="MONTH,-1" />
results in 30.November of current year
- Parameters:
xmlDate
-- Returns:
-
replaceDateString
This method replaces all occurrences of<date>
tags with the corresponding dynamic date. See computeDynamicdate.- Parameters:
content
-- Returns:
-
customNumberFormat
This method converts a double value into a custom number format including an optional locale."###,###.###", "en_UK", 123456.789 "EUR #,###,##0.00", "de_DE", 1456.781
- Parameters:
pattern
-value
-- Returns:
-