Package org.drools.guvnor.client.rpc

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


        serviceImplementation.createState( "testState2" );
        repositoryAssetService.changePackageState( packagUUID,
                                                   "testState2" );

        Module pkg = repositoryPackageService.loadModule( packagUUID );
        assertEquals( "testState2",
                      pkg.getState() );

        asset = repositoryAssetService.loadRuleAsset( ruleUUID2 );
        assertEquals( "testState2",
                      asset.getState() );
View Full Code Here


                                               false );

        assertTrue( pkg.getNode().getProperty( "drools:binaryUpToDate" ).getBoolean() );
        assertFalse( RuleBaseCache.getInstance().contains( pkg.getUUID() ) );

        Module config = repositoryPackageService.loadModule( pkg.getUUID() );
        repositoryPackageService.saveModule( config );

        assertFalse( pkg.getNode().getProperty( "drools:binaryUpToDate" ).getBoolean() );
        assertFalse( pkg.isBinaryUpToDate() );
        repositoryPackageService.buildPackage( pkg.getUUID(),
View Full Code Here

    public void onSelection(SelectionEvent<TreeItem> event) {
        TreeItem item = event.getSelectedItem();

        if ( item.getUserObject() instanceof Module ) {
            Module pc = (Module) item.getUserObject();
            String id = itemWidgets.get( item );


            if ( ExplorerNodeConfig.TEST_SCENARIOS_ID.equals( id ) ) {

                clientFactory.getPlaceController().goTo( new TestScenarioListPlace( pc.getUuid() ) );

            } else if ( ExplorerNodeConfig.ANALYSIS_ID.equals( id ) ) {
                clientFactory.getPlaceController().goTo( new VerifierPlace( pc.getUuid() ) );
            }
        }
    }
View Full Code Here

                public void onSuccess(Module[] conf) {
                    node.removeItems();
                    removeTestScenarioIDs( itemWidgets );

                    for (int i = 0; i < conf.length; i++) {
                        final Module c = conf[i];
                        TreeItem pkg = new TreeItem( Util.getHeader( DroolsGuvnorImages.INSTANCE.packages(),
                                c.getName() ) );

                        node.addItem( pkg );
                        pkg.setUserObject( c );
                        itemWidgets.put( pkg,
                                ExplorerNodeConfig.TEST_SCENARIOS_ID );
                    }
                }
            } );
        } else if ( ExplorerNodeConfig.ANALYSIS_ROOT_ID.equals( itemWidgets.get( node ) ) ) {
            RepositoryServiceFactory.getPackageService().listModules( new GenericCallback<Module[]>() {
                public void onSuccess(Module[] conf) {
                    node.removeItems();
                    removeAnalysisIDs( itemWidgets );
                    for (int i = 0; i < conf.length; i++) {
                        final Module c = conf[i];
                        TreeItem pkg = new TreeItem( Util.getHeader( DroolsGuvnorImages.INSTANCE.packages(),
                                c.getName() ) );

                        node.addItem( pkg );
                        pkg.setUserObject( c );
                        itemWidgets.put( pkg,
                                ExplorerNodeConfig.ANALYSIS_ID );
View Full Code Here

                    public void onFailure(Throwable caught) {
                        ErrorPopup
                                .showMessage("Error listing Global Area information!");
                    }
                    public void onSuccess(Module result) {
                        final Module presults = result;
                       
                        RepositoryServiceFactory.getPackageService().listImagesInModule(
                                result.getName(), new AsyncCallback<String[]>() {

                                    public void onFailure(Throwable caught) {
                                        ErrorPopup
                                                .showMessage("Error listing images information!");
                                    }
                                    public void onSuccess(String[] images) {
                                        for (int i = 0; i < images.length; i++) {
                                            imagesList.addItem(presults.getName() + " : " + images[i],
                                                    "http://localhost:8080/drools-guvnor/rest/packages/" +
                                                    presults.getName() + "/assets/" + images[i] + "/binary");
                                        }
                                    }
                                });
                    }
                });

        // Images in Packages
        RepositoryServiceFactory.getPackageService().listModules(
                new AsyncCallback<Module[]>() {

                    public void onFailure(Throwable caught) {
                        ErrorPopup
                                .showMessage("Error listing images information!");
                    }
                    public void onSuccess(Module[] result) {
                        for (int i = 0; i < result.length; i++) {
                            final Module packageConfigData = result[i];
                           
                            RepositoryServiceFactory.getPackageService().listImagesInModule(
                                    packageConfigData.getName(), new AsyncCallback<String[]>() {

                                        public void onFailure(Throwable caught) {
                                            ErrorPopup
                                                    .showMessage("Error listing images information!");
                                        }
                                        public void onSuccess(String[] images) {
                                            for (int i = 0; i < images.length; i++) {
                                                imagesList.addItem(packageConfigData.getName() + " : " + images[i],
                                                        "http://localhost:8080/drools-guvnor/rest/packages/" +
                                                        packageConfigData.getName() + "/assets/" + images[i] + "/binary");
                                            }
                                        }
                                    });
                        }
                    }
View Full Code Here

                    ErrorPopup.showMessage("Error listing package information!");
                }

                public void onSuccess(Module[] result) {
                    for (int i = 0; i < result.length; i++) {
                        final Module packageConfigData = result[i];
                        populatePackageTree(packageConfigData, null);
                    }
                }
            });
        } else {
View Full Code Here

                    ErrorPopup.showMessage("Error listing package information!");
                }

                public void onSuccess(Module[] result) {
                    for (int i = 0; i < result.length; i++) {
                        final Module packageConfigData = result[i];
                        populatePackageList(packageConfigData, packageUUID);
                    }

                    //once packages are loaded is time to load the asset table
                    loadAssetTable();
View Full Code Here

                ErrorPopup.showMessage("Error listing package information!");
            }

            public void onSuccess(Module[] result) {
                for (int i = 0; i < result.length; i++) {
                    final Module packageConfigData = result[i];
                    populatePackageTree(packageConfigData, rootItem);
                }
            }
        });
View Full Code Here

        }
        boolean isModified = false;

        //Load Module header and globals and imports
        String moduleUUID = item.getModule().getUUID();
        Module module = repositoryModuleService.loadModule( moduleUUID );
        ModuleHeader mh = ModuleHeaderHelper.parseHeader( module.header );

        //Make collections of existing items so we don't duplicate them when adding the new
        Map<String, String> existingGlobals = new HashMap<String, String>();
        for ( ModuleHeader.Global g : mh.getGlobals() ) {
            existingGlobals.put( g.getName(),
                                 g.getType() );
        }
        List<String> existingImports = new ArrayList<String>();
        for ( ModuleHeader.Import i : mh.getImports() ) {
            existingImports.add( i.getType() );
        }

        //Add globals
        if ( globals != null ) {
            for ( Global g : globals ) {
                if ( !existingGlobals.containsKey( g.getIdentifier() ) ) {
                    isModified = true;
                    result.addMessage( "Created Global '" + g.getIdentifier() + "' of type '" + g.getClassName() + "'.",
                                       ConversionMessageType.INFO );
                    mh.getGlobals().add( new ModuleHeader.Global( g.getClassName(),
                                                                  g.getIdentifier() ) );
                } else {
                    if ( !existingGlobals.get( g.getIdentifier() ).equals( g.getClassName() ) ) {
                        result.addMessage( "Global '" + g.getIdentifier() + "' is already declared. Type '" + existingGlobals.get( g.getIdentifier() ) + "'. Cannot create from Worksheet.",
                                           ConversionMessageType.WARNING );
                    }
                }
            }
        }

        //Add imports
        if ( imports != null ) {
            for ( Import i : imports ) {
                if ( !existingImports.contains( i.getClassName() ) ) {
                    isModified = true;
                    result.addMessage( "Created Import for '" + i.getClassName() + "'.",
                                       ConversionMessageType.INFO );
                    mh.getImports().add( new ModuleHeader.Import( i.getClassName() ) );
                }
            }
        }

        //Save update
        if ( isModified ) {
            module.setHeader( ModuleHeaderHelper.renderModuleHeader( mh ) );
            repositoryModuleService.saveModule( module );
        }
    }
View Full Code Here

    public void onSelection(SelectionEvent<TreeItem> event) {
        TreeItem item = event.getSelectedItem();

        if ( item.getUserObject() instanceof Module ) {
            Module pc = (Module) item.getUserObject();
            String id = itemWidgets.get( item );


            if ( ExplorerNodeConfig.TEST_SCENARIOS_ID.equals( id ) ) {

                placeController.goTo( new TestScenarioListPlace( pc.getUuid() ) );

            } else if ( ExplorerNodeConfig.ANALYSIS_ID.equals( id ) ) {
                placeController.goTo( new VerifierPlace( pc.getUuid() ) );
            }
        }
    }
View Full Code Here

TOP

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

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.