use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestContentEntityManager 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> contents = this._contentManager.searchId("EVN", filters);
String[] expectedOrderedEnitiesId = { "EVN192", "EVN103", "EVN21", "EVN20", "EVN25", "EVN41", "EVN23", "EVN24", "EVN193", "EVN194" };
assertEquals(expectedOrderedEnitiesId.length, contents.size());
for (int i = 0; i < expectedOrderedEnitiesId.length; i++) {
assertEquals(expectedOrderedEnitiesId[i], contents.get(i));
}
filter1.setOrder(EntitySearchFilter.DESC_ORDER);
EntitySearchFilter[] filters2 = { filter1 };
contents = this._contentManager.searchId("EVN", filters2);
assertEquals(expectedOrderedEnitiesId.length, contents.size());
for (int i = 0; i < expectedOrderedEnitiesId.length; i++) {
assertEquals(expectedOrderedEnitiesId[expectedOrderedEnitiesId.length - i - 1], contents.get(i));
}
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestContentEntityManager method testSearchEvents.
public void testSearchEvents() throws ApsSystemException {
EntitySearchFilter filterIt = new EntitySearchFilter("Titolo", true, "it", false);
filterIt.setLangCode("it");
EntitySearchFilter[] filters = { filterIt };
List<String> contents = this._contentManager.searchId("EVN", filters);
assertTrue(contents.isEmpty());
filterIt = new EntitySearchFilter("Titolo", true, "it", true);
filterIt.setLangCode("it");
EntitySearchFilter[] filters1 = { filterIt };
contents = this._contentManager.searchId("EVN", filters1);
assertFalse(contents.isEmpty());
String[] expectedItalianContentsId = { "EVN194", "EVN193", "EVN192", "EVN191", "EVN103" };
assertEquals(expectedItalianContentsId.length, contents.size());
for (int i = 0; i < expectedItalianContentsId.length; i++) {
assertTrue(contents.contains(expectedItalianContentsId[i]));
}
EntitySearchFilter filterEn = new EntitySearchFilter("Titolo", true, "it", true);
filterEn.setLangCode("en");
EntitySearchFilter[] filters2 = { filterEn };
contents = this._contentManager.searchId("EVN", filters2);
assertFalse(contents.isEmpty());
String[] expectedEnglishContentsId = { "EVN103", "EVN193", "EVN191", "EVN192", "EVN194" };
assertEquals(expectedEnglishContentsId.length, contents.size());
for (int i = 0; i < expectedEnglishContentsId.length; i++) {
assertTrue(contents.contains(expectedEnglishContentsId[i]));
}
filterEn.setOrder(EntitySearchFilter.DESC_ORDER);
EntitySearchFilter[] filters3 = { filterEn };
contents = this._contentManager.searchId("EVN", filters3);
assertEquals(expectedEnglishContentsId.length, contents.size());
for (int i = 0; i < expectedEnglishContentsId.length; i++) {
assertEquals(expectedEnglishContentsId[i], contents.get(i));
}
filterEn.setOrder(EntitySearchFilter.ASC_ORDER);
EntitySearchFilter[] filters4 = { filterEn };
contents = this._contentManager.searchId("EVN", filters4);
assertEquals(expectedEnglishContentsId.length, contents.size());
for (int i = 0; i < expectedEnglishContentsId.length; i++) {
assertEquals(expectedEnglishContentsId[expectedEnglishContentsId.length - i - 1], contents.get(i));
}
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestContentEntityManager 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> contents = this._contentManager.searchId("EVN", filters);
String[] expectedOrderedEntitiesId = { "EVN41", "EVN23", "EVN24", "EVN193", "EVN194" };
assertEquals(expectedOrderedEntitiesId.length, contents.size());
for (int i = 0; i < expectedOrderedEntitiesId.length; i++) {
assertEquals(expectedOrderedEntitiesId[i], contents.get(i));
}
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestContentEntityManager method testSearchRecords.
public void testSearchRecords() throws Throwable {
List<ApsEntityRecord> contents = this._contentManager.searchRecords(null);
assertNotNull(contents);
assertEquals(25, contents.size());
EntitySearchFilter typeFilter = new EntitySearchFilter(IContentManager.ENTITY_TYPE_CODE_FILTER_KEY, false, "ART", false);
EntitySearchFilter[] filters1 = { typeFilter };
contents = this._contentManager.searchRecords(filters1);
assertEquals(11, contents.size());
EntitySearchFilter creationOrderFilter = new EntitySearchFilter(IContentManager.CONTENT_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" };
contents = this._contentManager.searchRecords(filters2);
assertEquals(order2.length, contents.size());
this.verifyOrder(contents, order2);
EntitySearchFilter descrFilter = new EntitySearchFilter(IContentManager.CONTENT_DESCR_FILTER_KEY, false, "descriz", true);
EntitySearchFilter[] filters3 = { typeFilter, creationOrderFilter, descrFilter };
String[] order3 = { "ART187", "ART180", "ART179" };
contents = this._contentManager.searchRecords(filters3);
assertEquals(order3.length, contents.size());
this.verifyOrder(contents, order3);
EntitySearchFilter statusFilter = new EntitySearchFilter(IContentManager.CONTENT_STATUS_FILTER_KEY, false, "AF", true);
EntitySearchFilter[] filters4 = { typeFilter, creationOrderFilter, descrFilter, statusFilter };
String[] order4 = { "ART187", "ART179" };
contents = this._contentManager.searchRecords(filters4);
assertEquals(order4.length, contents.size());
this.verifyOrder(contents, order4);
EntitySearchFilter onLineFilter = new EntitySearchFilter(IContentManager.CONTENT_ONLINE_FILTER_KEY, false);
EntitySearchFilter[] filters5 = { typeFilter, creationOrderFilter, descrFilter, statusFilter, onLineFilter };
String[] order5 = { "ART187" };
contents = this._contentManager.searchRecords(filters5);
assertEquals(order5.length, contents.size());
this.verifyOrder(contents, order5);
onLineFilter.setNullOption(true);
EntitySearchFilter[] filters6 = { typeFilter, creationOrderFilter, descrFilter, statusFilter, onLineFilter };
String[] order6 = { "ART179" };
contents = this._contentManager.searchRecords(filters6);
assertEquals(order6.length, contents.size());
this.verifyOrder(contents, order6);
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestContentEntityManager 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> contents2 = this._contentManager.searchId("EVN", filters);
String[] expectedOrderedEntitiesId = { "EVN191", "EVN192", "EVN103", "EVN21", "EVN20", "EVN25", "EVN41", "EVN23" };
assertEquals(expectedOrderedEntitiesId.length, contents2.size());
for (int i = 0; i < expectedOrderedEntitiesId.length; i++) {
assertEquals(expectedOrderedEntitiesId[i], contents2.get(i));
}
}
Aggregations