Search in sources :

Example 11 with Content

use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.

the class TestSearchEngineManager method testSearchContentsId_1.

public void testSearchContentsId_1() throws Throwable {
    try {
        Content content_1 = this.createContent_1();
        this._searchEngineManager.deleteIndexedEntity(content_1.getId());
        this._searchEngineManager.addEntityToIndex(content_1);
        Content content_2 = this.createContent_2();
        this._searchEngineManager.deleteIndexedEntity(content_2.getId());
        this._searchEngineManager.addEntityToIndex(content_2);
        List<String> contentsId = this._searchEngineManager.searchEntityId("it", "San meravigliosa", null);
        assertNotNull(contentsId);
        assertTrue(contentsId.contains(content_1.getId()));
        contentsId = this._searchEngineManager.searchEntityId("en", "Petersburg wonderful", null);
        assertNotNull(contentsId);
        assertTrue(contentsId.contains(content_1.getId()));
        contentsId = this._searchEngineManager.searchEntityId("en", "meravigliosa", null);
        assertNotNull(contentsId);
        assertFalse(contentsId.contains(content_1.getId()));
    } catch (Throwable t) {
        throw t;
    }
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content)

Example 12 with Content

use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.

the class TestSearchEngineManager method testSearchContentsId_7.

public void testSearchContentsId_7() throws Throwable {
    try {
        Content content_1 = this.createContent_1();
        this._searchEngineManager.deleteIndexedEntity(content_1.getId());
        this._searchEngineManager.addEntityToIndex(content_1);
        Content content_2 = this.createContent_2();
        this._searchEngineManager.deleteIndexedEntity(content_2.getId());
        this._searchEngineManager.addEntityToIndex(content_2);
        Content content_3 = this.createContent_3();
        this._searchEngineManager.deleteIndexedEntity(content_3.getId());
        this._searchEngineManager.addEntityToIndex(content_3);
        // San Pietroburgo è una città meravigliosa W3C-WAI
        // 100
        // 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.
        // 101
        // La vita è una cosa meravigliosa
        // 103
        SearchEngineManager sem = (SearchEngineManager) this._searchEngineManager;
        List<String> allowedGroup = new ArrayList<String>();
        allowedGroup.add(Group.FREE_GROUP_NAME);
        SearchEngineFilter filter1 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.ALL_WORDS);
        SearchEngineFilter[] filters1 = { filter1 };
        List<String> contentsId = sem.searchEntityId(filters1, null, allowedGroup);
        assertNotNull(contentsId);
        assertEquals(1, contentsId.size());
        assertTrue(contentsId.contains(content_1.getId()));
        SearchEngineFilter filter2 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.AT_LEAST_ONE_WORD);
        SearchEngineFilter[] filters2 = { filter2 };
        contentsId = sem.searchEntityId(filters2, null, allowedGroup);
        assertNotNull(contentsId);
        assertEquals(2, contentsId.size());
        assertTrue(contentsId.contains(content_1.getId()));
        assertTrue(contentsId.contains(content_3.getId()));
        SearchEngineFilter filter3 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.EXACT);
        SearchEngineFilter[] filters3 = { filter3 };
        contentsId = sem.searchEntityId(filters3, null, allowedGroup);
        assertNotNull(contentsId);
        assertEquals(0, contentsId.size());
        SearchEngineFilter filter4 = new SearchEngineFilter("it", "una cosa meravigliosa", SearchEngineFilter.TextSearchOption.EXACT);
        SearchEngineFilter[] filters4 = { filter4 };
        contentsId = sem.searchEntityId(filters4, null, allowedGroup);
        assertNotNull(contentsId);
        assertEquals(1, contentsId.size());
        assertTrue(contentsId.contains(content_3.getId()));
    } catch (Throwable t) {
        throw t;
    }
}
Also used : SearchEngineFilter(org.entando.entando.aps.system.services.searchengine.SearchEngineFilter) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ArrayList(java.util.ArrayList)

Example 13 with Content

use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content 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 14 with Content

use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content 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)

Example 15 with Content

use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.

the class ContentManagerTest method createFakeEntity.

private IApsEntity createFakeEntity(String typeCode, String viewPage, String defaultModel) {
    Content content = new Content();
    content.setTypeCode(typeCode);
    content.setViewPage(viewPage);
    content.setDefaultModel(defaultModel);
    return content;
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content)

Aggregations

Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)227 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)55 AttributeTracer (com.agiletec.aps.system.common.entity.model.AttributeTracer)35 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)29 ArrayList (java.util.ArrayList)26 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)17 ActionSupport (com.opensymphony.xwork2.ActionSupport)14 List (java.util.List)14 CompositeAttribute (com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute)13 HttpSession (javax.servlet.http.HttpSession)13 UserDetails (com.agiletec.aps.system.services.user.UserDetails)12 IPage (com.agiletec.aps.system.services.page.IPage)10 Date (java.util.Date)8 EntitySearchFilter (com.agiletec.aps.system.common.entity.model.EntitySearchFilter)7 ITextAttribute (com.agiletec.aps.system.common.entity.model.attribute.ITextAttribute)7 LinkAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute)7 ResourceInterface (com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface)7 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)7 ListAttribute (com.agiletec.aps.system.common.entity.model.attribute.ListAttribute)6 TextAttribute (com.agiletec.aps.system.common.entity.model.attribute.TextAttribute)6