Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-9287

Refactor the runAction method in AbstractModelAction, ModelFormAction and ModelTreeAction classes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • None
    • 17.12.01
    • None

    Description

      This 3 methods share a pattern which should be refactored in a common protected method. The pattern is

      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);
      }
      

      Enough for a refactor I'd say.

      Attachments

        Activity

          People

            jleroux Jacques Le Roux
            jleroux Jacques Le Roux
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: