Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to programtically control Basic or Advance Search Mode for RichQuery.

919767Jun 28 2012 — edited Jul 16 2012
I have got two independent query page A and B. PageA is simple version of pageB. PageA is displayed in the menu bar as a shortcut region so that user can find certain document qucikly. There are two search fields and three buttons(search, advance, reset) in pageA.
When user press "search" button with search fields filled up, search result would be displayed in pageB.
When user press "advance" button in the pageA, pageB should be rendered in the main region in Advance Mode.
However, there is no declaratively way to dynamically control Search Mode.
I have tried following ways:

First, expose following method to DataControl via POJO class and call this method during PrepareModel or RenderModel phase. The uihint_mode has been changed during debug mode, but pageB was still in Basic SearchMode. Badly, no response even "advance" button was pressed in pageB.
public void setAdvancedMode(){
QueryDescriptor qd = (QueryDescriptor)ADFUtil.evaluateEL("#{bindings.findDocumentsByHrQuery.queryDescriptor}");
if(qd != null){
String md = qd.getUIHints().get(QueryDescriptor.UIHINT_MODE).toString();
qd.changeMode(QueryDescriptor.QueryMode.ADVANCED);
}
}

Second, like first one, but through event mechanism
public void setAdvancedMode(){
RichQuery rq = (RichQuery)ADFUtil.evaluateEL("#{pageFlowScope.TMPersonAndDocSearchQueryOperationListener.localAreaQuery}");
if(rq != null){
String md = rq.getValue().getUIHints().get(QueryDescriptor.UIHINT_MODE).toString();
QueryOperationEvent event = new QueryOperationEvent(rq, QueryOperationEvent.Operation.MODE_CHANGE, rq.getValue());
rq.getQueryOperationListeners()[0].processQueryOperation(event);
//////
//another way of using event mechnism BDGIN
//////
//rq.queueEvent(event);
//rq.refresh(FacesContext.getCurrentInstance());
//////
//another way of using event mechnism END
//////
}
}

Third, make use of RegionControl interface and register the class in the pageDef. In the class, also try event machenism and changeMode method during PrepareModel phase and RenderModel phase, unfortunately, none of them works.

Forth, since <af:query/> defined in pageB is bound in a backbean. I also tried event machenism and changeMode method when RichQuery was set in the bean, all of them failed.

I google the internet and found we do can change the SearchMode programtically, but none of the solution found over the web works.

Can you help me on this issue ?

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 13 2012
Added on Jun 28 2012
6 comments
217 views