001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.openejb.jee.jpa;
017:
018: import java.util.ArrayList;
019: import java.util.List;
020: import javax.xml.bind.annotation.XmlAccessType;
021: import javax.xml.bind.annotation.XmlAccessorType;
022: import javax.xml.bind.annotation.XmlAttribute;
023: import javax.xml.bind.annotation.XmlElement;
024: import javax.xml.bind.annotation.XmlRootElement;
025: import javax.xml.bind.annotation.XmlType;
026: import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
027: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
028:
029: /**
030: *
031: *
032: * The entity-mappings element is the root element of an mapping
033: * file. It contains the following four types of elements:
034: *
035: * 1. The persistence-unit-metadata element contains metadata
036: * for the entire persistence unit. It is undefined if this element
037: * occurs in multiple mapping files within the same persistence unit.
038: *
039: * 2. The package, schema, catalog and access elements apply to all of
040: * the entity, mapped-superclass and embeddable elements defined in
041: * the same file in which they occur.
042: *
043: * 3. The sequence-generator, table-generator, named-query,
044: * named-native-query and sql-result-set-mapping elements are global
045: * to the persistence unit. It is undefined to have more than one
046: * sequence-generator or table-generator of the same name in the same
047: * or different mapping files in a persistence unit. It is also
048: * undefined to have more than one named-query or named-native-query
049: * of the same name in the same or different mapping files in a
050: * persistence unit.
051: *
052: * 4. The entity, mapped-superclass and embeddable elements each define
053: * the mapping information for a managed persistent class. The mapping
054: * information contained in these elements may be complete or it may
055: * be partial.
056: *
057: *
058: *
059: * <p>Java class for anonymous complex type.
060: *
061: * <p>The following schema fragment specifies the expected content contained within this class.
062: *
063: * <pre>
064: * <complexType>
065: * <complexContent>
066: * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
067: * <sequence>
068: * <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
069: * <element name="persistence-unit-metadata" type="{http://java.sun.com/xml/ns/persistence/orm}persistence-unit-metadata" minOccurs="0"/>
070: * <element name="package" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
071: * <element name="schema" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
072: * <element name="catalog" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
073: * <element name="access" type="{http://java.sun.com/xml/ns/persistence/orm}access-type" minOccurs="0"/>
074: * <element name="sequence-generator" type="{http://java.sun.com/xml/ns/persistence/orm}sequence-generator" maxOccurs="unbounded" minOccurs="0"/>
075: * <element name="table-generator" type="{http://java.sun.com/xml/ns/persistence/orm}table-generator" maxOccurs="unbounded" minOccurs="0"/>
076: * <element name="named-query" type="{http://java.sun.com/xml/ns/persistence/orm}named-query" maxOccurs="unbounded" minOccurs="0"/>
077: * <element name="named-native-query" type="{http://java.sun.com/xml/ns/persistence/orm}named-native-query" maxOccurs="unbounded" minOccurs="0"/>
078: * <element name="sql-result-set-mapping" type="{http://java.sun.com/xml/ns/persistence/orm}sql-result-set-mapping" maxOccurs="unbounded" minOccurs="0"/>
079: * <element name="mapped-superclass" type="{http://java.sun.com/xml/ns/persistence/orm}mapped-superclass" maxOccurs="unbounded" minOccurs="0"/>
080: * <element name="entity" type="{http://java.sun.com/xml/ns/persistence/orm}entity" maxOccurs="unbounded" minOccurs="0"/>
081: * <element name="embeddable" type="{http://java.sun.com/xml/ns/persistence/orm}embeddable" maxOccurs="unbounded" minOccurs="0"/>
082: * </sequence>
083: * <attribute name="version" use="required" type="{http://java.sun.com/xml/ns/persistence/orm}versionType" fixed="1.0" />
084: * </restriction>
085: * </complexContent>
086: * </complexType>
087: * </pre>
088: *
089: *
090: */
091: @XmlAccessorType(XmlAccessType.FIELD)
092: @XmlType(name="",propOrder={"description","persistenceUnitMetadata","_package","schema","catalog","access","sequenceGenerator","tableGenerator","namedQuery","namedNativeQuery","sqlResultSetMapping","mappedSuperclass","entity","embeddable"})
093: @XmlRootElement(name="entity-mappings")
094: public class EntityMappings {
095:
096: protected String description;
097: @XmlElement(name="persistence-unit-metadata")
098: protected PersistenceUnitMetadata persistenceUnitMetadata;
099: @XmlElement(name="package")
100: protected String _package;
101: protected String schema;
102: protected String catalog;
103: protected AccessType access;
104: @XmlElement(name="sequence-generator")
105: protected List<SequenceGenerator> sequenceGenerator;
106: @XmlElement(name="table-generator")
107: protected List<TableGenerator> tableGenerator;
108: @XmlElement(name="named-query")
109: protected List<NamedQuery> namedQuery;
110: @XmlElement(name="named-native-query")
111: protected List<NamedNativeQuery> namedNativeQuery;
112: @XmlElement(name="sql-result-set-mapping")
113: protected List<SqlResultSetMapping> sqlResultSetMapping;
114: @XmlElement(name="mapped-superclass")
115: protected List<MappedSuperclass> mappedSuperclass;
116: protected List<Entity> entity;
117: protected List<Embeddable> embeddable;
118: @XmlAttribute(required=true)
119: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
120: protected String version = "1.0";
121:
122: /**
123: * Gets the value of the description property.
124: *
125: * @return
126: * possible object is
127: * {@link String }
128: *
129: */
130: public String getDescription() {
131: return description;
132: }
133:
134: /**
135: * Sets the value of the description property.
136: *
137: * @param value
138: * allowed object is
139: * {@link String }
140: *
141: */
142: public void setDescription(String value) {
143: this .description = value;
144: }
145:
146: /**
147: * Gets the value of the persistenceUnitMetadata property.
148: *
149: * @return
150: * possible object is
151: * {@link PersistenceUnitMetadata }
152: *
153: */
154: public PersistenceUnitMetadata getPersistenceUnitMetadata() {
155: return persistenceUnitMetadata;
156: }
157:
158: /**
159: * Sets the value of the persistenceUnitMetadata property.
160: *
161: * @param value
162: * allowed object is
163: * {@link PersistenceUnitMetadata }
164: *
165: */
166: public void setPersistenceUnitMetadata(PersistenceUnitMetadata value) {
167: this .persistenceUnitMetadata = value;
168: }
169:
170: /**
171: * Gets the value of the package property.
172: *
173: * @return
174: * possible object is
175: * {@link String }
176: *
177: */
178: public String getPackage() {
179: return _package;
180: }
181:
182: /**
183: * Sets the value of the package property.
184: *
185: * @param value
186: * allowed object is
187: * {@link String }
188: *
189: */
190: public void setPackage(String value) {
191: this ._package = value;
192: }
193:
194: /**
195: * Gets the value of the schema property.
196: *
197: * @return
198: * possible object is
199: * {@link String }
200: *
201: */
202: public String getSchema() {
203: return schema;
204: }
205:
206: /**
207: * Sets the value of the schema property.
208: *
209: * @param value
210: * allowed object is
211: * {@link String }
212: *
213: */
214: public void setSchema(String value) {
215: this .schema = value;
216: }
217:
218: /**
219: * Gets the value of the catalog property.
220: *
221: * @return
222: * possible object is
223: * {@link String }
224: *
225: */
226: public String getCatalog() {
227: return catalog;
228: }
229:
230: /**
231: * Sets the value of the catalog property.
232: *
233: * @param value
234: * allowed object is
235: * {@link String }
236: *
237: */
238: public void setCatalog(String value) {
239: this .catalog = value;
240: }
241:
242: /**
243: * Gets the value of the access property.
244: *
245: * @return
246: * possible object is
247: * {@link AccessType }
248: *
249: */
250: public AccessType getAccess() {
251: return access;
252: }
253:
254: /**
255: * Sets the value of the access property.
256: *
257: * @param value
258: * allowed object is
259: * {@link AccessType }
260: *
261: */
262: public void setAccess(AccessType value) {
263: this .access = value;
264: }
265:
266: /**
267: * Gets the value of the sequenceGenerator property.
268: *
269: * <p>
270: * This accessor method returns a reference to the live list,
271: * not a snapshot. Therefore any modification you make to the
272: * returned list will be present inside the JAXB object.
273: * This is why there is not a <CODE>set</CODE> method for the sequenceGenerator property.
274: *
275: * <p>
276: * For example, to add a new item, do as follows:
277: * <pre>
278: * getSequenceGenerator().add(newItem);
279: * </pre>
280: *
281: *
282: * <p>
283: * Objects of the following type(s) are allowed in the list
284: * {@link SequenceGenerator }
285: *
286: *
287: */
288: public List<SequenceGenerator> getSequenceGenerator() {
289: if (sequenceGenerator == null) {
290: sequenceGenerator = new ArrayList<SequenceGenerator>();
291: }
292: return this .sequenceGenerator;
293: }
294:
295: /**
296: * Gets the value of the tableGenerator property.
297: *
298: * <p>
299: * This accessor method returns a reference to the live list,
300: * not a snapshot. Therefore any modification you make to the
301: * returned list will be present inside the JAXB object.
302: * This is why there is not a <CODE>set</CODE> method for the tableGenerator property.
303: *
304: * <p>
305: * For example, to add a new item, do as follows:
306: * <pre>
307: * getTableGenerator().add(newItem);
308: * </pre>
309: *
310: *
311: * <p>
312: * Objects of the following type(s) are allowed in the list
313: * {@link TableGenerator }
314: *
315: *
316: */
317: public List<TableGenerator> getTableGenerator() {
318: if (tableGenerator == null) {
319: tableGenerator = new ArrayList<TableGenerator>();
320: }
321: return this .tableGenerator;
322: }
323:
324: /**
325: * Gets the value of the namedQuery property.
326: *
327: * <p>
328: * This accessor method returns a reference to the live list,
329: * not a snapshot. Therefore any modification you make to the
330: * returned list will be present inside the JAXB object.
331: * This is why there is not a <CODE>set</CODE> method for the namedQuery property.
332: *
333: * <p>
334: * For example, to add a new item, do as follows:
335: * <pre>
336: * getNamedQuery().add(newItem);
337: * </pre>
338: *
339: *
340: * <p>
341: * Objects of the following type(s) are allowed in the list
342: * {@link NamedQuery }
343: *
344: *
345: */
346: public List<NamedQuery> getNamedQuery() {
347: if (namedQuery == null) {
348: namedQuery = new ArrayList<NamedQuery>();
349: }
350: return this .namedQuery;
351: }
352:
353: /**
354: * Gets the value of the namedNativeQuery property.
355: *
356: * <p>
357: * This accessor method returns a reference to the live list,
358: * not a snapshot. Therefore any modification you make to the
359: * returned list will be present inside the JAXB object.
360: * This is why there is not a <CODE>set</CODE> method for the namedNativeQuery property.
361: *
362: * <p>
363: * For example, to add a new item, do as follows:
364: * <pre>
365: * getNamedNativeQuery().add(newItem);
366: * </pre>
367: *
368: *
369: * <p>
370: * Objects of the following type(s) are allowed in the list
371: * {@link NamedNativeQuery }
372: *
373: *
374: */
375: public List<NamedNativeQuery> getNamedNativeQuery() {
376: if (namedNativeQuery == null) {
377: namedNativeQuery = new ArrayList<NamedNativeQuery>();
378: }
379: return this .namedNativeQuery;
380: }
381:
382: /**
383: * Gets the value of the sqlResultSetMapping property.
384: *
385: * <p>
386: * This accessor method returns a reference to the live list,
387: * not a snapshot. Therefore any modification you make to the
388: * returned list will be present inside the JAXB object.
389: * This is why there is not a <CODE>set</CODE> method for the sqlResultSetMapping property.
390: *
391: * <p>
392: * For example, to add a new item, do as follows:
393: * <pre>
394: * getSqlResultSetMapping().add(newItem);
395: * </pre>
396: *
397: *
398: * <p>
399: * Objects of the following type(s) are allowed in the list
400: * {@link SqlResultSetMapping }
401: *
402: *
403: */
404: public List<SqlResultSetMapping> getSqlResultSetMapping() {
405: if (sqlResultSetMapping == null) {
406: sqlResultSetMapping = new ArrayList<SqlResultSetMapping>();
407: }
408: return this .sqlResultSetMapping;
409: }
410:
411: /**
412: * Gets the value of the mappedSuperclass property.
413: *
414: * <p>
415: * This accessor method returns a reference to the live list,
416: * not a snapshot. Therefore any modification you make to the
417: * returned list will be present inside the JAXB object.
418: * This is why there is not a <CODE>set</CODE> method for the mappedSuperclass property.
419: *
420: * <p>
421: * For example, to add a new item, do as follows:
422: * <pre>
423: * getMappedSuperclass().add(newItem);
424: * </pre>
425: *
426: *
427: * <p>
428: * Objects of the following type(s) are allowed in the list
429: * {@link MappedSuperclass }
430: *
431: *
432: */
433: public List<MappedSuperclass> getMappedSuperclass() {
434: if (mappedSuperclass == null) {
435: mappedSuperclass = new ArrayList<MappedSuperclass>();
436: }
437: return this .mappedSuperclass;
438: }
439:
440: /**
441: * Gets the value of the entity property.
442: *
443: * <p>
444: * This accessor method returns a reference to the live list,
445: * not a snapshot. Therefore any modification you make to the
446: * returned list will be present inside the JAXB object.
447: * This is why there is not a <CODE>set</CODE> method for the entity property.
448: *
449: * <p>
450: * For example, to add a new item, do as follows:
451: * <pre>
452: * getEntity().add(newItem);
453: * </pre>
454: *
455: *
456: * <p>
457: * Objects of the following type(s) are allowed in the list
458: * {@link Entity }
459: *
460: *
461: */
462: public List<Entity> getEntity() {
463: if (entity == null) {
464: entity = new ArrayList<Entity>();
465: }
466: return this .entity;
467: }
468:
469: /**
470: * Gets the value of the embeddable property.
471: *
472: * <p>
473: * This accessor method returns a reference to the live list,
474: * not a snapshot. Therefore any modification you make to the
475: * returned list will be present inside the JAXB object.
476: * This is why there is not a <CODE>set</CODE> method for the embeddable property.
477: *
478: * <p>
479: * For example, to add a new item, do as follows:
480: * <pre>
481: * getEmbeddable().add(newItem);
482: * </pre>
483: *
484: *
485: * <p>
486: * Objects of the following type(s) are allowed in the list
487: * {@link Embeddable }
488: *
489: *
490: */
491: public List<Embeddable> getEmbeddable() {
492: if (embeddable == null) {
493: embeddable = new ArrayList<Embeddable>();
494: }
495: return this .embeddable;
496: }
497:
498: /**
499: * Gets the value of the version property.
500: *
501: * @return
502: * possible object is
503: * {@link String }
504: *
505: */
506: public String getVersion() {
507: if (version == null) {
508: return "1.0";
509: } else {
510: return version;
511: }
512: }
513:
514: /**
515: * Sets the value of the version property.
516: *
517: * @param value
518: * allowed object is
519: * {@link String }
520: *
521: */
522: public void setVersion(String value) {
523: this.version = value;
524: }
525:
526: }
|