Source Code Cross Referenced for ReferenceDefinition.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » core » datadictionary » 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 » ERP CRM Financial » Kuali Financial System » org.kuali.core.datadictionary 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006-2007 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         * http://www.opensource.org/licenses/ecl1.php
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.kuali.core.datadictionary;
017:
018:        import org.apache.commons.lang.StringUtils;
019:        import org.apache.commons.logging.Log;
020:        import org.apache.commons.logging.LogFactory;
021:        import org.kuali.core.datadictionary.exception.AttributeValidationException;
022:        import org.kuali.core.datadictionary.exception.ClassValidationException;
023:
024:        public class ReferenceDefinition extends DataDictionaryDefinitionBase {
025:
026:            // logger
027:            private static Log LOG = LogFactory
028:                    .getLog(ReferenceDefinition.class);
029:
030:            private String attributeName;
031:            private String activeIndicatorAttributeName;
032:            private boolean activeIndicatorReversed;
033:            private String attributeToHighlightOnFail;
034:            private String displayFieldName;
035:            private String collection;
036:            private Class collectionBusinessObjectClass;
037:
038:            public ReferenceDefinition() {
039:                LOG.debug("creating new ReferenceDefinition");
040:                activeIndicatorReversed = false;
041:            }
042:
043:            /**
044:             * @return attributeName
045:             */
046:            public String getAttributeName() {
047:                return attributeName;
048:            }
049:
050:            /**
051:             * Sets attributeName to the given value.
052:             * 
053:             * @param attributeName
054:             * @throws IllegalArgumentException if the given attributeName is blank
055:             */
056:            public void setAttributeName(String attributeName) {
057:                if (StringUtils.isBlank(attributeName)) {
058:                    throw new IllegalArgumentException(
059:                            "invalid (blank) attributeName");
060:                }
061:                LOG.debug("calling setAttributeName '" + attributeName + "'");
062:
063:                this .attributeName = attributeName;
064:            }
065:
066:            /**
067:             * @return activeIndicatorAttributeName
068:             */
069:            public String getActiveIndicatorAttributeName() {
070:                return activeIndicatorAttributeName;
071:            }
072:
073:            /**
074:             * Sets activeIndicatorAttributeName to the given value.
075:             * 
076:             * @param attributeName
077:             * @throws IllegalArgumentException if the given activeIndicatorAttributeName is blank
078:             */
079:            public void setActiveIndicatorAttributeName(
080:                    String activeIndicatorAttributeName) {
081:                LOG.debug("calling setActiveIndicatorAttributeName '"
082:                        + activeIndicatorAttributeName + "'");
083:
084:                this .activeIndicatorAttributeName = activeIndicatorAttributeName;
085:            }
086:
087:            /**
088:             * Gets the activeIndicatorReversed attribute.
089:             * 
090:             * @return Returns the activeIndicatorReversed.
091:             */
092:            public boolean isActiveIndicatorReversed() {
093:                return activeIndicatorReversed;
094:            }
095:
096:            /**
097:             * Sets the activeIndicatorReversed attribute value.
098:             * 
099:             * @param activeIndicatorReversed The activeIndicatorReversed to set.
100:             */
101:            public void setActiveIndicatorReversed(
102:                    boolean activeIndicatorReversed) {
103:                LOG.debug("calling setActiveIndicatorReversed '"
104:                        + activeIndicatorReversed + "'");
105:                this .activeIndicatorReversed = activeIndicatorReversed;
106:            }
107:
108:            /**
109:             * Gets the attributeToHighlightOnFail attribute.
110:             * 
111:             * @return Returns the attributeToHighlightOnFail.
112:             */
113:            public String getAttributeToHighlightOnFail() {
114:                return attributeToHighlightOnFail;
115:            }
116:
117:            /**
118:             * Sets the attributeToHighlightOnFail attribute value.
119:             * 
120:             * @param attributeToHighlightOnFail The attributeToHighlightOnFail to set.
121:             */
122:            public void setAttributeToHighlightOnFail(
123:                    String attributeToHighlightOnFail) {
124:                if (StringUtils.isBlank(attributeToHighlightOnFail)) {
125:                    throw new IllegalArgumentException(
126:                            "invalid (blank) attributeToHighlightOnFail");
127:                }
128:                LOG.debug("calling setAttributeToHighlightOnFail '"
129:                        + attributeToHighlightOnFail + "'");
130:                this .attributeToHighlightOnFail = attributeToHighlightOnFail;
131:            }
132:
133:            /**
134:             * Gets the displayFieldName attribute.
135:             * 
136:             * @return Returns the displayFieldName.
137:             */
138:            public String getDisplayFieldName() {
139:                return displayFieldName;
140:            }
141:
142:            /**
143:             * Sets the displayFieldName attribute value.
144:             * 
145:             * @param displayFieldName The displayFieldName to set.
146:             */
147:            public void setDisplayFieldName(String displayFieldName) {
148:                LOG.debug("calling setDisplayFieldName '" + displayFieldName
149:                        + "'");
150:                this .displayFieldName = displayFieldName;
151:            }
152:
153:            /**
154:             * This method returns true if the displayFieldName is set, otherwise it returns false. Whether the displayFieldName is set is
155:             * defined by whether it has any non-whitespace content in it.
156:             * 
157:             * @return
158:             */
159:            public boolean isDisplayFieldNameSet() {
160:                if (StringUtils.isBlank(displayFieldName)) {
161:                    return false;
162:                } else {
163:                    return true;
164:                }
165:            }
166:
167:            /**
168:             * @return Returns true if there is an ActiveIndicatorAttributeName set, false if not.
169:             */
170:            public boolean isActiveIndicatorSet() {
171:                if (StringUtils.isNotBlank(activeIndicatorAttributeName)) {
172:                    return true;
173:                } else {
174:                    return false;
175:                }
176:            }
177:
178:            public String getCollection() {
179:                return collection;
180:            }
181:
182:            public void setCollection(String collection) {
183:                LOG.debug("calling setCollection '" + collection + "'");
184:                this .collection = collection;
185:            }
186:
187:            public boolean isCollectionReference() {
188:                return StringUtils.isNotBlank(getCollection());
189:            }
190:
191:            public Class getCollectionBusinessObjectClass() {
192:                return collectionBusinessObjectClass;
193:            }
194:
195:            public void setCollectionBusinessObjectClass(
196:                    Class collectionBusinessObjectClass) {
197:                this .collectionBusinessObjectClass = collectionBusinessObjectClass;
198:            }
199:
200:            /**
201:             * Directly validate simple fields.
202:             * 
203:             * @see org.kuali.core.datadictionary.DataDictionaryDefinition#completeValidation(java.lang.Class, java.lang.Object)
204:             */
205:            public void completeValidation(Class rootBusinessObjectClass,
206:                    Class otherBusinessObjectClass,
207:                    ValidationCompletionUtils validationCompletionUtils) {
208:
209:                // make sure the rootBusinessObjectClass is actually a descendent of BusinessObject
210:                if (!validationCompletionUtils
211:                        .isBusinessObjectClass(rootBusinessObjectClass)) {
212:                    throw new ClassValidationException(
213:                            "RootBusinessObject is not a descendent of BusinessObject. "
214:                                    + "rootBusinessObjectClass = '"
215:                                    + rootBusinessObjectClass.getName() + "' "
216:                                    + "(" + getParseLocation() + ")");
217:                }
218:
219:                // make sure the attributeName is actually a property of the BO
220:                String tmpAttributeName = isCollectionReference() ? collection
221:                        : attributeName;
222:                if (!validationCompletionUtils.isPropertyOf(
223:                        rootBusinessObjectClass, tmpAttributeName)) {
224:                    throw new AttributeValidationException(
225:                            "unable to find attribute '" + tmpAttributeName
226:                                    + "' in rootBusinessObjectClass '"
227:                                    + rootBusinessObjectClass.getName() + "' ("
228:                                    + getParseLocation() + ")");
229:                }
230:                if (isCollectionReference()) {
231:                    collectionBusinessObjectClass = validationCompletionUtils
232:                            .getCollectionElementClass(rootBusinessObjectClass,
233:                                    collection);
234:                }
235:                // if there's an activeIndicator set, then validate it
236:                if (isActiveIndicatorSet()) {
237:
238:                    // make sure named activeIndicator field exists in the reference class
239:
240:                    Class referenceClass = isCollectionReference() ? validationCompletionUtils
241:                            .getAttributeClass(collectionBusinessObjectClass,
242:                                    attributeName)
243:                            : validationCompletionUtils.getAttributeClass(
244:                                    rootBusinessObjectClass, attributeName);
245:
246:                    if (!validationCompletionUtils.isPropertyOf(referenceClass,
247:                            activeIndicatorAttributeName)) {
248:                        throw new AttributeValidationException(
249:                                "unable to find attribute '"
250:                                        + activeIndicatorAttributeName
251:                                        + "' in reference class '"
252:                                        + referenceClass.getName() + "' ("
253:                                        + getParseLocation() + ")");
254:                    }
255:
256:                    // make sure named activeIndicator field is a boolean in the reference class
257:                    Class activeIndicatorClass = validationCompletionUtils
258:                            .getAttributeClass(referenceClass,
259:                                    activeIndicatorAttributeName);
260:                    if (!activeIndicatorClass.equals(boolean.class)) {
261:                        throw new AttributeValidationException(
262:                                "Active Indicator Attribute Name '"
263:                                        + activeIndicatorAttributeName
264:                                        + "' in reference class '"
265:                                        + referenceClass.getName()
266:                                        + "' is not a boolean, it is a '"
267:                                        + activeIndicatorClass.getName() + "' "
268:                                        + " (" + getParseLocation() + ")");
269:                    }
270:
271:                }
272:
273:                // make sure the attributeToHighlightOnFail is actually a property of the BO
274:                if (isCollectionReference()) {
275:
276:                    if (!validationCompletionUtils.isPropertyOf(
277:                            collectionBusinessObjectClass,
278:                            attributeToHighlightOnFail)) {
279:                        throw new AttributeValidationException(
280:                                "unable to find attribute '"
281:                                        + attributeToHighlightOnFail
282:                                        + "' in collectionBusinessObjectClass '"
283:                                        + collectionBusinessObjectClass
284:                                                .getName() + "' ("
285:                                        + getParseLocation() + ")");
286:                    }
287:                } else {
288:                    if (!validationCompletionUtils
289:                            .isPropertyOf(rootBusinessObjectClass,
290:                                    attributeToHighlightOnFail)) {
291:                        throw new AttributeValidationException(
292:                                "unable to find attribute '"
293:                                        + attributeToHighlightOnFail
294:                                        + "' in rootBusinessObjectClass '"
295:                                        + rootBusinessObjectClass.getName()
296:                                        + "' (" + getParseLocation() + ")");
297:                    }
298:                }
299:
300:            }
301:
302:            /**
303:             * @see java.lang.Object#toString()
304:             */
305:            public String toString() {
306:                return "ReferenceDefinition for attribute "
307:                        + getAttributeName();
308:            }
309:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.