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));
}
}
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"));
}
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));
}
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));
}
}
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));
}
}
Aggregations