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

Taher Alkhateeb commented on OFBIZ-6986:
----------------------------------------

Hi Kulwant,

First of all, thank you for the great efforts. I checked your patch and I have 
the below comments:

- Your code suffers from copy and paste patterns. You are repeating the below 
code in each function:
{code:java}
Delegator delegator = (Delegator) params.get("delegator");
String partyId = (String) params.get("partyId");
String onclickFunction = (String) params.get("onclickFunction");
String additionParam = (String) params.get("additionParam");ata 
String hrefString = (String) params.get("hrefString");
String hrefString2 = (String) params.get("hrefString2");
{code}

So the fix for that is to build a map once and pass it to all the functions. 
The code would be much cleaner and you would shave off at least 20 lines of 
code.

- The list building logic is still relatively complex and can be further 
simplified. Right now, JSON syntax building is still mixed with normal data 
processing. If you separate the two, your code would be much cleaner.

- The signatures of the methods are complex and exception handling should be 
unified, the try and catch blocks sprinkled every where are making the code 
rather unpleasant.

If you feel comfortable with these changes, then please go ahead, if you need 
any help with any of that stuff then please us and we'll try our best to help 
out.

> Simplify getChildHRCategoryTree
> -------------------------------
>
>                 Key: OFBIZ-6986
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-6986
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL APPLICATIONS, humanres
>            Reporter: Kulwant
>            Assignee: Pranay Pandey
>         Attachments: OFBIZ-6986.patch, OFBIZ-6986.patch
>
>
> breaking the single long method to multiple private functions with improved 
> exception handling.



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

Reply via email to