Source Code Cross Referenced for SortDefinition.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-2006 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.Iterator;
021:        import java.util.List;
022:
023:        import org.apache.commons.lang.StringUtils;
024:        import org.apache.commons.logging.Log;
025:        import org.apache.commons.logging.LogFactory;
026:
027:        /**
028:         * Contains sorting-related information for DataDictionary entries.
029:         * 
030:         * Note: the setters do copious amounts of validation, to facilitate generating errors during the parsing process.
031:         * 
032:         * 
033:         */
034:        public class SortDefinition extends DataDictionaryDefinitionBase {
035:            // logger
036:            private static Log LOG = LogFactory.getLog(SortDefinition.class);
037:
038:            private boolean sortAscending;
039:            private String attributeName;
040:            private List attributes;
041:            private List attributeNames;
042:
043:            public SortDefinition() {
044:                LOG.debug("creating new SortDefinition");
045:
046:                this .sortAscending = true;
047:                this .attributes = new ArrayList();
048:                this .attributeNames = new ArrayList();
049:            }
050:
051:            /**
052:             * Sets attributeName to the given value.
053:             * 
054:             * @param attributeName
055:             * @throws IllegalArgumentException if the given attributeName is blank
056:             */
057:            public void setAttributeName(String attributeName) {
058:                if (StringUtils.isBlank(attributeName)) {
059:                    throw new IllegalArgumentException(
060:                            "invalid (blank) attributeName");
061:                }
062:                LOG.debug("calling setAttributeName '" + attributeName + "'");
063:                if (attributes.size() != 0) {
064:                    throw new IllegalStateException(
065:                            "unable to set sort attributeName when sortAttributes have already been added");
066:                }
067:
068:                this .attributeName = attributeName;
069:            }
070:
071:            /**
072:             * Adds the given attribute to the list of attributes associated with this sortDefinition.
073:             * 
074:             * @param sortAttributeDefinition
075:             */
076:            public void addSortAttribute(
077:                    SortAttributeDefinition sortAttributeDefinition) {
078:                if (attributeName != null) {
079:                    throw new IllegalStateException(
080:                            "unable to add sortAttributes when sort attributeName has already been set");
081:                }
082:
083:                this .attributes.add(sortAttributeDefinition);
084:            }
085:
086:            /**
087:             * @return the List of associated attribute names as Strings
088:             */
089:            public List getAttributeNames() {
090:                return this .attributeNames;
091:            }
092:
093:            /**
094:             * @return true if items should sort in ascending order
095:             */
096:            public boolean getSortAscending() {
097:                return sortAscending;
098:            }
099:
100:            /**
101:             * Sets sortAscending to the given value
102:             * 
103:             * @param sortAscending
104:             */
105:            public void setSortAscending(boolean sortAscending) {
106:                LOG.debug("calling setSortAscending '" + sortAscending + "'");
107:
108:                this .sortAscending = sortAscending;
109:            }
110:
111:            /**
112:             * Directly validate simple fields.
113:             * 
114:             * @see org.kuali.core.datadictionary.DataDictionaryDefinition#completeValidation(java.lang.Class, java.lang.Object)
115:             */
116:            public void completeValidation(Class rootBusinessObjectClass,
117:                    Class otherBusinessObjectClass,
118:                    ValidationCompletionUtils validationCompletionUtils) {
119:                if (this .attributeName != null) {
120:                    boolean oldIsParsingFile = isParsingFile;
121:                    isParsingFile = false;
122:                    SortAttributeDefinition syntheticAttribute = new SortAttributeDefinition();
123:                    isParsingFile = oldIsParsingFile;
124:                    syntheticAttribute.setAttributeName(this .attributeName);
125:                    this .attributeName = null;
126:
127:                    addSortAttribute(syntheticAttribute);
128:                }
129:
130:                for (Iterator i = attributes.iterator(); i.hasNext();) {
131:                    SortAttributeDefinition sortAttributeDefinition = (SortAttributeDefinition) i
132:                            .next();
133:                    sortAttributeDefinition.completeValidation(
134:                            rootBusinessObjectClass, otherBusinessObjectClass,
135:                            validationCompletionUtils);
136:
137:                    attributeNames.add(sortAttributeDefinition
138:                            .getAttributeName());
139:                }
140:            }
141:
142:            /**
143:             * @see java.lang.Object#toString()
144:             */
145:            public String toString() {
146:                StringBuffer attrList = new StringBuffer("[");
147:                for (Iterator i = attributes.iterator(); i.hasNext();) {
148:                    attrList.append(((SortAttributeDefinition) i.next())
149:                            .getAttributeName());
150:                    if (i.hasNext()) {
151:                        attrList.append(",");
152:                    }
153:                }
154:                attrList.append("]");
155:
156:                return "SortDefinition for attribute " + attrList.toString();
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.