@Test public void testFormatWithParams() throws EvaluationException { patternLinkCustomizer = new PatternLinkCustomizer(); ParameterEntry[] paramEntries = { new ParameterEntry( "param", "value" ) }; String result = patternLinkCustomizer.format( formulaContext, "generic-url", "http: assertEquals( "http: }
public String format( final FormulaContext formulaContext, final String configIndicator, final String reportPath, final ParameterEntry[] entries ) throws EvaluationException { try { final String parameter = computeParameter( formulaContext, entries ); final String pattern = computePattern( configIndicator, parameter ); final MessageFormat messageFormat = new MessageFormat( pattern, formulaContext.getLocalizationContext().getLocale() ); return messageFormat.format( new Object[] { reportPath, parameter } ); } catch ( UnsupportedEncodingException e ) { throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE ); } catch ( BeanException e ) { throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE ); } }
PatternLinkCustomizer implements LinkCustomizer { public String format( final FormulaContext formulaContext, final String configIndicator, final String reportPath, final ParameterEntry[] entries ) throws EvaluationException { try { final String parameter = computeParameter( formulaContext, entries ); final String pattern = computePattern( configIndicator, parameter ); final MessageFormat messageFormat = new MessageFormat( pattern, formulaContext.getLocalizationContext().getLocale() ); return messageFormat.format( new Object[] { reportPath, parameter } ); } catch ( UnsupportedEncodingException e ) { throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE ); } catch ( BeanException e ) { throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE ); } } }
PatternLinkCustomizer implements LinkCustomizer { public String format( final FormulaContext formulaContext, final String configIndicator, final String reportPath, final ParameterEntry[] entries ) throws EvaluationException { try { final String parameter = computeParameter( formulaContext, entries ); final String pattern = computePattern( configIndicator, parameter ); final MessageFormat messageFormat = new MessageFormat( pattern, formulaContext.getLocalizationContext().getLocale() ); return messageFormat.format( new Object[] { reportPath, parameter } ); } catch ( UnsupportedEncodingException e ) { throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE ); } catch ( BeanException e ) { throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE ); } } PatternLinkCustomizer(); }
PatternLinkCustomizer implements LinkCustomizer { public String format( final FormulaContext formulaContext, final String configIndicator, final String reportPath, final ParameterEntry[] entries ) throws EvaluationException { try { final String parameter = computeParameter( formulaContext, entries ); final String pattern = computePattern( configIndicator, parameter ); final MessageFormat messageFormat = new MessageFormat( pattern, formulaContext.getLocalizationContext().getLocale() ); return messageFormat.format( new Object[] { reportPath, parameter } ); } catch ( UnsupportedEncodingException e ) { throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE ); } catch ( BeanException e ) { throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE ); } } PatternLinkCustomizer(); String format( final FormulaContext formulaContext,
                        final String configIndicator,
                        final String reportPath,
                        final ParameterEntry[] entries ); static String computeParameter( final FormulaContext formulaContext, final ParameterEntry[] entries ); }
PatternLinkCustomizer implements LinkCustomizer { public String format( final FormulaContext formulaContext, final String configIndicator, final String reportPath, final ParameterEntry[] entries ) throws EvaluationException { try { final String parameter = computeParameter( formulaContext, entries ); final String pattern = computePattern( configIndicator, parameter ); final MessageFormat messageFormat = new MessageFormat( pattern, formulaContext.getLocalizationContext().getLocale() ); return messageFormat.format( new Object[] { reportPath, parameter } ); } catch ( UnsupportedEncodingException e ) { throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE ); } catch ( BeanException e ) { throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE ); } } PatternLinkCustomizer(); String format( final FormulaContext formulaContext,
                        final String configIndicator,
                        final String reportPath,
                        final ParameterEntry[] entries ); static String computeParameter( final FormulaContext formulaContext, final ParameterEntry[] entries );  }