Source Code Cross Referenced for BaseScarabRoleImplPeer.java in  » Issue-Tracking » scarab-0.21 » org » tigris » scarab » om » 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 » Issue Tracking » scarab 0.21 » org.tigris.scarab.om 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.tigris.scarab.om;
002:
003:        import java.math.BigDecimal;
004:        import java.sql.Connection;
005:        import java.sql.SQLException;
006:        import java.util.ArrayList;
007:        import java.util.Date;
008:        import java.util.Iterator;
009:        import java.util.LinkedList;
010:        import java.util.List;
011:
012:        import org.apache.torque.NoRowsException;
013:        import org.apache.torque.TooManyRowsException;
014:        import org.apache.torque.Torque;
015:        import org.apache.torque.TorqueException;
016:        import org.apache.torque.map.MapBuilder;
017:        import org.apache.torque.map.TableMap;
018:        import org.apache.torque.om.DateKey;
019:        import org.apache.torque.om.NumberKey;
020:        import org.apache.torque.om.StringKey;
021:        import org.apache.torque.om.ObjectKey;
022:        import org.apache.torque.om.SimpleKey;
023:        import org.apache.torque.util.BasePeer;
024:        import org.apache.torque.util.Criteria;
025:
026:        import com.workingdogs.village.DataSetException;
027:        import com.workingdogs.village.QueryDataSet;
028:        import com.workingdogs.village.Record;
029:
030:        // Local classes
031:        import org.tigris.scarab.om.map.*;
032:
033:        /**
034:         */
035:        public abstract class BaseScarabRoleImplPeer extends
036:                org.apache.fulcrum.security.impl.db.entity.TurbineRolePeer {
037:
038:            /** number of columns for this peer */
039:            public static final int numColumns = 1;
040:
041:            /** A class that can be returned by this peer. */
042:            protected static final String CLASSNAME_DEFAULT = "org.tigris.scarab.om.ScarabRoleImpl";
043:
044:            /** A class that can be returned by this peer. */
045:            protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
046:
047:            /**
048:             * Class object initialization method.
049:             *
050:             * @param className name of the class to initialize
051:             * @return the initialized class
052:             */
053:            private static Class initClass(String className) {
054:                Class c = null;
055:                try {
056:                    c = Class.forName(className);
057:                } catch (Throwable t) {
058:                    log
059:                            .error(
060:                                    "A FATAL ERROR has occurred which should not "
061:                                            + "have happened under any circumstance.  Please notify "
062:                                            + "the Torque developers <torque-dev@db.apache.org> "
063:                                            + "and give as many details as possible (including the error "
064:                                            + "stack trace).", t);
065:
066:                    // Error objects should always be propogated.
067:                    if (t instanceof  Error) {
068:                        throw (Error) t.fillInStackTrace();
069:                    }
070:                }
071:                return c;
072:            }
073:
074:            /**
075:             * The class that the Peer will make instances of.
076:             * If the BO is abstract then you must implement this method
077:             * in the BO.
078:             *
079:             * @throws TorqueException Any exceptions caught during processing will be
080:             *         rethrown wrapped into a TorqueException.
081:             */
082:            public static Class getOMClass() throws TorqueException {
083:                return CLASS_DEFAULT;
084:            }
085:
086:            /**
087:             * Retrieve a single object by pk
088:             *
089:             * @param pk the primary key
090:             * @throws TorqueException Any exceptions caught during processing will be
091:             *         rethrown wrapped into a TorqueException.
092:             * @throws NoRowsException Primary key was not found in database.
093:             * @throws TooManyRowsException Primary key was not found in database.
094:             */
095:            public static ScarabRoleImpl retrieveScarabRoleImplByPK(Integer pk)
096:                    throws TorqueException, NoRowsException,
097:                    TooManyRowsException {
098:                return retrieveScarabRoleImplByPK(SimpleKey.keyFor(pk));
099:            }
100:
101:            /**
102:             * Retrieve a single object by pk
103:             *
104:             * @param pk the primary key
105:             * @param con the connection to use
106:             * @throws TorqueException Any exceptions caught during processing will be
107:             *         rethrown wrapped into a TorqueException.
108:             * @throws NoRowsException Primary key was not found in database.
109:             * @throws TooManyRowsException Primary key was not found in database.
110:             */
111:            public static ScarabRoleImpl retrieveScarabRoleImplByPK(Integer pk,
112:                    Connection con) throws TorqueException, NoRowsException,
113:                    TooManyRowsException {
114:                return retrieveScarabRoleImplByPK(SimpleKey.keyFor(pk), con);
115:            }
116:
117:            /**
118:             * Retrieve a single object by pk
119:             *
120:             * @param pk the primary key
121:             * @throws TorqueException Any exceptions caught during processing will be
122:             *         rethrown wrapped into a TorqueException.
123:             * @throws NoRowsException Primary key was not found in database.
124:             * @throws TooManyRowsException Primary key was not found in database.
125:             */
126:            public static ScarabRoleImpl retrieveScarabRoleImplByPK(ObjectKey pk)
127:                    throws TorqueException, NoRowsException,
128:                    TooManyRowsException {
129:                Connection db = null;
130:                ScarabRoleImpl retVal = null;
131:                try {
132:                    db = Torque.getConnection(DATABASE_NAME);
133:                    retVal = retrieveScarabRoleImplByPK(pk, db);
134:                } finally {
135:                    Torque.closeConnection(db);
136:                }
137:                return retVal;
138:            }
139:
140:            /**
141:             * Retrieve a single object by pk
142:             *
143:             * @param pk the primary key
144:             * @param con the connection to use
145:             * @throws TorqueException Any exceptions caught during processing will be
146:             *         rethrown wrapped into a TorqueException.
147:             * @throws NoRowsException Primary key was not found in database.
148:             * @throws TooManyRowsException Primary key was not found in database.
149:             */
150:            public static ScarabRoleImpl retrieveScarabRoleImplByPK(
151:                    ObjectKey pk, Connection con) throws TorqueException,
152:                    NoRowsException, TooManyRowsException {
153:                Criteria criteria = buildCriteria(pk);
154:                List v = doSelect(criteria, con);
155:                if (v.size() == 0) {
156:                    throw new NoRowsException("Failed to select a row.");
157:                } else if (v.size() > 1) {
158:                    throw new TooManyRowsException(
159:                            "Failed to select only one row.");
160:                } else {
161:                    return (ScarabRoleImpl) v.get(0);
162:                }
163:            }
164:
165:            /**
166:             * Retrieve a multiple objects by pk
167:             *
168:             * @param pks List of primary keys
169:             * @throws TorqueException Any exceptions caught during processing will be
170:             *         rethrown wrapped into a TorqueException.
171:             */
172:            public static List retrieveScarabRoleImplByPKs(List pks)
173:                    throws TorqueException {
174:                Connection db = null;
175:                List retVal = null;
176:                try {
177:                    db = Torque.getConnection(DATABASE_NAME);
178:                    retVal = retrieveScarabRoleImplByPKs(pks, db);
179:                } finally {
180:                    Torque.closeConnection(db);
181:                }
182:                return retVal;
183:            }
184:
185:            /**
186:             * Retrieve a multiple objects by pk
187:             *
188:             * @param pks List of primary keys
189:             * @param dbcon the connection to use
190:             * @throws TorqueException Any exceptions caught during processing will be
191:             *         rethrown wrapped into a TorqueException.
192:             */
193:            public static List retrieveScarabRoleImplByPKs(List pks,
194:                    Connection dbcon) throws TorqueException {
195:                List objs = null;
196:                if (pks == null || pks.size() == 0) {
197:                    objs = new LinkedList();
198:                } else {
199:                    Criteria criteria = new Criteria();
200:                    criteria.addIn(ROLE_ID, pks);
201:                    objs = doSelect(criteria, dbcon);
202:                }
203:                return objs;
204:            }
205:
206:            private static void setDbName(Criteria crit) {
207:                // Set the correct dbName if it has not been overridden
208:                // crit.getDbName will return the same object if not set to
209:                // another value so == check is okay and faster
210:                if (crit.getDbName() == Torque.getDefaultDB()) {
211:                    crit.setDbName(DATABASE_NAME);
212:                }
213:            }
214:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.