use of org.alfresco.web.bean.search.SearchContext in project acs-community-packaging by Alfresco.
the class CategoryBrowserBean method generateCategorySearchContext.
public SearchContext generateCategorySearchContext() {
SearchContext categorySearch = new SearchContext();
String[] categories = new String[1];
categories[0] = SearchContext.getPathFromSpaceRef(currentCategory, includeSubcategories);
categorySearch.setText("");
categorySearch.setCategories(categories);
return categorySearch;
}
use of org.alfresco.web.bean.search.SearchContext in project acs-community-packaging by Alfresco.
the class UISimpleSearch method broadcast.
/**
* @see javax.faces.component.UICommand#broadcast(javax.faces.event.FacesEvent)
*/
public void broadcast(FacesEvent event) throws AbortProcessingException {
FacesContext fc = getFacesContext();
if (event instanceof SearchEvent) {
// update the component parameters from the search event details
SearchEvent searchEvent = (SearchEvent) event;
// construct the Search Context object
SearchContext context = new SearchContext();
context.setText(searchEvent.SearchText);
context.setMode(searchEvent.SearchMode);
context.setForceAndTerms(Application.getClientConfig(fc).getForceAndTerms());
context.setSimpleSearchAdditionalAttributes(Application.getClientConfig(fc).getSimpleSearchAdditionalAttributes());
this.search = context;
super.broadcast(event);
} else if (event instanceof AdvancedSearchEvent) {
// special case to navigate to the advanced search screen
AdvancedSearchEvent searchEvent = (AdvancedSearchEvent) event;
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, searchEvent.Outcome);
// NOTE: we don't call super() here so that our nav outcome is the one that occurs!
}
}
use of org.alfresco.web.bean.search.SearchContext in project acs-community-packaging by Alfresco.
the class UICategoryBrowser method broadcast.
/*
* (non-Javadoc)
*
* @see org.alfresco.extension.web.ui.repo.component.UINavigator#broadcast(javax.faces.event.FacesEvent)
*/
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException {
if (event instanceof CategoryBrowserEvent) {
FacesContext context = FacesContext.getCurrentInstance();
CategoryBrowserEvent categoryBrowseEvent = (CategoryBrowserEvent) event;
NodeRef nodeClicked = new NodeRef(categoryBrowseEvent.getItem());
boolean subcategories = categoryBrowseEvent.isIncludeSubcategories();
if (logger.isDebugEnabled())
logger.debug("Selected category: " + nodeClicked + " subcategories? " + subcategories);
CategoryBrowserBean categoryBrowserBean = (CategoryBrowserBean) FacesHelper.getManagedBean(context, CategoryBrowserBean.BEAN_NAME);
categoryBrowserBean.setCurrentCategory(nodeClicked);
categoryBrowserBean.setIncludeSubcategories(subcategories);
SearchContext categorySearch = categoryBrowserBean.generateCategorySearchContext();
NavigationBean nb = (NavigationBean) FacesHelper.getManagedBean(context, NavigationBean.BEAN_NAME);
nb.setSearchContext(categorySearch);
context.getApplication().getNavigationHandler().handleNavigation(context, null, "category-browse");
} else {
super.broadcast(event);
}
}
Aggregations