use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestDataObjectEntityManager method testLoadFutureEntityEvents1.
public void testLoadFutureEntityEvents1() throws Throwable {
Date dateForTest = DateConverter.parseDate("1999-03-14", "yyyy-MM-dd");
EntitySearchFilter filter1 = new EntitySearchFilter("DataInizio", true, dateForTest, null);
filter1.setOrder(EntitySearchFilter.ASC_ORDER);
EntitySearchFilter[] filters = { filter1 };
List<String> dataObjects = this._dataObjectManager.searchId("EVN", filters);
String[] expectedOrderedEnitiesId = { "EVN192", "EVN103", "EVN21", "EVN20", "EVN25", "EVN41", "EVN23", "EVN24", "EVN193", "EVN194" };
assertEquals(expectedOrderedEnitiesId.length, dataObjects.size());
for (int i = 0; i < expectedOrderedEnitiesId.length; i++) {
assertEquals(expectedOrderedEnitiesId[i], dataObjects.get(i));
}
filter1.setOrder(EntitySearchFilter.DESC_ORDER);
EntitySearchFilter[] filters2 = { filter1 };
dataObjects = this._dataObjectManager.searchId("EVN", filters2);
assertEquals(expectedOrderedEnitiesId.length, dataObjects.size());
for (int i = 0; i < expectedOrderedEnitiesId.length; i++) {
assertEquals(expectedOrderedEnitiesId[expectedOrderedEnitiesId.length - i - 1], dataObjects.get(i));
}
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestDataObjectEntityManager 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.searchId("EVN", filters);
String[] expectedContentsId = { "EVN24", "EVN23", "EVN103", "EVN191", "EVN192", "EVN193", "EVN194", "EVN41", "EVN20", "EVN21", "EVN25" };
assertEquals(expectedContentsId.length, dataObjects.size());
for (int i = 0; i < expectedContentsId.length; i++) {
assertEquals(expectedContentsId[i], dataObjects.get(i));
}
filterForDescr.setOrder(EntitySearchFilter.DESC_ORDER);
dataObjects = _dataObjectManager.searchId("EVN", filters);
assertEquals(expectedContentsId.length, dataObjects.size());
for (int i = 0; i < expectedContentsId.length; i++) {
assertEquals(expectedContentsId[expectedContentsId.length - i - 1], dataObjects.get(i));
}
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestDataObjectEntityManager method testLoadFutureEvents2.
public void testLoadFutureEvents2() throws ApsSystemException {
Date date = DateConverter.parseDate("2008-01-01", "yyyy-MM-dd");
EntitySearchFilter filter = new EntitySearchFilter("DataInizio", true, date, null);
filter.setOrder(EntitySearchFilter.ASC_ORDER);
EntitySearchFilter[] filters = { filter };
List<String> dataObjects = this._dataObjectManager.searchId("EVN", filters);
String[] expectedOrderedEntitiesId = { "EVN41", "EVN23", "EVN24", "EVN193", "EVN194" };
assertEquals(expectedOrderedEntitiesId.length, dataObjects.size());
for (int i = 0; i < expectedOrderedEntitiesId.length; i++) {
assertEquals(expectedOrderedEntitiesId[i], dataObjects.get(i));
}
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestDataObjectEntityManager method testSearchEntities.
public void testSearchEntities() throws ApsSystemException {
EntitySearchFilter filter = new EntitySearchFilter("Data", true);
EntitySearchFilter[] filters = { filter };
List<String> dataObjects = this._dataObjectManager.searchId("ART", filters);
String[] expectedContentsId1 = { "ART1", "ART104", "ART112", "ART111", "ART120", "ART121" };
assertEquals(expectedContentsId1.length, dataObjects.size());
for (int i = 0; i < expectedContentsId1.length; i++) {
assertTrue(dataObjects.contains(expectedContentsId1[i]));
}
dataObjects = this._dataObjectManager.searchId("EVN", null);
String[] expectedContentsId2 = { "EVN194", "EVN193", "EVN192", "EVN191", "EVN103", "EVN20", "EVN21", "EVN23", "EVN24", "EVN25", "EVN41" };
assertEquals(expectedContentsId2.length, dataObjects.size());
for (int i = 0; i < expectedContentsId2.length; i++) {
assertTrue(dataObjects.contains(expectedContentsId2[i]));
}
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestDataObjectEntityManager method testLoadFutureEntityEvents2.
public void testLoadFutureEntityEvents2() throws Throwable {
Date startDateForTest = DateConverter.parseDate("1999-03-14", "yyyy-MM-dd");
EntitySearchFilter filter1 = new EntitySearchFilter("DataInizio", true, startDateForTest, null);
filter1.setOrder(EntitySearchFilter.ASC_ORDER);
Date endDateForTest = DateConverter.parseDate("2017-09-12", "yyyy-MM-dd");
EntitySearchFilter filter2 = new EntitySearchFilter("DataFine", true, null, endDateForTest);
filter2.setOrder(EntitySearchFilter.ASC_ORDER);
EntitySearchFilter[] filters3 = { filter1, filter2 };
List<String> dataObjects = this._dataObjectManager.searchId("EVN", filters3);
String[] expectedOrderedEntitiesId = { "EVN192", "EVN103", "EVN21", "EVN20", "EVN25", "EVN41", "EVN23", "EVN24", "EVN193" };
assertEquals(expectedOrderedEntitiesId.length, dataObjects.size());
for (int i = 0; i < expectedOrderedEntitiesId.length; i++) {
assertEquals(expectedOrderedEntitiesId[i], dataObjects.get(i));
}
filter2.setOrder(EntitySearchFilter.DESC_ORDER);
dataObjects = this._dataObjectManager.searchId("EVN", filters3);
// l'ordinamento รจ lo stesso il quanto il primo ordinamento viene fatto con il filter1
assertEquals(expectedOrderedEntitiesId.length, dataObjects.size());
for (int i = 0; i < expectedOrderedEntitiesId.length; i++) {
assertEquals(expectedOrderedEntitiesId[i], dataObjects.get(i));
}
filter1.setOrder(EntitySearchFilter.DESC_ORDER);
dataObjects = this._dataObjectManager.searchId("EVN", filters3);
assertEquals(expectedOrderedEntitiesId.length, dataObjects.size());
for (int i = 0; i < expectedOrderedEntitiesId.length; i++) {
assertEquals(expectedOrderedEntitiesId[expectedOrderedEntitiesId.length - i - 1], dataObjects.get(i));
}
filter1.setOrder(EntitySearchFilter.ASC_ORDER);
filter2.setOrder(EntitySearchFilter.ASC_ORDER);
EntitySearchFilter[] filters4 = { filter2, filter1 };
dataObjects = this._dataObjectManager.searchId("EVN", filters4);
String[] expectedOrderedEntitiesId2 = { "EVN192", "EVN103", "EVN20", "EVN21", "EVN25", "EVN41", "EVN23", "EVN24", "EVN193" };
assertEquals(expectedOrderedEntitiesId2.length, dataObjects.size());
for (int i = 0; i < expectedOrderedEntitiesId2.length; i++) {
assertEquals(expectedOrderedEntitiesId2[i], dataObjects.get(i));
}
filter2.setOrder(EntitySearchFilter.DESC_ORDER);
dataObjects = this._dataObjectManager.searchId("EVN", filters4);
assertEquals(expectedOrderedEntitiesId2.length, dataObjects.size());
for (int i = 0; i < expectedOrderedEntitiesId2.length; i++) {
assertEquals(expectedOrderedEntitiesId2[expectedOrderedEntitiesId2.length - i - 1], dataObjects.get(i));
}
}
Aggregations