Class SchemEditValidator

java.lang.Object
org.dlese.dpc.schemedit.input.SchemEditValidator
Direct Known Subclasses:
CollectionConfigValidator, Msp2EditValidator, NsdlAnnoValidator, OsmEditValidator, SmileEditValidator

public class SchemEditValidator extends Object
Validates the metadata fields present in a http request.

The fields to be validated are filtered from the request, and the fields of like "type" (Attribute, Element, MulitValue) are validated as a set. The validation methods return ActionErrors instances that have been populated by the

invalid reference
org.dlese.dpc.schemedit.SchemEditErrors
.
Author:
ostwald
  • Field Details

    • sef

      protected SchemEditForm sef
      the ActionForm providing fields to validate
    • schemaHelper

      protected SchemaHelper schemaHelper
      the schemaHelper provided schema info
    • framework

      protected MetaDataFramework framework
      NOT YET DOCUMENTED
    • request

      protected HttpServletRequest request
      NOT YET DOCUMENTED
    • im

      protected InputManager im
      NOT YET DOCUMENTED
    • docMap

      protected DocMap docMap
      NOT YET DOCUMENTED
  • Constructor Details

    • SchemEditValidator

      public SchemEditValidator(SchemEditForm sef, MetaDataFramework framework, org.apache.struts.action.ActionMapping mapping, HttpServletRequest request)
      Constructor for the SchemEditValidator object
      Parameters:
      sef - Description of the Parameter
      framework - Description of the Parameter
      mapping - NOT YET DOCUMENTED
      request - Description of the Parameter
  • Method Details

    • getInputManager

      public InputManager getInputManager()
      Gets the inputManager attribute of the SchemEditValidator object
      Returns:
      The inputManager value
    • skipFieldValidation

      protected boolean skipFieldValidation(InputField inputField)
    • validateForm

      public SchemEditActionErrors validateForm()
      Validates the metadata fields contained in a request by calling validateMultiValueFields , then validateAttributeFields, and finally validateElementFields .
      Returns:
      validation errors found during the process of validation
    • hasEntityErrors

      public boolean hasEntityErrors()
      Predicate to identify if the input contains entities that could not be resolved.
      Returns:
      NOT YET DOCUMENTED
    • getEntityErrors

      public SchemEditActionErrors getEntityErrors()
      Gets the entityErrors attribute of the SchemEditValidator object
      Returns:
      The entityErrors value
    • validateDocument

      public SchemEditActionErrors validateDocument()
      Description of the Method
      Returns:
      Description of the Return Value
    • pruneRepeatingFields

      protected void pruneRepeatingFields()
      Removes empty elements of repeating fields.

      DISABLED 5/11/04 - the repository will contain non-valid elements, so we don't worry so much about getting rid of the empty elements (many of which will be invalid due to the "stringTextType" convention) Removes empty child elements from each repeating field in the toPrune list. Children are pruned if they are empty and their occurance attribute allows them to be deleted.

    • validateElementFields

      protected SchemEditActionErrors validateElementFields()
      Validate the input fields corresponding to elements in the DocMap. NOTE: do not bother validating elements that are not present in the DocMap!.
      Returns:
      Description of the Return Value
    • validateAttributeFields

      protected SchemEditActionErrors validateAttributeFields()
      Checks all required attribute fields for a value, and all populated attributes for schema-type compliance.
      Returns:
      Description of the Return Value
    • updateMultiValueFields

      public void updateMultiValueFields()
      Validate the multivalue parameters managed by the input manager. For each different group of multivalue elements found, remove all existing elements, then add the NON-EMPTY params from the input, and finally validate, returning errors.
    • validateMultiValueFields

      protected SchemEditActionErrors validateMultiValueFields()
      Ensures that all fields expecting 1 or more values have at least one value;
      Returns:
      Description of the Return Value
    • isLastRequiredRepeatingElement

      public boolean isLastRequiredRepeatingElement(String pathArg)
      Guards against deletion of the last required element, causing a new empty element to be automatically inserted after the last one is deleted. But this guard is relaxed for choice and substitutionGroup elements, since we can't know which element to replace the last one with.
      Parameters:
      pathArg - NOT YET DOCUMENTED
      Returns:
      The lastRequiredRepeatingElement value
    • validateDeletion

      public SchemEditActionErrors validateDeletion(String pathArg)
      Guard against deletion of last member of a required repeating sequence.
      Parameters:
      pathArg - Description of the Parameter
      Returns:
      Description of the Return Value
    • exposeField

      protected void exposeField(InputField field)
      Description of the Method
      Parameters:
      field - Description of the Parameter
    • pruneInstanceDoc

      public void pruneInstanceDoc()
      Rid the instanceDocument of any non-required empty fields