com.ivata.mask
Class DefaultMaskFactory

java.lang.Object
  extended bycom.ivata.mask.DefaultMaskFactory
All Implemented Interfaces:
MaskFactory, java.io.Serializable

public final class DefaultMaskFactory
extends java.lang.Object
implements MaskFactory, java.io.Serializable

This factory class is at the heart of ivata masks. Use it to read in a configuration file (in XML), and then access groups of fields via their unique identifiers.

It is called DefaultMaskFactory because the ivata masks system actually never refers to this class directly - it uses the interface MaskFactory, meaning you could create your own factory implementation, if you want to.

Since:
ivata masks 0.1 (2004-02-26)
Author:
Colin MacLeod colin.macleod@ivata.com
See Also:
Serialized Form

Constructor Summary
DefaultMaskFactory(FieldValueConvertorFactory fieldValueConvertorFactory)
           Default constructor.
DefaultMaskFactory(java.lang.String defaultInputMaskParam, java.lang.String defaultListMaskParam, FieldValueConvertorFactory fieldValueConvertorFactoryParam)
           Construct an instance of the factory with the default mask/screens provided.
 
Method Summary
 java.lang.String getDefaultInputMask()
           Get the name of the default mask/screen used for user input.
 java.lang.String getDefaultListMask()
           Get the name of the default mask/screen used for lists.
 Group getGroup(java.lang.String id)
           Get a group definition referenced by its id.
 Mask getMask(java.lang.Class valueObjectClassParam)
          This will return the default input mask for the class provided.
 Mask getMask(java.lang.Class valueObjectClass, java.lang.String name)
           Get a mask, identified by its class and name.
 Mask getMask(Field parentField, java.lang.Class valueObjectClassParam)
          This will return the default input mask for the class provided of the subclassed field.
 Mask getMask(Field parentField, java.lang.Class valueObjectClass, java.lang.String nameParam)
           Get a mask, identified by its class and name.
 boolean isConfigured()
           Discover whether or not this object has been configured.
 void readConfiguration(java.io.InputStream inputStream)
          Get the configuration represented by the dom4j document provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMaskFactory

public DefaultMaskFactory(FieldValueConvertorFactory fieldValueConvertorFactory)

Default constructor. Initializes the mask factory with "inputMask" as the default input mask, and "inputMask" as the default list mask.

Parameters:
fieldValueConvertorFactory - creates convertors to convert field values in the filters.

DefaultMaskFactory

public DefaultMaskFactory(java.lang.String defaultInputMaskParam,
                          java.lang.String defaultListMaskParam,
                          FieldValueConvertorFactory fieldValueConvertorFactoryParam)

Construct an instance of the factory with the default mask/screens provided.

Parameters:
defaultInputMaskParam - The name of the default mask/screen used for user input.
defaultListMaskParam - The name of the default mask/screen used to list.
Method Detail

getDefaultInputMask

public java.lang.String getDefaultInputMask()

Get the name of the default mask/screen used for user input.

Specified by:
getDefaultInputMask in interface MaskFactory
Returns:
name of the default mask/screen used for user input.
See Also:
MaskFactory.getDefaultInputMask()

getDefaultListMask

public java.lang.String getDefaultListMask()

Get the name of the default mask/screen used for lists.

Specified by:
getDefaultListMask in interface MaskFactory
Returns:
name of the default mask/screen used for lists.
See Also:
MaskFactory.getDefaultListMask()

getGroup

public Group getGroup(java.lang.String id)

Get a group definition referenced by its id.

Specified by:
getGroup in interface MaskFactory
Parameters:
id - unique identifier of the group.
Returns:
Group definition with the id provided, or null if there is no such group.

getMask

public Mask getMask(java.lang.Class valueObjectClassParam)
This will return the default input mask for the class provided. Refer to MaskFactory.getMask(java.lang.Class, java.lang.String).

Specified by:
getMask in interface MaskFactory
Parameters:
valueObjectClassParam - Refer to MaskFactory.getMask(java.lang.Class, java.lang.String).
Returns:
Refer to MaskFactory.getMask(java.lang.Class, java.lang.String).

getMask

public Mask getMask(java.lang.Class valueObjectClass,
                    java.lang.String name)

Get a mask, identified by its class and name.

Specified by:
getMask in interface MaskFactory
Parameters:
valueObjectClass - class of value object for the mask to be returned.
name - optional parameter defining multiple masks for the same value object. May be null.
Returns:
Mask definition with the id provided, or null if there is no such mask.

getMask

public Mask getMask(Field parentField,
                    java.lang.Class valueObjectClassParam)
This will return the default input mask for the class provided of the subclassed field. Refer to MaskFactory.getMask(java.lang.Class, java.lang.String).

Specified by:
getMask in interface MaskFactory
Parameters:
valueObjectClassParam - Refer to MaskFactory.getMask(java.lang.Class, java.lang.String).
parentField - If this mask applies to a field within another mask, (known as a submask) this is the field to which it applies, otherwise use the other getMask method.
Returns:
Refer to MaskFactory.getMask(java.lang.Class, java.lang.String).

getMask

public Mask getMask(Field parentField,
                    java.lang.Class valueObjectClass,
                    java.lang.String nameParam)

Get a mask, identified by its class and name.

Parameters:
parentField - If this mask applies to a field within another mask, (known as a submask) this is the field to which it applies, otherwise use the other getMask method.
valueObjectClass - class of value object for the mask to be returned.
nameParam - describes this mask uniquely within the value object. (You can have more than one mask for each value object.)
Returns:
Mask definition with the id provided, or null if there is no such mask. TODO: replace NullPointerException thrown here with a mask configuration exception.

isConfigured

public boolean isConfigured()

Discover whether or not this object has been configured.

Specified by:
isConfigured in interface MaskFactory
Returns:
true if the object has been configured, otherwise false.
See Also:
MaskFactory.isConfigured()

readConfiguration

public void readConfiguration(java.io.InputStream inputStream)
                       throws java.io.IOException
Get the configuration represented by the dom4j document provided.

Specified by:
readConfiguration in interface MaskFactory
Parameters:
inputStream - The input stream to read the XML from.
Throws:
java.io.IOException - If there is any problem reading from the stream provided.


Copyright © 2001-2005 ivata limited. All Rights Reserved.