use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestDataObjectListHelper method testGetFilters.
public void testGetFilters() throws Throwable {
String filtersShowletParam = "(key=DataInizio;attributeFilter=true;start=21/10/2007;order=DESC)+(key=Titolo;attributeFilter=true;order=ASC)";
EntitySearchFilter[] filters = this._helper.getFilters("EVN", filtersShowletParam, this.getRequestContext());
assertEquals(2, filters.length);
EntitySearchFilter filter = filters[0];
assertEquals("DataInizio", filter.getKey());
assertEquals(DateConverter.parseDate("21/10/2007", "dd/MM/yyyy"), filter.getStart());
assertNull(filter.getEnd());
assertNull(filter.getValue());
assertEquals("DESC", filter.getOrder().toString());
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestDataObjectListHelper method testGetFilters_OneDefinition.
public void testGetFilters_OneDefinition() {
RequestContext reqCtx = this.getRequestContext();
String contentType = "ART";
String showletParam = "(key=Titolo;attributeFilter=TRUE;start=START;end=END;like=FALSE;order=ASC)";
EntitySearchFilter[] filters = this._helper.getFilters(contentType, showletParam, reqCtx);
assertNotNull(filters);
assertEquals(1, filters.length);
EntitySearchFilter entitySearchFilter = filters[0];
assertNotNull(entitySearchFilter);
assertEquals("Titolo", entitySearchFilter.getKey());
assertEquals("START", entitySearchFilter.getStart());
assertEquals("END", entitySearchFilter.getEnd());
assertEquals("ASC", entitySearchFilter.getOrder().toString());
contentType = "ART";
showletParam = "(key=Titolo;attributeFilter=TRUE;start=START;end=END;like=FALSE;order=DESC)";
filters = this._helper.getFilters(contentType, showletParam, reqCtx);
assertNotNull(filters);
assertEquals(1, filters.length);
entitySearchFilter = filters[0];
assertNotNull(entitySearchFilter);
assertEquals("Titolo", entitySearchFilter.getKey());
assertEquals("START", entitySearchFilter.getStart());
assertEquals("END", entitySearchFilter.getEnd());
assertEquals("DESC", entitySearchFilter.getOrder().toString());
contentType = "ART";
showletParam = "(key=descr;value=VALUE;attributeFilter=FALSE;order=ASC)";
filters = this._helper.getFilters(contentType, showletParam, reqCtx);
assertNotNull(filters);
assertEquals(1, filters.length);
entitySearchFilter = filters[0];
assertNotNull(entitySearchFilter);
assertEquals("descr", entitySearchFilter.getKey());
assertEquals(null, entitySearchFilter.getStart());
assertEquals(null, entitySearchFilter.getEnd());
assertEquals("ASC", entitySearchFilter.getOrder().toString());
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestDataObjectListHelper method testGetFilters_TwoDefinition.
public void testGetFilters_TwoDefinition() {
RequestContext reqCtx = this.getRequestContext();
String contentType = "ART";
String showletParam = "(key=Titolo;attributeFilter=TRUE;start=START;end=END;like=FALSE;order=ASC)+(key=descr;value=VALUE;attributeFilter=FALSE;order=ASC)";
EntitySearchFilter[] filters = this._helper.getFilters(contentType, showletParam, reqCtx);
assertNotNull(filters);
assertEquals(2, filters.length);
EntitySearchFilter entitySearchFilter = filters[0];
assertNotNull(entitySearchFilter);
assertEquals("Titolo", entitySearchFilter.getKey());
assertEquals("START", entitySearchFilter.getStart());
assertEquals("END", entitySearchFilter.getEnd());
assertEquals("ASC", entitySearchFilter.getOrder().toString());
assertEquals(null, entitySearchFilter.getValue());
assertTrue(entitySearchFilter.isAttributeFilter());
entitySearchFilter = filters[1];
assertNotNull(entitySearchFilter);
assertEquals("descr", entitySearchFilter.getKey());
assertEquals(null, entitySearchFilter.getStart());
assertEquals(null, entitySearchFilter.getEnd());
assertEquals("ASC", entitySearchFilter.getOrder().toString());
assertFalse(entitySearchFilter.isAttributeFilter());
Object obj = entitySearchFilter.getValue();
assertNotNull(obj);
assertEquals(String.class, obj.getClass());
assertEquals("VALUE", (String) obj);
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestDataObjectListHelper method testGetContents_2.
public void testGetContents_2() throws Throwable {
String pageCode = "pagina_1";
int frame = 1;
try {
this.setUserOnSession("admin");
RequestContext reqCtx = this.valueRequestContext(pageCode, frame);
MockDataObjectListTagBean bean = new MockDataObjectListTagBean();
bean.setContentType("EVN");
bean.addCategory("evento");
EntitySearchFilter filter = new EntitySearchFilter("DataInizio", true);
filter.setOrder(EntitySearchFilter.DESC_ORDER);
bean.addFilter(filter);
List<String> contents = this._helper.getContentsId(bean, reqCtx);
String[] expected = { "EVN193", "EVN192" };
assertEquals(expected.length, contents.size());
for (int i = 0; i < expected.length; i++) {
assertEquals(expected[i], contents.get(i));
}
} catch (Throwable t) {
throw t;
} finally {
this.setPageWidgets(pageCode, frame, null);
}
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class UserProfileManagerIntegrationTest method testSearchProfiles_1.
public void testSearchProfiles_1() throws Throwable {
List<String> usernames = this._profileManager.searchId(null);
assertNotNull(usernames);
assertEquals(4, usernames.size());
EntitySearchFilter usernameFilter1 = new EntitySearchFilter(IUserProfileManager.ENTITY_ID_FILTER_KEY, false);
usernameFilter1.setOrder(EntitySearchFilter.Order.ASC);
EntitySearchFilter[] filters1 = { usernameFilter1 };
usernames = this._profileManager.searchId(filters1);
assertNotNull(usernames);
String[] expected1 = { "editorCoach", "editorCustomers", "mainEditor", "pageManagerCoach" };
assertEquals(expected1.length, usernames.size());
this.verifyOrder(usernames, expected1);
EntitySearchFilter usernameFilter2 = new EntitySearchFilter(IUserProfileManager.ENTITY_ID_FILTER_KEY, false, "oa", true);
usernameFilter2.setOrder(EntitySearchFilter.Order.ASC);
EntitySearchFilter[] filters2 = { usernameFilter2 };
usernames = this._profileManager.searchId(filters2);
assertNotNull(usernames);
String[] expected2 = { "editorCoach", "pageManagerCoach" };
assertEquals(expected2.length, usernames.size());
this.verifyOrder(usernames, expected2);
}
Aggregations