ParameterXmlContentHandler { protected void appendParametersList( final DefaultParameterContext parameterContext, final ValidationResult vr, final Element parameters, final ParameterDependencyGraph dependencies, final LinkedHashMap<String, ParameterDefinitionEntry> reportParameters, final Map<String, Object> inputs, final Set<String> changedParameters ) throws CloneNotSupportedException, BeanException, ReportDataFactoryException { if ( !changedParameters.isEmpty() ) { final Set<String> changedWithDependencies = new HashSet<>( changedParameters ); changedWithDependencies.addAll( dependencies.getAllDependencies( changedParameters ) ); final List<ParameterDefinitionEntry> changedParamDefinitions = reportParameters.values().stream() .filter( p -> changedWithDependencies.contains( p.getName() ) ) .collect( Collectors.toList() ); final Set<String> effectivelyChanged = filterRedundantParameter( changedParameters, dependencies ); renderParameters( parameterContext, vr, parameters, dependencies, changedParamDefinitions, effectivelyChanged, inputs, true ); parameters.setAttribute( "minimized", "true" ); } else { renderParameters( parameterContext, vr, parameters, dependencies, reportParameters.values(), Collections.emptySet(), inputs, false ); } } ParameterXmlContentHandler( final ParameterContentGenerator contentGenerator, final boolean paginate ); static String convertParameterValueToString( final ParameterDefinitionEntry parameter,
                                                      final ParameterContext context, final Object value,
                                                      final Class<?> type ); void createParameterContent( final OutputStream outputStream,
                                      final Serializable fileId,
                                      final String path,
                                      boolean overrideOutputType,
                                      final MasterReport sourceReport ); static final String SYS_PARAM_ACCEPTED_PAGE; static final String SYS_PARAM_RENDER_MODE; static final String SYS_PARAM_CONTENT_LINK; static final String SYS_PARAM_SESSION_ID; static final String SYS_SERVER_NAMESPACE; }
@Test public void appendInitialParametersList() throws BeanException, ReportDataFactoryException, ParserConfigurationException, XPathExpressionException, CloneNotSupportedException { final LinkedHashMap<String, ParameterDefinitionEntry> parameterDefinitions = getParametersMap(); final DefaultParameterContext context = getTestParameterContext(); final ValidationResult vr = new ValidationResult(); vr.setParameterValues( new ReportParameterValues() ); handler.document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); final ParameterDependencyGraph dependencies = new ParameterDependencyGraph( "first", "second", "third" ); dependencies.addDependency( "first", "second" ); dependencies.addDependency( "second", "third" ); final Element parameters = handler.document.createElement( "parameters" ); handler.document.appendChild( parameters ); handler.appendParametersList( context, vr, parameters, dependencies, parameterDefinitions, new HashMap<>(), new HashSet<>() ); examineInitialParameters( handler.document ); }
@Test public void appendChangedParametersList() throws BeanException, ReportDataFactoryException, ParserConfigurationException, XPathExpressionException, CloneNotSupportedException { final LinkedHashMap<String, ParameterDefinitionEntry> parameterDefinitions = getParametersMap(); final DefaultParameterContext context = getTestParameterContext(); final ValidationResult vr = new ValidationResult(); vr.setParameterValues( new ReportParameterValues() ); handler.document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); final ParameterDependencyGraph dependencies = new ParameterDependencyGraph( "first", "second", "third", "fourth", "fifth", "sixth" ); dependencies.addDependency( "first", "second" ); dependencies.addDependency( "first", "fourth" ); dependencies.addDependency( "second", "third" ); dependencies.addDependency( "third", "seventh" ); dependencies.addDependency( "second", "fourth" ); dependencies.addDependency( "fourth", "third" ); dependencies.addDependency( "third", "fourth" ); dependencies.addDependency( "fifth", "sixth" ); dependencies.addDependency( "first", "first" ); final Element parameters = handler.document.createElement( "parameters" ); handler.document.appendChild( parameters ); handler.appendParametersList( context, vr, parameters, dependencies, parameterDefinitions, new HashMap<>(), new HashSet<>( Collections.singletonList( "first" ) ) ); System.out.println( toString( handler.document ) ); examineChangedDependentParameters( handler.document ); }
@Test public void appendChangedIndependentParametersList() throws BeanException, ReportDataFactoryException, ParserConfigurationException, XPathExpressionException, CloneNotSupportedException { final LinkedHashMap<String, ParameterDefinitionEntry> parameterDefinitions = getParametersMap(); final DefaultParameterContext context = getTestParameterContext(); final ValidationResult vr = new ValidationResult(); vr.setParameterValues( new ReportParameterValues() ); handler.document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); final ParameterDependencyGraph dependencies = new ParameterDependencyGraph( "first", "second", "third" ); dependencies.addDependency( "first", "second" ); dependencies.addDependency( "second", "third" ); final Element parameters = handler.document.createElement( "parameters" ); handler.document.appendChild( parameters ); handler.appendParametersList( context, vr, parameters, dependencies, parameterDefinitions, new HashMap<>(), new HashSet<>( Collections.singletonList( "fourth" ) ) ); examineChangedIndependentParameters( handler.document ); }
@Test public void resetInputParentChanged() throws BeanException, ReportDataFactoryException, ParserConfigurationException, XPathExpressionException, CloneNotSupportedException { final LinkedHashMap<String, ParameterDefinitionEntry> parameterDefinitions = getParametersMap( false ); final DefaultParameterContext context = getTestParameterContext(); final ValidationResult vr = new ValidationResult(); vr.setParameterValues( new ReportParameterValues() ); handler.document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); final ParameterDependencyGraph dependencies = new ParameterDependencyGraph( "first", "second", "third" ); dependencies.addDependency( "first", "second" ); dependencies.addDependency( "second", "third" ); final Element parameters = handler.document.createElement( "parameters" ); handler.document.appendChild( parameters ); final Map<String, Object> inputs = new HashMap<>(); inputs.put( "first", new String[] { "c11", "c10" } ); inputs.put( "second", new String[] { "c11", "c10" } ); inputs.put( "third", new String[] { "c11", "c10" } ); handler .appendParametersList( context, vr, parameters, dependencies, parameterDefinitions, inputs, asSet( "first" ) ); examineChangedResetParameters( handler.document ); }
@Test public void resetInputParentChangedChildSentFromUI() throws BeanException, ReportDataFactoryException, ParserConfigurationException, XPathExpressionException, CloneNotSupportedException { final LinkedHashMap<String, ParameterDefinitionEntry> parameterDefinitions = getParametersMap( false ); final DefaultParameterContext context = getTestParameterContext(); final ValidationResult vr = new ValidationResult(); vr.setParameterValues( new ReportParameterValues() ); handler.document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); final ParameterDependencyGraph dependencies = new ParameterDependencyGraph( "first", "second", "third" ); dependencies.addDependency( "first", "second" ); dependencies.addDependency( "second", "third" ); final Element parameters = handler.document.createElement( "parameters" ); handler.document.appendChild( parameters ); final Map<String, Object> inputs = new HashMap<>(); inputs.put( "first", new String[] { "c11", "c10" } ); inputs.put( "second", new String[] { "c11", "c10" } ); inputs.put( "third", new String[] { "c11", "c10" } ); handler.appendParametersList( context, vr, parameters, dependencies, parameterDefinitions, inputs, asSet( "first", "second" ) ); examineChangedResetParameters( handler.document ); }
@Test public void resetInputParentInTheMiddleChangedChildSentFromUI() throws BeanException, ReportDataFactoryException, ParserConfigurationException, XPathExpressionException, CloneNotSupportedException { final LinkedHashMap<String, ParameterDefinitionEntry> parameterDefinitions = getParametersMap( false ); final DefaultParameterContext context = getTestParameterContext(); final ValidationResult vr = new ValidationResult(); vr.setParameterValues( new ReportParameterValues() ); handler.document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); final ParameterDependencyGraph dependencies = new ParameterDependencyGraph( "first", "second", "third" ); dependencies.addDependency( "first", "second" ); dependencies.addDependency( "second", "third" ); final Element parameters = handler.document.createElement( "parameters" ); handler.document.appendChild( parameters ); final Map<String, Object> inputs = new HashMap<>(); inputs.put( "first", new String[] { "c11", "c10" } ); inputs.put( "second", new String[] { "c11", "c10" } ); inputs.put( "third", new String[] { "c11", "c10" } ); handler.appendParametersList( context, vr, parameters, dependencies, parameterDefinitions, inputs, asSet( "third", "second" ) ); examineChangedMiddleResetParameters( handler.document ); }