com.softwareag.mdm.schema
Interface ConstraintEnumeration

All Superinterfaces:
Constraint

public interface ConstraintEnumeration
extends Constraint

Specifies an enumeration constraint that may be contextual and dynamic. This interface provides a programmatic extension of xs:enumeration facet.

Schema definition

The constraint must be declared under the element xs:annotation/xs:appinfo/mdm:otherFacets:

 <mdm:constraintEnumeration class="com.foo.MyConstraintEnumeration" />
where com.foo.MyConstraintEnumeration is the fully qualified name of the class implementing this interface. It is also possible to set additional JavaBean properties:
 <mdm:constraintEnumeration class="com.foo.MyConstraintEnumeration">
 	 <param1>...</param1>
 	 <param2>...</param2>
 </mdm:constraintEnumeration>
where param1 and param2 are JavaBean properties of the class specified.

For more information, read JavaBeans specification.

Life-cycle

See Constraint life-cycle.

See Also:
ConstraintOnNull

Method Summary
 String displayOccurrence(Object aValue, ValueContext aContext, Locale aLocale)
          Returns, for user display, a string representation of the value specified (a 'label').
 List getValues(ValueContext aContext)
          Returns all values from the underlying enumeration of this constraint.
 
Methods inherited from interface com.softwareag.mdm.schema.Constraint
checkOccurrence, setup, toUserDocumentation
 

Method Detail

getValues

public List getValues(ValueContext aContext)
               throws InvalidSchemaException
Returns all values from the underlying enumeration of this constraint.

Throws:
InvalidSchemaException - if some schema's dynamic condition prevents the execution of this method.

displayOccurrence

public String displayOccurrence(Object aValue,
                                ValueContext aContext,
                                Locale aLocale)
                         throws InvalidSchemaException
Returns, for user display, a string representation of the value specified (a 'label').

The value specified should be compatible with the current node's type, more particularly it should be one of the values returned by getValues(ValueContext). However, if this enumeration has evolved, it is possible that the value is no more in the current enumeration. Hence such degraded cases must be handled properly by the implementation of this method (those cases will be considered independently as proper validation errors).

Parameters:
aValue - The value that must be displayed
aContext - The current context
aLocale - The current user locale
Throws:
InvalidSchemaException - if some schema's dynamic condition prevents the execution of this method.
See Also:
ValueContext.displayOccurrence(Object, Locale), ValueContext.formatOccurrence(Object)


(report a bug)
webMethods MDM 4.2.8 [0558]
Copyright Software AG 2000-2007. All rights reserved.