[jira] [Created] (OFBIZ-9287) Refactor the runAction method in AbstractModelAction, ModelFormAction and ModelTreeAction classes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (OFBIZ-9287) Refactor the runAction method in AbstractModelAction, ModelFormAction and ModelTreeAction classes

Nicolas Malin (Jira)
Jacques Le Roux created OFBIZ-9287:
--------------------------------------

             Summary: Refactor the runAction method in AbstractModelAction, ModelFormAction and ModelTreeAction classes
                 Key: OFBIZ-9287
                 URL: https://issues.apache.org/jira/browse/OFBIZ-9287
             Project: OFBiz
          Issue Type: Improvement
            Reporter: Jacques Le Roux
            Priority: Minor


This 3 methods share a pattern which should be refactored in a common protected method. The pattern is
{code}
if (!this.resultMapNameAcsr.isEmpty()) {
    this.resultMapNameAcsr.put(context, result);
    String queryString = (String) result.get("queryString");
    context.put("queryString", queryString);
    context.put("queryStringMap", result.get("queryStringMap"));
    if (UtilValidate.isNotEmpty(queryString)) {
        try {
            String queryStringEncoded = queryString.replaceAll("&", "%26");
            context.put("queryStringEncoded", queryStringEncoded);
        } catch (PatternSyntaxException e) {
         // obviously a PatternSyntaxException should not occur here
        }
    }
} else {
    context.putAll(result);
}
{code}
Enough for a refactor I'd say.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)