JrxmlParser { public Pair<ProcessDefinition, Map<String, String>> parse( String processId, String name, String description, XMLAdapter jrxmlAdapter, List<JrxmlContentProvider> contentProviders, Map<String, ParameterDescription> parameterDescriptions ) { OMElement root = jrxmlAdapter.getRootElement(); String processName = jrxmlAdapter.getNodeAsString( root, new XPath( "/jasper:jasperReport/@name", nsContext ), name ); Map<String, String> parameters = new HashMap<String, String>(); List<OMElement> paramElements = jrxmlAdapter.getElements( root, new XPath( "/jasper:jasperReport/jasper:parameter", nsContext ) ); for ( OMElement paramElement : paramElements ) { String paramName = paramElement.getAttributeValue( new QName( "name" ) ); String paramType = paramElement.getAttributeValue( new QName( "class" ) ); LOG.debug( "Found parameter '{}', type {}", paramName, paramType ); parameters.put( paramName, paramType ); } InputParameters inputParams = new InputParameters(); List<JAXBElement<? extends ProcessletInputDefinition>> processInput = inputParams.getProcessInput(); List<String> handledParameters = new ArrayList<String>(); handledParameters.addAll( globalParameters ); for ( JrxmlContentProvider contentProvider : contentProviders ) { contentProvider.inspectInputParametersFromJrxml( parameterDescriptions, processInput, jrxmlAdapter, parameters, handledParameters ); } OutputParameters outputParams = new OutputParameters(); ComplexOutputDefinition output = new ComplexOutputDefinition(); output.setTitle( getAsLanguageStringType( "report" ) ); output.setIdentifier( getAsCodeType( "report" ) ); ComplexFormatType format = new ComplexFormatType(); format.setMimeType( JrxmlUtils.OUTPUT_MIME_TYPES.PDF.getMimeType() ); output.setDefaultFormat( format ); outputParams.getProcessOutput().add( new JAXBElement<ComplexOutputDefinition>( new QName( "report" ), ComplexOutputDefinition.class, output ) ); ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setConfigVersion( "0.5.0" ); processDefinition.setProcessVersion( "1.0.0" ); processDefinition.setStatusSupported( false ); processDefinition.setStoreSupported( true ); processDefinition.setIdentifier( getAsCodeType( processId ) ); processDefinition.setTitle( getAsLanguageStringType( processName ) ); if ( description != null ) processDefinition.setAbstract( getAsLanguageStringType( description ) ); processDefinition.setInputParameters( inputParams ); processDefinition.setOutputParameters( outputParams ); return new Pair<ProcessDefinition, Map<String, String>>( processDefinition, parameters ); } JrxmlParser();   JrxmlParser( List<String> globalParameters ); Pair<ProcessDefinition, Map<String, String>> parse( String processId, String name, String description,
                                                               XMLAdapter jrxmlAdapter,
                                                               List<JrxmlContentProvider> contentProviders,
                                                               Map<String, ParameterDescription> parameterDescriptions );  }
@Test public void testParse() { XMLAdapter jrxmlAdapter = new XMLAdapter( TestJrxmlParserTest.class.getResourceAsStream( "testWPSreportTemplate.jrxml" ) ); JrxmlParser p = new JrxmlParser(); Pair<ProcessDefinition, Map<String, String>> parsed = p.parse( "processId", "testWPSreportTemplate", "Process description", jrxmlAdapter, new ArrayList<JrxmlContentProvider>(), new HashMap<String, ParameterDescription>() ); assertNotNull( parsed ); ProcessDefinition pd = parsed.first; assertNotNull( pd ); assertNotNull( pd.getIdentifier() ); assertEquals( "processId", pd.getIdentifier().getValue() ); assertEquals( "createReportByAWPSProcess", pd.getTitle().getValue() ); }