Class DashboardServiceImpl

java.lang.Object
com.flowable.platform.service.dashboard.DashboardServiceImpl
All Implemented Interfaces:
DashboardService

@Transactional public class DashboardServiceImpl extends Object implements DashboardService
  • Field Details

  • Constructor Details

    • DashboardServiceImpl

      public DashboardServiceImpl()
  • Method Details

    • createDashboard

      public Dashboard createDashboard(String name, String currentUserId, String currentTenantId)
      Description copied from interface: DashboardService
      Creates a new Dashboard for the given user and tenant.
      Specified by:
      createDashboard in interface DashboardService
    • createDashboardQuery

      public DashboardQuery createDashboardQuery()
      Description copied from interface: DashboardService
      Create a DashboardQuery which can be used to query existing dashboards.
      Specified by:
      createDashboardQuery in interface DashboardService
    • delete

      public void delete(String dashboardId)
      Description copied from interface: DashboardService
      Deletes a Dashboard.
      Specified by:
      delete in interface DashboardService
    • getAvailableComponentDefinitions

      public List<DashboardComponentDefinitionModel> getAvailableComponentDefinitions(String dashboardId)
      Description copied from interface: DashboardService
      Returns a catalogue of components (returned as a list of DashboardComponentDefinitionModels) that can be added to the Dashboard with the provided id.
      Specified by:
      getAvailableComponentDefinitions in interface DashboardService
    • getAvailableVariables

      public List<DashboardAvailableVariable> getAvailableVariables(String dashboardId, String tenantId, String variableNameLike, com.fasterxml.jackson.databind.JsonNode runtimeInputParameterValues, int responseSize)
      Specified by:
      getAvailableVariables in interface DashboardService
    • getAvailableInputParameterValues

      public List<DashboardParameterValue> getAvailableInputParameterValues(String dashboardId, String tenantId, String parameterName)
      Specified by:
      getAvailableInputParameterValues in interface DashboardService
    • extractAvailableVariables

      protected List<DashboardAvailableVariable> extractAvailableVariables(com.fasterxml.jackson.databind.JsonNode queryResponse)
    • createDashboardUpdateBuilder

      public DashboardUpdateBuilder createDashboardUpdateBuilder(String dashboardId)
      Description copied from interface: DashboardService
      Updates the dashboard configuration
      Specified by:
      createDashboardUpdateBuilder in interface DashboardService
    • getDashboardComponentInfo

      public List<DashboardComponentDefinitionModel.DashboardComponentInfo> getDashboardComponentInfo(String dashboardId)
      Description copied from interface: DashboardService
      Returns the metadata of all components for the dashboard with the provided id. The map will have the component instance id as key and the list of input parameters as value.
      Specified by:
      getDashboardComponentInfo in interface DashboardService
    • getData

      public DashboardComponentData getData(String dashboardId, String componentDefinitionKey, com.fasterxml.jackson.databind.JsonNode inputParameterValues, com.fasterxml.jackson.databind.JsonNode optionValues)
      Description copied from interface: DashboardService
      Returns the data for one component of a dashboard, using the provided input parameters and options.
      Specified by:
      getData in interface DashboardService
    • exportDataAsCSV

      public void exportDataAsCSV(String dashboardId, String componentDefinitionKey, com.fasterxml.jackson.databind.JsonNode requestInputParameterValues, com.fasterxml.jackson.databind.JsonNode requestOptionValues, OutputStream outputStream)
      Exporting the data of a dashboard component as CSV followsthe same steps as described in internalGetData(Dashboard, String, JsonNode, JsonNode), with the exception that it won't do a one-time query and then process the result to a format specific to the component type. Instead, it will continuously build the runtime query with different paging settings to go through the full dataset, transform the result to CSV format and append it to the resulting full CSV dataset.
      Specified by:
      exportDataAsCSV in interface DashboardService
    • internalGetData

      protected DashboardComponentData internalGetData(Dashboard dashboard, String componentDefinitionKey, com.fasterxml.jackson.databind.JsonNode inputParameterValues, com.fasterxml.jackson.databind.JsonNode optionValues)
      Getting the data for a dashboard component involves a few different classes to be involved. Take into account that the frontend already queried the metadata about the dashboard component, and thus has rendered the relevant input parameter and option widgets. Through the e.g. REST API we're thus receiving: a. Concrete values for the input parameters of the dashboard component b. Concrete values for the options of the dashboard component. With this input, the following steps are now applied: 1. First the dashboard component model itself is fetched. This is needed because it contains information about the fields, the type (which determines the result mapping), etc. 2. The StandardDataQueryInputValuesTransformer is used to transform the given input parameter values (a. from above) to values that are understood by all what follows next. Specifically, it will: - Filter out any value that's not matching the metadata of the dashboard component. - Transform the 'raw json values' to a 'richer' object. For example: - when the FE would filter on data with 'yesterday', it will generate the correct timestamps relative to the current time. - when the FE gives a list of versions for a definition, it will look up the actual definition ids to filter properly - etc. 3. Similarly, the 'option values' for the dashboard component are now transformed. Sorting is a good example here: it's not an input parameter, but it's an option offered on some dashboard components. The 'raw json option values' are then transformed to a more usable format with typed keys (e.g, for sorting using StandardDataQuerySortValue) 4. Now that the input values are transformed to a usable format, the referenced query model is retrieved and the QueryService is used to actually execute the particular query. In this service, the query model will be transformed into a runtime query. For a query builder query model, this means that the configuration will be processed, using the payload (= the transformed input values from above). Eventually, a json result is returned. 5. Lastly, this 'raw json result data' needs to be transformed into a format suitable for the component. For example, a pie chart component has very different data formatting compared to e.g. a table component. Each such dashboard component will have one DashboardComponentQueryResultMapper, which will take the 'raw json result data' and transform it to the appropriate DashboardComponentData.
    • processDataRetrievalInputValues

      protected org.apache.commons.lang3.tuple.Pair<DashboardComponentDefinitionModel,Map<String,com.fasterxml.jackson.databind.JsonNode>> processDataRetrievalInputValues(Dashboard dashboard, String componentDefinitionKey, com.fasterxml.jackson.databind.JsonNode inputParameterValues, com.fasterxml.jackson.databind.JsonNode optionValues)
    • getValueFromOptions

      protected void getValueFromOptions(com.fasterxml.jackson.databind.JsonNode optionValues, Map<String,com.fasterxml.jackson.databind.JsonNode> queryPayload, String field)
    • getDashboardConfiguration

      protected DashboardConfiguration getDashboardConfiguration(Dashboard dashboard)