Standard ADF inputListOfValues component should behave like this:
- When pressed “Search”, action should stop and wait untill any change happen in DB table being searched
- When change happen in DB table, search should resume among updated data. If no change happen it should resume after 10 seconds timeout
- In addition – search input field validation should happen on “Search” press. If there is no at least one field filled with at least 3 symbols – error should be shown.
- Create a separate class which extends ListOfValuesModel, put custom logic there for validation and processing query
- Use Continuous Query Notification (CQN) or in earlier Java releases called Database Change Notification (DCN) for delivering event from DB to application
- Use Java latches (CountDownLatc) for suspending and resuming search after either an event from DB or timeout occurs.
- Configure LOV for departmentId in EmployeesView. Set UI hint for list type “Input Text With List of Values”. Create main.jspx file and drag’n’drop EmpoyeesView data control into it, render as regular ADF table. Check whether inputListOfValues component is rendered for departmentId attribute:
- Create a managed bean mainBean.java for main.jspx and put there getter of inputListOfValues model. Reassign model in main.jspx.
- Get back to custom model class ListOfValuesModelEx. Put necessary validation and change subscribtion logic into method performQuery. Special attention to CountDownLatch utility here – it is used to suspend query execution and wait either till it is notified from the CQN listener or timeout occurs. The key points are emphasized in red:
For more detailed sample description of Continuous Query Notification (CQN/DCN) usage, please have a glimpse to my previous post: WebSocket together with DB Change Notification in ADF for immediate data refresh in browser (complete sample).