Package org.drools.guvnor.client.rpc

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


            roleBasedPermissionManager.create(); // HACK flushes the permission cache

        try {
            //now lets see if we can access this asset with the permissions
            //RuleAsset asset2 = impl.loadRuleAsset(uuid2);
            @SuppressWarnings("unused")
            Asset asset1 = repositoryAssetService.loadRuleAsset( uuid1 );

        } finally {
            roleBasedPermissionStore.clearAllRoleBasedPermissionsForTesting(USER_NAME);
            roleBasedPermissionResolver.setEnableRoleBasedAuthorization(false);
View Full Code Here


                                           category1 ) );
        roleBasedPermissionManager.create(); // HACK flushes the permission cache

        try {
            // now lets see if we can access this asset with the permissions
            @SuppressWarnings("unused")
            Asset asset = null;
            try {
                asset = repositoryAssetService.loadRuleAsset( uuid );
            } catch ( AuthorizationException e ) {
                fail( "User has permissions for the category" );
View Full Code Here

        roleBasedPermissionManager.create(); // HACK flushes the permission cache

        try {
            //now lets see if we can access this asset with the permissions
            try {
                Asset asset = repositoryAssetService.loadRuleAsset( uuid );
                fail( "Did not catch expected exception" );
            } catch ( AuthorizationException e ) {
            }
        } finally {
            roleBasedPermissionStore.clearAllRoleBasedPermissionsForTesting(USER_NAME);
View Full Code Here

                                          "this is a description",
                                          "testCheckinWithPackageReadonlyCat",
                                          "testCheckinWithPackageReadonlyPack",
                                          AssetFormats.DRL );

        Asset asset = repositoryAssetService.loadRuleAsset( uuid );
        assertNotNull( asset.getLastModified() );
        asset.getMetaData().setCoverage( "boo" );
        asset.setContent( new RuleContentText() );
        ((RuleContentText) asset.getContent()).content = "yeah !";
        Thread.sleep( 100 );

        roleBasedPermissionResolver.setEnableRoleBasedAuthorization(true);
        roleBasedPermissionStore.addRoleBasedPermissionForTesting(USER_NAME, new RoleBasedPermission( USER_NAME,
                                           RoleType.PACKAGE_READONLY.getName(),
View Full Code Here

                                          "this is a description",
                                          "testCheckinPackageDeveloperCat1",
                                          "testCheckinPackageDeveloperPack1",
                                          AssetFormats.DRL );

        Asset asset = repositoryAssetService.loadRuleAsset( uuid );
        assertNotNull( asset.getLastModified() );
        asset.getMetaData().setCoverage( "boo" );
        asset.setContent( new RuleContentText() );
        ((RuleContentText) asset.getContent()).content = "yeah !";
        Thread.sleep( 100 );

        roleBasedPermissionResolver.setEnableRoleBasedAuthorization(true);
        roleBasedPermissionStore.addRoleBasedPermissionForTesting(USER_NAME, new RoleBasedPermission( USER_NAME,
                                           RoleType.PACKAGE_DEVELOPER.getName(),
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

                throw new ServletException( new IllegalArgumentException( "The load action requires the parameter uuid" ) );
            }
            ServletOutputStream outputStream = response.getOutputStream();

            try {
                Asset asset = repositoryAssetService.loadRuleAsset( uuid );
                if ( asset.getContent() != null ) {
                    response.setContentType( "application/json" );
                    String content = null;
                    if ( asset.getContent() instanceof RuleFlowContentModel ) {
                        content = ((RuleFlowContentModel) asset.getContent()).getXml();
                    } else {
                        content = asset.getContent().toString();
                    }
                    try {
                        content = deserialize( getDesignerURL()+"/bpmn2_0deserialization",
                                               content );
                    } catch ( IOException e ) {
View Full Code Here

                               ConversionMessageType.ERROR );
            return;
        }

        //Check-in asset with content
        Asset newAsset = repositoryAssetService.loadRuleAsset( uuid );
        newAsset.setContent( content );
        newAsset.setCheckinComment( "Converted from '" + item.getName() + "'." );
        uuid = repositoryAssetService.checkinVersion( newAsset );

        //If there was an error checking-in new asset return
        if ( uuid.startsWith( "ERR" ) ) {
            result.addMessage( uuid,
View Full Code Here

        PageResponse<AssetPageRow> assetWorkDefinitions = repositoryAssetService.findAssetPage( workDefinitionAssetRequest );

        //Add individual assets to definitions list
        List<String> definitions = new ArrayList<String>();
        for ( AssetPageRow row : assetWorkDefinitions.getPageRowList() ) {
            Asset asset = repositoryAssetService.loadRuleAsset( row.getUuid() );
            RuleContentText content = (RuleContentText) asset.getContent();
            definitions.add( content.content );
        }

        return definitions;
    }
View Full Code Here

        RuleCoverageListener coverage = new RuleCoverageListener(expectedRules(bin));

        while (it.hasNext()) {
            AssetItem as = it.next();
            if (!as.getDisabled()) {
                Asset asset = repositoryAssetOperations.loadAsset(as);
                Scenario sc = (Scenario) asset.getContent();
                runScenario(packageItem.getName(),
                        sc,
                        coverage);

                int[] totals = sc.countFailuresTotal();
                resultSummaries.add(new ScenarioResultSummary(totals[0],
                        totals[1],
                        asset.getName(),
                        asset.getDescription(),
                        asset.getUuid()));
            }
        }

        ScenarioResultSummary[] summaries = resultSummaries.toArray(new ScenarioResultSummary[resultSummaries.size()]);
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.