No functional change
The code present on ViewGeneric.groovy has been migrated from bsh script
without deep rewrite.
I removed all unecessary or redund code to lighten the reading
(OFBIZ-11007)
Some issue has been introduce on the previous commit 6e1c7b5 [1], corrected by this one :
* the view link on ListGeneric failed
* the paginate on ListGeneric failed
I also simplify the url writing with delegate the entity path generation and translation
to two function on EntityUtil : entityToPath and getPkValuesMapFromPath
thanks to Pawan Verma to spot the pagination problem
[1] https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=6e1c7b5
(OFBIZ-11007)
After implemeted Rest mechanism on rev. 1868963 by Mathieu Lirzin,
I reviewed the rest url implemented by Artemiy Rozovyk for entitymaint in webtools.
With discussion with Mathieu and Leila, I selected this pattern :
entity/[cover]/{entityName}/{pkValues: .*}
and implemented like this :
entity/list -> list all entities
entity/find/Party -> search
entity/find/Party/Company -> displaying form for Party with id Company
entity/create/Party -> creation form for a Party
entity/edit/Party/Company/Company -> edit form for Party with id Company
entity/change/Party/Company -> call crud following given http method
entity/relations/Party -> View relation for Party
The old uris were currently kept and the oldest GenericWebEvent.updateGeneric() were updated to support rest method information.
Thanks Mathieu, Artemiy and Leila for their help to complete this improvement.
(OFBIZ-11064)
As we all know, Groovy is a powerful language with great built-in functions.
Groovy Truth[1] is one of them, which is not used properly in our code base.
We have used UtilValidate Class to validate arguments for Empty or NotEmpty,
which can easily be done in groovy with built-in functionality[1].
Current Code: if (UtilValidate.isNotEmpty(locations)) { ... }
Groovy Built-in Code: if (locations) { ... }
[1] - http://groovy-lang.org/semantics.html#Groovy-Truth
We need to careful for some points while we change this:
Like:
maxRetry = 0
if (!maxRetry)
{ // Not set, use a default maxRetry = -1 }
Because groovy evaluates zero to be false, it wouldn't be possible to set
maxRetry to zero. So it's best not to use groovy truth for null-checks on
numbers in some cases.
Thanks: Pawan Verma
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860051 13f79535-47bb-0310-9956-ffa450edef68
I found an inconsistency in the code for string comparison statusId.equals("PRUN_COMPLETED") whereas it should be written as "PRUN_COMPLETED".equals(statusId) cause the former can throw NullPointerException if the variable found to be NULL.
Thanks Devanshu Vyas for your contribution.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1795342 13f79535-47bb-0310-9956-ffa450edef68