org.vfny.geoserver.config
Class AttributeTypeInfoConfig

java.lang.Object
  extended byorg.vfny.geoserver.config.AttributeTypeInfoConfig

public class AttributeTypeInfoConfig
extends java.lang.Object

Allows editing of AttributeTypeInfo.

Represents most of a xs:element for an XMLSchema.

we have three types of information to store, Schema defined types, references and extentions on types. If the type represented is either a reference or a Schema defined type then isRef should be true.

Non-complex types are of the form:

These cases have their type name stored in this.type

For complex types such as {element name='test'}{xs:complexContent}{xs:extension base="gml:AbstractFeatureType"}{xs:sequence}{xs:element name="id" type="xs:string" minOccurs="0"/}{xs:element ref="gml:pointProperty" minOccurs="0"/}{/xs:sequence}{/xs:extension}{/xs:complexContent}{/element} The type contains a similar XML fragment.

minOccurs, maxOccurs and nillable are all attributes for all cases. There is more stuff in the XMLSchema spec but we don't care.


Field Summary
 java.lang.String type
          Element type, a well-known gml or xs type or TYPE_FRAGMENT.
static java.lang.String TYPE_FRAGMENT
          Value of getType() used to indicate that fragement is in use
 
Constructor Summary
AttributeTypeInfoConfig(org.geotools.feature.AttributeType attributeType)
          Set up AttributeTypeInfo based on attributeType.
AttributeTypeInfoConfig(AttributeTypeInfoDTO dto)
          Set up AttributeTypeInfo based on Data Transfer Object.
 
Method Summary
 java.lang.String getFragment()
          XML Fragment used to define stuff.
 int getMaxOccurs()
          getMaxOccurs purpose.
 int getMinOccurs()
          getMinOccurs purpose.
 java.lang.String getName()
          getName purpose.
 java.lang.String getType()
          Element type, a well-known gml or xs type or TYPE_FRAGMENT.
 boolean isNillable()
          Indicate if the attribute is allowed to be null.
 void setFragment(java.lang.String fragment)
          XML Fragment used to define stuff.
 void setMaxOccurs(int max)
          Maxmium number of occurances of this attribute in a feature.
 void setMinOccurs(int min)
          Minimum number of occrances of this attribute in a feature.
 void setNillable(boolean nillable)
          Indicate if the attribute is allowed to be null.
 void setType(java.lang.String type)
          Element type, a well-known gml or xs type or TYPE_FRAGMENT.
 AttributeTypeInfoDTO toDTO()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_FRAGMENT

public static final java.lang.String TYPE_FRAGMENT
Value of getType() used to indicate that fragement is in use

See Also:
Constant Field Values

type

public java.lang.String type
Element type, a well-known gml or xs type or TYPE_FRAGMENT.

If getType is equals to TYPE_FRAGMENT please consult getFragment() to examin the actual user's definition.

Other than that getType should be one of the constants defined by GMLUtils.

Constructor Detail

AttributeTypeInfoConfig

public AttributeTypeInfoConfig(org.geotools.feature.AttributeType attributeType)
Set up AttributeTypeInfo based on attributeType.

Set up is determined by the AttributeTypeInfoDTO( AttributeType ) constructor. This allows all Schema generation to be acomplished in the same palce.

Parameters:
attributeType - GeoTools2 attributeType used for configuration

AttributeTypeInfoConfig

public AttributeTypeInfoConfig(AttributeTypeInfoDTO dto)
Set up AttributeTypeInfo based on Data Transfer Object.

Parameters:
dto - AttributeTypeInfoDTO used for configuration
Method Detail

getFragment

public java.lang.String getFragment()
XML Fragment used to define stuff.

This property is only used with getType() is equals to "(xml fragment)".

baseGMLTypes can only be used in your XML fragment.

Returns:
Returns the fragment.

getMaxOccurs

public int getMaxOccurs()
getMaxOccurs purpose.

The max number of occurences for this element.

Returns:
max number of occurences

getMinOccurs

public int getMinOccurs()
getMinOccurs purpose.

the min number of occurences for this element

Returns:
min number of occurences

getName

public java.lang.String getName()
getName purpose.

returns the element name

Returns:
the element name

getType

public java.lang.String getType()
Element type, a well-known gml or xs type or TYPE_FRAGMENT.

If getType is equals to TYPE_FRAGMENT please consult getFragment() to examine the actual user's definition.

Other than that getType should be one of the constants defined by GMLUtils.

Returns:
The element, or TYPE_FRAGMENT

isNillable

public boolean isNillable()
Indicate if the attribute is allowed to be null.

Nillable is often used to indicate that an attribute is optional. The use of minOccurs and maxOccurs may be a more correct way to indicate optional attribtues.

Returns:
true to indicate attribute is alloed to be null
See Also:
AttributeTypeInfoDTO.setMinOccurs, AttributeTypeInfoDTO.setMaxOccurs

setFragment

public void setFragment(java.lang.String fragment)
XML Fragment used to define stuff.

This property is only used with getType() is equals to "(xml fragment)".

baseGMLTypes can only be used in your XML fragment.

Parameters:
fragment - The fragment to set.

setMaxOccurs

public void setMaxOccurs(int max)
Maxmium number of occurances of this attribute in a feature.

For Features based on the Simple Feature Specification this should be a value of 1. If the attribute is optional it should still be 1, although often optional is represented by allowing the Attribute to be nillable.

Common Min..Max Occurs values:

Parameters:
max - The maximum number of occurances
See Also:
AttributeTypeInfoDTO.isNillable

setMinOccurs

public void setMinOccurs(int min)
Minimum number of occrances of this attribute in a feature.

For Features based on the Simple Feture Specification this should be a value of 1. If the attribute is optional is should be 0, although often optional is represented by allowing the attribute to be nillable.

Common Min..Max Occurs values:

Parameters:
min - The minimum number of occurances
See Also:
AttributeTypeInfoDTO.isNillable

setNillable

public void setNillable(boolean nillable)
Indicate if the attribute is allowed to be null.

Nillable is often used to indicate that an attribute is optional. The use of minOccurs and maxOccurs may be a more correct way to indicate optional attribtues.

Parameters:
nillable - true to indicate attribute is alloed to be null
See Also:
AttributeTypeInfoDTO.setMinOccurs, AttributeTypeInfoDTO.setMaxOccurs

setType

public void setType(java.lang.String type)
Element type, a well-known gml or xs type or TYPE_FRAGMENT.

If getType is equals to TYPE_FRAGMENT please consult getFragment() to examin the actual user's definition.
Other than that getType should be one of the constants defined by GMLUtils.

Parameters:
type - DOCUMENT ME!

toDTO

public AttributeTypeInfoDTO toDTO()