use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestContentManager method testSearchContents_1_6.
public void testSearchContents_1_6() throws Throwable {
// forcing case sensitive search
WorkContentSearcherDAO searcherDao = (WorkContentSearcherDAO) this.getApplicationContext().getBean("jacmsWorkContentSearcherDAO");
EntitySearchFilter creationOrder = new EntitySearchFilter(IContentManager.CONTENT_CREATION_DATE_FILTER_KEY, false);
creationOrder.setOrder(EntitySearchFilter.ASC_ORDER);
EntitySearchFilter descrFilter = new EntitySearchFilter(IContentManager.CONTENT_DESCR_FILTER_KEY, false, "CoNt", true);
EntitySearchFilter[] filters1 = { creationOrder, descrFilter };
List<String> contentIds = this._contentManager.searchId(filters1);
assertEquals(9, contentIds.size());
EntitySearchFilter lastEditorFilter = new EntitySearchFilter(IContentManager.CONTENT_LAST_EDITOR_FILTER_KEY, false, "AdMin", true);
EntitySearchFilter[] filters2 = { creationOrder, descrFilter, lastEditorFilter };
contentIds = this._contentManager.searchId(filters2);
assertNotNull(contentIds);
assertEquals(9, contentIds.size());
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestContentManager method testLoadOrderedPublicEvents_1.
public void testLoadOrderedPublicEvents_1() throws ApsSystemException {
EntitySearchFilter filterForDescr = new EntitySearchFilter(IContentManager.CONTENT_DESCR_FILTER_KEY, false);
filterForDescr.setOrder(EntitySearchFilter.ASC_ORDER);
EntitySearchFilter[] filters = { filterForDescr };
List<String> contents = _contentManager.loadPublicContentsId("EVN", null, filters, null);
String[] expectedFreeContentsId = { "EVN24", "EVN23", "EVN191", "EVN192", "EVN193", "EVN194", "EVN20", "EVN21", "EVN25" };
assertEquals(expectedFreeContentsId.length, contents.size());
for (int i = 0; i < expectedFreeContentsId.length; i++) {
assertEquals(expectedFreeContentsId[i], contents.get(i));
}
filterForDescr.setOrder(EntitySearchFilter.DESC_ORDER);
contents = _contentManager.loadPublicContentsId("EVN", null, filters, null);
assertEquals(expectedFreeContentsId.length, contents.size());
for (int i = 0; i < expectedFreeContentsId.length; i++) {
assertEquals(expectedFreeContentsId[expectedFreeContentsId.length - i - 1], contents.get(i));
}
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class TestContentManager method testLoadPublicEvents_5.
public void testLoadPublicEvents_5() throws ApsSystemException {
List<String> groups = new ArrayList<String>();
groups.add(Group.ADMINS_GROUP_NAME);
List<Date> allowedDates = new ArrayList<Date>();
// EVN192
allowedDates.add(DateConverter.parseDate("1999-04-14", "yyyy-MM-dd"));
// EVN23
allowedDates.add(DateConverter.parseDate("2008-02-13", "yyyy-MM-dd"));
EntitySearchFilter filter = new EntitySearchFilter("DataInizio", true, allowedDates, false);
filter.setOrder(EntitySearchFilter.DESC_ORDER);
EntitySearchFilter[] filters = { filter };
List<String> contents = _contentManager.loadPublicContentsId("EVN", null, filters, groups);
String[] expectedOrderedContentsId2 = { "EVN23", "EVN192" };
assertEquals(expectedOrderedContentsId2.length, contents.size());
for (int i = 0; i < expectedOrderedContentsId2.length; i++) {
assertEquals(expectedOrderedContentsId2[i], contents.get(i));
}
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class UserProfileFinderAction method execute.
@Override
public String execute() {
try {
String username = this.getUsername();
EntitySearchFilter filter = null;
if (username != null && username.trim().length() > 0) {
filter = new EntitySearchFilter(IEntityManager.ENTITY_ID_FILTER_KEY, false, username, true);
} else {
filter = new EntitySearchFilter(IEntityManager.ENTITY_ID_FILTER_KEY, false);
}
filter.setOrder(EntitySearchFilter.ASC_ORDER);
this.addFilter(filter);
} catch (Throwable t) {
_logger.error("error in execute", t);
return FAILURE;
}
return super.execute();
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class ContentUpdaterService method getContentsId.
@Override
public Set<String> getContentsId(String categoryCode) throws ApsSystemException {
Set<String> allContents = new HashSet<String>();
try {
// Ricerca contenuti per
EntitySearchFilter[] filters = null;
boolean orCategoryFilter = false;
// tutti i gruppi
List<String> userGroupCodes = new ArrayList<String>();
userGroupCodes.add(Group.ADMINS_GROUP_NAME);
// associati alla categoria che รจ stata spostata...
String[] categories = new String[] { categoryCode };
List<String> publicContents = this.getContentManager().loadPublicContentsId(categories, orCategoryFilter, filters, userGroupCodes);
ApsSystemUtils.getLogger().debug("public contents: " + publicContents.size());
List<String> workContents = this.getContentManager().loadWorkContentsId(categories, filters, userGroupCodes);
ApsSystemUtils.getLogger().debug("work contents: " + workContents.size());
allContents.addAll(publicContents);
allContents.addAll(workContents);
} catch (Throwable t) {
ApsSystemUtils.logThrowable(t, this, "getContentsId");
throw new ApsSystemException("Error loading contents to update", t);
}
return allContents;
}
Aggregations