Package org.drools.guvnor.client.rpc

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


   
    public void onSave() {
        try {
            String s = callSave( ((IFrameElement) ((com.google.gwt.dom.client.Element) frame.getElement())).getContentDocument() );
            if ( asset.content == null ) {
                asset.content = new RuleFlowContentModel();
            }
            ((RuleFlowContentModel) asset.content).setXml( null );
            ((RuleFlowContentModel) asset.content).setJson( s );
        } catch(Exception e) {
            GWT.log("JSNI method callSave() threw an exception:", e);
View Full Code Here


                                     AssetItem item) throws SerializationException {

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

        if ( process != null ) {
            RuleFlowContentModel content = RuleFlowContentModelBuilder.createModel( process );
            content.setXml( item.getContent() );
            asset.content = content;
        } else if ( process == null && !"".equals( item.getContent() ) ) {
            asset.content = 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.content;

        //
        // 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

        LoadingPopup.close();
    }

    private void initRuleflowViewer() {
        RuleFlowContentModel rfcm = (RuleFlowContentModel) asset.content;

        if ( rfcm != null && rfcm.getXml() != null && rfcm.getNodes() != null ) {
            try {
                parameterPanel = new DecoratedDisclosurePanel( constants.Parameters() );
                parameterPanel.ensureDebugId( "cwDisclosurePanel" );
                parameterPanel.setWidth( "100%" );
                parameterPanel.setOpen( false );

                FormStyleLayout parametersForm = new FormStyleLayout();
                parametersForm.setHeight( "120px" );
                parameterPanel.setContent( parametersForm );

                ruleFlowViewer = new RuleFlowViewer( rfcm,
                                                     parametersForm );
            } catch ( Exception e ) {
                Window.alert( e.toString() );
            }
        } else if ( rfcm != null && rfcm.getXml() == null ) {

            // If the XML is not set there was some problem when the diagram was
            // created.
            Window.alert( constants.CouldNotCreateTheRuleflowDiagramItIsPossibleThatTheRuleflowFileIsInvalid() );
View Full Code Here

    }

    public void onSave() {

        RuleFlowContentModel rfcm = (RuleFlowContentModel) asset.content;

        rfcm.setNodes( ruleFlowViewer.getTransferNodes() );

    }
View Full Code Here

    public void retrieveAssetContent(RuleAsset asset,
                                     PackageItem pkg,
                                     AssetItem item) throws SerializationException {
        RuleFlowProcess process = readProcess( new ByteArrayInputStream( item.getContent().getBytes() ) );
        if ( process != null ) {
            RuleFlowContentModel content = RuleFlowContentModelBuilder.createModel( process );
            content.setXml( item.getContent() );
            asset.content = content;
        } else {
            // we are very fault tolerant
            RuleFlowContentModel content = new RuleFlowContentModel();
            content.setXml( item.getContent() );
            asset.content = content;
        }
    }
View Full Code Here

        return process;
    }

    public void storeAssetContent(RuleAsset asset,
                                  AssetItem repoAsset) throws SerializationException {
        RuleFlowContentModel content = (RuleFlowContentModel) asset.content;
        //
        // 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() );
                }
            }
            if ( content.getJson() != null ) {    
                try {
                    String xml = serialize("http://localhost:8080/designer/uuidRepository?profile=drools&action=toXML",
                                        content.getJson());
                    content.setXml(xml);
                    repoAsset.updateContent(content.getXml());
                } catch ( Exception e ) {
                  log.error( e.getMessage(),
                             e );
              }
            }
View Full Code Here

                        ErrorLogger logger) {
        // This can not work, no binary data in RuleAsset
    }
   
    public void assembleProcessSource(PortableObject assetContent, StringBuffer buf) {
        RuleFlowContentModel content = (RuleFlowContentModel) assetContent;
        if(content.getXml() != null && content.getXml().length() > 0) {
            buf.append(content.getXml());
        } else if(content.getJson() != null && content.getJson().length() > 0) {
            // convert the json to xml
            try {
                String xml = BPMN2ProcessHandler.serialize("http://localhost:8080/designer/uuidRepository?profile=drools&action=toXML",
                        content.getJson());
                buf.append(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

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.