Examples of ValidationRule


Examples of org.gsm.oneapi.server.ValidationRule

      ValidationRule[] rules=null;
     
      if (code!=null) {
        rules=new ValidationRule[] {
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_TEL, "endUserId", endUserId),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "transactionId", transactionId),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "referenceCode", referenceCode),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "transactionOperationStatus", transactionOperationStatus, "charged"),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_INT_GT_ONE, "referenceSequence", Integer.valueOf(referenceSequence)),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "description", description),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "code", code),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_URL, "callbackURL", callbackURL),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "clientCorrelator", clientCorrelator),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "onBehalfOf", onBehalfOf),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "purchaseCategoryCode", purchaseCategoryCode),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_PAYMENT_CHANNEL, "channel", channel),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_DOUBLE_GE_ZERO, "taxAmount", taxAmount),         
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "serviceID", serviceID),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "productID", productID),
        };
       
      } else {
        rules=new ValidationRule[] {
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_TEL, "endUserId", endUserId),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "transactionId", transactionId),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "referenceCode", referenceCode),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "transactionOperationStatus", transactionOperationStatus, "charged"),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_INT_GT_ONE, "referenceSequence", Integer.valueOf(referenceSequence)),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "description", description),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "currency", currency),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_DOUBLE_GE_ZERO, "amount", amount),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_URL, "callbackURL", callbackURL),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "clientCorrelator", clientCorrelator),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "onBehalfOf", onBehalfOf),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "purchaseCategoryCode", purchaseCategoryCode),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_PAYMENT_CHANNEL, "channel", channel),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_DOUBLE_GE_ZERO, "taxAmount", taxAmount),         
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "serviceID", serviceID),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "productID", productID),
        };
      }

      if (checkRequestParameters(response, rules)) {     
        String serverReferenceCode="DEF-456";
View Full Code Here

Examples of org.gsm.oneapi.server.ValidationRule

      ValidationRule[] rules=null;
     
      if (code!=null) {
        rules=new ValidationRule[] {
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_TEL, "endUserId", endUserId),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "referenceCode", referenceCode),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "transactionOperationStatus", transactionOperationStatus, "refunded"),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "description", description),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "code", code),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "clientCorrelator", clientCorrelator),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "originalServerReferenceCode", originalServerReferenceCode),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "onBehalfOf", onBehalfOf),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "purchaseCategoryCode", purchaseCategoryCode),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_PAYMENT_CHANNEL, "channel", channel),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_DOUBLE_GE_ZERO, "taxAmount", taxAmount),         
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "serviceID", serviceID),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "productID", productID),
        };
       
      } else {
        rules=new ValidationRule[] {
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_TEL, "endUserId", endUserId),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "referenceCode", referenceCode),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "transactionOperationStatus", transactionOperationStatus, "refunded"),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "description", description),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "currency", currency),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_DOUBLE_GE_ZERO, "amount", amount),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "clientCorrelator", clientCorrelator),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "originalServerReferenceCode", originalServerReferenceCode),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "onBehalfOf", onBehalfOf),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "purchaseCategoryCode", purchaseCategoryCode),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_PAYMENT_CHANNEL, "channel", channel),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_DOUBLE_GE_ZERO, "taxAmount", taxAmount),         
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "serviceID", serviceID),
            new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "productID", productID),
        };
      }

      if (checkRequestParameters(response, rules)) {           
     
View Full Code Here

Examples of org.gsm.oneapi.server.ValidationRule

      logger.debug("registrationId = "+registrationId);
      logger.debug("messageId = "+messageId);
      logger.debug("resFormat = "+resFormat);
     
      ValidationRule[] rules={
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "registrationId", registrationId),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "messageId", messageId),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_JSON, "resFormat", resFormat),
      };

      if (checkRequestParameters(response, rules)) {     
        InboundMessage inboundMessage=new InboundMessage();
        java.util.Date message1DT=makeUTCDateTime(2010, Calendar.NOVEMBER, 19, 12, 0, 0);
View Full Code Here

Examples of org.gsm.oneapi.server.ValidationRule

     
      logger.debug("registrationId = "+registrationId);
      logger.debug("maxBatchSize = "+maxBatchSize);
     
      ValidationRule[] rules={
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "registrationId", registrationId),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_INT_GE_ZERO, "maxBatchSize", Integer.valueOf(maxBatchSize)),
      };

      if (checkRequestParameters(response, rules)) {     
        InboundMessageList inboundMessageList=new InboundMessageList();
       
View Full Code Here

Examples of org.gsm.oneapi.server.ValidationRule

     
      logger.debug("senderAddress = "+senderAddress);
      logger.debug("requestId = "+requestId);
     
      ValidationRule[] rules={
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_TEL, "senderAddress", senderAddress),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "requestId", requestId),
      };
     
      if (checkRequestParameters(response, rules)) {
        DeliveryInfoList deliveryInfoList=new DeliveryInfoList();
       
View Full Code Here

Examples of org.gsm.oneapi.server.ValidationRule

      if (addresses!=null) for (String add:addresses) logger.debug("address = "+add);   
     
      String resourceURL=null;

      ValidationRule[] rules={
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_TEL, "senderAddress", senderAddress),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_TEL, "address", addresses),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "message", message),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "clientCorrelator", clientCorrelator),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "senderName", senderName),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_URL, "notifyURL", notifyURL),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "callbackData", callbackData),         
      };

      if (checkRequestParameters(response, rules)) {     
        resourceURL=getRequestHostnameAndContext(request)+request.getServletPath()+"/1/smsmessaging/outbound/"+urlEncode(senderAddress)+"/requests/"+urlEncode(clientCorrelator);
       
View Full Code Here

Examples of org.gsm.oneapi.server.ValidationRule

     
      logger.debug("registrationId = "+registrationId);
      logger.debug("maxBatchSize = "+maxBatchSize);

      ValidationRule[] rules={
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "registrationId", registrationId),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_INT_GE_ZERO, "maxBatchSize", Integer.valueOf(maxBatchSize)),
      };

      if (checkRequestParameters(response, rules)) {     
        InboundSMSMessageList inboundSMSMessageList=new InboundSMSMessageList();
       
View Full Code Here

Examples of org.gsm.oneapi.server.ValidationRule

      logger.debug("clientCorrelator = "+clientCorrelator);
      logger.debug("notifyURL = "+notifyURL);
      logger.debug("callbackData = "+callbackData);     
     
      ValidationRule[] rules={
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_TEL, "senderAddress", senderAddress),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_URL, "notifyURL", notifyURL),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "clientCorrelator", clientCorrelator),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "callbackData", callbackData),         
      };

      if (checkRequestParameters(response, rules)) {
        String resourceURL=getRequestHostnameAndContext(request)+request.getServletPath()+"/1/smsmessaging/outbound/subscriptions/sub789";
       
View Full Code Here

Examples of org.gsm.oneapi.server.ValidationRule

      logger.debug("notificationFormat = "+notificationFormat);
      logger.debug("clientCorrelator = "+clientCorrelator);
      logger.debug("callbackData = "+callbackData);     
     
      ValidationRule[] rules={
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "destinationAddress", destinationAddress),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY_URL, "notifyURL", notifyURL),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "criteria", criteria),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_JSON, "notificationFormat", notificationFormat),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "clientCorrelator", clientCorrelator),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL, "callbackData", callbackData),         
      };
     
      if (checkRequestParameters(response, rules)) {
        String resourceURL=getRequestHostnameAndContext(request)+request.getServletPath()+"/1/smsmessaging/inbound/subscriptions/sub6789";
       
View Full Code Here

Examples of org.springmodules.validation.bean.rule.ValidationRule

     * @param errors The {@link Errors} instance where all global validation errors will be registered.
     */
    protected void applyGlobalValidationRules(BeanValidationConfiguration configuration, Object obj, Errors errors) {
        ValidationRule[] globalRules = configuration.getGlobalRules();
        for (int i=0; i<globalRules.length; i++) {
            ValidationRule rule = globalRules[i];
            if (rule.isApplicable(obj) && !rule.getCondition().check(obj)) {
                String errorCode = errorCodeConverter.convertGlobalErrorCode(rule.getErrorCode(), obj.getClass());

                // if there is a nested path in errors, the global errors should be registered as field errors
                // for the nested path. Otherwise, they should be registered as global errors. Starting from Spring 2.0-rc2
                // this is actually not required - it's just enough to call rejectValue() with null as the field name,
                // but we keep this implementation for now to support earlier versions.

                if (StringUtils.hasLength(errors.getNestedPath())) {
                    String nestedPath = errors.getNestedPath();
                    String propertyName = nestedPath.substring(0, nestedPath.length() - 1);
                    errors.popNestedPath();
                    errors.rejectValue(propertyName, errorCode, rule.getErrorArguments(obj), rule.getDefaultErrorMessage());
                    errors.pushNestedPath(propertyName);
                } else {
                    errors.reject(errorCode, rule.getErrorArguments(obj), rule.getDefaultErrorMessage());
                }
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.