Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326718

Summary: Any/Choice content for generic JAXB to support validation
Product: [WebTools] Dali JPA Tools Reporter: Neil Hauge <neil.hauge>
Component: JAXBAssignee: Karen Butzke <karenfbutzke>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: karenfbutzke
Version: 3.0Keywords: plan
Target Milestone: 3.0 M6   
Hardware: PC   
OS: Windows 7   
Whiteboard: JAXB

Description Neil Hauge CLA 2010-09-30 17:13:36 EDT
This enhancement covers context model for the generic JAXB Any/Choice content, specifically:

XmlElementWrapper
XmlList
XmlValue
XmlAnyElement
XmlAnyAttribute
XmlMixed

See http://wiki.eclipse.org/EclipseLink/DesignDocs/277920/Phase4 for detailed info and examples for these annotations.

Context model should include standard state and behavior required for validation purposes.
Comment 1 Karen Butzke CLA 2011-02-02 16:12:29 EST
added support to XmlElement mappings for XmlElementWrapper. Added 1 validation message, if the type of the property is not an Array or a Collection then you should get an error message : "XmlElementWrapper is only allowed on a collection or array property". Added bug 336161 for remaining validation and code-assist
Comment 2 Karen Butzke CLA 2011-02-03 11:44:47 EST
added support to XmlElement and XmlAttribute mappings for @XmlList. Added 1 validation message, if the type of the property is not an Array or a Collection then you should get an error message : "XmlList is only allowed on a
collection or array property". Added bug 336259 for remaining validation
Comment 3 Karen Butzke CLA 2011-02-04 15:48:21 EST
added XmlValue attribute mapping support. These now appear in the navigator UI. 2 validation messages were added:

1. If a class has multiple attribute mappings mapped with @XmlValue then all mappings except the first will have this validation message: "Attribute "foo" cannot be mapped as XmlValue because attribute "bar" is already mapped as XmlValue, cannot define multiple XmlValue mappings
2. If a class that has an @XmlValue attribute mapping in it, then all attributes that are mapped as anything except XmlAttribute will have this validation message:
Attribute "foo" must be mapped as XmlAttribute because another attribute "bar" is mapped as XmlValue

The remaining validation has been defined in bug 336393
Comment 4 Karen Butzke CLA 2011-02-10 17:47:12 EST
Added context model support for XmlAnyElement and XmlAnyAttribute. Also added these to the UI, though the icons still need to be updated.

XmlAnyElement also has support for XmlMixed

Added validation errors:

1. Attribute 'foo' cannot be mapped as XmlAnyElement because attribute 'bar' is already mapped as XmlAnyElement, cannot define multiple XmlAnyElement mappings

2.  Attribute 'foo' cannot be mapped as XmlAnyAttribute because attribute 'bar' is already mapped as XmlAnyAttribute, cannot define multiple XmlAnyAttribute mappings

3.XmlAnyAttribute is only allowed on a property assignable to java.util.Map


bug 336877 has been opened to support additional validation for @XmlAnyElement