on 05-24-2007 10:10 AM
Hi Experts,
I have an Entity called Client with a query method called findById which returns a client. I also have an Application Service called ClientAppService which has a method updateClient which needs to retrieve a certain Client and perform some operations on it. The signature looks as follow:
// Pass Client ID in.
public boolean updateClient(java.lang.String arg0) {
// Retrieve Client matching the ID
// Perform operations on the Client
}
I've tried retrieving the Client through the Entity's findById method, but it takes a QueryString as a parameter, not an ID.
getClientService().findById(/* QueryString */);
Is there anyway to retrieve the Client from inside the Application Service by only specifying the Client ID, or do I have to instantiate a QueryString and if so how should I do that?
Thanks,
JP
Hi,
You can call the findBy() methods of entity service from an application service method by passing the QueryFilter as input.
For instantiating the QueryFilter and filling the input data write the following line of code:
QueryFilter qfInput = new QueryFilter(clientID, "==");
then :
List result = this.getClientService().findById(qfInput);
Thanks,
Dipankar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Dipankar,
What should I do with arg0, which contains the client ID to search for?
Also, if I wanted to change the method to return the Clients after modifying them, what should the return type be? I can make it a list, but I would like to bind them to a Context Model Node in the same way I can bind the Entity's getAll method to a Model Node?
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.