[ 
https://issues.apache.org/jira/browse/OFBIZ-5844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14197996#comment-14197996
 ] 

Scott Gray commented on OFBIZ-5844:
-----------------------------------

Hi Arun,

So far I've been taking the approach of "inlining" everything into the query 
that can be e.g. any variables that are used only in the query preparation such 
as select field lists, where conditions and order by lists; as well as any 
post-processing that could be done within the query itself such as 
EntityUtil.getFirst() or EntityUtil.filterByDate().  

Here's a few examples from the first few hunks of your patch 
(CommunicationEventServices.java):
Line 307: Set<String> fieldsToSelect = UtilMisc.toSet("partyId", 
"preferredContactMechId", "fromDate", "infoString");
can be replaced inline by using EntityQuery.select(...):
EntityQuery.use(delegator).select("partyId", "preferredContactMechId", 
"fromDate", "infoString").from(...)....

Line 313: List<String> orderBy = UtilMisc.toList("-fromDate");
can be replaced by using EntityQuery.orderBy("-fromDate")

Line 382: GenericValue contactListPartyStatus = 
EntityUtil.getFirst(contactListPartyStatuses);
can be replaced by using EntityQuery.queryFirst()

These are just a few examples of things to keep an eye out for.  In general I 
like to get as much of the processing into the query chain as possible so that 
you can quickly and easily see exactly what data is being returned and worked 
with.

> Convert java files to EntityQuery
> ---------------------------------
>
>                 Key: OFBIZ-5844
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5844
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL COMPONENTS
>    Affects Versions: Trunk
>            Reporter: Arun Patidar
>            Priority: Minor
>         Attachments: OFBIZ-5844-Party.patch
>
>
> Recently [~lektran] has been converted java files to use Entity Query methods 
> in place of Entity Engine methods. Components that has been converted are as 
> below:
> - content
> - humanres
> - manufacturing
> - ordermgr (partially converted)
> - Replaced findOne() method in all components
> And commit revisions are: r1635380, r1635381, r1635382 and r1635383
> Remaining components to be convert are:
> - product
> - party
> - commonext
> - securityext
> - workeffort
> - ordermgr (remaining part)
> - specialpurpose



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to