Package org.drools.repository

Examples of org.drools.repository.AssetItemIterator


                                null );
                    }
                }
            }

            AssetItemIterator it = packageItem.listAssetsByFormat( AssetFormats.TEST_SCENARIO );
            List<ScenarioResultSummary> resultSummaries = new ArrayList<ScenarioResultSummary>();
            RuleBase rb = RuleBaseCache.getInstance().get( packageItem.getUUID() );
            Package bin = rb.getPackages()[0];

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

            while (it.hasNext()) {
                AssetItem as = it.next();
                if ( !as.getDisabled() ) {
                    RuleAsset asset = repositoryAssetOperations.loadAsset( as );
                    Scenario sc = (Scenario) asset.getContent();
                    runScenario( packageItem.getName(),
                            sc,
View Full Code Here


    }

    //Ensure all Processes (RuleFlow, BPMN, BPMN2) have their package name updated to that of the containing Guvnor package
    private void fixProcessPackageNames(final String moduleUUID) {
        final PackageItem newPackage = getRulesRepository().loadPackageByUUID( moduleUUID );
        final AssetItemIterator assetIterator = newPackage.listAssetsByFormat( new String[]{AssetFormats.RULE_FLOW_RF, AssetFormats.BPMN_PROCESS, AssetFormats.BPMN2_PROCESS} );

        while ( assetIterator.hasNext() ) {
            final AssetItem asset = assetIterator.next();
            final String assetFormat = asset.getFormat();
            final ContentHandler contentHandler = ContentManager.getHandler( assetFormat );
            if ( contentHandler instanceof ICanHasAttachment ) {
                ICanHasAttachment attachmentHandler = (ICanHasAttachment) contentHandler;
                try {
View Full Code Here

        assertTrue( referredItem.getCategories().size() == 1 );
        assertTrue( referredItem.getCategorySummary().contains( "testCreateNewRuleAsLinkCat1" ) );

        //now verify AssetItemIterator works by calling search
        AssetItemIterator it = impl.repository.findAssetsByName( "testCreateLinkedAssetItemRule%",
                                                                 true );
        //NOTE, getSize() may return -1
/*       assertEquals( 1,
                      it.getSize() );*/
        int size = 0;
        while ( it.hasNext() ) {
          size++;
            AssetItem ai = it.next();
            if ( ai.getUUID().equals( uuid ) ) {
                assertEquals( ai.getPackage().getName(),
                              "globalArea" );
                assertEquals( ai.getDescription(),
                              "an initial desc" );
View Full Code Here

                                  DateUtil.isoDate( createdAfter ),
                                  DateUtil.isoDate( createdBefore ) );
        dates[1] = new DateQuery( AssetItem.LAST_MODIFIED_PROPERTY_NAME,
                                  DateUtil.isoDate( modifiedAfter ),
                                  DateUtil.isoDate( modifiedBefore ) );
        AssetItemIterator it = rulesRepository.query( q,
                                                           seekArchived,
                                                           dates );
        // Add Filter to check Permission
        List<AssetItem> resultList = new ArrayList<AssetItem>();

        RepositoryFilter packageFilter = new ModuleFilter( identity );
        RepositoryFilter categoryFilter = new CategoryFilter( identity );

        while ( it.hasNext() ) {
            AssetItem ai = it.next();
            if ( checkPackagePermissionHelper( packageFilter,
                                               ai,
                                               RoleType.PACKAGE_READONLY.getName() ) || checkCategoryPermissionHelper( categoryFilter,
                                                                                                                       ai,
                                                                                                                       RoleType.ANALYST_READ.getName() ) ) {
View Full Code Here

        if ( request.getPageSize() != null && request.getPageSize() < 0 ) {
            throw new IllegalArgumentException( "pageSize cannot be less than zero." );
        }

        long start = System.currentTimeMillis();
        AssetItemIterator iterator = rulesRepository.queryFullText( request.getSearchText(),
                                                                         request.isSearchArchived() );
        log.debug( "Search time: " + (System.currentTimeMillis() - start) );

        List<QueryPageRow> rowList = new QueryFullTextPageRowBuilder()
                                            .withPageRequest( request )
                                            .withIdentity( identity )
                                            .withContent( iterator )
                                                .build();
        boolean bHasMoreRows = iterator.hasNext();
        PageResponse<QueryPageRow> response = new PageResponseBuilder<QueryPageRow>()
                                                      .withStartRowIndex( request.getStartRowIndex() )
                                                      .withPageRowList( rowList )
                                                      .withLastPage( !bHasMoreRows )
                                                          .buildWithTotalRowCount( -1 );
View Full Code Here

        Map<String, String[]> queryMap = createQueryMap( request.getMetadata() );

        DateQuery[] dates = createDateQueryForRepository( request );

        long start = System.currentTimeMillis();
        AssetItemIterator iterator = rulesRepository.query( queryMap,
                                                                 request.isSearchArchived(),
                                                                 dates );
        log.debug( "Search time: " + (System.currentTimeMillis() - start) );

        List<QueryPageRow> rowList = new QueryMetadataPageRowBuilder()
                                            .withPageRequest( request )
                                            .withIdentity( identity )
                                            .withContent( iterator )
                                            .build();
        boolean bHasMoreRows = iterator.hasNext();
        PageResponse<QueryPageRow> response = new PageResponseBuilder<QueryPageRow>()
                                                .withStartRowIndex( request.getStartRowIndex() )
                                                .withPageRowList( rowList )
                                                .withLastPage( !bHasMoreRows )
                                                .buildWithTotalRowCount( -1 );//its impossible to know the exact selected count until we'v reached
View Full Code Here

                        xml += "    </add>\n";
                        xml += "</change-set>";
                        out.write(xml.getBytes());
                    } else if (req.getRequestURI().endsWith("MODEL")) {
                        ModuleItem pkg = rulesRepository.loadModule(helper.getPackageName());
                        AssetItemIterator it = pkg.listAssetsByFormat(AssetFormats.MODEL);
                        BufferedInputStream inputFile = null;
                        byte[] data = new byte[1000];
                        int count = 0;
                        int numberOfAssets = 0;
                        while (it.hasNext()) {
                            it.next();
                            numberOfAssets++;
                        }

                        if (numberOfAssets == 0) {
                            res.setContentType("text/html");
View Full Code Here

    public SuggestionCompletionEngine getSuggestionEngine(ModuleItem packageItem,
                                                          String droolsHeader) {

        StringBuilder buf = new StringBuilder();
        AssetItemIterator it = packageItem.listAssetsByFormat(AssetFormats.DRL_MODEL);
        while (it.hasNext()) {
            AssetItem as = it.next();
            buf.append(as.getContent());
            buf.append('\n');
        }

View Full Code Here

                                  DateUtil.isoDate( createdAfter ),
                                  DateUtil.isoDate( createdBefore ) );
        dates[1] = new DateQuery( AssetItem.LAST_MODIFIED_PROPERTY_NAME,
                                  DateUtil.isoDate( modifiedAfter ),
                                  DateUtil.isoDate( modifiedBefore ) );
        AssetItemIterator it = rulesRepository.query( q,
                                                           seekArchived,
                                                           dates );
        // Add Filter to check Permission
        List<AssetItem> resultList = new ArrayList<AssetItem>();

        RepositoryFilter packageFilter = new ModuleFilter( identity );
        RepositoryFilter categoryFilter = new CategoryFilter( identity );

        while ( it.hasNext() ) {
            AssetItem ai = it.next();
            if ( checkPackagePermissionHelper( packageFilter,
                                               ai,
                                               RoleType.PACKAGE_READONLY.getName() ) || checkCategoryPermissionHelper( categoryFilter,
                                                                                                                       ai,
                                                                                                                       RoleType.ANALYST_READ.getName() ) ) {
View Full Code Here

        if ( request.getPageSize() != null && request.getPageSize() < 0 ) {
            throw new IllegalArgumentException( "pageSize cannot be less than zero." );
        }

        long start = System.currentTimeMillis();
        AssetItemIterator iterator = rulesRepository.queryFullText( request.getSearchText(),
                                                                         request.isSearchArchived() );
        log.debug( "Search time: " + (System.currentTimeMillis() - start) );

        List<QueryPageRow> rowList = new QueryFullTextPageRowBuilder()
                                            .withPageRequest( request )
                                            .withIdentity( identity )
                                            .withContent( iterator )
                                                .build();
        boolean bHasMoreRows = iterator.hasNext();
        PageResponse<QueryPageRow> response = new PageResponseBuilder<QueryPageRow>()
                                                      .withStartRowIndex( request.getStartRowIndex() )
                                                      .withPageRowList( rowList )
                                                      .withLastPage( !bHasMoreRows )
                                                          .buildWithTotalRowCount( -1 );
View Full Code Here

TOP

Related Classes of org.drools.repository.AssetItemIterator

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.