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 Rodrigo Westrupp
028: */
029:
030: package com.caucho.amber.cfg;
031:
032: import java.util.ArrayList;
033:
034: /**
035: * <entity> tag in the orm.xml
036: */
037: public class EntityConfig extends MappedSuperclassConfig {
038: // attributes
039: private String _name;
040:
041: // elements
042: private TableConfig _table;
043: private SecondaryTableConfig _secondaryTable;
044: private PrimaryKeyJoinColumnConfig _primaryKeyJoinColumn;
045: private InheritanceConfig _inheritance;
046: private String _discriminatorValue;
047: private DiscriminatorColumnConfig _discriminatorColumn;
048: private SequenceGeneratorConfig _sequenceGenerator;
049: private TableGeneratorConfig _tableGenerator;
050: private NamedQueryConfig _namedQuery;
051: private NamedNativeQueryConfig _namedNativeQuery;
052: private SqlResultSetMappingConfig _sqlResultSetMapping;
053: private ArrayList<AttributeOverrideConfig> _attributeOverrideList = new ArrayList<AttributeOverrideConfig>();
054: private ArrayList<AssociationOverrideConfig> _associationOverrideList = new ArrayList<AssociationOverrideConfig>();
055:
056: /**
057: * Returns the entity name.
058: */
059: public String getName() {
060: return _name;
061: }
062:
063: /**
064: * Sets the entity name.
065: */
066: public void setName(String name) {
067: _name = name;
068: }
069:
070: public TableConfig getTable() {
071: return _table;
072: }
073:
074: public void setTable(TableConfig table) {
075: _table = table;
076: }
077:
078: public void addAssociationOverride(
079: AssociationOverrideConfig associationOverride) {
080: _associationOverrideList.add(associationOverride);
081: }
082:
083: public ArrayList<AssociationOverrideConfig> getAssociationOverrideList() {
084: return _associationOverrideList;
085: }
086:
087: public void addAttributeOverride(
088: AttributeOverrideConfig attributeOverride) {
089: _attributeOverrideList.add(attributeOverride);
090: }
091:
092: public ArrayList<AttributeOverrideConfig> getAttributeOverrideList() {
093: return _attributeOverrideList;
094: }
095:
096: public SecondaryTableConfig getSecondaryTable() {
097: return _secondaryTable;
098: }
099:
100: public void setSecondaryTable(SecondaryTableConfig secondaryTable) {
101: _secondaryTable = secondaryTable;
102: }
103:
104: public PrimaryKeyJoinColumnConfig getPrimaryKeyJoinColumn() {
105: return _primaryKeyJoinColumn;
106: }
107:
108: public void setPrimaryKeyJoinColumn(
109: PrimaryKeyJoinColumnConfig primaryKeyJoinColumn) {
110: _primaryKeyJoinColumn = primaryKeyJoinColumn;
111: }
112:
113: public InheritanceConfig getInheritance() {
114: return _inheritance;
115: }
116:
117: public void setInheritance(InheritanceConfig inheritance) {
118: _inheritance = inheritance;
119: }
120:
121: public String getDiscriminatorValue() {
122: return _discriminatorValue;
123: }
124:
125: public void setDiscriminatorValue(String discriminatorValue) {
126: _discriminatorValue = discriminatorValue;
127: }
128:
129: public DiscriminatorColumnConfig getDiscriminatorColumn() {
130: return _discriminatorColumn;
131: }
132:
133: public void setDiscriminatorColumn(
134: DiscriminatorColumnConfig discriminatorColumn) {
135: _discriminatorColumn = discriminatorColumn;
136: }
137:
138: public SequenceGeneratorConfig getSequenceGenerator() {
139: return _sequenceGenerator;
140: }
141:
142: public void setSequenceGenerator(
143: SequenceGeneratorConfig sequenceGenerator) {
144: _sequenceGenerator = sequenceGenerator;
145: }
146:
147: public TableGeneratorConfig getTableGenerator() {
148: return _tableGenerator;
149: }
150:
151: public void setTableGenerator(TableGeneratorConfig tableGenerator) {
152: _tableGenerator = tableGenerator;
153: }
154:
155: public NamedQueryConfig getNamedQuery() {
156: return _namedQuery;
157: }
158:
159: public void setNamedQuery(NamedQueryConfig namedQuery) {
160: _namedQuery = namedQuery;
161: }
162:
163: public NamedNativeQueryConfig getNamedNativeQuery() {
164: return _namedNativeQuery;
165: }
166:
167: public void setNamedNativeQuery(
168: NamedNativeQueryConfig namedNativeQuery) {
169: _namedNativeQuery = namedNativeQuery;
170: }
171:
172: public SqlResultSetMappingConfig getSqlResultSetMapping() {
173: return _sqlResultSetMapping;
174: }
175:
176: public void setSqlResultSetMapping(
177: SqlResultSetMappingConfig sqlResultSetMapping) {
178: _sqlResultSetMapping = sqlResultSetMapping;
179: }
180:
181: public String toString() {
182: return "EntityConfig[" + _name + ", " + getClassName() + "]";
183: }
184: }
|