on 03-28-2007 7:58 PM
Hello,
I created an entity service called A with 3 attributes: description (string), startDate (date) and endDate (date). I need to have a find operation that retrieves all A instances where startDate and endDate are in specific ranges of date.
For example, operation needs to return all instances where startDate is between 01/03/2007 and 05/03/2007 and/or my endDate is between 10/03/2007 and 15/03/2007.
Is it possible to do using entity services operations ? If yes, how can I do that ?
Thanks in advance,
Hi Helder,
Create a findBy method (findbyDateRange) for the entity service with the fromDate and toDate as input parameters. In the app service create a method with four input parameters of type caf.core.timestamp/date (fromdateStart, fromdateEnd and todateStart and todateEnd). In the method implementation write :
//instantiate query filters
QueryFilter qfInputfromDate = new QueryFilter(fromdateStart, fromdateEnd);
QueryFilter qfInputtoDate = new QueryFilter(todateStart, todateEnd);
//get entity service instance
myEntityServiceLocal entityServiceInstance = this.getmyEntityService();
//call entity service method
List dataList = entityServiceInstance.findbyDateRange(qfInputfromDate, qfInputtoDate);
for(int i=0; i<dataList.size();i++)
{
myEntityService data = (myEntityService) dataList.get(i);
//do your custom processing
}
retValue = dataList;
Hope this helps.
Thanks,
Dipankar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.