Search in sources :

Example 66 with EntitySearchFilter

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

the class TestDataObjectEntityManager method testLoadFutureEvents1.

public void testLoadFutureEvents1() throws ApsSystemException {
    Date today = DateConverter.parseDate("2005-01-01", "yyyy-MM-dd");
    EntitySearchFilter filter = new EntitySearchFilter("DataInizio", true, today, null);
    filter.setOrder(EntitySearchFilter.ASC_ORDER);
    EntitySearchFilter[] filters = { filter };
    List<String> dataObjects = this._dataObjectManager.searchId("EVN", filters);
    String[] expectedOrderedEntitiesId = { "EVN21", "EVN20", "EVN25", "EVN41", "EVN23", "EVN24", "EVN193", "EVN194" };
    assertEquals(expectedOrderedEntitiesId.length, dataObjects.size());
    for (int i = 0; i < expectedOrderedEntitiesId.length; i++) {
        assertEquals(expectedOrderedEntitiesId[i], dataObjects.get(i));
    }
}
Also used : EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter) Date(java.util.Date)

Example 67 with EntitySearchFilter

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

the class TestDataObjectEntityManager method testLoadFutureEvents3.

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

Example 68 with EntitySearchFilter

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

the class TestDataObjectEntityManager method testLoadPastEvents2.

public void testLoadPastEvents2() 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> dataObjects2 = this._dataObjectManager.searchId("EVN", filters);
    String[] expectedOrderedEntitiesId = { "EVN23", "EVN41", "EVN25", "EVN20", "EVN21", "EVN103", "EVN192", "EVN191" };
    assertEquals(expectedOrderedEntitiesId.length, dataObjects2.size());
    for (int i = 0; i < expectedOrderedEntitiesId.length; i++) {
        assertEquals(expectedOrderedEntitiesId[i], dataObjects2.get(i));
    }
}
Also used : EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter) Date(java.util.Date)

Example 69 with EntitySearchFilter

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

the class TestDataObjectEntityManager method testSearchRecords.

public void testSearchRecords() throws Throwable {
    List<ApsEntityRecord> dataObjects = this._dataObjectManager.searchRecords(null);
    assertNotNull(dataObjects);
    assertEquals(25, dataObjects.size());
    EntitySearchFilter typeFilter = new EntitySearchFilter(IDataObjectManager.ENTITY_TYPE_CODE_FILTER_KEY, false, "ART", false);
    EntitySearchFilter[] filters1 = { typeFilter };
    dataObjects = this._dataObjectManager.searchRecords(filters1);
    assertEquals(11, dataObjects.size());
    EntitySearchFilter creationOrderFilter = new EntitySearchFilter(IDataObjectManager.DATA_OBJECT_CREATION_DATE_FILTER_KEY, false);
    creationOrderFilter.setOrder(EntitySearchFilter.DESC_ORDER);
    EntitySearchFilter[] filters2 = { typeFilter, creationOrderFilter };
    String[] order2 = { "ART122", "ART121", "ART120", "ART112", "ART111", "ART104", "ART102", "ART187", "ART180", "ART179", "ART1" };
    dataObjects = this._dataObjectManager.searchRecords(filters2);
    assertEquals(order2.length, dataObjects.size());
    this.verifyOrder(dataObjects, order2);
    EntitySearchFilter descrFilter = new EntitySearchFilter(IDataObjectManager.DATA_OBJECT_DESCR_FILTER_KEY, false, "descriz", true);
    EntitySearchFilter[] filters3 = { typeFilter, creationOrderFilter, descrFilter };
    String[] order3 = { "ART187", "ART180", "ART179" };
    dataObjects = this._dataObjectManager.searchRecords(filters3);
    assertEquals(order3.length, dataObjects.size());
    this.verifyOrder(dataObjects, order3);
    EntitySearchFilter statusFilter = new EntitySearchFilter(IDataObjectManager.DATA_OBJECT_STATUS_FILTER_KEY, false, "AF", true);
    EntitySearchFilter[] filters4 = { typeFilter, creationOrderFilter, descrFilter, statusFilter };
    String[] order4 = { "ART187", "ART179" };
    dataObjects = this._dataObjectManager.searchRecords(filters4);
    assertEquals(order4.length, dataObjects.size());
    this.verifyOrder(dataObjects, order4);
    EntitySearchFilter onLineFilter = new EntitySearchFilter(IDataObjectManager.DATA_OBJECT_ONLINE_FILTER_KEY, false);
    EntitySearchFilter[] filters5 = { typeFilter, creationOrderFilter, descrFilter, statusFilter, onLineFilter };
    String[] order5 = { "ART187" };
    dataObjects = this._dataObjectManager.searchRecords(filters5);
    assertEquals(order5.length, dataObjects.size());
    this.verifyOrder(dataObjects, order5);
    onLineFilter.setNullOption(true);
    EntitySearchFilter[] filters6 = { typeFilter, creationOrderFilter, descrFilter, statusFilter, onLineFilter };
    String[] order6 = { "ART179" };
    dataObjects = this._dataObjectManager.searchRecords(filters6);
    assertEquals(order6.length, dataObjects.size());
    this.verifyOrder(dataObjects, order6);
}
Also used : ApsEntityRecord(com.agiletec.aps.system.common.entity.model.ApsEntityRecord) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Example 70 with EntitySearchFilter

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

the class TestDataObjectEntityManager method testLoadPastEvents1.

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

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