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.gen;
031:
032: import com.caucho.amber.type.*;
033: import com.caucho.java.JavaWriter;
034: import com.caucho.util.L10N;
035:
036: import java.io.IOException;
037: import java.util.HashSet;
038:
039: /**
040: * Generates the Java code for the wrapped object.
041: */
042: public class MappedSuperclassComponent extends AmberMappedComponent {
043: private static final L10N L = new L10N(
044: MappedSuperclassComponent.class);
045:
046: public MappedSuperclassComponent() {
047: }
048:
049: /**
050: * Gets the mapped superclass type.
051: */
052: public MappedSuperclassType getMappedSuperclassType() {
053: return (MappedSuperclassType) _relatedType;
054: }
055:
056: /**
057: * Sets the bean info for the generator
058: */
059: public void setMappedSuperclassType(
060: MappedSuperclassType mappedSuperclassType) {
061: setRelatedType(mappedSuperclassType);
062: }
063:
064: /**
065: * Starts generation of the Java code
066: */
067: public void generate(JavaWriter out) throws IOException {
068: try {
069: generateHeader(out, false);
070:
071: // jpa/0ge8 generateInit(out, false);
072:
073: generateIncrementVersion(out);
074:
075: HashSet<Object> completedSet = new HashSet<Object>();
076:
077: generatePrologue(out, completedSet);
078:
079: generateGetEntityType(out);
080:
081: generateGetEntityState(out);
082:
083: // jpa/0ge8 generateMatch(out);
084:
085: generateFields(out);
086:
087: generateMethods(out);
088:
089: // jpa/0ge8 generateDetach(out, false);
090:
091: generateLoad(out, false);
092:
093: int min = 0;
094: int max = getMappedSuperclassType().getLoadGroupIndex();
095:
096: for (int i = min; i <= max; i++)
097: generateLoadGroup(out, i);
098:
099: generateResultSetLoad(out, false);
100:
101: // jpa/0ge8 generateSetQuery(out, false);
102:
103: generateCopy(out);
104:
105: generateMakePersistent(out);
106:
107: generateCascadePersist(out);
108:
109: generateCascadeRemove(out);
110:
111: /* jpa/0ge8
112:
113: generateCreate(out);
114:
115: jpa/0ge8 generateDelete(out);
116:
117: jpa/0ge8 generateDeleteForeign(out);
118:
119: jpa/0ge8 generateFlush(out);
120:
121: generateAfterCommit(out, false);
122:
123: generateAfterRollback(out);
124:
125: generateHome(out);
126:
127: generateInternals(out);
128: */
129:
130: } catch (IOException e) {
131: throw e;
132: }
133: }
134: }
|