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());
}
}
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);
}
}
}
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);
}
}
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);
}
}
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;
}
Aggregations