Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2011-08-25 22:32:59 +0000
committerpfullbright2011-08-25 22:32:59 +0000
commit5701d45519bcada51fdca3e6a8a1b6c0830ef4af (patch)
treee6cd0399bc8f7307359042027d15cf2a0b950bc9 /jaxb/plugins/org.eclipse.jpt.jaxb.core
parent852720b31df8acb8c434b3b197624392806b1b7b (diff)
downloadwebtools.dali-5701d45519bcada51fdca3e6a8a1b6c0830ef4af.tar.gz
webtools.dali-5701d45519bcada51fdca3e6a8a1b6c0830ef4af.tar.xz
webtools.dali-5701d45519bcada51fdca3e6a8a1b6c0830ef4af.zip
XmlMixed support and tests
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.jaxb.core')
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementRefMapping.java11
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementRefsMapping.java9
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlMixed.java8
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAnyElementMapping.java7
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefMapping.java103
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefsMapping.java92
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java5
7 files changed, 210 insertions, 25 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementRefMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementRefMapping.java
index 8bf6c28eec..c8148595dd 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementRefMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementRefMapping.java
@@ -36,4 +36,15 @@ public interface XmlElementRefMapping
XmlElementWrapper addXmlElementWrapper();
void removeXmlElementWrapper();
+
+
+ // ***** XmlMixed *****
+
+ String XML_MIXED_PROPERTY = "xmlMixed"; //$NON-NLS-1$
+
+ XmlMixed getXmlMixed();
+
+ XmlMixed addXmlMixed();
+
+ void removeXmlMixed();
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementRefsMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementRefsMapping.java
index a99e837802..5175b16eb5 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementRefsMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementRefsMapping.java
@@ -24,4 +24,13 @@ package org.eclipse.jpt.jaxb.core.context;
public interface XmlElementRefsMapping
extends JaxbAttributeMapping {
+ // ***** XmlMixed *****
+
+ String XML_MIXED_PROPERTY = "xmlMixed"; //$NON-NLS-1$
+
+ XmlMixed getXmlMixed();
+
+ XmlMixed addXmlMixed();
+
+ void removeXmlMixed();
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlMixed.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlMixed.java
index 859a755a0c..dfc6df927a 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlMixed.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlMixed.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.jaxb.core.context;
import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode;
/**
- *
+ * Represents the @XmlMixed JAXB annotation
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -24,8 +24,6 @@ import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode;
* @since 3.0
*/
public interface XmlMixed
- extends
- JavaContextNode
-{
-
+ extends JavaContextNode {
+
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAnyElementMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAnyElementMapping.java
index a55653606b..09ee290a22 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAnyElementMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAnyElementMapping.java
@@ -16,6 +16,7 @@ import org.eclipse.jpt.jaxb.core.context.XmlAdaptable;
import org.eclipse.jpt.jaxb.core.context.XmlAnyElementMapping;
import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
import org.eclipse.jpt.jaxb.core.context.XmlMixed;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyElementAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation;
@@ -169,7 +170,7 @@ public class GenericJavaXmlAnyElementMapping
if (this.xmlMixed != null) {
throw new IllegalStateException();
}
- XmlMixedAnnotation annotation = (XmlMixedAnnotation) this.getJavaResourceAttribute().addAnnotation(XmlMixedAnnotation.ANNOTATION_NAME);
+ XmlMixedAnnotation annotation = (XmlMixedAnnotation) this.getJavaResourceAttribute().addAnnotation(JAXB.XML_MIXED);
XmlMixed xmlMixed = this.buildXmlMixed(annotation);
this.setXmlMixed_(xmlMixed);
@@ -184,7 +185,7 @@ public class GenericJavaXmlAnyElementMapping
if (this.xmlMixed == null) {
throw new IllegalStateException();
}
- this.getJavaResourceAttribute().removeAnnotation(XmlMixedAnnotation.ANNOTATION_NAME);
+ this.getJavaResourceAttribute().removeAnnotation(JAXB.XML_MIXED);
this.setXmlMixed_(null);
}
@@ -196,7 +197,7 @@ public class GenericJavaXmlAnyElementMapping
}
protected XmlMixedAnnotation getXmlMixedAnnotation() {
- return (XmlMixedAnnotation) this.getJavaResourceAttribute().getAnnotation(XmlMixedAnnotation.ANNOTATION_NAME);
+ return (XmlMixedAnnotation) this.getJavaResourceAttribute().getAnnotation(JAXB.XML_MIXED);
}
protected void syncXmlMixed() {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefMapping.java
index 35603e6339..8893cb1ab4 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefMapping.java
@@ -23,10 +23,12 @@ import org.eclipse.jpt.jaxb.core.context.XmlElementRef;
import org.eclipse.jpt.jaxb.core.context.XmlElementRefMapping;
import org.eclipse.jpt.jaxb.core.context.XmlElementWrapper;
import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
+import org.eclipse.jpt.jaxb.core.context.XmlMixed;
import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -41,12 +43,15 @@ public class GenericJavaXmlElementRefMapping
protected XmlElementWrapper xmlElementWrapper;
+ protected XmlMixed xmlMixed;
+
public GenericJavaXmlElementRefMapping(JaxbPersistentAttribute parent) {
super(parent);
this.xmlElementRef = buildXmlElementRef();
this.xmlAdaptable = buildXmlAdaptable();
- this.initializeXmlElementWrapper();
+ initializeXmlElementWrapper();
+ initializeXmlMixed();
}
@@ -65,6 +70,7 @@ public class GenericJavaXmlElementRefMapping
this.xmlElementRef.synchronizeWithResourceModel();
this.xmlAdaptable.synchronizeWithResourceModel();
syncXmlElementWrapper();
+ syncXmlMixed();
}
@Override
@@ -73,6 +79,7 @@ public class GenericJavaXmlElementRefMapping
this.xmlElementRef.update();
this.xmlAdaptable.update();
updateXmlElementWrapper();
+ updateXmlMixed();
}
@@ -126,6 +133,12 @@ public class GenericJavaXmlElementRefMapping
return this.xmlElementWrapper;
}
+ protected void setXmlElementWrapper_(XmlElementWrapper xmlElementWrapper) {
+ XmlElementWrapper oldXmlElementWrapper = this.xmlElementWrapper;
+ this.xmlElementWrapper = xmlElementWrapper;
+ firePropertyChanged(XML_ELEMENT_WRAPPER_PROPERTY, oldXmlElementWrapper, xmlElementWrapper);
+ }
+
public XmlElementWrapper addXmlElementWrapper() {
if (this.xmlElementWrapper != null) {
throw new IllegalStateException();
@@ -137,18 +150,22 @@ public class GenericJavaXmlElementRefMapping
return xmlElementWrapper;
}
- protected XmlElementWrapper buildXmlElementWrapper(XmlElementWrapperAnnotation xmlElementWrapperAnnotation) {
- return new GenericJavaXmlElementWrapper(this, xmlElementWrapperAnnotation);
- }
-
public void removeXmlElementWrapper() {
if (this.xmlElementWrapper == null) {
throw new IllegalStateException();
}
- this.getJavaResourceAttribute().removeAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME);
+ this.getJavaResourceAttribute().removeAnnotation(JAXB.XML_ELEMENT_WRAPPER);
this.setXmlElementWrapper_(null);
}
+ protected XmlElementWrapperAnnotation getXmlElementWrapperAnnotation() {
+ return (XmlElementWrapperAnnotation) this.getJavaResourceAttribute().getAnnotation(JAXB.XML_ELEMENT_WRAPPER);
+ }
+
+ protected XmlElementWrapper buildXmlElementWrapper(XmlElementWrapperAnnotation xmlElementWrapperAnnotation) {
+ return new GenericJavaXmlElementWrapper(this, xmlElementWrapperAnnotation);
+ }
+
protected void initializeXmlElementWrapper() {
XmlElementWrapperAnnotation annotation = this.getXmlElementWrapperAnnotation();
if (annotation != null) {
@@ -156,10 +173,6 @@ public class GenericJavaXmlElementRefMapping
}
}
- protected XmlElementWrapperAnnotation getXmlElementWrapperAnnotation() {
- return (XmlElementWrapperAnnotation) this.getJavaResourceAttribute().getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME);
- }
-
protected void syncXmlElementWrapper() {
XmlElementWrapperAnnotation annotation = this.getXmlElementWrapperAnnotation();
if (annotation != null) {
@@ -181,10 +194,72 @@ public class GenericJavaXmlElementRefMapping
}
}
- protected void setXmlElementWrapper_(XmlElementWrapper xmlElementWrapper) {
- XmlElementWrapper oldXmlElementWrapper = this.xmlElementWrapper;
- this.xmlElementWrapper = xmlElementWrapper;
- firePropertyChanged(XML_ELEMENT_WRAPPER_PROPERTY, oldXmlElementWrapper, xmlElementWrapper);
+
+ // ***** XmlMixed *****
+
+ public XmlMixed getXmlMixed() {
+ return this.xmlMixed;
+ }
+
+ protected void setXmlMixed_(XmlMixed xmlMixed) {
+ XmlMixed oldXmlMixed = this.xmlMixed;
+ this.xmlMixed = xmlMixed;
+ firePropertyChanged(XML_MIXED_PROPERTY, oldXmlMixed, xmlMixed);
+ }
+
+ public XmlMixed addXmlMixed() {
+ if (this.xmlMixed != null) {
+ throw new IllegalStateException();
+ }
+ XmlMixedAnnotation annotation = (XmlMixedAnnotation) getJavaResourceAttribute().addAnnotation(JAXB.XML_MIXED);
+
+ XmlMixed xmlMixed = buildXmlMixed(annotation);
+ setXmlMixed_(xmlMixed);
+ return xmlMixed;
+ }
+
+ public void removeXmlMixed() {
+ if (this.xmlMixed == null) {
+ throw new IllegalStateException();
+ }
+ getJavaResourceAttribute().removeAnnotation(JAXB.XML_MIXED);
+ setXmlMixed_(null);
+ }
+
+ protected XmlMixedAnnotation getXmlMixedAnnotation() {
+ return (XmlMixedAnnotation) getJavaResourceAttribute().getAnnotation(JAXB.XML_MIXED);
+ }
+
+ protected XmlMixed buildXmlMixed(XmlMixedAnnotation xmlMixedAnnotation) {
+ return new GenericJavaXmlMixed(this, xmlMixedAnnotation);
+ }
+
+ protected void initializeXmlMixed() {
+ XmlMixedAnnotation annotation = getXmlMixedAnnotation();
+ if (annotation != null) {
+ this.xmlMixed = buildXmlMixed(annotation);
+ }
+ }
+
+ protected void syncXmlMixed() {
+ XmlMixedAnnotation annotation = getXmlMixedAnnotation();
+ if (annotation != null) {
+ if (this.xmlMixed != null) {
+ this.xmlMixed.synchronizeWithResourceModel();
+ }
+ else {
+ setXmlMixed_(buildXmlMixed(annotation));
+ }
+ }
+ else {
+ setXmlMixed_(null);
+ }
+ }
+
+ protected void updateXmlMixed() {
+ if (this.xmlMixed != null) {
+ this.xmlMixed.update();
+ }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefsMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefsMapping.java
index ce8f2b47ad..fdfc6881b7 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefsMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefsMapping.java
@@ -12,16 +12,22 @@ package org.eclipse.jpt.jaxb.core.internal.context.java;
import org.eclipse.jpt.jaxb.core.MappingKeys;
import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
import org.eclipse.jpt.jaxb.core.context.XmlElementRefsMapping;
+import org.eclipse.jpt.jaxb.core.context.XmlMixed;
import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefsAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation;
public class GenericJavaXmlElementRefsMapping
extends AbstractJavaAttributeMapping<XmlElementRefsAnnotation>
implements XmlElementRefsMapping {
+ protected XmlMixed xmlMixed;
+
+
public GenericJavaXmlElementRefsMapping(JaxbPersistentAttribute parent) {
super(parent);
+ initializeXmlMixed();
}
@@ -33,4 +39,90 @@ public class GenericJavaXmlElementRefsMapping
protected String getAnnotationName() {
return JAXB.XML_ELEMENT_REFS;
}
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+// this.xmlElementRef.synchronizeWithResourceModel();
+// this.xmlAdaptable.synchronizeWithResourceModel();
+// syncXmlElementWrapper();
+ syncXmlMixed();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+// this.xmlElementRef.update();
+// this.xmlAdaptable.update();
+// updateXmlElementWrapper();
+ updateXmlMixed();
+ }
+
+
+ // ***** XmlMixed *****
+
+ public XmlMixed getXmlMixed() {
+ return this.xmlMixed;
+ }
+
+ protected void setXmlMixed_(XmlMixed xmlMixed) {
+ XmlMixed oldXmlMixed = this.xmlMixed;
+ this.xmlMixed = xmlMixed;
+ firePropertyChanged(XML_MIXED_PROPERTY, oldXmlMixed, xmlMixed);
+ }
+
+ public XmlMixed addXmlMixed() {
+ if (this.xmlMixed != null) {
+ throw new IllegalStateException();
+ }
+ XmlMixedAnnotation annotation = (XmlMixedAnnotation) getJavaResourceAttribute().addAnnotation(JAXB.XML_MIXED);
+
+ XmlMixed xmlMixed = buildXmlMixed(annotation);
+ setXmlMixed_(xmlMixed);
+ return xmlMixed;
+ }
+
+ public void removeXmlMixed() {
+ if (this.xmlMixed == null) {
+ throw new IllegalStateException();
+ }
+ getJavaResourceAttribute().removeAnnotation(JAXB.XML_MIXED);
+ setXmlMixed_(null);
+ }
+
+ protected XmlMixedAnnotation getXmlMixedAnnotation() {
+ return (XmlMixedAnnotation) getJavaResourceAttribute().getAnnotation(JAXB.XML_MIXED);
+ }
+
+ protected XmlMixed buildXmlMixed(XmlMixedAnnotation xmlMixedAnnotation) {
+ return new GenericJavaXmlMixed(this, xmlMixedAnnotation);
+ }
+
+ protected void initializeXmlMixed() {
+ XmlMixedAnnotation annotation = getXmlMixedAnnotation();
+ if (annotation != null) {
+ this.xmlMixed = buildXmlMixed(annotation);
+ }
+ }
+
+ protected void syncXmlMixed() {
+ XmlMixedAnnotation annotation = getXmlMixedAnnotation();
+ if (annotation != null) {
+ if (this.xmlMixed != null) {
+ this.xmlMixed.synchronizeWithResourceModel();
+ }
+ else {
+ setXmlMixed_(buildXmlMixed(annotation));
+ }
+ }
+ else {
+ setXmlMixed_(null);
+ }
+ }
+
+ protected void updateXmlMixed() {
+ if (this.xmlMixed != null) {
+ this.xmlMixed.update();
+ }
+ }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java
index 10cdf06a39..d9370409c9 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java
@@ -26,8 +26,7 @@ import org.eclipse.jpt.common.core.resource.java.Annotation;
* @since 3.0
*/
public interface XmlMixedAnnotation
- extends Annotation
-{
+ extends Annotation {
+
String ANNOTATION_NAME = JAXB.XML_MIXED;
-
}

Back to the top