In my task management application, users should be able to filter based on the tasks: assignedTo, priority, statusand / ordueDate
I'm not sure how to create a dynamic query so that it builds the query based on the available parameters.
For instance:
If I have a url like: task/index?assignedTo=1&status=2
I can build a query based on only these two parameters. The method I'm used to is
Task.findAllByAssignedToAndStatus(
User.get(params.assignedTo),
TaskStatus.get(params.status)
)
I obviously don’t want to implement the DRY method, writing out each findAllByrequest for every possible combination of URL parameters.
Is there a good way to do this in the grail?
source
share