use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class PublicContentSearcherDAO method loadPublicContentsId.
@Override
public List<String> loadPublicContentsId(String contentType, String[] categories, boolean orClauseCategoryFilter, EntitySearchFilter[] filters, Collection<String> userGroupCodes) {
if (contentType != null && contentType.trim().length() > 0) {
EntitySearchFilter typeFilter = new EntitySearchFilter(IContentManager.ENTITY_TYPE_CODE_FILTER_KEY, false, contentType, false);
filters = this.addFilter(filters, typeFilter);
}
return this.loadPublicContentsId(categories, orClauseCategoryFilter, filters, userGroupCodes);
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class PublicContentSearcherDAO method loadPublicContentsId.
@Override
public List<String> loadPublicContentsId(String[] categories, boolean orClauseCategoryFilter, EntitySearchFilter[] filters, Collection<String> userGroupCodes) {
Set<String> groupCodes = new HashSet<String>();
if (null != userGroupCodes) {
groupCodes.addAll(userGroupCodes);
}
groupCodes.add(Group.FREE_GROUP_NAME);
EntitySearchFilter onLineFilter = new EntitySearchFilter(IContentManager.CONTENT_ONLINE_FILTER_KEY, false);
filters = this.addFilter(filters, onLineFilter);
List<String> contentsId = new ArrayList<String>();
Connection conn = null;
PreparedStatement stat = null;
ResultSet result = null;
try {
conn = this.getConnection();
stat = this.buildStatement(filters, categories, orClauseCategoryFilter, groupCodes, false, conn);
result = stat.executeQuery();
while (result.next()) {
String id = result.getString(this.getMasterTableIdFieldName());
if (!contentsId.contains(id)) {
contentsId.add(id);
}
}
// this.flowResult(contentsId, filters, result);
} catch (Throwable t) {
_logger.error("Error loading contents id list", t);
throw new RuntimeException("Error loading contents id list", t);
// processDaoException(t, "Errore in caricamento lista id contenuti", "loadContentsId");
} finally {
closeDaoResources(result, stat, conn);
}
return contentsId;
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class ContentListHelper method extractContentsId.
protected List<String> extractContentsId(IContentListTagBean bean, RequestContext reqCtx) throws ApsSystemException {
List<String> contentsId = null;
try {
List<UserFilterOptionBean> userFilters = bean.getUserFilterOptions();
Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
ApsProperties config = (null != widget) ? widget.getConfig() : null;
if (null == bean.getContentType() && null != config) {
bean.setContentType(config.getProperty(WIDGET_PARAM_CONTENT_TYPE));
}
if (null == bean.getContentType()) {
throw new ApsSystemException("Tipo contenuto non definito");
}
if (null == bean.getCategory() && null != config && null != config.getProperty(SHOWLET_PARAM_CATEGORY)) {
bean.setCategory(config.getProperty(SHOWLET_PARAM_CATEGORY));
}
this.addWidgetFilters(bean, config, WIDGET_PARAM_FILTERS, reqCtx);
if (null != userFilters && userFilters.size() > 0) {
for (UserFilterOptionBean userFilter : userFilters) {
EntitySearchFilter filter = userFilter.getEntityFilter();
if (null != filter) {
bean.addFilter(filter);
}
}
}
String[] categories = this.getCategories(bean.getCategories(), config, userFilters);
Collection<String> userGroupCodes = this.getAllowedGroups(reqCtx);
boolean orCategoryFilterClause = this.extractOrCategoryFilterClause(config);
contentsId = this.getContentManager().loadPublicContentsId(bean.getContentType(), categories, orCategoryFilterClause, bean.getFilters(), userGroupCodes);
} catch (Throwable t) {
_logger.error("Error extracting contents id", t);
throw new ApsSystemException("Error extracting contents id", t);
}
return contentsId;
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class AbstractTestContentAttribute method deleteTestContent.
protected void deleteTestContent() throws Throwable {
EntitySearchFilter filter = new EntitySearchFilter(IContentManager.CONTENT_DESCR_FILTER_KEY, false, TEST_CONTENT_DESCRIPTION, false);
EntitySearchFilter[] filters = { filter };
List<String> groupCodes = new ArrayList<String>();
groupCodes.add(Group.ADMINS_GROUP_NAME);
List<String> contentIds = this.getContentManager().loadWorkContentsId(filters, groupCodes);
for (int i = 0; i < contentIds.size(); i++) {
String contentId = (String) contentIds.get(i);
Content content = this.getContentManager().loadContent(contentId, false);
this.getContentManager().deleteContent(content);
}
}
use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.
the class AbstractEntitySearcherDAO method searchId.
@Override
public List<String> searchId(String typeCode, EntitySearchFilter[] filters) {
if (typeCode != null && typeCode.trim().length() > 0) {
EntitySearchFilter filter = new EntitySearchFilter(IEntityManager.ENTITY_TYPE_CODE_FILTER_KEY, false, typeCode, false);
EntitySearchFilter[] newFilters = this.addFilter(filters, filter);
return this.searchId(newFilters);
}
return this.searchId(filters);
}
Aggregations