Package io.jmix.reportsrest.controller
Class ReportRestControllerManager
java.lang.Object
io.jmix.reportsrest.controller.ReportRestControllerManager
@Component("report_ReportRestControllerManager")
public class ReportRestControllerManager
extends Object
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classprotected static classprotected static classprotected static classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserSubstitutionprotected DataManagerprotected EntityStatesprotected Metadataprotected MetadataToolsprotected ObjectToStringConverterprotected ParameterClassResolverprotected PolicyStoreprotected ReportGroupRepositoryprotected ReportInputParameterValidatorprotected ReportRepositoryprotected ReportRunnerprotected SecureOperations -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckCanReadEntity(MetaClass metaClass) protected voidcheckEntityIsNotNull(String entityName, String entityId, @Nullable Object entity) protected voidcheckEntityIsNotNull(String entityName, String identifierName, String identifierValue, @Nullable Object entity) protected voidcheckReportOutputType(ReportTemplate reportTemplate) collectValuesToValidate(Report report, @Nullable List<ReportRestControllerManager.ParameterValueInfo> paramValues, Map<String, Object> preparedValues) Collects the values to validate, in the canonical parameter class the UI and the reporting engine use: a passed scalar is parsed from its string value into that class (not thejava.sql.*wire class used to run the report); a passed entity reuses the instance already loaded for the run; a parameter the caller did not pass falls back to its default value.protected com.google.gson.Gsonprotected @Nullable Reportprotected @Nullable ReportfindAccessibleReportById(UUID reportId) protected @Nullable ReportGroupfindReportGroupById(UUID groupId) protected ObjectgetIdFromString(String entityId, MetaClass metaClass) protected UUIDgetReportGroupIdFromString(String entityId) protected UUIDgetReportIdFromString(String entityId) loadReport(String entityId) protected Reportprotected ReportloadReportInternal(String entityId) mapInputParameterInfo(ReportInputParameter parameter) protected ReportRestControllerManager.TemplateInfomapTemplateInfo(ReportTemplate template) protected ReportRestControllerManager.ReportInfomapToReportInfo(Report report) protected @Nullable ObjectprepareValue(ReportInputParameter inputParam, ReportRestControllerManager.ParameterValueInfo paramValue) prepareValues(Report report, List<ReportRestControllerManager.ParameterValueInfo> paramValues) protected ClassresolveDatatypeActualClass(ReportInputParameter inputParam) protected @Nullable ObjectresolveDefaultValue(ReportInputParameter inputParameter) protected @Nullable ObjectresolveValueToValidate(ReportInputParameter inputParameter, @Nullable List<ReportRestControllerManager.ParameterValueInfo> paramValues, Map<String, Object> preparedValues) runReportByCode(String code, String bodyJson) protected ReportRestResultrunReportInternal(Report report, String bodyJson, String reportRef) protected StringtransformDefaultValue(ReportInputParameter parameter) protected voidvalidateReportParameters(Report report, @Nullable List<ReportRestControllerManager.ParameterValueInfo> paramValues, Map<String, Object> preparedValues) Validates report input parameters the same way the UI does before running: single-parameter validators (delegate and Groovy script) for parameters with validation turned on, then report-level cross-parameter validation.
-
Field Details
-
dataManager
-
reportRepository
-
reportGroupRepository
-
reportRunner
-
reportInputParameterValidator
-
objectToStringConverter
-
metadata
-
metadataTools
-
entityStates
-
secureOperations
-
parameterClassResolver
-
policyStore
-
currentUserSubstitution
-
-
Constructor Details
-
ReportRestControllerManager
public ReportRestControllerManager()
-
-
Method Details
-
loadGroup
-
loadReportsList
-
loadReport
-
runReport
-
runReportByCode
-
runReportInternal
-
loadReportInternal
-
loadReportByCodeInternal
-
validateReportParameters
protected void validateReportParameters(Report report, @Nullable List<ReportRestControllerManager.ParameterValueInfo> paramValues, Map<String, Object> preparedValues) Validates report input parameters the same way the UI does before running: single-parameter validators (delegate and Groovy script) for parameters with validation turned on, then report-level cross-parameter validation. Values are validated in the canonical parameter class (e.g.LocalDate) - the type the UI and the reporting engine use - and include default values of parameters the caller did not pass. AReportParametersValidationExceptionthrown here is translated into a400 Bad Requestresponse by the caller instead of running the report with invalid input. The report itself still runs withpreparedValues; the collected values are used for validation only. -
collectValuesToValidate
protected Map<String,Object> collectValuesToValidate(Report report, @Nullable List<ReportRestControllerManager.ParameterValueInfo> paramValues, Map<String, Object> preparedValues) Collects the values to validate, in the canonical parameter class the UI and the reporting engine use: a passed scalar is parsed from its string value into that class (not thejava.sql.*wire class used to run the report); a passed entity reuses the instance already loaded for the run; a parameter the caller did not pass falls back to its default value. This mirrors what the UI validates and keeps typed validator delegates from receiving an unexpected value type. -
resolveValueToValidate
protected @Nullable Object resolveValueToValidate(ReportInputParameter inputParameter, @Nullable List<ReportRestControllerManager.ParameterValueInfo> paramValues, Map<String, Object> preparedValues) -
resolveDefaultValue
-
prepareValues
-
createGson
protected com.google.gson.Gson createGson() -
prepareValue
protected @Nullable Object prepareValue(ReportInputParameter inputParam, ReportRestControllerManager.ParameterValueInfo paramValue) -
resolveDatatypeActualClass
-
mapToReportInfo
-
mapTemplateInfo
-
mapInputParameterInfo
protected ReportRestControllerManager.InputParameterInfo mapInputParameterInfo(ReportInputParameter parameter) -
transformDefaultValue
-
getReportIdFromString
-
getReportGroupIdFromString
-
loadAccessibleReports
-
findAccessibleReportById
-
findAccessibleReportByCode
-
findReportGroupById
-
getIdFromString
-
checkCanReadEntity
-
checkEntityIsNotNull
-
checkEntityIsNotNull
-
checkReportOutputType
-