use of org.activityinfo.shared.command.GenerateElement in project activityinfo by bedatadriven.
the class SearchHandler method processFilter.
private void processFilter(final ExecutionContext context, final AsyncCallback<SearchResult> callback, final Filter resultFilter) {
final SearchResult searchResult = new SearchResult();
if (resultFilter.getRestrictedDimensions().size() > 0) {
// pivot data query
final PivotTableReportElement pivotTable = createSearchPivotTableElement();
pivotTable.setFilter(resultFilter);
GenerateElement<PivotContent> zmd = new GenerateElement<PivotContent>(pivotTable);
context.execute(zmd, new AsyncCallback<PivotContent>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(PivotContent content) {
content.setEffectiveFilter(resultFilter);
searchResult.setPivotTabelData(content);
// recent sites query
GetSites getSites = createGetSitesCommand(resultFilter);
context.execute(getSites, new AsyncCallback<SiteResult>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(SiteResult resultSites) {
searchResult.setRecentAdditions(resultSites.getData());
callback.onSuccess(searchResult);
}
});
}
});
} else {
// Return empty searchresult when no filtered entities found
callback.onSuccess(searchResult);
}
}
Aggregations