View Javadoc

1   /*
2    * Copyright (c) 2001 - 2005 ivata limited.
3    * All rights reserved.
4    * -----------------------------------------------------------------------------
5    * ivata masks may be redistributed under the GNU General Public
6    * License as published by the Free Software Foundation;
7    * version 2 of the License.
8    *
9    * These programs are free software; you can redistribute them and/or
10   * modify them under the terms of the GNU General Public License
11   * as published by the Free Software Foundation; version 2 of the License.
12   *
13   * These programs are distributed in the hope that they will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16   *
17   * See the GNU General Public License in the file LICENSE.txt for more
18   * details.
19   *
20   * If you would like a copy of the GNU General Public License write to
21   *
22   * Free Software Foundation, Inc.
23   * 59 Temple Place - Suite 330
24   * Boston, MA 02111-1307, USA.
25   *
26   *
27   * To arrange commercial support and licensing, contact ivata at
28   *                  http://www.ivata.com/contact.jsp
29   * -----------------------------------------------------------------------------
30   * $Log: MaskFactory.java,v $
31   * Revision 1.5  2005/04/11 12:27:03  colinmacleod
32   * Added preliminary support for filters.
33   * Added FieldValueConvertor factor interface
34   * to split off value convertors for reuse.
35   *
36   * Revision 1.4  2005/04/09 18:04:14  colinmacleod
37   * Changed copyright text to GPL v2 explicitly.
38   *
39   * Revision 1.3  2005/03/10 10:26:17  colinmacleod
40   * Added getClass() method with defaulted name.
41   *
42   * Revision 1.2  2005/01/06 22:13:21  colinmacleod
43   * Moved up a version number.
44   * Changed copyright notices to 2005.
45   * Updated the documentation:
46   *   - started working on multiproject:site docu.
47   *   - changed the logo.
48   * Added checkstyle and fixed LOADS of style issues.
49   * Added separate thirdparty subproject.
50   * Added struts (in web), util and webgui (in webtheme) from ivata op.
51   *
52   * Revision 1.1  2004/12/29 20:07:06  colinmacleod
53   * Renamed subproject masks to mask.
54   *
55   * Revision 1.3  2004/12/29 15:28:15  colinmacleod
56   * Added override for default list/input masks.
57   *
58   * Revision 1.2  2004/11/11 13:34:47  colinmacleod
59   * Added getMask.
60   *
61   * Revision 1.1.1.1  2004/05/16 20:40:31  colinmacleod
62   * Ready for 0.1 release
63   * -----------------------------------------------------------------------------
64   */
65  package com.ivata.mask;
66  import java.io.IOException;
67  import java.io.InputStream;
68  import com.ivata.mask.field.Field;
69  import com.ivata.mask.group.Group;
70  /***
71   * An instance of this interface is used to generate all masks and groups in the
72   * project.
73   *
74   * @since ivata masks 0.1 (2004-05-14)
75   * @author Colin MacLeod
76   * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
77   * @version $Revision: 1.5 $
78   * @see DefaultMaskFactory
79   */
80  public interface MaskFactory {
81      /***
82       * <p>
83       * Get the name of the default mask/screen used for user input.
84       * </p>
85       *
86       * @return name of the default mask/screen used for user input.
87       */
88      String getDefaultInputMask();
89      /***
90       * <p>
91       * Get the name of the default mask/screen used to list a base class.
92       * </p>
93       *
94       * @return name of the default mask/screen used to list a base class.
95       */
96      String getDefaultListMask();
97      /***
98       * <p>
99       * Get a group definition referenced by its id.
100      * </p>
101      *
102      * @param id
103      *            unique identifier of the group.
104      * @return Group definition with the id provided, or <code>null</code> if
105      *         there is no such group.
106      */
107     Group getGroup(String id);
108     /***
109      * <p>
110      * Get a mask, identified by its class and type.
111      * </p>
112      *
113      * @param valueObjectClass
114      *            class of value object for the mask to be returned.
115      * @param type
116      *            optional parameter defining multiple masks for the same value
117      *            object. May be <code>null</code>.
118      * @return Mask definition with the id provided, or <code>null</code> if
119      *         there is no such mask.
120      */
121     Mask getMask(Class valueObjectClass, String type);
122     /***
123      * <p>
124      * Get the default mask for a value object class.
125      * </p>
126      *
127      * @param valueObjectClass
128      *            class of value object for the mask to be returned.
129      * @return Mask definition with the id provided, or <code>null</code> if
130      *         there is no such mask.
131      */
132     Mask getMask(Class valueObjectClass);
133     /***
134      * <p>
135      * Get a mask, identified by its parent field, and class. This returns the
136      * input mask for the subclassed field.
137      * </p>
138      *
139      * @param parentField
140      *            If this mask applies to a field within another mask, (known as
141      *            a submask) this is the field to which it applies, otherwise
142      *            use the other <code>getMask</code> method.
143      * @param valueObjectClass
144      *            class of value object for the mask to be returned.
145      * @return Mask definition with the id provided, or <code>null</code> if
146      *         there is no such mask.
147      */
148     Mask getMask(Field parentField, Class valueObjectClass);
149     /***
150      * <p>
151      * Discover whether or not this object has been configured.
152      * </p>
153      *
154      * @return <code>true</code> if the object has been configured, otherwise
155      *         <code>false</code>.
156      */
157     boolean isConfigured();
158     /***
159      * <p>
160      * Get the configuration represented by the document provided.
161      * </p>
162      *
163      * @param inputStream
164      *            The input stream to read the XML from.
165      * @throws IOException
166      *             If there is any problem reading from the stream provided.
167      */
168     void readConfiguration(InputStream inputStream) throws IOException;
169 }