1 /*
2 * File: IFrontEndAttributeInformation.java
3 * Created: 23.2.2006 10:43:19
4 *
5 * Copyright 2007 Michal Burda.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 package net.sf.webmancer.db;
23
24 import java.util.Collection;
25
26 /**
27 * This interface represents the front-end meta-data about an attribute of a database table.
28 * The front-end attribute information provides methods of accessing attribute's meta-data
29 * to widgets. See {@link IBackEndAttributeInformation} for an interface defining methods
30 * needed by persistent layer.
31 *
32 * Usually, the classes do not implement this interface directly. Instead, the {@link IAttribute}
33 * interface is implemented.
34 *
35 * @author Michal Burda
36 */
37 public interface IFrontEndAttributeInformation extends ICommonAttributeInformation {
38 /**
39 * Gets the human readable name of the attribute. This name appears in various widgets to describe attribute value
40 * (e.g. as header in DataTable, input-line label in input forms etc.).
41 *
42 * @return The human readable name of the attribute.
43 */
44 String getName();
45
46 /**
47 * Gets the description of the attribute. It contains some help text for users.
48 *
49 * @return The description of the attribute.
50 */
51 String getDescription();
52
53 /**
54 * Determines whether the attribute is mandatory, i.e. it must always have a value assigned to it.
55 *
56 * @return <code>true</code> if the attribute is mandatory.
57 */
58 boolean isMandatory();
59
60 /**
61 * Gets the value that is used as initial if a new record is edited by a user.
62 *
63 * @return the value used to initialize empty entries if a new record is edited by a user.
64 */
65 String getInitialValue();
66
67 /**
68 * Returns the maximum allowed length of user input string. Negative value means unlimited length.
69 *
70 * @return the maximum allowed length of user input string or negative value for unlimited lenght.
71 */
72 int getMaximumInputLength();
73
74 /**
75 * @param internal
76 * @return
77 */
78 String convertInternalToOutput(Object internal);
79
80 /**
81 * @param internal
82 * @return
83 */
84 String convertInternalToInput(Object internal);
85
86 /**
87 * @param input
88 * @return
89 */
90 String preProcessInput(String input);
91
92 /**
93 * @param input
94 * @return
95 */
96 String preProcessConditionInput(String input);
97
98 /**
99 * @param input
100 * @return
101 */
102 Collection<String> validateInput(String input);
103 }