Search in sources :

Example 6 with Category

use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.

the class TestSearchEngineManager method createContent_3.

private Content createContent_3() {
    Content content = new Content();
    content.setId("103");
    content.setMainGroup(Group.FREE_GROUP_NAME);
    content.setTypeCode("ART");
    TextAttribute text = new TextAttribute();
    text.setName("Articolo");
    text.setType("Text");
    text.setIndexingType(IndexableAttributeInterface.INDEXING_TYPE_TEXT);
    text.setText("La vita è una cosa meravigliosa", "it");
    text.setText("Life is a wonderful thing", "en");
    content.addAttribute(text);
    Category category = this._categoryManager.getCategory("general_cat1");
    content.addCategory(category);
    return content;
}
Also used : Category(com.agiletec.aps.system.services.category.Category) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) TextAttribute(com.agiletec.aps.system.common.entity.model.attribute.TextAttribute)

Example 7 with Category

use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.

the class TestSearchEngineManager method testSearchFacetedContents_1.

public void testSearchFacetedContents_1() throws Throwable {
    try {
        Thread thread = this._searchEngineManager.startReloadContentsReferences();
        thread.join();
        SearchEngineManager sem = (SearchEngineManager) this._searchEngineManager;
        Category general = this._categoryManager.getCategory("general");
        List<ITreeNode> categories = new ArrayList<ITreeNode>();
        categories.add(general);
        List<String> allowedGroup = new ArrayList<String>();
        allowedGroup.add(Group.FREE_GROUP_NAME);
        allowedGroup.add(Group.ADMINS_GROUP_NAME);
        FacetedContentsResult result = sem.searchFacetedEntities(null, categories, allowedGroup);
        assertNotNull(result);
        String[] expected1 = { "ART122", "ART102", "ART111", "ART120" };
        this.verify(result.getContentsId(), expected1);
        assertEquals(4, result.getOccurrences().size());
    } catch (Throwable t) {
        throw t;
    }
}
Also used : FacetedContentsResult(org.entando.entando.aps.system.services.searchengine.FacetedContentsResult) Category(com.agiletec.aps.system.services.category.Category) ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode) ArrayList(java.util.ArrayList)

Example 8 with Category

use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.

the class TestSearchEngineManager method testSearchContentsId_6.

public void testSearchContentsId_6() throws Throwable {
    try {
        Thread thread = this._searchEngineManager.startReloadContentsReferences();
        thread.join();
        SearchEngineManager sem = (SearchEngineManager) this._searchEngineManager;
        Category general = this._categoryManager.getCategory("general");
        List<ITreeNode> categories = new ArrayList<ITreeNode>();
        categories.add(general);
        List<String> allowedGroup = new ArrayList<String>();
        allowedGroup.add(Group.ADMINS_GROUP_NAME);
        List<String> contentsId = sem.searchEntityId(null, categories, allowedGroup);
        assertNotNull(contentsId);
        String[] expected1 = { "ART122", "ART102", "ART111", "ART120" };
        this.verify(contentsId, expected1);
    } catch (Throwable t) {
        throw t;
    }
}
Also used : Category(com.agiletec.aps.system.services.category.Category) ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode) ArrayList(java.util.ArrayList)

Example 9 with Category

use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.

the class TestSearchEngineManager method createContent_1.

private Content createContent_1() {
    Content content = new Content();
    content.setId("100");
    content.setMainGroup(Group.FREE_GROUP_NAME);
    content.addGroup("secondaryGroup");
    content.setTypeCode("ART");
    TextAttribute text = new TextAttribute();
    text.setName("Articolo");
    text.setType("Text");
    text.setIndexingType(IndexableAttributeInterface.INDEXING_TYPE_TEXT);
    text.setText("San Pietroburgo è una città meravigliosa W3C-WAI", "it");
    text.setText("St. Petersburg is a wonderful city", "en");
    content.addAttribute(text);
    Category category1 = this._categoryManager.getCategory("resCat2");
    Category category2 = this._categoryManager.getCategory("general_cat3");
    content.addCategory(category1);
    content.addCategory(category2);
    return content;
}
Also used : Category(com.agiletec.aps.system.services.category.Category) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) TextAttribute(com.agiletec.aps.system.common.entity.model.attribute.TextAttribute)

Example 10 with Category

use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.

the class TestSearchEngineManager method createContent_2.

private Content createContent_2() {
    Content content = new Content();
    content.setId("101");
    content.setMainGroup(Group.FREE_GROUP_NAME);
    content.addGroup("thirdGroup");
    content.setTypeCode("ART");
    TextAttribute text = new TextAttribute();
    text.setName("Articolo");
    text.setType("Text");
    text.setIndexingType(IndexableAttributeInterface.INDEXING_TYPE_TEXT);
    text.setText("Il turismo ha incrementato più del 20 per cento nel 2011-2013, quando la Croazia ha aderito all'Unione europea. Consegienda di questo aumento è una serie di modernizzazione di alloggi di recente costruzione, tra cui circa tre dozzine di ostelli.", "it");
    text.setText("Tourism had shot up more than 20 percent from 2011 to 2013, when Croatia joined the European Union. Accompanying that rise is a raft of modernized and recently built lodgings, including some three dozen hostels.", "en");
    content.addAttribute(text);
    Category category1 = this._categoryManager.getCategory("resCat1");
    Category category2 = this._categoryManager.getCategory("general_cat2");
    content.addCategory(category1);
    content.addCategory(category2);
    return content;
}
Also used : Category(com.agiletec.aps.system.services.category.Category) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) TextAttribute(com.agiletec.aps.system.common.entity.model.attribute.TextAttribute)

Aggregations

Category (com.agiletec.aps.system.services.category.Category)91 ArrayList (java.util.ArrayList)23 ITreeNode (com.agiletec.aps.system.common.tree.ITreeNode)9 ResourceNotFoundException (org.entando.entando.aps.system.exception.ResourceNotFoundException)7 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)6 TextAttribute (com.agiletec.aps.system.common.entity.model.attribute.TextAttribute)6 List (java.util.List)6 ValidationGenericException (org.entando.entando.web.common.exceptions.ValidationGenericException)6 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)5 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)5 RestServerError (org.entando.entando.aps.system.exception.RestServerError)5 ICategoryManager (com.agiletec.aps.system.services.category.ICategoryManager)4 Lang (com.agiletec.aps.system.services.lang.Lang)4 ResourceInterface (com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface)4 CategoryDto (org.entando.entando.aps.system.services.category.model.CategoryDto)4 IDataObjectSearchEngineManager (org.entando.entando.aps.system.services.dataobjectsearchengine.IDataObjectSearchEngineManager)4 SearchEngineManager (org.entando.entando.aps.system.services.dataobjectsearchengine.SearchEngineManager)4 Cache (org.springframework.cache.Cache)4 CategoryUtilizer (com.agiletec.aps.system.services.category.CategoryUtilizer)3 HashSet (java.util.HashSet)3