Search in sources :

Example 86 with EntitySearchFilter

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

the class TestDataObjectManager method testLoadEvents_8.

protected void testLoadEvents_8(boolean useRoleFilter) throws ApsSystemException {
    List<String> groups = new ArrayList<String>();
    groups.add(Group.ADMINS_GROUP_NAME);
    List<String> allowedDescription = new ArrayList<String>();
    // EVN24
    allowedDescription.add("Castello");
    // EVN24
    allowedDescription.add("dei bambini");
    EntitySearchFilter filter = (useRoleFilter) ? EntitySearchFilter.createRoleFilter(SystemConstants.DATA_TYPE_ATTRIBUTE_ROLE_TITLE, allowedDescription, true) : new EntitySearchFilter("Titolo", true, allowedDescription, true);
    filter.setLangCode("it");
    filter.setOrder(EntitySearchFilter.DESC_ORDER);
    EntitySearchFilter[] filters = { filter };
    List<String> dataObjects = _dataObjectManager.loadDataObjectsId("EVN", null, filters, groups);
    String[] expectedOrderedDataObjectsId2 = { "EVN24" };
    assertEquals(expectedOrderedDataObjectsId2.length, dataObjects.size());
    for (int i = 0; i < expectedOrderedDataObjectsId2.length; i++) {
        assertEquals(expectedOrderedDataObjectsId2[i], dataObjects.get(i));
    }
}
Also used : ArrayList(java.util.ArrayList) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Example 87 with EntitySearchFilter

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

the class TestDataObjectManager method testLoadEventsForCategory_1.

public void testLoadEventsForCategory_1() throws ApsSystemException {
    String[] categories = { "evento" };
    List<String> dataObjects = _dataObjectManager.loadDataObjectsId("EVN", categories, null, null);
    assertEquals(2, dataObjects.size());
    assertTrue(dataObjects.contains("EVN192"));
    assertTrue(dataObjects.contains("EVN193"));
    Date today = DateConverter.parseDate("2005-02-13", "yyyy-MM-dd");
    EntitySearchFilter filter = new EntitySearchFilter("DataInizio", true, null, today);
    filter.setOrder(EntitySearchFilter.ASC_ORDER);
    EntitySearchFilter[] filters = { filter };
    dataObjects = _dataObjectManager.loadDataObjectsId("EVN", categories, filters, null);
    assertEquals(1, dataObjects.size());
    assertTrue(dataObjects.contains("EVN192"));
}
Also used : EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter) Date(java.util.Date)

Example 88 with EntitySearchFilter

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

the class TestDataObjectManager method testLoadEvents_3.

public void testLoadEvents_3() throws ApsSystemException {
    List<String> groups = new ArrayList<String>();
    groups.add(Group.ADMINS_GROUP_NAME);
    Date value = DateConverter.parseDate("1999-04-14", "yyyy-MM-dd");
    EntitySearchFilter filter = new EntitySearchFilter("DataInizio", true, value, false);
    EntitySearchFilter[] filters = { filter };
    List<String> dataObjects = _dataObjectManager.loadDataObjectsId("EVN", null, filters, groups);
    assertEquals(1, dataObjects.size());
    assertEquals("EVN192", dataObjects.get(0));
}
Also used : ArrayList(java.util.ArrayList) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter) Date(java.util.Date)

Example 89 with EntitySearchFilter

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

the class TestDataObjectManager method testLoadPastEvents_2.

public void testLoadPastEvents_2() throws ApsSystemException {
    Date today = DateConverter.parseDate("2008-10-01", "yyyy-MM-dd");
    EntitySearchFilter filter = new EntitySearchFilter("DataInizio", true, null, today);
    filter.setOrder(EntitySearchFilter.DESC_ORDER);
    EntitySearchFilter[] filters = { filter };
    List<String> dataObjects = _dataObjectManager.loadDataObjectsId("EVN", null, filters, null);
    String[] expectedOrderedDataObjectsId = { "EVN23", "EVN25", "EVN20", "EVN21", "EVN192", "EVN191" };
    assertEquals(expectedOrderedDataObjectsId.length, dataObjects.size());
    for (int i = 0; i < expectedOrderedDataObjectsId.length; i++) {
        assertEquals(expectedOrderedDataObjectsId[i], dataObjects.get(i));
    }
}
Also used : EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter) Date(java.util.Date)

Example 90 with EntitySearchFilter

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

the class TestDataObjectManager method testLoadOrderedEvents_1.

public void testLoadOrderedEvents_1() throws ApsSystemException {
    EntitySearchFilter filterForDescr = new EntitySearchFilter(IDataObjectManager.DATA_OBJECT_DESCR_FILTER_KEY, false);
    filterForDescr.setOrder(EntitySearchFilter.ASC_ORDER);
    EntitySearchFilter[] filters = { filterForDescr };
    List<String> dataObjects = _dataObjectManager.loadDataObjectsId("EVN", null, filters, null);
    String[] expectedFreeDataObjectsId = { "EVN24", "EVN23", "EVN191", "EVN192", "EVN193", "EVN194", "EVN20", "EVN21", "EVN25" };
    assertEquals(expectedFreeDataObjectsId.length, dataObjects.size());
    for (int i = 0; i < expectedFreeDataObjectsId.length; i++) {
        assertEquals(expectedFreeDataObjectsId[i], dataObjects.get(i));
    }
    filterForDescr.setOrder(EntitySearchFilter.DESC_ORDER);
    dataObjects = _dataObjectManager.loadDataObjectsId("EVN", null, filters, null);
    assertEquals(expectedFreeDataObjectsId.length, dataObjects.size());
    for (int i = 0; i < expectedFreeDataObjectsId.length; i++) {
        assertEquals(expectedFreeDataObjectsId[expectedFreeDataObjectsId.length - i - 1], dataObjects.get(i));
    }
}
Also used : EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Aggregations

EntitySearchFilter (com.agiletec.aps.system.common.entity.model.EntitySearchFilter)157 ArrayList (java.util.ArrayList)51 Date (java.util.Date)46 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)12 RequestContext (com.agiletec.aps.system.RequestContext)9 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)7 IApsEntity (com.agiletec.aps.system.common.entity.model.IApsEntity)6 DateAttribute (com.agiletec.aps.system.common.entity.model.attribute.DateAttribute)5 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)5 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)4 BigDecimal (java.math.BigDecimal)4 HashSet (java.util.HashSet)4 ApsEntityRecord (com.agiletec.aps.system.common.entity.model.ApsEntityRecord)3 BooleanAttribute (com.agiletec.aps.system.common.entity.model.attribute.BooleanAttribute)3 ITextAttribute (com.agiletec.aps.system.common.entity.model.attribute.ITextAttribute)3 NumberAttribute (com.agiletec.aps.system.common.entity.model.attribute.NumberAttribute)3 Properties (java.util.Properties)3 DataObject (org.entando.entando.aps.system.services.dataobject.model.DataObject)3 IEntityTypesConfigurer (com.agiletec.aps.system.common.entity.IEntityTypesConfigurer)2 MonoTextAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute)2