Package org.drools.repository

Examples of org.drools.repository.AssetItemIterator


    protected TableDataResult loadArchivedAssets(int skip,
                                                 int numRows) {
        List<TableDataRow> result = new ArrayList<TableDataRow>();
        RepositoryFilter filter = new AssetItemFilter();

        AssetItemIterator it = getRulesRepository().findArchivedAssets();
        it.skip( skip );
        int count = 0;
        while ( it.hasNext() ) {

            AssetItem archived = (AssetItem) it.next();

            if ( filter.accept( archived,
                                "read" ) ) {
                result.add( createArchivedRow( archived ) );
                count++;
View Full Code Here


    }

    protected PageResponse<AdminArchivedPageRow> loadArchivedAssets(PageRequest request) {
        // Do query
        long start = System.currentTimeMillis();
        AssetItemIterator iterator = getRulesRepository().findArchivedAssets();
        log.debug( "Search time: " + (System.currentTimeMillis() - start) );

        // Populate response
        long totalRowsCount = iterator.getSize();

        List<AdminArchivedPageRow> rowList = new ArchivedAssetPageRowBuilder()
                .withPageRequest( request )
                .withContent( iterator )
                .build();

        PageResponse<AdminArchivedPageRow> response = new PageResponseBuilder<AdminArchivedPageRow>()
                .withStartRowIndex( request.getStartRowIndex() )
                .withPageRowList( rowList )
                .withLastPage( !iterator.hasNext() )
                .buildWithTotalRowCount( totalRowsCount );

        long methodDuration = System.currentTimeMillis() - start;
        log.debug( "Searched for Archived Assests in " + methodDuration + " ms." );
        return response;
View Full Code Here

                                         int skip,
                                         int numRows,
                                         String tableConfig) {
        long start = System.currentTimeMillis();
        PackageItem pkg = getRulesRepository().loadPackageByUUID( packageUuid );
        AssetItemIterator it;
        if ( formats.length > 0 ) {
            it = pkg.listAssetsByFormat( formats );
        } else {
            it = pkg.listAssetsNotOfFormat( AssetFormatHelper
                    .listRegisteredTypes() );
View Full Code Here

        }

        List<AssetItem> resultList = new ArrayList<AssetItem>();

        long start = System.currentTimeMillis();
        AssetItemIterator it = getRulesRepository().findAssetsByName( search,
                                                                      searchArchived );
        log.debug( "Search time: " + (System.currentTimeMillis() - start) );

        RepositoryFilter filter = new AssetItemFilter();

        while ( it.hasNext() ) {
            AssetItem ai = it.next();
            if ( filter.accept( ai,
                                RoleType.PACKAGE_READONLY.getName() ) ) {
                resultList.add( ai );
            }
        }
View Full Code Here

                                            int numRows) throws SerializationException {

        List<AssetItem> resultList = new ArrayList<AssetItem>();
        RepositoryFilter filter = new PackageFilter();

        AssetItemIterator assetItemIterator = getRulesRepository().queryFullText( text,
                                                                                  seekArchived );
        while ( assetItemIterator.hasNext() ) {
            AssetItem assetItem = assetItemIterator.next();
            PackageConfigData data = new PackageConfigData();
            data.setUuid( assetItem.getPackage().getUUID() );
            if ( filter.accept( data,
                                RoleType.PACKAGE_READONLY.getName() ) ) {
                resultList.add( assetItem );
View Full Code Here

                   + request.getPackageUuid() + ")" );
        long start = System.currentTimeMillis();

        PackageItem packageItem = getRulesRepository().loadPackageByUUID( request.getPackageUuid() );

        AssetItemIterator iterator;
        if ( request.getFormatInList() != null ) {
            if ( request.getFormatIsRegistered() != null ) {
                throw new IllegalArgumentException( "Combining formatInList and formatIsRegistered is not yet supported." );
            }
            iterator = packageItem.listAssetsByFormat( request.getFormatInList() );

        } else {
            if ( request.getFormatIsRegistered() != null && request.getFormatIsRegistered().equals( Boolean.FALSE ) ) {
                iterator = packageItem.listAssetsNotOfFormat( registeredFormats );
            } else {
                iterator = packageItem.queryAssets( "" );
            }
        }

        // Populate response
        long totalRowsCount = iterator.getSize();

        List<AssetPageRow> rowList = new AssetPageRowBuilder()
                .withPageRequest( request )
                .withContent( iterator )
                .build();

        PageResponse<AssetPageRow> response = new PageResponseBuilder<AssetPageRow>()
                .withStartRowIndex( request.getStartRowIndex() )
                .withPageRowList( rowList )
                .withLastPage( !iterator.hasNext() )
                .buildWithTotalRowCount( totalRowsCount );
        long methodDuration = System.currentTimeMillis() - start;
        log.debug( "Found asset page of packageUuid ("
                   + request.getPackageUuid() + ") in " + methodDuration + " ms." );
        return response;
View Full Code Here

            search += "%";
        }

        // Do query
        long start = System.currentTimeMillis();
        AssetItemIterator iterator = getRulesRepository().findAssetsByName( search,
                                                                            request.isSearchArchived(),
                                                                            request.isCaseSensitive() );
        log.debug( "Search time: " + (System.currentTimeMillis() - start) );

        // Populate response
        long totalRowsCount = iterator.getSize();

        List<QueryPageRow> rowList = new QuickFindPageRowBuilder()
                .withPageRequest( request )
                .withContent( iterator )
                .build();

        PageResponse<QueryPageRow> response = new PageResponseBuilder<QueryPageRow>()
                .withStartRowIndex( request.getStartRowIndex() )
                .withPageRowList( rowList )
                .withLastPage( !iterator.hasNext() )
                .buildWithTotalRowCount( totalRowsCount );

        long methodDuration = System.currentTimeMillis() - start;
        log.debug( "Queried repository (Quick Find) for (" + search + ") in " + methodDuration + " ms." );
        return response;
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 = getRulesRepository().query( q,
                                                           seekArchived,
                                                           dates );
        // Add Filter to check Permission
        List<AssetItem> resultList = new ArrayList<AssetItem>();

        RepositoryFilter packageFilter = new PackageFilter();
        RepositoryFilter categoryFilter = new CategoryFilter();

        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 = getRulesRepository().queryFullText( request.getSearchText(),
                                                                         request.isSearchArchived() );
        log.debug( "Search time: " + (System.currentTimeMillis() - start) );

        long totalRowsCount = iterator.getSize();

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

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

        DateQuery[] dates = createDateQueryForRepository( request );

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

        long totalRowsCount = iterator.getSize();

        List<QueryPageRow> rowList = new QueryMetadataPageRowBuilder()
                                            .withPageRequest( request )
                                            .withContent( iterator )
                                                .build();
        boolean bHasMoreRows = iterator.hasNext();
        PageResponse<QueryPageRow> response = new PageResponseBuilder<QueryPageRow>()
                                                .withStartRowIndex( request.getStartRowIndex() )
                                                .withPageRowList( rowList )
                                                .withLastPage( !bHasMoreRows )
                                                    .buildWithTotalRowCount( totalRowsCount );
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.