protected Map<QName, Object> getPromptingParameters(){ JRParameter[] params = dataset.getParameters(); Map<QName, Object> expressionParameters = new HashMap<QName, Object>(); for (JRParameter param : params){ if (param.isSystemDefined()){ continue; } if (!param.isForPrompting()){ continue; } //LOGGER.trace(((JRBaseParameter)param).getName()); Object v = getParameterValue(param.getName()); try{ expressionParameters.put(new QName(param.getName()), new PrismPropertyValue(v)); } catch (Exception e){ //just skip properties that are not important for midpoint } LOGGER.trace("p.val: {}", v); } return expressionParameters; }
private static JasperPrint fillReport(JRFileVirtualizer virtualizer) throws JRException { long start = System.currentTimeMillis(); // Virtualization works only with in memory JasperPrint objects. // All the operations will first fill the report and then export // the filled object. // creating the data source JRDataSource dataSource = new JREmptyDataSource(1000); // Preparing parameters Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put(JRParameter.REPORT_VIRTUALIZER, virtualizer); // filling the report JasperPrint jasperPrint = JasperFillManager.fillReport("build/reports/VirtualizerReport.jasper", parameters, dataSource); virtualizer.setReadOnly(true); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); return jasperPrint; }
/** * Expose current Spring-managed Locale and MessageSource to JasperReports i18n * ($R expressions etc). The MessageSource should only be exposed as JasperReports * resource bundle if no such bundle is defined in the report itself. * <p>The default implementation exposes the Spring RequestContext Locale and a * MessageSourceResourceBundle adapter for the Spring ApplicationContext, * analogous to the {@code JstlUtils.exposeLocalizationContext} method. * @see org.springframework.web.servlet.support.RequestContextUtils#getLocale * @see org.springframework.context.support.MessageSourceResourceBundle * @see #getApplicationContext() * @see net.sf.jasperreports.engine.JRParameter#REPORT_LOCALE * @see net.sf.jasperreports.engine.JRParameter#REPORT_RESOURCE_BUNDLE * @see org.springframework.web.servlet.support.JstlUtils#exposeLocalizationContext */ protected void exposeLocalizationContext(Map<String, Object> model, HttpServletRequest request) { RequestContext rc = new RequestContext(request, getServletContext()); Locale locale = rc.getLocale(); if (!model.containsKey(JRParameter.REPORT_LOCALE)) { model.put(JRParameter.REPORT_LOCALE, locale); } TimeZone timeZone = rc.getTimeZone(); if (timeZone != null && !model.containsKey(JRParameter.REPORT_TIME_ZONE)) { model.put(JRParameter.REPORT_TIME_ZONE, timeZone); } JasperReport report = getReport(); if ((report == null || report.getResourceBundle() == null) && !model.containsKey(JRParameter.REPORT_RESOURCE_BUNDLE)) { model.put(JRParameter.REPORT_RESOURCE_BUNDLE, new MessageSourceResourceBundle(rc.getMessageSource(), locale)); } }
public static String[] getReportParams(JasperReport jasperReport){ JRParameter[] jrp = jasperReport.getParameters(); ArrayList<String> list = new ArrayList<String>(); if(jrp != null){ for (int i = 0 ; i < jrp.length; i++){ if(!jrp[i].isSystemDefined()){ list.add(jrp[i].getName()); MiscUtils.getLogger().debug("JRP "+i+" :"+jrp[i].getName()); } } } String[] s = new String[list.size()]; return list.toArray(s); }
/** * */ private void fill(boolean ignorePagination) throws JRException { long start = System.currentTimeMillis(); //Preparing parameters Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("ReportTitle", "Address Report"); List<String> excludedCities = new ArrayList<String>(); excludedCities.add("Boston"); excludedCities.add("Chicago"); excludedCities.add("Oslo"); parameters.put("ExcludedCities", excludedCities); parameters.put("OrderClause", "City"); if (ignorePagination) { parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); } JasperFillManager.fillReportToFile("build/reports/QueryReport.jasper", parameters, getDemoHsqldbConnection()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); Locale locale = chooseLocale(); if (locale != null) { // Object[] aw = new Object[] {new Double(1000000.45), "$", "Ferrari", new Integer(20),new Integer(88)}; Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("number", new Double(1234567 + Math.random())); // parameters.put("array", aw); parameters.put(JRParameter.REPORT_LOCALE, locale); JasperFillManager.fillReportToFile("build/reports/I18nReport.jasper", parameters, new JREmptyDataSource()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); } }
@Override public void contributeParameters(Map<String, Object> parameters) throws JRException { JndiDataAdapter jndiDataAdapter = getJndiDataAdapter(); if (jndiDataAdapter != null) { try { Context ctx = new InitialContext(); DataSource dataSource = (DataSource) ctx.lookup("java:comp/env/" + jndiDataAdapter.getDataSourceName()); connection = dataSource.getConnection(); } catch (Exception ex) { throw new JRException(ex); } parameters.put(JRParameter.REPORT_CONNECTION, connection); } }
private void setBookmarksParameter() { JRPart part = fillContext.getPart(); String bookmarksParameter = part.hasProperties() ? part.getPropertiesMap().getProperty(PROPERTY_BOOKMARKS_DATA_SOURCE_PARAMETER) : null; if (bookmarksParameter == null) { return; } if (bookmarksParameter.equals(JRParameter.REPORT_DATA_SOURCE)) { // if the bookmarks data source is created as main data source for the part report, // automatically exclude it from data snapshots as jive actions might result in different bookmarks. // if the data source is not the main report data source people will have to manually inhibit data caching. cacheIncluded = false; } BookmarkHelper bookmarks = fillContext.getFiller().getFirstBookmarkHelper(); BookmarksFlatDataSource bookmarksDataSource = new BookmarksFlatDataSource(bookmarks); parameterValues.put(bookmarksParameter, bookmarksDataSource); }
/** * */ protected JRBaseParameter getParameter(JRParameter parameter) { JRBaseParameter baseParameter = null; if (parameter != null) { baseParameter = (JRBaseParameter)get(parameter); if (baseParameter == null) { baseParameter = new JRBaseParameter(parameter, this); } } return baseParameter; }
/** * */ protected JRBaseParameter(JRParameter parameter, JRBaseObjectFactory factory) { factory.put(parameter, this); name = parameter.getName(); description = parameter.getDescription(); valueClassName = parameter.getValueClassName(); nestedTypeName = parameter.getNestedTypeName(); isSystemDefined = parameter.isSystemDefined(); isForPrompting = parameter.isForPrompting(); evaluationTime = parameter.getEvaluationTime(); defaultValueExpression = factory.getExpression(parameter.getDefaultValueExpression()); propertiesMap = parameter.getPropertiesMap().cloneProperties(); }
protected TimeZone resolveTimeZone(String timezoneId) { TimeZone tz; if (timezoneId == null || timezoneId.length() == 0) { tz = null; } else if (timezoneId.equals(JRParameter.REPORT_TIME_ZONE)) { // using the report timezone tz = (TimeZone) getParameterValue(JRParameter.REPORT_TIME_ZONE, true); } else { // resolving as tz ID tz = TimeZone.getTimeZone(timezoneId); } return tz; }
/** * */ public JRJpaQueryExecuter( JasperReportsContext jasperReportsContext, JRDataset dataset, Map<String,? extends JRValueParameter> parameters ) { super(jasperReportsContext, dataset, parameters); em = (EntityManager)getParameterValue(JRJpaQueryExecuterFactory.PARAMETER_JPA_ENTITY_MANAGER); reportMaxCount = (Integer)getParameterValue(JRParameter.REPORT_MAX_COUNT); if (em == null) { log.warn("The supplied javax.persistence.EntityManager object is null."); } parseQuery(); }
/** * */ public JRHibernateQueryExecuter( JasperReportsContext jasperReportsContext, JRDataset dataset, Map<String, ? extends JRValueParameter> parameters ) { super(jasperReportsContext, dataset, parameters); session = (Session) getParameterValue(JRHibernateQueryExecuterFactory.PARAMETER_HIBERNATE_SESSION); reportMaxCount = (Integer) getParameterValue(JRParameter.REPORT_MAX_COUNT); isClearCache = getPropertiesUtil().getBooleanProperty(dataset, JRHibernateQueryExecuterFactory.PROPERTY_HIBERNATE_CLEAR_CACHE, false); if (session == null) { log.warn("The supplied org.hibernate.Session object is null."); } parseQuery(); }
/** * */ private void writeParameter(JRParameter parameter) throws IOException { writer.startElement(JRXmlConstants.ELEMENT_parameter); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, parameter.getName()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_class, parameter.getValueClassName()); if(isNewerVersionOrEqual(JRConstants.VERSION_3_1_4)) { writer.addAttribute(JRXmlConstants.ATTRIBUTE_nestedType, parameter.getNestedTypeName()); } writer.addAttribute(JRXmlConstants.ATTRIBUTE_isForPrompting, parameter.isForPrompting(), true); if(isNewerVersionOrEqual(JRConstants.VERSION_6_3_1)) { writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, parameter.getEvaluationTime()); } writeProperties(parameter); writer.writeCDATAElement(JRXmlConstants.ELEMENT_parameterDescription, parameter.getDescription()); writeExpression(JRXmlConstants.ELEMENT_defaultValueExpression, parameter.getDefaultValueExpression(), false); writer.closeElement(); }
public static TimeZone resolveFormatTimeZone(String timeZoneId, TimeZone reportTimeZone) { if (timeZoneId == null || timeZoneId.isEmpty()) { return null; } if (timeZoneId.equals(JRTextField.FORMAT_TIMEZONE_SYSTEM)) { // using the default JVM timezone return TimeZone.getDefault(); } if (timeZoneId.equals(JRParameter.REPORT_TIME_ZONE)) { // using the report timezone return reportTimeZone; } // note that this returns GMT if the ID is unknown, leaving that as is return getTimeZone(timeZoneId); }
/** * */ private void writeParameter( JRParameter parameter, String parameterName) { if(parameter != null) { write( "JRDesignParameter " + parameterName + " = new JRDesignParameter();\n"); write( parameterName + ".setName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(parameter.getName())); write( parameterName + ".setDescription(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(parameter.getDescription())); write( parameterName + ".setValueClassName(\"{0}\");\n", parameter.getValueClassName()); write( parameterName + ".setNestedTypeName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(parameter.getNestedTypeName())); write( parameterName + ".setForPrompting({0});\n", parameter.isForPrompting(), true); write( parameterName + ".setEvaluationTime({0});\n", parameter.getEvaluationTime()); writeProperties( parameter, parameterName); writeExpression( parameter.getDefaultValueExpression(), parameterName, "DefaultValueExpression"); flush(); } }
protected JRSourceCompileTask( JasperDesign jasperDesign, String unitName, JRExpressionCollector expressionCollector, Map<String, ? extends JRParameter> parametersMap, Map<String, JRField> fieldsMap, Map<String, JRVariable> variablesMap, JRVariable[] variables, boolean onlyDefaultEvaluation ) { this.jasperDesign = jasperDesign; this.unitName = unitName; this.expressionCollector = expressionCollector; this.parametersMap = parametersMap; this.fieldsMap = fieldsMap; this.variablesMap = variablesMap; this.variables = variables; this.expressions = expressionCollector.getCompiledExpressions(); this.onlyDefaultEvaluation = onlyDefaultEvaluation; }
/** * Inserts a parameter at the specified position into the dataset. * @param index the parameter position * @param parameter the parameter to insert * @throws JRException * @see net.sf.jasperreports.engine.JRDataset#getParameters() */ public void addParameter(int index, JRParameter parameter) throws JRException { if (parametersMap.containsKey(parameter.getName())) { throw new JRException( EXCEPTION_MESSAGE_KEY_DUPLICATE_PARAMETER, new Object[]{parameter.getName()}); } parametersList.add(index, parameter); parametersMap.put(parameter.getName(), parameter); getEventSupport().fireCollectionElementAddedEvent(PROPERTY_PARAMETERS, parameter, index); }
/** * Removes a parameter from the dataset. * * @param parameter the parameter to be removed * @return the parameter to be removed */ public JRParameter removeParameter(JRParameter parameter) { if (parameter != null) { int idx = parametersList.indexOf(parameter); if (idx >= 0) { parametersList.remove(idx); parametersMap.remove(parameter.getName()); getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_PARAMETERS, parameter, idx); } } return parameter; }
public JasperReportParameterDto(JRParameter param) { this.name = param.getName(); this.typeAsString = param.getValueClassName(); this.type = (Class<?>) param.getValueClass(); this.forPrompting = param.isForPrompting(); if (param.getDescription() != null){ this.description = param.getDescription(); } this.nestedType = param.getNestedType(); this.nestedTypeAsString = param.getNestedTypeName(); this.value = new ArrayList<>(); this.value.add(new JasperReportValueDto()); this.properties = new JasperReportParameterPropertiesDto(param.getPropertiesMap()); }
/** * */ protected JRFillParameter getParameter(JRParameter parameter) { JRFillParameter fillParameter = null; if (parameter != null) { fillParameter = (JRFillParameter)get(parameter); if (fillParameter == null) { fillParameter = new JRFillParameter(parameter, this); } } return fillParameter; }
protected Boolean getOwnIgnorePagination(Map<String,Object> parameterValues, boolean onlySetAttribute) { Boolean isIgnorePaginationParam = (Boolean) parameterValues.get(JRParameter.IS_IGNORE_PAGINATION); if (isIgnorePaginationParam != null) { return isIgnorePaginationParam; } boolean ignorePaginationAttribute = jasperReport.isIgnorePagination(); if (ignorePaginationAttribute) { return ignorePaginationAttribute; } return onlySetAttribute ? null : false; }
/** * Returns all current sort field criteria, including the dynamic ones provided as report parameter. */ public static JRSortField[] getAllSortFields(JRFillDataset dataset) { List<JRSortField> allSortFields = new ArrayList<JRSortField>(); JRSortField[] staticSortFields = dataset.getSortFields(); if (staticSortFields != null) { allSortFields.addAll(Arrays.asList(staticSortFields)); } @SuppressWarnings("unchecked") List<JRSortField> dynamicSortFields = (List<JRSortField>)dataset.getParameterValue(JRParameter.SORT_FIELDS, true); if (dynamicSortFields != null) { allSortFields.addAll(dynamicSortFields); } return allSortFields.toArray(new JRSortField[allSortFields.size()]); }
protected void collectTemplates() throws JRException { templates = new ArrayList<JRTemplate>(); if (reportTemplates != null) { for (JRFillReportTemplate reportTemplate : reportTemplates) { JRTemplate template = reportTemplate.evaluate(); if (template != null) { templates.add(template); } } } Collection<JRTemplate> paramTemplates = (Collection<JRTemplate>) mainDataset.getParameterValue( JRParameter.REPORT_TEMPLATES, true); if (paramTemplates != null) { templates.addAll(paramTemplates); } }
protected int getMaxPageHeight(Map<String,Object> parameterValues) { Integer maxPageHeightParam = (Integer) parameterValues.get(JRParameter.MAX_PAGE_HEIGHT); int maxPageHeight = maxPageHeightParam != null ? maxPageHeightParam : PAGE_HEIGHT_PAGINATION_IGNORED; if (maxPageHeight < pageHeight) { if (log.isDebugEnabled()) { log.debug("max page height " + maxPageHeight + " smaller than report page height " + pageHeight); } //use the report page height maxPageHeight = pageHeight; } if (log.isDebugEnabled()) { log.debug("max page height is " + maxPageHeight); } return maxPageHeight; }
protected int getMaxPageWidth(Map<String,Object> parameterValues) { Integer maxPageWidthParam = (Integer) parameterValues.get(JRParameter.MAX_PAGE_WIDTH); int maxPageWidth = maxPageWidthParam != null ? maxPageWidthParam : PAGE_WIDTH_IGNORED; if (maxPageWidth < pageWidth) { if (log.isDebugEnabled()) { log.debug("max page width " + maxPageWidth + " smaller than report page width " + pageWidth); } //use the report page width maxPageWidth = pageWidth; } if (log.isDebugEnabled()) { log.debug("max page width is " + maxPageWidth); } return maxPageWidth; }
protected void copyConnectionParameter(Map<String,Object> parameterValues) { JRQuery query = dataset.getQuery(); if (query != null) { String language = query.getLanguage(); if (connectionExpression == null && (language.equals("sql") || language.equals("SQL")) && !parameterValues.containsKey(JRParameter.REPORT_CONNECTION)) { JRFillParameter connParam = expressionEvaluator.getFillDataset().getParametersMap().get(JRParameter.REPORT_CONNECTION); Connection connection = (Connection) connParam.getValue(); parameterValues.put(JRParameter.REPORT_CONNECTION, connection); } } }
/** * Initializes the evaluator by setting the parameter, field and variable objects. * * @param parametersMap the parameters indexed by name * @param fieldsMap the fields indexed by name * @param variablesMap the variables indexed by name * @param resourceMissingType the resource missing type * @throws JRException */ @Override public void init( Map<String, JRFillParameter> parametersMap, Map<String, JRFillField> fieldsMap, Map<String, JRFillVariable> variablesMap, WhenResourceMissingTypeEnum resourceMissingType, boolean ignoreNPE ) throws JRException { whenResourceMissingType = resourceMissingType; this.ignoreNPE = ignoreNPE; resourceBundle = parametersMap.get(JRParameter.REPORT_RESOURCE_BUNDLE); locale = parametersMap.get(JRParameter.REPORT_LOCALE); functions = new HashMap<String, FunctionSupport>(); functionContext = new FillFunctionContext(parametersMap); customizedInit(parametersMap, fieldsMap, variablesMap); defaultValues = new FillExpressionDefaultValues(this, parametersMap, fieldsMap, variablesMap); oldValues = new FillExpressionOldValues(this, parametersMap, fieldsMap, variablesMap); estimatedValues = new FillExpressionEstimatedValues(this, parametersMap, fieldsMap, variablesMap); }
protected void copyConnectionParameter(Map<String, Object> parameterValues) { // copy the main report's connection parameter to the table subreport // this is done for consistency with subdataset runs if (!parameterValues.containsKey(JRParameter.REPORT_CONNECTION) && getConnectionExpression() == null) { JRQuery query = tableReport.getQuery(); if (query != null) { String language = query.getLanguage(); if (language.equals("sql") || language.equals("SQL")) { Connection connection = (Connection) filler.getParameterValuesMap().get( JRParameter.REPORT_CONNECTION); if (connection != null) { parameterValues.put(JRParameter.REPORT_CONNECTION, connection); } } } } }
protected Map<QName, Object> getParameters(){ JRParameter[] params = dataset.getParameters(); Map<QName, Object> expressionParameters = new HashMap<QName, Object>(); for (JRParameter param : params){ if (param.isSystemDefined()){ continue; } //LOGGER.trace(((JRBaseParameter)param).getName()); Object v = getParameterValue(param.getName()); try{ expressionParameters.put(new QName(param.getName()), new PrismPropertyValue(v)); } catch (Exception e){ //just skip properties that are not important for midpoint } LOGGER.trace("p.val: {}", v); } return expressionParameters; }
private Map<String, Object> getParameters() { Map<String, Object> model = new HashMap<String, Object>(); model.put("ReportTitle", "Dear Lord!"); model.put(JRParameter.REPORT_LOCALE, Locale.GERMAN); model.put(JRParameter.REPORT_RESOURCE_BUNDLE, ResourceBundle.getBundle("org/springframework/ui/jasperreports/messages", Locale.GERMAN)); return model; }
/** * Adds the date format configuration into the parameter map. * * @param parameters * Map of parameters where the date format configuration is put. */ private static void setReportFormatFactory(Map<String, Object> parameters) { String javaDateFormat = OBPropertiesProvider.getInstance().getOpenbravoProperties() .getProperty("dateFormat.java"); if (log.isDebugEnabled()) log.debug("creating the format factory: " + javaDateFormat); final JRFormatFactory jrFormatFactory = new JRFormatFactory(); jrFormatFactory.setDatePattern(javaDateFormat); parameters.put(JRParameter.REPORT_FORMAT_FACTORY, jrFormatFactory); }
private Object formatParameter(VariablesSecureApp vars, String strParamName, String strParamValue, String reference, JasperReport jasperReport) throws ServletException { String strObjectClass = ""; Object object; JRParameter[] jrparams = jasperReport.getParameters(); for (int i = 0; i < jrparams.length; i++) { if (jrparams[i].getName().equals(strParamName)) strObjectClass = jrparams[i].getValueClassName(); } if (log4j.isDebugEnabled()) log4j.debug("ClassType: " + strObjectClass); if (strObjectClass.equals("java.lang.String")) { object = new String(strParamValue); } else if (strObjectClass.equals("java.util.Date")) { String strDateFormat; strDateFormat = vars.getJavaDateFormat(); SimpleDateFormat dateFormat = new SimpleDateFormat(strDateFormat); try { object = dateFormat.parse(strParamValue); } catch (Exception e) { throw new ServletException(e.getMessage()); } } else { object = new String(strParamValue); } return object; }
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); Map<String, Object> params = new HashMap<String, Object>(); Document document = JRXmlUtils.parse(JRLoader.getLocationInputStream("data/northwind.xml")); params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document); params.put(JRXPathQueryExecuterFactory.XML_DATE_PATTERN, "yyyy-MM-dd"); params.put(JRXPathQueryExecuterFactory.XML_NUMBER_PATTERN, "#,##0.##"); params.put(JRXPathQueryExecuterFactory.XML_LOCALE, Locale.ENGLISH); params.put(JRParameter.REPORT_LOCALE, Locale.US); JasperFillManager.fillReportToFile("build/reports/CustomersReport.jasper", params); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
/** * */ public void jsonMetadata() throws JRException { long start = System.currentTimeMillis(); JasperReport subreport = (JasperReport)JRLoader.loadObjectFromFile("build/reports/ProductReport.jasper"); //Preparing parameters Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("ProductsSubreport", subreport); parameters.put(JRParameter.IS_IGNORE_PAGINATION, true); JasperPrint jasperPrint = JasperFillManager.fillReport("build/reports/MasterReport.jasper", parameters, getDemoHsqldbConnection()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); start = System.currentTimeMillis(); File destFile = new File(new File("build/reports"), jasperPrint.getName() + ".json"); JsonMetadataExporter exporter = new JsonMetadataExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("JSON creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); Map<String, Object> params = new HashMap<String, Object>(); params.put(JsonQueryExecuterFactory.JSON_DATE_PATTERN, "yyyy-MM-dd"); params.put(JsonQueryExecuterFactory.JSON_NUMBER_PATTERN, "#,##0.##"); params.put(JsonQueryExecuterFactory.JSON_LOCALE, Locale.ENGLISH); params.put(JRParameter.REPORT_LOCALE, Locale.US); JasperFillManager.fillReportToFile("build/reports/JsonCustomersReport.jasper", params); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
private TimeZone getReportTimeZone() { TimeZone reportTimeZone = TimeZone.getDefault(); if(getContext()!=null) { reportTimeZone = (TimeZone) getContext().getParameterValue(JRParameter.REPORT_TIME_ZONE); } return reportTimeZone; }
private Locale getReportLocale() { Locale reportLocale = Locale.getDefault(); if(getContext()!=null) { reportLocale = (Locale) getContext().getParameterValue(JRParameter.REPORT_LOCALE); } return reportLocale; }
/** * */ public static final WebReportContext getInstance(HttpServletRequest request, String reportContextId, boolean create) { WebReportContext webReportContext = null; if (reportContextId == null) { reportContextId = request.getParameter(REQUEST_PARAMETER_REPORT_CONTEXT_ID); } if (reportContextId != null) { webReportContext = (WebReportContext)request.getSession().getAttribute(getSessionAttributeName(reportContextId)); } if (webReportContext == null && create) { webReportContext = new WebReportContext(); request.getSession().setAttribute(webReportContext.getSessionAttributeName(), webReportContext); //FIXMEJIVE use FIFO accessor } if (webReportContext != null) { //webReportContext.setRequest(request); webReportContext.setParameterValue(APPLICATION_CONTEXT_PATH, request.getContextPath()); webReportContext.setParameterValue(JRParameter.REPORT_CONTEXT, webReportContext); } return webReportContext; }