com.day.cq.wcm.foundation.forms
Class ValidationHelper

java.lang.Object
  extended by com.day.cq.wcm.foundation.forms.ValidationHelper

public class ValidationHelper
extends Object

Helper class for the forms components for validation.


Method Summary
static void checkConstraint(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, org.apache.sling.api.resource.Resource resource)
          Convenience method to check the constraint of a form element.
static boolean checkRequired(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.resource.Resource resource)
          Convenience method to check the required flag of a form element.
static String getConstraintMessage(org.apache.sling.api.resource.Resource resource)
          Return the constraint message for this element.
static String getFormElementQualifier(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.resource.Resource resource)
           
static String getRequiredMessage(org.apache.sling.api.resource.Resource resource)
          Return the required message for this element.
static ValidationInfo getValidationInfo(org.apache.sling.api.SlingHttpServletRequest request)
          Return the current validation info for server side validation
static boolean hasValidationInfo(javax.servlet.http.HttpServletRequest request)
          Check if there are validation errors for the current request.
static void writeConstraintCheck(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, org.apache.sling.api.resource.Resource resource, javax.servlet.jsp.JspWriter out)
           
static void writeRegexpText(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.resource.Resource resource, String regexp, javax.servlet.jsp.JspWriter out)
           
static void writeRequiredCheck(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.resource.Resource resource, javax.servlet.jsp.JspWriter out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getValidationInfo

public static ValidationInfo getValidationInfo(org.apache.sling.api.SlingHttpServletRequest request)
Return the current validation info for server side validation

Parameters:
request - The current request
Returns:
The validation info object.

hasValidationInfo

public static boolean hasValidationInfo(javax.servlet.http.HttpServletRequest request)
Check if there are validation errors for the current request.

Parameters:
request - The curren t request.
Returns:
true if there are validation errors.

getRequiredMessage

public static String getRequiredMessage(org.apache.sling.api.resource.Resource resource)
Return the required message for this element.

Parameters:
resource - The form element resource.
Returns:
The required message.

getConstraintMessage

public static String getConstraintMessage(org.apache.sling.api.resource.Resource resource)
Return the constraint message for this element.

Parameters:
resource - The form element resource.
Returns:
The constraint message.

checkRequired

public static boolean checkRequired(org.apache.sling.api.SlingHttpServletRequest request,
                                    org.apache.sling.api.resource.Resource resource)
Convenience method to check the required flag of a form element.

Parameters:
request -
resource - The form element resource.
Returns:
true if check passed.

checkConstraint

public static void checkConstraint(org.apache.sling.api.SlingHttpServletRequest request,
                                   org.apache.sling.api.SlingHttpServletResponse response,
                                   org.apache.sling.api.resource.Resource resource)
                            throws IOException,
                                   javax.servlet.ServletException
Convenience method to check the constraint of a form element.

Parameters:
request -
resource - The form element resource.
Throws:
IOException
javax.servlet.ServletException

writeRequiredCheck

public static void writeRequiredCheck(org.apache.sling.api.SlingHttpServletRequest request,
                                      org.apache.sling.api.resource.Resource resource,
                                      javax.servlet.jsp.JspWriter out)
                               throws IOException
Throws:
IOException

getFormElementQualifier

public static String getFormElementQualifier(org.apache.sling.api.SlingHttpServletRequest request,
                                             org.apache.sling.api.resource.Resource resource)

writeConstraintCheck

public static void writeConstraintCheck(org.apache.sling.api.SlingHttpServletRequest request,
                                        org.apache.sling.api.SlingHttpServletResponse response,
                                        org.apache.sling.api.resource.Resource resource,
                                        javax.servlet.jsp.JspWriter out)
                                 throws IOException,
                                        javax.servlet.ServletException
Throws:
IOException
javax.servlet.ServletException

writeRegexpText

public static void writeRegexpText(org.apache.sling.api.SlingHttpServletRequest request,
                                   org.apache.sling.api.resource.Resource resource,
                                   String regexp,
                                   javax.servlet.jsp.JspWriter out)
                            throws IOException
Throws:
IOException


Copyright © 2009 Day Management AG. All Rights Reserved.