Hi,
from ProductDisplayWorker.java, lines 171-176, there is an array used, which contains only one value. Is it OK with you to remove this declaration and simplify the code ? Regards, // get all order role entities for user by customer role type // final String[] USER_ORDER_ROLE_TYPES = {"END_USER_CUSTOMER", "SHIP_TO_CUSTOMER", "BILL_TO_CUSTOMER", "PLACING_CUSTOMER"}; final String[] USER_ORDER_ROLE_TYPES = {"PLACING_CUSTOMER"}; for (int i = 0; i < USER_ORDER_ROLE_TYPES.length; i++) { List<GenericValue> orderRoles = delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", USER_ORDER_ROLE_TYPES[i]), null); -- Erwan de FERRIERES www.nereide.biz |
For me, it makes happy when code get cleaned as we go.
On Thu, Mar 29, 2012 at 4:55 PM, Erwan de FERRIERES <[hidden email]> wrote: > Hi, > > from ProductDisplayWorker.java, lines 171-176, there is an array used, which > contains only one value. Is it OK with you to remove this declaration and > simplify the code ? > > Regards, > > // get all order role entities for user by customer role type > // final String[] USER_ORDER_ROLE_TYPES = > {"END_USER_CUSTOMER", "SHIP_TO_CUSTOMER", "BILL_TO_CUSTOMER", > "PLACING_CUSTOMER"}; > final String[] USER_ORDER_ROLE_TYPES = {"PLACING_CUSTOMER"}; > > for (int i = 0; i < USER_ORDER_ROLE_TYPES.length; i++) { > List<GenericValue> orderRoles = > delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", > userLogin.get("partyId"), "roleTypeId", USER_ORDER_ROLE_TYPES[i]), null); > -- > Erwan de FERRIERES > www.nereide.biz |
Administrator
|
+1, don't see the need from code snippet in Erwan's email (ie did not check code, but I guess it does not make sense to have an
array with 1 value) Jacques From: "Mansour Al Akeel" <[hidden email]> > For me, it makes happy when code get cleaned as we go. > > > > On Thu, Mar 29, 2012 at 4:55 PM, Erwan de FERRIERES > <[hidden email]> wrote: >> Hi, >> >> from ProductDisplayWorker.java, lines 171-176, there is an array used, which >> contains only one value. Is it OK with you to remove this declaration and >> simplify the code ? >> >> Regards, >> >> // get all order role entities for user by customer role type >> // final String[] USER_ORDER_ROLE_TYPES = >> {"END_USER_CUSTOMER", "SHIP_TO_CUSTOMER", "BILL_TO_CUSTOMER", >> "PLACING_CUSTOMER"}; >> final String[] USER_ORDER_ROLE_TYPES = {"PLACING_CUSTOMER"}; >> >> for (int i = 0; i < USER_ORDER_ROLE_TYPES.length; i++) { >> List<GenericValue> orderRoles = >> delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", >> userLogin.get("partyId"), "roleTypeId", USER_ORDER_ROLE_TYPES[i]), null); >> -- >> Erwan de FERRIERES >> www.nereide.biz > |
In reply to this post by Mansour
Hi Erwan,
Why this question? Shouldn't having made a JIRA issue for this not have been enough? It seems to me that starting a discussion for every piece of code here is overkill. Regards, Pierre Op 30 maart 2012 07:15 schreef Mansour Al Akeel <[hidden email]>het volgende: > For me, it makes happy when code get cleaned as we go. > > > > On Thu, Mar 29, 2012 at 4:55 PM, Erwan de FERRIERES > <[hidden email]> wrote: > > Hi, > > > > from ProductDisplayWorker.java, lines 171-176, there is an array used, > which > > contains only one value. Is it OK with you to remove this declaration and > > simplify the code ? > > > > Regards, > > > > // get all order role entities for user by customer role > type > > // final String[] USER_ORDER_ROLE_TYPES = > > {"END_USER_CUSTOMER", "SHIP_TO_CUSTOMER", "BILL_TO_CUSTOMER", > > "PLACING_CUSTOMER"}; > > final String[] USER_ORDER_ROLE_TYPES = > {"PLACING_CUSTOMER"}; > > > > for (int i = 0; i < USER_ORDER_ROLE_TYPES.length; i++) { > > List<GenericValue> orderRoles = > > delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", > > userLogin.get("partyId"), "roleTypeId", USER_ORDER_ROLE_TYPES[i]), null); > > -- > > Erwan de FERRIERES > > www.nereide.biz > |
Le 30/03/2012 08:25, Pierre Smits a écrit :
> Hi Erwan, > > Why this question? Shouldn't having made a JIRA issue for this not have > been enough? It seems to me that starting a discussion for every piece of > code here is overkill. > Just to check if someone knew why the array was still used, and why it has been not replaced when reduced to 1 element. Cheers, -- Erwan de FERRIERES www.nereide.biz |
Yeah, I would do the same to make sure I am not breaking anything, if
I am not sure about that piece of code. On Fri, Mar 30, 2012 at 2:13 PM, Erwan de FERRIERES <[hidden email]> wrote: > Le 30/03/2012 08:25, Pierre Smits a écrit : > >> Hi Erwan, >> >> Why this question? Shouldn't having made a JIRA issue for this not have >> been enough? It seems to me that starting a discussion for every piece of >> code here is overkill. >> > > Just to check if someone knew why the array was still used, and why it has > been not replaced when reduced to 1 element. > > Cheers, > > > -- > Erwan de FERRIERES > www.nereide.biz |
Free forum by Nabble | Edit this page |