Package org.drools.repository

Examples of org.drools.repository.AssetItemIterator


    }

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

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

        List<AdminArchivedPageRow> rowList = new ArchivedAssetPageRowBuilder()
                .withPageRequest(request)
                .withIdentity(identity)
                .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 Assets in " + methodDuration + " ms.");
        return response;
View Full Code Here


            int skip,
            int numRows,
            String tableConfig) {
        long start = System.currentTimeMillis();
        ModuleItem pkg = rulesRepository.loadModuleByUUID(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 = rulesRepository.findAssetsByName(search,
                searchArchived);
        log.debug("Search time: " + (System.currentTimeMillis() - start));

        RepositoryFilter filter = new AssetItemFilter(identity);

        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 ModuleFilter(identity);

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

    protected PageResponse<AssetPageRow> findAssetPage(AssetPageRequest request) {
        log.debug("Finding asset page of packageUuid ("
                + request.getPackageUuid() + ")");
        long start = System.currentTimeMillis();

        AssetItemIterator iterator = getAssetIterator(request);

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

        List<AssetPageRow> rowList = new AssetPageRowBuilder()
                .withPageRequest(request)
                .withIdentity(identity)
                .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.");
View Full Code Here

            search += "%";
        }

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

        // Populate response
        List<QueryPageRow> rowList = new QuickFindPageRowBuilder()
                .withPageRequest(request)
                .withIdentity(identity)
                .withContent(iterator)
                .build();

        PageResponse<QueryPageRow> response = new PageResponseBuilder<QueryPageRow>()
                .withStartRowIndex(request.getStartRowIndex())
                .withPageRowList(rowList)
                .withLastPage(!iterator.hasNext())
                .buildWithTotalRowCount(-1);//its impossible to know the exact count selected until we'v reached
        //the end of iterator

        long methodDuration = System.currentTimeMillis() - start;
        log.debug("Queried repository (Quick Find) for (" + search + ") in " + methodDuration + " ms.");
View Full Code Here

    protected long getAssetCount(AssetPageRequest request) {
        log.debug("Counting assets in packageUuid (" + request.getPackageUuid() + ")");
        long start = System.currentTimeMillis();

        AssetItemIterator iterator = getAssetIterator(request);

        long methodDuration = System.currentTimeMillis() - start;
        log.debug("Counted assets in packageUuid ("
                + request.getPackageUuid() + ") in " + methodDuration + " ms.");
        return iterator.getSize();
    }
View Full Code Here

    }

    private AssetItemIterator getAssetIterator(AssetPageRequest request) {
        ModuleItem packageItem = rulesRepository.loadModuleByUUID(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());
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 String[] listTypesInPackage(String packageUUID) throws SerializationException {
        serviceSecurity.checkSecurityPackageReadOnlyWithPackageUuid(packageUUID);

        ModuleItem pkg = this.rulesRepository.loadModuleByUUID(packageUUID);
        List<String> res = new ArrayList<String>();
        AssetItemIterator it = pkg.listAssetsByFormat(AssetFormats.MODEL,
                AssetFormats.DRL_MODEL);

        JarInputStream jis = null;

        try {
            while (it.hasNext()) {
                AssetItem asset = it.next();
                if (!asset.isArchived()) {
                    if (asset.getFormat().equals(AssetFormats.MODEL)) {
                        jis = typesForModel(res,
                                asset);
                    } else {
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.