Package org.dlese.dpc.schemedit.input
Class SchemEditValidator
java.lang.Object
org.dlese.dpc.schemedit.input.SchemEditValidator
- Direct Known Subclasses:
CollectionConfigValidator,Msp2EditValidator,NsdlAnnoValidator,OsmEditValidator,SmileEditValidator
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 Summary
FieldsModifier and TypeFieldDescriptionprotected DocMapNOT YET DOCUMENTEDprotected MetaDataFrameworkNOT YET DOCUMENTEDprotected InputManagerNOT YET DOCUMENTEDprotected HttpServletRequestNOT YET DOCUMENTEDprotected SchemaHelperthe schemaHelper provided schema infoprotected SchemEditFormthe ActionForm providing fields to validate -
Constructor Summary
ConstructorsConstructorDescriptionSchemEditValidator(SchemEditForm sef, MetaDataFramework framework, org.apache.struts.action.ActionMapping mapping, HttpServletRequest request) Constructor for the SchemEditValidator object -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexposeField(InputField field) Description of the MethodGets the entityErrors attribute of the SchemEditValidator objectGets the inputManager attribute of the SchemEditValidator objectbooleanPredicate to identify if the input contains entities that could not be resolved.booleanisLastRequiredRepeatingElement(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.voidRid the instanceDocument of any non-required empty fieldsprotected voidRemoves empty elements of repeating fields.protected booleanskipFieldValidation(InputField inputField) voidValidate the multivalue parameters managed by the input manager.protected SchemEditActionErrorsChecks all required attribute fields for a value, and all populated attributes for schema-type compliance.validateDeletion(String pathArg) Guard against deletion of last member of a required repeating sequence.Description of the Methodprotected SchemEditActionErrorsValidate the input fields corresponding to elements in the DocMap.Validates the metadata fields contained in a request by callingvalidateMultiValueFields, thenvalidateAttributeFields, and finallyvalidateElementFields.protected SchemEditActionErrorsEnsures that all fields expecting 1 or more values have at least one value;
-
Field Details
-
sef
the ActionForm providing fields to validate -
schemaHelper
the schemaHelper provided schema info -
framework
NOT YET DOCUMENTED -
request
NOT YET DOCUMENTED -
im
NOT YET DOCUMENTED -
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 Parameterframework- Description of the Parametermapping- NOT YET DOCUMENTEDrequest- Description of the Parameter
-
-
Method Details
-
getInputManager
Gets the inputManager attribute of the SchemEditValidator object- Returns:
- The inputManager value
-
skipFieldValidation
-
validateForm
Validates the metadata fields contained in a request by callingvalidateMultiValueFields, thenvalidateAttributeFields, and finallyvalidateElementFields.- 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
Gets the entityErrors attribute of the SchemEditValidator object- Returns:
- The entityErrors value
-
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
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
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
Ensures that all fields expecting 1 or more values have at least one value;- Returns:
- Description of the Return Value
-
isLastRequiredRepeatingElement
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
Guard against deletion of last member of a required repeating sequence.- Parameters:
pathArg- Description of the Parameter- Returns:
- Description of the Return Value
-
exposeField
Description of the Method- Parameters:
field- Description of the Parameter
-
pruneInstanceDoc
public void pruneInstanceDoc()Rid the instanceDocument of any non-required empty fields
-