diff --git a/modules/web/src/com/haulmont/reports/web/restapi/v1/ReportRestControllerManager.java b/modules/web/src/com/haulmont/reports/web/restapi/v1/ReportRestControllerManager.java index 5adb6b1a..fa4eea77 100644 --- a/modules/web/src/com/haulmont/reports/web/restapi/v1/ReportRestControllerManager.java +++ b/modules/web/src/com/haulmont/reports/web/restapi/v1/ReportRestControllerManager.java @@ -65,7 +65,8 @@ public String loadReportsList() { new View(Report.class) .addProperty("id") .addProperty("name") - .addProperty("code")) + .addProperty("code") + .addProperty("group")) .setQueryString("select r from report$Report r where r.restAccess = true"); reportSecurityManager.applySecurityPolicies(loadContext, null, userSessionSource.getUserSession().getCurrentOrSubstitutedUser()); List reports = dataManager.loadList(loadContext); @@ -218,6 +219,7 @@ protected ReportInfo mapToReportInfo(Report report) { reportInfo.id = report.getId().toString(); reportInfo.code = report.getCode(); reportInfo.name = report.getName(); + reportInfo.group = report.getGroup().getId().toString(); if (entityStates.isLoaded(report, "templates")) { if (report.getTemplates() != null) { @@ -259,9 +261,27 @@ protected InputParameterInfo mapInputParameterInfo(ReportInputParameter paramete if (parameter.getEnumerationClass() != null) { inputParameterInfo.enumerationClass = parameter.getEnumerationClass(); } + + if (parameter.getDefaultValue() != null) { + inputParameterInfo.defaultValue = transformDefaultValue(parameter); + } return inputParameterInfo; } + protected String transformDefaultValue(ReportInputParameter parameter) { + switch (parameter.getType()){ + case ENTITY: + EntityLoadInfo info = EntityLoadInfo.parse(parameter.getDefaultValue()); + if (info != null) return info.getId().toString(); + break; + case DATE: + case TIME: + Object defParamValue = reportService.convertFromString(parameter.getParameterClass(), parameter.getDefaultValue()); + return reportService.convertToString(resolveDatatypeActualClass(parameter), defParamValue); + } + return parameter.getDefaultValue(); + } + protected UUID getReportIdFromString(String entityId) { return (UUID) getIdFromString(entityId, metadata.getClassNN(Report.class)); } @@ -349,6 +369,7 @@ protected class ReportInfo { protected String id; protected String name; protected String code; + protected String group; protected List templates; protected List inputParameters; @@ -367,6 +388,7 @@ protected static class InputParameterInfo { protected boolean hidden; protected String entityMetaClass; protected String enumerationClass; + protected String defaultValue; } protected static class ParameterValueInfo {