Source Code Cross Referenced for OrgCodeEOK.java in  » ERP-CRM-Financial » Kuali-Financial-System » mocks » elements » 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 » mocks.elements 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 The Kuali Foundation.
003:         * 
004:         * 
005:         * Licensed under the Educational Community License, Version 1.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         * 
009:         * http://www.opensource.org/licenses/ecl1.php
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package mocks.elements;
018:
019:        import org.jdom.Element;
020:        import org.jdom.output.XMLOutputter;
021:
022:        /**
023:         * OrgCDEOK is the key class for retrieving|building the org_cd element in an xml document
024:         * <p>Title: </p>
025:         * <p>Description: </p>
026:         * <p>Copyright: Copyright (c) 2001</p>
027:         * <p>Company: UIS - Indiana University</p>
028:         * @author Xiaofeng Qi
029:         * @version 1.0
030:         */
031:        public class OrgCodeEOK {
032:            public final static String ORG_CODE_EOK = "university_organization_eok";
033:            public final static String ORG_CD_TAG = "org_cd";
034:            public final static String VALUE = "value";
035:            private final String ROUTE_CONTROL_ATTR = "route-control";
036:            private final String ROUTE_CONTROL_TRUE = "yes";
037:
038:            /** Indicates if the key is being used as a route control - true by default*/
039:            private boolean routeControl = true;
040:
041:            //default of org_cd value
042:            public String orgCd = "";
043:
044:            //default chart_of_accounts_eok object
045:            public ChartCodeEOK charteok;
046:
047:            //constructors
048:            //create an org_cd_eok with org_cd and route-control,
049:            //and a charteok
050:            public OrgCodeEOK(String orgCd, ChartCodeEOK charteok,
051:                    boolean isRouteControl) throws Exception {
052:                if ((orgCd == null) || (charteok == null) || orgCd.equals("")) {
053:                    throw new Exception("Empty values for keys not allowed");
054:                }
055:
056:                this .orgCd = orgCd;
057:                this .routeControl = isRouteControl;
058:                this .charteok = charteok;
059:            }
060:
061:            public OrgCodeEOK(String orgCd, String chartCd,
062:                    boolean isRouteControl) throws Exception {
063:                this (orgCd, new ChartCodeEOK(chartCd, isRouteControl),
064:                        isRouteControl);
065:            }
066:
067:            /**
068:             * Construct an OrgCDEOK object from a JDOM element
069:             * @param keyElement a JDOM element
070:             */
071:            public OrgCodeEOK(Element rootElement) throws Exception {
072:                // check if root element is valid
073:                if (!rootElement.getName().equals(OrgCodeEOK.ORG_CODE_EOK)) {
074:                    throw new Exception("Invalid OrgCodeEOK element "
075:                            + rootElement.getName());
076:                }
077:
078:                // set the route-control for this eok
079:                String routeCtrlVal = rootElement
080:                        .getAttributeValue(this .ROUTE_CONTROL_ATTR);
081:
082:                if ((routeCtrlVal != null)
083:                        && routeCtrlVal.trim().equalsIgnoreCase(
084:                                this .ROUTE_CONTROL_TRUE)) {
085:                    this .routeControl = true;
086:                } else {
087:                    this .routeControl = false;
088:                }
089:
090:                //get children elements
091:                // org_cd tag
092:                Element orgCd = rootElement.getChild(OrgCodeEOK.ORG_CD_TAG);
093:
094:                if (orgCd == null) {
095:                    throw new Exception("Missing <org_cd> tag");
096:                }
097:
098:                String orgVal = orgCd.getAttributeValue(VALUE);
099:
100:                if ((orgVal == null) || orgVal.trim().equals("")) {
101:                    throw new Exception(
102:                            "Invalid org_cd element -- missing value for org_cd");
103:                }
104:
105:                this .orgCd = orgVal;
106:
107:                this .charteok = new ChartCodeEOK(rootElement
108:                        .getChild(ChartCodeEOK.CHART_CODE_EOK));
109:            }
110:
111:            /**
112:             * Construct the JDOM Element for this key
113:             * @return Element the JDOM element for this OrgCodeEOK
114:             */
115:            public Element buildJdom() {
116:                //build root element
117:                Element keyJDOM = new Element(ORG_CODE_EOK);
118:
119:                //set route-control for root element
120:                if (this .routeControl) {
121:                    keyJDOM.setAttribute(this .ROUTE_CONTROL_ATTR,
122:                            ROUTE_CONTROL_TRUE);
123:                }
124:
125:                //build the org_cd tag
126:                Element org_cd = new Element(ORG_CD_TAG);
127:                org_cd.setAttribute(VALUE, this .orgCd);
128:                keyJDOM.addContent(org_cd);
129:                keyJDOM.addContent(charteok.buildJdom());
130:
131:                return keyJDOM;
132:            }
133:
134:            public String getSerializedForm() {
135:                XMLOutputter out = new XMLOutputter();
136:
137:                return out.outputString(buildJdom());
138:            }
139:
140:            //getters
141:            public String getOrg_cd_value() {
142:                return orgCd;
143:            }
144:
145:            public ChartCodeEOK getCharteok() {
146:                return charteok;
147:            }
148:
149:            public boolean isRouteControl() {
150:                return this .routeControl;
151:            }
152:
153:            public String getChartCdValue() {
154:                return this .charteok.getChart_cd_value();
155:            }
156:
157:            /**
158:             * Create a printable representation of this object.  Do not count
159:             * on the format of this string being the same in future versions!
160:             *
161:             * @return a string representation of this object
162:             */
163:            public String toString() {
164:                StringBuffer sb = new StringBuffer("[fin_coa_cd=");
165:                sb.append(charteok.getChart_cd_value());
166:                sb.append(",org_cd=");
167:                sb.append(orgCd);
168:                sb.append("]");
169:
170:                return sb.toString();
171:            }
172:        }
173:
174:        /*
175:         * Copyright 2003 The Trustees of Indiana University.  All rights reserved.
176:         *
177:         * This file is part of the EDEN software package.
178:         * For license information, see the LICENSE file in the top level directory
179:         * of the EDEN source distribution.
180:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.