Class DashboardServiceImpl
java.lang.Object
com.flowable.platform.service.dashboard.DashboardServiceImpl
- All Implemented Interfaces:
DashboardService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CmmnRepositoryService
protected DashboardConfigurationService
protected com.fasterxml.jackson.databind.ObjectMapper
protected PlatformRepositoryService
protected QueryResultToCsvTransformerService
protected QueryService
protected RepositoryService
protected ResourceHelper
protected SearchService
protected StandardDataQueryInputValuesTransformer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateDashboard
(String name, String currentUserId, String currentTenantId) Creates a newDashboard
for the given user and tenant.Create aDashboardQuery
which can be used to query existing dashboards.createDashboardUpdateBuilder
(String dashboardId) Updates the dashboard configurationvoid
Deletes aDashboard
.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 ininternalGetData(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.protected List<DashboardAvailableVariable>
extractAvailableVariables
(com.fasterxml.jackson.databind.JsonNode queryResponse) getAvailableComponentDefinitions
(String dashboardId) Returns a catalogue of components (returned as a list ofDashboardComponentDefinitionModel
s) that can be added to theDashboard
with the provided id.getAvailableInputParameterValues
(String dashboardId, String tenantId, String parameterName) getAvailableVariables
(String dashboardId, String tenantId, String variableNameLike, com.fasterxml.jackson.databind.JsonNode runtimeInputParameterValues, int responseSize) getDashboardComponentInfo
(String dashboardId) Returns the metadata of all components for the dashboard with the provided id.protected DashboardConfiguration
getDashboardConfiguration
(Dashboard dashboard) getData
(String dashboardId, String componentDefinitionKey, com.fasterxml.jackson.databind.JsonNode inputParameterValues, com.fasterxml.jackson.databind.JsonNode optionValues) Returns the data for one component of a dashboard, using the provided input parameters and options.protected void
getValueFromOptions
(com.fasterxml.jackson.databind.JsonNode optionValues, Map<String, com.fasterxml.jackson.databind.JsonNode> queryPayload, String field) 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.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)
-
Field Details
-
dashboardConfigurationService
-
standardDataQueryInputValuesTransformer
@Autowired protected StandardDataQueryInputValuesTransformer standardDataQueryInputValuesTransformer -
queryResultToCsvTransformerService
-
dashboardComponentQueryResultMapperService
@Autowired protected DashboardComponentQueryResultMapperService dashboardComponentQueryResultMapperService -
platformRepositoryService
-
queryService
-
searchService
-
repositoryService
-
cmmnRepositoryService
-
resourceHelper
-
objectMapper
-
-
Constructor Details
-
DashboardServiceImpl
public DashboardServiceImpl()
-
-
Method Details
-
createDashboard
Description copied from interface:DashboardService
Creates a newDashboard
for the given user and tenant.- Specified by:
createDashboard
in interfaceDashboardService
-
createDashboardQuery
Description copied from interface:DashboardService
Create aDashboardQuery
which can be used to query existing dashboards.- Specified by:
createDashboardQuery
in interfaceDashboardService
-
delete
Description copied from interface:DashboardService
Deletes aDashboard
.- Specified by:
delete
in interfaceDashboardService
-
getAvailableComponentDefinitions
Description copied from interface:DashboardService
Returns a catalogue of components (returned as a list ofDashboardComponentDefinitionModel
s) that can be added to theDashboard
with the provided id.- Specified by:
getAvailableComponentDefinitions
in interfaceDashboardService
-
getAvailableVariables
public List<DashboardAvailableVariable> getAvailableVariables(String dashboardId, String tenantId, String variableNameLike, com.fasterxml.jackson.databind.JsonNode runtimeInputParameterValues, int responseSize) - Specified by:
getAvailableVariables
in interfaceDashboardService
-
getAvailableInputParameterValues
public List<DashboardParameterValue> getAvailableInputParameterValues(String dashboardId, String tenantId, String parameterName) - Specified by:
getAvailableInputParameterValues
in interfaceDashboardService
-
extractAvailableVariables
protected List<DashboardAvailableVariable> extractAvailableVariables(com.fasterxml.jackson.databind.JsonNode queryResponse) -
createDashboardUpdateBuilder
Description copied from interface:DashboardService
Updates the dashboard configuration- Specified by:
createDashboardUpdateBuilder
in interfaceDashboardService
-
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 interfaceDashboardService
-
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 interfaceDashboardService
-
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 ininternalGetData(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 interfaceDashboardService
-
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. TheStandardDataQueryInputValuesTransformer
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 usingStandardDataQuerySortValue
) 4. Now that the input values are transformed to a usable format, the referenced query model is retrieved and theQueryService
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 oneDashboardComponentQueryResultMapper
, which will take the 'raw json result data' and transform it to the appropriateDashboardComponentData
. -
processDataRetrievalInputValues
protected org.apache.commons.lang3.tuple.Pair<DashboardComponentDefinitionModel,Map<String, processDataRetrievalInputValuescom.fasterxml.jackson.databind.JsonNode>> (Dashboard dashboard, String componentDefinitionKey, com.fasterxml.jackson.databind.JsonNode inputParameterValues, com.fasterxml.jackson.databind.JsonNode optionValues) -
getValueFromOptions
-
getDashboardConfiguration
-