Package org.drools.guvnor.client.rpc

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


        return assets.toArray(new Asset[assets.size()]);
    }

    private Asset createAsset(RuleModel ruleModel) {
        Asset asset = new Asset();

        asset.setUuid("mock-" + UUID.randomUUID().toString());
        asset.setContent(ruleModel);
        asset.setName(ruleModel.name);
        asset.setFormat(AssetFormats.BUSINESS_RULE);
        asset.setMetaData(createMetaData());
        asset.setState("temporal");

        return asset;
    }
View Full Code Here


                        public void onSuccess(final String packageRef, final Asset[] assets, final String name, final String description) {
                            //for each selcted resource we are going to add a xml entry
                            final StringBuilder result = new StringBuilder("");

                            for (int i = 0; i < assets.length; i++) {
                                final Asset asset = assets[i];

                                String partialResult = resourceXMLElementTemplate;

                                String nameString = "";
                                if (name.length() != 0) {
                                    if (assets.length == 1) {
                                        nameString = "name=\"" + name.trim() + "\"";
                                    } else {
                                        //add index to the name to avoid duplication
                                        nameString = "name=\"" + name.trim() + i + "\"";
                                    }
                                }
                                partialResult = partialResult.replace("{name}",
                                        nameString);

                                String descriptionString = "";
                                if (description.length() != 0) {
                                    descriptionString = "description=\"" + description.trim() + "\"";
                                }
                                partialResult = partialResult.replace("{description}",
                                        descriptionString);

                                final String type = convertAssetFormatToResourceType(asset.getFormat());
                                if (type == null) {
                                    throw new IllegalArgumentException(Constants.INSTANCE.UnknownResourceFormat(asset.getFormat()));
                                }

                                partialResult = partialResult.replace("{type}", type);

                                partialResult = partialResult.replace("{source}", buildDownloadLink(asset, packageRef));
View Full Code Here

        AssetItem dtItem = rulesRepository.loadAssetByUUID( uuid );
        assertEquals( dtItem.getDescription(),
                      "an initial desc" );

        Asset asset = this.repositoryAssetService.loadRuleAsset( uuid );
        GuidedDecisionTable52 retrievedContent = (GuidedDecisionTable52) asset.getContent();

        assertNotNull( retrievedContent );
        assertEquals( TableFormat.LIMITED_ENTRY,
                      retrievedContent.getTableFormat() );
View Full Code Here

            //fail( "did not get expected exception" );
        } catch ( SerializationException e ) {
            //assertTrue( e.getMessage().indexOf( "'testCreateNewRuleContainsApostropheContains' character' is not a valid path. ''' not a valid name character" ) >= 0 );
        }

        Asset assetWrapper = repositoryAssetService.loadRuleAsset( uuid );
        assertEquals( assetWrapper.getDescription(),
                      "an initial desc" );
        assertEquals( assetWrapper.getName(),
                      "testCreateNewRuleContainsApostropheContains' character" );

    }
View Full Code Here

                                                                null,
                                                                "testStatus",
                                                                AssetFormats.DRL );
        serviceImplementation.createState( "testState" );

        Asset asset = repositoryAssetService.loadRuleAsset( ruleUUID );
        assertEquals( StateItem.DRAFT_STATE_NAME,
                      asset.getState() );
        repositoryAssetService.changeState( ruleUUID,
                                            "testState" );
        asset = repositoryAssetService.loadRuleAsset( ruleUUID );
        assertEquals( "testState",
                      asset.getState() );
        asset = repositoryAssetService.loadRuleAsset( ruleUUID2 );
        assertEquals( StateItem.DRAFT_STATE_NAME,
                      asset.getState() );

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

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

        asset = repositoryAssetService.loadRuleAsset( ruleUUID2 );
        assertEquals( "testState2",
                      asset.getState() );

        repositoryAssetService.checkinVersion( asset );
        asset = repositoryAssetService.loadRuleAsset( asset.getUuid() );
        assertEquals( "testState2",
                      asset.getState() );

    }
View Full Code Here

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

        Asset asset = repositoryAssetService.loadRuleAsset( rule1.getUUID() );
        repositoryAssetService.checkinVersion( asset );

        assertFalse( pkg.getNode().getProperty( "drools:binaryUpToDate" ).getBoolean() );
        assertFalse( RuleBaseCache.getInstance().contains( pkg.getUUID() ) );
View Full Code Here

                                                          "",
                                                          "testGuidedDTExecuteCategory",
                                                          pkg.getName(),
                                                          AssetFormats.DECISION_TABLE_GUIDED );

        Asset ass = repositoryAssetService.loadRuleAsset( uid );
        ass.setContent( dt );
        repositoryAssetService.checkinVersion( ass );

        BuilderResult results = repositoryPackageService.buildPackage( pkg.getUUID(),
                                                                       true );
        for ( BuilderResultLine line : results.getLines() ) {
View Full Code Here

        final int PAGE_SIZE = 2;

        UserInbox ib = new UserInbox( rulesRepository );
        ib.clearAll();

        @SuppressWarnings("unused")
        Asset asset;
        String uuid;
        rulesRepository.createModule( "testLoadInboxPackage",
                                      "testLoadInboxDescription" );
        repositoryCategoryService.createCategory( "",
View Full Code Here

        UserInbox ib = new UserInbox( rulesRepository );

        ib.clearAll();

        @SuppressWarnings("unused")
        Asset asset;
        String uuid;
        rulesRepository.createModule( "testLoadInboxFullResults",
                                      "testLoadInboxDescription" );
        repositoryCategoryService.createCategory( "",
View Full Code Here

        assertEquals( 1,
                      response.getPageRowList().size() );
        String uuid = response.getPageRowList().get( 0 ).getUuid();

        // create version 4.
        Asset ai = repositoryAssetService.loadRuleAsset( uuid );
        ai.setCheckinComment( "version 4" );
        repositoryAssetService.checkinVersion( ai );

        // create version 5.
        ai = repositoryAssetService.loadRuleAsset( uuid );
        ai.setCheckinComment( "version 5" );
        repositoryAssetService.checkinVersion( ai );

        System.out.println( "old uuid: " + uuid );

        //NOTE: Have not figured out the reason, but if we dont create a random package here,
View Full Code Here

TOP

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

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.