Search in sources :

Example 1 with ICmsSearchEngineManager

use of com.agiletec.plugins.jacms.aps.system.services.searchengine.ICmsSearchEngineManager in project entando-core by entando.

the class SearcherTagHelper method executeSearch.

/**
 * Carica una lista di identificativi di contenuto in base ad una ricerca
 * effettuata in funzione ad una parila chiave specificata.
 * @param word La parola con cui effettuare la ricerca.
 * @param reqCtx Il contesto della richiesta.
 * @return La lista di identificativi di contenuto.
 * @throws ApsSystemException
 */
public List<String> executeSearch(String word, RequestContext reqCtx) throws ApsSystemException {
    List<String> result = new ArrayList<String>();
    if (null != word && word.trim().length() > 0) {
        UserDetails currentUser = (UserDetails) reqCtx.getRequest().getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
        ICmsSearchEngineManager searchEngine = (ICmsSearchEngineManager) ApsWebApplicationUtils.getBean(JacmsSystemConstants.SEARCH_ENGINE_MANAGER, reqCtx.getRequest());
        IAuthorizationManager authManager = (IAuthorizationManager) ApsWebApplicationUtils.getBean(SystemConstants.AUTHORIZATION_SERVICE, reqCtx.getRequest());
        List<Group> groups = authManager.getUserGroups(currentUser);
        Set<String> userGroups = new HashSet<String>();
        Iterator<Group> iter = groups.iterator();
        while (iter.hasNext()) {
            Group group = iter.next();
            userGroups.add(group.getName());
        }
        Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
        result = searchEngine.searchEntityId(currentLang.getCode(), word, userGroups);
    }
    return result;
}
Also used : ICmsSearchEngineManager(com.agiletec.plugins.jacms.aps.system.services.searchengine.ICmsSearchEngineManager) IAuthorizationManager(com.agiletec.aps.system.services.authorization.IAuthorizationManager) Group(com.agiletec.aps.system.services.group.Group) UserDetails(com.agiletec.aps.system.services.user.UserDetails) ArrayList(java.util.ArrayList) Lang(com.agiletec.aps.system.services.lang.Lang) HashSet(java.util.HashSet)

Example 2 with ICmsSearchEngineManager

use of com.agiletec.plugins.jacms.aps.system.services.searchengine.ICmsSearchEngineManager in project entando-core by entando.

the class TestApplicationContext method testGetServices.

public void testGetServices() {
    IResourceManager resourceManager = (IResourceManager) this.getService(JacmsSystemConstants.RESOURCE_MANAGER);
    assertNotNull(resourceManager);
    IContentManager contentManager = (IContentManager) this.getService(JacmsSystemConstants.CONTENT_MANAGER);
    assertNotNull(contentManager);
    IContentModelManager contentModelManager = (IContentModelManager) this.getService(JacmsSystemConstants.CONTENT_MODEL_MANAGER);
    assertNotNull(contentModelManager);
    IContentRenderer contentRenderer = (IContentRenderer) this.getService(JacmsSystemConstants.CONTENT_RENDERER_MANAGER);
    assertNotNull(contentRenderer);
    IContentDispenser contentDispenser = (IContentDispenser) this.getService(JacmsSystemConstants.CONTENT_DISPENSER_MANAGER);
    assertNotNull(contentDispenser);
    ICmsSearchEngineManager searchEngineManager = (ICmsSearchEngineManager) this.getService(JacmsSystemConstants.SEARCH_ENGINE_MANAGER);
    assertNotNull(searchEngineManager);
    ILinkResolverManager linkResolver = (ILinkResolverManager) this.getService(JacmsSystemConstants.LINK_RESOLVER_MANAGER);
    assertNotNull(linkResolver);
    IContentPageMapperManager contentPageMapper = (IContentPageMapperManager) this.getService(JacmsSystemConstants.CONTENT_PAGE_MAPPER_MANAGER);
    assertNotNull(contentPageMapper);
}
Also used : IContentDispenser(com.agiletec.plugins.jacms.aps.system.services.dispenser.IContentDispenser) ICmsSearchEngineManager(com.agiletec.plugins.jacms.aps.system.services.searchengine.ICmsSearchEngineManager) IContentRenderer(com.agiletec.plugins.jacms.aps.system.services.renderer.IContentRenderer) IContentManager(com.agiletec.plugins.jacms.aps.system.services.content.IContentManager) IResourceManager(com.agiletec.plugins.jacms.aps.system.services.resource.IResourceManager) ILinkResolverManager(com.agiletec.plugins.jacms.aps.system.services.linkresolver.ILinkResolverManager) IContentPageMapperManager(com.agiletec.plugins.jacms.aps.system.services.contentpagemapper.IContentPageMapperManager) IContentModelManager(com.agiletec.plugins.jacms.aps.system.services.contentmodel.IContentModelManager)

Example 3 with ICmsSearchEngineManager

use of com.agiletec.plugins.jacms.aps.system.services.searchengine.ICmsSearchEngineManager in project entando-core by entando.

the class TestCmsApplicationContext method testGetCmsServices.

public void testGetCmsServices() throws Throwable {
    try {
        IResourceManager resourceManager = (IResourceManager) this.getService(JacmsSystemConstants.RESOURCE_MANAGER);
        assertNotNull(resourceManager);
        IContentManager contentManager = (IContentManager) this.getService(JacmsSystemConstants.CONTENT_MANAGER);
        assertNotNull(contentManager);
        ICategoryManager categoryManager = (ICategoryManager) this.getService(SystemConstants.CATEGORY_MANAGER);
        assertNotNull(categoryManager);
        IContentModelManager contentModelManager = (IContentModelManager) this.getService(JacmsSystemConstants.CONTENT_MODEL_MANAGER);
        assertNotNull(contentModelManager);
        IContentRenderer contentRenderer = (IContentRenderer) this.getService(JacmsSystemConstants.CONTENT_RENDERER_MANAGER);
        assertNotNull(contentRenderer);
        IContentDispenser contentDispenser = (IContentDispenser) this.getService(JacmsSystemConstants.CONTENT_DISPENSER_MANAGER);
        assertNotNull(contentDispenser);
        ICmsSearchEngineManager searchEngineManager = (ICmsSearchEngineManager) this.getService(JacmsSystemConstants.SEARCH_ENGINE_MANAGER);
        assertNotNull(searchEngineManager);
        ILinkResolverManager linkResolver = (ILinkResolverManager) this.getService(JacmsSystemConstants.LINK_RESOLVER_MANAGER);
        assertNotNull(linkResolver);
        IContentPageMapperManager contentPageMapper = (IContentPageMapperManager) this.getService(JacmsSystemConstants.CONTENT_PAGE_MAPPER_MANAGER);
        assertNotNull(contentPageMapper);
    } catch (Throwable t) {
        throw t;
    }
}
Also used : IContentDispenser(com.agiletec.plugins.jacms.aps.system.services.dispenser.IContentDispenser) ICmsSearchEngineManager(com.agiletec.plugins.jacms.aps.system.services.searchengine.ICmsSearchEngineManager) IContentRenderer(com.agiletec.plugins.jacms.aps.system.services.renderer.IContentRenderer) IContentManager(com.agiletec.plugins.jacms.aps.system.services.content.IContentManager) IResourceManager(com.agiletec.plugins.jacms.aps.system.services.resource.IResourceManager) ILinkResolverManager(com.agiletec.plugins.jacms.aps.system.services.linkresolver.ILinkResolverManager) IContentPageMapperManager(com.agiletec.plugins.jacms.aps.system.services.contentpagemapper.IContentPageMapperManager) ICategoryManager(com.agiletec.aps.system.services.category.ICategoryManager) IContentModelManager(com.agiletec.plugins.jacms.aps.system.services.contentmodel.IContentModelManager)

Aggregations

ICmsSearchEngineManager (com.agiletec.plugins.jacms.aps.system.services.searchengine.ICmsSearchEngineManager)3 IContentManager (com.agiletec.plugins.jacms.aps.system.services.content.IContentManager)2 IContentModelManager (com.agiletec.plugins.jacms.aps.system.services.contentmodel.IContentModelManager)2 IContentPageMapperManager (com.agiletec.plugins.jacms.aps.system.services.contentpagemapper.IContentPageMapperManager)2 IContentDispenser (com.agiletec.plugins.jacms.aps.system.services.dispenser.IContentDispenser)2 ILinkResolverManager (com.agiletec.plugins.jacms.aps.system.services.linkresolver.ILinkResolverManager)2 IContentRenderer (com.agiletec.plugins.jacms.aps.system.services.renderer.IContentRenderer)2 IResourceManager (com.agiletec.plugins.jacms.aps.system.services.resource.IResourceManager)2 IAuthorizationManager (com.agiletec.aps.system.services.authorization.IAuthorizationManager)1 ICategoryManager (com.agiletec.aps.system.services.category.ICategoryManager)1 Group (com.agiletec.aps.system.services.group.Group)1 Lang (com.agiletec.aps.system.services.lang.Lang)1 UserDetails (com.agiletec.aps.system.services.user.UserDetails)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1