KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > amber > cfg > AttributesConfig


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Rodrigo Westrupp
28  */

29
30 package com.caucho.amber.cfg;
31
32 import java.util.HashMap JavaDoc;
33
34 /**
35  * <attributes> tag in the orm.xml
36  */

37 public class AttributesConfig {
38
39   // no attributes
40

41   // elements
42
private HashMap JavaDoc<String JavaDoc, IdConfig> _idMap
43     = new HashMap JavaDoc<String JavaDoc, IdConfig>();
44
45   private HashMap JavaDoc<String JavaDoc, BasicConfig> _basicMap
46     = new HashMap JavaDoc<String JavaDoc, BasicConfig>();
47
48   private EmbeddedIdConfig _embeddedId;
49
50   private HashMap JavaDoc<String JavaDoc, VersionConfig> _versionMap
51     = new HashMap JavaDoc<String JavaDoc, VersionConfig>();
52
53   private HashMap JavaDoc<String JavaDoc, ManyToOneConfig> _manyToOneMap
54     = new HashMap JavaDoc<String JavaDoc, ManyToOneConfig>();
55
56   private HashMap JavaDoc<String JavaDoc, OneToManyConfig> _oneToManyMap
57     = new HashMap JavaDoc<String JavaDoc, OneToManyConfig>();
58
59   private HashMap JavaDoc<String JavaDoc, OneToOneConfig> _oneToOneMap
60     = new HashMap JavaDoc<String JavaDoc, OneToOneConfig>();
61
62   private HashMap JavaDoc<String JavaDoc, ManyToManyConfig> _manyToManyMap
63     = new HashMap JavaDoc<String JavaDoc, ManyToManyConfig>();
64
65   private HashMap JavaDoc<String JavaDoc, EmbeddedConfig> _embeddedMap
66     = new HashMap JavaDoc<String JavaDoc, EmbeddedConfig>();
67
68   private HashMap JavaDoc<String JavaDoc, TransientConfig> _transientMap
69     = new HashMap JavaDoc<String JavaDoc, TransientConfig>();
70
71
72   /**
73    * Adds a new <basic>.
74    */

75   public void addBasic(BasicConfig basic)
76   {
77     _basicMap.put(basic.getName(), basic);
78   }
79
80   /**
81    * Returns the <basic> map.
82    */

83   public HashMap JavaDoc<String JavaDoc, BasicConfig> getBasicMap()
84   {
85     return _basicMap;
86   }
87
88   /**
89    * Returns a <basic> config.
90    */

91   public BasicConfig getBasic(String JavaDoc name)
92   {
93     return _basicMap.get(name);
94   }
95
96   /**
97    * Adds a new <id>.
98    */

99   public void addId(IdConfig id)
100   {
101     _idMap.put(id.getName(), id);
102   }
103
104   /**
105    * Returns the <id> map.
106    */

107   public HashMap JavaDoc<String JavaDoc, IdConfig> getIdMap()
108   {
109     return _idMap;
110   }
111
112   /**
113    * Returns an <id> config.
114    */

115   public IdConfig getId(String JavaDoc name)
116   {
117     return _idMap.get(name);
118   }
119
120   /**
121    * Returns the <embedded-id> config.
122    */

123   public EmbeddedIdConfig getEmbeddedId()
124   {
125     return _embeddedId;
126   }
127
128   /**
129    * Sets the <embedded-id> config.
130    */

131   public void setEmbeddedId(EmbeddedIdConfig embeddedId)
132   {
133     _embeddedId = embeddedId;
134   }
135
136   public HashMap JavaDoc<String JavaDoc, VersionConfig> getVersionMap()
137   {
138     return _versionMap;
139   }
140
141   public void addVersion(VersionConfig version)
142   {
143     _versionMap.put(version.getName(), version);
144   }
145
146   public VersionConfig getVersion(String JavaDoc name)
147   {
148     return _versionMap.get(name);
149   }
150
151   public HashMap JavaDoc<String JavaDoc, ManyToOneConfig> getManyToOneMap()
152   {
153     return _manyToOneMap;
154   }
155
156   public void addManyToOne(ManyToOneConfig manyToOne)
157   {
158     _manyToOneMap.put(manyToOne.getName(), manyToOne);
159   }
160
161   public ManyToOneConfig getManyToOne(String JavaDoc name)
162   {
163     return _manyToOneMap.get(name);
164   }
165
166   public HashMap JavaDoc<String JavaDoc, OneToManyConfig> getOneToManyMap()
167   {
168     return _oneToManyMap;
169   }
170
171   public void addOneToMany(OneToManyConfig oneToMany)
172   {
173     _oneToManyMap.put(oneToMany.getName(), oneToMany);
174   }
175
176   public OneToManyConfig getOneToMany(String JavaDoc name)
177   {
178     return _oneToManyMap.get(name);
179   }
180
181   public HashMap JavaDoc<String JavaDoc, OneToOneConfig> getOneToOneMap()
182   {
183     return _oneToOneMap;
184   }
185
186   public void addOneToOne(OneToOneConfig oneToOne)
187   {
188     _oneToOneMap.put(oneToOne.getName(), oneToOne);
189   }
190
191   public OneToOneConfig getOneToOne(String JavaDoc name)
192   {
193     return _oneToOneMap.get(name);
194   }
195
196   public HashMap JavaDoc<String JavaDoc, ManyToManyConfig> getManyToManyMap()
197   {
198     return _manyToManyMap;
199   }
200
201   public void addManyToMany(ManyToManyConfig manyToMany)
202   {
203     _manyToManyMap.put(manyToMany.getName(), manyToMany);
204   }
205
206   public ManyToManyConfig getManyToMany(String JavaDoc name)
207   {
208     return _manyToManyMap.get(name);
209   }
210
211   public HashMap JavaDoc<String JavaDoc, EmbeddedConfig> getEmbeddedMap()
212   {
213     return _embeddedMap;
214   }
215
216   public void addEmbedded(EmbeddedConfig embedded)
217   {
218     _embeddedMap.put(embedded.getName(), embedded);
219   }
220
221   public EmbeddedConfig getEmbedded(String JavaDoc name)
222   {
223     return _embeddedMap.get(name);
224   }
225
226   public HashMap JavaDoc<String JavaDoc, TransientConfig> getTransientMap()
227   {
228     return _transientMap;
229   }
230
231   public void addTransient(TransientConfig transientConfig)
232   {
233     _transientMap.put(transientConfig.getName(), transientConfig);
234   }
235
236   public TransientConfig getTransient(String JavaDoc name)
237   {
238     return _transientMap.get(name);
239   }
240 }
241
Popular Tags