Source Code Cross Referenced for HibernateUtils.java in  » UML » AndroMDA-3.2 » org » andromda » cartridges » hibernate » 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 » UML » AndroMDA 3.2 » org.andromda.cartridges.hibernate 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.andromda.cartridges.hibernate;
002:
003:        import java.util.Collection;
004:        import java.util.LinkedHashSet;
005:
006:        import org.andromda.cartridges.hibernate.metafacades.HibernateGlobals;
007:        import org.andromda.metafacades.uml.Service;
008:        import org.apache.commons.collections.Closure;
009:        import org.apache.commons.collections.CollectionUtils;
010:
011:        /**
012:         * Contains utilities used within the Hibernate cartridge.
013:         *
014:         * @author Chad Brandon
015:         * @author Joel Kozikowski
016:         * @author Wouter Zoons
017:         */
018:        public class HibernateUtils {
019:            /**
020:             * Retrieves all roles from the given <code>services</code> collection.
021:             *
022:             * @param services the collection services.
023:             * @return all roles from the collection.
024:             */
025:            public Collection getAllRoles(Collection services) {
026:                final Collection allRoles = new LinkedHashSet();
027:                CollectionUtils.forAllDo(services, new Closure() {
028:                    public void execute(Object object) {
029:                        if (object instanceof  Service) {
030:                            allRoles.addAll(((Service) object).getAllRoles());
031:                        }
032:                    }
033:                });
034:                return allRoles;
035:            }
036:
037:            /**
038:             * Stores the version of Hibernate we're generating for.
039:             */
040:            private String hibernateVersion;
041:
042:            /**
043:             * Sets the version of Hibernate we're generating for.
044:             *
045:             * @param hibernateVersion The version to set.
046:             */
047:            public void setHibernateVersion(final String hibernateVersion) {
048:                this .hibernateVersion = hibernateVersion;
049:            }
050:
051:            /**
052:             * Retrieves the appropriate Hibernate package for the given version.
053:             *
054:             * @return the Hibernate package name.
055:             */
056:            public String getHibernatePackage() {
057:                return this .isVersion3() ? "org.hibernate" : "net.sf.hibernate";
058:            }
059:
060:            /**
061:             * Retrieves the appropriate package for Hibernate user types given
062:             * the version defined within this class.
063:             *
064:             * @return the hibernate user type package.
065:             */
066:            public String getHibernateUserTypePackage() {
067:                return isVersion3() ? this .getHibernatePackage() + ".usertype"
068:                        : this .getHibernatePackage();
069:            }
070:
071:            /**
072:             * Indicates whether or not Hibernate 3 is enabled.
073:             *
074:             * @return true/false
075:             */
076:            public boolean isVersion3() {
077:                return isVersion3(this .hibernateVersion);
078:            }
079:
080:            /**
081:             * Indicates whether or not the given property value is version 3 or not.
082:             *
083:             * @param hibernateVersionPropertyValue the value of the property
084:             * @return true/false
085:             */
086:            public static boolean isVersion3(
087:                    String hibernateVersionPropertyValue) {
088:                boolean version3 = false;
089:                if (hibernateVersionPropertyValue != null) {
090:                    version3 = hibernateVersionPropertyValue
091:                            .equals(HibernateGlobals.HIBERNATE_VERSION_3);
092:                }
093:                return version3;
094:            }
095:
096:            /**
097:             * Denotes whether or not to make use of Hibernate 3 XML persistence support.
098:             */
099:            private String hibernateXmlPersistence;
100:
101:            /**
102:             * @param hibernateXmlPersistence <code>true</code> when you to make use of Hibernate 3 XML persistence support,
103:             *      <code>false</code> otherwise
104:             */
105:            public void setHibernateXMLPersistence(
106:                    final String hibernateXmlPersistence) {
107:                this .hibernateXmlPersistence = hibernateXmlPersistence;
108:            }
109:
110:            public boolean isXmlPersistenceActive() {
111:                return isXmlPersistenceActive(this .hibernateVersion,
112:                        this .hibernateXmlPersistence);
113:            }
114:
115:            public static boolean isXmlPersistenceActive(
116:                    String hibernateVersionPropertyValue,
117:                    String hibernateXMLPersistencePropertyValue) {
118:                return isVersion3(hibernateVersionPropertyValue)
119:                        && "true"
120:                                .equalsIgnoreCase(hibernateXMLPersistencePropertyValue);
121:            }
122:
123:            private String hibernateMappingStrategy;
124:
125:            public void setHibernateMappingStrategy(
126:                    String hibernateMappingStrategy) {
127:                this .hibernateMappingStrategy = hibernateMappingStrategy;
128:            }
129:
130:            public boolean isMapSubclassesInSeparateFile() {
131:                return mapSubclassesInSeparateFile(this .hibernateMappingStrategy);
132:            }
133:
134:            public static boolean mapSubclassesInSeparateFile(
135:                    String hibernateMappingStrategy) {
136:                // subclass or hierarchy
137:                return HibernateGlobals.HIBERNATE_MAPPING_STRATEGY_SUBCLASS
138:                        .equalsIgnoreCase(hibernateMappingStrategy);
139:            }
140:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.