Search in sources :

Example 1 with TextAttribute

use of com.agiletec.aps.system.common.entity.model.attribute.TextAttribute 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 2 with TextAttribute

use of com.agiletec.aps.system.common.entity.model.attribute.TextAttribute 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 3 with TextAttribute

use of com.agiletec.aps.system.common.entity.model.attribute.TextAttribute 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 4 with TextAttribute

use of com.agiletec.aps.system.common.entity.model.attribute.TextAttribute in project entando-core by entando.

the class TestDataObjectManager method testLoadDataObject.

public void testLoadDataObject() throws Throwable {
    DataObject dataObject = this._dataObjectManager.loadDataObject("ART111", false);
    assertEquals(DataObject.STATUS_PUBLIC, dataObject.getStatus());
    assertEquals("coach", dataObject.getMainGroup());
    assertEquals(2, dataObject.getGroups().size());
    assertTrue(dataObject.getGroups().contains("customers"));
    assertTrue(dataObject.getGroups().contains("helpdesk"));
    Map<String, AttributeInterface> attributes = dataObject.getAttributeMap();
    assertEquals(5, attributes.size());
    TextAttribute title = (TextAttribute) attributes.get("Titolo");
    assertEquals("Titolo Contenuto 3 Coach", title.getTextForLang("it"));
    assertNull(title.getTextForLang("en"));
    MonoListAttribute authors = (MonoListAttribute) attributes.get("Autori");
    assertEquals(4, authors.getAttributes().size());
    HypertextAttribute hypertext = (HypertextAttribute) attributes.get("CorpoTesto");
    assertEquals("<p>Corpo Testo Contenuto 3 Coach</p>", hypertext.getTextForLang("it").trim());
    assertNull(hypertext.getTextForLang("en"));
    DateAttribute date = (DateAttribute) attributes.get("Data");
    assertEquals("13/12/2006", DateConverter.getFormattedDate(date.getDate(), "dd/MM/yyyy"));
}
Also used : MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) HypertextAttribute(com.agiletec.aps.system.common.entity.model.attribute.HypertextAttribute) DataObject(org.entando.entando.aps.system.services.dataobject.model.DataObject) TextAttribute(com.agiletec.aps.system.common.entity.model.attribute.TextAttribute) MonoTextAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface) DateAttribute(com.agiletec.aps.system.common.entity.model.attribute.DateAttribute)

Example 5 with TextAttribute

use of com.agiletec.aps.system.common.entity.model.attribute.TextAttribute in project entando-core by entando.

the class TestDataObjectManager method testLoadDataObjectsByAttribute_3.

public void testLoadDataObjectsByAttribute_3() throws Throwable {
    List<String> groups = new ArrayList<String>();
    String[] masterDataObjectIds = { "EVN193", "EVN191", "EVN192", "EVN194", "EVN23", "EVN24" };
    String[] newDataObjectIds = null;
    try {
        newDataObjectIds = this.addDraftDataObjectsForTest(masterDataObjectIds, false);
        for (int i = 0; i < newDataObjectIds.length; i++) {
            DataObject dataObject = this._dataObjectManager.loadDataObject(newDataObjectIds[i], false);
            TextAttribute titleAttribute = (TextAttribute) dataObject.getAttribute("Titolo");
            if (i % 2 == 1 && i < 4) {
                titleAttribute.setText(null, "en");
            }
            titleAttribute.setText(null, "it");
            this._dataObjectManager.saveDataObject(dataObject);
        }
        groups.add(Group.ADMINS_GROUP_NAME);
        EntitySearchFilter filter0 = new EntitySearchFilter(IDataObjectManager.DATA_OBJECT_CREATION_DATE_FILTER_KEY, false);
        filter0.setOrder(EntitySearchFilter.ASC_ORDER);
        EntitySearchFilter filter1 = new EntitySearchFilter(IDataObjectManager.ENTITY_TYPE_CODE_FILTER_KEY, false, "EVN", false);
        EntitySearchFilter filter2 = new EntitySearchFilter(IDataObjectManager.ENTITY_ID_FILTER_KEY, false);
        filter2.setOrder(EntitySearchFilter.ASC_ORDER);
        EntitySearchFilter[] filters = { filter0, filter1, filter2 };
        String[] expectedDataObjectsId = { "EVN191", "EVN192", "EVN193", "EVN194", "EVN103", "EVN20", "EVN23", "EVN24", "EVN25", "EVN41", "EVN21", newDataObjectIds[0], newDataObjectIds[1], newDataObjectIds[2], newDataObjectIds[3], newDataObjectIds[4], newDataObjectIds[5] };
        List<String> dataObjects = this._dataObjectManager.loadDataObjectsId(null, filters, groups);
        assertEquals(expectedDataObjectsId.length, dataObjects.size());
        for (int i = 0; i < expectedDataObjectsId.length; i++) {
            assertEquals(expectedDataObjectsId[i], dataObjects.get(i));
        }
        EntitySearchFilter filter3 = new EntitySearchFilter("Titolo", true);
        filter3.setLangCode("en");
        filter3.setOrder(EntitySearchFilter.ASC_ORDER);
        EntitySearchFilter[] filters1 = { filter0, filter1, filter2, filter3 };
        String[] expectedDataObjectsId1 = { "EVN191", "EVN192", "EVN193", "EVN194", "EVN103", "EVN20", "EVN23", "EVN24", "EVN25", "EVN41", "EVN21", newDataObjectIds[0], newDataObjectIds[2] };
        dataObjects = this._dataObjectManager.loadDataObjectsId(null, filters1, groups);
        assertEquals(expectedDataObjectsId1.length, dataObjects.size());
        for (int i = 0; i < expectedDataObjectsId1.length; i++) {
            assertEquals(expectedDataObjectsId1[i], dataObjects.get(i));
        }
        filter3.setNullOption(true);
        filter3.setLangCode("it");
        EntitySearchFilter[] filters2 = { filter0, filter1, filter2, filter3 };
        String[] expectedDataObjectsId2 = { newDataObjectIds[0], newDataObjectIds[1], newDataObjectIds[2], newDataObjectIds[3], newDataObjectIds[4], newDataObjectIds[5] };
        dataObjects = this._dataObjectManager.loadDataObjectsId(null, filters2, groups);
        assertEquals(expectedDataObjectsId2.length, dataObjects.size());
        for (int i = 0; i < expectedDataObjectsId2.length; i++) {
            assertEquals(expectedDataObjectsId2[i], dataObjects.get(i));
        }
        filter3.setNullOption(true);
        filter3.setLangCode("en");
        EntitySearchFilter[] filters3 = { filter0, filter1, filter2, filter3 };
        String[] expectedDataObjectsId3 = { newDataObjectIds[1], newDataObjectIds[3], newDataObjectIds[4], newDataObjectIds[5] };
        dataObjects = this._dataObjectManager.loadDataObjectsId(null, filters3, groups);
        assertEquals(expectedDataObjectsId3.length, dataObjects.size());
        for (int i = 0; i < expectedDataObjectsId3.length; i++) {
            assertEquals(expectedDataObjectsId3[i], dataObjects.get(i));
        }
        filter2.setNullOption(true);
        EntitySearchFilter[] filters4 = { filter0, filter1, filter2 };
        dataObjects = this._dataObjectManager.loadDataObjectsId(null, filters4, groups);
        assertEquals(0, dataObjects.size());
    } catch (Throwable t) {
        throw t;
    } finally {
        this.deleteDataObjects(newDataObjectIds);
    }
}
Also used : DataObject(org.entando.entando.aps.system.services.dataobject.model.DataObject) TextAttribute(com.agiletec.aps.system.common.entity.model.attribute.TextAttribute) MonoTextAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute) ArrayList(java.util.ArrayList) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Aggregations

TextAttribute (com.agiletec.aps.system.common.entity.model.attribute.TextAttribute)13 MonoTextAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute)6 Category (com.agiletec.aps.system.services.category.Category)6 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)6 DataObject (org.entando.entando.aps.system.services.dataobject.model.DataObject)6 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)5 DateAttribute (com.agiletec.aps.system.common.entity.model.attribute.DateAttribute)5 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)5 HypertextAttribute (com.agiletec.aps.system.common.entity.model.attribute.HypertextAttribute)4 CompositeAttribute (com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute)3 ListAttribute (com.agiletec.aps.system.common.entity.model.attribute.ListAttribute)3 NumberAttribute (com.agiletec.aps.system.common.entity.model.attribute.NumberAttribute)3 ArrayList (java.util.ArrayList)3 EntitySearchFilter (com.agiletec.aps.system.common.entity.model.EntitySearchFilter)2 CheckBoxAttribute (com.agiletec.aps.system.common.entity.model.attribute.CheckBoxAttribute)2 EnumeratorAttribute (com.agiletec.aps.system.common.entity.model.attribute.EnumeratorAttribute)2 ThreeStateAttribute (com.agiletec.aps.system.common.entity.model.attribute.ThreeStateAttribute)2 ResourceAttributeInterface (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.ResourceAttributeInterface)2 EnumeratorMapAttribute (org.entando.entando.aps.system.common.entity.model.attribute.EnumeratorMapAttribute)2 SystemConstants (com.agiletec.aps.system.SystemConstants)1