예제 #1
0
  @Override
  public void validateSpecificParameters(final Map<String, String> params) {
    super.validateSpecificParameters(params);

    final Object pageSizeObj = params.get(ApiConstants.PAGE_SIZE);
    Long pageSize = null;
    if (pageSizeObj != null) {
      pageSize = Long.valueOf((String) pageSizeObj);
    }

    if (params.get(ApiConstants.PAGE) == null
        && pageSize != null
        && !pageSize.equals(BaseListCmd.s_pageSizeUnlimited)) {
      final ServerApiException ex =
          new ServerApiException(
              ApiErrorCode.PARAM_ERROR,
              "\"page\" parameter is required when \"pagesize\" is specified");
      ex.setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ex.getClass().getName()));
      throw ex;
    } else if (pageSize == null && (params.get(ApiConstants.PAGE) != null)) {
      throw new ServerApiException(
          ApiErrorCode.PARAM_ERROR,
          "\"pagesize\" parameter is required when \"page\" is specified");
    }
  }