Source Code Cross Referenced for LookupDefinition.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 2005-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:
017:        package org.kuali.core.datadictionary;
018:
019:        import java.util.ArrayList;
020:        import java.util.Collection;
021:        import java.util.Collections;
022:        import java.util.Iterator;
023:        import java.util.LinkedHashMap;
024:        import java.util.List;
025:        import java.util.Map;
026:
027:        import org.apache.commons.lang.StringUtils;
028:        import org.apache.commons.logging.Log;
029:        import org.apache.commons.logging.LogFactory;
030:        import org.kuali.RiceConstants;
031:        import org.kuali.core.datadictionary.exception.DuplicateEntryException;
032:        import org.kuali.rice.KNSServiceLocator;
033:
034:        /**
035:         * Contains lookup-related information relating to the parent BusinessObject.
036:         * 
037:         * Note: the setters do copious amounts of validation, to facilitate generating errors during the parsing process.
038:         * 
039:         * 
040:         */
041:        public class LookupDefinition extends DataDictionaryDefinitionBase {
042:            // logger
043:            private static Log LOG = LogFactory.getLog(LookupDefinition.class);
044:
045:            private String lookupableID;
046:            private String title;
047:            private String menubar;
048:            private String instructions;
049:            private SortDefinition defaultSort;
050:
051:            private Map lookupFields;
052:            private Map<String, FieldDefinition> resultFields;
053:
054:            private String extraButtonSource;
055:            private String extraButtonParams;
056:
057:            public LookupDefinition() {
058:                LOG.debug("creating new LookupDefinition");
059:
060:                this .lookupFields = new LinkedHashMap();
061:                this .resultFields = new LinkedHashMap<String, FieldDefinition>();
062:            }
063:
064:            /**
065:             * @param lookupableID
066:             */
067:            public void setLookupableID(String lookupableID) {
068:                if (lookupableID == null) {
069:                    throw new IllegalArgumentException(
070:                            "invalid (null) lookupableID");
071:                }
072:
073:                this .lookupableID = lookupableID;
074:            }
075:
076:            /**
077:             * @return custom lookupable id
078:             */
079:            public String getLookupableID() {
080:                return this .lookupableID;
081:            }
082:
083:            /**
084:             * @return title
085:             */
086:            public String getTitle() {
087:                return title;
088:            }
089:
090:            /**
091:             * Sets title to the given value.
092:             * 
093:             * @param title
094:             * @throws IllegalArgumentException if the given title is blank
095:             */
096:            public void setTitle(String title) {
097:                if (StringUtils.isBlank(title)) {
098:                    throw new IllegalArgumentException("invalid (blank) title");
099:                }
100:                LOG.debug("calling setTitle '" + title + "'");
101:
102:                this .title = title;
103:            }
104:
105:            /**
106:             * @return true if this instance has a menubar
107:             */
108:            public boolean hasMenubar() {
109:                return (menubar != null);
110:            }
111:
112:            /**
113:             * @return menubar
114:             */
115:            public String getMenubar() {
116:                return menubar;
117:            }
118:
119:            /**
120:             * Sets menubar to the given value.
121:             * 
122:             * @param menubar
123:             * @throws IllegalArgumentException if the given menubar is blank
124:             */
125:            public void setMenubar(String menubar) {
126:                if (StringUtils.isBlank(menubar)) {
127:                    throw new IllegalArgumentException(
128:                            "invalid (blank) menubar");
129:                }
130:                LOG.debug("calling setMenubar '" + menubar + "'");
131:
132:                this .menubar = menubar
133:                        .replace(
134:                                "${kr.externalizable.images.url}",
135:                                KNSServiceLocator
136:                                        .getKualiConfigurationService()
137:                                        .getPropertyString(
138:                                                RiceConstants.EXTERNALIZABLE_IMAGES_URL_KEY))
139:                        .replace(
140:                                "${externalizable.images.url}",
141:                                KNSServiceLocator
142:                                        .getKualiConfigurationService()
143:                                        .getPropertyString(
144:                                                RiceConstants.APPLICATION_EXTERNALIZABLE_IMAGES_URL_KEY));
145:            }
146:
147:            /**
148:             * @return true if this instance has instructions
149:             */
150:            public boolean hasInstructions() {
151:                return (instructions != null);
152:            }
153:
154:            /**
155:             * @return instructions
156:             */
157:            public String getInstructions() {
158:                return instructions;
159:            }
160:
161:            /**
162:             * Sets instructions to the given value.
163:             * 
164:             * @param title
165:             * @throws IllegalArgumentException if the given instructions are blank
166:             */
167:            public void setInstructions(String instructions) {
168:                if (StringUtils.isBlank(instructions)) {
169:                    throw new IllegalArgumentException(
170:                            "invalid (blank) instructions");
171:                }
172:                LOG.debug("calling setInstructions '" + instructions + "'");
173:
174:                this .instructions = instructions;
175:            }
176:
177:            /**
178:             * @return true if this instance has a default sort defined
179:             */
180:            public boolean hasDefaultSort() {
181:                return (defaultSort != null);
182:            }
183:
184:            /**
185:             * @return defaultSort
186:             */
187:            public SortDefinition getDefaultSort() {
188:                return defaultSort;
189:            }
190:
191:            /**
192:             * Sets defaultSort to the given value.
193:             * 
194:             * @param defaultSort
195:             * @throws IllegalArgumentException if the given defaultSort is blank
196:             */
197:            public void setDefaultSort(SortDefinition defaultSort) {
198:                if (defaultSort == null) {
199:                    throw new IllegalArgumentException(
200:                            "invalid (null) defaultSort");
201:                }
202:                LOG.debug("calling setDefaultSort '"
203:                        + defaultSort.toString()
204:                        + "', "
205:                        + (defaultSort.getSortAscending() ? "ascending"
206:                                : "descending"));
207:
208:                this .defaultSort = defaultSort;
209:            }
210:
211:            /**
212:             * @param lookupField
213:             * @throws IllegalArgumentException if the given lookupField is null
214:             */
215:            public void addLookupField(FieldDefinition lookupField) {
216:                if (lookupField == null) {
217:                    throw new IllegalArgumentException(
218:                            "invalid (null) lookupField");
219:                }
220:                LOG.debug("calling addLookupField for field '"
221:                        + lookupField.getAttributeName() + "'");
222:
223:                String keyName = lookupField.getAttributeName();
224:                if (this .lookupFields.containsKey(keyName)) {
225:                    throw new DuplicateEntryException(
226:                            "duplicate lookupField entry for attribute '"
227:                                    + keyName + "'");
228:                }
229:
230:                this .lookupFields.put(keyName, lookupField);
231:            }
232:
233:            /**
234:             * @return List of attributeNames of all lookupField FieldDefinitions associated with this LookupDefinition, in the order in
235:             *         which they were added
236:             */
237:            public List getLookupFieldNames() {
238:                List fieldNames = new ArrayList();
239:                fieldNames.addAll(this .lookupFields.keySet());
240:
241:                return Collections.unmodifiableList(fieldNames);
242:            }
243:
244:            /**
245:             * @return Collection of all lookupField FieldDefinitions associated with this LookupDefinition, in the order in which they were
246:             *         added
247:             */
248:            public Collection getLookupFields() {
249:                return Collections.unmodifiableCollection(this .lookupFields
250:                        .values());
251:            }
252:
253:            /**
254:             * @return FieldDefinition associated with the named lookup field, or null if there is none
255:             * @param fieldName
256:             */
257:            public FieldDefinition getLookupField(String attributeName) {
258:                return (FieldDefinition) lookupFields.get(attributeName);
259:            }
260:
261:            /**
262:             * @param resultField
263:             * @throws IllegalArgumentException if the given resultField is null
264:             */
265:            public void addResultField(FieldDefinition resultField) {
266:                if (resultField == null) {
267:                    throw new IllegalArgumentException(
268:                            "invalid (null) resultField");
269:                }
270:                LOG.debug("calling addResultField for field '"
271:                        + resultField.getAttributeName() + "'");
272:
273:                String keyName = resultField.getAttributeName();
274:                if (this .resultFields.containsKey(keyName)) {
275:                    throw new DuplicateEntryException(
276:                            "duplicate resultField entry for attribute '"
277:                                    + keyName + "'");
278:                }
279:
280:                this .resultFields.put(keyName, resultField);
281:            }
282:
283:            /**
284:             * @return List of attributeNames of all resultField FieldDefinitions associated with this LookupDefinition, in the order in
285:             *         which they were added
286:             */
287:            public List<String> getResultFieldNames() {
288:                List<String> fieldNames = new ArrayList<String>();
289:                fieldNames.addAll(this .resultFields.keySet());
290:
291:                return Collections.unmodifiableList(fieldNames);
292:            }
293:
294:            /**
295:             * @return Collection of all resultField FieldDefinitions associated with this LookupDefinition, in the order in which they were
296:             *         added
297:             */
298:            public Collection<FieldDefinition> getResultFields() {
299:                return Collections.unmodifiableCollection(this .resultFields
300:                        .values());
301:            }
302:
303:            /**
304:             * @return FieldDefinition associated with the named result field, or null if there is none
305:             * @param fieldName
306:             */
307:            public FieldDefinition getResultField(String attributeName) {
308:                return (FieldDefinition) resultFields.get(attributeName);
309:            }
310:
311:            /**
312:             * Directly validate simple fields, call completeValidation on Definition fields.
313:             * 
314:             * @see org.kuali.core.datadictionary.DataDictionaryDefinition#completeValidation(java.lang.Class, java.lang.Object)
315:             */
316:            public void completeValidation(Class rootBusinessObjectClass,
317:                    Class otherBusinessObjectClass,
318:                    ValidationCompletionUtils validationCompletionUtils) {
319:                if (hasDefaultSort()) {
320:                    defaultSort.completeValidation(rootBusinessObjectClass,
321:                            null, validationCompletionUtils);
322:                }
323:
324:                for (Iterator i = lookupFields.entrySet().iterator(); i
325:                        .hasNext();) {
326:                    Map.Entry e = (Map.Entry) i.next();
327:
328:                    FieldDefinition lookupField = (FieldDefinition) e
329:                            .getValue();
330:                    lookupField.completeValidation(rootBusinessObjectClass,
331:                            null, validationCompletionUtils);
332:                }
333:
334:                for (Iterator i = resultFields.entrySet().iterator(); i
335:                        .hasNext();) {
336:                    Map.Entry e = (Map.Entry) i.next();
337:
338:                    FieldDefinition resultField = (FieldDefinition) e
339:                            .getValue();
340:                    resultField.completeValidation(rootBusinessObjectClass,
341:                            null, validationCompletionUtils);
342:                }
343:
344:            }
345:
346:            /**
347:             * @return true if this instance has extraButtonSource
348:             */
349:            public boolean hasExtraButtonSource() {
350:                return extraButtonSource != null;
351:            }
352:
353:            /**
354:             * @return extraButtonSource
355:             */
356:            public String getExtraButtonSource() {
357:                return extraButtonSource;
358:            }
359:
360:            /**
361:             * Sets extraButtonParams to the given value.
362:             * 
363:             * @param extraButtonParams
364:             * @throws IllegalArgumentException if the given source is blank
365:             */
366:            public void setExtraButtonSource(String extraButtonSource) {
367:                if (StringUtils.isBlank(extraButtonSource)) {
368:                    throw new IllegalArgumentException(
369:                            "invalid (blank) button source");
370:                }
371:                LOG
372:                        .debug("calling setInstructions '" + extraButtonSource
373:                                + "'");
374:                this .extraButtonSource = extraButtonSource;
375:            }
376:
377:            /**
378:             * @return true if this instance has extraButtonParams
379:             */
380:            public boolean hasExtraButtonParams() {
381:                return extraButtonParams != null;
382:            }
383:
384:            /**
385:             * @return extraButtonParams
386:             */
387:            public String getExtraButtonParams() {
388:                return extraButtonParams;
389:            }
390:
391:            /**
392:             * Sets extraButtonParams to the given value.
393:             * 
394:             * @param extraButtonParams
395:             */
396:            public void setExtraButtonParams(String extraButtonParams) {
397:                LOG
398:                        .debug("calling setInstructions '" + extraButtonParams
399:                                + "'");
400:                this .extraButtonParams = extraButtonParams;
401:            }
402:
403:            public String toString() {
404:                return "LookupDefinition '" + getTitle() + "'";
405:            }
406:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.