/**
  * Retrieves parameters given in URL
  *
  * @param parameters - parameters in URL
  * @param model - object to be filled with data to show in the web page
  * @return - jsp page name to be returned and displayed
  */
 @RequestMapping(value = "/rstatus/{parameters:.+}", method = RequestMethod.GET)
 public String showCurrentRegressionStatusWithParameters(
     @PathVariable("parameters") String parameters, Model model) {
   urlParametersHandler.fillUrlParametersMap(parameters);
   model.addAttribute(
       "isDisplayInPrintVersion", isStatusTableToBeShownInPrintedVersion(urlParametersHandler));
   return showCurrentRegressionStatus(parameters, model);
 }
 /**
  * looking in url params a value of a 'printstatus' parameter
  *
  * @param urlParametersHandler
  * @return
  */
 private boolean isStatusTableToBeShownInPrintedVersion(
     UrlParametersHandler urlParametersHandler) {
   List<String> shouldBePrinted =
       urlParametersHandler.getUrlParameterFromMap(UrlCommand.PRINT_STATUS);
   if (shouldBePrinted != null && shouldBePrinted.size() > 0) {
     cleanUpOnReturn(urlParametersHandler, UrlCommand.PRINT_STATUS);
     return Boolean.parseBoolean(shouldBePrinted.get(0));
   }
   cleanUpOnReturn(urlParametersHandler, UrlCommand.PRINT_STATUS);
   return false;
 }
  /**
   * retrieves the ip addresses of setups to collect jsystem reports from
   *
   * @param rawRemoteStationsIpaddresses - default ip addresses appear in app.properties
   * @return list of all ips of the setups to collect jsystem reports from
   */
  public static List<String> getRemoteStationsIpaddresses(
      String rawRemoteStationsIpaddresses, UrlParametersHandler urlParametersHandler) {

    List<String> ipAddressesList = urlParametersHandler.getUrlParameterFromMap(UrlCommand.IP);
    List<String> shouldBeWithUsedDefaultIps =
        urlParametersHandler.getUrlParameterFromMap(UrlCommand.USE_WITH_DEFAULT_IPS);
    List<String> defaultIps =
        Arrays.asList(
            rawRemoteStationsIpaddresses
                .trim()
                .split(
                    AbstractCurrentRegressionStatusDataUpdaterSummaryReport
                        .MULTI_VALUES_PROPERTY_SEPARATOR));

    if (ipAddressesList == null
        || ipAddressesList.size() == 0) { // no custom ipaddresses, but only default ones
      cleanUpOnReturn(urlParametersHandler, UrlCommand.IP, UrlCommand.USE_WITH_DEFAULT_IPS);
      return defaultIps;
    }

    if (ipAddressesList != null
        && ipAddressesList.size() > 0
        && shouldBeWithUsedDefaultIps != null
        && shouldBeWithUsedDefaultIps.size() > 0) {
      boolean isDefaultIpsShouldBeUsed = Boolean.parseBoolean(shouldBeWithUsedDefaultIps.get(0));
      if (isDefaultIpsShouldBeUsed) {
        ipAddressesList.addAll(defaultIps);
      }
    }

    // after getting all params the map should be cleared from data, not to affect rstatus without
    // parameters
    cleanUpOnReturn(urlParametersHandler, UrlCommand.IP, UrlCommand.USE_WITH_DEFAULT_IPS);

    return ipAddressesList;
  }
 /**
  * after getting all params the map should be cleared from data, not to affect rstatus without
  * parameters
  *
  * @param urlParametersHandler
  * @param cmdList
  */
 private static void cleanUpOnReturn(
     UrlParametersHandler urlParametersHandler, UrlCommand... cmdList) {
   for (UrlCommand cmd : cmdList) {
     urlParametersHandler.clearUrlParameterCommand(cmd);
   }
 }