org.kuali.kfs.sys.context
Class AttributeSchemaValidationBuilder

java.lang.Object
  extended by org.kuali.kfs.sys.context.AttributeSchemaValidationBuilder

public class AttributeSchemaValidationBuilder
extends Object

Builder for XML schema types based on a data dictionary attribute. Data dictionary properties such as required, maxLength, and validation pattern are retrieved and then the equivalent schema restriction is rendered for the type


Nested Class Summary
static class AttributeSchemaValidationBuilder.DD_VALIDATION_TYPES
           
static class AttributeSchemaValidationBuilder.SCHEMA_BASE_TYPES
           
 
Field Summary
protected  String attributeKey
           
protected  Map attributeMap
           
protected static String DD_ALLOW_WHITESPACE_KEY
           
protected static String DD_MAP_EXACT_LENGTH_KEY
           
protected static String DD_MAP_EXCLUSIVE_MAX_KEY
           
protected static String DD_MAP_EXCLUSIVE_MIN_KEY
           
protected static String DD_MAP_MAX_LENGTH_KEY
           
protected static String DD_MAP_REQUIRED_KEY
           
protected static String DD_MAP_VALIDATION_KEY
           
protected static String DD_MAP_VALIDATION_TYPE_KEY
           
static String XSD_SCHEMA_PREFIX
           
 
Constructor Summary
AttributeSchemaValidationBuilder()
          Constructs a AttributeSchemaValidationBuilder.java.
AttributeSchemaValidationBuilder(String attributeKey)
          Constructs a AttributeSchemaValidationBuilder.java.
 
Method Summary
protected  boolean getAllowWhitespaceFromMap()
          Helper method to get the allow whitespace setting from dd Map
 String getAttributeKey()
          Gets the attributeKey attribute.
protected  int getExactLengthFromMap()
          Helper method to get the exact length from the dd Map
 Collection getFurtherRestrictionTags()
          Based on attribute definition adds any further restrictions to the type
protected  int getMaxLengthFromMap()
          Helper method to get the max length from the dd map
protected  boolean getRequiredFromMap()
          Helper method to get the required setting from dd Map
 String getRestrictionTagCloser()
          Builds restriction closing tag
 String getRestrictionTagOpener()
          Builds restriction opening tag.
 String getTypeTagCloser()
          Builds simple type closing tag .
 String getTypeTagOpener()
          Builds simple type opening tag .
protected  String getValidationType()
          Helper method to get validation type from dd Map
protected  boolean isDateType()
          Determines if the attribute's validation type is the Date validation type
protected  boolean isDecimalType()
          Determines if the attribute's validation type is the Decimal validation type
protected  boolean isFloatingType()
          Determines if the attribute's validation type is the Floating validation type
protected  boolean isNumericType()
          Determines if the attribute's validation type is the Numeric validation type
protected  boolean isStringType()
          Determines if the attribute's validation type is a String validation type
protected  boolean isTimestampType()
          Determines if the attribute's validation type is the Timestamp validation type
 void setAttributeKey(String attributeKey)
          Sets the attributeKey attribute value.
 Collection toSchemaType()
          Based on data dictionary configuration for attribute builds a complete schema simple type with the appropriate base and restrictions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DD_MAP_MAX_LENGTH_KEY

protected static final String DD_MAP_MAX_LENGTH_KEY
See Also:
Constant Field Values

DD_MAP_EXACT_LENGTH_KEY

protected static final String DD_MAP_EXACT_LENGTH_KEY
See Also:
Constant Field Values

DD_MAP_REQUIRED_KEY

protected static final String DD_MAP_REQUIRED_KEY
See Also:
Constant Field Values

DD_MAP_EXCLUSIVE_MIN_KEY

protected static final String DD_MAP_EXCLUSIVE_MIN_KEY
See Also:
Constant Field Values

DD_MAP_EXCLUSIVE_MAX_KEY

protected static final String DD_MAP_EXCLUSIVE_MAX_KEY
See Also:
Constant Field Values

DD_MAP_VALIDATION_KEY

protected static final String DD_MAP_VALIDATION_KEY
See Also:
Constant Field Values

DD_MAP_VALIDATION_TYPE_KEY

protected static final String DD_MAP_VALIDATION_TYPE_KEY
See Also:
Constant Field Values

DD_ALLOW_WHITESPACE_KEY

protected static final String DD_ALLOW_WHITESPACE_KEY
See Also:
Constant Field Values

XSD_SCHEMA_PREFIX

public static final String XSD_SCHEMA_PREFIX
See Also:
Constant Field Values

attributeKey

protected String attributeKey

attributeMap

protected Map attributeMap
Constructor Detail

AttributeSchemaValidationBuilder

public AttributeSchemaValidationBuilder()
Constructs a AttributeSchemaValidationBuilder.java.


AttributeSchemaValidationBuilder

public AttributeSchemaValidationBuilder(String attributeKey)
Constructs a AttributeSchemaValidationBuilder.java.

Parameters:
attributeKey - name of data dictionary entry to build type for
Method Detail

toSchemaType

public Collection toSchemaType()
Based on data dictionary configuration for attribute builds a complete schema simple type with the appropriate base and restrictions

Returns:
collection of XML lines for the type

getTypeTagOpener

public String getTypeTagOpener()
Builds simple type opening tag .

Returns:
XML Line

getTypeTagCloser

public String getTypeTagCloser()
Builds simple type closing tag .

Returns:
XML Line

getRestrictionTagOpener

public String getRestrictionTagOpener()
Builds restriction opening tag. Data dictionary validation type is used to determine base schema type .

Returns:
XML Line

getRestrictionTagCloser

public String getRestrictionTagCloser()
Builds restriction closing tag

Returns:
XML Line

getFurtherRestrictionTags

public Collection getFurtherRestrictionTags()
Based on attribute definition adds any further restrictions to the type

Returns:
collection of XML lines

getMaxLengthFromMap

protected int getMaxLengthFromMap()
Helper method to get the max length from the dd map

Returns:
max length, or -1 if not found

getExactLengthFromMap

protected int getExactLengthFromMap()
Helper method to get the exact length from the dd Map

Returns:
exact length or -1 if not found

getRequiredFromMap

protected boolean getRequiredFromMap()
Helper method to get the required setting from dd Map

Returns:
true if required setting is set to true in dd, false if setting is false or was not found

getAllowWhitespaceFromMap

protected boolean getAllowWhitespaceFromMap()
Helper method to get the allow whitespace setting from dd Map

Returns:
true if allow whitespace setting is set to true in dd, false if setting is false or was not found

getValidationType

protected String getValidationType()
Helper method to get validation type from dd Map

Returns:
dd validation type

isDateType

protected boolean isDateType()
Determines if the attribute's validation type is the Date validation type

Returns:
boolean true if type is Date, false otherwise

isTimestampType

protected boolean isTimestampType()
Determines if the attribute's validation type is the Timestamp validation type

Returns:
boolean true if type is Timestamp, false otherwise

isNumericType

protected boolean isNumericType()
Determines if the attribute's validation type is the Numeric validation type

Returns:
boolean true if type is Numeric, false otherwise

isDecimalType

protected boolean isDecimalType()
Determines if the attribute's validation type is the Decimal validation type

Returns:
boolean true if type is Decimal, false otherwise

isFloatingType

protected boolean isFloatingType()
Determines if the attribute's validation type is the Floating validation type

Returns:
boolean true if type is Floating, false otherwise

isStringType

protected boolean isStringType()
Determines if the attribute's validation type is a String validation type

Returns:
boolean true if type is String, false otherwise

getAttributeKey

public String getAttributeKey()
Gets the attributeKey attribute.

Returns:
Returns the attributeKey.

setAttributeKey

public void setAttributeKey(String attributeKey)
Sets the attributeKey attribute value.

Parameters:
attributeKey - The attributeKey to set.


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.