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


001:        /**
002:         * GENERATED CODE: DO NOT MODIFY IT UNDER ANY CIRCUMSTANCES!!!
003:         */package com.completex.objective.persistency.examples.ex002;
004:
005:        import com.completex.objective.components.persistency.key.impl.DefaultNaturalKeyFactory;
006:        import java.util.Date;
007:        import java.util.HashMap;
008:        import java.util.Map;
009:        import java.io.InputStream;
010:        import java.math.BigDecimal;
011:        import java.math.BigInteger;
012:        import java.sql.Clob;
013:        import java.sql.Blob;
014:        import com.completex.objective.components.persistency.*;
015:        import com.completex.objective.components.persistency.key.impl.DefaultNaturalKeyFactory;
016:
017:        import java.util.Date;
018:
019:        public class ExplPerson extends PersistentObject implements 
020:                java.io.Externalizable {
021:            //
022:            // Complex object related:
023:            //
024:
025:            //
026:            private static Map registeredMasters;
027:            private static Object lock = new Object();
028:
029:            protected Object classLock() {
030:                return lock;
031:            }
032:
033:            protected void instantiateRegisteredMasters() {
034:                if (registeredMasters == null) {
035:                    synchronized (lock) {
036:                        if (registeredMasters == null) {
037:                            registeredMasters = new HashMap();
038:                        }
039:                    }
040:                }
041:            }
042:
043:            protected Map registeredMasters() {
044:                return registeredMasters;
045:            }
046:
047:            //
048:            //
049:            //
050:
051:            public static final String TABLE_EXPL_PERSON = "EXPL_PERSON";
052:
053:            public ExplPerson() {
054:                super (new Record(table));
055:            }
056:
057:            public ExplPerson(Long personId) {
058:                this ();
059:                setPersonId(personId);
060:            }
061:
062:            public static final String COL_PERSON_ID = "PERSON_ID";
063:            public static final String TCOL_PERSON_ID = "EXPL_PERSON.PERSON_ID";
064:            public static final int ICOL_PERSON_ID = 0;
065:            public static final int JDBC_TYPE_PERSON_ID = -5;
066:
067:            public static final String COL_FIRST_NAME = "FIRST_NAME";
068:            public static final String TCOL_FIRST_NAME = "EXPL_PERSON.FIRST_NAME";
069:            public static final int ICOL_FIRST_NAME = 1;
070:            public static final int JDBC_TYPE_FIRST_NAME = 12;
071:
072:            public static final String COL_LAST_NAME = "LAST_NAME";
073:            public static final String TCOL_LAST_NAME = "EXPL_PERSON.LAST_NAME";
074:            public static final int ICOL_LAST_NAME = 2;
075:            public static final int JDBC_TYPE_LAST_NAME = 12;
076:
077:            public static final String COL_BIRTH_DATE = "BIRTH_DATE";
078:            public static final String TCOL_BIRTH_DATE = "EXPL_PERSON.BIRTH_DATE";
079:            public static final int ICOL_BIRTH_DATE = 3;
080:            public static final int JDBC_TYPE_BIRTH_DATE = 91;
081:
082:            public static final String COL_LAST_UPDATED = "LAST_UPDATED";
083:            public static final String TCOL_LAST_UPDATED = "EXPL_PERSON.LAST_UPDATED";
084:            public static final int ICOL_LAST_UPDATED = 4;
085:            public static final int JDBC_TYPE_LAST_UPDATED = 91;
086:
087:            public static final String COL_CREATION_DATE = "CREATION_DATE";
088:            public static final String TCOL_CREATION_DATE = "EXPL_PERSON.CREATION_DATE";
089:            public static final int ICOL_CREATION_DATE = 5;
090:            public static final int JDBC_TYPE_CREATION_DATE = 91;
091:
092:            private static final MetaTable table = new MetaTable("EXPL_PERSON",
093:                    "EXPL_PERSON", 6, 1);
094:
095:            static {
096:                table.setStaticFinal(true);
097:                //
098:                // Meta Foreign Keys:
099:                //
100:                //
101:                // Meta Natural Key:
102:                //
103:                MetaNaturalKey naturalKey = new MetaNaturalKey();
104:                naturalKey.addColumnName(COL_PERSON_ID);
105:                table.setNaturalKey(naturalKey);
106:
107:                //
108:                // Meta Columns:
109:                //
110:
111:                final MetaColumn metaPersonId = new MetaColumn(ICOL_PERSON_ID,
112:                        "PERSON_ID", "PERSON_ID", table);
113:                metaPersonId.setPrimaryKey(true);
114:                metaPersonId.setRequired(true);
115:                metaPersonId.setOptimisticLock(false);
116:                metaPersonId.setType(ColumnType.LONG);
117:                metaPersonId.setColumnSize(0);
118:                metaPersonId.setRemarks("");
119:                metaPersonId.setDecimalDigits(0);
120:                metaPersonId.setAutoGenerated(true);
121:                metaPersonId.setAutoIncrement(false);
122:                metaPersonId.setJdbcType(-5);
123:                metaPersonId
124:                        .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.SimpleSequenceKeyGeneratorImpl());
125:                {
126:                    HashMap staticAttributes = new HashMap();
127:                    staticAttributes.put("name", "EXPL_PERSON_SEQ");
128:                    metaPersonId.setGeneratorStaticAttributes(staticAttributes);
129:                }
130:                metaPersonId.initializeKeyGenerator();
131:                table.addToPrimaryKey(new Integer(ICOL_PERSON_ID));
132:                table.addColumn(metaPersonId);
133:
134:                final MetaColumn metaFirstName = new MetaColumn(
135:                        ICOL_FIRST_NAME, "FIRST_NAME", "FIRST_NAME", table);
136:                metaFirstName.setPrimaryKey(false);
137:                metaFirstName.setRequired(true);
138:                metaFirstName.setOptimisticLock(false);
139:                metaFirstName.setType(ColumnType.STRING);
140:                metaFirstName.setColumnSize(40);
141:                metaFirstName.setRemarks("");
142:                metaFirstName.setDecimalDigits(0);
143:                metaFirstName.setAutoGenerated(false);
144:                metaFirstName.setAutoIncrement(false);
145:                metaFirstName.setJdbcType(12);
146:                table.addColumn(metaFirstName);
147:
148:                final MetaColumn metaLastName = new MetaColumn(ICOL_LAST_NAME,
149:                        "LAST_NAME", "LAST_NAME", table);
150:                metaLastName.setPrimaryKey(false);
151:                metaLastName.setRequired(true);
152:                metaLastName.setOptimisticLock(false);
153:                metaLastName.setType(ColumnType.STRING);
154:                metaLastName.setColumnSize(40);
155:                metaLastName.setRemarks("");
156:                metaLastName.setDecimalDigits(0);
157:                metaLastName.setAutoGenerated(false);
158:                metaLastName.setAutoIncrement(false);
159:                metaLastName.setJdbcType(12);
160:                table.addColumn(metaLastName);
161:
162:                final MetaColumn metaBirthDate = new MetaColumn(
163:                        ICOL_BIRTH_DATE, "BIRTH_DATE", "BIRTH_DATE", table);
164:                metaBirthDate.setPrimaryKey(false);
165:                metaBirthDate.setRequired(false);
166:                metaBirthDate.setOptimisticLock(false);
167:                metaBirthDate.setType(ColumnType.DATE);
168:                metaBirthDate.setColumnSize(0);
169:                metaBirthDate.setRemarks("");
170:                metaBirthDate.setDecimalDigits(0);
171:                metaBirthDate.setAutoGenerated(false);
172:                metaBirthDate.setAutoIncrement(false);
173:                metaBirthDate.setJdbcType(91);
174:                table.addColumn(metaBirthDate);
175:
176:                final MetaColumn metaLastUpdated = new MetaColumn(
177:                        ICOL_LAST_UPDATED, "LAST_UPDATED", "LAST_UPDATED",
178:                        table);
179:                metaLastUpdated.setPrimaryKey(false);
180:                metaLastUpdated.setRequired(false);
181:                metaLastUpdated.setOptimisticLock(false);
182:                metaLastUpdated.setType(ColumnType.DATE);
183:                metaLastUpdated.setColumnSize(0);
184:                metaLastUpdated.setRemarks("");
185:                metaLastUpdated.setDecimalDigits(0);
186:                metaLastUpdated.setAutoGenerated(true);
187:                metaLastUpdated.setAutoIncrement(false);
188:                metaLastUpdated.setJdbcType(91);
189:                metaLastUpdated
190:                        .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.LastUpdatedDateGenerator());
191:                metaLastUpdated.initializeKeyGenerator();
192:                table.addColumn(metaLastUpdated);
193:
194:                final MetaColumn metaCreationDate = new MetaColumn(
195:                        ICOL_CREATION_DATE, "CREATION_DATE", "CREATION_DATE",
196:                        table);
197:                metaCreationDate.setPrimaryKey(false);
198:                metaCreationDate.setRequired(false);
199:                metaCreationDate.setOptimisticLock(false);
200:                metaCreationDate.setType(ColumnType.DATE);
201:                metaCreationDate.setColumnSize(0);
202:                metaCreationDate.setRemarks("");
203:                metaCreationDate.setDecimalDigits(0);
204:                metaCreationDate.setAutoGenerated(true);
205:                metaCreationDate.setAutoIncrement(false);
206:                metaCreationDate.setJdbcType(91);
207:                metaCreationDate
208:                        .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.CreatedDateGenerator());
209:                metaCreationDate.initializeKeyGenerator();
210:                table.addColumn(metaCreationDate);
211:
212:            }
213:
214:            private Long personId;
215:            private String firstName;
216:            private String lastName;
217:            private Date birthDate;
218:            private Date lastUpdated;
219:            private Date creationDate;
220:
221:            //
222:            // personId:
223:            //
224:            public Long getPersonId() {
225:                return this .personId;
226:            }
227:
228:            public void setPersonId(Long personId) {
229:                if (record2().setObject(ICOL_PERSON_ID, personId)) {
230:                    this .personId = personId;
231:                }
232:            }
233:
234:            public boolean izNullPersonId() {
235:                return record2().getObject(ICOL_PERSON_ID) == null;
236:            }
237:
238:            public void setNullPersonId() {
239:                if (record2().setObject(ICOL_PERSON_ID, null)) {
240:                    this .personId = null;
241:                }
242:            }
243:
244:            //
245:            // firstName:
246:            //
247:            public String getFirstName() {
248:                return this .firstName;
249:            }
250:
251:            public void setFirstName(String firstName) {
252:                if (record2().setObject(ICOL_FIRST_NAME, firstName)) {
253:                    this .firstName = firstName;
254:                }
255:            }
256:
257:            public boolean izNullFirstName() {
258:                return record2().getObject(ICOL_FIRST_NAME) == null;
259:            }
260:
261:            public void setNullFirstName() {
262:                if (record2().setObject(ICOL_FIRST_NAME, null)) {
263:                    this .firstName = null;
264:                }
265:            }
266:
267:            //
268:            // lastName:
269:            //
270:            public String getLastName() {
271:                return this .lastName;
272:            }
273:
274:            public void setLastName(String lastName) {
275:                if (record2().setObject(ICOL_LAST_NAME, lastName)) {
276:                    this .lastName = lastName;
277:                }
278:            }
279:
280:            public boolean izNullLastName() {
281:                return record2().getObject(ICOL_LAST_NAME) == null;
282:            }
283:
284:            public void setNullLastName() {
285:                if (record2().setObject(ICOL_LAST_NAME, null)) {
286:                    this .lastName = null;
287:                }
288:            }
289:
290:            //
291:            // birthDate:
292:            //
293:            public Date getBirthDate() {
294:                return this .birthDate;
295:            }
296:
297:            public void setBirthDate(Date birthDate) {
298:                if (record2().setObject(ICOL_BIRTH_DATE, birthDate)) {
299:                    this .birthDate = birthDate;
300:                }
301:            }
302:
303:            public boolean izNullBirthDate() {
304:                return record2().getObject(ICOL_BIRTH_DATE) == null;
305:            }
306:
307:            public void setNullBirthDate() {
308:                if (record2().setObject(ICOL_BIRTH_DATE, null)) {
309:                    this .birthDate = null;
310:                }
311:            }
312:
313:            //
314:            // lastUpdated:
315:            //
316:            public Date getLastUpdated() {
317:                return this .lastUpdated;
318:            }
319:
320:            public void setLastUpdated(Date lastUpdated) {
321:                if (record2().setObject(ICOL_LAST_UPDATED, lastUpdated)) {
322:                    this .lastUpdated = lastUpdated;
323:                }
324:            }
325:
326:            public boolean izNullLastUpdated() {
327:                return record2().getObject(ICOL_LAST_UPDATED) == null;
328:            }
329:
330:            public void setNullLastUpdated() {
331:                if (record2().setObject(ICOL_LAST_UPDATED, null)) {
332:                    this .lastUpdated = null;
333:                }
334:            }
335:
336:            //
337:            // creationDate:
338:            //
339:            public Date getCreationDate() {
340:                return this .creationDate;
341:            }
342:
343:            public void setCreationDate(Date creationDate) {
344:                if (record2().setObject(ICOL_CREATION_DATE, creationDate)) {
345:                    this .creationDate = creationDate;
346:                }
347:            }
348:
349:            public boolean izNullCreationDate() {
350:                return record2().getObject(ICOL_CREATION_DATE) == null;
351:            }
352:
353:            public void setNullCreationDate() {
354:                if (record2().setObject(ICOL_CREATION_DATE, null)) {
355:                    this .creationDate = null;
356:                }
357:            }
358:
359:            public void toBeanFields() {
360:                toBeanFields(this );
361:            }
362:
363:            public void toBeanFields(PersistentObject from) {
364:                personId = (Long) from.record2().getObject(ICOL_PERSON_ID);
365:                firstName = (String) from.record2().getObject(ICOL_FIRST_NAME);
366:                lastName = (String) from.record2().getObject(ICOL_LAST_NAME);
367:                birthDate = (Date) from.record2().getObject(ICOL_BIRTH_DATE);
368:                lastUpdated = (Date) from.record2()
369:                        .getObject(ICOL_LAST_UPDATED);
370:                creationDate = (Date) from.record2().getObject(
371:                        ICOL_CREATION_DATE);
372:                super .toBeanFields(from);
373:            }
374:
375:            public void fromBeanFields(PersistentObject persistentObject) {
376:                ExplPerson from = (ExplPerson) persistentObject;
377:                record2().getEntry(ICOL_PERSON_ID).setUnmarkedValue(
378:                        from.personId, from.personId);
379:                record2().getEntry(ICOL_FIRST_NAME).setUnmarkedValue(
380:                        from.firstName, from.firstName);
381:                record2().getEntry(ICOL_LAST_NAME).setUnmarkedValue(
382:                        from.lastName, from.lastName);
383:                record2().getEntry(ICOL_BIRTH_DATE).setUnmarkedValue(
384:                        from.birthDate, from.birthDate);
385:                record2().getEntry(ICOL_LAST_UPDATED).setUnmarkedValue(
386:                        from.lastUpdated, from.lastUpdated);
387:                record2().getEntry(ICOL_CREATION_DATE).setUnmarkedValue(
388:                        from.creationDate, from.creationDate);
389:                super .fromBeanFieldsDataSaved(persistentObject);
390:            }
391:
392:            public String toString() {
393:
394:                StringBuffer buffer = new StringBuffer();
395:                buffer.append("{ " + "class = ").append(
396:                        this .getClass().getName()).append(" " + "table = ")
397:                        .append(TABLE_EXPL_PERSON).append(" columns = {");
398:
399:                if (record() != null) {
400:                    buffer.append(COL_PERSON_ID).append(" = ").append(
401:                            record().getObject(ICOL_PERSON_ID)).append(" ");
402:                    buffer.append(COL_FIRST_NAME).append(" = ").append(
403:                            record().getObject(ICOL_FIRST_NAME)).append(" ");
404:                    buffer.append(COL_LAST_NAME).append(" = ").append(
405:                            record().getObject(ICOL_LAST_NAME)).append(" ");
406:                    buffer.append(COL_BIRTH_DATE).append(" = ").append(
407:                            record().getObject(ICOL_BIRTH_DATE)).append(" ");
408:                    buffer.append(COL_LAST_UPDATED).append(" = ").append(
409:                            record().getObject(ICOL_LAST_UPDATED)).append(" ");
410:                    buffer.append(COL_CREATION_DATE).append(" = ").append(
411:                            record().getObject(ICOL_CREATION_DATE)).append(" ");
412:                } else {
413:                    buffer.append(COL_PERSON_ID).append(" = ").append(personId)
414:                            .append(" ");
415:                    buffer.append(COL_FIRST_NAME).append(" = ").append(
416:                            firstName).append(" ");
417:                    buffer.append(COL_LAST_NAME).append(" = ").append(lastName)
418:                            .append(" ");
419:                    buffer.append(COL_BIRTH_DATE).append(" = ").append(
420:                            birthDate).append(" ");
421:                    buffer.append(COL_LAST_UPDATED).append(" = ").append(
422:                            lastUpdated).append(" ");
423:                    buffer.append(COL_CREATION_DATE).append(" = ").append(
424:                            creationDate).append(" ");
425:                }
426:                buffer.append("}}");
427:                return buffer.toString();
428:            }
429:
430:            public Object toKey() {
431:                if (flattened()) {
432:                    Object[] values = new Object[table.getNaturalKey().size()];
433:                    values[0] = getPersonId();
434:                    if (table.getNaturalKey().getNaturalKeyFactory()
435:                            .getSimpleNaturalKeyFactory() == null) {
436:                        return DefaultNaturalKeyFactory.naturalKey(this , this 
437:                                .getClass().getName(), values);
438:                    } else {
439:                        return DefaultNaturalKeyFactory.naturalKey(this , table
440:                                .getNaturalKey().getNaturalKeyFactory()
441:                                .getSimpleNaturalKeyFactory(), this .getClass()
442:                                .getName(), values);
443:                    }
444:                } else {
445:                    return super .toKey();
446:                }
447:            }
448:
449:            /**
450:             * Equals by Basic Peristent object fields (without children objects)
451:             */
452:            public boolean equalsBasic(Object value) {
453:                if (this  == value)
454:                    return true;
455:                if (value == null || getClass() != value.getClass())
456:                    return false;
457:
458:                ExplPerson that = (ExplPerson) value;
459:
460:                if (personId != null ? !personId.equals(that.personId)
461:                        : that.personId != null)
462:                    return false;
463:                if (firstName != null ? !firstName.equals(that.firstName)
464:                        : that.firstName != null)
465:                    return false;
466:                if (lastName != null ? !lastName.equals(that.lastName)
467:                        : that.lastName != null)
468:                    return false;
469:                if (birthDate != null ? !birthDate.equals(that.birthDate)
470:                        : that.birthDate != null)
471:                    return false;
472:                if (lastUpdated != null ? !lastUpdated.equals(that.lastUpdated)
473:                        : that.lastUpdated != null)
474:                    return false;
475:                if (creationDate != null ? !creationDate
476:                        .equals(that.creationDate) : that.creationDate != null)
477:                    return false;
478:                return true;
479:            }
480:
481:            /**
482:             * hashCode by Basic Peristent object fields (without children objects)
483:             */
484:            public int hashCodeBasic() {
485:                int result;
486:                long temp;
487:                result = (personId != null ? personId.hashCode() : 0);
488:                result = 29 * result
489:                        + (firstName != null ? firstName.hashCode() : 0);
490:                result = 29 * result
491:                        + (lastName != null ? lastName.hashCode() : 0);
492:                result = 29 * result
493:                        + (birthDate != null ? birthDate.hashCode() : 0);
494:                result = 29 * result
495:                        + (lastUpdated != null ? lastUpdated.hashCode() : 0);
496:                result = 29 * result
497:                        + (creationDate != null ? creationDate.hashCode() : 0);
498:
499:                return result;
500:            }
501:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.