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() );
            String p = callPreprocessingData( ((IFrameElement) ((com.google.gwt.dom.client.Element) frame.getElement())).getContentDocument() );
            if ( asset.getContent() == null ) {
                asset.setContent( new RuleFlowContentModel() );
            }
            ((RuleFlowContentModel) asset.getContent()).setXml( null );
            ((RuleFlowContentModel) asset.getContent()).setJson( s );
            ((RuleFlowContentModel) asset.getContent()).setPreprocessingdata(p);
        } catch ( Exception e ) {
View Full Code Here


        LoadingPopup.close();
    }

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

        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.getContent();

        rfcm.setNodes( ruleFlowViewer.getTransferNodes() );

    }
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.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 void retrieveAssetContent(RuleAsset asset,
                                     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.setContent( content );
        } else {
            // we are very fault tolerant
            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 ) {
                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=jbpm&action=toXML&pp=" +
                                                    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 xml = BPMN2ProcessHandler.serialize( "http://localhost:8080/designer/uuidRepository?profile=jbpm&action=toXML&pp=" +
                                                                    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 void onSave() {
        try {
            String s = callSave( ((IFrameElement) ((com.google.gwt.dom.client.Element) frame.getElement())).getContentDocument() );
            String p = callPreprocessingData( ((IFrameElement) ((com.google.gwt.dom.client.Element) frame.getElement())).getContentDocument() );
            if ( asset.getContent() == null ) {
                asset.setContent( new RuleFlowContentModel() );
            }
            ((RuleFlowContentModel) asset.getContent()).setXml( null );
            ((RuleFlowContentModel) asset.getContent()).setJson( s );
            ((RuleFlowContentModel) asset.getContent()).setPreprocessingdata(p);
        } catch ( Exception e ) {
View Full Code Here

        LoadingPopup.close();
    }

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

        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

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.