use of com.agiletec.aps.system.common.FieldSearchFilter in project entando-core by entando.
the class RestListRequest method buildFieldSearchFilters.
@SuppressWarnings("rawtypes")
public List<FieldSearchFilter> buildFieldSearchFilters() {
List<FieldSearchFilter> fieldSearchFilters = new ArrayList<>();
if (null != filters && filters.length > 0) {
Arrays.stream(filters).forEach(i -> fieldSearchFilters.add(i.getFieldSearchFilter()));
}
FieldSearchFilter pageFilter = this.buildPaginationFilter();
if (null != pageFilter) {
fieldSearchFilters.add(pageFilter);
}
FieldSearchFilter sortFilter = this.buildSortFilter();
if (null != sortFilter) {
fieldSearchFilters.add(sortFilter);
}
return fieldSearchFilters;
}
use of com.agiletec.aps.system.common.FieldSearchFilter in project entando-core by entando.
the class DataObjectModelManager method getDataObjectModels.
@Override
public SearcherDaoPaginatedResult<DataObjectModel> getDataObjectModels(List<FieldSearchFilter> filters) throws ApsSystemException {
SearcherDaoPaginatedResult<DataObjectModel> pagedResult = null;
try {
List<DataObjectModel> dataObjectModels = new ArrayList<>();
FieldSearchFilter[] filtersArray = filters.toArray(new FieldSearchFilter[filters.size()]);
int count = this.getDataModelDAO().countDataObjectModels(filtersArray);
List<Long> codes = this.searchDataObjectModels(filtersArray);
for (Long code : codes) {
dataObjectModels.add(this.getDataObjectModel(code));
}
pagedResult = new SearcherDaoPaginatedResult<>(count, dataObjectModels);
} catch (Throwable t) {
logger.error("Error searching models", t);
throw new ApsSystemException("Error searching models", t);
}
return pagedResult;
}
use of com.agiletec.aps.system.common.FieldSearchFilter in project entando-core by entando.
the class GuiFragmentManager method searchGuiFragments.
@Override
public List<String> searchGuiFragments(FieldSearchFilter[] filters) throws ApsSystemException {
List<String> guiFragments = null;
try {
FieldSearchFilter filter = new FieldSearchFilter("code");
filter.setOrder(FieldSearchFilter.Order.ASC);
filters = this.addFilter(filters, filter);
guiFragments = this.getGuiFragmentDAO().searchGuiFragments(filters);
} catch (Throwable t) {
logger.error("Error searching GuiFragments", t);
throw new ApsSystemException("Error searching GuiFragments", t);
}
return guiFragments;
}
use of com.agiletec.aps.system.common.FieldSearchFilter in project entando-core by entando.
the class GuiFragmentManager method searchFragments.
protected Set<String> searchFragments(String strToSearch, String column) throws ApsSystemException {
FieldSearchFilter filterTag = new FieldSearchFilter(column, "<@wp.fragment", true);
FieldSearchFilter[] filters1 = new FieldSearchFilter[] { filterTag };
List<String> result1 = this.searchGuiFragments(filters1);
FieldSearchFilter filterCode = new FieldSearchFilter(column, strToSearch, true);
FieldSearchFilter[] filters2 = new FieldSearchFilter[] { filterCode };
List<String> result2 = this.searchGuiFragments(filters2);
Set<String> result = new HashSet<>();
result.addAll(result1);
result.addAll(result2);
return result;
}
use of com.agiletec.aps.system.common.FieldSearchFilter in project entando-core by entando.
the class GuiFragmentManager method getGuiFragmentCodesByWidgetType.
@Override
@CachePut(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'GuiFragment_codesByWidgetType_'.concat(#widgetTypeCode)")
// TODO improve group handling
@CacheableInfo(groups = "'GuiFragment_codesByWidgetTypeGroup'")
public List<String> getGuiFragmentCodesByWidgetType(String widgetTypeCode) throws ApsSystemException {
List<String> codes = null;
try {
FieldSearchFilter filter = new FieldSearchFilter("widgettypecode", widgetTypeCode, false);
filter.setOrder(FieldSearchFilter.Order.ASC);
FieldSearchFilter[] filters = { filter };
codes = this.searchGuiFragments(filters);
} catch (Throwable t) {
logger.error("Error loading fragments code by widget '{}'", widgetTypeCode, t);
throw new ApsSystemException("Error loading fragment codes by widget " + widgetTypeCode, t);
}
return codes;
}
Aggregations