public void validateForClose(final String json) {
    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("ticketmaster");

    final JsonElement element = fromApiJsonHelper.parse(json);

    final Integer status =
        Integer.parseInt(fromApiJsonHelper.extractStringNamed("status", element));
    final String resolutionDescription =
        fromApiJsonHelper.extractStringNamed("resolutionDescription", element);

    baseDataValidator
        .reset()
        .parameter("status")
        .value(status)
        .notBlank()
        .notExceedingLengthOf(100);
    baseDataValidator
        .reset()
        .parameter("resolutionDescription")
        .value(resolutionDescription)
        .notBlank()
        .notExceedingLengthOf(100);

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
  @Override
  public RoleCommand commandFromApiJson(final String json) {

    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final JsonElement element = fromApiJsonHelper.parse(json);
    final String name = fromApiJsonHelper.extractStringNamed("name", element);
    final String description = fromApiJsonHelper.extractStringNamed("description", element);

    return new RoleCommand(name, description);
  }
  public void validateForCreateInteractive(String json) {

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("interactivedetail");

    final JsonElement element = fromApiJsonHelper.parse(json);

    final JsonArray interactiveDataArray =
        fromApiJsonHelper.extractJsonArrayNamed("activeData", element);
    String[] interactiveDataArrayAttributes = null;
    interactiveDataArrayAttributes = new String[interactiveDataArray.size()];
    int interactiveDataSize = interactiveDataArray.size();
    baseDataValidator.reset().parameter(null).value(interactiveDataSize).integerGreaterThanZero();

    for (int i = 0; i < interactiveDataArray.size(); i++) {
      interactiveDataArrayAttributes[i] = interactiveDataArray.get(i).toString();
    }

    for (String singleinteractiveData : interactiveDataArrayAttributes) {

      final JsonElement elements = fromApiJsonHelper.parse(singleinteractiveData);

      final Long playSource = fromApiJsonHelper.extractLongNamed("playSource", elements);
      baseDataValidator.reset().parameter("playSource").value(playSource).notBlank();

      final String contentName = fromApiJsonHelper.extractStringNamed("contentName", elements);
      baseDataValidator.reset().parameter("contentName").value(contentName).notBlank();

      final Long contentProvider = fromApiJsonHelper.extractLongNamed("contentProvider", elements);
      baseDataValidator.reset().parameter("contentProvider").value(contentProvider).notBlank();

      final Long channelName = fromApiJsonHelper.extractLongNamed("channelName", elements);
      baseDataValidator.reset().parameter("channelName").value(channelName).notBlank();

      final Long serviceName = fromApiJsonHelper.extractLongNamed("serviceName", elements);
      baseDataValidator.reset().parameter("serviceName").value(serviceName).notBlank();

      final BigDecimal endUserPrice =
          fromApiJsonHelper.extractBigDecimalWithLocaleNamed("endUserPrice", elements);
      baseDataValidator.reset().parameter("endUserPrice").value(endUserPrice).notBlank();

      final BigDecimal grossRevenue =
          fromApiJsonHelper.extractBigDecimalWithLocaleNamed("grossRevenue", elements);
      baseDataValidator.reset().parameter("grossRevenue").value(grossRevenue).notBlank();

      final Long downloads = fromApiJsonHelper.extractLongNamed("downloads", elements);
      baseDataValidator.reset().parameter("downloads").value(downloads).notBlank();

      // final Long sequence = fromApiJsonHelper.extractLongNamed("sequence", elements);
      // baseDataValidator.reset().parameter("sequence").value(sequence).notBlank();

      throwExceptionIfValidationWarningsExist(dataValidationErrors);
    }
  }
  /** Validation for Create Ticket */
  public void validateForCreate(final String json) {

    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("ticketmaster");

    final JsonElement element = fromApiJsonHelper.parse(json);

    final String priority = fromApiJsonHelper.extractStringNamed("priority", element);
    final String problemCode = fromApiJsonHelper.extractStringNamed("problemCode", element);
    final String description = fromApiJsonHelper.extractStringNamed("description", element);
    final String assignedTo = fromApiJsonHelper.extractStringNamed("assignedTo", element);

    baseDataValidator
        .reset()
        .parameter("problemCode")
        .value(problemCode)
        .notBlank()
        .notExceedingLengthOf(100);
    baseDataValidator
        .reset()
        .parameter("priority")
        .value(priority)
        .notBlank()
        .notExceedingLengthOf(100);
    baseDataValidator
        .reset()
        .parameter("assignedTo")
        .value(assignedTo)
        .notBlank()
        .notExceedingLengthOf(100);
    baseDataValidator.reset().parameter("description").value(description).notBlank();

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
  public void validateForCreate(String json) {

    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }
    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParams);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseValidatorBuilder =
        new DataValidatorBuilder(dataValidationErrors);

    final JsonElement element = fromJsonHelper.parse(json);

    final String supplierCode = fromJsonHelper.extractStringNamed("supplierCode", element);
    final String supplierDescription =
        fromJsonHelper.extractStringNamed("supplierDescription", element);
    final String supplierAddress = fromJsonHelper.extractStringNamed("supplierAddress", element);

    baseValidatorBuilder
        .reset()
        .parameter("supplierCode")
        .value(supplierCode)
        .notBlank()
        .notExceedingLengthOf(10);
    baseValidatorBuilder
        .reset()
        .parameter("supplierDescription")
        .value(supplierDescription)
        .notBlank()
        .notExceedingLengthOf(100);
    baseValidatorBuilder
        .reset()
        .parameter("supplierAddress")
        .value(supplierAddress)
        .notBlank()
        .notExceedingLengthOf(100);

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
  public void validateForCreate(final String json) {
    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("onetimesale");

    final JsonElement element = fromApiJsonHelper.parse(json);

    final LocalDate saleDate = fromApiJsonHelper.extractLocalDateNamed("saleDate", element);
    baseDataValidator.reset().parameter("saleDate").value(saleDate).notBlank();
    final Long itemId = fromApiJsonHelper.extractLongNamed("itemId", element);
    baseDataValidator.reset().parameter("itemId").value(itemId).notNull();
    final String quantity = fromApiJsonHelper.extractStringNamed("quantity", element);
    baseDataValidator
        .reset()
        .parameter("quantity")
        .value(quantity)
        .notBlank()
        .integerGreaterThanZero()
        .notExceedingLengthOf(50);
    final Long discountId = fromApiJsonHelper.extractLongNamed("discountId", element);
    baseDataValidator.reset().parameter("discountId").value(discountId).notNull();
    final String chargeCode = fromApiJsonHelper.extractStringNamed("chargeCode", element);
    baseDataValidator.reset().parameter("chargeCode").value(chargeCode).notBlank();
    final BigDecimal totalPrice =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed("totalPrice", element);
    baseDataValidator.reset().parameter("totalPrice").value(totalPrice).notNull();
    final BigDecimal unitPrice =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed("unitPrice", element);
    baseDataValidator.reset().parameter("unitPrice").value(unitPrice).notNull();

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
  public void validateForCreate(final String json) {
    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("itemsale");

    final JsonElement element = fromApiJsonHelper.parse(json);

    final String agentId = fromApiJsonHelper.extractStringNamed("agentId", element);
    baseDataValidator.reset().parameter("agentId").value(agentId).notNull();
    final String itemId = fromApiJsonHelper.extractStringNamed("itemId", element);
    baseDataValidator.reset().parameter("itemId").value(itemId).notNull();
    final LocalDate purchaseDate = fromApiJsonHelper.extractLocalDateNamed("purchaseDate", element);
    baseDataValidator.reset().parameter("purchaseDate").value(purchaseDate).notBlank();

    final Long orderQuantity = fromApiJsonHelper.extractLongNamed("orderQuantity", element);
    baseDataValidator
        .reset()
        .parameter("orderQuantity")
        .value(orderQuantity)
        .notNull()
        .integerGreaterThanZero();
    final BigDecimal chargeAmount =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed("chargeAmount", element);
    baseDataValidator.reset().parameter("chargeAmount").value(chargeAmount).notNull();
    final BigDecimal taxAmount =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed("taxAmount", element);
    baseDataValidator.reset().parameter("taxAmount").value(chargeAmount).notNull();

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
  public void validateForCreateDeduction(String json) {

    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final List<ApiParameterError> dataValidatorErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidatorErrors).resource("operator.deduction");

    final JsonElement element = fromApiJsonHelper.parse(json);

    final JsonArray deductionData =
        fromApiJsonHelper.extractJsonArrayNamed("deductionData", element);

    String[] chStringArray = new String[deductionData.size()];
    int chStringArraySize = deductionData.size();
    /*baseDataValidator.reset().parameter(null).value(chStringArraySize).integerGreaterThanZero();*/

    for (int i = 0; i < chStringArraySize; i++) {
      chStringArray[i] = deductionData.get(i).toString();
    }

    final Long clientId = fromApiJsonHelper.extractLongNamed("clientId", element);
    baseDataValidator.reset().parameter("clientId").value(clientId).notBlank();
    throwExceptionIfValidationWarningsExist(dataValidatorErrors);

    for (String s : chStringArray) {

      final JsonElement el = fromApiJsonHelper.parse(s);

      final String deductionCode = fromApiJsonHelper.extractStringNamed("deductionCode", el);
      baseDataValidator.reset().parameter("deductionCode").value(deductionCode).notBlank();

      final BigDecimal deductionValue =
          fromApiJsonHelper.extractBigDecimalWithLocaleNamed("deductionValue", el);
      baseDataValidator
          .reset()
          .parameter("deductionValue")
          .value(deductionValue)
          .notBlank()
          .inMinAndMaxAmountRange(BigDecimal.ZERO, BigDecimal.valueOf(100));

      throwExceptionIfValidationWarningsExist(dataValidatorErrors);
    }
  }
  public void validateForUpdate(final String json) {
    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("role");

    final JsonElement element = fromApiJsonHelper.parse(json);

    if (fromApiJsonHelper.parameterExists("name", element)) {
      final String username = fromApiJsonHelper.extractStringNamed("name", element);
      baseDataValidator
          .reset()
          .parameter("name")
          .value(username)
          .notBlank()
          .notExceedingLengthOf(100);
    }

    if (fromApiJsonHelper.parameterExists("description", element)) {
      final String description = fromApiJsonHelper.extractStringNamed("description", element);
      baseDataValidator
          .reset()
          .parameter("description")
          .value(description)
          .notBlank()
          .notExceedingLengthOf(500);
    }

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
  public void validateForUpdateDeductionCode(String json) {
    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(
        typeOfMap, json, supportedParametersForUpdateDeductionCode);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("currency");

    final JsonElement element = fromApiJsonHelper.parse(json);

    final String deductionCode = fromApiJsonHelper.extractStringNamed("deductionCode", element);
    baseDataValidator.reset().parameter("deductionCode").value(deductionCode).notBlank();

    final BigDecimal deductionValue =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed("deductionValue", element);
    baseDataValidator.reset().parameter("deductionValue").value(deductionValue).notBlank();

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
  public void validateForCreate(final String json) {
    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("clientbalance");

    final JsonElement element = fromApiJsonHelper.parse(json);

    final Long clientId = fromApiJsonHelper.extractLongNamed("clientId", element);
    baseDataValidator.reset().parameter("clientId").value(clientId).notBlank();
    final Long units = fromApiJsonHelper.extractLongNamed("balance", element);
    baseDataValidator.reset().parameter("units").value(units).notBlank();

    final String balance = fromApiJsonHelper.extractStringNamed("balance", element);
    baseDataValidator.reset().parameter("balance").value(balance).notBlank();

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
  public void validateForCreate(final String json) {
    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("media.settlement");

    final JsonElement element = fromApiJsonHelper.parse(json);

    /*final String partnerType = fromApiJsonHelper.extractStringNamed("partnerType", element);
    baseDataValidator.reset().parameter("partnerType").value(partnerType).notBlank().notExceedingLengthOf(50);

    final String mediaCategory = fromApiJsonHelper.extractStringNamed("mediaCategory", element);
    baseDataValidator.reset().parameter("mediaCategory").value(mediaCategory).notBlank().notExceedingLengthOf(50);*/

    final String partnerName = fromApiJsonHelper.extractStringNamed("partnerName", element);
    baseDataValidator
        .reset()
        .parameter("partnerName")
        .value(partnerName)
        .notBlank()
        .notExceedingLengthOf(100);

    final String partnerAddress = fromApiJsonHelper.extractStringNamed("partnerAddress", element);
    baseDataValidator
        .reset()
        .parameter("partnerAddress")
        .value(partnerAddress)
        .notBlank()
        .notExceedingLengthOf(255);

    final BigDecimal externalId =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed("externalId", element);
    baseDataValidator.reset().parameter("externalId").value(externalId).notBlank();

    final String contactNum = fromApiJsonHelper.extractStringNamed("contactNum", element);
    baseDataValidator
        .reset()
        .parameter("contactNum")
        .value(contactNum)
        .notBlank()
        .notExceedingLengthOf(11);

    final String emailId = fromApiJsonHelper.extractStringNamed("emailId", element);
    baseDataValidator
        .reset()
        .parameter("emailId")
        .value(emailId)
        .notBlank()
        .notExceedingLengthOf(100);

    if (fromApiJsonHelper.parameterExists("currencyCode", element)) {
      final BigDecimal currencyCode =
          fromApiJsonHelper.extractBigDecimalWithLocaleNamed("currencyCode", element);
      baseDataValidator
          .reset()
          .parameter("currencyCode")
          .value(currencyCode)
          .notBlank()
          .notExceedingLengthOf(255);
    }

    /*final String country = fromApiJsonHelper.extractStringNamed("country", element);
    baseDataValidator.reset().parameter("country").value(country).notBlank().notExceedingLengthOf(50);*/

    if (fromApiJsonHelper.parameterExists("currencyId", element)) {
      final Long currencyId = fromApiJsonHelper.extractLongNamed("currencyId", element);
      baseDataValidator.reset().parameter("currencyId").value(currencyId).notBlank();
    }

    if (fromApiJsonHelper.parameterExists("chData", element)) {

      final JsonArray chDataArray = fromApiJsonHelper.extractJsonArrayNamed("chData", element);

      String[] chStringArray = new String[chDataArray.size()];
      /*int chStringArraySize = chDataArray.size();*/
      /*baseDataValidator.reset().parameter(null).value(chStringArraySize).integerGreaterThanZero();*/

      for (int i = 0; i < chDataArray.size(); i++) {
        chStringArray[i] = chDataArray.get(i).toString();
      }

      for (String s : chStringArray) {

        final JsonElement el = fromApiJsonHelper.parse(s);
        final String channelPartnerName =
            fromApiJsonHelper.extractStringNamed("channelPartnerName", el);
        baseDataValidator
            .reset()
            .parameter("channelPartnerName")
            .value(channelPartnerName)
            .notBlank();

        /*final String channelPartnerAddress = fromApiJsonHelper.extractStringNamed("channelPartnerAddress", el);
        baseDataValidator.reset().parameter("channelPartnerAddress").value(channelPartnerAddress).notBlank();
        throwExceptionIfValidationWarningsExist(dataValidationErrors);*/
      }
    }

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
Ejemplo n.º 13
0
  public void validateForCreate(final String json) {

    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(
        typeOfMap, json, SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource(SAVINGS_PRODUCT_RESOURCE_NAME);
    final JsonElement element = fromApiJsonHelper.parse(json);

    final String name = fromApiJsonHelper.extractStringNamed(nameParamName, element);
    baseDataValidator
        .reset()
        .parameter(nameParamName)
        .value(name)
        .notBlank()
        .notExceedingLengthOf(100);

    final String description = fromApiJsonHelper.extractStringNamed(descriptionParamName, element);
    baseDataValidator
        .reset()
        .parameter(descriptionParamName)
        .value(description)
        .notBlank()
        .notExceedingLengthOf(500);

    final String currencyCode =
        fromApiJsonHelper.extractStringNamed(currencyCodeParamName, element);
    baseDataValidator.reset().parameter(currencyCodeParamName).value(currencyCode).notBlank();

    final Integer digitsAfterDecimal =
        fromApiJsonHelper.extractIntegerSansLocaleNamed(digitsAfterDecimalParamName, element);
    baseDataValidator
        .reset()
        .parameter(digitsAfterDecimalParamName)
        .value(digitsAfterDecimal)
        .notNull()
        .inMinMaxRange(0, 6);

    final Integer inMultiplesOf =
        fromApiJsonHelper.extractIntegerSansLocaleNamed(inMultiplesOfParamName, element);
    baseDataValidator
        .reset()
        .parameter(inMultiplesOfParamName)
        .value(inMultiplesOf)
        .ignoreIfNull()
        .integerZeroOrGreater();

    final BigDecimal nominalAnnualInterestRate =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed(
            nominalAnnualInterestRateParamName, element);
    baseDataValidator
        .reset()
        .parameter(nominalAnnualInterestRateParamName)
        .value(nominalAnnualInterestRate)
        .notNull()
        .zeroOrPositiveAmount();

    final Integer interestCompoundingPeriodType =
        fromApiJsonHelper.extractIntegerSansLocaleNamed(
            interestCompoundingPeriodTypeParamName, element);
    baseDataValidator
        .reset()
        .parameter(interestCompoundingPeriodTypeParamName)
        .value(interestCompoundingPeriodType)
        .notNull()
        .isOneOfTheseValues(SavingsCompoundingInterestPeriodType.integerValues());

    final Integer interestPostingPeriodType =
        fromApiJsonHelper.extractIntegerSansLocaleNamed(
            interestPostingPeriodTypeParamName, element);
    baseDataValidator
        .reset()
        .parameter(interestPostingPeriodTypeParamName)
        .value(interestPostingPeriodType)
        .notNull()
        .isOneOfTheseValues(SavingsPostingInterestPeriodType.integerValues());

    final Integer interestCalculationType =
        fromApiJsonHelper.extractIntegerSansLocaleNamed(interestCalculationTypeParamName, element);
    baseDataValidator
        .reset()
        .parameter(interestCalculationTypeParamName)
        .value(interestCalculationType)
        .notNull()
        .isOneOfTheseValues(SavingsInterestCalculationType.integerValues());

    final Integer interestCalculationDaysInYearType =
        fromApiJsonHelper.extractIntegerSansLocaleNamed(
            interestCalculationDaysInYearTypeParamName, element);
    baseDataValidator
        .reset()
        .parameter(interestCalculationDaysInYearTypeParamName)
        .value(interestCalculationDaysInYearType)
        .notNull()
        .isOneOfTheseValues(SavingsInterestCalculationDaysInYearType.integerValues());

    if (this.fromApiJsonHelper.parameterExists(minRequiredOpeningBalanceParamName, element)) {
      final BigDecimal minOpeningBalance =
          fromApiJsonHelper.extractBigDecimalWithLocaleNamed(
              minRequiredOpeningBalanceParamName, element);
      baseDataValidator
          .reset()
          .parameter(minRequiredOpeningBalanceParamName)
          .value(minOpeningBalance)
          .zeroOrPositiveAmount();
    }

    if (this.fromApiJsonHelper.parameterExists(lockinPeriodFrequencyParamName, element)) {

      final Integer lockinPeriodFrequency =
          fromApiJsonHelper.extractIntegerWithLocaleNamed(lockinPeriodFrequencyParamName, element);
      baseDataValidator
          .reset()
          .parameter(lockinPeriodFrequencyParamName)
          .value(lockinPeriodFrequency)
          .integerZeroOrGreater();

      if (lockinPeriodFrequency != null) {
        final Integer lockinPeriodFrequencyType =
            fromApiJsonHelper.extractIntegerSansLocaleNamed(
                lockinPeriodFrequencyTypeParamName, element);
        baseDataValidator
            .reset()
            .parameter(lockinPeriodFrequencyTypeParamName)
            .value(lockinPeriodFrequencyType)
            .notNull()
            .inMinMaxRange(0, 3);
      }
    }

    if (this.fromApiJsonHelper.parameterExists(lockinPeriodFrequencyTypeParamName, element)) {
      final Integer lockinPeriodFrequencyType =
          fromApiJsonHelper.extractIntegerSansLocaleNamed(
              lockinPeriodFrequencyTypeParamName, element);
      baseDataValidator
          .reset()
          .parameter(lockinPeriodFrequencyTypeParamName)
          .value(lockinPeriodFrequencyType)
          .inMinMaxRange(0, 3);

      if (lockinPeriodFrequencyType != null) {
        final Integer lockinPeriodFrequency =
            fromApiJsonHelper.extractIntegerWithLocaleNamed(
                lockinPeriodFrequencyParamName, element);
        baseDataValidator
            .reset()
            .parameter(lockinPeriodFrequencyParamName)
            .value(lockinPeriodFrequency)
            .notNull()
            .integerZeroOrGreater();
      }
    }

    if (this.fromApiJsonHelper.parameterExists(withdrawalFeeAmountParamName, element)) {

      final BigDecimal withdrawalFeeAmount =
          fromApiJsonHelper.extractBigDecimalWithLocaleNamed(withdrawalFeeAmountParamName, element);
      baseDataValidator
          .reset()
          .parameter(withdrawalFeeAmountParamName)
          .value(withdrawalFeeAmount)
          .zeroOrPositiveAmount();

      if (withdrawalFeeAmount != null) {
        final Integer withdrawalFeeType =
            fromApiJsonHelper.extractIntegerSansLocaleNamed(withdrawalFeeTypeParamName, element);
        baseDataValidator
            .reset()
            .parameter(withdrawalFeeTypeParamName)
            .value(withdrawalFeeType)
            .isOneOfTheseValues(SavingsWithdrawalFeesType.integerValues());
      }
    }

    if (this.fromApiJsonHelper.parameterExists(withdrawalFeeTypeParamName, element)) {
      final Integer withdrawalFeeType =
          fromApiJsonHelper.extractIntegerSansLocaleNamed(withdrawalFeeTypeParamName, element);
      baseDataValidator
          .reset()
          .parameter(withdrawalFeeTypeParamName)
          .value(withdrawalFeeType)
          .ignoreIfNull()
          .isOneOfTheseValues(1, 2);

      if (withdrawalFeeType != null) {
        final BigDecimal withdrawalFeeAmount =
            fromApiJsonHelper.extractBigDecimalWithLocaleNamed(
                withdrawalFeeAmountParamName, element);
        baseDataValidator
            .reset()
            .parameter(withdrawalFeeAmountParamName)
            .value(withdrawalFeeAmount)
            .notNull()
            .zeroOrPositiveAmount();
      }
    }

    if (this.fromApiJsonHelper.parameterExists(annualFeeAmountParamName, element)) {
      final BigDecimal annualFeeAmount =
          fromApiJsonHelper.extractBigDecimalWithLocaleNamed(annualFeeAmountParamName, element);
      baseDataValidator
          .reset()
          .parameter(annualFeeAmountParamName)
          .value(annualFeeAmount)
          .zeroOrPositiveAmount();

      if (annualFeeAmount != null) {
        MonthDay monthDayOfAnnualFee =
            fromApiJsonHelper.extractMonthDayNamed(annualFeeOnMonthDayParamName, element);
        baseDataValidator
            .reset()
            .parameter(annualFeeOnMonthDayParamName)
            .value(monthDayOfAnnualFee)
            .notNull();
      }
    }

    if (this.fromApiJsonHelper.parameterExists(annualFeeOnMonthDayParamName, element)) {

      MonthDay monthDayOfAnnualFee =
          fromApiJsonHelper.extractMonthDayNamed(annualFeeOnMonthDayParamName, element);
      if (monthDayOfAnnualFee != null) {
        final BigDecimal annualFeeAmount =
            fromApiJsonHelper.extractBigDecimalWithLocaleNamed(annualFeeAmountParamName, element);
        baseDataValidator
            .reset()
            .parameter(annualFeeAmountParamName)
            .value(annualFeeAmount)
            .notNull()
            .zeroOrPositiveAmount();
      }
    }

    // accounting related data validation
    final Integer accountingRuleType =
        fromApiJsonHelper.extractIntegerNamed("accountingRule", element, Locale.getDefault());
    baseDataValidator
        .reset()
        .parameter("accountingRule")
        .value(accountingRuleType)
        .notNull()
        .inMinMaxRange(1, 3);

    if (isCashBasedAccounting(accountingRuleType)) {

      final Long savingsControlAccountId =
          fromApiJsonHelper.extractLongNamed(
              SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), element);
      baseDataValidator
          .reset()
          .parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue())
          .value(savingsControlAccountId)
          .notNull()
          .integerGreaterThanZero();

      final Long savingsReferenceAccountId =
          fromApiJsonHelper.extractLongNamed(
              SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), element);
      baseDataValidator
          .reset()
          .parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue())
          .value(savingsReferenceAccountId)
          .notNull()
          .integerGreaterThanZero();

      final Long interestOnSavingsAccountId =
          fromApiJsonHelper.extractLongNamed(
              SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), element);
      baseDataValidator
          .reset()
          .parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue())
          .value(interestOnSavingsAccountId)
          .notNull()
          .integerGreaterThanZero();

      final Long incomeFromFeeId =
          fromApiJsonHelper.extractLongNamed(
              SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), element);
      baseDataValidator
          .reset()
          .parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue())
          .value(incomeFromFeeId)
          .notNull()
          .integerGreaterThanZero();

      validatePaymentChannelFundSourceMappings(baseDataValidator, element);
    }

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
  public void validateForCreate(String json) {

    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("payment");

    final JsonElement element = fromApiJsonHelper.parse(json);

    // final LocalDate paymentDate = fromApiJsonHelper.extractLocalDateNamed("paymentDate",
    // element);
    final String paymentCode = fromApiJsonHelper.extractStringNamed("paymentCode", element);
    final BigDecimal amountPaid =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed("amountPaid", element);
    // final String remarks = fromApiJsonHelper.extractStringNamed("remarks", element);

    /*String receiptNo = fromApiJsonHelper.extractStringNamed("receiptNo", element);
    baseDataValidator.reset().parameter("receiptNo").value(receiptNo).notBlank().notExceedingLengthOf(20);*/
    //	baseDataValidator.reset().parameter("paymentDate").value(paymentDate)
    // .notBlank().notExceedingLengthOf(100);
    baseDataValidator
        .reset()
        .parameter("paymentCode")
        .value(paymentCode)
        .notBlank()
        .notExceedingLengthOf(100);
    baseDataValidator
        .reset()
        .parameter("amountPaid")
        .value(amountPaid)
        .notBlank()
        .notExceedingLengthOf(100);
    // baseDataValidator.reset().parameter("remarks").value(remarks)
    // .notBlank().notExceedingLengthOf(100);
    if (fromApiJsonHelper.parameterExists("isChequeSelected", element)) {
      String isChequeSelected = fromApiJsonHelper.extractStringNamed("isChequeSelected", element);
      if (isChequeSelected.equalsIgnoreCase("yes")) {
        if (fromApiJsonHelper.parameterExists("chequeNo", element)) {
          String chequeNo = fromApiJsonHelper.extractStringNamed("chequeNo", element);
          baseDataValidator
              .reset()
              .parameter("chequeNo")
              .value(chequeNo)
              .notBlank()
              .notExceedingLengthOf(20);
        }
        if (fromApiJsonHelper.parameterExists("chequeDate", element)) {
          LocalDate chequeDate = fromApiJsonHelper.extractLocalDateNamed("chequeDate", element);
          baseDataValidator.reset().parameter("chequeDate").value(chequeDate).notBlank();
        }
        if (fromApiJsonHelper.parameterExists("bankName", element)) {
          String bankName = fromApiJsonHelper.extractStringNamed("bankName", element);
          baseDataValidator
              .reset()
              .parameter("bankName")
              .value(bankName)
              .notBlank()
              .notExceedingLengthOf(100);
        }
        if (fromApiJsonHelper.parameterExists("branchName", element)) {
          String branchName = fromApiJsonHelper.extractStringNamed("branchName", element);
          baseDataValidator
              .reset()
              .parameter("branchName")
              .value(branchName)
              .notBlank()
              .notExceedingLengthOf(100);
        }
      }
    }

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
  @Override
  public CommandProcessingResult createMediaAsset(JsonCommand command) {

    try {

      this.context.authenticatedUser();
      this.fromApiJsonDeserializer.validateForCreate(command.json());
      MediaAsset mediaAsset = MediaAsset.fromJson(command);
      final JsonArray mediaassetAttributesArray =
          command.arrayOfParameterNamed("mediaassetAttributes").getAsJsonArray();
      String[] mediaassetAttributes = null;
      mediaassetAttributes = new String[mediaassetAttributesArray.size()];
      for (int i = 0; i < mediaassetAttributesArray.size(); i++) {
        mediaassetAttributes[i] = mediaassetAttributesArray.get(i).toString();
        // JsonObject temp = mediaassetAttributesArray.getAsJsonObject();

      }
      // For Media Attributes
      for (String mediaassetAttribute : mediaassetAttributes) {

        final JsonElement element = fromApiJsonHelper.parse(mediaassetAttribute);
        final String mediaAttributeType =
            fromApiJsonHelper.extractStringNamed("attributeType", element);
        final String mediaattributeName =
            fromApiJsonHelper.extractStringNamed("attributeName", element);
        final String mediaattributeValue =
            fromApiJsonHelper.extractStringNamed("attributevalue", element);
        final String mediaattributeNickname =
            fromApiJsonHelper.extractStringNamed("attributeNickname", element);
        final String mediaattributeImage =
            fromApiJsonHelper.extractStringNamed("attributeImage", element);
        MediaassetAttributes attributes =
            new MediaassetAttributes(
                mediaAttributeType,
                mediaattributeName,
                mediaattributeValue,
                mediaattributeNickname,
                mediaattributeImage);
        mediaAsset.add(attributes);
      }

      final JsonArray mediaassetLocationsArray =
          command.arrayOfParameterNamed("mediaAssetLocations").getAsJsonArray();
      String[] mediaassetLocations = null;
      mediaassetLocations = new String[mediaassetLocationsArray.size()];
      for (int i = 0; i < mediaassetLocationsArray.size(); i++) {

        mediaassetLocations[i] = mediaassetLocationsArray.get(i).toString();
      }
      // For Media Attributes
      for (String mediaassetLocationData : mediaassetLocations) {

        final JsonElement element = fromApiJsonHelper.parse(mediaassetLocationData);
        final Long languageId = fromApiJsonHelper.extractLongNamed("languageId", element);
        final String formatType = fromApiJsonHelper.extractStringNamed("formatType", element);
        final String location = fromApiJsonHelper.extractStringNamed("location", element);
        MediaassetLocation mediaassetLocation =
            new MediaassetLocation(languageId, formatType, location);
        mediaAsset.addMediaLocations(mediaassetLocation);
      }

      this.assetRepository.save(mediaAsset);
      return new CommandProcessingResult(mediaAsset.getId());

    } catch (DataIntegrityViolationException dve) {
      handleCodeDataIntegrityIssues(command, dve);
      return new CommandProcessingResult(Long.valueOf(-1));
    }
  }
  @Override
  public CommandProcessingResult updateGameMediaAsset(JsonCommand command) {

    MediaAsset mediaAssetMaster = null;
    try {
      this.context.authenticatedUser();
      final Long mediaId = command.entityId();
      mediaAssetMaster = this.assetRepository.findOne(mediaId);

      if (mediaAssetMaster == null) {
        throw new NoMoviesFoundException(
            "error.media.assets.game.not.found", "No Game Asset Found");
      }

      final Map<String, Object> changes = mediaAssetMaster.updateForGame(command);
      if (!changes.isEmpty()) {
        assetRepository.save(mediaAssetMaster);
      }

      final JsonArray gameData = command.arrayOfParameterNamed("gameMediaData").getAsJsonArray();
      for (int i = 0; i < gameData.size(); i++) {
        String currentData = gameData.get(i).toString();
        final JsonElement element = fromApiJsonHelper.parse(currentData);

        final Long settlementId = fromApiJsonHelper.extractLongNamed("settlementId", element);
        if (settlementId == null) {

          final BigDecimal amount =
              fromApiJsonHelper.extractBigDecimalWithLocaleNamed("amount", element);
          final String category = fromApiJsonHelper.extractStringNamed("category", element);
          final String mediaContentProvider =
              fromApiJsonHelper.extractStringNamed("mediaContentProvider", element);
          final String mt = fromApiJsonHelper.extractStringNamed("mediaType", element);
          final Character mediaType = mt.equals("Flat") ? 'F' : 'P';
          final Long sequence = fromApiJsonHelper.extractLongNamed("sequence", element);
          final String source = fromApiJsonHelper.extractStringNamed("source", element);

          final Settlement settlement =
              Settlement.fromJson(
                  mediaId, amount, category, mediaContentProvider, mediaType, sequence, source);
          settlementJpaRepository.save(settlement);
        } else {
          final Settlement settlement = settlementJpaRepository.findOne(settlementId);
          if (settlement == null) {
            throw new SettlementNotFoundException();
          }

          final Map<String, Object> settlementChanges =
              settlement.update(element, fromApiJsonHelper, mediaId);

          if (!settlementChanges.isEmpty()) {
            settlementJpaRepository.save(settlement);
          }
        }
      }

    } catch (DataIntegrityViolationException dve) {
      handleCodeDataIntegrityIssues(command, dve);
      return new CommandProcessingResult(Long.valueOf(-1));
    }
    return new CommandProcessingResult(mediaAssetMaster.getId());
  }
  public void validateForCreateGameEvent(String json) {

    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(
        typeOfMap, json, supportedParametersforGameEvent);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("media.settlement");

    final JsonElement element = fromApiJsonHelper.parse(json);

    final BigDecimal clientId =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed("clientId", element);
    baseDataValidator
        .reset()
        .parameter("clientId")
        .value(clientId)
        .notBlank()
        .notExceedingLengthOf(50);

    /*final BigDecimal circle = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("circle", element);
    baseDataValidator.reset().parameter("circle").value(circle).notBlank().notExceedingLengthOf(50);*/

    final BigDecimal externalId =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed("externalId", element);
    baseDataValidator
        .reset()
        .parameter("externalId")
        .value(externalId)
        .notBlank()
        .notExceedingLengthOf(50);

    /*final BigDecimal activityMonth = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("activityMonth",element);
    baseDataValidator.reset().parameter("activityMonth").value(activityMonth).notBlank().notExceedingLengthOf(50);*/

    final String activityMonth = fromApiJsonHelper.extractStringNamed("activityMonth", element);
    baseDataValidator.reset().parameter("activityMonth").value(activityMonth).notBlank();

    final BigDecimal businessLine =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed("businessLine", element);
    baseDataValidator
        .reset()
        .parameter("businessLine")
        .value(businessLine)
        .notBlank()
        .notExceedingLengthOf(50);

    final BigDecimal mediaCategory =
        fromApiJsonHelper.extractBigDecimalWithLocaleNamed("mediaCategory", element);
    baseDataValidator
        .reset()
        .parameter("mediaCategory")
        .value(mediaCategory)
        .notBlank()
        .notExceedingLengthOf(50);

    /*final BigDecimal chargeCode = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("chargeCode", element);
    baseDataValidator.reset().parameter("chargeCode").value(chargeCode).notBlank().notExceedingLengthOf(50);*/

    /*final LocalDate dataUploadedDate = fromApiJsonHelper.extractLocalDateNamed("dataUploadedDate", element);
    baseDataValidator.reset().parameter("dataUploadedDate").value(dataUploadedDate).notBlank();*/

    final JsonArray interactiveDataArray =
        fromApiJsonHelper.extractJsonArrayNamed("activeData", element);
    String[] interactiveDataArrayAttributes = null;
    interactiveDataArrayAttributes = new String[interactiveDataArray.size()];
    int interactiveDataSize = interactiveDataArray.size();
    baseDataValidator
        .reset()
        .parameter("interactiveDataArray")
        .value(interactiveDataSize)
        .integerGreaterThanZero();

    for (int i = 0; i < interactiveDataArray.size(); i++) {
      interactiveDataArrayAttributes[i] = interactiveDataArray.get(i).toString();
    }

    for (String singleinteractiveData : interactiveDataArrayAttributes) {

      final JsonElement elements = fromApiJsonHelper.parse(singleinteractiveData);

      final Long playSource = fromApiJsonHelper.extractLongNamed("playSource", elements);
      baseDataValidator.reset().parameter("playSource").value(playSource).notBlank();

      final String contentName = fromApiJsonHelper.extractStringNamed("contentName", elements);
      baseDataValidator.reset().parameter("contentName").value(contentName).notBlank();

      final Long contentProvider = fromApiJsonHelper.extractLongNamed("contentProvider", elements);
      baseDataValidator.reset().parameter("contentProvider").value(contentProvider).notBlank();

      final Long channelName = fromApiJsonHelper.extractLongNamed("channelName", elements);
      baseDataValidator.reset().parameter("channelName").value(channelName).notBlank();

      final Long serviceName = fromApiJsonHelper.extractLongNamed("serviceName", elements);
      baseDataValidator.reset().parameter("serviceName").value(serviceName).notBlank();

      final BigDecimal endUserPrice =
          fromApiJsonHelper.extractBigDecimalWithLocaleNamed("endUserPrice", elements);
      baseDataValidator.reset().parameter("endUserPrice").value(endUserPrice).notBlank();

      final BigDecimal grossRevenue =
          fromApiJsonHelper.extractBigDecimalWithLocaleNamed("grossRevenue", elements);
      baseDataValidator.reset().parameter("grossRevenue").value(grossRevenue).notBlank();

      final Integer downloads =
          fromApiJsonHelper.extractIntegerWithLocaleNamed("downloads", elements);
      baseDataValidator
          .reset()
          .parameter("downloads")
          .value(downloads)
          .notBlank()
          .integerGreaterThanZero();

      // final Long sequence = fromApiJsonHelper.extractLongNamed("sequence", elements);
      // baseDataValidator.reset().parameter("sequence").value(sequence).notBlank();

      throwExceptionIfValidationWarningsExist(dataValidationErrors);
    }

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
  }
  public void validateForCreatePartnerGame(final String json) {
    if (StringUtils.isBlank(json)) {
      throw new InvalidJsonException();
    }

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
    fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator =
        new DataValidatorBuilder(dataValidationErrors).resource("media.settlement");

    final JsonElement element = fromApiJsonHelper.parse(json);

    final Long partnerName = fromApiJsonHelper.extractLongNamed("partnerName", element);
    baseDataValidator.reset().parameter("partnerName").value(partnerName).notBlank();

    final Long gamePlaySource = fromApiJsonHelper.extractLongNamed("gamePlaySource", element);
    baseDataValidator.reset().parameter("gamePlaySource").value(gamePlaySource).notBlank();

    final Long royaltyValue = fromApiJsonHelper.extractLongNamed("royaltyValue", element);
    baseDataValidator.reset().parameter("royaltyValue").value(royaltyValue).notBlank();

    final Long royaltySequence = fromApiJsonHelper.extractLongNamed("royaltySequence", element);
    baseDataValidator.reset().parameter("royaltySequence").value(royaltySequence).notBlank();

    throwExceptionIfValidationWarningsExist(dataValidationErrors);

    final JsonArray gameMediaPartnerDataArray =
        fromApiJsonHelper.extractJsonArrayNamed("gameMediaPartnerData", element);
    String[] gameMediaPartnerDataAttributes = null;
    gameMediaPartnerDataAttributes = new String[gameMediaPartnerDataArray.size()];
    int gameMediaPartnerDataSize = gameMediaPartnerDataArray.size();
    baseDataValidator
        .reset()
        .parameter(null)
        .value(gameMediaPartnerDataSize)
        .integerGreaterThanZero();

    for (int i = 0; i < gameMediaPartnerDataArray.size(); i++) {
      gameMediaPartnerDataAttributes[i] = gameMediaPartnerDataArray.get(i).toString();
    }

    for (String singleGameMediaPartnerData : gameMediaPartnerDataAttributes) {

      final JsonElement elements = fromApiJsonHelper.parse(singleGameMediaPartnerData);

      final LocalDate gDate = fromApiJsonHelper.extractLocalDateNamed("gDate", elements);
      baseDataValidator.reset().parameter("gDate").value(gDate).notBlank();

      if (fromApiJsonHelper.parameterExists("game", elements)) {
        final String game = fromApiJsonHelper.extractStringNamed("game", elements);
        baseDataValidator.reset().parameter("game").value(game).notBlank();
      } else if (fromApiJsonHelper.parameterExists("gameL", elements)) {
        final String gameL = fromApiJsonHelper.extractStringNamed("gameL", elements);
        baseDataValidator.reset().parameter("gameL").value(gameL).notBlank();
      }

      final BigDecimal overwriteRoyaltyValue =
          fromApiJsonHelper.extractBigDecimalWithLocaleNamed("overwriteRoyaltyValue", elements);
      baseDataValidator
          .reset()
          .parameter("overwriteRoyaltyValue")
          .value(overwriteRoyaltyValue)
          .notBlank();

      final Long playSource = fromApiJsonHelper.extractLongNamed("playSource", elements);
      baseDataValidator.reset().parameter("playSource").value(playSource).notBlank();

      final BigDecimal price =
          fromApiJsonHelper.extractBigDecimalWithLocaleNamed("price", elements);
      baseDataValidator.reset().parameter("price").value(price).notBlank();

      final Long sequence = fromApiJsonHelper.extractLongNamed("sequence", elements);
      baseDataValidator.reset().parameter("sequence").value(sequence).notBlank();

      throwExceptionIfValidationWarningsExist(dataValidationErrors);
    }
  }