Search in sources :

Example 1 with SolrClient

use of org.wso2.carbon.registry.indexing.solr.SolrClient in project carbon-apimgt by wso2.

the class RegistryPersistenceImpl method searchPaginatedPublisherAPIsByDoc.

private PublisherAPISearchResult searchPaginatedPublisherAPIsByDoc(Registry registry, int tenantID, String searchQuery, String username, int start, int offset) throws APIPersistenceException {
    PublisherAPISearchResult searchResults = new PublisherAPISearchResult();
    try {
        GenericArtifactManager artifactManager = RegistryPersistenceUtil.getArtifactManager(registry, APIConstants.API_KEY);
        if (artifactManager == null) {
            String errorMessage = "Artifact manager is null when searching APIs by docs in tenant ID " + tenantID;
            log.error(errorMessage);
            throw new APIPersistenceException(errorMessage);
        }
        GenericArtifactManager docArtifactManager = RegistryPersistenceUtil.getArtifactManager(registry, APIConstants.DOCUMENTATION_KEY);
        if (docArtifactManager == null) {
            String errorMessage = "Doc artifact manager is null when searching APIs by docs in tenant ID " + tenantID;
            log.error(errorMessage);
            throw new APIPersistenceException(errorMessage);
        }
        SolrClient client = SolrClient.getInstance();
        Map<String, String> fields = new HashMap<String, String>();
        fields.put(APIConstants.DOCUMENTATION_SEARCH_PATH_FIELD, "*" + APIConstants.API_ROOT_LOCATION + "*");
        fields.put(APIConstants.DOCUMENTATION_SEARCH_MEDIA_TYPE_FIELD, "*");
        if (tenantID == -1) {
            tenantID = MultitenantConstants.SUPER_TENANT_ID;
        }
        // PaginationContext.init(0, 10000, "ASC", APIConstants.DOCUMENTATION_SEARCH_PATH_FIELD, Integer.MAX_VALUE);
        SolrDocumentList documentList = client.query(searchQuery, tenantID, fields);
        org.wso2.carbon.user.api.AuthorizationManager manager = ServiceReferenceHolder.getInstance().getRealmService().getTenantUserRealm(tenantID).getAuthorizationManager();
        username = MultitenantUtils.getTenantAwareUsername(username);
        List<PublisherAPIInfo> publisherAPIInfoList = new ArrayList<PublisherAPIInfo>();
        for (SolrDocument document : documentList) {
            PublisherAPIInfo apiInfo = new PublisherAPIInfo();
            String filePath = (String) document.getFieldValue("path_s");
            String fileName = (String) document.getFieldValue("resourceName_s");
            int index = filePath.indexOf(APIConstants.APIMGT_REGISTRY_LOCATION);
            filePath = filePath.substring(index);
            boolean isAuthorized;
            int indexOfContents = filePath.indexOf(APIConstants.INLINE_DOCUMENT_CONTENT_DIR);
            String documentationPath = filePath.substring(0, indexOfContents) + fileName;
            String path = RegistryUtils.getAbsolutePath(RegistryContext.getBaseInstance(), RegistryPersistenceUtil.getMountedPath(RegistryContext.getBaseInstance(), RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH) + documentationPath);
            if (CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME.equalsIgnoreCase(username)) {
                isAuthorized = manager.isRoleAuthorized(APIConstants.ANONYMOUS_ROLE, path, ActionConstants.GET);
            } else {
                isAuthorized = manager.isUserAuthorized(username, path, ActionConstants.GET);
            }
            if (isAuthorized) {
                int indexOfDocumentation = filePath.indexOf(APIConstants.DOCUMENTATION_KEY);
                String apiPath = documentationPath.substring(0, indexOfDocumentation) + APIConstants.API_KEY;
                path = RegistryUtils.getAbsolutePath(RegistryContext.getBaseInstance(), RegistryPersistenceUtil.getMountedPath(RegistryContext.getBaseInstance(), RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH) + apiPath);
                if (CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME.equalsIgnoreCase(username)) {
                    isAuthorized = manager.isRoleAuthorized(APIConstants.ANONYMOUS_ROLE, path, ActionConstants.GET);
                } else {
                    isAuthorized = manager.isUserAuthorized(username, path, ActionConstants.GET);
                }
                if (isAuthorized) {
                    Resource resource = registry.get(apiPath);
                    String apiArtifactId = resource.getUUID();
                    if (apiArtifactId != null) {
                        GenericArtifact artifact = artifactManager.getGenericArtifact(apiArtifactId);
                        String status = artifact.getAttribute(APIConstants.API_OVERVIEW_STATUS);
                        if (APIConstants.PUBLISHED.equals(status) || APIConstants.PROTOTYPED.equals(status)) {
                            apiInfo.setType(artifact.getAttribute(APIConstants.API_OVERVIEW_TYPE));
                            apiInfo.setId(artifact.getId());
                            apiInfo.setApiName(artifact.getAttribute(APIConstants.API_OVERVIEW_NAME));
                            apiInfo.setDescription(artifact.getAttribute(APIConstants.API_OVERVIEW_DESCRIPTION));
                            apiInfo.setContext(artifact.getAttribute(APIConstants.API_OVERVIEW_CONTEXT_TEMPLATE));
                            apiInfo.setProviderName(artifact.getAttribute(APIConstants.API_OVERVIEW_PROVIDER));
                            apiInfo.setStatus(status);
                            apiInfo.setThumbnail(artifact.getAttribute(APIConstants.API_OVERVIEW_THUMBNAIL_URL));
                            apiInfo.setCreatedTime(String.valueOf(resource.getCreatedTime().getTime()));
                            apiInfo.setUpdatedTime(resource.getLastModified());
                            apiInfo.setGatewayVendor(String.valueOf(artifact.getAttribute(APIConstants.API_GATEWAY_VENDOR)));
                            // apiInfo.setBusinessOwner(artifact.getAttribute(APIConstants.API_OVERVIEW_BUSS_OWNER));
                            apiInfo.setVersion(artifact.getAttribute(APIConstants.API_OVERVIEW_VERSION));
                            apiInfo.setAdvertiseOnly(Boolean.parseBoolean(artifact.getAttribute(APIConstants.API_OVERVIEW_ADVERTISE_ONLY)));
                            publisherAPIInfoList.add(apiInfo);
                        }
                    } else {
                        throw new GovernanceException("artifact id is null of " + apiPath);
                    }
                }
            }
        }
        // Sort the publisherAPIInfoList according to the API name.
        Collections.sort(publisherAPIInfoList, new PublisherAPISearchResultComparator());
        searchResults.setPublisherAPIInfoList(publisherAPIInfoList);
        searchResults.setTotalAPIsCount(publisherAPIInfoList.size());
        searchResults.setReturnedAPIsCount(publisherAPIInfoList.size());
    } catch (RegistryException | UserStoreException | APIPersistenceException | IndexerException e) {
        String msg = "Failed to search APIs with type";
        throw new APIPersistenceException(msg, e);
    } finally {
        PaginationContext.destroy();
    }
    return searchResults;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SolrDocument(org.apache.solr.common.SolrDocument) SolrClient(org.wso2.carbon.registry.indexing.solr.SolrClient) UserStoreException(org.wso2.carbon.user.api.UserStoreException) IndexerException(org.wso2.carbon.registry.indexing.indexer.IndexerException) GenericArtifact(org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact) APIPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.APIPersistenceException) GenericArtifactManager(org.wso2.carbon.governance.api.generic.GenericArtifactManager) Resource(org.wso2.carbon.registry.core.Resource) GovernanceException(org.wso2.carbon.governance.api.exception.GovernanceException) SolrDocumentList(org.apache.solr.common.SolrDocumentList) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) PublisherAPIInfo(org.wso2.carbon.apimgt.persistence.dto.PublisherAPIInfo) PublisherAPISearchResult(org.wso2.carbon.apimgt.persistence.dto.PublisherAPISearchResult) PublisherAPISearchResultComparator(org.wso2.carbon.apimgt.persistence.utils.PublisherAPISearchResultComparator)

Example 2 with SolrClient

use of org.wso2.carbon.registry.indexing.solr.SolrClient in project carbon-apimgt by wso2.

the class RegistryPersistenceImpl method searchPaginatedDevPortalAPIsByDoc.

private DevPortalAPISearchResult searchPaginatedDevPortalAPIsByDoc(Registry registry, int tenantID, String searchQuery, String username, int start, int offset) throws APIPersistenceException {
    DevPortalAPISearchResult searchResults = new DevPortalAPISearchResult();
    try {
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(username);
        GenericArtifactManager artifactManager = RegistryPersistenceUtil.getArtifactManager(registry, APIConstants.API_KEY);
        if (artifactManager == null) {
            String errorMessage = "Artifact manager is null when searching APIs by docs in tenant ID " + tenantID;
            log.error(errorMessage);
            throw new APIPersistenceException(errorMessage);
        }
        GenericArtifactManager docArtifactManager = RegistryPersistenceUtil.getArtifactManager(registry, APIConstants.DOCUMENTATION_KEY);
        if (docArtifactManager == null) {
            String errorMessage = "Doc artifact manager is null when searching APIs by docs in tenant ID " + tenantID;
            log.error(errorMessage);
            throw new APIPersistenceException(errorMessage);
        }
        SolrClient client = SolrClient.getInstance();
        Map<String, String> fields = new HashMap<String, String>();
        fields.put(APIConstants.DOCUMENTATION_SEARCH_PATH_FIELD, "*" + APIConstants.API_ROOT_LOCATION + "*");
        fields.put(APIConstants.DOCUMENTATION_SEARCH_MEDIA_TYPE_FIELD, "*");
        if (tenantID == -1) {
            tenantID = MultitenantConstants.SUPER_TENANT_ID;
        }
        // PaginationContext.init(0, 10000, "ASC", APIConstants.DOCUMENTATION_SEARCH_PATH_FIELD, Integer.MAX_VALUE);
        SolrDocumentList documentList = client.query(searchQuery, tenantID, fields);
        org.wso2.carbon.user.api.AuthorizationManager manager = ServiceReferenceHolder.getInstance().getRealmService().getTenantUserRealm(tenantID).getAuthorizationManager();
        username = MultitenantUtils.getTenantAwareUsername(username);
        List<DevPortalAPIInfo> devPortalAPIInfoList = new ArrayList<DevPortalAPIInfo>();
        for (SolrDocument document : documentList) {
            DevPortalAPIInfo apiInfo = new DevPortalAPIInfo();
            String filePath = (String) document.getFieldValue("path_s");
            String fileName = (String) document.getFieldValue("resourceName_s");
            int index = filePath.indexOf(APIConstants.APIMGT_REGISTRY_LOCATION);
            filePath = filePath.substring(index);
            boolean isAuthorized;
            int indexOfContents = filePath.indexOf(APIConstants.INLINE_DOCUMENT_CONTENT_DIR);
            String documentationPath = filePath.substring(0, indexOfContents) + fileName;
            String path = RegistryUtils.getAbsolutePath(RegistryContext.getBaseInstance(), RegistryPersistenceUtil.getMountedPath(RegistryContext.getBaseInstance(), RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH) + documentationPath);
            if (CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME.equalsIgnoreCase(username)) {
                isAuthorized = manager.isRoleAuthorized(APIConstants.ANONYMOUS_ROLE, path, ActionConstants.GET);
            } else {
                isAuthorized = manager.isUserAuthorized(username, path, ActionConstants.GET);
            }
            if (isAuthorized) {
                int indexOfDocumentation = filePath.indexOf(APIConstants.DOCUMENTATION_KEY);
                String apiPath = documentationPath.substring(0, indexOfDocumentation) + APIConstants.API_KEY;
                path = RegistryUtils.getAbsolutePath(RegistryContext.getBaseInstance(), RegistryPersistenceUtil.getMountedPath(RegistryContext.getBaseInstance(), RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH) + apiPath);
                if (CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME.equalsIgnoreCase(username)) {
                    isAuthorized = manager.isRoleAuthorized(APIConstants.ANONYMOUS_ROLE, path, ActionConstants.GET);
                } else {
                    isAuthorized = manager.isUserAuthorized(username, path, ActionConstants.GET);
                }
                if (isAuthorized) {
                    Resource resource = registry.get(apiPath);
                    String apiArtifactId = resource.getUUID();
                    if (apiArtifactId != null) {
                        GenericArtifact artifact = artifactManager.getGenericArtifact(apiArtifactId);
                        String status = artifact.getAttribute(APIConstants.API_OVERVIEW_STATUS);
                        if (APIConstants.PUBLISHED.equals(status) || APIConstants.PROTOTYPED.equals(status)) {
                            apiInfo.setType(artifact.getAttribute(APIConstants.API_OVERVIEW_TYPE));
                            apiInfo.setId(artifact.getId());
                            apiInfo.setApiName(artifact.getAttribute(APIConstants.API_OVERVIEW_NAME));
                            apiInfo.setDescription(artifact.getAttribute(APIConstants.API_OVERVIEW_DESCRIPTION));
                            apiInfo.setContext(artifact.getAttribute(APIConstants.API_OVERVIEW_CONTEXT_TEMPLATE));
                            apiInfo.setProviderName(artifact.getAttribute(APIConstants.API_OVERVIEW_PROVIDER));
                            apiInfo.setStatus(status);
                            apiInfo.setThumbnail(artifact.getAttribute(APIConstants.API_OVERVIEW_THUMBNAIL_URL));
                            apiInfo.setBusinessOwner(artifact.getAttribute(APIConstants.API_OVERVIEW_BUSS_OWNER));
                            apiInfo.setVersion(artifact.getAttribute(APIConstants.API_OVERVIEW_VERSION));
                            apiInfo.setSubscriptionAvailability(artifact.getAttribute(APIConstants.API_OVERVIEW_SUBSCRIPTION_AVAILABILITY));
                            apiInfo.setSubscriptionAvailableOrgs(artifact.getAttribute(APIConstants.API_OVERVIEW_SUBSCRIPTION_AVAILABLE_TENANTS));
                            apiInfo.setGatewayVendor(artifact.getAttribute(APIConstants.API_GATEWAY_VENDOR));
                            devPortalAPIInfoList.add(apiInfo);
                        }
                    } else {
                        throw new GovernanceException("artifact id is null of " + apiPath);
                    }
                }
            }
        }
        searchResults.setDevPortalAPIInfoList(devPortalAPIInfoList);
        searchResults.setTotalAPIsCount(devPortalAPIInfoList.size());
        searchResults.setReturnedAPIsCount(devPortalAPIInfoList.size());
    } catch (RegistryException | UserStoreException | APIPersistenceException | IndexerException e) {
        String msg = "Failed to search APIs with type";
        throw new APIPersistenceException(msg, e);
    } finally {
        PaginationContext.destroy();
    }
    return searchResults;
}
Also used : HashMap(java.util.HashMap) DevPortalAPIInfo(org.wso2.carbon.apimgt.persistence.dto.DevPortalAPIInfo) ArrayList(java.util.ArrayList) SolrDocument(org.apache.solr.common.SolrDocument) DevPortalAPISearchResult(org.wso2.carbon.apimgt.persistence.dto.DevPortalAPISearchResult) SolrClient(org.wso2.carbon.registry.indexing.solr.SolrClient) UserStoreException(org.wso2.carbon.user.api.UserStoreException) IndexerException(org.wso2.carbon.registry.indexing.indexer.IndexerException) GenericArtifact(org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact) APIPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.APIPersistenceException) GenericArtifactManager(org.wso2.carbon.governance.api.generic.GenericArtifactManager) Resource(org.wso2.carbon.registry.core.Resource) GovernanceException(org.wso2.carbon.governance.api.exception.GovernanceException) SolrDocumentList(org.apache.solr.common.SolrDocumentList) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException)

Example 3 with SolrClient

use of org.wso2.carbon.registry.indexing.solr.SolrClient in project carbon-apimgt by wso2.

the class APIUtil method searchAPIsByDoc.

/**
 * Search Apis by Doc Content
 *
 * @param registry     - Registry which is searched
 * @param tenantID     - Tenant id of logged in domain
 * @param username     - Logged in username
 * @param searchTerm   - Search value for doc
 * @param searchClient - Search client
 * @return - Documentation to APIs map
 * @throws APIManagementException - If failed to get ArtifactManager for given tenant
 */
public static Map<Documentation, API> searchAPIsByDoc(Registry registry, int tenantID, String username, String searchTerm, String searchClient) throws APIManagementException {
    Map<Documentation, API> apiDocMap = new HashMap<Documentation, API>();
    try {
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(username);
        GenericArtifactManager artifactManager = APIUtil.getArtifactManager(registry, APIConstants.API_KEY);
        if (artifactManager == null) {
            String errorMessage = "Artifact manager is null when searching APIs by docs in tenant ID " + tenantID;
            log.error(errorMessage);
            throw new APIManagementException(errorMessage);
        }
        GenericArtifactManager docArtifactManager = APIUtil.getArtifactManager(registry, APIConstants.DOCUMENTATION_KEY);
        if (docArtifactManager == null) {
            String errorMessage = "Doc artifact manager is null when searching APIs by docs in tenant ID " + tenantID;
            log.error(errorMessage);
            throw new APIManagementException(errorMessage);
        }
        SolrClient client = SolrClient.getInstance();
        Map<String, String> fields = new HashMap<String, String>();
        fields.put(APIConstants.DOCUMENTATION_SEARCH_PATH_FIELD, "*" + APIConstants.API_ROOT_LOCATION + "*");
        fields.put(APIConstants.DOCUMENTATION_SEARCH_MEDIA_TYPE_FIELD, "*");
        if (tenantID == -1) {
            tenantID = MultitenantConstants.SUPER_TENANT_ID;
        }
        // PaginationContext.init(0, 10000, "ASC", APIConstants.DOCUMENTATION_SEARCH_PATH_FIELD, Integer.MAX_VALUE);
        SolrDocumentList documentList = client.query(searchTerm, tenantID, fields);
        org.wso2.carbon.user.api.AuthorizationManager manager = ServiceReferenceHolder.getInstance().getRealmService().getTenantUserRealm(tenantID).getAuthorizationManager();
        username = MultitenantUtils.getTenantAwareUsername(username);
        for (SolrDocument document : documentList) {
            String filePath = (String) document.getFieldValue("path_s");
            String fileName = (String) document.getFieldValue("resourceName_s");
            int index = filePath.indexOf(APIConstants.APIMGT_REGISTRY_LOCATION);
            filePath = filePath.substring(index);
            API api = null;
            Documentation doc = null;
            boolean isAuthorized;
            int indexOfContents = filePath.indexOf(APIConstants.INLINE_DOCUMENT_CONTENT_DIR);
            String documentationPath = filePath.substring(0, indexOfContents) + fileName;
            String path = RegistryUtils.getAbsolutePath(RegistryContext.getBaseInstance(), APIUtil.getMountedPath(RegistryContext.getBaseInstance(), RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH) + documentationPath);
            if (CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME.equalsIgnoreCase(username)) {
                isAuthorized = manager.isRoleAuthorized(APIConstants.ANONYMOUS_ROLE, path, ActionConstants.GET);
            } else {
                isAuthorized = manager.isUserAuthorized(username, path, ActionConstants.GET);
            }
            if (isAuthorized) {
                Resource docResource = registry.get(documentationPath);
                String docArtifactId = docResource.getUUID();
                if (docArtifactId != null) {
                    GenericArtifact docArtifact = docArtifactManager.getGenericArtifact(docArtifactId);
                    doc = APIUtil.getDocumentation(docArtifact);
                }
                int indexOfDocumentation = filePath.indexOf(APIConstants.DOCUMENTATION_KEY);
                String apiPath = documentationPath.substring(0, indexOfDocumentation) + APIConstants.API_KEY;
                path = RegistryUtils.getAbsolutePath(RegistryContext.getBaseInstance(), APIUtil.getMountedPath(RegistryContext.getBaseInstance(), RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH) + apiPath);
                if (CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME.equalsIgnoreCase(username)) {
                    isAuthorized = manager.isRoleAuthorized(APIConstants.ANONYMOUS_ROLE, path, ActionConstants.GET);
                } else {
                    isAuthorized = manager.isUserAuthorized(username, path, ActionConstants.GET);
                }
                if (isAuthorized) {
                    Resource resource = registry.get(apiPath);
                    String apiArtifactId = resource.getUUID();
                    if (apiArtifactId != null) {
                        GenericArtifact apiArtifact = artifactManager.getGenericArtifact(apiArtifactId);
                        api = APIUtil.getAPI(apiArtifact, registry);
                    } else {
                        throw new GovernanceException("artifact id is null of " + apiPath);
                    }
                }
            }
            if (doc != null && api != null) {
                if (APIConstants.STORE_CLIENT.equals(searchClient)) {
                    if (APIConstants.PUBLISHED.equals(api.getStatus()) || APIConstants.PROTOTYPED.equals(api.getStatus())) {
                        apiDocMap.put(doc, api);
                    }
                } else {
                    apiDocMap.put(doc, api);
                }
            }
        }
    } catch (IndexerException e) {
        handleException("Failed to search APIs with type Doc", e);
    } catch (RegistryException e) {
        handleException("Failed to search APIs with type Doc", e);
    } catch (UserStoreException e) {
        handleException("Failed to search APIs with type Doc", e);
    }
    return apiDocMap;
}
Also used : GenericArtifact(org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact) GenericArtifactManager(org.wso2.carbon.governance.api.generic.GenericArtifactManager) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) Documentation(org.wso2.carbon.apimgt.api.model.Documentation) Resource(org.wso2.carbon.registry.core.Resource) APIProductResource(org.wso2.carbon.apimgt.api.model.APIProductResource) APIResource(org.wso2.carbon.apimgt.api.doc.model.APIResource) GovernanceException(org.wso2.carbon.governance.api.exception.GovernanceException) SolrDocumentList(org.apache.solr.common.SolrDocumentList) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) Endpoint(org.wso2.carbon.governance.api.endpoints.dataobjects.Endpoint) SolrDocument(org.apache.solr.common.SolrDocument) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) SolrClient(org.wso2.carbon.registry.indexing.solr.SolrClient) UserStoreException(org.wso2.carbon.user.api.UserStoreException) API(org.wso2.carbon.apimgt.api.model.API) IndexerException(org.wso2.carbon.registry.indexing.indexer.IndexerException)

Example 4 with SolrClient

use of org.wso2.carbon.registry.indexing.solr.SolrClient in project jaggery by wso2.

the class RegistryHostObject method search.

private ResourceData[] search(UserRegistry registry, String searchQuery) throws IndexerException, RegistryException {
    SolrClient client = SolrClient.getInstance();
    SolrDocumentList results = client.query(searchQuery, registry.getTenantId());
    if (log.isDebugEnabled())
        log.debug("result received " + results);
    List<ResourceData> filteredResults = new ArrayList<ResourceData>();
    for (int i = 0; i < results.getNumFound(); i++) {
        SolrDocument solrDocument = results.get(i);
        String path = getPathFromId((String) solrDocument.getFirstValue("id"));
        // if (AuthorizationUtils.authorize(path, ActionConstants.GET)){
        if ((registry.resourceExists(path)) && (isAuthorized(registry, path, ActionConstants.GET))) {
            filteredResults.add(loadResourceByPath(registry, path));
        }
    }
    if (log.isDebugEnabled()) {
        log.debug("filtered results " + filteredResults + " for user " + registry.getUserName());
    }
    return filteredResults.toArray(new ResourceData[0]);
}
Also used : ResourceData(org.wso2.carbon.registry.common.ResourceData) SolrDocument(org.apache.solr.common.SolrDocument) SolrClient(org.wso2.carbon.registry.indexing.solr.SolrClient) SolrDocumentList(org.apache.solr.common.SolrDocumentList)

Aggregations

SolrDocument (org.apache.solr.common.SolrDocument)4 SolrDocumentList (org.apache.solr.common.SolrDocumentList)4 SolrClient (org.wso2.carbon.registry.indexing.solr.SolrClient)4 HashMap (java.util.HashMap)3 GovernanceException (org.wso2.carbon.governance.api.exception.GovernanceException)3 GenericArtifactManager (org.wso2.carbon.governance.api.generic.GenericArtifactManager)3 GenericArtifact (org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact)3 Resource (org.wso2.carbon.registry.core.Resource)3 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)3 IndexerException (org.wso2.carbon.registry.indexing.indexer.IndexerException)3 UserStoreException (org.wso2.carbon.user.api.UserStoreException)3 ArrayList (java.util.ArrayList)2 APIPersistenceException (org.wso2.carbon.apimgt.persistence.exceptions.APIPersistenceException)2 LinkedHashMap (java.util.LinkedHashMap)1 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)1 APIResource (org.wso2.carbon.apimgt.api.doc.model.APIResource)1 API (org.wso2.carbon.apimgt.api.model.API)1 APIProductResource (org.wso2.carbon.apimgt.api.model.APIProductResource)1 Documentation (org.wso2.carbon.apimgt.api.model.Documentation)1 DevPortalAPIInfo (org.wso2.carbon.apimgt.persistence.dto.DevPortalAPIInfo)1