private Bpmn2Resource unmarshall ( JsonParser parser , String preProcessingData ) throws IOException { try { parser . nextToken ( ) ; // open the object ResourceSet rSet = new ResourceSetImpl ( ) ; rSet . getResourceFactoryRegistry ( ) . getExtensionToFactoryMap ( ) . put ( "bpmn2" , new JBPMBpmn2ResourceFactoryImpl ( ) ) ; Bpmn2Resource bpmn2 = ( Bpmn2Resource ) rSet . createResource ( URI . createURI ( "virtual.bpmn2" ) ) ; rSet . getResources ( ) . add ( bpmn2 ) ; _currentResource = bpmn2 ; if ( preProcessingData == null || preProcessingData . length ( ) < 1 ) { preProcessingData = "ReadOnlyService" ; } // do the unmarshalling now: Definitions def = ( Definitions ) unmarshallItem ( parser , preProcessingData ) ; def . setExporter ( exporterName ) ; def . setExporterVersion ( exporterVersion ) ; revisitUserTasks ( def ) ; revisitServiceTasks ( def ) ; revisitMessages ( def ) ; revisitCatchEvents ( def ) ; revisitThrowEvents ( def ) ; revisitLanes ( def ) ; revisitSubProcessItemDefs ( def ) ; revisitArtifacts ( def ) ; revisitGroups ( def ) ; revisitTaskAssociations ( def ) ; revisitTaskIoSpecification ( def ) ; revisitSendReceiveTasks ( def ) ; reconnectFlows ( ) ; revisitGateways ( def ) ; revisitCatchEventsConvertToBoundary ( def ) ; revisitBoundaryEventsPositions ( def ) ; createDiagram ( def ) ; updateIDs ( def ) ; revisitDataObjects ( def ) ; revisitAssociationsIoSpec ( def ) ; revisitWsdlImports ( def ) ; revisitMultiInstanceTasks ( def ) ; addSimulation ( def ) ; revisitItemDefinitions ( def ) ; revisitProcessDoc ( def ) ; revisitDI ( def ) ; revisitSignalRef ( def ) ; orderDiagramElements ( def ) ; // return def; _currentResource . getContents ( ) . add ( def ) ; return _currentResource ; } catch ( Exception e ) { _logger . error ( e . getMessage ( ) ) ; return _currentResource ; } finally { parser . close ( ) ; _objMap . clear ( ) ; _idMap . clear ( ) ; _outgoingFlows . clear ( ) ; _sequenceFlowTargets . clear ( ) ; _bounds . clear ( ) ; _currentResource = null ; } }
Start unmarshalling using the parser .