Source Code Cross Referenced for UserDefinedTypeMetaModel.java in  » Database-ORM » ODAL » com » completex » objective » components » persistency » 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 » ODAL » com.completex.objective.components.persistency 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *  Objective Database Abstraction Layer (ODAL)
003:         *  Copyright (c) 2004, The ODAL Development Group
004:         *  All rights reserved.
005:         *  For definition of the ODAL Development Group please refer to LICENCE.txt file
006:         *
007:         *  Distributable under LGPL license.
008:         *  See terms of license at gnu.org.
009:         */package com.completex.objective.components.persistency;
010:
011:        import com.completex.objective.components.persistency.meta.ModelFilter;
012:
013:        import java.util.Iterator;
014:        import java.util.LinkedHashMap;
015:        import java.util.Map;
016:
017:        /**
018:         * Under construction 
019:         *
020:         * @author Gennady Krizhevsky
021:         */
022:        public class UserDefinedTypeMetaModel implements  ModelConsts {
023:
024:            private Map tables = new LinkedHashMap();
025:            private Map modelByObjectId = new LinkedHashMap();
026:
027:            private ModelFilter filter = new ModelFilter.NullModelFilter();
028:
029:            public UserDefinedTypeMetaTable getColumnById(String objectId) {
030:                return (UserDefinedTypeMetaTable) modelByObjectId.get(objectId);
031:            }
032:
033:            public UserDefinedTypeMetaTable getTypeTable(String key) {
034:                return (UserDefinedTypeMetaTable) tables.get(key);
035:            }
036:
037:            public boolean containsObjectId(String objectId) {
038:                return modelByObjectId.containsKey(objectId);
039:            }
040:
041:            public void addColumn(String key, UserDefinedTypeMetaTable table) {
042:                tables.put(key, table);
043:                table.setModelByObjectId(modelByObjectId);
044:            }
045:
046:            public Iterator typeTableNameIterator() {
047:                return tables.keySet().iterator();
048:            }
049:
050:            public final Map toInternalMap() {
051:                final Map modelMap = new LinkedHashMap();
052:
053:                final Map tableMap = new LinkedHashMap();
054:
055:                modelMap.put(TABLES_TAG, tableMap);
056:
057:                for (Iterator it = tables.keySet().iterator(); it.hasNext();) {
058:                    String tableName = (String) it.next();
059:                    UserDefinedTypeMetaTable table = (UserDefinedTypeMetaTable) tables
060:                            .get(tableName);
061:                    tableMap.put(table.getName(), table.toInternalMap());
062:                }
063:
064:                return modelMap;
065:            }
066:
067:            public final Map toExternalMap() {
068:                final Map modelMap = new LinkedHashMap();
069:
070:                final Map tableMap = new LinkedHashMap();
071:
072:                modelMap.put(TABLES_TAG, tableMap);
073:
074:                for (Iterator it = tables.keySet().iterator(); it.hasNext();) {
075:                    String tableName = (String) it.next();
076:                    UserDefinedTypeMetaTable table = (UserDefinedTypeMetaTable) tables
077:                            .get(tableName);
078:                    tableMap.put(table.getName(), table.toExternalMap());
079:                }
080:
081:                return modelMap;
082:            }
083:
084:            /**
085:             * This method must be called before fromInternalMap since it populates
086:             * aliases map.
087:             *
088:             * @param modelMap
089:             */
090:            public final void fromExternalMap(Map modelMap) {
091:
092:                Map tablesMap = (Map) modelMap.get(TABLES_TAG);
093:
094:                for (Iterator it = tablesMap.keySet().iterator(); it.hasNext();) {
095:                    String tableKey = (String) it.next();
096:                    Map tableMap = (Map) tablesMap.get(tableKey);
097:                    String tableName = (String) tableMap.get(TABLE_NAME_TAG);
098:                    String tableAlias = (String) tableMap.get(TABLE_ALIAS_TAG);
099:
100:                    if (filter.isAllowed(tableName)) {
101:                        UserDefinedTypeMetaTable table = (UserDefinedTypeMetaTable) tables
102:                                .get(tableName);
103:                        //                if (table == null) {
104:                        //                    table = new UserDefinedTypeMetaTable(tableName);
105:                        //                }
106:                        if (table != null) {
107:                            table.fromExternalMap(tableMap);
108:                            tables.put(tableName, table);
109:                        }
110:                    }
111:                }
112:            }
113:
114:            public final void fromInternalMap(Map modelMap) {
115:                Map tablesMap = (Map) modelMap.get(TABLES_TAG);
116:
117:                for (Iterator it = tablesMap.keySet().iterator(); it.hasNext();) {
118:                    String tableKey = (String) it.next();
119:                    Map tableMap = (Map) tablesMap.get(tableKey);
120:                    String tableName = (String) tableMap.get(TABLE_NAME_TAG);
121:
122:                    if (filter.isAllowed(tableName)) {
123:                        UserDefinedTypeMetaTable table = (UserDefinedTypeMetaTable) tables
124:                                .get(tableName);
125:                        if (table == null) {
126:                            table = new UserDefinedTypeMetaTable(tableName);
127:                        }
128:                        table.fromInternalMap(tableMap);
129:                        tables.put(tableName, table);
130:                    }
131:                }
132:            }
133:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.