Source Code Cross Referenced for EmbeddedSubField.java in  » EJB-Server-resin-3.1.5 » resin » com » caucho » amber » field » 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 » EJB Server resin 3.1.5 » resin » com.caucho.amber.field 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003:         *
004:         * This file is part of Resin(R) Open Source
005:         *
006:         * Each copy or derived work must preserve the copyright notice and this
007:         * notice unmodified.
008:         *
009:         * Resin Open Source is free software; you can redistribute it and/or modify
010:         * it under the terms of the GNU General Public License as published by
011:         * the Free Software Foundation; either version 2 of the License, or
012:         * (at your option) any later version.
013:         *
014:         * Resin Open Source is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017:         * of NON-INFRINGEMENT.  See the GNU General Public License for more
018:         * details.
019:         *
020:         * You should have received a copy of the GNU General Public License
021:         * along with Resin Open Source; if not, write to the
022:         *
023:         *   Free Software Foundation, Inc.
024:         *   59 Temple Place, Suite 330
025:         *   Boston, MA 02111-1307  USA
026:         *
027:         * @author Scott Ferguson
028:         */
029:
030:        package com.caucho.amber.field;
031:
032:        import com.caucho.amber.expr.*;
033:        import com.caucho.amber.manager.*;
034:        import com.caucho.amber.query.QueryParser;
035:        import com.caucho.amber.table.Column;
036:        import com.caucho.amber.table.Table;
037:        import com.caucho.amber.type.*;
038:        import com.caucho.bytecode.*;
039:        import com.caucho.config.ConfigException;
040:        import com.caucho.java.JavaWriter;
041:        import com.caucho.log.Log;
042:        import com.caucho.util.CharBuffer;
043:        import com.caucho.util.L10N;
044:
045:        import java.io.IOException;
046:        import java.io.Serializable;
047:        import java.sql.SQLException;
048:        import java.util.*;
049:        import java.util.logging.Logger;
050:
051:        /**
052:         * Represents the sub-field of an embedded type.
053:         */
054:        public class EmbeddedSubField implements  AmberField {
055:            private static final L10N L = new L10N(EmbeddedSubField.class);
056:            protected static final Logger log = Logger
057:                    .getLogger(EmbeddedSubField.class.getName());
058:
059:            // The owning embedded field in the entity
060:            private EntityEmbeddedField _embeddedField;
061:
062:            // The corresponding field of the embeddable type
063:            private AmberField _embeddableField;
064:
065:            private Column _column;
066:            private boolean _isInsert;
067:            private boolean _isUpdate;
068:
069:            private int _index;
070:
071:            public EmbeddedSubField(EntityEmbeddedField embeddedField,
072:                    AmberField embeddableField, int index)
073:                    throws ConfigException {
074:                _embeddedField = embeddedField;
075:                _embeddableField = embeddableField;
076:                _index = index;
077:
078:                Column embeddableColumn;
079:
080:                if (embeddableField instanceof  PropertyField) {
081:                    embeddableColumn = ((PropertyField) embeddableField)
082:                            .getColumn();
083:                } else
084:                    throw new IllegalStateException(
085:                            L
086:                                    .l(
087:                                            "'{0}' is an unknown field type of @Embeddable bean.",
088:                                            embeddableField.getClass()
089:                                                    .getName()));
090:
091:                if (embeddableColumn == null)
092:                    throw new IllegalStateException(embeddableField
093:                            + " column is null");
094:
095:                _column = new Column(_embeddedField.getTable(),
096:                        embeddableColumn.getName(), embeddableColumn.getType());
097:            }
098:
099:            /**
100:             * Returns the owning entity class.
101:             */
102:            public AbstractStatefulType getSourceType() {
103:                return _embeddedField.getSourceType();
104:            }
105:
106:            /**
107:             * Returns true if and only if this is a LAZY field.
108:             */
109:            public boolean isLazy() {
110:                return _embeddedField.isLazy();
111:            }
112:
113:            /**
114:             * Returns the field name.
115:             */
116:            public String getName() {
117:                return _embeddableField.getName();
118:            }
119:
120:            /**
121:             * Returns the table containing the value (or null)
122:             */
123:            public Table getTable() {
124:                return getColumn().getTable();
125:            }
126:
127:            public Column getColumn() {
128:                return _column;
129:            }
130:
131:            /**
132:             * Returns the property index.
133:             */
134:            public int getIndex() {
135:                return _embeddedField.getIndex();
136:            }
137:
138:            /**
139:             * Returns the property's group index.
140:             */
141:            public int getLoadGroupIndex() {
142:                return _embeddedField.getLoadGroupIndex();
143:            }
144:
145:            /**
146:             * Returns the load group mask.
147:             */
148:            public long getCreateLoadMask(int group) {
149:                return _embeddedField.getCreateLoadMask(group);
150:            }
151:
152:            /**
153:             * Returns the getter method.
154:             */
155:            public JMethod getGetterMethod() {
156:                throw new UnsupportedOperationException();
157:            }
158:
159:            /**
160:             * Returns the getter name.
161:             */
162:            public String getGetterName() {
163:                throw new UnsupportedOperationException();
164:            }
165:
166:            /**
167:             * Returns the type of the field
168:             */
169:            public JType getJavaType() {
170:                return _embeddableField.getJavaType();
171:            }
172:
173:            /**
174:             * Returns the name of the java type.
175:             */
176:            public String getJavaTypeName() {
177:                return _embeddableField.getJavaTypeName();
178:            }
179:
180:            /**
181:             * Returns the setter method.
182:             */
183:            public JMethod getSetterMethod() {
184:                throw new UnsupportedOperationException();
185:            }
186:
187:            /**
188:             * Returns the setter name.
189:             */
190:            public String getSetterName() {
191:                throw new UnsupportedOperationException();
192:            }
193:
194:            /**
195:             * Returns true if the methods are abstract.
196:             */
197:            public boolean isAbstract() {
198:                return false;
199:            }
200:
201:            /**
202:             * Returns true if the field is cascadable.
203:             */
204:            public boolean isCascadable() {
205:                return false;
206:            }
207:
208:            /**
209:             * Returns true for an updateable field.
210:             */
211:            public boolean isUpdateable() {
212:                return true;
213:            }
214:
215:            /**
216:             * Links to the target.
217:             */
218:            public void setIndex(int index) {
219:            }
220:
221:            /**
222:             * Links to the target.
223:             */
224:            public void init() throws ConfigException {
225:            }
226:
227:            /**
228:             * Returns the actual data.
229:             */
230:            public String generateSuperGetter() {
231:                throw new UnsupportedOperationException();
232:            }
233:
234:            /**
235:             * Sets the actual data.
236:             */
237:            public String generateSuperSetter(String value) {
238:                return generateSuperSetter("this", value);
239:            }
240:
241:            /**
242:             * Sets the actual data.
243:             */
244:            public String generateSuperSetter(String objThis, String value) {
245:                throw new UnsupportedOperationException();
246:            }
247:
248:            /**
249:             * Generates any prologue.
250:             */
251:            public void generatePrologue(JavaWriter out,
252:                    HashSet<Object> completedSet) throws IOException {
253:            }
254:
255:            /**
256:             * Generates the post constructor fixup
257:             */
258:            public void generatePostConstructor(JavaWriter out)
259:                    throws IOException {
260:            }
261:
262:            /**
263:             * Generates loading cache
264:             */
265:            public void generateUpdate(JavaWriter out, String mask,
266:                    String pstmt, String index) throws IOException {
267:                throw new UnsupportedOperationException();
268:            }
269:
270:            /**
271:             * Generates loading code
272:             */
273:            public boolean hasLoadGroup(int index) {
274:                throw new UnsupportedOperationException();
275:            }
276:
277:            /**
278:             * Generates loading code
279:             */
280:            public int generateLoad(JavaWriter out, String rs, String indexVar,
281:                    int loadGroupIndex) throws IOException {
282:                throw new UnsupportedOperationException();
283:            }
284:
285:            /**
286:             * Generates loading code after the basic fields.
287:             */
288:            public int generatePostLoadSelect(JavaWriter out, int index)
289:                    throws IOException {
290:                throw new UnsupportedOperationException();
291:            }
292:
293:            /**
294:             * Generates loading cache
295:             */
296:            public void generateLoadFromObject(JavaWriter out, String obj)
297:                    throws IOException {
298:                throw new UnsupportedOperationException();
299:            }
300:
301:            /**
302:             * Generates loading cache
303:             */
304:            public void generateSet(JavaWriter out, String obj)
305:                    throws IOException {
306:                throw new UnsupportedOperationException();
307:            }
308:
309:            /**
310:             * Generates loading cache
311:             */
312:            public void generateUpdateFromObject(JavaWriter out, String obj)
313:                    throws IOException {
314:                throw new UnsupportedOperationException();
315:            }
316:
317:            /**
318:             * Generates the field getter.
319:             *
320:             * @param value the non-null value
321:             */
322:            public void generateGet(JavaWriter out, String value)
323:                    throws IOException {
324:                out.print(generateGet(value));
325:            }
326:
327:            /**
328:             * Generates the field getter.
329:             *
330:             * @param value the non-null value
331:             */
332:            public String generateGet(String objThis) {
333:                String fieldType = getColumn().getType().getForeignType()
334:                        .getJavaTypeName();
335:
336:                return ("((" + fieldType + ") " + "((Embeddable) "
337:                        + _embeddedField.generateGet(objThis)
338:                        + ").__caucho_get_field(" + _index + "))");
339:            }
340:
341:            /**
342:             * Generates the field setter.
343:             *
344:             * @param value the non-null value
345:             */
346:            public String generateSet(String obj, String value) {
347:                throw new UnsupportedOperationException();
348:            }
349:
350:            /**
351:             * Generates the get property.
352:             */
353:            public void generateGetProperty(JavaWriter out) throws IOException {
354:                throw new UnsupportedOperationException();
355:            }
356:
357:            /**
358:             * Generates the set property.
359:             */
360:            public void generateSetProperty(JavaWriter out) throws IOException {
361:                throw new UnsupportedOperationException();
362:            }
363:
364:            /**
365:             * Generates the get property.
366:             */
367:            public void generateSuperGetter(JavaWriter out) throws IOException {
368:                throw new UnsupportedOperationException();
369:            }
370:
371:            /**
372:             * Generates the get property.
373:             */
374:            public void generateSuperSetter(JavaWriter out) throws IOException {
375:                throw new UnsupportedOperationException();
376:            }
377:
378:            /**
379:             * Generates the table create.
380:             */
381:            public String generateCreateTableSQL(AmberPersistenceUnit manager) {
382:                throw new UnsupportedOperationException();
383:            }
384:
385:            /**
386:             * Generates the JDBC preparedStatement set clause.
387:             */
388:            public void generateSet(JavaWriter out, String pstmt, String index)
389:                    throws IOException {
390:                getColumn().generateSet(out, pstmt, index, generateGet("this"));
391:            }
392:
393:            /**
394:             * Generates the set clause for the insert clause.
395:             */
396:            public void generateInsertSet(JavaWriter out, String pstmt,
397:                    String index, String obj) throws IOException {
398:                throw new UnsupportedOperationException();
399:            }
400:
401:            /**
402:             * Generates the set clause for the insert clause.
403:             */
404:            public void generateUpdateSet(JavaWriter out, String pstmt,
405:                    String index, String obj) throws IOException {
406:                throw new UnsupportedOperationException();
407:            }
408:
409:            /**
410:             * Updates the cached copy.
411:             */
412:            public void generateCopyUpdateObject(JavaWriter out, String dst,
413:                    String src, int updateIndex) throws IOException {
414:                throw new UnsupportedOperationException();
415:            }
416:
417:            /**
418:             * Updates the cached copy.
419:             */
420:            public void generateCopyLoadObject(JavaWriter out, String dst,
421:                    String src, int loadIndex) throws IOException {
422:                throw new UnsupportedOperationException();
423:            }
424:
425:            /**
426:             * Updates the cached copy.
427:             */
428:            public void generateCopyMergeObject(JavaWriter out, String dst,
429:                    String src, int loadIndex) throws IOException {
430:                throw new UnsupportedOperationException();
431:            }
432:
433:            /**
434:             * Checks entity-relationships from an object.
435:             */
436:            public void generateDumpRelationships(JavaWriter out,
437:                    int updateIndex) throws IOException {
438:                throw new UnsupportedOperationException();
439:            }
440:
441:            /**
442:             * Generates the set clause.
443:             */
444:            public void generateSet(JavaWriter out, String pstmt, String index,
445:                    String obj) throws IOException {
446:                getColumn().generateSet(out, pstmt, index, generateGet(obj));
447:            }
448:
449:            /**
450:             * Converts to an object.
451:             */
452:            public String toObject(String value) {
453:                throw new UnsupportedOperationException();
454:            }
455:
456:            /**
457:             * Links to the target.
458:             */
459:            public void link() {
460:                throw new UnsupportedOperationException();
461:            }
462:
463:            /**
464:             * Generates the delete foreign
465:             */
466:            public void generatePreDelete(JavaWriter out) throws IOException {
467:                throw new UnsupportedOperationException();
468:            }
469:
470:            /**
471:             * Generates the delete foreign
472:             */
473:            public void generatePostDelete(JavaWriter out) throws IOException {
474:                throw new UnsupportedOperationException();
475:            }
476:
477:            /**
478:             * Generates the expire code.
479:             */
480:            public void generateExpire(JavaWriter out) throws IOException {
481:                throw new UnsupportedOperationException();
482:            }
483:
484:            /**
485:             * Generates code for foreign entity create/delete
486:             */
487:            public void generateInvalidateForeign(JavaWriter out)
488:                    throws IOException {
489:                throw new UnsupportedOperationException();
490:            }
491:
492:            /**
493:             * Deletes the children
494:             */
495:            public void childDelete(AmberConnection aConn,
496:                    Serializable primaryKey) throws SQLException {
497:                throw new UnsupportedOperationException();
498:            }
499:
500:            /**
501:             * Generates code to convert to the type from the object.
502:             */
503:            public String generateCastFromObject(String value) {
504:                throw new UnsupportedOperationException();
505:            }
506:
507:            /**
508:             * Generates code to test the equals.
509:             */
510:            public String generateEquals(String leftBase, String value) {
511:                throw new UnsupportedOperationException();
512:            }
513:
514:            //
515:            // SQL generation
516:
517:            /**
518:             * Generates the select clause for an entity load.
519:             */
520:            public String generateLoadSelect(Table table, String id) {
521:                if (getColumn().getTable() == table)
522:                    return generateSelect(id);
523:                else
524:                    return null;
525:            }
526:
527:            /**
528:             * Generates the select clause.
529:             */
530:            public String generateSelect(String id) {
531:                return getColumn().generateSelect(id);
532:            }
533:
534:            /**
535:             * Generates the insert.
536:             */
537:            public void generateInsertColumns(ArrayList<String> columns) {
538:                if (_isInsert)
539:                    columns.add(getColumn().getName());
540:            }
541:
542:            /**
543:             * Generates the JPA QL select clause.
544:             */
545:            public String generateJavaSelect(String id) {
546:                throw new UnsupportedOperationException();
547:            }
548:
549:            /**
550:             * Generates the where clause.
551:             */
552:            public String generateWhere(String id) {
553:                return getColumn().generateSelect(id);
554:            }
555:
556:            /**
557:             * Generates the where clause.
558:             */
559:            public void generateUpdate(CharBuffer sql) {
560:                if (_isUpdate)
561:                    sql.append(getColumn().generateUpdateSet());
562:            }
563:
564:            //
565:            // Query methods
566:
567:            /**
568:             * Creates the expression for the field.
569:             */
570:            public AmberExpr createExpr(QueryParser parser, PathExpr parent) {
571:                throw new UnsupportedOperationException();
572:            }
573:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.