Source Code Cross Referenced for OjbMetaCollectionDescriptorNode.java in  » Database-ORM » db-ojb » org » apache » ojb » tools » mapping » reversedb2 » ojbmetatreemodel » 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 » Database ORM » db ojb » org.apache.ojb.tools.mapping.reversedb2.ojbmetatreemodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.ojb.tools.mapping.reversedb2.ojbmetatreemodel;
002:
003:        import org.apache.ojb.broker.metadata.ClassDescriptor;
004:        import org.apache.ojb.broker.metadata.CollectionDescriptor;
005:        import org.apache.ojb.broker.metadata.DescriptorRepository;
006:        import org.apache.commons.collections.iterators.ArrayIterator;
007:
008:        public class OjbMetaCollectionDescriptorNode extends OjbMetaTreeNode {
009:            private static java.util.ArrayList supportedActions = new java.util.ArrayList();
010:
011:            private CollectionDescriptor collectionDescriptor;
012:
013:            /* Copyright 2002-2005 The Apache Software Foundation
014:             *
015:             * Licensed under the Apache License, Version 2.0 (the "License");
016:             * you may not use this file except in compliance with the License.
017:             * You may obtain a copy of the License at
018:             *
019:             *     http://www.apache.org/licenses/LICENSE-2.0
020:             *
021:             * Unless required by applicable law or agreed to in writing, software
022:             * distributed under the License is distributed on an "AS IS" BASIS,
023:             * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
024:             * See the License for the specific language governing permissions and
025:             * limitations under the License.
026:             */
027:            public OjbMetaCollectionDescriptorNode(
028:                    DescriptorRepository pRepository,
029:                    OjbMetaDataTreeModel pTreeModel, OjbMetaTreeNode pparent,
030:                    CollectionDescriptor pCollectionDescriptor) {
031:                super (pRepository, pTreeModel, pparent);
032:                this .collectionDescriptor = pCollectionDescriptor;
033:            }
034:
035:            /**
036:             * @see OjbMetaTreeNode#_load()
037:             */
038:            protected boolean _load() {
039:                java.util.ArrayList newChildren = new java.util.ArrayList();
040:                ClassDescriptor itemClass = this .getRepository()
041:                        .getDescriptorFor(
042:                                this .collectionDescriptor.getItemClassName());
043:                newChildren.add(getOjbMetaTreeModel()
044:                        .getClassDescriptorNodeForClassDescriptor(itemClass));
045:
046:                // Foreign Key fields retrieved here map to FieldDescriptors of the table in the collection
047:                System.err.println(toString());
048:                java.util.Iterator it;
049:                try {
050:                    it = new ArrayIterator(collectionDescriptor
051:                            .getFksToThisClass());
052:                    while (it.hasNext())
053:                        newChildren
054:                                .add(new javax.swing.tree.DefaultMutableTreeNode(
055:                                        "FksToThisClass: "
056:                                                + it.next().toString()));
057:                    it = new ArrayIterator(collectionDescriptor
058:                            .getFksToItemClass());
059:                    while (it.hasNext())
060:                        newChildren
061:                                .add(new javax.swing.tree.DefaultMutableTreeNode(
062:                                        "FksToItemClass: "
063:                                                + it.next().toString()));
064:
065:                } catch (NullPointerException npe) {
066:                }
067:                try {
068:
069:                    it = collectionDescriptor.getForeignKeyFields().iterator();
070:                    while (it.hasNext())
071:                        newChildren
072:                                .add(new javax.swing.tree.DefaultMutableTreeNode(
073:                                        "FkFields: " + it.next().toString()));
074:                } catch (NullPointerException npe) {
075:                    npe.printStackTrace();
076:                }
077:                this .alChildren = newChildren;
078:                this .getOjbMetaTreeModel().nodeStructureChanged(this );
079:                return true;
080:            }
081:
082:            /**
083:             * Override load() of superClass to prevent recursive loading which would lead to an endless recursion
084:             * because of OjbClassDescriptorNodes being children of this node
085:             */
086:            public boolean load() {
087:                return _load();
088:            }
089:
090:            /**
091:             * @see OjbMetaTreeNode#isLeaf()
092:             */
093:            public boolean isLeaf() {
094:                return false;
095:            }
096:
097:            /**
098:             * @see OjbMetaTreeNode#getAllowsChildren()
099:             */
100:            public boolean getAllowsChildren() {
101:                return false;
102:            }
103:
104:            /**
105:             * @see OjbMetaTreeNode#setAttribute(String, Object)
106:             */
107:            public void setAttribute(String strKey, Object value) {
108:            }
109:
110:            /**
111:             * @see OjbMetaTreeNode#getAttribute(String)
112:             */
113:            public Object getAttribute(String strKey) {
114:                return null;
115:            }
116:
117:            /**
118:             * @see org.apache.ojb.tools.mapping.reversedb2.propertyEditors.PropertyEditorTarget#getPropertyEditorClass()
119:             */
120:            public Class getPropertyEditorClass() {
121:                return null;
122:            }
123:
124:            public String toString() {
125:                //    	System.out.println(collectionDescriptor.toXML());
126:                if (collectionDescriptor.getItemClassName() == null)
127:                    return "CollectionDescriptor.getItemClass() == null";
128:                else
129:                    return "CollectionDescriptor: "
130:                            + collectionDescriptor.getItemClassName();
131:            }
132:
133:            /**
134:             * @see org.apache.ojb.tools.mapping.reversedb2.ActionTarget#getActions()
135:             */
136:            public java.util.Iterator getActions() {
137:                return supportedActions.iterator();
138:            }
139:
140:            /**
141:             * @see org.apache.ojb.tools.mapping.reversedb2.ActionTarget#actionListCachable() 
142:             */
143:            public boolean actionListCachable() {
144:                return true;
145:            }
146:
147:            public boolean actionListStatic() {
148:                return true;
149:            }
150:
151:            /**
152:             * Return the descriptor object this node is associated with. E.g. if the 
153:             * node displays a class descriptor, the ClassDescriptor describing the class
154:             * should be returned. Used for creating a Transferable.
155:             */
156:            public Object getAssociatedDescriptor() {
157:                return collectionDescriptor;
158:            }
159:
160:        }
ww_w.__j_a___v__a_2s.___c_o__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.