Search in sources :

Example 46 with EntitySearchFilter

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);
}
Also used : EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Example 47 with EntitySearchFilter

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;
}
Also used : ArrayList(java.util.ArrayList) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter) HashSet(java.util.HashSet)

Example 48 with EntitySearchFilter

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;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 49 with EntitySearchFilter

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);
    }
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ArrayList(java.util.ArrayList) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Example 50 with EntitySearchFilter

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);
}
Also used : EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Aggregations

EntitySearchFilter (com.agiletec.aps.system.common.entity.model.EntitySearchFilter)157 ArrayList (java.util.ArrayList)51 Date (java.util.Date)46 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)12 RequestContext (com.agiletec.aps.system.RequestContext)9 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)7 IApsEntity (com.agiletec.aps.system.common.entity.model.IApsEntity)6 DateAttribute (com.agiletec.aps.system.common.entity.model.attribute.DateAttribute)5 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)5 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)4 BigDecimal (java.math.BigDecimal)4 HashSet (java.util.HashSet)4 ApsEntityRecord (com.agiletec.aps.system.common.entity.model.ApsEntityRecord)3 BooleanAttribute (com.agiletec.aps.system.common.entity.model.attribute.BooleanAttribute)3 ITextAttribute (com.agiletec.aps.system.common.entity.model.attribute.ITextAttribute)3 NumberAttribute (com.agiletec.aps.system.common.entity.model.attribute.NumberAttribute)3 Properties (java.util.Properties)3 DataObject (org.entando.entando.aps.system.services.dataobject.model.DataObject)3 IEntityTypesConfigurer (com.agiletec.aps.system.common.entity.IEntityTypesConfigurer)2 MonoTextAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute)2