Source Code Cross Referenced for MaintenanceDocumentEntry.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:        package org.kuali.core.datadictionary;
017:
018:        import java.util.ArrayList;
019:        import java.util.Collections;
020:        import java.util.Iterator;
021:        import java.util.LinkedHashMap;
022:        import java.util.List;
023:        import java.util.Map;
024:
025:        import org.apache.commons.logging.Log;
026:        import org.apache.commons.logging.LogFactory;
027:        import org.kuali.core.datadictionary.exception.ClassValidationException;
028:        import org.kuali.core.datadictionary.exception.DuplicateEntryException;
029:        import org.kuali.core.document.MaintenanceDocumentBase;
030:        import org.kuali.core.document.authorization.DocumentAuthorizerBase;
031:
032:        /**
033:         * MaintenanceDocumentEntry
034:         * 
035:         * 
036:         */
037:        public class MaintenanceDocumentEntry extends DocumentEntry {
038:            // logger
039:            private static Log LOG = LogFactory
040:                    .getLog(MaintenanceDocumentEntry.class);
041:
042:            private Class businessObjectClass;
043:            private Class maintainableClass;
044:
045:            private Map maintainableSections;
046:            private Map lockingKeys;
047:            private Map defaultExistenceChecks;
048:            private Map apcRules;
049:
050:            private boolean allowsNewOrCopy;
051:
052:            public MaintenanceDocumentEntry() {
053:                super ();
054:
055:                LOG.debug("creating new MaintenanceDocumentEntry");
056:                maintainableSections = new LinkedHashMap();
057:                lockingKeys = new LinkedHashMap();
058:                defaultExistenceChecks = new LinkedHashMap();
059:                apcRules = new LinkedHashMap();
060:                allowsNewOrCopy = true;
061:                super .setDocumentClass(MaintenanceDocumentBase.class);
062:            }
063:
064:            public void setBusinessObjectClass(Class businessObjectClass) {
065:                if (businessObjectClass == null) {
066:                    throw new IllegalArgumentException(
067:                            "invalid (null) businessObjectClass");
068:                }
069:                LOG.debug("calling setBusinessObjectClass '"
070:                        + businessObjectClass.getName() + "'");
071:
072:                this .businessObjectClass = businessObjectClass;
073:            }
074:
075:            public Class getBusinessObjectClass() {
076:                return businessObjectClass;
077:            }
078:
079:            public void setMaintainableClass(Class maintainableClass) {
080:                if (maintainableClass == null) {
081:                    throw new IllegalArgumentException(
082:                            "invalid (null) maintainableClass");
083:                }
084:                LOG.debug("calling setMaintainableClass '"
085:                        + maintainableClass.getName() + "'");
086:
087:                this .maintainableClass = maintainableClass;
088:            }
089:
090:            public Class getMaintainableClass() {
091:                return maintainableClass;
092:            }
093:
094:            /**
095:             * Adds the given maintainableSection to the current collection of sections defined for this MaintenanceDocumentEntry
096:             * 
097:             * @param maintainableSectionDefinition
098:             */
099:            public void addMaintainableSection(
100:                    MaintainableSectionDefinition maintainableSectionDefinition) {
101:                if (maintainableSectionDefinition == null) {
102:                    throw new IllegalArgumentException(
103:                            "invalid (null) maintainableSectionDefinition");
104:                }
105:
106:                String sectionTitle = maintainableSectionDefinition.getTitle();
107:                if (maintainableSections.containsKey(sectionTitle)) {
108:                    throw new DuplicateEntryException("section '"
109:                            + sectionTitle
110:                            + "' already defined for maintenanceDocument '"
111:                            + getDocumentTypeName() + "'");
112:                }
113:
114:                maintainableSections.put(sectionTitle,
115:                        maintainableSectionDefinition);
116:            }
117:
118:            /**
119:             * @return List of MaintainableSectionDefinition objects contained in this document
120:             */
121:            public List getMaintainableSections() {
122:                List sectionList = new ArrayList();
123:
124:                sectionList.addAll(this .maintainableSections.values());
125:
126:                return Collections.unmodifiableList(sectionList);
127:            }
128:
129:            /**
130:             * @param lockingKey
131:             * @throws IllegalArgumentException if the given lockingKey is null
132:             */
133:            public void addLockingKey(FieldDefinition lockingKey) {
134:                if (lockingKey == null) {
135:                    throw new IllegalArgumentException(
136:                            "invalid (null) lockingKey");
137:                }
138:                LOG.debug("calling addLockingKey for field '"
139:                        + lockingKey.getAttributeName() + "'");
140:
141:                String keyName = lockingKey.getAttributeName();
142:                if (this .lockingKeys.containsKey(keyName)) {
143:                    throw new DuplicateEntryException(
144:                            "duplicate returnKey entry for attribute '"
145:                                    + keyName + "'");
146:                }
147:
148:                this .lockingKeys.put(keyName, lockingKey);
149:            }
150:
151:            /**
152:             * @return List of all lockingKey fieldNames associated with this LookupDefinition, in the order in which they were added
153:             */
154:            public List getLockingKeyFieldnames() {
155:                List fieldNames = new ArrayList();
156:                fieldNames.addAll(this .lockingKeys.keySet());
157:
158:                return Collections.unmodifiableList(fieldNames);
159:            }
160:
161:            /**
162:             * @return Collection of all lockingKey FieldDefinitions associated with this LookupDefinition, in the order in which they were
163:             *         added
164:             */
165:            public List getLockingKeys() {
166:                List keyList = new ArrayList();
167:
168:                keyList.addAll(this .lockingKeys.values());
169:
170:                return Collections.unmodifiableList(keyList);
171:            }
172:
173:            /**
174:             * 
175:             * Adds a new defaultExistenceCheck (ReferenceDefinition) to this MaintDoc
176:             * 
177:             * @param reference
178:             * @throws IllegalArgumentException if the given reference is null
179:             */
180:            public void addDefaultExistenceCheck(ReferenceDefinition reference) {
181:
182:                if (reference == null) {
183:                    throw new IllegalArgumentException(
184:                            "invalid (null) reference");
185:                }
186:                LOG.debug("calling addDefaultExistenceCheck for field '"
187:                        + reference.getAttributeName() + "'");
188:
189:                String keyName = reference.isCollectionReference() ? (reference
190:                        .getCollection()
191:                        + "." + reference.getAttributeName()) : reference
192:                        .getAttributeName();
193:                if (this .defaultExistenceChecks.containsKey(keyName)) {
194:                    throw new DuplicateEntryException(
195:                            "duplicate defaultExistenceCheck entry for attribute '"
196:                                    + keyName + "'");
197:                }
198:
199:                this .defaultExistenceChecks.put(keyName, reference);
200:            }
201:
202:            /**
203:             * 
204:             * @return List of all defaultExistenceCheck ReferenceDefinitions associated with this MaintenanceDocument, in the order in
205:             *         which they were added
206:             * 
207:             */
208:            public List getDefaultExistenceChecks() {
209:                List referenceList = new ArrayList();
210:
211:                referenceList.addAll(this .defaultExistenceChecks.values());
212:
213:                return Collections.unmodifiableList(referenceList);
214:            }
215:
216:            /**
217:             * 
218:             * @return List of all defaultExistenceCheck reference fieldNames associated with this MaintenanceDocument, in the order in
219:             *         which they were added
220:             * 
221:             */
222:            public List getDefaultExistenceCheckFieldNames() {
223:                List fieldNames = new ArrayList();
224:                fieldNames.addAll(this .defaultExistenceChecks.keySet());
225:
226:                return Collections.unmodifiableList(fieldNames);
227:            }
228:
229:            /**
230:             * Adds a new apcRule (ApcRuleDefinition) to this class
231:             * 
232:             * @param apcRule
233:             */
234:            public void addApcRule(ApcRuleDefinition apcRule) {
235:
236:                if (apcRule == null) {
237:                    throw new IllegalArgumentException("invalid (null) apcRule");
238:                }
239:                LOG.debug("calling addApcRule for field '"
240:                        + apcRule.getAttributeName() + "'");
241:
242:                String keyName = apcRule.getAttributeName();
243:                if (this .apcRules.containsKey(keyName)) {
244:                    throw new DuplicateEntryException(
245:                            "duplicate apcRule entry for attribute '" + keyName
246:                                    + "'");
247:                }
248:
249:                this .apcRules.put(keyName, apcRule);
250:            }
251:
252:            /**
253:             * 
254:             * @return List of all apcRule ApcRuleDefinitions associated with this MaintenanceDocument, in the order in which they were
255:             *         added
256:             * 
257:             */
258:            public List getApcRules() {
259:                List rulesList = new ArrayList();
260:
261:                rulesList.addAll(this .apcRules.values());
262:
263:                return Collections.unmodifiableList(rulesList);
264:            }
265:
266:            /**
267:             * 
268:             * @return List of all apcRule rule's fieldNames associated with this MaintenanceDocument, in the order in which they were added
269:             * 
270:             */
271:            public List getApcRuleFieldNames() {
272:                List fieldNames = new ArrayList();
273:                fieldNames.addAll(this .apcRules.keySet());
274:
275:                return Collections.unmodifiableList(fieldNames);
276:            }
277:
278:            /**
279:             * Gets the allowsNewOrCopy attribute. 
280:             * @return Returns the allowsNewOrCopy.
281:             */
282:            public boolean getAllowsNewOrCopy() {
283:                return allowsNewOrCopy;
284:            }
285:
286:            /**
287:             * Sets the allowsNewOrCopy attribute value.
288:             * @param allowsNewOrCopy The allowsNewOrCopy to set.
289:             */
290:            public void setAllowsNewOrCopy(boolean allowsNewOrCopy) {
291:                this .allowsNewOrCopy = allowsNewOrCopy;
292:            }
293:
294:            /**
295:             * Directly validate simple fields, call completeValidation on Definition fields.
296:             * 
297:             * @see org.kuali.core.datadictionary.DocumentEntry#completeValidation()
298:             */
299:            public void completeValidation(
300:                    ValidationCompletionUtils validationCompletionUtils) {
301:                super .completeValidation(validationCompletionUtils);
302:
303:                if (!validationCompletionUtils
304:                        .isBusinessObjectClass(businessObjectClass)) {
305:                    throw new ClassValidationException("businessObjectClass '"
306:                            + businessObjectClass.getName()
307:                            + "' is not a BusinessObject class");
308:                }
309:
310:                if (!validationCompletionUtils
311:                        .isMaintainableClass(maintainableClass)) {
312:                    throw new ClassValidationException("maintainableClasss '"
313:                            + maintainableClass.getName()
314:                            + "' is not a Maintainable class");
315:                }
316:
317:                for (Iterator i = maintainableSections.entrySet().iterator(); i
318:                        .hasNext();) {
319:                    Map.Entry e = (Map.Entry) i.next();
320:
321:                    MaintainableSectionDefinition maintainableSectionDefinition = (MaintainableSectionDefinition) e
322:                            .getValue();
323:                    maintainableSectionDefinition.completeValidation(
324:                            businessObjectClass, null,
325:                            validationCompletionUtils);
326:                }
327:
328:                for (Iterator i = lockingKeys.entrySet().iterator(); i
329:                        .hasNext();) {
330:                    Map.Entry e = (Map.Entry) i.next();
331:
332:                    FieldDefinition returnKey = (FieldDefinition) e.getValue();
333:                    returnKey.completeValidation(businessObjectClass, null,
334:                            validationCompletionUtils);
335:                }
336:
337:                for (Iterator i = defaultExistenceChecks.entrySet().iterator(); i
338:                        .hasNext();) {
339:                    Map.Entry e = (Map.Entry) i.next();
340:
341:                    ReferenceDefinition reference = (ReferenceDefinition) e
342:                            .getValue();
343:                    reference.completeValidation(businessObjectClass, null,
344:                            validationCompletionUtils);
345:                }
346:
347:                for (Iterator i = apcRules.entrySet().iterator(); i.hasNext();) {
348:                    Map.Entry e = (Map.Entry) i.next();
349:
350:                    ApcRuleDefinition apcRule = (ApcRuleDefinition) e
351:                            .getValue();
352:                    apcRule.completeValidation(businessObjectClass, null,
353:                            validationCompletionUtils);
354:                }
355:
356:                // its never okay for a MaintenanceDocument.xml file to have the
357:                // DocumentAuthorizerBase class as its documentAuthorizerClass.
358:                if (documentAuthorizerClass
359:                        .equals(DocumentAuthorizerBase.class)) {
360:                    throw new ClassValidationException(
361:                            "This maintenance document for '"
362:                                    + businessObjectClass.getName()
363:                                    + "' has an invalid "
364:                                    + "documentAuthorizerClass ('"
365:                                    + documentAuthorizerClass.getName()
366:                                    + "').  "
367:                                    + "Maintenance Documents cannot use the "
368:                                    + "DocumentAuthorizerBase class for their documentAuthorizerClass property.  "
369:                                    + "They must use MaintenanceDocumentAuthorizerBase, or one of its subclasses.");
370:                }
371:            }
372:
373:            /**
374:             * @see java.lang.Object#toString()
375:             */
376:            public String toString() {
377:                return "MaintenanceDocumentEntry for documentType "
378:                        + getDocumentTypeName();
379:            }
380:
381:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.