Source Code Cross Referenced for FetchPlanMetaData.java in  » Database-ORM » JPOX » org » jpox » metadata » 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 » JPOX » org.jpox.metadata 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************
002:        Copyright (c) 2007 Andy Jefferson and others. All rights reserved.
003:        Licensed under the Apache License, Version 2.0 (the "License");
004:        you may not use this file except in compliance with the License.
005:        You may obtain a copy of the License at
006:
007:            http://www.apache.org/licenses/LICENSE-2.0
008:
009:        Unless required by applicable law or agreed to in writing, software
010:        distributed under the License is distributed on an "AS IS" BASIS,
011:        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012:        See the License for the specific language governing permissions and
013:        limitations under the License.
014:
015:        Contributors:
016:            ...
017:         **********************************************************************/package org.jpox.metadata;
018:
019:        import java.util.ArrayList;
020:        import java.util.Iterator;
021:        import java.util.List;
022:
023:        import org.jpox.util.StringUtils;
024:
025:        /**
026:         * FetchPlan defined in MetaData.
027:         * 
028:         * @since 1.1
029:         * @version $Revision: 1.12 $
030:         */
031:        public class FetchPlanMetaData extends MetaData {
032:            /** Name of the FetchPlan. */
033:            final String name;
034:
035:            /** Max fetch depth for this FetchPlan. */
036:            protected int maxFetchDepth = -1;
037:
038:            /** Fetch Size for use when querying using this FetchPlan. */
039:            protected int fetchSize = -1;
040:
041:            /** Series of Fetch Groups used in this FetchPlan. Only used during construction. */
042:            protected List fetchGroups = new ArrayList();
043:
044:            /**
045:             * Constructor.
046:             * @param parent The parent MetaData
047:             * @param name Name of fetch plan
048:             * @param depth Max fetch depth
049:             * @param size Fetch size for this fetch plan
050:             */
051:            public FetchPlanMetaData(MetaData parent, String name,
052:                    String depth, String size) {
053:                super (parent);
054:
055:                this .name = name;
056:                if (!StringUtils.isWhitespace(depth)) {
057:                    try {
058:                        this .maxFetchDepth = (new Integer(depth)).intValue();
059:                    } catch (NumberFormatException nfe) {
060:                        this .maxFetchDepth = -1;
061:                    }
062:                }
063:                if (!StringUtils.isWhitespace(size)) {
064:                    try {
065:                        this .fetchSize = (new Integer(size)).intValue();
066:                    } catch (NumberFormatException nfe) {
067:                        this .fetchSize = -1;
068:                    }
069:                }
070:            }
071:
072:            /**
073:             * Accessor for name
074:             * @return Returns the name.
075:             */
076:            public final String getName() {
077:                return name;
078:            }
079:
080:            /**
081:             * Accessor for the maximum fetch depth.
082:             * @return Returns the max fetch depth
083:             */
084:            public final int getMaxFetchDepth() {
085:                return maxFetchDepth;
086:            }
087:
088:            /**
089:             * Accessor for the fetch size.
090:             * @return Returns the fetch size
091:             */
092:            public final int getFetchSize() {
093:                return fetchSize;
094:            }
095:
096:            /**
097:             * Accessor for fetchGroupMetaData
098:             * @return Returns the fetchGroupMetaData.
099:             */
100:            public final FetchGroupMetaData[] getFetchGroupMetaData() {
101:                return (FetchGroupMetaData[]) fetchGroups
102:                        .toArray(new FetchGroupMetaData[fetchGroups.size()]);
103:            }
104:
105:            /**
106:             * Add a new FetchGroupMetaData
107:             * @param fgmd the fetch group
108:             */
109:            public void addFetchGroup(FetchGroupMetaData fgmd) {
110:                fetchGroups.add(fgmd);
111:            }
112:
113:            // ----------------------------- Utilities ------------------------------------
114:
115:            /**
116:             * Returns a string representation of the object.
117:             * This can be used as part of a facility to output a MetaData file. 
118:             * @param prefix prefix string
119:             * @param indent indent string
120:             * @return a string representation of the object.
121:             */
122:            public String toString(String prefix, String indent) {
123:                StringBuffer sb = new StringBuffer();
124:                sb.append(prefix).append(
125:                        "<fetch-plan name=\"" + name + "\""
126:                                + " max-fetch-depth=\"" + maxFetchDepth + "\""
127:                                + " fetch-size=\"" + fetchSize + "\"\n");
128:
129:                // Add fetch-groups
130:                Iterator iter = fetchGroups.iterator();
131:                while (iter.hasNext()) {
132:                    FetchGroupMetaData fgmd = (FetchGroupMetaData) iter.next();
133:                    sb.append(fgmd.toString(prefix + indent, indent));
134:                }
135:
136:                sb.append(prefix + "</fetch-plan>\n");
137:                return sb.toString();
138:            }
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.