gwt requestFactory search

GWT RequestFactory is nice while saving/update the data, using as below:

EmployeeRequest request = requestFactory.employeeRequest();
EmployeeProxy newEmployee = request.create(EmployeeProxy.class);
newEmployee.setName("Joe!");

Request<Void> createReq = request.persist().using(newEmployee);
createReq.fire();

and we use remove instead of persist to delete.

Then how about Search using RequestFactory. Say my domain object is Employee with name, login & address. All three fields are optional for search, Can we achieve this using RequestFactory? or we should use RPC?

Regards

Answers


Using your example, you can find user with RequestFactory like this:

request.employeeRequest().find(newEmployee).with("name", "login", "address");

You could do it in several ways, very similar to how you'd do it with GWT-RPC:

  • request.findEmployees(optionalName, optionalLogin, optionalAddress).fire(new Receiver<List<EmployeeProxy>>() { … })
  • EmployeeSearchProxy search = request.create(EmployeeSearchProxy.class); search.setName(optionalName); search.setLogin(optionalLogin); search.setAddress(optionalAddress); request.findEmployees(search).fire(new Receiver<List<EmployeeProxy>>() { … })

Need Your Help

Batch file for loop /D flag not appearing in command line

windows batch-file

I've got a small batch file that I want to use to copy a file from one location to many locations that may have different name.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.