Class ReportService

java.lang.Object
org.imixs.workflow.engine.ReportService

@DeclareRoles({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) @RolesAllowed({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) public class ReportService extends Object
The ReportService supports methods to create, process and find report instances. A Report Entity is identified by its name represented by the attribute 'name' So a ReportService Implementation should ensure that name is a unique key for the report entity. Also each report entity holds a EQL Query in the attribute "txtquery". this eql statement will be processed by the processQuery method and should return a collection of entities defined by the query.
Author:
Ralph Soika
  • Constructor Details

    • ReportService

      public ReportService()
  • Method Details

    • findReport

      public ItemCollection findReport(String reportID)
      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

      public List<ItemCollection> findAllReports()
      Returns a list of all reports sorted by name.
      Returns:
      list of ItemCollection objects.
    • updateReport

      public void updateReport(ItemCollection aReport) throws AccessDeniedException
      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 QueryException
      Returns 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 executed
      startPos - - optional start position to query entities
      maxcount - - optional max count of entities to query
      params - - optional parameter list to be mapped to the JQPL statement
      itemList - - 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 definition
      data - - the data source
      fileName -
      Returns:
      FileData object containing the transformed data source.
      Throws:
      jakarta.xml.bind.JAXBException
      TransformerException
      IOException
    • computeDynamicDate

      public Calendar computeDynamicDate(String xmlDate)
      This method parses a xml 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

      public String replaceDateString(String content)
      This method replaces all occurrences of <date> tags with the corresponding dynamic date. See computeDynamicdate.
      Parameters:
      content -
      Returns:
    • customNumberFormat

      public String customNumberFormat(String pattern, String locale, double value)
      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: