Package com.github.dandelion.datatables.core.exception

Examples of com.github.dandelion.datatables.core.exception.ConfigurationProcessingException


      String[] splittedValue = value.split("#");
      if (value.startsWith("#") || splittedValue.length != 2) {
        StringBuilder sb = new StringBuilder();
        sb.append("Wrong format used in the attribute value. ");
        sb.append("The right format is: 'bundleToAdd#javascriptObject'");
        throw new ConfigurationProcessingException(sb.toString());
      }
      else {
        if (splittedValue[0].contains(",")) {
          String[] splittedBundles = splittedValue[0].trim().split(",");
          for (String bundle : splittedBundles) {
View Full Code Here


        StringBuilder sb = new StringBuilder();
        sb.append("'");
        sb.append(this.orientation);
        sb.append("' is not a valid orientation. Possible values are: ");
        sb.append(EnumUtils.printPossibleValuesOf(Orientation.class));
        throw new ConfigurationProcessingException(sb.toString());
      }
      this.orientation = orientationEnum;
    }

    String includeHeader = request.getParameter(ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_HEADER);
View Full Code Here

  protected void doProcess() {
    Integer result = null;
    try {
      result = StringUtils.isNotBlank(stringifiedValue) ? Integer.parseInt(stringifiedValue) : null;
    } catch (NumberFormatException e) {
      throw new ConfigurationProcessingException("The value '" + stringifiedValue
          + "' cannot be parsed to Integer", e);
    }

    updateEntry(result);
  }
View Full Code Here

        case MIMETYPE:
          exportConf.setMimeType(stringifiedValue);
          break;
        }
      } else {
        throw new ConfigurationProcessingException("Format " + format + " unknown");
      }
    }
  }
View Full Code Here

        DataTablesDialect.INTERNAL_BEAN_CONFIGS, request);

    String tableId = AttributeUtils.parseStringAttribute(arguments, element, attributeName);

    if (configs != null && configs.containsKey(tableId)) {
      throw new ConfigurationProcessingException("A div with id '" + tableId
          + "' is already present in the current template.");
    }
    else {
      configs = new HashMap<String, Map<ConfType, Object>>();
    }
View Full Code Here

      StringBuilder sb = new StringBuilder();
      sb.append("'");
      sb.append(confTypeStr.trim());
      sb.append("' is not a valid configuration type. Possible values are: ");
      sb.append(EnumUtils.printPossibleValuesOf(ConfType.class));
      throw new ConfigurationProcessingException(sb.toString());
    }

    switch (confType) {
    case CALLBACK:
      processCallbackAttributes(element, configs, request, tableId);
View Full Code Here

          StringBuilder sb = new StringBuilder();
          sb.append("'");
          sb.append(stringifiedValue);
          sb.append("' is not a valid sort direction. Possible values are: ");
          sb.append(EnumUtils.printPossibleValuesOf(Direction.class));
          throw new ConfigurationProcessingException(sb.toString(), e);
        }
      }

      updateEntry(sortDirections);
    }
View Full Code Here

      div.setAttribute(DataTablesDialect.DIALECT_PREFIX + ":uid", extraHtml.getUid());
      element.getParent().addChild(div);
     
    }
    else {
      throw new ConfigurationProcessingException(
          "The attribute 'dt:uid' is required when defining an extra HTML snippet.");
    }
  }
View Full Code Here

    if (hasAttribute(element, "type")) {
      exportFormat = element.getAttributeValue(DataTablesDialect.DIALECT_PREFIX + ":type").trim().toLowerCase();
      conf = new ExportConf(exportFormat);
    } else {
      throw new ConfigurationProcessingException(
          "The attribute 'dt:type' is required when defining an export configuration.");
    }

    StringBuilder exportUrl = null;
    // Custom mode (export using controller)
    if (element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":url")) {
      exportUrl = new StringBuilder(AttributeUtils.parseStringAttribute(arguments, element,
          DataTablesDialect.DIALECT_PREFIX + ":url").trim());
      UrlUtils.addParameter(exportUrl, ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_TYPE, "c");
      conf.setHasCustomUrl(true);
    }
    // Default mode (export using filter)
    else{
      exportUrl = UrlUtils.getCurrentUri(request);
      UrlUtils.addParameter(exportUrl, ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_TYPE, "f");
      conf.setHasCustomUrl(false);
    }
   
    if (hasAttribute(element, "fileName")) {
      String fileName = getStringValue(element, "fileName");
      conf.setFileName(fileName);
      UrlUtils.addParameter(exportUrl, ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_NAME, fileName);
    }

    if (hasAttribute(element, "mimeType")) {
      String mimeType = getStringValue(element, "mimeType");
      conf.setMimeType(mimeType);
      UrlUtils.addParameter(exportUrl, ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_MIME_TYPE, mimeType);
    }

    if (hasAttribute(element, "label")) {
      conf.setLabel(getStringValue(element, "label"));
    }

    if (hasAttribute(element, "cssStyle")) {
      conf.setCssStyle(new StringBuilder(getStringValue(element, "cssStyle")));
    }

    if (hasAttribute(element, "cssClass")) {
      conf.setCssClass(new StringBuilder(getStringValue(element, "cssClass")));
    }

    if (hasAttribute(element, "includeHeader")) {
      String includeHeader = getStringValue(element, "includeHeader");
      conf.setIncludeHeader(Boolean.parseBoolean(includeHeader));
      UrlUtils.addParameter(exportUrl, ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_HEADER, includeHeader);
    }
   
    if (hasAttribute(element, "method")) {
      String methodStr = element.getAttributeValue(DataTablesDialect.DIALECT_PREFIX + ":method");

      HttpMethod methodEnum = null;
      try {
        methodEnum = HttpMethod.valueOf(methodStr.toUpperCase().trim());
      } catch (IllegalArgumentException e) {
        StringBuilder sb = new StringBuilder();
        sb.append("'");
        sb.append(methodStr);
        sb.append("' is not a valid HTTP method. Possible values are: ");
        sb.append(EnumUtils.printPossibleValuesOf(HttpMethod.class));
        throw new ConfigurationProcessingException(sb.toString());
      }

      conf.setMethod(methodEnum);
    }

    if (hasAttribute(element, "autoSize")) {
      String autosize = getStringValue(element, "autoSize");
      conf.setAutoSize(Boolean.parseBoolean(autosize));
      UrlUtils.addParameter(exportUrl, ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_AUTOSIZE, autosize);
    }

    if (hasAttribute(element, "exportClass")) {
      conf.setExportClass(getStringValue(element, "exportClass"));
    }

    if (hasAttribute(element, "fileExtension")) {
      String fileExtension = getStringValue(element, "fileExtension");
      conf.setFileExtension(fileExtension);
      UrlUtils.addParameter(exportUrl, ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_EXTENSION, fileExtension);
    }

    if (hasAttribute(element, "orientation")) {
      String orientationStr = element.getAttributeValue(DataTablesDialect.DIALECT_PREFIX + ":orientation");

      Orientation orientationEnum = null;
      try {
        orientationEnum = Orientation.valueOf(orientationStr.toUpperCase().trim());
      } catch (IllegalArgumentException e) {
        StringBuilder sb = new StringBuilder();
        sb.append("'");
        sb.append(orientationStr);
        sb.append("' is not a valid orientation. Possible values are: ");
        sb.append(EnumUtils.printPossibleValuesOf(Orientation.class));
        throw new ConfigurationProcessingException(sb.toString());
      }

      conf.setOrientation(orientationEnum);
      UrlUtils.addParameter(exportUrl, ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_ORIENTATION, orientationStr);
    }
View Full Code Here

          StringBuilder sb = new StringBuilder();
          sb.append("'");
          sb.append(typeStr);
          sb.append("' is not a valid callback type. Possible values are: ");
          sb.append(EnumUtils.printPossibleValuesOf(CallbackType.class));
          throw new ConfigurationProcessingException(sb.toString());
        }

        if (configs.get(tableId).containsKey(ConfType.CALLBACK)) {
          List<Callback> callbacks = (List<Callback>) configs.get(tableId).get(ConfType.CALLBACK);

          if (Callback.hasCallback(callbackType, callbacks)) {
            Callback.findByType(callbackType, callbacks).appendCode(
                (callbackType.hasReturn() ? "return " : "") + functionStr + "("
                    + StringUtils.join(callbackType.getArgs(), ",") + ");");
          } else {
            callbacks.add(new Callback(callbackType, (callbackType.hasReturn() ? "return " : "")
                + functionStr + "(" + StringUtils.join(callbackType.getArgs(), ",") + ");"));
          }
        } else {
          List<Callback> callbacks = new ArrayList<Callback>();
          callbacks.add(new Callback(callbackType, (callbackType.hasReturn() ? "return " : "") + functionStr
              + "(" + StringUtils.join(callbackType.getArgs(), ",") + ");"));

          configs.get(tableId).put(ConfType.CALLBACK, callbacks);
        }
      } else {
        throw new ConfigurationProcessingException("The attribute '" + DataTablesDialect.DIALECT_PREFIX
            + ":function' is required when defining a callback.");
      }
    } else {
      throw new ConfigurationProcessingException("The attribute '" + DataTablesDialect.DIALECT_PREFIX
          + ":type' is required when defining a callback.");
    }
  }
View Full Code Here

TOP

Related Classes of com.github.dandelion.datatables.core.exception.ConfigurationProcessingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.