Search in sources :

Example 56 with EntitySearchFilter

use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.

the class ContentFinderAction method restoreCommonSearchState.

@SuppressWarnings("rawtypes")
protected void restoreCommonSearchState(ContentFinderSearchInfo searchInfo) {
    if (null != searchInfo.getFilter(IContentManager.CONTENT_STATUS_FILTER_KEY)) {
        EntitySearchFilter filterToAdd = searchInfo.getFilter(IContentManager.CONTENT_STATUS_FILTER_KEY);
        this.addFilter(filterToAdd);
        this.setState((String) filterToAdd.getValue());
    }
    if (null != searchInfo.getFilter(IContentManager.CONTENT_DESCR_FILTER_KEY)) {
        EntitySearchFilter filterToAdd = searchInfo.getFilter(IContentManager.CONTENT_DESCR_FILTER_KEY);
        this.addFilter(filterToAdd);
        this.setText((String) filterToAdd.getValue());
    }
    if (null != searchInfo.getFilter(IContentManager.CONTENT_MAIN_GROUP_FILTER_KEY)) {
        EntitySearchFilter filterToAdd = searchInfo.getFilter(IContentManager.CONTENT_MAIN_GROUP_FILTER_KEY);
        this.addFilter(filterToAdd);
        this.setOwnerGroupName((String) filterToAdd.getValue());
    }
    if (null != searchInfo.getFilter(IContentManager.CONTENT_ONLINE_FILTER_KEY)) {
        EntitySearchFilter filterToAdd = searchInfo.getFilter(IContentManager.CONTENT_ONLINE_FILTER_KEY);
        this.addFilter(filterToAdd);
        this.setOnLineState(filterToAdd.isNullOption() ? "no" : "yes");
    }
    if (null != searchInfo.getFilter(IContentManager.ENTITY_ID_FILTER_KEY)) {
        EntitySearchFilter filterToAdd = searchInfo.getFilter(IContentManager.ENTITY_ID_FILTER_KEY);
        this.addFilter(filterToAdd);
        this.setContentIdToken((String) filterToAdd.getValue());
    }
}
Also used : EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Example 57 with EntitySearchFilter

use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.

the class ContentFinderSearchInfo method addAttributeFilters.

public void addAttributeFilters(EntitySearchFilter[] filtersToAdd) {
    if (null != filtersToAdd && filtersToAdd.length > 0) {
        for (int i = 0; i < filtersToAdd.length; i++) {
            EntitySearchFilter theFilter = filtersToAdd[i];
            this.addFilter(ATTRIBUTE_FILTER + theFilter.getKey(), theFilter);
        }
    }
}
Also used : EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Example 58 with EntitySearchFilter

use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.

the class AbstractApsEntityFinderAction method addFilters.

protected void addFilters(EntitySearchFilter[] filters) {
    for (int i = 0; i < filters.length; i++) {
        EntitySearchFilter filterToAdd = filters[i];
        this.addFilter(filterToAdd);
    }
}
Also used : EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Example 59 with EntitySearchFilter

use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.

the class AbstractApsEntityFinderAction method createBaseFilters.

protected void createBaseFilters() {
    try {
        int initSize = this.getFilters().length;
        EntitySearchFilter[] roleFilters = this.getEntityActionHelper().getRoleFilters(this);
        this.addFilters(roleFilters);
        IApsEntity prototype = this.getEntityPrototype();
        if (null != prototype) {
            EntitySearchFilter filterToAdd = new EntitySearchFilter(IEntityManager.ENTITY_TYPE_CODE_FILTER_KEY, false, prototype.getTypeCode(), false);
            this.addFilter(filterToAdd);
            EntitySearchFilter[] filters = this.getEntityActionHelper().getAttributeFilters(this, prototype);
            this.addFilters(filters);
        }
        this.setAddedAttributeFilter(this.getFilters().length > initSize);
    } catch (Throwable t) {
        _logger.error("Error while creating entity filters", t);
        // ApsSystemUtils.logThrowable(t, this, "createBaseFilters");
        throw new RuntimeException("Error while creating entity filters", t);
    }
}
Also used : IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Example 60 with EntitySearchFilter

use of com.agiletec.aps.system.common.entity.model.EntitySearchFilter in project entando-core by entando.

the class EntityActionHelper method getAttributeFilters.

@Override
public EntitySearchFilter[] getAttributeFilters(AbstractApsEntityFinderAction entityFinderAction, IApsEntity prototype) {
    EntitySearchFilter[] filters = new EntitySearchFilter[0];
    if (null == prototype) {
        return filters;
    }
    List<AttributeInterface> contentAttributes = prototype.getAttributeList();
    for (int i = 0; i < contentAttributes.size(); i++) {
        AttributeInterface attribute = contentAttributes.get(i);
        if (attribute.isActive() && attribute.isSearcheable()) {
            if (attribute instanceof ITextAttribute) {
                String insertedText = entityFinderAction.getSearchFormFieldValue(attribute.getName() + "_textFieldName");
                if (null != insertedText && insertedText.trim().length() > 0) {
                    EntitySearchFilter filterToAdd = new EntitySearchFilter(attribute.getName(), true, insertedText.trim(), true);
                    filters = this.addFilter(filters, filterToAdd);
                }
            } else if (attribute instanceof DateAttribute) {
                Date dateStart = this.getDateSearchFormValue(entityFinderAction, attribute.getName(), "_dateStartFieldName", true);
                Date dateEnd = this.getDateSearchFormValue(entityFinderAction, attribute.getName(), "_dateEndFieldName", false);
                if (null != dateStart || null != dateEnd) {
                    EntitySearchFilter filterToAdd = new EntitySearchFilter(attribute.getName(), true, dateStart, dateEnd);
                    filters = this.addFilter(filters, filterToAdd);
                }
            } else if (attribute instanceof BooleanAttribute) {
                String booleanValue = entityFinderAction.getSearchFormFieldValue(attribute.getName() + "_booleanFieldName");
                if (null != booleanValue && booleanValue.trim().length() > 0) {
                    EntitySearchFilter filterToAdd = new EntitySearchFilter(attribute.getName(), true, booleanValue, false);
                    filters = this.addFilter(filters, filterToAdd);
                }
            } else if (attribute instanceof NumberAttribute) {
                BigDecimal numberStart = this.getNumberSearchFormValue(entityFinderAction, attribute.getName(), "_numberStartFieldName", true);
                BigDecimal numberEnd = this.getNumberSearchFormValue(entityFinderAction, attribute.getName(), "_numberEndFieldName", false);
                if (null != numberStart || null != numberEnd) {
                    EntitySearchFilter filterToAdd = new EntitySearchFilter(attribute.getName(), true, numberStart, numberEnd);
                    filters = this.addFilter(filters, filterToAdd);
                }
            }
        }
    }
    return filters;
}
Also used : ITextAttribute(com.agiletec.aps.system.common.entity.model.attribute.ITextAttribute) BooleanAttribute(com.agiletec.aps.system.common.entity.model.attribute.BooleanAttribute) NumberAttribute(com.agiletec.aps.system.common.entity.model.attribute.NumberAttribute) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface) Date(java.util.Date) BigDecimal(java.math.BigDecimal) DateAttribute(com.agiletec.aps.system.common.entity.model.attribute.DateAttribute)

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