Package org.drools.guvnor.client.rpc

Examples of org.drools.guvnor.client.rpc.RuleFlowContentModel


    private static final LoggingHelper log = LoggingHelper.getLogger( BPMN2ProcessHandler.class );

    public void retrieveAssetContent(RuleAsset asset,
                                     AssetItem item) throws SerializationException {
      RuleFlowContentModel content = new RuleFlowContentModel();
        content.setXml( item.getContent() );
        asset.setContent( content );
    }
View Full Code Here


        return process;
    }

    public void storeAssetContent(RuleAsset asset,
                                  AssetItem repoAsset) throws SerializationException {
        RuleFlowContentModel content = (RuleFlowContentModel) asset.getContent();
        // Migrate v4 ruleflows to v5
        // Added guards to check for nulls in the case where the ruleflows
        // have not been migrated from drools 4 to 5.
        if ( content != null ) {
            if ( content.getXml() != null ) {
                if (!asset.getFormat().equals("bpmn2") && !asset.getFormat().equals("bpmn")) {
                    RuleFlowProcess process = readProcess( new ByteArrayInputStream( content.getXml().getBytes() ) );

                    if ( process != null ) {
                        RuleFlowProcessBuilder.updateProcess( process,
                                content.getNodes() );
                        XmlRuleFlowProcessDumper dumper = XmlRuleFlowProcessDumper.INSTANCE;
                        String out = dumper.dump( process );
                        repoAsset.updateContent( out );
                    } else {
                        // Migrate v4 ruleflows to v5
                        // Put the old contents back as there is no updating possible
                        repoAsset.updateContent( content.getXml() );
                    }
                }
            }
            if ( content.getJson() != null ) {
                try {
                    String designerURL = System.getProperty(ApplicationPreferences.DESIGNER_URL)+"/"+System.getProperty(ApplicationPreferences.DESIGNER_CONTEXT);
                    designerURL += "/uuidRepository?profile="+System.getProperty(ApplicationPreferences.DESIGNER_PROFILE)+"&action=toXML&pp=";
                    String xml = serialize( designerURL +
                                                    URLEncoder.encode( content.getPreprocessingdata(),
                                                                       "UTF-8" ),
                                            content.getJson() );
                    content.setXml( xml );
                    repoAsset.updateContent( content.getXml() );
                } catch ( Exception e ) {
                    log.error( e.getMessage(), e );
                }
            }
        }
View Full Code Here

        }
    }

    public void assembleSource(PortableObject assetContent,
                               StringBuilder stringBuilder) {
        RuleFlowContentModel content = (RuleFlowContentModel) assetContent;
        if ( content.getXml() != null && content.getXml().length() > 0 ) {
            stringBuilder.append( content.getXml() );
        } else if ( content.getJson() != null && content.getJson().length() > 0 ) {
            // convert the json to xml
            try {
                String designerURL = System.getProperty(ApplicationPreferences.DESIGNER_URL)+"/"+System.getProperty(ApplicationPreferences.DESIGNER_CONTEXT);
                designerURL += "/uuidRepository?profile="+System.getProperty(ApplicationPreferences.DESIGNER_PROFILE)+"&action=toXML&pp=";
                String xml = BPMN2ProcessHandler.serialize( designerURL +
                                                                    URLEncoder.encode( content.getPreprocessingdata(),
                                                                                       "UTF-8" ),
                                                            content.getJson() );
                stringBuilder.append( StringEscapeUtils.escapeXml( xml ) );
            } catch ( IOException e ) {
                log.error( "Exception converting to xml: " + e.getMessage() );
            }
        } else {
View Full Code Here

public class RuleFlowContentModelBuilder {

    public static RuleFlowContentModel createModel(RuleFlowProcess process) {

        RuleFlowContentModel model = new RuleFlowContentModel();

        Collection<TransferNode> transferNodes = createNodesAndConnections(process.getNodes(),
                model);

        model.getNodes().addAll(transferNodes);

        return model;
    }
View Full Code Here

    }

    private static ElementContainerTransferNode createRuleFlowContentModelTransferNode(Node[] nodes) {

        ElementContainerTransferNode fetn = new ElementContainerTransferNode();
        RuleFlowContentModel model = new RuleFlowContentModel();

        List<TransferNode> transferNodes = createNodesAndConnections(nodes,
                model);

        model.setNodes(transferNodes);
        fetn.setContentModel(model);

        return fetn;
    }
View Full Code Here

                                     AssetItem item) throws SerializationException {

        RuleFlowProcess process = readProcess( new ByteArrayInputStream( item.getContent().getBytes() ) );

        if ( process != null ) {
      RuleFlowContentModel content = new RuleFlowContentModel();
            content.setXml( item.getContent() );
            asset.setContent( content );
        } else if ( process == null && !"".equals( item.getContent() ) ) {
            asset.setContent( new RuleFlowContentModel() );
            //
            //
            // Migrate v4 ruleflows to v5
            // All we can do is put the old drools 4 rfm back as the xml so
            // that we can at least rebuild the package with it if the
View Full Code Here

    }

    public void storeAssetContent(RuleAsset asset,
                                  AssetItem repoAsset) throws SerializationException {

        RuleFlowContentModel content = (RuleFlowContentModel) asset.getContent();

        //
        // Migrate v4 ruleflows to v5
        // Added guards to check for nulls in the case where the ruleflows
        // have not been migrated from drools 4 to 5.
        //
        if ( content != null ) {
            if ( content.getXml() != null ) {
                RuleFlowProcess process = readProcess( new ByteArrayInputStream( content.getXml().getBytes() ) );

                if ( process != null ) {
                    RuleFlowProcessBuilder.updateProcess( process,
                                                          content.getNodes() );

                    XmlRuleFlowProcessDumper dumper = XmlRuleFlowProcessDumper.INSTANCE;
                    String out = dumper.dump( process );

                    repoAsset.updateContent( out );
                } else {
                    //
                    // Migrate v4 ruleflows to v5
                    // Put the old contents back as there is no updating possible
                    //
                    repoAsset.updateContent( content.getXml() );
                }
            }
        }
    }
View Full Code Here

public class RuleFlowContentModelBuilder {

    public static RuleFlowContentModel createModel(RuleFlowProcess process) {

        RuleFlowContentModel model = new RuleFlowContentModel();

        Collection<TransferNode> transferNodes = createNodesAndConnections( process.getNodes(),
                                                                            model );

        model.getNodes().addAll( transferNodes );

        return model;
    }
View Full Code Here

    }

    private static ElementContainerTransferNode createRuleFlowContentModelTransferNode(Node[] nodes) {

        ElementContainerTransferNode fetn = new ElementContainerTransferNode();
        RuleFlowContentModel model = new RuleFlowContentModel();

        List<TransferNode> transferNodes = createNodesAndConnections( nodes,
                                                                      model );

        model.setNodes( transferNodes );
        fetn.setContentModel( model );

        return fetn;
    }
View Full Code Here

        for ( RuleFlowBaseNode subNode : node.getNodes().values() ) {
            baseNodes.add( createNode( subNode ) );
        }

        RuleFlowContentModel model = new RuleFlowContentModel();
        model.setNodes( baseNodes );
        fetn.setContentModel( model );

        return fetn;
    }
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.rpc.RuleFlowContentModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.