Source Code Cross Referenced for PropertyMeta.java in  » Workflow-Engines » osbl-1_0 » org » conform » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » osbl 1_0 » org.conform 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.conform;
002:
003:        import java.util.*;
004:
005:        import org.conform.format.Format;
006:
007:        /**
008:         * Holds meta information of a property.
009:         */
010:        public class PropertyMeta implements  Meta {
011:            public static final int NO_RELATION = 0;
012:            public static final int ONE_TO_ONE_RELATION = 1;
013:            public static final int ONE_TO_MANY_RELATION = 2;
014:            public static final int MANY_TO_MANY_RELATION = 3;
015:            public static final int MANY_TO_ONE_RELATION = 4;
016:            public static final int DERIVATE = 5;
017:            public static final int VALUE = 6;
018:
019:            public static final String ATTRIBUTE_LENGTH = "length";
020:            public static final String ATTRIBUTE_PRECISION = "precision";
021:            public static final String ATTRIBUTE_SCALE = "scale";
022:            public static final String ATTRIBUTE_ALIGNMENT = "alignment";
023:            public static final String ATTRIBUTE_IMPORTANT = "important";
024:            public static final String ATTRIBUTE_IDENTIFIER = "identifier";
025:            public static final String ATTRIBUTE_PATTERN = "pattern";
026:            public static final String ATTRIBUTE_PATTERN_KEY = "patternKey";
027:            public static final String ATTRIBUTE_CHANGE_LISTENER = "changeListener";
028:
029:            // the BeanMeta, this PropertyMeta belongs to
030:            protected BeanMeta beanMeta;
031:            // the name of the property (field name)
032:            protected String name;
033:            // the type of the property (e.g. String, Long...)
034:            protected Class type;
035:            // specifies if the property is mandatory
036:            protected boolean mandatory;
037:            // specifies if the property is readonly
038:            protected boolean writable = true;
039:            // specifies if the property is hidden
040:            protected boolean readable = true;
041:            // specifies if the property is applicable
042:            protected boolean applicable = true;
043:            // initializer
044:            protected Initializer initializer;
045:            // any additional attributes, if any
046:            protected Map attributes;
047:
048:            // a collection of validators for the field (e.g. max length of a string 20)
049:            protected Collection validators;
050:            // the format which must be suported by the field
051:            protected Format format;
052:            // the type of relation of this property meta with other property meta
053:            private int relationType = NO_RELATION;
054:            // the beanMeta to which this property meta has a relation to 
055:            private BeanMeta relationBean;
056:            private PropertyMeta relationProperty;
057:            // used to eventually sort the bean meta fields in the frontend based on priority 
058:            private int priority = 0;
059:            protected DomainProvider domainProvider;
060:            // the localized label for this field (localization takes place in a modifier)
061:            private String label;
062:            // the localized micro helper for this field (localization takes place in a modifier)
063:            private String microHelp;
064:
065:            private static Map wrapperTypeMap = new HashMap();
066:
067:            static {
068:                wrapperTypeMap.put(boolean.class, Boolean.class);
069:            }
070:
071:            PropertyMeta(String name, Class type) {
072:                this (null, name, type);
073:            }
074:
075:            public PropertyMeta(BeanMeta beanMeta, String name, Class type) {
076:                this .beanMeta = beanMeta;
077:                this .name = name;
078:                this .type = type;
079:                this .mandatory = type.isPrimitive();
080:
081:                if (name == null)
082:                    throw new IllegalArgumentException(
083:                            "null not allowed for name");
084:                if (type == null)
085:                    throw new IllegalArgumentException(
086:                            "null not allowed for type");
087:            }
088:
089:            public BeanMeta getBeanMeta() {
090:                return beanMeta;
091:            }
092:
093:            public String getName() {
094:                return name;
095:            }
096:
097:            public void setName(String name) {
098:                this .name = name;
099:            }
100:
101:            public Class getType() {
102:                return type;
103:            }
104:
105:            public void setType(Class type) {
106:                this .type = type;
107:            }
108:
109:            public boolean isMandatory() {
110:                return mandatory;
111:            }
112:
113:            public void setMandatory(boolean mandatory) {
114:                this .mandatory = mandatory;
115:            }
116:
117:            public boolean isWritable() {
118:                return writable;
119:            }
120:
121:            public void setWritable(boolean writable) {
122:                this .writable = writable;
123:            }
124:
125:            public boolean isReadable() {
126:                return readable;
127:            }
128:
129:            public void setReadable(boolean readable) {
130:                this .readable = readable;
131:            }
132:
133:            public boolean isApplicable() {
134:                return applicable;
135:            }
136:
137:            public void setApplicable(boolean applicable) {
138:                this .applicable = applicable;
139:            }
140:
141:            public Initializer getInitializer() {
142:                return initializer;
143:            }
144:
145:            public void setInitializer(Initializer initializer) {
146:                this .initializer = initializer;
147:            }
148:
149:            public Collection getValidators() {
150:                return validators;
151:            }
152:
153:            public void setValidators(Collection validators) {
154:                this .validators = validators;
155:            }
156:
157:            public void addValidator(Validator validator) {
158:                if (validator == null)
159:                    throw new IllegalArgumentException("null not allowed");
160:
161:                if (validators == null) {
162:                    validators = new ArrayList();
163:                }
164:                validators.add(validator);
165:            }
166:
167:            public Format getFormat() {
168:                return format;
169:            }
170:
171:            public void setFormat(Format format) {
172:                this .format = format;
173:            }
174:
175:            public DomainProvider getDomainProvider() {
176:                return domainProvider;
177:            }
178:
179:            public void setDomainProvider(DomainProvider domainProvider) {
180:                this .domainProvider = domainProvider;
181:            }
182:
183:            public int getRelationType() {
184:                return relationType;
185:            }
186:
187:            public void setRelationType(int relationType) {
188:                this .relationType = relationType;
189:            }
190:
191:            public BeanMeta getRelationBean() {
192:                return relationBean;
193:            }
194:
195:            public void setRelationBean(BeanMeta relationBean) {
196:                this .relationBean = relationBean;
197:            }
198:
199:            public PropertyMeta getRelationProperty() {
200:                return relationProperty;
201:            }
202:
203:            public void setRelationProperty(PropertyMeta relationProperty) {
204:                this .relationProperty = relationProperty;
205:            }
206:
207:            public int getPriority() {
208:                return priority;
209:            }
210:
211:            public void setPriority(int priority) {
212:                this .priority = priority;
213:            }
214:
215:            public void setAttribute(String name, Object value) {
216:                if (attributes == null)
217:                    attributes = new HashMap();
218:
219:                attributes.put(name, value);
220:            }
221:
222:            public Object getAttribute(String name) {
223:                if (attributes == null)
224:                    return null;
225:
226:                return attributes.get(name);
227:            }
228:
229:            public Map getAttributes() {
230:                return attributes;
231:            }
232:
233:            public void setAttributes(Map attributes) {
234:                this .attributes = attributes;
235:            }
236:
237:            public String getMicroHelp() {
238:                return microHelp;
239:            }
240:
241:            public void setMicroHelp(String microHelp) {
242:                this .microHelp = microHelp;
243:            }
244:
245:            public String getLabel() {
246:                return label;
247:            }
248:
249:            public void setLabel(String label) {
250:                this .label = label;
251:            }
252:
253:            public String parameterString() {
254:                StringBuffer buffer = new StringBuffer(name.length() + 10);
255:                buffer.append(name);
256:                buffer.append(": ");
257:                buffer.append(readable ? 'r' : ' ');
258:                buffer.append(writable ? 'w' : ' ');
259:                buffer.append(mandatory ? 'm' : ' ');
260:                buffer.append(' ');
261:                buffer.append(format);
262:                buffer.append(' ');
263:                buffer.append('\n');
264:                for (Iterator iter = validators.iterator(); iter.hasNext();) {
265:                    Validator validator = (Validator) iter.next();
266:                    buffer.append(" ");
267:                    buffer.append(validator);
268:                }
269:                return buffer.toString();
270:            }
271:
272:            public String toString() {
273:                return name;
274:            }
275:
276:            public boolean equals(Object o) {
277:                if (this  == o)
278:                    return true;
279:                if (o == null || getClass() != o.getClass())
280:                    return false;
281:
282:                final PropertyMeta that = (PropertyMeta) o;
283:
284:                if (!beanMeta.equals(that.beanMeta))
285:                    return false;
286:                if (!name.equals(that.name))
287:                    return false;
288:
289:                return true;
290:            }
291:
292:            public int hashCode() {
293:                int result;
294:                result = beanMeta.hashCode();
295:                result = 29 * result + name.hashCode();
296:                return result;
297:            }
298:
299:            public Object clone() {
300:                try {
301:                    PropertyMeta property = (PropertyMeta) super .clone();
302:                    if (attributes != null)
303:                        property.attributes = new HashMap(attributes);
304:
305:                    if (format != null)
306:                        property.format = (Format) format.clone();
307:                    return property;
308:                } catch (Exception e) {
309:                    throw new RuntimeException(e);
310:                }
311:            }
312:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.