Updated version to 2.6 and updated SPI so it can be adapted by JDev
diff --git a/antbuild.xml b/antbuild.xml
index 1aef192..72a86fb 100644
--- a/antbuild.xml
+++ b/antbuild.xml
@@ -1,434 +1,434 @@
-<!--/*******************************************************************************
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
-* which accompanies this distribution.
-* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
-* and the Eclipse Distribution License is available at
-* http://www.eclipse.org/org/documents/edl-v10.php.
-*
-* Ant naming conventions:
-* - regardless of the actual OS platform,'/' is the directory separator
-* (Ant will convert as appropriate).
-* - multi-word properties use periods '.'
-* - properties ending in .jar define jarfile names only (no path)
-* - properties ending in .lib are fully qualified jars (path and filename)
-* - properties ending in .dir are directory paths
-* - properties ending in .path are path refid names (classpath fragments)
-* - multi-word targets use hyphens '-'
-* - targets beginning with test- are reserved for high level test targets,
-* and are used in test results parsing
-* - targets typically use the form <action>-<object>-<type> (ie. package-bundle-zip)
-* - multi-word macros use underscores '_'
-* - multi-word macro attributes are concatinated
-* e.g. 'runpathref'
-* - multi-word tasks (taskdef) names are concatinated
-* e.g. 'validateconnection'
-* - OS environment variables are in ALLCAPS and have 'env' as a prefix
-* e.g. ${env.XXX}.
-* - Ant properties are lower case.
-*
-* Contributors:
-* egwin - initial implementation.
-#******************************************************************************/-->
-<!-- =============================================================================
-* General Comments
-* This buildfile contains:
-* - calls to the component builds to clean, compile, package and test thier bits
-* - calls to initiate component tests
-* - targets to generate the eclipselink tools installer
-* - targets to generate the javadocs
-* Used standalone it can generate Developer Builds of the entire product or subsets
-* of the product.
-*================================================================================= -->
-<!-- This ant project includes the following tasks:
- - build (default) : compiles all components and tests
- - clean : removes all build generated files
- - build-distribution : compiles and packages all jars, javadocs, installer
- - build-javadocs : generates Javadocs
- - package-installer-zip : builds installer
- - test-srg : runs all Short ReGression test suites
- - test-lrg : runs all Long ReGression test suites
-
- It may require some configuration of the build.properties to run.
- -->
-<project name="eclipselink.tools.temp" default="build" basedir=".">
-
- <target name="build" depends="init, build-tools, build-tools-test" description="Default ant target, compiles all components and tests"/>
- <target name="clean" depends="init, clean-tools, clean-tools-test" description="Cleans all build generated files."/>
- <target name="build-distribution" depends="clean, build, build-javadocs, package-installer-zip" description="Builds all jars, generates javadoc, and builds installer."/>
- <target name="test-srg" depends="init, test-tools-srg" description="Run the SRG test suites"/>
- <target name="test-lrg" depends="init, test-tools" description="Run the LRG test suites"/>
-
-<!-- ================================================================================= -->
-<!-- =========================== Init Targets ====================================== -->
- <target name="init">
- <dirname property="tools.build.location_temp" file="${ant.file.eclipselink.tools.temp}"/>
- <pathconvert targetos="unix" property="tools.build.location">
- <path>
- <pathelement location="${tools.build.location_temp}"/>
- </path>
- </pathconvert>
- <echo message="tools.build.location = '${tools.build.location}'"/>
- <property environment="env"/>
- <echo message="env.JAVA_HOME = '${env.JAVA_HOME}'"/>
- <echo message="env.ANT_HOME = '${env.ANT_HOME}'"/>
- <echo message="env.JUNIT_HOME = '${env.JUNIT_HOME}'"/>
- <echo message="env.MAVENANT_DIR= '${env.MAVENANT_DIR}'"/>
- <echo message="env.PATH = '${env.PATH}'"/>
- <echo message="env.CLASSPATH = '${env.CLASSPATH}'"/>
- <echo message="env.GIT_EXEC = '${env.GIT_EXEC}'"/>
- <echo message="env.TARGET = '${env.TARGET}'"/>
- <echo message=" "/>
- <!-- Allows a user to overide certain user specific properties. -->
- <echo message="user.home = '${user.home}'"/>
-
- <!-- local property overrides -->
- <condition property="custom.properties.message" value="Loading ${user.home}/build.properties..."
- else="Custom properties file '${user.home}/build.properties' not found. Skipping...">
- <available file="${user.home}/build.properties"/>
- </condition>
- <echo message="${custom.properties.message}"/>
- <property file="${user.home}/build.properties"/>
-
- <!-- default dependency jar location -->
- <condition property="extensions.depend.dir" value="${tools.build.location}/../extension.lib.external"
- else="${tools.build.location}">
- <available file="${tools.build.location}/../extension.lib.external" type="dir"/>
- </condition>
- <echo message="extensions.depend.dir= '${extensions.depend.dir}'"/>
-
- <!-- helper definitions -->
- <property name="tools.root" value="${tools.build.location}/tools"/>
- <property name="tools.mvn.parent" value="${tools.root}/org.eclipse.persistence.tools.parent"/>
- <property name="tools.prefix" value="eclipselink-tools"/>
-
- <!-- Versioning -->
- <!-- These variables are set in Hudson. A manual build gets defaults -->
- <tstamp>
- <format property="build.date" pattern="yyyyMMdd"/>
- <format property="build.time" pattern="HHmm"/>
- </tstamp>
- <property name="build.type" value="SNAPSHOT"/>
- <property name="git.hash" value="NA"/>
- <condition property="version.qualifier" value="qualifier"
- else="v${build.date}-${git.hash}">
- <equals arg1="${git.hash}" arg2="NA"/>
- </condition>
- <property name="release.version" value="2.5.0"/>
- <property name="version.string" value="${release.version}.${version.qualifier}"/>
- <property name="release.designation" value="EclipseLink DeveloperBuild"/>
- <!-- generate string for tag creation (used for maven publish and handoff-version as well) -->
- <condition property="milestone.tag" value="${release.version}">
- <equals arg1="${build.type}" arg2="RELEASE"/>
- </condition>
- <property name="milestone.tag" value="${release.version}-${build.type}"/>
- <echo message="milestone.tag ='${milestone.tag}'"/>
-
- <!-- Javadoc properties -->
- <property name="javadoc.title" value="EclipseLink Tools ${release.version}, build '${version.qualifier}' API Reference"/>
- <property name="javadoc.dir" value="${tools.build.location}/tools/target/javadoc"/>
- <path id="javadoc.path">
- <pathelement path="${some.jar}"/>
- </path>
-
- <echo message="ANT_ARGS='${env.ANT_ARGS}'"/>
- <echo message="ANT_OPTS='${env.ANT_OPTS}'"/>
- <echo message=" "/>
- <echo message="java.version ='${java.version}'"/>
- <echo message="java.class.path='${java.class.path}'"/>
- <echo message="os.name ='${os.name}'"/>
- <echo message="os.arch ='${os.arch}'"/>
- <echo message="os.version ='${os.version}'"/>
- <echo message=" "/>
- <echo message="tools.root ='${tools.root}'"/>
- <echo message="tools.mvn.parent='${tools.mvn.parent}'"/>
- <echo message="tools.prefix ='${tools.prefix}'"/>
- <echo message=" "/>
- <echo message="builddate.buildtime='${build.date}.${build.time}'"/>
- <echo message="git.hash ='${git.hash}'"/>
- <echo message="build.type ='${build.type}'"/>
- <echo message="version.qualifier ='${version.qualifier}'"/>
- <echo message="release.version ='${release.version}'"/>
- <echo message="version.string ='${version.string}'"/>
- <echo message="release.designation='${release.designation}'"/>
- <echo message=" "/>
- <echo message="javadoc.title ='${javadoc.title}'"/>
- <echo message="javadoc.dir ='${javadoc.dir}'"/>
- </target>
-
- <!-- Needed for Maven/Tycho builds -->
- <target name="check-maven" description="Verify the Maven tool is installed and configured">
- <condition property="M2_HOME" value="${env.M2_HOME}">
- <!-- else="D:/apache-maven-3.0.4" -->
- <isset property="env.M2_HOME"/>
- </condition>
- <echo message="Maven install (M2_HOME) set to: '${M2_HOME}'"/>
- <available file="${M2_HOME}/bin/mvn" property="use.maven"/>
- <fail message="Maven 3 not found. Build won't run if Maven 3 not installed and M2_HOME properly set!." unless="use.maven"/>
- </target>
-
-<!-- ================================================================================= -->
-<!-- =========================== Clean Targets ===================================== -->
- <target name="clean-tools" depends="check-maven" description="Clean the maven built runtime projects">
- <java dir="${tools.mvn.parent}" fork="true" failonerror="true" classname="org.codehaus.plexus.classworlds.launcher.Launcher">
- <jvmarg value="-Dclassworlds.conf=${M2_HOME}/bin/m2.conf"/>
- <jvmarg value="-Dmaven.home=${M2_HOME}"/>
- <jvmarg value="-Dbuild.qualifier=${version.qualifier}"/>
- <arg value="clean"/>
- <classpath>
- <fileset dir="${M2_HOME}/boot">
- <include name="plexus-classworlds-*.jar"/>
- </fileset>
- </classpath>
- </java>
- <echo message="Deleting: '${tools.root}/target/**/*'"/>
- <delete failonerror="false">
- <fileset dir="${tools.root}/target">
- <include name="**/*"/>
- </fileset>
- </delete>
- <echo message="Deleting old archives: '${tools.build.location}/${tools.prefix}*.zip'"/>
- <delete failonerror="false">
- <fileset dir="${tools.build.location}">
- <include name="${tools.prefix}*.zip"/>
- </fileset>
- </delete>
- </target>
-
- <!-- Placeholder for non-OSGi test targets -->
- <target name="clean-tools-test" description="Clean the testing projects">
- <echo message="clean-tools-test"/>
- <!-- ant antfile="antbuild.xml" dir="" target="clean"/>
- <delete file="${eclipselink.tst.src.prefix}${eclipselink.zip.suffix}" failonerror="false"/ -->
- </target>
-
-<!-- ================================================================================= -->
-<!-- =========================== Build Targets ===================================== -->
- <!-- Compiles all runtime tools OSGi components. -->
- <target name="build-tools" depends="check-maven">
- <echo message="Launching Maven build with the following parameters:"/>
- <echo message=" -Dclassworlds.conf=${M2_HOME}/bin/m2.conf"/>
- <echo message=" -Dmaven.home=${M2_HOME}"/>
- <echo message=" -Dbuild.qualifier=${version.qualifier}"/>
- <echo message=" -DforceContextQualifier=${version.qualifier}"/>
- <echo message=" verify"/>
- <java dir="${tools.mvn.parent}" fork="true" failonerror="true" classname="org.codehaus.plexus.classworlds.launcher.Launcher">
- <jvmarg value="-Dclassworlds.conf=${M2_HOME}/bin/m2.conf"/>
- <jvmarg value="-Dmaven.home=${M2_HOME}"/>
- <jvmarg value="-Dbuild.qualifier=${version.qualifier}"/>
- <jvmarg value="-DforceContextQualifier=${version.qualifier}"/>
- <!-- arg value="-X"/ -->
- <arg value="verify"/>
- <classpath>
- <fileset dir="${M2_HOME}/boot">
- <include name="plexus-classworlds-*.jar"/>
- </fileset>
- </classpath>
- </java>
- </target>
-
- <!-- Placeholder for non-OSGi tools compiles -->
- <!-- Compiles tests (excluding workbench, dbws-util and Oracle extensions). -->
- <target name="build-tools-test">
- <echo message="build-tools-test"/>
- <!-- ant antfile="antbuild.xml" dir="${eclipselink.core.test}" target="build"/ -->
- </target>
-
-<!-- ================================================================================= -->
-<!-- =========================== Javadoc Targets =================================== -->
- <target name="build-javadocs">
- <!-- the following property needs to be here because the "qualifier" is generated at runtime -->
- <mkdir dir="${javadoc.dir}"/>
- <delete dir="${javadoc.dir}" failonerror="false"/>
- <javadoc
- maxmemory="384m"
- Verbose="false"
- packagenames="org.eclipse.persistence.**"
- destdir="${javadoc.dir}"
- useexternalfile="yes"
- additionalparam="-breakiterator -quiet"
- windowtitle="${javadoc.title}"
- >
- <classpath>
- <path refid="javadoc.path"/>
- </classpath>
- <tag name ="author" enabled="true" description="Author:" />
- <tag name ="since" scope="all" description="Since:" />
- <tag name ="SBGen" scope="all" description="SBGen:" />
- <tag name ="bug" enabled="true" description="Related Bugs:" />
- <doctitle><![CDATA[${javadoc.title}]]></doctitle>
- <header><![CDATA[${javadoc.title}]]></header>
-
- <!-- *** EclipseLink modules *** -->
- <fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.db/src" defaultexcludes="yes">
- <include name="org/eclipse/persistence/tools/**/*.java"/>
- <exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
- </fileset>
- <fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.gen.db/src" defaultexcludes="yes">
- <include name="org/eclipse/persistence/tools/**/*.java"/>
- <exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
- </fileset>
- <fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.mapping/src" defaultexcludes="yes">
- <include name="org/eclipse/persistence/tools/**/*.java"/>
- <exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
- </fileset>
- <fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.utility/src" defaultexcludes="yes">
- <include name="org/eclipse/persistence/tools/**/*.java"/>
- <exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
- </fileset>
- <fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.gen.nosql/src" defaultexcludes="yes">
- <include name="org/eclipse/persistence/tools/**/*.java"/>
- <exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
- </fileset>
- </javadoc>
- </target>
-
-<!-- ================================================================================= -->
-<!-- =========================== Package Targets =================================== -->
- <!-- Packages javadoc into a zip. -->
- <target name="package-javadoc-zip" depends="build-javadocs" description="build EclipseLink javadoc zip">
- <delete file="${tools.prefix}-javadoc-${version.string}.zip" failonerror="false"/>
- <zip destfile="${tools.prefix}-javadoc-${version.string}.zip">
- <!-- miscellaneous files -->
- <zipfileset dir="${javadocs.dir}/"/>
- </zip>
- </target>
-
- <!-- Packages the installer zip. -->
- <target name="package-installer-zip" description="build EclipseLink Tools Installer zip">
- <delete file="${tools.prefix}-${version.string}.zip" failonerror="false"/>
- <zip destfile="${tools.prefix}-${version.string}.zip">
- <!-- miscellaneous files -->
- <zipfileset dir="${tools.mvn.parent}/resource">
- <include name="*.html"/>
- </zipfileset>
- <zipfileset dir=".">
- <include name="eclipselink-tools-javadoc-${version.string}.zip"/>
- </zipfileset>
- <!-- Library bundles -->
- <zipfileset dir="${tools.root}/target">
- <include name="*.jar"/>
- <exclude name="*.test*"/>
- <exclude name="*.parent*"/>
- </zipfileset>
- <!-- Testing bundles -->
- <zipfileset dir="${tools.root}/target" prefix="testing">
- <include name="*.test*"/>
- </zipfileset>
- </zip>
- </target>
-
-<!-- ================================================================================= -->
-<!-- =========================== Test Targets ====================================== -->
- <!-- Run core LRG. -->
- <target name="test-tools" description="run the LRG tests">
- <echo message="test-tools (LRG run)"/>
- <ant antfile="test.xml" dir="${tools.root}/org.eclipse.persistence.tools.utility.tests" target="run"/>
- </target>
- <!-- Run core SRG. -->
- <target name="test-tools-srg" description="run the SRG tests">
- <echo message="test-tools-srg (SRG run)"/>
- <ant antfile="test.xml" dir="${tools.root}/org.eclipse.persistence.tools.utility.tests" target="test-srg"/>
- </target>
-
-<!-- ================================================================================= -->
-<!-- =========================== AutoBuild Targets ================================= -->
-
- <target name="build-nightly" depends="get-git-hash, build-distribution, publish-distribution" description="Setup for nightly, build, then export for promote"/>
-
-<!-- ================================================================================= -->
-<!-- =========================== AutoBuild Init Targets ============================ -->
- <target name="set-defaults">
- <!-- The following variables should be passed from Hudson:
- env.JAVA_HOME - JAVA_HOME as defined by Hudson
- git.exec - fully qualified path to git executable
- build.deps.dir - location on buildserver that stores dependencies (/shared/rt/eclipselink/bld_deps/master)
- junit.dir - directory where junit.jar can be found
- junit.lib - fully qualified path to junit jarfile (junit.dir/junit.jarname)
- build.tool.root - root of build server (from here releng and db data files can be found)
- hudson.workspace- WORKSPACE as defined by the Hudson slave
- M2_HOME - location of Maven3 install (on build server)
- -->
- <property name="branch" value="master"/>
- <condition property="git.exec.message" value="git.exec = '${git.exec}' (Set by Hudson Job)"
- else="git.exec = not set!">
- <isset property="git.exec"/>
- </condition>
-
- <!-- property file="${build.tool.root}/db-${branch}.properties"/ -->
-
- <!-- M2_HOME defaults the value maven 3.0.3 install location on the build -->
- <!-- server for AutoBuilds. This is brittle, but easier for now -->
- <property name="M2_HOME" value="/shared/common/apache-maven-3.0.3"/>
- <!-- Set location of executed scripts to hudson (is also set in promote-init for milestone publising) -->
- <property name="script.dir" value="${hudson.workspace}/buildsystem"/>
- <!-- Set location to export builds for publishing -->
- <property name="extract.root.dir" value="${build.tool.root}/exported_builds"/>
-
- <echo message=" "/>
- <echo message="${git.exec.message}"/>
- <echo message="build.deps.dir = '${build.deps.dir}'"/>
- <echo message="build.tool.root = '${build.tool.root}'"/>
- <echo message="hudson.workspace= '${hudson.workspace}'"/>
- <echo message="M2_HOME = '${M2_HOME}'"/>
- <echo message=" "/>
- <echo message="branch = '${branch}'"/>
- <echo message="extract.root.dir= '${extract.root.dir}'"/>
- </target>
-
- <target name="get-git-hash" unless="git.hash" depends="set-defaults">
- <fail message="${git.exec.message}" unless="git.exec"/>
- <!-- get git.hash NOTE: if "get" fails defaulted to "NA" -->
- <exec outputproperty="git.hash"
- failonerror="false"
- failifexecutionfails="false"
- errorproperty="githash.failed"
- logError="true"
- executable="${git.exec}">
- <arg value="log"/>
- <arg value="-1"/>
- <arg value="--format=%h"/>
- </exec>
- <property name="git.hash" value="NA"/>
- </target>
-
-<!-- ================================================================================= -->
-<!-- =========================== AutoBuild Publish Targets ========================= -->
-
- <target name="cannot-generate-handoff" unless="procedure" depends="init">
- <fail message="'procedure' not set. Cannot generate handoff file!"/>
- </target>
- <target name="generate-handoff" if="procedure" depends="cannot-generate-handoff" description="generate the publishing handoff file">
- <property name="handoff.file" value="${build.tool.root}/handoff-file-${procedure}-${branch}-${version.qualifier}.dat"/>
- <echo message="Generating Publishing handoff file with the following values:"/>
- <echo message=" procedure ='${procedure}'"/>
- <echo message=" extract.loc ='${extract.loc}'"/>
- <echo message=" host ='${host}'"/>
- <echo message=" milestone.tag='${milestone.tag}'"/>
- <echo message=" handoff.file ='${handoff.file}'"/>
-
- <echo message="extract.loc=${extract.loc} host=${host} maven.tag=${milestone.tag}" file="${handoff.file}" append="false"/>
- <!-- could use ${line.separator} to generate on separate lines, but don't as yet -->
- </target>
-
- <target name="publish-distribution" depends="build-distribution">
- <echo message="publish-distribution"/>
- <property name="tools.extract.dir" value="${extract.root.dir}/tools/${release.version}/${version.qualifier}"/>
- <mkdir dir="${tools.extract.dir}"/>
- <echo message="Exporting Tools artifacts..."/>
- <echo message=" from '${hudson.workspace}'"/>
- <echo message=" to '${tools.extract.dir}'"/>
- <copy todir="${tools.extract.dir}" failonerror="false">
- <fileset dir="${hudson.workspace}">
- <include name="${tools.prefix}*${version.qualifier}.zip"/>
- </fileset>
- </copy>
- <!-- Generate proper handoff file -->
- <antcall target="generate-handoff">
- <param name="procedure" value="tools"/>
- <param name="host" value="Eclipse"/>
- <param name="extract.loc" value="${tools.extract.dir}"/>
- </antcall>
- </target>
-
-</project>
+<!--/*******************************************************************************
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+* which accompanies this distribution.
+* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+* and the Eclipse Distribution License is available at
+* http://www.eclipse.org/org/documents/edl-v10.php.
+*
+* Ant naming conventions:
+* - regardless of the actual OS platform,'/' is the directory separator
+* (Ant will convert as appropriate).
+* - multi-word properties use periods '.'
+* - properties ending in .jar define jarfile names only (no path)
+* - properties ending in .lib are fully qualified jars (path and filename)
+* - properties ending in .dir are directory paths
+* - properties ending in .path are path refid names (classpath fragments)
+* - multi-word targets use hyphens '-'
+* - targets beginning with test- are reserved for high level test targets,
+* and are used in test results parsing
+* - targets typically use the form <action>-<object>-<type> (ie. package-bundle-zip)
+* - multi-word macros use underscores '_'
+* - multi-word macro attributes are concatinated
+* e.g. 'runpathref'
+* - multi-word tasks (taskdef) names are concatinated
+* e.g. 'validateconnection'
+* - OS environment variables are in ALLCAPS and have 'env' as a prefix
+* e.g. ${env.XXX}.
+* - Ant properties are lower case.
+*
+* Contributors:
+* egwin - initial implementation.
+#******************************************************************************/-->
+<!-- =============================================================================
+* General Comments
+* This buildfile contains:
+* - calls to the component builds to clean, compile, package and test thier bits
+* - calls to initiate component tests
+* - targets to generate the eclipselink tools installer
+* - targets to generate the javadocs
+* Used standalone it can generate Developer Builds of the entire product or subsets
+* of the product.
+*================================================================================= -->
+<!-- This ant project includes the following tasks:
+ - build (default) : compiles all components and tests
+ - clean : removes all build generated files
+ - build-distribution : compiles and packages all jars, javadocs, installer
+ - build-javadocs : generates Javadocs
+ - package-installer-zip : builds installer
+ - test-srg : runs all Short ReGression test suites
+ - test-lrg : runs all Long ReGression test suites
+
+ It may require some configuration of the build.properties to run.
+ -->
+<project name="eclipselink.tools.temp" default="build" basedir=".">
+
+ <target name="build" depends="init, build-tools, build-tools-test" description="Default ant target, compiles all components and tests"/>
+ <target name="clean" depends="init, clean-tools, clean-tools-test" description="Cleans all build generated files."/>
+ <target name="build-distribution" depends="clean, build, build-javadocs, package-installer-zip" description="Builds all jars, generates javadoc, and builds installer."/>
+ <target name="test-srg" depends="init, test-tools-srg" description="Run the SRG test suites"/>
+ <target name="test-lrg" depends="init, test-tools" description="Run the LRG test suites"/>
+
+<!-- ================================================================================= -->
+<!-- =========================== Init Targets ====================================== -->
+ <target name="init">
+ <dirname property="tools.build.location_temp" file="${ant.file.eclipselink.tools.temp}"/>
+ <pathconvert targetos="unix" property="tools.build.location">
+ <path>
+ <pathelement location="${tools.build.location_temp}"/>
+ </path>
+ </pathconvert>
+ <echo message="tools.build.location = '${tools.build.location}'"/>
+ <property environment="env"/>
+ <echo message="env.JAVA_HOME = '${env.JAVA_HOME}'"/>
+ <echo message="env.ANT_HOME = '${env.ANT_HOME}'"/>
+ <echo message="env.JUNIT_HOME = '${env.JUNIT_HOME}'"/>
+ <echo message="env.MAVENANT_DIR= '${env.MAVENANT_DIR}'"/>
+ <echo message="env.PATH = '${env.PATH}'"/>
+ <echo message="env.CLASSPATH = '${env.CLASSPATH}'"/>
+ <echo message="env.GIT_EXEC = '${env.GIT_EXEC}'"/>
+ <echo message="env.TARGET = '${env.TARGET}'"/>
+ <echo message=" "/>
+ <!-- Allows a user to overide certain user specific properties. -->
+ <echo message="user.home = '${user.home}'"/>
+
+ <!-- local property overrides -->
+ <condition property="custom.properties.message" value="Loading ${user.home}/build.properties..."
+ else="Custom properties file '${user.home}/build.properties' not found. Skipping...">
+ <available file="${user.home}/build.properties"/>
+ </condition>
+ <echo message="${custom.properties.message}"/>
+ <property file="${user.home}/build.properties"/>
+
+ <!-- default dependency jar location -->
+ <condition property="extensions.depend.dir" value="${tools.build.location}/../extension.lib.external"
+ else="${tools.build.location}">
+ <available file="${tools.build.location}/../extension.lib.external" type="dir"/>
+ </condition>
+ <echo message="extensions.depend.dir= '${extensions.depend.dir}'"/>
+
+ <!-- helper definitions -->
+ <property name="tools.root" value="${tools.build.location}/tools"/>
+ <property name="tools.mvn.parent" value="${tools.root}/org.eclipse.persistence.tools.parent"/>
+ <property name="tools.prefix" value="eclipselink-tools"/>
+
+ <!-- Versioning -->
+ <!-- These variables are set in Hudson. A manual build gets defaults -->
+ <tstamp>
+ <format property="build.date" pattern="yyyyMMdd"/>
+ <format property="build.time" pattern="HHmm"/>
+ </tstamp>
+ <property name="build.type" value="SNAPSHOT"/>
+ <property name="git.hash" value="NA"/>
+ <condition property="version.qualifier" value="qualifier"
+ else="v${build.date}-${git.hash}">
+ <equals arg1="${git.hash}" arg2="NA"/>
+ </condition>
+ <property name="release.version" value="2.6.0"/>
+ <property name="version.string" value="${release.version}.${version.qualifier}"/>
+ <property name="release.designation" value="EclipseLink DeveloperBuild"/>
+ <!-- generate string for tag creation (used for maven publish and handoff-version as well) -->
+ <condition property="milestone.tag" value="${release.version}">
+ <equals arg1="${build.type}" arg2="RELEASE"/>
+ </condition>
+ <property name="milestone.tag" value="${release.version}-${build.type}"/>
+ <echo message="milestone.tag ='${milestone.tag}'"/>
+
+ <!-- Javadoc properties -->
+ <property name="javadoc.title" value="EclipseLink Tools ${release.version}, build '${version.qualifier}' API Reference"/>
+ <property name="javadoc.dir" value="${tools.build.location}/tools/target/javadoc"/>
+ <path id="javadoc.path">
+ <pathelement path="${some.jar}"/>
+ </path>
+
+ <echo message="ANT_ARGS='${env.ANT_ARGS}'"/>
+ <echo message="ANT_OPTS='${env.ANT_OPTS}'"/>
+ <echo message=" "/>
+ <echo message="java.version ='${java.version}'"/>
+ <echo message="java.class.path='${java.class.path}'"/>
+ <echo message="os.name ='${os.name}'"/>
+ <echo message="os.arch ='${os.arch}'"/>
+ <echo message="os.version ='${os.version}'"/>
+ <echo message=" "/>
+ <echo message="tools.root ='${tools.root}'"/>
+ <echo message="tools.mvn.parent='${tools.mvn.parent}'"/>
+ <echo message="tools.prefix ='${tools.prefix}'"/>
+ <echo message=" "/>
+ <echo message="builddate.buildtime='${build.date}.${build.time}'"/>
+ <echo message="git.hash ='${git.hash}'"/>
+ <echo message="build.type ='${build.type}'"/>
+ <echo message="version.qualifier ='${version.qualifier}'"/>
+ <echo message="release.version ='${release.version}'"/>
+ <echo message="version.string ='${version.string}'"/>
+ <echo message="release.designation='${release.designation}'"/>
+ <echo message=" "/>
+ <echo message="javadoc.title ='${javadoc.title}'"/>
+ <echo message="javadoc.dir ='${javadoc.dir}'"/>
+ </target>
+
+ <!-- Needed for Maven/Tycho builds -->
+ <target name="check-maven" description="Verify the Maven tool is installed and configured">
+ <condition property="M2_HOME" value="${env.M2_HOME}">
+ <!-- else="D:/apache-maven-3.0.4" -->
+ <isset property="env.M2_HOME"/>
+ </condition>
+ <echo message="Maven install (M2_HOME) set to: '${M2_HOME}'"/>
+ <available file="${M2_HOME}/bin/mvn" property="use.maven"/>
+ <fail message="Maven 3 not found. Build won't run if Maven 3 not installed and M2_HOME properly set!." unless="use.maven"/>
+ </target>
+
+<!-- ================================================================================= -->
+<!-- =========================== Clean Targets ===================================== -->
+ <target name="clean-tools" depends="check-maven" description="Clean the maven built runtime projects">
+ <java dir="${tools.mvn.parent}" fork="true" failonerror="true" classname="org.codehaus.plexus.classworlds.launcher.Launcher">
+ <jvmarg value="-Dclassworlds.conf=${M2_HOME}/bin/m2.conf"/>
+ <jvmarg value="-Dmaven.home=${M2_HOME}"/>
+ <jvmarg value="-Dbuild.qualifier=${version.qualifier}"/>
+ <arg value="clean"/>
+ <classpath>
+ <fileset dir="${M2_HOME}/boot">
+ <include name="plexus-classworlds-*.jar"/>
+ </fileset>
+ </classpath>
+ </java>
+ <echo message="Deleting: '${tools.root}/target/**/*'"/>
+ <delete failonerror="false">
+ <fileset dir="${tools.root}/target">
+ <include name="**/*"/>
+ </fileset>
+ </delete>
+ <echo message="Deleting old archives: '${tools.build.location}/${tools.prefix}*.zip'"/>
+ <delete failonerror="false">
+ <fileset dir="${tools.build.location}">
+ <include name="${tools.prefix}*.zip"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <!-- Placeholder for non-OSGi test targets -->
+ <target name="clean-tools-test" description="Clean the testing projects">
+ <echo message="clean-tools-test"/>
+ <!-- ant antfile="antbuild.xml" dir="" target="clean"/>
+ <delete file="${eclipselink.tst.src.prefix}${eclipselink.zip.suffix}" failonerror="false"/ -->
+ </target>
+
+<!-- ================================================================================= -->
+<!-- =========================== Build Targets ===================================== -->
+ <!-- Compiles all runtime tools OSGi components. -->
+ <target name="build-tools" depends="check-maven">
+ <echo message="Launching Maven build with the following parameters:"/>
+ <echo message=" -Dclassworlds.conf=${M2_HOME}/bin/m2.conf"/>
+ <echo message=" -Dmaven.home=${M2_HOME}"/>
+ <echo message=" -Dbuild.qualifier=${version.qualifier}"/>
+ <echo message=" -DforceContextQualifier=${version.qualifier}"/>
+ <echo message=" verify"/>
+ <java dir="${tools.mvn.parent}" fork="true" failonerror="true" classname="org.codehaus.plexus.classworlds.launcher.Launcher">
+ <jvmarg value="-Dclassworlds.conf=${M2_HOME}/bin/m2.conf"/>
+ <jvmarg value="-Dmaven.home=${M2_HOME}"/>
+ <jvmarg value="-Dbuild.qualifier=${version.qualifier}"/>
+ <jvmarg value="-DforceContextQualifier=${version.qualifier}"/>
+ <!-- arg value="-X"/ -->
+ <arg value="verify"/>
+ <classpath>
+ <fileset dir="${M2_HOME}/boot">
+ <include name="plexus-classworlds-*.jar"/>
+ </fileset>
+ </classpath>
+ </java>
+ </target>
+
+ <!-- Placeholder for non-OSGi tools compiles -->
+ <!-- Compiles tests (excluding workbench, dbws-util and Oracle extensions). -->
+ <target name="build-tools-test">
+ <echo message="build-tools-test"/>
+ <!-- ant antfile="antbuild.xml" dir="${eclipselink.core.test}" target="build"/ -->
+ </target>
+
+<!-- ================================================================================= -->
+<!-- =========================== Javadoc Targets =================================== -->
+ <target name="build-javadocs">
+ <!-- the following property needs to be here because the "qualifier" is generated at runtime -->
+ <mkdir dir="${javadoc.dir}"/>
+ <delete dir="${javadoc.dir}" failonerror="false"/>
+ <javadoc
+ maxmemory="384m"
+ Verbose="false"
+ packagenames="org.eclipse.persistence.**"
+ destdir="${javadoc.dir}"
+ useexternalfile="yes"
+ additionalparam="-breakiterator -quiet"
+ windowtitle="${javadoc.title}"
+ >
+ <classpath>
+ <path refid="javadoc.path"/>
+ </classpath>
+ <tag name ="author" enabled="true" description="Author:" />
+ <tag name ="since" scope="all" description="Since:" />
+ <tag name ="SBGen" scope="all" description="SBGen:" />
+ <tag name ="bug" enabled="true" description="Related Bugs:" />
+ <doctitle><![CDATA[${javadoc.title}]]></doctitle>
+ <header><![CDATA[${javadoc.title}]]></header>
+
+ <!-- *** EclipseLink modules *** -->
+ <fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.db/src" defaultexcludes="yes">
+ <include name="org/eclipse/persistence/tools/**/*.java"/>
+ <exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
+ </fileset>
+ <fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.gen.db/src" defaultexcludes="yes">
+ <include name="org/eclipse/persistence/tools/**/*.java"/>
+ <exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
+ </fileset>
+ <fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.mapping/src" defaultexcludes="yes">
+ <include name="org/eclipse/persistence/tools/**/*.java"/>
+ <exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
+ </fileset>
+ <fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.utility/src" defaultexcludes="yes">
+ <include name="org/eclipse/persistence/tools/**/*.java"/>
+ <exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
+ </fileset>
+ <fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.gen.nosql/src" defaultexcludes="yes">
+ <include name="org/eclipse/persistence/tools/**/*.java"/>
+ <exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
+ </fileset>
+ </javadoc>
+ </target>
+
+<!-- ================================================================================= -->
+<!-- =========================== Package Targets =================================== -->
+ <!-- Packages javadoc into a zip. -->
+ <target name="package-javadoc-zip" depends="build-javadocs" description="build EclipseLink javadoc zip">
+ <delete file="${tools.prefix}-javadoc-${version.string}.zip" failonerror="false"/>
+ <zip destfile="${tools.prefix}-javadoc-${version.string}.zip">
+ <!-- miscellaneous files -->
+ <zipfileset dir="${javadocs.dir}/"/>
+ </zip>
+ </target>
+
+ <!-- Packages the installer zip. -->
+ <target name="package-installer-zip" description="build EclipseLink Tools Installer zip">
+ <delete file="${tools.prefix}-${version.string}.zip" failonerror="false"/>
+ <zip destfile="${tools.prefix}-${version.string}.zip">
+ <!-- miscellaneous files -->
+ <zipfileset dir="${tools.mvn.parent}/resource">
+ <include name="*.html"/>
+ </zipfileset>
+ <zipfileset dir=".">
+ <include name="eclipselink-tools-javadoc-${version.string}.zip"/>
+ </zipfileset>
+ <!-- Library bundles -->
+ <zipfileset dir="${tools.root}/target">
+ <include name="*.jar"/>
+ <exclude name="*.test*"/>
+ <exclude name="*.parent*"/>
+ </zipfileset>
+ <!-- Testing bundles -->
+ <zipfileset dir="${tools.root}/target" prefix="testing">
+ <include name="*.test*"/>
+ </zipfileset>
+ </zip>
+ </target>
+
+<!-- ================================================================================= -->
+<!-- =========================== Test Targets ====================================== -->
+ <!-- Run core LRG. -->
+ <target name="test-tools" description="run the LRG tests">
+ <echo message="test-tools (LRG run)"/>
+ <ant antfile="test.xml" dir="${tools.root}/org.eclipse.persistence.tools.utility.tests" target="run"/>
+ </target>
+ <!-- Run core SRG. -->
+ <target name="test-tools-srg" description="run the SRG tests">
+ <echo message="test-tools-srg (SRG run)"/>
+ <ant antfile="test.xml" dir="${tools.root}/org.eclipse.persistence.tools.utility.tests" target="test-srg"/>
+ </target>
+
+<!-- ================================================================================= -->
+<!-- =========================== AutoBuild Targets ================================= -->
+
+ <target name="build-nightly" depends="get-git-hash, build-distribution, publish-distribution" description="Setup for nightly, build, then export for promote"/>
+
+<!-- ================================================================================= -->
+<!-- =========================== AutoBuild Init Targets ============================ -->
+ <target name="set-defaults">
+ <!-- The following variables should be passed from Hudson:
+ env.JAVA_HOME - JAVA_HOME as defined by Hudson
+ git.exec - fully qualified path to git executable
+ build.deps.dir - location on buildserver that stores dependencies (/shared/rt/eclipselink/bld_deps/master)
+ junit.dir - directory where junit.jar can be found
+ junit.lib - fully qualified path to junit jarfile (junit.dir/junit.jarname)
+ build.tool.root - root of build server (from here releng and db data files can be found)
+ hudson.workspace- WORKSPACE as defined by the Hudson slave
+ M2_HOME - location of Maven3 install (on build server)
+ -->
+ <property name="branch" value="master"/>
+ <condition property="git.exec.message" value="git.exec = '${git.exec}' (Set by Hudson Job)"
+ else="git.exec = not set!">
+ <isset property="git.exec"/>
+ </condition>
+
+ <!-- property file="${build.tool.root}/db-${branch}.properties"/ -->
+
+ <!-- M2_HOME defaults the value maven 3.0.3 install location on the build -->
+ <!-- server for AutoBuilds. This is brittle, but easier for now -->
+ <property name="M2_HOME" value="/shared/common/apache-maven-3.0.3"/>
+ <!-- Set location of executed scripts to hudson (is also set in promote-init for milestone publising) -->
+ <property name="script.dir" value="${hudson.workspace}/buildsystem"/>
+ <!-- Set location to export builds for publishing -->
+ <property name="extract.root.dir" value="${build.tool.root}/exported_builds"/>
+
+ <echo message=" "/>
+ <echo message="${git.exec.message}"/>
+ <echo message="build.deps.dir = '${build.deps.dir}'"/>
+ <echo message="build.tool.root = '${build.tool.root}'"/>
+ <echo message="hudson.workspace= '${hudson.workspace}'"/>
+ <echo message="M2_HOME = '${M2_HOME}'"/>
+ <echo message=" "/>
+ <echo message="branch = '${branch}'"/>
+ <echo message="extract.root.dir= '${extract.root.dir}'"/>
+ </target>
+
+ <target name="get-git-hash" unless="git.hash" depends="set-defaults">
+ <fail message="${git.exec.message}" unless="git.exec"/>
+ <!-- get git.hash NOTE: if "get" fails defaulted to "NA" -->
+ <exec outputproperty="git.hash"
+ failonerror="false"
+ failifexecutionfails="false"
+ errorproperty="githash.failed"
+ logError="true"
+ executable="${git.exec}">
+ <arg value="log"/>
+ <arg value="-1"/>
+ <arg value="--format=%h"/>
+ </exec>
+ <property name="git.hash" value="NA"/>
+ </target>
+
+<!-- ================================================================================= -->
+<!-- =========================== AutoBuild Publish Targets ========================= -->
+
+ <target name="cannot-generate-handoff" unless="procedure" depends="init">
+ <fail message="'procedure' not set. Cannot generate handoff file!"/>
+ </target>
+ <target name="generate-handoff" if="procedure" depends="cannot-generate-handoff" description="generate the publishing handoff file">
+ <property name="handoff.file" value="${build.tool.root}/handoff-file-${procedure}-${branch}-${version.qualifier}.dat"/>
+ <echo message="Generating Publishing handoff file with the following values:"/>
+ <echo message=" procedure ='${procedure}'"/>
+ <echo message=" extract.loc ='${extract.loc}'"/>
+ <echo message=" host ='${host}'"/>
+ <echo message=" milestone.tag='${milestone.tag}'"/>
+ <echo message=" handoff.file ='${handoff.file}'"/>
+
+ <echo message="extract.loc=${extract.loc} host=${host} maven.tag=${milestone.tag}" file="${handoff.file}" append="false"/>
+ <!-- could use ${line.separator} to generate on separate lines, but don't as yet -->
+ </target>
+
+ <target name="publish-distribution" depends="build-distribution">
+ <echo message="publish-distribution"/>
+ <property name="tools.extract.dir" value="${extract.root.dir}/tools/${release.version}/${version.qualifier}"/>
+ <mkdir dir="${tools.extract.dir}"/>
+ <echo message="Exporting Tools artifacts..."/>
+ <echo message=" from '${hudson.workspace}'"/>
+ <echo message=" to '${tools.extract.dir}'"/>
+ <copy todir="${tools.extract.dir}" failonerror="false">
+ <fileset dir="${hudson.workspace}">
+ <include name="${tools.prefix}*${version.qualifier}.zip"/>
+ </fileset>
+ </copy>
+ <!-- Generate proper handoff file -->
+ <antcall target="generate-handoff">
+ <param name="procedure" value="tools"/>
+ <param name="host" value="Eclipse"/>
+ <param name="extract.loc" value="${tools.extract.dir}"/>
+ </antcall>
+ </target>
+
+</project>
diff --git a/tools/org.eclipse.persistence.tools.db/META-INF/MANIFEST.MF b/tools/org.eclipse.persistence.tools.db/META-INF/MANIFEST.MF
index 7824848..e997679 100644
--- a/tools/org.eclipse.persistence.tools.db/META-INF/MANIFEST.MF
+++ b/tools/org.eclipse.persistence.tools.db/META-INF/MANIFEST.MF
@@ -8,12 +8,12 @@
org.eclipse.persistence.tools.db.model.spi.jdbc,
platforms
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.eclipse.persistence.tools.utility;bundle-version="2.5.0",
- org.eclipse.persistence.tools.gen.db;bundle-version="2.5.0",
+Require-Bundle: org.eclipse.persistence.tools.utility;bundle-version="2.6.0",
+ org.eclipse.persistence.tools.gen.db;bundle-version="2.6.0",
org.eclipse.persistence.core;bundle-version="2.4.0"
Bundle-SymbolicName: org.eclipse.persistence.tools.db
Bundle-Name: EclipseLink Tools Db
Bundle-Vendor: Eclipse.org - EclipseLink Project
-Bundle-Version: 2.5.0.qualifier
+Bundle-Version: 2.6.0.qualifier
Bundle-ManifestVersion: 2
Import-Package: org.w3c.dom;resolution:=optional
diff --git a/tools/org.eclipse.persistence.tools.db/pom.xml b/tools/org.eclipse.persistence.tools.db/pom.xml
index 81f9de9..0ce70a0 100644
--- a/tools/org.eclipse.persistence.tools.db/pom.xml
+++ b/tools/org.eclipse.persistence.tools.db/pom.xml
@@ -6,13 +6,13 @@
<name>EclipseLink Tools DB</name>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.tools.db</artifactId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<parent>
<artifactId>org.eclipse.persistence.tools.parent</artifactId>
<groupId>org.eclipse.persistence</groupId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<relativePath>../org.eclipse.persistence.tools.parent/pom.xml</relativePath>
</parent>
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkColumn.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkColumn.java
index e1c4bad..0b42793 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkColumn.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkColumn.java
@@ -29,7 +29,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class EclipseLinkColumn implements Column {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkColumnPair.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkColumnPair.java
index e8754a3..753b92c 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkColumnPair.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkColumnPair.java
@@ -25,7 +25,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public class EclipseLinkColumnPair implements ColumnPair {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkConnectionProfile.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkConnectionProfile.java
index 49a2694..dbaf224 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkConnectionProfile.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkConnectionProfile.java
@@ -28,7 +28,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public class EclipseLinkConnectionProfile implements ConnectionProfile {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkDatabase.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkDatabase.java
index 1352ea5..68df9c5 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkDatabase.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkDatabase.java
@@ -38,7 +38,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
* @author John Bracken
*/
@SuppressWarnings("nls")
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkForeignKey.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkForeignKey.java
index 72051a6..6e5690d 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkForeignKey.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkForeignKey.java
@@ -33,7 +33,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class EclipseLinkForeignKey implements ForeignKey {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkSchema.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkSchema.java
index 1137c47..4ec6f10 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkSchema.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkSchema.java
@@ -34,7 +34,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class EclipseLinkSchema implements Schema {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkTable.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkTable.java
index 85a005d..75192c6 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkTable.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/EclipseLinkTable.java
@@ -31,7 +31,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class EclipseLinkTable implements Table {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/AbstractWorkbenchDriverAdapter.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/AbstractWorkbenchDriverAdapter.java
index 94eb773..0b70fc4 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/AbstractWorkbenchDriverAdapter.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/AbstractWorkbenchDriverAdapter.java
@@ -42,7 +42,7 @@
* Consolidate the behavior common to the typical DTP drivers.
*
* @see Unknown
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
abstract class AbstractWorkbenchDriverAdapter implements WorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/CatalogStrategy.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/CatalogStrategy.java
index d18dd77..3fa5fd5 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/CatalogStrategy.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/CatalogStrategy.java
@@ -15,7 +15,7 @@
/**
* Adapt the variety of catalog (and schema) configurations generated by DTP-supplied drivers.
*
- * @version 2.5
+ * @version 2.6
*/
interface CatalogStrategy {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/DB2.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/DB2.java
index 83011d3..5296508 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/DB2.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/DB2.java
@@ -16,7 +16,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
class DB2 extends AbstractWorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Derby.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Derby.java
index 2851d79..e20a33a 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Derby.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Derby.java
@@ -17,7 +17,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
class Derby extends AbstractWorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/FauxCatalogStrategy.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/FauxCatalogStrategy.java
index 3987871..b9a6505 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/FauxCatalogStrategy.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/FauxCatalogStrategy.java
@@ -18,7 +18,7 @@
*
* @see java.sql.DatabaseMetaData#getCatalogs()
*
- * @version 2.5
+ * @version 2.6
*/
class FauxCatalogStrategy implements CatalogStrategy {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/FoldingStrategy.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/FoldingStrategy.java
index be49b9d..e19d68b 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/FoldingStrategy.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/FoldingStrategy.java
@@ -15,7 +15,7 @@
/**
* Adapt database-specific identifier-folding etc.
*
- * @version 2.5
+ * @version 2.6
*/
interface FoldingStrategy {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/HSQLDB.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/HSQLDB.java
index 2022f9f..f8add8e 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/HSQLDB.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/HSQLDB.java
@@ -17,7 +17,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
class HSQLDB extends AbstractWorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Informix.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Informix.java
index 7d5ece8..024461b 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Informix.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Informix.java
@@ -16,7 +16,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
class Informix extends AbstractWorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/LowerCaseFoldingStrategy.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/LowerCaseFoldingStrategy.java
index eb243c6..b1ea531 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/LowerCaseFoldingStrategy.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/LowerCaseFoldingStrategy.java
@@ -17,7 +17,7 @@
/**
* Fold <em>regular</em> identifiers to lower case.
*
- * @version 2.5
+ * @version 2.6
*/
class LowerCaseFoldingStrategy implements FoldingStrategy {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/MaxDB.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/MaxDB.java
index cb07e1c..e4b5756 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/MaxDB.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/MaxDB.java
@@ -16,7 +16,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
class MaxDB extends AbstractWorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/MySQL.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/MySQL.java
index b1ecbc2..a24c3f7 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/MySQL.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/MySQL.java
@@ -48,7 +48,7 @@
* See <a href=http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html>
* Identifier Case Sensitivity</a>.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
class MySQL extends AbstractWorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/NoCatalogStrategy.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/NoCatalogStrategy.java
index a68b2e2..45af283 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/NoCatalogStrategy.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/NoCatalogStrategy.java
@@ -15,7 +15,7 @@
/**
* Catalog strategy for DTP database drivers that do not have catalogs (e.g. MySQL; see bug 249013).
*
- * @version 2.5
+ * @version 2.6
*/
class NoCatalogStrategy implements CatalogStrategy {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/NonFoldingStrategy.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/NonFoldingStrategy.java
index 969ce08..d90d383 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/NonFoldingStrategy.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/NonFoldingStrategy.java
@@ -15,7 +15,7 @@
/**
* Do not fold <em>regular</em> identifiers.
*
- * @version 2.5
+ * @version 2.6
*/
class NonFoldingStrategy implements FoldingStrategy {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Oracle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Oracle.java
index 93167c7..5182640 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Oracle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Oracle.java
@@ -16,7 +16,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
class Oracle extends AbstractWorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/PostgreSQL.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/PostgreSQL.java
index fcdcc17..87c4a70 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/PostgreSQL.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/PostgreSQL.java
@@ -17,7 +17,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
class PostgreSQL extends AbstractWorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/SQLServer.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/SQLServer.java
index 6f74d74..9641bf6 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/SQLServer.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/SQLServer.java
@@ -19,7 +19,7 @@
/**
* Microsoft SQL Server
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
class SQLServer extends AbstractWorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/SimpleCatalogStrategy.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/SimpleCatalogStrategy.java
index a064d3f..0ea2d25 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/SimpleCatalogStrategy.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/SimpleCatalogStrategy.java
@@ -18,7 +18,7 @@
*
* @see java.sql.DatabaseMetaData#getCatalogs()
*
- * @version 2.5
+ * @version 2.6
*/
class SimpleCatalogStrategy implements CatalogStrategy {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Sybase.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Sybase.java
index f9fb423..ce56ba1 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Sybase.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Sybase.java
@@ -18,7 +18,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
class Sybase extends AbstractWorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Unknown.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Unknown.java
index 5c7625f..6bb7135 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Unknown.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/Unknown.java
@@ -16,7 +16,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
class Unknown extends AbstractWorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/UpperCaseFoldingStrategy.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/UpperCaseFoldingStrategy.java
index bedd9c8..88d42a3 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/UpperCaseFoldingStrategy.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/UpperCaseFoldingStrategy.java
@@ -17,7 +17,7 @@
/**
* Fold <em>regular</em> identifiers to upper case.
*
- * @version 2.5
+ * @version 2.6
*/
class UpperCaseFoldingStrategy implements FoldingStrategy {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapter.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapter.java
index 8ca329e..ad958f4 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapter.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapter.java
@@ -39,7 +39,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public interface WorkbenchDriverAdapter {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapterFactory.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapterFactory.java
index 27e5f5e..ee9de3b 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapterFactory.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapterFactory.java
@@ -17,7 +17,7 @@
/**
* Factory interface.
*
- * @version 2.5
+ * @version 2.6
*/
interface WorkbenchDriverAdapterFactory {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapterManager.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapterManager.java
index 0ddf349..0da89b0 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapterManager.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/driver/WorkbenchDriverAdapterManager.java
@@ -17,7 +17,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class WorkbenchDriverAdapterManager {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/DatabaseTypeHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/DatabaseTypeHandle.java
index 3fddfb7..2871db9 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/DatabaseTypeHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/DatabaseTypeHandle.java
@@ -20,7 +20,7 @@
* This handle is a bit different from the other handles. It references an object that is completely
* outside of the project and is only used by database fields.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
final class DatabaseTypeHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELColumn.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELColumn.java
index 87b8531..efd70de 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELColumn.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELColumn.java
@@ -21,7 +21,7 @@
import org.eclipse.persistence.tools.utility.node.Node;
/**
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELColumn extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELColumnPair.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELColumnPair.java
index 4daac22..8bcd865 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELColumnPair.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELColumnPair.java
@@ -22,7 +22,7 @@
/**
* Simple class that pairs a source column and a target column for a reference.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELColumnPair extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELDatabase.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELDatabase.java
index 872f659..dd7d507 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELDatabase.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELDatabase.java
@@ -42,7 +42,7 @@
import org.eclipse.persistence.tools.utility.node.Node;
/**
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELDatabase extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELLoginSpec.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELLoginSpec.java
index 8559116..9afb496 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELLoginSpec.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELLoginSpec.java
@@ -39,7 +39,7 @@
import org.eclipse.persistence.tools.utility.node.Node;
/**
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELLoginSpec extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELLoginSpecHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELLoginSpecHandle.java
index c0ac71a..56367b6 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELLoginSpecHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELLoginSpecHandle.java
@@ -30,7 +30,7 @@
* ever used in another place in the model, the model synchronization will need to cascade to all
* model objects
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELLoginSpecHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELModel.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELModel.java
index 43bc941..f72e6dd 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELModel.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELModel.java
@@ -21,7 +21,7 @@
import org.eclipse.persistence.tools.utility.node.Node;
/**
- * @version 2.5
+ * @version 2.6
*/
public abstract class ELModel extends AbstractNode
implements ELNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELNode.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELNode.java
index efb1578..7a8dee3 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELNode.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELNode.java
@@ -22,7 +22,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public interface ELNode extends Node {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELReference.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELReference.java
index da037c2..dcef200 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELReference.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELReference.java
@@ -31,7 +31,7 @@
* to a "target" table. The foreign-key constraint can either be real ("on database") or virtual
* (only implied by the joins performed by TopLink).
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELReference extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELTable.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELTable.java
index a6f765a..0b05102 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELTable.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/ELTable.java
@@ -33,7 +33,7 @@
import org.eclipse.persistence.tools.utility.node.Node;
/**
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELTable extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/NodeModel.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/NodeModel.java
index a1d99e7..fc69396 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/NodeModel.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/NodeModel.java
@@ -22,7 +22,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public interface NodeModel extends Node {
// no additional behavior
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWColumnHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWColumnHandle.java
index 2853c4f..766b35e 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWColumnHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWColumnHandle.java
@@ -28,7 +28,7 @@
* This causes no end of pain when dealing with TopLink, property
* change listeners, backward-compatibility, etc.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class MWColumnHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWColumnPairHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWColumnPairHandle.java
index 1d61eac..a68149d 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWColumnPairHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWColumnPairHandle.java
@@ -29,7 +29,7 @@
* This causes no end of pain when dealing with TopLink, property
* change listeners, backward-compatibility, etc.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class MWColumnPairHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWHandle.java
index ba5baa7..d479901 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWHandle.java
@@ -32,7 +32,7 @@
*
* All handles should subclass this abstract class.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public abstract class MWHandle implements ELNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWReferenceHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWReferenceHandle.java
index efef9d1..53b32c1 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWReferenceHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWReferenceHandle.java
@@ -28,7 +28,7 @@
* This causes no end of pain when dealing with TopLink, property
* change listeners, backward-compatibility, etc.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class MWReferenceHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWTableHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWTableHandle.java
index 041e413..8483fa8 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWTableHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/handles/MWTableHandle.java
@@ -19,7 +19,7 @@
/**
* MWTableHandle is used to handle a reference to a MWTable via a table name.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class MWTableHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/AbstractJDBCTypeToJavaTypeDeclarationMapping.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/AbstractJDBCTypeToJavaTypeDeclarationMapping.java
index 620369a..0efef42 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/AbstractJDBCTypeToJavaTypeDeclarationMapping.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/AbstractJDBCTypeToJavaTypeDeclarationMapping.java
@@ -20,7 +20,7 @@
* Common behavior(?).
* Neither instance variable should ever be null.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
abstract class AbstractJDBCTypeToJavaTypeDeclarationMapping extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/CorruptXMLException.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/CorruptXMLException.java
index d2fd3fa..9069a0b 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/CorruptXMLException.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/CorruptXMLException.java
@@ -15,7 +15,7 @@
/**
* A CorruptFileException is thrown whenever a "corrupt" XML file is read in.
*
- * @version 2.5
+ * @version 2.6
*/
public class CorruptXMLException extends Exception {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabasePlatform.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabasePlatform.java
index 2803a73..45cde42 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabasePlatform.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabasePlatform.java
@@ -33,7 +33,7 @@
* Server). This includes whether the platform supports certain features used by TopLink (e.g.
* native sequencing) and the various database types and their corresponding JDBC types.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class DatabasePlatform extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabasePlatformRepository.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabasePlatformRepository.java
index ae3cb4e..39ce0cf 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabasePlatformRepository.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabasePlatformRepository.java
@@ -35,7 +35,7 @@
* This is a repository of all the database platforms in the platforms resource directory. We also
* hold on to the JDBC type repository.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class DatabasePlatformRepository
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabaseType.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabaseType.java
index ffe393a..79ee90a 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabaseType.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/DatabaseType.java
@@ -25,7 +25,7 @@
* - does not allow a sub-size specification
* - allows a null value
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class DatabaseType extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCType.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCType.java
index 17d8910..760d65e 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCType.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCType.java
@@ -21,7 +21,7 @@
*
* @see java.sql.Types
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JDBCType extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeRepository.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeRepository.java
index d9ab561..3a648ce 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeRepository.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeRepository.java
@@ -41,7 +41,7 @@
* see "Getting Started with JDBC API"
* http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/getstart/GettingStartedTOC.fm.html
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JDBCTypeRepository extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeToDatabaseTypeMapping.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeToDatabaseTypeMapping.java
index 67beff9..656f3bb 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeToDatabaseTypeMapping.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeToDatabaseTypeMapping.java
@@ -20,7 +20,7 @@
* Map a JDBC type to the appropriate platform-specific database type. Every platform must specify a
* database type for every possible JDBC type. The JDBC type cannot be changed.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JDBCTypeToDatabaseTypeMapping extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeToJavaTypeDeclarationMapping.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeToJavaTypeDeclarationMapping.java
index 9570767..c412f60 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeToJavaTypeDeclarationMapping.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JDBCTypeToJavaTypeDeclarationMapping.java
@@ -18,7 +18,7 @@
* Map a JDBC type to the appropriate Java type declaration. These are used to generate classes from
* tables. The JDBC type cannot be changed.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JDBCTypeToJavaTypeDeclarationMapping extends AbstractJDBCTypeToJavaTypeDeclarationMapping {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JavaTypeDeclaration.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JavaTypeDeclaration.java
index f95d990..8c3362b 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JavaTypeDeclaration.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JavaTypeDeclaration.java
@@ -25,7 +25,7 @@
* cannot be changed. If you want a different declaration, you will need
* to build another instance, which isn't all that painful.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JavaTypeDeclaration extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JavaTypeDeclarationToJDBCTypeMapping.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JavaTypeDeclarationToJDBCTypeMapping.java
index 2867edf..bb40954 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JavaTypeDeclarationToJDBCTypeMapping.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/platformsmodel/JavaTypeDeclarationToJDBCTypeMapping.java
@@ -19,7 +19,7 @@
* These are used to generate tables from classes.
* The Java type declaration cannot be changed.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JavaTypeDeclarationToJDBCTypeMapping extends AbstractJDBCTypeToJavaTypeDeclarationMapping {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalColumn.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalColumn.java
index 064cdc1..7ded908 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalColumn.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalColumn.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalTable
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalColumn {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalDatabase.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalDatabase.java
index 092e2e0..0a485ea 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalDatabase.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalDatabase.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalDatabaseFactory
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalDatabase {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalDatabaseFactory.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalDatabaseFactory.java
index 66b0fa4..c6b0391 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalDatabaseFactory.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalDatabaseFactory.java
@@ -22,7 +22,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalDatabaseFactory {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalForeignKey.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalForeignKey.java
index 7774118..aa88d88 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalForeignKey.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalForeignKey.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalTable
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalForeignKey {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalForeignKeyColumnPair.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalForeignKeyColumnPair.java
index 02f7d6e..a1f96f1 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalForeignKeyColumnPair.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalForeignKeyColumnPair.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalForeignKey
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalForeignKeyColumnPair {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalTable.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalTable.java
index fdf9261..f83d16f 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalTable.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalTable.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalTableDescription
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalTable {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalTableDescription.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalTableDescription.java
index 53d30ba..61d1037 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalTableDescription.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/ExternalTableDescription.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalDatabase
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalTableDescription extends TableDescription {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/TableDescription.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/TableDescription.java
index 84d30fd..dbf46c0 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/TableDescription.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/TableDescription.java
@@ -21,7 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public interface TableDescription {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalColumn.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalColumn.java
index 448cf91..ac24a8d 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalColumn.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalColumn.java
@@ -21,7 +21,7 @@
/**
* @see comment about defensive programming at JDBCExternalDatabase
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
final class JDBCExternalColumn implements ExternalColumn {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalDatabase.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalDatabase.java
index 221bbfc..4a28451 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalDatabase.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalDatabase.java
@@ -39,7 +39,7 @@
* determined defaults.
* ~bjv
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
final class JDBCExternalDatabase implements ExternalDatabase {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalDatabaseFactory.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalDatabaseFactory.java
index 0410c18..5e89c96 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalDatabaseFactory.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalDatabaseFactory.java
@@ -22,7 +22,7 @@
* the "JDBC" implementation of ExternalDatabase, which uses a
* java.sql.Connection ExternalTables etc.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JDBCExternalDatabaseFactory implements ExternalDatabaseFactory {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalForeignKey.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalForeignKey.java
index 5a137bc..4d1adb5 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalForeignKey.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalForeignKey.java
@@ -21,7 +21,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
final class JDBCExternalForeignKey implements ExternalForeignKey {
private final JDBCExternalTable table;
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalForeignKeyColumnPair.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalForeignKeyColumnPair.java
index fd0316a..c3b9d35 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalForeignKeyColumnPair.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalForeignKeyColumnPair.java
@@ -24,7 +24,7 @@
* Either column can be null if we have any problems gathering
* up the meta-data.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
final class JDBCExternalForeignKeyColumnPair implements ExternalForeignKeyColumnPair {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalTable.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalTable.java
index f8d3704..253fc55 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalTable.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalTable.java
@@ -27,7 +27,7 @@
/**
* see comment about defensive programming at JDBCExternalDatabase
*
- * @version 2.5
+ * @version 2.6
*/
final class JDBCExternalTable implements ExternalTable {
private final JDBCExternalTableDescription tableDescription;
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalTableDescription.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalTableDescription.java
index c74930f..e4ab4a0 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalTableDescription.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/model/spi/jdbc/JDBCExternalTableDescription.java
@@ -21,7 +21,7 @@
import org.eclipse.persistence.tools.utility.ObjectTools;
/**
- * @version 2.5
+ * @version 2.6
*/
final class JDBCExternalTableDescription implements ExternalTableDescription {
private final JDBCExternalDatabase database;
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/DatabaseTypeHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/DatabaseTypeHandle.java
index 2535cee..5d15694 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/DatabaseTypeHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/DatabaseTypeHandle.java
@@ -20,7 +20,7 @@
* This handle is a bit different from the other handles. It references an object that is completely
* outside of the project and is only used by database fields.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
final class DatabaseTypeHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELColumn.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELColumn.java
index e9a9d3f..46d9e1e 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELColumn.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELColumn.java
@@ -21,7 +21,7 @@
import org.eclipse.persistence.tools.utility.node.Node;
/**
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELColumn extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELColumnPair.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELColumnPair.java
index 4e71741..6a802b7 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELColumnPair.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELColumnPair.java
@@ -22,7 +22,7 @@
/**
* Simple class that pairs a source column and a target column for a reference.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELColumnPair extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELDatabase.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELDatabase.java
index c9706d5..66565fa 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELDatabase.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELDatabase.java
@@ -42,7 +42,7 @@
import org.eclipse.persistence.tools.utility.node.Node;
/**
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELDatabase extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELLoginSpec.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELLoginSpec.java
index 2c2d665..77896be 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELLoginSpec.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELLoginSpec.java
@@ -39,7 +39,7 @@
import org.eclipse.persistence.tools.utility.node.Node;
/**
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELLoginSpec extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELLoginSpecHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELLoginSpecHandle.java
index 649d4da..b15ec4b 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELLoginSpecHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELLoginSpecHandle.java
@@ -30,7 +30,7 @@
* ever used in another place in the model, the model synchronization will need to cascade to all
* model objects
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELLoginSpecHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELModel.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELModel.java
index 7b98251..037f228 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELModel.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELModel.java
@@ -21,7 +21,7 @@
import org.eclipse.persistence.tools.utility.node.Node;
/**
- * @version 2.5
+ * @version 2.6
*/
public abstract class ELModel extends AbstractNode
implements ELNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELNode.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELNode.java
index ce3da52..aa91288 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELNode.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELNode.java
@@ -22,7 +22,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public interface ELNode extends Node {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELReference.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELReference.java
index 11d1524..004f656 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELReference.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELReference.java
@@ -31,7 +31,7 @@
* to a "target" table. The foreign-key constraint can either be real ("on database") or virtual
* (only implied by the joins performed by TopLink).
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELReference extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELTable.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELTable.java
index 7d7cfa2..6d8294e 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELTable.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/ELTable.java
@@ -33,7 +33,7 @@
import org.eclipse.persistence.tools.utility.node.Node;
/**
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ELTable extends ELModel {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/NodeModel.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/NodeModel.java
index 9f12393..a3dbe3f 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/NodeModel.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/NodeModel.java
@@ -22,7 +22,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public interface NodeModel extends Node {
// no additional behavior
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWColumnHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWColumnHandle.java
index 49729c7..22d3878 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWColumnHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWColumnHandle.java
@@ -28,7 +28,7 @@
* This causes no end of pain when dealing with TopLink, property
* change listeners, backward-compatibility, etc.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class MWColumnHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWColumnPairHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWColumnPairHandle.java
index 11b05ca..68a8589 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWColumnPairHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWColumnPairHandle.java
@@ -29,7 +29,7 @@
* This causes no end of pain when dealing with TopLink, property
* change listeners, backward-compatibility, etc.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class MWColumnPairHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWHandle.java
index 7eb67ca..07e3668 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWHandle.java
@@ -32,7 +32,7 @@
*
* All handles should subclass this abstract class.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public abstract class MWHandle implements ELNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWReferenceHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWReferenceHandle.java
index 38c4e89..9457d0b 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWReferenceHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWReferenceHandle.java
@@ -28,7 +28,7 @@
* This causes no end of pain when dealing with TopLink, property
* change listeners, backward-compatibility, etc.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class MWReferenceHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWTableHandle.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWTableHandle.java
index 38fbe43..b37986c 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWTableHandle.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/handles/MWTableHandle.java
@@ -19,7 +19,7 @@
/**
* MWTableHandle is used to handle a reference to a MWTable via a table name.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class MWTableHandle extends MWHandle {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/AbstractJDBCTypeToJavaTypeDeclarationMapping.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/AbstractJDBCTypeToJavaTypeDeclarationMapping.java
index 002f515..b0ca437 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/AbstractJDBCTypeToJavaTypeDeclarationMapping.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/AbstractJDBCTypeToJavaTypeDeclarationMapping.java
@@ -20,7 +20,7 @@
* Common behavior(?).
* Neither instance variable should ever be null.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
abstract class AbstractJDBCTypeToJavaTypeDeclarationMapping extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/CorruptXMLException.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/CorruptXMLException.java
index 9553c75..bb47593 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/CorruptXMLException.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/CorruptXMLException.java
@@ -15,7 +15,7 @@
/**
* A CorruptFileException is thrown whenever a "corrupt" XML file is read in.
*
- * @version 2.5
+ * @version 2.6
*/
public class CorruptXMLException extends Exception {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabasePlatform.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabasePlatform.java
index 891d1db..d373b21 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabasePlatform.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabasePlatform.java
@@ -33,7 +33,7 @@
* Server). This includes whether the platform supports certain features used by TopLink (e.g.
* native sequencing) and the various database types and their corresponding JDBC types.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class DatabasePlatform extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabasePlatformRepository.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabasePlatformRepository.java
index 884fc18..77368b4 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabasePlatformRepository.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabasePlatformRepository.java
@@ -35,7 +35,7 @@
* This is a repository of all the database platforms in the platforms resource directory. We also
* hold on to the JDBC type repository.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class DatabasePlatformRepository
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabaseType.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabaseType.java
index 17b6ca0..812b294 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabaseType.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/DatabaseType.java
@@ -25,7 +25,7 @@
* - does not allow a sub-size specification
* - allows a null value
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class DatabaseType extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCType.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCType.java
index a65ba02..5d3abee 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCType.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCType.java
@@ -21,7 +21,7 @@
*
* @see java.sql.Types
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JDBCType extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeRepository.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeRepository.java
index d6f44f4..e5bd58f 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeRepository.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeRepository.java
@@ -41,7 +41,7 @@
* see "Getting Started with JDBC API"
* http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/getstart/GettingStartedTOC.fm.html
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JDBCTypeRepository extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeToDatabaseTypeMapping.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeToDatabaseTypeMapping.java
index 5ab108a..2db633d 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeToDatabaseTypeMapping.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeToDatabaseTypeMapping.java
@@ -20,7 +20,7 @@
* Map a JDBC type to the appropriate platform-specific database type. Every platform must specify a
* database type for every possible JDBC type. The JDBC type cannot be changed.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JDBCTypeToDatabaseTypeMapping extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeToJavaTypeDeclarationMapping.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeToJavaTypeDeclarationMapping.java
index f0dfd75..eaf7983 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeToJavaTypeDeclarationMapping.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JDBCTypeToJavaTypeDeclarationMapping.java
@@ -18,7 +18,7 @@
* Map a JDBC type to the appropriate Java type declaration. These are used to generate classes from
* tables. The JDBC type cannot be changed.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JDBCTypeToJavaTypeDeclarationMapping extends AbstractJDBCTypeToJavaTypeDeclarationMapping {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JavaTypeDeclaration.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JavaTypeDeclaration.java
index 1ee9ef6..f1b9c6d 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JavaTypeDeclaration.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JavaTypeDeclaration.java
@@ -25,7 +25,7 @@
* cannot be changed. If you want a different declaration, you will need
* to build another instance, which isn't all that painful.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JavaTypeDeclaration extends AbstractNode {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JavaTypeDeclarationToJDBCTypeMapping.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JavaTypeDeclarationToJDBCTypeMapping.java
index 74b6c98..1762a32 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JavaTypeDeclarationToJDBCTypeMapping.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/platformsmodel/JavaTypeDeclarationToJDBCTypeMapping.java
@@ -19,7 +19,7 @@
* These are used to generate tables from classes.
* The Java type declaration cannot be changed.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JavaTypeDeclarationToJDBCTypeMapping extends AbstractJDBCTypeToJavaTypeDeclarationMapping {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalColumn.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalColumn.java
index d57eccd..533da80 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalColumn.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalColumn.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalTable
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalColumn {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalDatabase.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalDatabase.java
index cb1808f..a4c6d00 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalDatabase.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalDatabase.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalDatabaseFactory
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalDatabase {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalDatabaseFactory.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalDatabaseFactory.java
index 7da8d0f..b60a721 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalDatabaseFactory.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalDatabaseFactory.java
@@ -22,7 +22,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalDatabaseFactory {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalForeignKey.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalForeignKey.java
index 543cdf2..c9005b1 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalForeignKey.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalForeignKey.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalTable
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalForeignKey {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalForeignKeyColumnPair.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalForeignKeyColumnPair.java
index e29bb9b..157ab5a 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalForeignKeyColumnPair.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalForeignKeyColumnPair.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalForeignKey
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalForeignKeyColumnPair {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalTable.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalTable.java
index d13f945..ba951f4 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalTable.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalTable.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalTableDescription
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalTable {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalTableDescription.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalTableDescription.java
index 4c4d61f..a318e8c 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalTableDescription.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/ExternalTableDescription.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @see ExternalDatabase
- * @version 2.5
+ * @version 2.6
*/
public interface ExternalTableDescription extends TableDescription {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/TableDescription.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/TableDescription.java
index 9ba81af..ec8e002 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/TableDescription.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/TableDescription.java
@@ -21,7 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public interface TableDescription {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalColumn.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalColumn.java
index c47e477..62ff19d 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalColumn.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalColumn.java
@@ -21,7 +21,7 @@
/**
* @see comment about defensive programming at JDBCExternalDatabase
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
final class JDBCExternalColumn implements ExternalColumn {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalDatabase.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalDatabase.java
index bfc9245..139310c 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalDatabase.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalDatabase.java
@@ -39,7 +39,7 @@
* determined defaults.
* ~bjv
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
final class JDBCExternalDatabase implements ExternalDatabase {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalDatabaseFactory.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalDatabaseFactory.java
index 024b7f8..42dc0f1 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalDatabaseFactory.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalDatabaseFactory.java
@@ -22,7 +22,7 @@
* the "JDBC" implementation of ExternalDatabase, which uses a
* java.sql.Connection ExternalTables etc.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class JDBCExternalDatabaseFactory implements ExternalDatabaseFactory {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalForeignKey.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalForeignKey.java
index 0114a2f..929a2fd 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalForeignKey.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalForeignKey.java
@@ -21,7 +21,7 @@
/**
*
- * @version 2.5
+ * @version 2.6
*/
final class JDBCExternalForeignKey implements ExternalForeignKey {
private final JDBCExternalTable table;
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalForeignKeyColumnPair.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalForeignKeyColumnPair.java
index e4a3332..0c4f055 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalForeignKeyColumnPair.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalForeignKeyColumnPair.java
@@ -24,7 +24,7 @@
* Either column can be null if we have any problems gathering
* up the meta-data.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
final class JDBCExternalForeignKeyColumnPair implements ExternalForeignKeyColumnPair {
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalTable.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalTable.java
index 2f9c667..88b88c3 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalTable.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalTable.java
@@ -27,7 +27,7 @@
/**
* see comment about defensive programming at JDBCExternalDatabase
*
- * @version 2.5
+ * @version 2.6
*/
final class JDBCExternalTable implements ExternalTable {
private final JDBCExternalTableDescription tableDescription;
diff --git a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalTableDescription.java b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalTableDescription.java
index 211df3d..6223e31 100644
--- a/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalTableDescription.java
+++ b/tools/org.eclipse.persistence.tools.db/src/org/eclipse/persistence/tools/db/relational/spi/jdbc/JDBCExternalTableDescription.java
@@ -21,7 +21,7 @@
import org.eclipse.persistence.tools.utility.ObjectTools;
/**
- * @version 2.5
+ * @version 2.6
*/
final class JDBCExternalTableDescription implements ExternalTableDescription {
private final JDBCExternalDatabase database;
diff --git a/tools/org.eclipse.persistence.tools.gen.db/META-INF/MANIFEST.MF b/tools/org.eclipse.persistence.tools.gen.db/META-INF/MANIFEST.MF
index 39549bc..ea9762b 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/META-INF/MANIFEST.MF
+++ b/tools/org.eclipse.persistence.tools.gen.db/META-INF/MANIFEST.MF
@@ -8,9 +8,9 @@
org.apache.commons.collections;bundle-version="3.2.0",
org.jdom;bundle-version="1.1.1",
org.apache.commons.lang;bundle-version="2.1.0",
- org.eclipse.persistence.tools.utility;bundle-version="2.5.0"
+ org.eclipse.persistence.tools.utility;bundle-version="2.6.0"
Bundle-SymbolicName: org.eclipse.persistence.tools.gen.db
Bundle-Name: EclipseLink Tools Gen
Bundle-Vendor: Eclipse.org - EclipseLink Project
-Bundle-Version: 2.5.0.qualifier
+Bundle-Version: 2.6.0.qualifier
Bundle-ManifestVersion: 2
diff --git a/tools/org.eclipse.persistence.tools.gen.db/pom.xml b/tools/org.eclipse.persistence.tools.gen.db/pom.xml
index 3e72258..36b6d8a 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/pom.xml
+++ b/tools/org.eclipse.persistence.tools.gen.db/pom.xml
@@ -6,13 +6,13 @@
<name>EclipseLink Tools Gen DB</name>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.tools.gen.db</artifactId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<parent>
<artifactId>org.eclipse.persistence.tools.parent</artifactId>
<groupId>org.eclipse.persistence</groupId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<relativePath>../org.eclipse.persistence.tools.parent/pom.xml</relativePath>
</parent>
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/DatabaseType.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/DatabaseType.java
index 6677a52..c836c8e 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/DatabaseType.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/DatabaseType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,7 @@
******************************************************************************/
package org.eclipse.persistence.tools.gen;
-import java.util.ArrayList;
-import java.util.List;
+import org.eclipse.persistence.tools.utility.iterable.IterableTools;
/**
* This enumeration defines the database type supported by dynamic entity generation.
@@ -26,7 +25,7 @@
*
* @see RelationalEntityGenerator
*
- * @version 2.5
+ * @version 2.6
* @author John Bracken
*/
@SuppressWarnings("nls")
@@ -66,10 +65,7 @@
* @return The list of unique constants
*/
public static Iterable<DatabaseType> types() {
- List<DatabaseType> types = new ArrayList<DatabaseType>();
- types.add(MySql);
- types.add(Oracle);
- return types;
+ return IterableTools.iterable(values());
}
/**
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/RelationalEntityGenerator.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/RelationalEntityGenerator.java
index d0ab117..95999ae 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/RelationalEntityGenerator.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/RelationalEntityGenerator.java
@@ -38,7 +38,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
* @author John Bracken
*/
public class RelationalEntityGenerator {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Catalog.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Catalog.java
index 09619fa..6288a06 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Catalog.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Catalog.java
@@ -21,7 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public interface Catalog extends SchemaContainer {
// nothing yet
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Column.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Column.java
index 56a0822..dbf7b85 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Column.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Column.java
@@ -23,7 +23,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public interface Column extends DatabaseObject {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionAdapter.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionAdapter.java
index c7ea5c6..8cf0e15 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionAdapter.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionAdapter.java
@@ -23,7 +23,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public class ConnectionAdapter implements ConnectionListener {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionListener.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionListener.java
index 7173a90..6ba5b57 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionListener.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionListener.java
@@ -21,7 +21,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.
*
* @see org.eclipse.datatools.connectivity.IManagedConnectionListener
- * @version 2.5
+ * @version 2.6
*/
public interface ConnectionListener extends EventListener {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfile.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfile.java
index 82aecc0..82c686c 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfile.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfile.java
@@ -24,7 +24,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public interface ConnectionProfile extends DatabaseObject {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileAdapter.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileAdapter.java
index 1162fde..7dec8fd 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileAdapter.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileAdapter.java
@@ -21,7 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public class ConnectionProfileAdapter implements ConnectionProfileListener {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileFactory.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileFactory.java
index e69f8e9..408149e 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileFactory.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileFactory.java
@@ -21,7 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public interface ConnectionProfileFactory {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileListener.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileListener.java
index 6434bb7..7f56141 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileListener.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ConnectionProfileListener.java
@@ -25,7 +25,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public interface ConnectionProfileListener extends EventListener {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Database.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Database.java
index 07d0b96..0c62084 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Database.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Database.java
@@ -21,7 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public interface Database extends SchemaContainer {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/DatabaseIdentifierAdapter.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/DatabaseIdentifierAdapter.java
index 022ef6f..25fedb5 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/DatabaseIdentifierAdapter.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/DatabaseIdentifierAdapter.java
@@ -25,7 +25,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public interface DatabaseIdentifierAdapter {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/DatabaseObject.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/DatabaseObject.java
index 8e5e74b..2b8473a 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/DatabaseObject.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/DatabaseObject.java
@@ -25,7 +25,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public interface DatabaseObject {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ForeignKey.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ForeignKey.java
index 9690b8f..0c94451 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ForeignKey.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/ForeignKey.java
@@ -24,7 +24,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public interface ForeignKey extends DatabaseObject {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Schema.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Schema.java
index 1655b79..a822d5b 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Schema.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Schema.java
@@ -21,7 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public interface Schema extends DatabaseObject {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/SchemaContainer.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/SchemaContainer.java
index 24eb1f1..47250c4 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/SchemaContainer.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/SchemaContainer.java
@@ -21,7 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public interface SchemaContainer extends DatabaseObject {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Sequence.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Sequence.java
index 2b10275..06f826d 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Sequence.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Sequence.java
@@ -21,7 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public interface Sequence extends DatabaseObject {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Table.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Table.java
index b3004fc..991a3d6 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Table.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/db/Table.java
@@ -21,7 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public interface Table extends DatabaseObject {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/Association.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/Association.java
index 653c88d..5a85e95 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/Association.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/Association.java
@@ -36,7 +36,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class Association implements Serializable {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/AssociationRole.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/AssociationRole.java
index 8a5670a..c3bfa51 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/AssociationRole.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/AssociationRole.java
@@ -25,7 +25,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class AssociationRole implements java.io.Serializable {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/BaseEntityGenCustomizer.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/BaseEntityGenCustomizer.java
index ffcc8fc..2006429 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/BaseEntityGenCustomizer.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/BaseEntityGenCustomizer.java
@@ -33,7 +33,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class BaseEntityGenCustomizer extends ORMGenCustomizer {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/DatabaseAnnotationNameBuilder.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/DatabaseAnnotationNameBuilder.java
index d44015b..b0c2f0d 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/DatabaseAnnotationNameBuilder.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/DatabaseAnnotationNameBuilder.java
@@ -27,7 +27,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public interface DatabaseAnnotationNameBuilder {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/EntityGeneratorDatabaseAnnotationNameBuilder.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/EntityGeneratorDatabaseAnnotationNameBuilder.java
index 51da079..84a95a9 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/EntityGeneratorDatabaseAnnotationNameBuilder.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/EntityGeneratorDatabaseAnnotationNameBuilder.java
@@ -26,7 +26,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public interface EntityGeneratorDatabaseAnnotationNameBuilder {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java
index 45b7b0b..e64517f 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java
@@ -25,7 +25,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
public final class GenericEntityGeneratorDatabaseAnnotationNameBuilder implements EntityGeneratorDatabaseAnnotationNameBuilder {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/MappingFileGenerator.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/MappingFileGenerator.java
index 7a5ac7e..83678b0 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/MappingFileGenerator.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/MappingFileGenerator.java
@@ -29,7 +29,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class MappingFileGenerator {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenColumn.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenColumn.java
index af35d9a..cc9da70 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenColumn.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenColumn.java
@@ -32,7 +32,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class ORMGenColumn {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenCustomizer.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenCustomizer.java
index 9a96d3f..8334152 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenCustomizer.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenCustomizer.java
@@ -50,7 +50,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public abstract class ORMGenCustomizer implements java.io.Serializable {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenTable.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenTable.java
index 587dcb6..eb51ce8 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenTable.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/ORMGenTable.java
@@ -40,7 +40,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class ORMGenTable {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/OverwriteConfirmer.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/OverwriteConfirmer.java
index eb641d0..fc90f78 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/OverwriteConfirmer.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/OverwriteConfirmer.java
@@ -23,7 +23,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public interface OverwriteConfirmer {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/DBUtil.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/DBUtil.java
index 04a910c..bff746d 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/DBUtil.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/DBUtil.java
@@ -26,7 +26,7 @@
/**
* Collection of utility methods to access DTP and other jpt.db APIs
*
- * @version 2.5
+ * @version 2.6
*/
public class DBUtil {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/EntityGenTools.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/EntityGenTools.java
index 0395adf..e2a6b85 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/EntityGenTools.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/EntityGenTools.java
@@ -20,7 +20,7 @@
/**
* Utility methods for entity generation.
*
- * @version 2.5
+ * @version 2.6
*/
public class EntityGenTools {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/FileUtil.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/FileUtil.java
index 38c3207..aca143a 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/FileUtil.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/FileUtil.java
@@ -21,7 +21,7 @@
/**
* Collections of utility methods handling files.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class FileUtil {
diff --git a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/UrlUtil.java b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/UrlUtil.java
index 4ccd98c..1d731b4 100644
--- a/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/UrlUtil.java
+++ b/tools/org.eclipse.persistence.tools.gen.db/src/org/eclipse/persistence/tools/gen/internal/util/UrlUtil.java
@@ -20,7 +20,7 @@
/**
* Collections of utility methods handling URLs.
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class UrlUtil {
diff --git a/tools/org.eclipse.persistence.tools.gen.nosql/META-INF/MANIFEST.MF b/tools/org.eclipse.persistence.tools.gen.nosql/META-INF/MANIFEST.MF
index c959b83..f95d302 100644
--- a/tools/org.eclipse.persistence.tools.gen.nosql/META-INF/MANIFEST.MF
+++ b/tools/org.eclipse.persistence.tools.gen.nosql/META-INF/MANIFEST.MF
@@ -1,18 +1,19 @@
Manifest-Version: 1.0
Export-Package:
- org.eclipse.persistence.tools.gen.nosql.mongo
+ org.eclipse.persistence.tools.gen.nosql.mongo,
+ org.eclipse.persistence.tools.gen.nosql.mongo.meta
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.apache.velocity;bundle-version="1.5.0",
org.apache.commons.collections;bundle-version="3.2.0",
org.jdom;bundle-version="1.1.1",
org.apache.commons.lang;bundle-version="2.1.0",
- org.eclipse.persistence.tools.utility;bundle-version="2.5.0",
- org.eclipse.persistence.tools.mapping;bundle-version="2.5.0",
+ org.eclipse.persistence.tools.utility;bundle-version="2.6.0",
+ org.eclipse.persistence.tools.mapping;bundle-version="2.6.0",
javax.persistence;bundle-version="2.0.4"
Bundle-SymbolicName: org.eclipse.persistence.tools.gen.nosql
Bundle-Name: EclipseLink Tools NoSql
Bundle-Vendor: Eclipse.org - EclipseLink Project
-Bundle-Version: 2.5.0.qualifier
+Bundle-Version: 2.6.0.qualifier
Bundle-ManifestVersion: 2
Import-Package: com.mongodb;resolution:=optional,
org.bson;resolution:=optional
diff --git a/tools/org.eclipse.persistence.tools.gen.nosql/pom.xml b/tools/org.eclipse.persistence.tools.gen.nosql/pom.xml
index 313f1a4..8caf6f2 100644
--- a/tools/org.eclipse.persistence.tools.gen.nosql/pom.xml
+++ b/tools/org.eclipse.persistence.tools.gen.nosql/pom.xml
@@ -6,13 +6,13 @@
<name>EclipseLink Tools Gen NoSQL</name>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.tools.gen.nosql</artifactId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<parent>
<artifactId>org.eclipse.persistence.tools.parent</artifactId>
<groupId>org.eclipse.persistence</groupId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<relativePath>../org.eclipse.persistence.tools.parent/pom.xml</relativePath>
</parent>
diff --git a/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/MongoEntityGenerator.java b/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/MongoEntityGenerator.java
index 72562d5..b13edd6 100644
--- a/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/MongoEntityGenerator.java
+++ b/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/MongoEntityGenerator.java
@@ -13,8 +13,18 @@
******************************************************************************/
package org.eclipse.persistence.tools.gen.nosql.mongo;
+import com.mongodb.BasicDBList;
+import com.mongodb.BasicDBObject;
+import com.mongodb.DB;
+import com.mongodb.DBCollection;
+import com.mongodb.DBCursor;
+import com.mongodb.DBObject;
+import com.mongodb.Mongo;
+import com.mongodb.MongoException;
+import com.mongodb.ServerAddress;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.StringWriter;
import java.net.UnknownHostException;
import java.util.Collection;
@@ -25,20 +35,17 @@
import java.util.Properties;
import java.util.Set;
import java.util.Vector;
-
-import javax.persistence.AccessType;
-import javax.persistence.Embeddable;
-
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.eclipse.persistence.tools.gen.nosql.mongo.meta.CollectionDescriptor;
import org.eclipse.persistence.tools.gen.nosql.mongo.meta.ColumnDescriptor;
import org.eclipse.persistence.tools.gen.nosql.mongo.meta.LeafColumnDescriptor;
import org.eclipse.persistence.tools.gen.nosql.mongo.meta.NestedColumnDescriptor;
+import org.eclipse.persistence.tools.mapping.orm.AccessType;
import org.eclipse.persistence.tools.mapping.orm.DataFormatType;
import org.eclipse.persistence.tools.mapping.orm.ExternalColumnMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalElementCollectionMapping;
-import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddableEntity;
+import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddable;
import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddedMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntity;
import org.eclipse.persistence.tools.mapping.orm.ExternalNamedQuery;
@@ -51,16 +58,6 @@
import org.eclipse.persistence.tools.utility.StringUtil;
import org.eclipse.persistence.tools.utility.collection.ListTools;
-import com.mongodb.BasicDBList;
-import com.mongodb.BasicDBObject;
-import com.mongodb.DB;
-import com.mongodb.DBCollection;
-import com.mongodb.DBCursor;
-import com.mongodb.DBObject;
-import com.mongodb.Mongo;
-import com.mongodb.MongoException;
-import com.mongodb.ServerAddress;
-
/**
* This class is an entry point for dynamic entity xml and source generation for
* MongoDB. It also provides API for discovering metadata (table names, etc) and generating
@@ -72,7 +69,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @author John Bracken
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("nls")
public class MongoEntityGenerator {
@@ -100,8 +97,11 @@
* @throws MongoException
* @throws UnknownHostException
*/
- public MongoEntityGenerator(String host, int port, String dbName, int rowSampleSize)
- throws MongoException, UnknownHostException {
+ public MongoEntityGenerator(String host,
+ int port,
+ String dbName,
+ int rowSampleSize) throws MongoException, UnknownHostException {
+
super();
this.rowSampleSize = rowSampleSize;
this.connection = new Mongo(new ServerAddress(host, port));
@@ -185,7 +185,7 @@
}
// Generate source for embeddables
- for (ExternalEmbeddableEntity entity : config.embeddableEntities()) {
+ for (ExternalEmbeddable entity : config.embeddables()) {
generateSource(entity, type, "embeddable.java.vm", packageName, packageDirectory, ve, characterEncoding);
}
}
@@ -203,7 +203,7 @@
*
* @throws Exception
*/
- private void generateSource(ExternalEmbeddableEntity entity, AccessType accessType,
+ private void generateSource(ExternalEmbeddable entity, AccessType accessType,
String templateName, String packageName,
File packageDirectory, VelocityEngine ve,
String characterEncoding) throws Exception {
@@ -236,7 +236,7 @@
* @param columnName the name of the column.
* @param javaColumnName the java identifier name to use for the column.
*/
- private void generateLeafMapping(ExternalEmbeddableEntity exEntity, LeafColumnDescriptor column,
+ private void generateLeafMapping(ExternalEmbeddable exEntity, LeafColumnDescriptor column,
String columnName, String javaColumnName) {
ExternalColumnMapping mapping;
// If this is a list-type column, then a collection based mapping is required.
@@ -267,7 +267,7 @@
* @param config the orm configuration.
* @param allEntityNames a {@link Set} of all of the entity names already in use.
*/
- private void generateMappings(ExternalEmbeddableEntity exEntity, CollectionDescriptor collection, String packageName,
+ private void generateMappings(ExternalEmbeddable exEntity, CollectionDescriptor collection, String packageName,
ExternalORMConfiguration config, Set<String> allEntityNames) {
for (ColumnDescriptor column : collection.columns()) {
String columnName = column.getColumnName();
@@ -293,13 +293,13 @@
* @param columnName the name of the column.
* @param javaColumnName the java identifier name for the column.
*/
- private void generateNestedMapping(ExternalEmbeddableEntity exEntity,ExternalORMConfiguration config, String packageName,
+ private void generateNestedMapping(ExternalEmbeddable exEntity,ExternalORMConfiguration config, String packageName,
Set<String> allEntityNames, NestedColumnDescriptor column, String columnName, String javaColumnName) {
// Create the embeddable for the nested value
String embeddableName = uniqueJavaClassName(columnName, packageName, allEntityNames);
- ExternalEmbeddableEntity embeddable = config.addEmbeddableEntity(embeddableName);
+ ExternalEmbeddable embeddable = config.addEmbeddable(embeddableName);
embeddable.addNoSql().setDataFormat(DataFormatType.MAPPED);
- embeddable.setAccessType("VIRTUAL");
+ embeddable.setAccessType(AccessType.VIRTUAL);
// generate mappings for the embeddable
generateMappings(embeddable, column.getColumnDescriptor(), packageName, config, allEntityNames);
@@ -340,34 +340,40 @@
*
* @param collectionDescriptors the MongoDB collections to generate entities from.
* @param packageName the package name to qualify all generated entities for.
- *
+ *
* @return a {@link String} representation of the eclipselink-orm.xml.
*/
private ExternalORMConfiguration generate(List<CollectionDescriptor> collectionDescriptors, String packageName) {
- // Create a new orm.xml metadata model.
- ExternalORMConfiguration config = new ORMRepository().buildORMConfiguration(ORMDocumentType.ECLIPELINK_2_5);
- // track all entity names being used.
- Set<String> allEntityNames = new HashSet<String>();
- // Iterate over all collection descriptors and create an entity and associated mapping for them.
- for (CollectionDescriptor collection : collectionDescriptors) {
- // add an entity with a unique name
- String collectionName = collection.getName();
- String entityName = uniqueJavaClassName(collectionName, packageName, allEntityNames);
- ExternalEntity exEntity = config.addEntity(entityName);
- // access type is virtual
- exEntity.setAccessType("VIRTUAL");
- // Configure NoSql settings
- ExternalNoSql noSqlDesc = exEntity.addNoSql();
- noSqlDesc.setDataFormat(DataFormatType.MAPPED);
- noSqlDesc.setDataType(collectionName);
- // add mappings
- generateMappings(exEntity, collection, packageName, config, allEntityNames);
+ try {
+ // Create a new orm.xml metadata model.
+ ExternalORMConfiguration config = new ORMRepository().buildORMConfiguration(null, ORMDocumentType.ECLIPELINK_2_6);
+ // track all entity names being used.
+ Set<String> allEntityNames = new HashSet<String>();
+ // Iterate over all collection descriptors and create an entity and associated mapping for them.
+ for (CollectionDescriptor collection : collectionDescriptors) {
+ // add an entity with a unique name
+ String collectionName = collection.getName();
+ String entityName = uniqueJavaClassName(collectionName, packageName, allEntityNames);
+ ExternalEntity exEntity = config.addEntity(entityName);
+ // access type is virtual
+ exEntity.setAccessType(AccessType.VIRTUAL);
+ // Configure NoSql settings
+ ExternalNoSql noSqlDesc = exEntity.addNoSql();
+ noSqlDesc.setDataFormat(DataFormatType.MAPPED);
+ noSqlDesc.setDataType(collectionName);
+ // add mappings
+ generateMappings(exEntity, collection, packageName, config, allEntityNames);
+ }
+
+ // Generate a default, read all query for all entities
+ generateQueries(config);
+
+ return config;
}
-
- // Generate a default, read all query for all entities
- generateQueries(config);
-
- return config;
+ catch (IOException e) {
+ // Never happens
+ return null;
+ }
}
/**
@@ -489,7 +495,7 @@
updateCollectionDescriptor(columnDescriptor.getColumnDescriptor(), (DBObject)value);
}
-
+
/**
* Returns the names of the Mongo collections on the specified
* database.
@@ -503,15 +509,15 @@
return collectionNames;
}
-
+
/**
- * Generates a unique, fully qualified and singularised entity name for the specified
+ * Generates a unique, fully qualified and singularised entity name for the specified
* Mongo collection name.
- *
+ *
* @param collectionName the name of the Mongo collection.
* @param packageName the package name to qualify the entity name with.
* @param allEntityNames all of the existing entity names in use.
- *
+ *
* @return the unique, qualifed and singularised entity name.
*/
private String uniqueJavaClassName(String collectionName, String packageName, Set<String> allEntityNames) {
@@ -521,7 +527,7 @@
}
entityName = NameTools.uniqueName(entityName, allEntityNames);
allEntityNames.add(entityName);
-
+
return entityName;
}
diff --git a/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/CollectionDescriptor.java b/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/CollectionDescriptor.java
index 0609267..2daf391 100644
--- a/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/CollectionDescriptor.java
+++ b/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/CollectionDescriptor.java
@@ -26,7 +26,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @author John Bracken
- * @version 2.5
+ * @version 2.6
*/
public final class CollectionDescriptor {
diff --git a/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/ColumnDescriptor.java b/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/ColumnDescriptor.java
index a74777a..602a142 100644
--- a/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/ColumnDescriptor.java
+++ b/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/ColumnDescriptor.java
@@ -23,7 +23,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @author John Bracken
- * @version 2.5
+ * @version 2.6
*/
public abstract class ColumnDescriptor {
diff --git a/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/LeafColumnDescriptor.java b/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/LeafColumnDescriptor.java
index 84c6c36..0d20bf6 100644
--- a/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/LeafColumnDescriptor.java
+++ b/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/LeafColumnDescriptor.java
@@ -23,7 +23,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @author John Bracken
- * @version 2.5
+ * @version 2.6
*/
public final class LeafColumnDescriptor extends ColumnDescriptor {
diff --git a/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/NestedColumnDescriptor.java b/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/NestedColumnDescriptor.java
index 1a4fd3b..8d6273e 100644
--- a/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/NestedColumnDescriptor.java
+++ b/tools/org.eclipse.persistence.tools.gen.nosql/src/org/eclipse/persistence/tools/gen/nosql/mongo/meta/NestedColumnDescriptor.java
@@ -24,7 +24,7 @@
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
* @author John Bracken
- * @version 2.5
+ * @version 2.6
*/
public final class NestedColumnDescriptor extends ColumnDescriptor{
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/.classpath b/tools/org.eclipse.persistence.tools.mapping.tests/.classpath
new file mode 100644
index 0000000..6afa455
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.persistence.tools.mapping"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/.gitignore b/tools/org.eclipse.persistence.tools.mapping.tests/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/.project b/tools/org.eclipse.persistence.tools.mapping.tests/.project
new file mode 100644
index 0000000..2ecfac0
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.persistence.tools.mapping.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/META-INF/MANIFEST.MF b/tools/org.eclipse.persistence.tools.mapping.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..bc44163
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: EclipseLink Tools Mapping Tests
+Bundle-SymbolicName: org.eclipse.persistence.tools.mapping.tests
+Bundle-Version: 2.6.0.qualifier
+Bundle-Vendor: Eclipse.org - EclipseLink Project
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.persistence.tools.mapping
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/build.properties b/tools/org.eclipse.persistence.tools.mapping.tests/build.properties
new file mode 100644
index 0000000..b107977
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/build.properties
@@ -0,0 +1,3 @@
+source.. = src/
+bin.includes = META-INF/,\
+ .
diff --git a/tools/org.eclipse.persistence.tools.mapping/META-INF/MANIFEST.MF b/tools/org.eclipse.persistence.tools.mapping/META-INF/MANIFEST.MF
index 6912e28..a250cb5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/META-INF/MANIFEST.MF
+++ b/tools/org.eclipse.persistence.tools.mapping/META-INF/MANIFEST.MF
@@ -1,20 +1,14 @@
Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Mapping
+Bundle-SymbolicName: org.eclipse.persistence.tools.mapping
+Bundle-Version: 2.6.0.qualifier
+Require-Bundle: org.eclipse.persistence.core;bundle-version="2.4.0",
+ javax.persistence;bundle-version="2.0.0",
+ org.eclipse.persistence.tools.utility;bundle-version="2.6.0"
Export-Package: org.eclipse.persistence.tools.mapping.orm,
org.eclipse.persistence.tools.mapping.orm.dom,
org.eclipse.persistence.tools.mapping.persistence,
org.eclipse.persistence.tools.mapping.persistence.dom
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.eclipse.persistence.core;bundle-version="2.4.0",
- javax.persistence;bundle-version="2.0.0",
- org.eclipse.persistence.tools.utility;bundle-version="2.5.0"
-Bundle-SymbolicName: org.eclipse.persistence.tools.mapping
-Bundle-Name: EclipseLink Tools Mapping
Bundle-Vendor: Eclipse.org - EclipseLink Project
-Bundle-Version: 2.5.0.qualifier
-Bundle-ManifestVersion: 2
-Import-Package: javax.xml.parsers;resolution:=optional,
- javax.xml.transform;resolution:=optional,
- javax.xml.transform.dom;resolution:=optional,
- javax.xml.transform.stream;resolution:=optional,
- org.w3c.dom;resolution:=optional,
- org.xml.sax;resolution:=optional
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/tools/org.eclipse.persistence.tools.mapping/pom.xml b/tools/org.eclipse.persistence.tools.mapping/pom.xml
index f4fcd22..aa44211 100644
--- a/tools/org.eclipse.persistence.tools.mapping/pom.xml
+++ b/tools/org.eclipse.persistence.tools.mapping/pom.xml
@@ -6,13 +6,13 @@
<name>EclipseLink Tools Mapping</name>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.tools.mapping</artifactId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<parent>
<artifactId>org.eclipse.persistence.tools.parent</artifactId>
<groupId>org.eclipse.persistence</groupId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<relativePath>../org.eclipse.persistence.tools.parent/pom.xml</relativePath>
</parent>
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/AbstractExternalForm.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/AbstractExternalForm.java
new file mode 100644
index 0000000..edf3f3f
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/AbstractExternalForm.java
@@ -0,0 +1,3478 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.persistence.tools.utility.ObjectTools;
+import org.eclipse.persistence.tools.utility.StringTools;
+import org.eclipse.persistence.tools.utility.TextRange;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ * This abstract implementation of an {@link ExternalForm} defines common behavior for accessing and
+ * manipulating an XML document.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.<p>
+ *
+ * @see ExternalForm
+ *
+ * @version 2.6
+ */
+@SuppressWarnings("nls")
+public abstract class AbstractExternalForm implements ExternalForm {
+
+ /**
+ * A list of attribute names that will be used to insert a property at the right position.
+ */
+ private List<String> attributeNamesOrder;
+
+ /**
+ * A list of element names that will be used to insert a new child element at the right position.
+ */
+ private List<String> elementNamesOrder;
+
+ /**
+ * The parent of this external form or <code>null</code> if this is the root object.
+ */
+ private AbstractExternalForm parent;
+
+ /**
+ * The XML attribute identifier for the XML namespace.
+ */
+ public static final String XMLNS_ATTRIBUTE = "xmlns";
+
+ /**
+ * The namespace for all XML attributes.
+ */
+ public static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/";
+
+ /**
+ *
+ */
+ public static final String XMLNS_XSI = "xmlns:xsi";
+
+ /**
+ * The namespace of the XML representation of schema components.
+ */
+ public static final String XSD_URI = "http://www.w3.org/2001/XMLSchema";
+
+ /**
+ * The attribute name of the child text node for version.
+ */
+ public static final String XSD_VERSION = "version";
+
+ /**
+ *
+ */
+ public static final String XSI_SCHEMA_LOCATION = "xsi:schemaLocation";
+
+ /**
+ * The namespace of the XML Schema: Structures, which defines several attributes for direct use
+ * in any XML documents.
+ */
+ public static final String XSI_URI = "http://www.w3.org/2001/XMLSchema-instance";
+
+ /**
+ * Creates a new <code>AbstractExternalForm</code>.
+ *
+ * @param parent The parent of this external form or <code>null</code> if this is the root object
+ */
+ protected AbstractExternalForm(AbstractExternalForm parent) {
+ super();
+ this.parent = parent;
+ this.initialize();
+ }
+
+ /**
+ * Acquires a lock before reading the document.
+ */
+ public final void acquireReadLock() {
+ getHelper().acquireReadLock();
+ }
+
+ /**
+ * Adds a new child element to the element represented by the given parent external form. The
+ * child element will be added at the end of the list of children.
+ *
+ * @param parent The external form representing the parent element where the child element will be added
+ * @param elementName The name of the new child element
+ * @return The newly created child element
+ */
+ public final Element addChild(AbstractExternalForm parent, String elementName) {
+
+ Element element = parent.getElement();
+
+ if (element == null) {
+ element = parent.addSelf();
+ }
+
+ return addChild(element, elementName);
+ }
+
+ /**
+ * Adds a new child element to the given element. The child element will be added at the end of
+ * the list of children.
+ *
+ * @param parent The external form representing the parent element where the child element will be added
+ * @param elementName The name of the new child element
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ * @return The newly created child element
+ */
+ public final Element addChild(AbstractExternalForm parent,
+ String elementName,
+ List<String> elementNamesOrder) {
+
+ Element element = parent.getElement();
+
+ if (element == null) {
+ element = parent.addSelf();
+ }
+
+ return addChild(element, elementName, elementNamesOrder);
+ }
+
+ /**
+ * Adds a new child element to the given element. The child element will be added at the end of
+ * the list of children.
+ *
+ * @param element The element to which a new child element will be added
+ * @param elementName The name of the new child element
+ * @return The newly created child element
+ */
+ protected Element addChild(Element element, String elementName) {
+ return addChild(element, elementName, getElementNamesOrder());
+ }
+
+ /**
+ * Adds a new child element to the given element. The child element will be added at the end of
+ * the list of children.
+ *
+ * @param element The element to which a new child element will be added
+ * @param elementName The name of the new child element
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ * @return The newly created child element
+ */
+ public final Element addChild(Element element,
+ String elementName,
+ List<String> elementNamesOrder) {
+
+ // Add the child element
+ Element childElement = getHelper().addChild(this, element, elementName, elementNamesOrder);
+
+ // Notify the subclass the element has been added
+ calculateInsertionIndex(element, childElement, elementName);
+
+ return childElement;
+ }
+
+ /**
+ * Adds a new child element to the element represented by this external form. The child element
+ * will be added at the end of the list of element's children.
+ *
+ * @param elementName The name of the new child element
+ * @return The newly created child element
+ */
+ public final Element addChild(String elementName) {
+
+ Element element = getElement();
+
+ if (element == null) {
+ element = addSelf();
+ }
+
+ return addChild(element, elementName);
+ }
+
+ /**
+ * Adds a new child element to the element represented by this external form. The child element
+ * will be added at the end of the list of element's children.
+ *
+ * @param elementName The name of the new child element
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ * @return The newly created child element
+ */
+ public final Element addChild(String elementName, List<String> elementNamesOrder) {
+
+ Element element = getElement();
+
+ if (element == null) {
+ element = addSelf();
+ }
+
+ return addChild(element, elementName, elementNamesOrder);
+ }
+
+ /**
+ * Adds a child text node to the given parent element.
+ *
+ * @param element The element to which a new child element will be added
+ * @param elementName The name of the new child element
+ * @param value The node's text
+ * @return The newly created element
+ */
+ public final Element addChildTextNode(Element element, String elementName, String value) {
+ return addChildTextNode(element, elementName, value, getElementNamesOrder());
+ }
+
+ /**
+ * Adds a child text node to the given parent element.
+ *
+ * @param element The element to which a new child element will be added
+ * @param elementName The name of the new child element
+ * @param value The node's text
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ * @return The newly created element
+ */
+ public final Element addChildTextNode(Element element,
+ String elementName,
+ String value,
+ List<String> elementNamesOrder) {
+
+ return getHelper().addChildTextNode(this, element, elementName, value, elementNamesOrder);
+ }
+
+ /**
+ * Adds a child text node to the given parent element.
+ *
+ * @param elementName The name of the new child element
+ * @param value The node's text
+ * @return The newly created element
+ */
+ public final Element addChildTextNode(String elementName, String value) {
+ return addChildTextNode(elementName, value, getElementNamesOrder());
+ }
+
+ /**
+ * Adds a child text node to the given parent element.
+ *
+ * @param elementName The name of the new child element
+ * @param value The node's text
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ * @return The newly created element
+ */
+ public final Element addChildTextNode(String elementName,
+ String value,
+ List<String> elementNamesOrder) {
+
+ Element element = getElement();
+
+ if ((element == null) && (value == null)) {
+ return null;
+ }
+
+ if (element == null) {
+ element = addSelf();
+ }
+
+ return addChildTextNode(element, elementName, value, elementNamesOrder);
+ }
+
+ /**
+ * Adds a new child element to the parent element that represents this model.
+ *
+ * @return The newly created child element
+ */
+ public Element addSelf() {
+ return addSelf(getElementName());
+ }
+
+ /**
+ * Adds a new child element to the parent element that represents this model.
+ *
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ * @return The newly created child element
+ */
+ protected Element addSelf(List<String> elementNamesOrder) {
+ return addSelf(getElementName(), elementNamesOrder);
+ }
+
+ /**
+ * Adds a new child element to the parent element that represents this model.
+ *
+ * @param elementName The new name of the node
+ * @return The newly created child element
+ */
+ protected Element addSelf(String elementName) {
+ return addSelf(elementName, getParent().getElementNamesOrder());
+ }
+
+ /**
+ * Adds a new child element to the parent element that represents this model.
+ *
+ * @param elementName The new name of the node
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ * @return The newly created child element
+ */
+ public Element addSelf(String elementName, List<String> elementNamesOrder) {
+ return addChild(getParent(), elementName, elementNamesOrder);
+ }
+
+ /**
+ * Adds an xmlns: attribute to the given element to register the given prefix. Does no checking
+ * for uniqueness. Also doesn't handle setting default namespace.
+ */
+ public final void addXmlns(Element ownerElement, String prefix, String uri) {
+ ownerElement.setAttributeNS(XMLNS_URI, "xmlns:" + prefix, uri);
+ }
+
+ /**
+ * Creates a list of attribute names that will be used to insert a property at the right position.
+ *
+ * @return The list of properties specifying the order
+ */
+ protected List<String> buildAttributeNamesOrder() {
+ return Collections.emptyList();
+ }
+
+ /**
+ * Creates a list of element names that will be used to insert a new child element at the right position.
+ *
+ * @return The list of element names specifying the order
+ */
+ protected List<String> buildElementNamesOrder() {
+ return Collections.emptyList();
+ }
+
+ /**
+ * Creates a fully qualified name by prepending the prefix to the given name.
+ *
+ * @param name The name to qualify with the prefix
+ * @return The fully qualified name if a prefix exists; otherwise the given name is returned
+ */
+ public final String buildQualifiedName(String name) {
+
+ String prefix = getPrefix();
+
+ if (prefix == null) {
+ return name;
+ }
+
+ return prefix + ":" + name;
+ }
+
+ /**
+ * Notifies this form's element has been added to its parent.
+ *
+ * @param parent The parent element
+ * @param child The child element that was added
+ * @param elementName The name of the new child element
+ */
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ }
+
+ /**
+ * Retrieves the element that should follow the element with the given name by using the list of
+ * ordered element names.
+ *
+ * @param element The element to which a new child element will be added
+ * @param elementName The name of the new child element
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ */
+ public final Element elementOfInsertion(Element element,
+ String elementName,
+ List<String> elementNamesOrder) {
+
+ return (Element) nodeOfInsertion(
+ element,
+ getChildren(element),
+ elementName,
+ elementNamesOrder
+ );
+ }
+
+ /**
+ * Retrieves the {@link Text} node from the given element if one exists.
+ *
+ * @param element The element from which its {@link Text} node will be returned
+ * @return The child {@link Text} node if it exists or <code>null</code> if none was found
+ */
+ public final Text findTextNode(Element element) {
+
+ NodeList children = element.getChildNodes();
+
+ if (children == null) {
+ return null;
+ }
+
+ for (int index = children.getLength(); --index >= 0; ) {
+ Node childNode = children.item(index);
+ if (isText(childNode)) {
+ return (Text) childNode;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves all the children of the element represented by this external form, elements and
+ * non-elements are included in the list.
+ *
+ * @return The list of children or an empty list if no children are present
+ */
+ public final List<Node> getAllChildren() {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getAllChildren(element);
+ }
+
+ return Collections.emptyList();
+ }
+
+ /**
+ * Retrieves all the children of the given element, elements and non-elements are included in the list.
+ *
+ * @param node The node to retrieve its children
+ * @return The list of children or an empty list if no children are present
+ */
+ public final List<Node> getAllChildren(Node node) {
+
+ acquireReadLock();
+
+ try {
+ List<Node> children = new ArrayList<Node>();
+ NodeList childrenList = node.getChildNodes();
+
+ if (childrenList != null) {
+ for (int index = 0, count = childrenList.getLength(); index < count; index++) {
+ children.add(childrenList.item(index));
+ }
+ }
+
+ return children;
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Retrieves the count of the children the element represented by this external form. The count
+ * includes any type of child (elements and comments).
+ *
+ * @return The total count of children
+ */
+ public final int getAllChildrenSize() {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getAllChildrenSize(element);
+ }
+
+ return 0;
+ }
+
+ /**
+ * Retrieves all the children of the given node.
+ *
+ * @param node The parent node for which its children are requested
+ * @return The children of the given node or an empty list is returned if none was found
+ */
+ public final int getAllChildrenSize(Node node) {
+
+ acquireReadLock();
+
+ try {
+ NodeList childrenList = node.getChildNodes();
+ return (childrenList != null) ? childrenList.getLength() : 0;
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Retrieves an attribute's value associated with the given property name from the given element.
+ *
+ * @param element The element used to retrieve the value of one of its properties
+ * @param attributeName The attribute name to retrieve it's value
+ * @return The value mapped to the given property name; an empty string is returned if it
+ * couldn't be retrieved
+ */
+ public final String getAttribute(Element element, String attributeName) {
+
+ acquireReadLock();
+
+ try {
+
+ if (element.hasAttribute(attributeName)) {
+ return element.getAttribute(attributeName);
+ }
+
+ return null;
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Retrieves the attribute's value having the given name from this model's element.
+ *
+ * @param attributeName The name of the attribute
+ * @return The attribute's value
+ */
+ public final String getAttribute(String attributeName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getAttribute(element, attributeName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the order of the attributes of the element represented by this external form.
+ *
+ * @return The list of property names that determines the order of insertion
+ */
+ public final List<String> getAttributeNamesOrder() {
+ return attributeNamesOrder;
+ }
+
+ /**
+ * Retrieves an attribute's value associated with the given property name from the given element.
+ *
+ * @param element The element used to retrieve the value of one of its properties
+ * @param attributeName The name of the attribute, which will be prepended by the namespace
+ * @return The value mapped to the given property name; an empty string is returned if it couldn't be retrieved
+ */
+ public final String getAttributeNS(Element element, String attributeName) {
+
+ acquireReadLock();
+
+ try {
+ if (element.hasAttributeNS(XSI_URI, attributeName)) {
+ return element.getAttributeNS(XSI_URI, attributeName);
+ }
+
+ return null;
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Retrieves the attribute's value having the given name from this model's element.
+ *
+ * @param attributeName The name of the attribute, which will be prepended by the namespace
+ * @return The attribute's value
+ */
+ public final String getAttributeNS(String attributeName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getAttributeNS(element, attributeName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the list of attributes for the given element.
+ *
+ * @param element The element to retrieve its list of attributes
+ * @return The attributes for the given element
+ */
+ public final List<Attr> getAttributes(Element element) {
+
+ List<Attr> attributes = new ArrayList<Attr>();
+ NamedNodeMap map = element.getAttributes();
+
+ if (map != null) {
+ for (int index = 0, count = map.getLength(); index < count; index++) {
+ Node node = map.item(index);
+ if (isAttribute(node)) {
+ attributes.add((Attr) node);
+ }
+ }
+ }
+
+ return attributes;
+ }
+
+ /**
+ * Retrieves the {@link TextRange} for the given {@link Attr} within the document.
+ *
+ * @param attribute The {@link Attr} to retrieve its {@link TextRange}
+ * @return The {@link TextRange} of the given {@link Attr}'s value
+ */
+ public final TextRange getAttributeTextRange(Attr attribute) {
+
+ if (attribute == null) {
+ return null;
+ }
+
+ return getHelper().getTextRange(this, attribute);
+ }
+
+ /**
+ * Retrieves an attribute's {@linkTextRange} associated with the given property name from the
+ * given element.
+ *
+ * @param element The element used to retrieve the value of one of its properties
+ * @param attributeName The attribute name to retrieve it's {@link TextRange}
+ * @return The {@linkTextRange} of the value associated with the given property name or
+ * <code>null</code> is returned if it couldn't be retrieved
+ */
+ public final TextRange getAttributeTextRange(Element element, String attributeName) {
+
+ acquireReadLock();
+
+ try {
+
+ if (element.hasAttribute(attributeName)) {
+ Attr attribute = element.getAttributeNode(attributeName);
+ return getAttributeTextRange(attribute);
+ }
+
+ return getTextRange(element);
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Retrieves the attribute's {@link TextRange} having the given name from this model's element.
+ *
+ * @param attributeName The name of the attribute
+ * @return The attribute's {@link TextRange}
+ */
+ public final TextRange getAttributeTextRange(String attributeName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getAttributeTextRange(element, attributeName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the attribute's value having the given name from this model's element.
+ *
+ * @param element The element where the attribute's value is located
+ * @param attributeName The name of the attribute
+ * @return The attribute's value
+ */
+ public final Boolean getBooleanAttribute(Element element, String attributeName) {
+
+ String value = getAttribute(element, attributeName);
+
+ if (value == null) {
+ return null;
+ }
+
+ return Boolean.valueOf(value);
+ }
+
+ /**
+ * Retrieves the attribute's value having the given name from this model's element.
+ *
+ * @param attributeName The name of the attribute
+ * @return The attribute's value
+ */
+ public final Boolean getBooleanAttribute(String attributeName) {
+
+ Element element = getElement();
+
+ if (element == null) {
+ return null;
+ }
+
+ return getBooleanAttribute(element, attributeName);
+ }
+
+ /**
+ * Retrieves the element with the given name.
+ *
+ * @param parent The parent of this external form used to retrieve the parent element
+ * @param elementName The name of the child to retrieve if it could not be found
+ */
+ public final Element getChild(AbstractExternalForm parent, String elementName) {
+ return getChild(parent.getElement(), elementName);
+ }
+
+ /**
+ * Retrieves the element with the given name.
+ *
+ * @param parent The parent of this external form used to retrieve the parent element
+ * @param elementName The name of the child to retrieve
+ * @param index The position of the child to retrieve among the children
+ * @return The element with the given name or <code>null</code> if it could not be found
+ */
+ public final Element getChild(AbstractExternalForm parent, String elementName, int index) {
+ return getChild(parent.getElement(), elementName, index);
+ }
+
+ /**
+ * Retrieves the XML element with the given name that is the direct child of the given
+ * parent node.
+ *
+ * @param node The node for which one of its children is requested
+ * @param index The position of the child to retrieve among the children
+ * @return The element at the given position if it was found; <code>null</code> otherwise
+ */
+ public final Element getChild(Node node, int index) {
+
+ List<Element> children = getChildren(node);
+
+ if (index >= children.size()) {
+ return null;
+ }
+
+ return children.get(index);
+ }
+
+ /**
+ * Retrieves the XML element with the given name that is the direct child of the given node.
+ *
+ * @param node The parent node for which one of its children is requested
+ * @param elementName The name of the children to retrieve
+ * @return The element with the given name if it was found; <code>null</code> otherwise
+ */
+ public final Element getChild(Node node, String elementName) {
+
+ acquireReadLock();
+
+ try {
+
+ for (Element child : getChildren(node)) {
+ if (ObjectTools.equals(child.getNodeName(), elementName)) {
+ return child;
+ }
+ }
+
+ return null;
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Retrieves the element with the given name.
+ *
+ * @param node The parent element from which to search for the child element
+ * @param elementName The name of the child to retrieve
+ * @param index The position of the child to retrieve among the children
+ * @return The element with the given name or <code>null</code> if it could not be found
+ */
+ public final Element getChild(Node node, String elementName, int index) {
+
+ if (index < 0) {
+ return null;
+ }
+
+ List<Element> children = getChildren(node, elementName);
+
+ if (index >= children.size()) {
+ return null;
+ }
+
+ return children.get(index);
+ }
+
+ /**
+ * Retrieves the element with the given name that is a child of the element
+ * represented by this model.
+ *
+ * @param elementName The name of the child element to retrieve
+ * @return The element with the given name or <code>null</code> if it could not be found
+ */
+ public final Element getChild(String elementName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ element = getChild(element, elementName);
+ }
+
+ return element;
+ }
+
+ /**
+ * Retrieves the element with the given name that is a child of the element
+ * represented by this model.
+ *
+ * @param elementName The name of the child element to retrieve
+ * @param index
+ * @return The element with the given name or <code>null</code> if it could not be found
+ */
+ public final Element getChild(String elementName, int index) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ element = getChild(element, elementName, index);
+ }
+
+ return element;
+ }
+
+ /**
+ * Retrieves the attribute's value associated with the given attribute name that is defined in
+ * the child element with the given name.
+ *
+ * @param childName The name of the child for which the attribute's value is retrieved
+ * @param attributeName The name of the attribute to retrieve its value
+ * @return The value of the attribute
+ */
+ public final String getChildAttribute(Node element, String childName, String attributeName) {
+
+ Element childNode = getChild(element, childName);
+
+ if (childNode == null) {
+ return null;
+ }
+
+ return getAttribute(childNode, attributeName);
+ }
+
+ /**
+ * Retrieves the attribute's value associated with the given attribute name that is defined in
+ * the child element with the given name.
+ *
+ * @param childName The name of the child for which the attribute's value is retrieved
+ * @param attributeName The name of the attribute to retrieve its value
+ * @return The value of the attribute
+ */
+ public final String getChildAttribute(String childName, String attributeName) {
+
+ Element element = getChild(childName);
+
+ if (element == null) {
+ return null;
+ }
+
+ return getAttribute(element, attributeName);
+ }
+
+ /**
+ * Retrieves the {@link TextRange} of the attribute's value.
+ *
+ * @param childName The name of the child for which the {@link TextRange} of the attribute's
+ * value should be retrieved
+ * @param attributeName The name of the attribute to retrieve the {@link TextRange} of its value
+ * @return The {@link TextRange} of the attribute's value
+ */
+ public final TextRange getChildAttributeTextRange(String childName, String attributeName) {
+
+ Element element = getChild(childName);
+
+ if (element != null) {
+ return getAttributeTextRange(element, attributeName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the <code>Boolean</code> representation of the child's attribute.
+ *
+ * @param elementName The name of the child element for which to retrieve its given attribute's value
+ * @param attributeName The name of the attribute to retrieve its value
+ * @return The <code>Boolean</code> value of the child node's value
+ */
+ public final Boolean getChildBooleanAttribute(Node element,
+ String elementName,
+ String attributeName) {
+
+ String value = getChildAttribute(element, elementName, attributeName);
+
+ if (value != null) {
+ return Boolean.valueOf(value);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the <code>Boolean</code> representation of the child's attribute.
+ *
+ * @param elementName The name of the child element for which to retrieve its given attribute's value
+ * @param attributeName The name of the attribute to retrieve its value
+ * @return The <code>Boolean</code> value of the child node's value
+ */
+ public final Boolean getChildBooleanAttribute(String elementName, String attributeName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildBooleanAttribute(element, elementName, attributeName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the <code>Boolean</code> representation of the child node's text.
+ *
+ * @param elementName The name of the child element to retrieve its value
+ * @return The <code>Boolean</code> value of the child node's value
+ */
+ public final Boolean getChildBooleanNode(Node element, String elementName) {
+
+ String value = getChildTextNode(element, elementName);
+
+ if (value != null) {
+ return Boolean.valueOf(value);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the <code>Boolean</code> representation of the child node's text.
+ *
+ * @param elementName The name of the child element to retrieve its value
+ * @return The <code>Boolean</code> value of the child node's value
+ */
+ public final Boolean getChildBooleanNode(String elementName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildBooleanNode(element, elementName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link Enum} representation of the child's attribute.
+ *
+ * @param node The parent node to retrieve its child
+ * @param elementName The name of the child element for which to retrieve its given attribute's value
+ * @param attributeName The name of the attribute to retrieve its value
+ * @param enumClass The type of the enumeration used to retrieve the constant
+ * @param <T> The type of the enumeration
+ * @return The {@link Enum} value of the child node's value
+ */
+ public final <T extends Enum<T>> T getChildEnumAttribute(Node node,
+ String elementName,
+ String attributeName,
+ Class<T> enumClass) {
+
+ String value = getChildAttribute(node, elementName, attributeName);
+
+ if (value != null) {
+ try {
+ return Enum.valueOf(enumClass, value);
+ }
+ catch (Exception e) {
+ // Ignore, it's not a valid enum constant
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link Enum} representation of the child's attribute.
+ *
+ * @param elementName The name of the child element for which to retrieve its given attribute's value
+ * @param attributeName The name of the attribute to retrieve its value
+ * @param enumClass The type of the enumeration used to retrieve the constant
+ * @param <T> The type of the enumeration
+ * @return The {@link Enum} value of the child node's value
+ */
+ public final <T extends Enum<T>> T getChildEnumAttribute(String elementName,
+ String attributeName,
+ Class<T> enumClass) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildEnumAttribute(element, elementName, attributeName, enumClass);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link Enum} representation of the child node's text.
+ *
+ * @param node The parent node to retrieve its child
+ * @param elementName The name of the child to retrieve
+ * @param enumClass The type of the enumeration used to retrieve the constant
+ * @param <T> The type of the enumeration
+ * @return The {@link Enum} value of the child node's value
+ */
+ public final <T extends Enum<T>> T getChildEnumNode(Node node,
+ String elementName,
+ Class<T> enumClass) {
+
+ String value = getChildTextNode(node, elementName);
+
+ if (value != null) {
+ try {
+ return Enum.valueOf(enumClass, value);
+ }
+ catch (Exception e) {
+ // Ignore, it's not a valid enum constant
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link Enum} representation of the child node's text.
+ *
+ * @param elementName The name of the child to retrieve
+ * @param enumClass The type of the enumeration used to retrieve the constant
+ * @param <T> The type of the enumeration
+ * @return The {@link Enum} value of the child node's value
+ */
+ public final <T extends Enum<T>> T getChildEnumNode(String elementName, Class<T> enumClass) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildEnumNode(element, elementName, enumClass);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link Integer} value of a child text node that is the child of the given element.
+ *
+ * @param element The parent element
+ * @param elementName The name of the child element for which to retrieve its given attribute's value
+ * @param attributeName The name of the attribute to retrieve its value
+ * @return The {@link Integer} of the child element or <code>null</code> if the element is not defined
+ */
+ public final Integer getChildIntegerAttribute(Node element,
+ String elementName,
+ String attributeName) {
+
+ String value = getChildAttribute(element, elementName, attributeName);
+
+ if (value == null) {
+ return null;
+ }
+
+ try {
+ return Integer.valueOf(value);
+ }
+ catch (Exception e) {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the {@link Integer} value of a child text node that is the child of the element
+ * represented by this external form.
+ *
+ * @param elementName The name of the child element for which to retrieve its given attribute's value
+ * @param attributeName The name of the attribute to retrieve its value
+ * @return The {@link Integer} of the child element or <code>null</code> if the element is not defined
+ */
+ public final Integer getChildIntegerAttribute(String elementName, String attributeName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildIntegerAttribute(element, elementName, attributeName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link Integer} value of a child text node that is the child of the given element.
+ *
+ * @param element The parent element
+ * @param elementName The name of the child element to retrieve its value
+ * @return The {@link Integer} of the child element or <code>null</code> if the element is not defined
+ */
+ public final Integer getChildIntegerNode(Node element, String elementName) {
+
+ String value = getChildTextNode(element, elementName);
+
+ if (value == null) {
+ return null;
+ }
+
+ try {
+ return Integer.valueOf(value);
+ }
+ catch (Exception e) {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the {@link Integer} value of a child text node that is the child of the element
+ * represented by this external form.
+ *
+ * @param elementName The name of the child element to retrieve its value
+ * @return The {@link Integer} of the child element or <code>null</code> if the element is not defined
+ */
+ public final Integer getChildIntegerNode(String elementName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildIntegerNode(element, elementName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the elements that are the direct children of the given parent node.
+ *
+ * @return The elements that are children of the parent node or an empty list is returned if none was found
+ */
+ public final List<Element> getChildren() {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildren(element);
+ }
+
+ return Collections.emptyList();
+ }
+
+ /**
+ * Retrieves the XML elements that are the direct children of the given parent node.
+ *
+ * @param node The node for which its children are requested
+ * @return The elements that are children of the parent node or an empty list is returned if none was found
+ */
+ public final List<Element> getChildren(Node node) {
+
+ acquireReadLock();
+
+ try {
+
+ List<Element> children = new ArrayList<Element>();
+ NodeList childrenList = node.getChildNodes();
+
+ if (childrenList != null) {
+ for (int index = 0, count = childrenList.getLength(); index < count; index++) {
+ Node child = childrenList.item(index);
+ if (isElement(child)) {
+ children.add((Element) child);
+ }
+ }
+ }
+
+ return children;
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Retrieves the XML elements that are the direct children of the given parent node.
+ *
+ * @param node The parent node for which its children are requested
+ * @param elementNames The collection of names that count as a child of the given node
+ * @return The elements that are children of the parent node or an empty list is returned if none was found
+ */
+ public final List<Element> getChildren(Node node, Collection<String> elementNames) {
+
+ acquireReadLock();
+
+ try {
+
+ List<Element> children = getChildren(node);
+
+ for (Iterator<Element> iter = children.iterator(); iter.hasNext(); ) {
+ Element element = iter.next();
+ String elementName = element.getNodeName();
+
+ if (!elementNames.contains(elementName)) {
+ iter.remove();
+ }
+ }
+
+ return children;
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Retrieves the XML elements that are the direct children of the given parent node.
+ *
+ * @param node The parent node for which its children are requested
+ * @param elementName The name of the element to retrieve
+ * @return The elements that are children of the parent node or an empty list is returned if none was found
+ */
+ public final List<Element> getChildren(Node node, String elementName) {
+
+ acquireReadLock();
+
+ try {
+
+ List<Element> children = getChildren(node);
+
+ for (Iterator<Element> iter = children.iterator(); iter.hasNext();) {
+ Element element = iter.next();
+
+ if (ObjectTools.notEquals(element.getNodeName(), elementName)) {
+ iter.remove();
+ }
+ }
+
+ return children;
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Retrieves the XML elements that are the direct children of the given parent node.
+ *
+ * @param elementName The name of the element to retrieve
+ * @return The elements that are children of the parent node or an empty list is returned if none was found
+ */
+ public final List<Element> getChildren(String elementName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildren(element, elementName);
+ }
+
+ return Collections.emptyList();
+ }
+
+ /**
+ * Retrieves the XML elements that are the direct children of the given parent node.
+ *
+ * @return The count of child nodes
+ */
+ public final int getChildrenSize() {
+ return getChildren().size();
+ }
+
+ /**
+ * Retrieves the XML elements that are the direct children of the given parent node.
+ *
+ * @param node The count of children for this node
+ * @return The count of child nodes listed under the given node
+ */
+ public final int getChildrenSize(Node node) {
+ return getChildren(node).size();
+ }
+
+ /**
+ * Retrieves the XML elements that are the direct children of the given parent node.
+ *
+ * @param element The parent element to retrieve the count of child nodes it has with the given element name
+ * @param elementNames The collection of names that count as a child of the given node
+ * @return The count of child nodes with the given element name
+ */
+ public final int getChildrenSize(Node element, Collection<String> elementNames) {
+ return getChildren(element, elementNames).size();
+ }
+
+ /**
+ * Retrieves the XML elements that are the direct children of the given parent node.
+ *
+ * @param element The parent element to retrieve the count of child nodes it has with the given element name
+ * @param elementName The name of the element to retrieve
+ * @return The count of child nodes with the given element name
+ */
+ public final int getChildrenSize(Node element, String elementName) {
+ return getChildren(element, elementName).size();
+ }
+
+ /**
+ * Retrieves the XML elements that are the direct children of the given parent node.
+ *
+ * @param elementName The name of the element to retrieve
+ * @return The count of child nodes with the given element name
+ */
+ public final int getChildrenSize(String elementName) {
+ return getChildren(elementName).size();
+ }
+
+ /**
+ * Returns the texts of the text nodes that are the children of the given parent.
+ * <p>
+ * Form: <elementName>text</elementName>.
+ *
+ * @param node The parent element
+ * @param elementName The name of the child element to retrieve its value
+ * @return The text of the child element or <code>null</code> if the element is not defined
+ */
+ public final List<String> getChildrenTextNode(Node node, String elementName) {
+
+ acquireReadLock();
+
+ try {
+ List<String> values = new ArrayList<String>();
+
+ for (Element element : getChildren(node, elementName)) {
+ values.add(element.getTextContent());
+ }
+
+ return values;
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Returns the texts of the text nodes that are the children of the given parent.
+ * <p>
+ * Form: <elementName>text</elementName>.
+ *
+ * @param elementName The name of the child element to retrieve its value
+ * @return The text of the child element or <code>null</code> if the element is not defined
+ */
+ public final List<String> getChildrenTextNode(String elementName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildrenTextNode(element, elementName);
+ }
+
+ return Collections.emptyList();
+ }
+
+ /**
+ * Returns the text of a child node that is the child of the given element.
+ * <p>Form: <elementName>text</elementName>.
+ *
+ * @param node The parent node
+ * @param elementName The name of the child element to retrieve its value
+ * @return The text of the child element or <code>null</code> if the element is not defined
+ */
+ public final String getChildTextNode(Node node, String elementName) {
+
+ Element child = getChild(node, elementName);
+
+ if (child != null) {
+ return getTextNode(child);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the child node that is the child of the given element with the given text.
+ * <p>Form: <elementName>text</elementName>.
+ *
+ * @param node The parent node
+ * @param elementName The name of the child element to retrieve its value
+ * @param index The nth child that has the same element name and text value
+ * @return The text of the child element or <code>null</code> if the element is not defined
+ */
+ public final String getChildTextNode(Node node, String elementName, int index) {
+
+ Element element = getChild(node, elementName, index);
+
+ if (element != null) {
+ return getTextNode(element);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the child node that is the child of the given element with the given text.
+ * <p>Form: <elementName>text</elementName>.
+ *
+ * @param node The parent node
+ * @param elementName The name of the child element to retrieve its value
+ * @param index The nth child that has the same element name and text value
+ * @param text The text of the child element to retrieve its {@link TextRange}
+ * @return The text of the child element or <code>null</code> if the element is not defined
+ */
+ public final Element getChildTextNode(Node node, String elementName, int index, String text) {
+
+ int nodeIndex = 0;
+
+ for (Element child : getChildren(node, elementName)) {
+ String childText = getTextNode(child);
+ if (childText.equals(text)) {
+ if (nodeIndex == index) {
+ return child;
+ }
+ nodeIndex++;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the child node that is the child of the given element with the given text.
+ * <p>Form: <elementName>text</elementName>.
+ *
+ * @param node The parent node
+ * @param elementName The name of the child element to retrieve its value
+ * @param text The text of the child element to retrieve its {@link TextRange}
+ * @return The text of the child element or <code>null</code> if the element is not defined
+ */
+ public final Element getChildTextNode(Node node, String elementName, String text) {
+
+ for (Element child : getChildren(node, elementName)) {
+ String childText = getTextNode(child);
+ if (childText.equals(text)) {
+ return child;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the text of a child node: <elementName>text</elementName>.
+ *
+ * @param elementName The name of the child element to retrieve its value
+ * @return The text of the child element or <code>null</code> if the element is not defined
+ */
+ public final String getChildTextNode(String elementName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildTextNode(element, elementName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the text of a child node: <elementName>text</elementName>.
+ *
+ * @param elementName The name of the child element to retrieve its value
+ * @param index The position of the child to retrieve its value
+ * @return The text of the child element or <code>null</code> if the element is not defined
+ */
+ public final String getChildTextNode(String elementName, int index) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildTextNode(element, elementName, index);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the text of a child node that is the child of the given element.
+ * <p>Form: <elementName>text</elementName>.
+ *
+ * @param childName The child to retrieve it's child text node's value
+ * @param elementName The name of the child element to retrieve its value
+ * @return The text of the child element or <code>null</code> if the element is not defined
+ */
+ public final String getChildTextNode(String childName, String elementName) {
+
+ Element child = getChild(childName);
+
+ if (child != null) {
+ return getChildTextNode(child, elementName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link TextRange} of a child node that is the child of the given element.
+ * <p>Form: <elementName>text</elementName>.
+ *
+ * @param node The parent node
+ * @param elementName The name of the child element to retrieve its value's {@link TextRange}
+ * @return The {@link TextRange} of the child element or <code>null</code> if the element is not defined
+ */
+ public final TextRange getChildTextNodeTextRange(Node node, String elementName) {
+
+ Element child = getChild(node, elementName);
+
+ if (child != null) {
+ return getTextNodeTextRange(child);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link TextRange} of a child node that is the child of the given element.
+ * <p>Form: <elementName>text</elementName>.
+ *
+ * @param node The parent node
+ * @param elementName The name of the child element to retrieve its value's {@link TextRange}
+ * @param index The nth child node to retrieve that has the same element name and text node
+ * @param textNode The text of the child element to retrieve its {@link TextRange}
+ * @return The {@link TextRange} of the child element or <code>null</code> if the element is not defined
+ */
+ public final TextRange getChildTextNodeTextRange(Node node,
+ String elementName,
+ int index,
+ String textNode) {
+
+ Element child = getChildTextNode(node, elementName, index, textNode);
+
+ if (child != null) {
+ return getTextNodeTextRange(child);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link TextRange} of a child node that is the child of the given element.
+ * <p>Form: <elementName>text</elementName>.
+ *
+ * @param node The parent node
+ * @param elementName The name of the child element to retrieve its value's {@link TextRange}
+ * @param textNode The text of the child element to retrieve its {@link TextRange}
+ * @return The {@link TextRange} of the child element or <code>null</code> if the element is not defined
+ */
+ public final TextRange getChildTextNodeTextRange(Node node,
+ String elementName,
+ String textNode) {
+
+ Element child = getChildTextNode(node, elementName, textNode);
+
+ if (child != null) {
+ return getTextNodeTextRange(child);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link TextRange} of a child node's value: <elementName>text</elementName>.
+ *
+ * @param elementName The name of the child element to retrieve its value's {@link TextRange}
+ * @return The {@link TextRange} of the child element or <code>null</code> if the element is not defined
+ */
+ public final TextRange getChildTextNodeTextRange(String elementName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildTextNodeTextRange(element, elementName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link TextRange} of a child node's value: <elementName>text</elementName>
+ * at a specific location.
+ *
+ * @param elementName The name of the child element to retrieve its value's {@link TextRange}
+ * @param index The position of the child text node to retrieve its {@link TextRange}
+ * @return The {@link TextRange} of the child element or <code>null</code> if the element is not defined
+ */
+ public final TextRange getChildTextNodeTextRange(String elementName, int index) {
+
+ Element element = getChild(elementName, index);
+
+ if (element != null) {
+ return getTextNodeTextRange(element);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link TextRange} of a child node's value: <elementName>text</elementName>
+ * at a specific location.
+ *
+ * @param elementName The name of the child element to retrieve its value's {@link TextRange}
+ * @param index The position of the child text node to retrieve its {@link TextRange}
+ * @param textNode The text of the child element to retrieve its {@link TextRange}
+ * @return The {@link TextRange} of the child element or <code>null</code> if the element is not defined
+ */
+ public final TextRange getChildTextNodeTextRange(String elementName,
+ int index,
+ String textNode) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildTextNodeTextRange(element, elementName, index, textNode);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the {@link TextRange} of a child node's value: <elementName>text</elementName>.
+ *
+ * @param elementName The name of the child element to retrieve its value's {@link TextRange}
+ * @param textNode The text of the child element to retrieve its {@link TextRange}
+ * @return The {@link TextRange} of the child element or <code>null</code> if the element is not defined
+ */
+ public final TextRange getChildTextNodeTextRange(String elementName, String textNode) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getChildTextNodeTextRange(element, elementName, textNode);
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the {@link TextRange} of the first child with the given name.
+ *
+ * @param childName The name of the child to retrieve its {@link TextRange}
+ * @return The {@link TextRange} of the child node
+ */
+ public final TextRange getChildTextRange(String childName) {
+
+ Element element = getChild(childName);
+
+ if (element != null) {
+ return getTextRange(element);
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the XML document.
+ *
+ * @return The XML document
+ */
+ protected final Document getDocument() {
+ return getHelper().getDocument();
+ }
+
+ /**
+ * Retrieves the XML element representing this model.
+ *
+ * @return The child element retrieved from its parent element that represents the XML structure
+ * of this model
+ */
+ protected Element getElement() {
+ return getChild(getParent(), getElementName());
+ }
+
+ /**
+ * Returns the name used to store the information in the XML document.
+ *
+ * @return A non-<code>null</code> value used to retrieve the element from the XML document
+ */
+ protected abstract String getElementName();
+
+ /**
+ * Returns the order of the child elements.
+ *
+ * @return The list of element names that determines the order of insertion
+ */
+ public final List<String> getElementNamesOrder() {
+ return elementNamesOrder;
+ }
+
+ /**
+ * Retrieves the {@link TextRange} for the name of the given {@link Element} within the document.
+ *
+ * @param attribute The {@link Element} to retrieve the {@link TextRange} for its name
+ * @return The {@link TextRange} of the given {@link Element}'s name
+ */
+ public final TextRange getElementNameTextRange(Element element) {
+
+ if (element == null) {
+ return null;
+ }
+
+ return getHelper().getElementNameTextRange(this, element);
+ }
+
+ /**
+ * Retrieves the attribute's value having the given name from this model's
+ * element.
+ *
+ * @param element The element where the attribute's value is located
+ * @param attributeName The name of the attribute
+ * @return The attribute's value
+ */
+ public final <T extends Enum<T>> T getEnumAttribute(Element element,
+ String attributeName,
+ Class<T> enumClass) {
+
+ String value = getAttribute(element, attributeName);
+
+ if (value != null) {
+ try {
+ return Enum.valueOf(enumClass, value);
+ }
+ catch (Exception e) {
+ // Invalid property
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the attribute's value having the given name from this model's element.
+ *
+ * @param attributeName The name of the attribute
+ * @return The attribute's value
+ */
+ public final <T extends Enum<T>> T getEnumAttribute(String attributeName, Class<T> enumClass) {
+
+ Element element = getElement();
+
+ if (element == null) {
+ return null;
+ }
+
+ return getEnumAttribute(element, attributeName, enumClass);
+ }
+
+ /**
+ * Returns the helper that completes the behavior of this form.
+ *
+ * @return The helper that is called when the document needs to be modified
+ */
+ protected ExternalFormHelper getHelper() {
+ return getRoot().getHelper();
+ }
+
+ /**
+ * Retrieves the attribute's value having the given name from this model's element.
+ *
+ * @param element The element where the attribute's value is located
+ * @param attributeName The name of the attribute
+ * @return The attribute's value
+ */
+ public final Integer getIntegerAttribute(Element element, String attributeName) {
+
+ String value = getAttribute(attributeName);
+
+ if (value != null) {
+ try {
+ return Integer.valueOf(value);
+ }
+ catch (Exception e) {
+ // Invalid property
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the attribute's value having the given name from this model's element.
+ *
+ * @param attributeName The name of the attribute
+ * @return The attribute's value
+ */
+ public final Integer getIntegerAttribute(String attributeName) {
+
+ Element element = getElement();
+
+ if (element == null) {
+ return null;
+ }
+
+ return getIntegerAttribute(element, attributeName);
+ }
+
+ /**
+ * Returns the namespace of the root element for this external form.
+ *
+ * @param uri The URI of the namespace
+ */
+ public final String getNamespace() {
+
+ Element element = getRootElement();
+
+ if (element != null) {
+ return getAttribute(element, XMLNS_ATTRIBUTE);
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the name of the given node.
+ * <p>
+ * Example: <name>...</name> where "name" will be returned for the element.
+ * <p>
+ * Example: <node "key"="value"/> where "key" will be returned for the attribute.
+ *
+ * @param node The node to retrieve its name
+ * @return The element name of the given node
+ */
+ public final String getNodeName(Node node) {
+
+ acquireReadLock();
+
+ try {
+ return node.getNodeName();
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Returns the parent of this object.
+ *
+ * @return The parent of this object, <code>null</code> is never returned
+ */
+ public AbstractExternalForm getParent() {
+ return parent;
+ }
+
+ /**
+ * Retrieves the XML element representing by the parent model.
+ *
+ * @return The element of the parent form
+ */
+ public final Element getParentElement() {
+ return getParent().getElement();
+ }
+
+ /**
+ * Retrieves the prefix representing the XML schema nodes. It is declared in the root element's properties.
+ *
+ * @return The prefix defined in the root element properties or <code>null</code> if it is not defined
+ */
+ public final String getPrefix() {
+
+ // The root element needs to be retrieved before acquiring a read lock
+ // in case the root element doesn't yet exist
+ Element element = getRootElement();
+
+ acquireReadLock();
+
+ try {
+ NamedNodeMap attributes = element.getAttributes();
+
+ if (attributes != null) {
+ for (int index = attributes.getLength(); --index >= 0; ) {
+ Node node = attributes.item(index);
+ String localName = node.getNodeName();
+ String value = node.getNodeValue();
+
+ if (localName != null &&
+ localName.startsWith("xmlns:") &&
+ XSI_URI.equals(value)) {
+
+ return localName.substring("xmlns:".length());
+ }
+ }
+ }
+
+ return null;
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Retrieves the root of the model object hierarchy.
+ *
+ * @return The top node of the model object hierarchy
+ */
+ public final AbstractExternalForm getRoot() {
+ return (parent == null) ? this : parent.getRoot();
+ }
+
+ /**
+ * Retrieves the root element from the XML document. If the element could not be found, it will
+ * be automatically added.
+ *
+ * @return The root of the XML model hierarchy
+ */
+ public final Element getRootElement() {
+
+ Document document = getDocument();
+ String rootElementName = getRoot().getElementName();
+ Element element = getChild(document, rootElementName);
+
+ if (element == null) {
+
+ // First make sure there are no root element with a different name
+ for (Element child : getChildren(document)) {
+
+ if (ObjectTools.notEquals(child.getNodeName(), rootElementName)) {
+ // A root element was found, simply rename it to comply
+ // with the document's XSD
+ setElementName(child, rootElementName);
+ return getRootElement();
+ }
+ }
+ }
+
+ return element;
+ }
+
+ /**
+ * Returns the schema location defined in the root element of this form.
+ *
+ * @return URI of the XML schema.
+ */
+ public final String getSchemaLocation() {
+ return getAttribute(XSI_SCHEMA_LOCATION);
+ }
+
+ /**
+ * Retrieves the text content from the text node handled by this form.
+ *
+ * @return The text contained within the text node or <code>null</code> if the element does not exist
+ */
+ public final String getTextNode() {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getTextNode(element);
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the text content from the given text node.
+ *
+ * @param element The node from which the text is retrieved
+ * @return The text contained within the given text node
+ */
+ public final String getTextNode(Node element) {
+
+ acquireReadLock();
+
+ try {
+ return element.getTextContent();
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Retrieves the {@link TextRange} of the given text node's value.
+ *
+ * @param element The node from which the {@link TextRange} is retrieved
+ * @return The {@link TextRange} of the node's text
+ */
+ public final TextRange getTextNodeTextRange(Node element) {
+
+ if (element == null) {
+ return getParent().getTextRange();
+ }
+
+ return getHelper().getTextNodeTextRange(this, element);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final TextRange getTextRange() {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return getTextRange(element);
+ }
+
+ AbstractExternalForm parent = getParent();
+
+ if (parent != null) {
+ return parent.getTextRange();
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the {@link TextRange} of the given {@link Node}.
+ *
+ * @param element The node from which the {@link TextRange} is retrieved
+ * @return The {@link TextRange} of the given {@link Node}
+ */
+ public final TextRange getTextRange(Element element) {
+ return getHelper().getTextRange(this, element);
+ }
+
+ /**
+ * Returns the version attribute value specified on this form.
+ *
+ * @return The version attribute value specified on this form
+ */
+ public final String getVersion() {
+ return getAttribute(XSD_VERSION);
+ }
+
+ /**
+ * Determines whether the element represented by this external form has any children, which
+ * includes comments and elements.
+ *
+ * @return <code>true</code> if the element is not a leaf and has children; <code>false</code> if
+ * the element is a leaf
+ */
+ public final boolean hasAnyChildren() {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return hasAnyChildren(element);
+ }
+
+ return false;
+ }
+
+ /**
+ * Determines whether the given node has any children, which includes comments and elements.
+ *
+ * @param node The node checked for having children
+ * @return <code>true</code> if the element is not a leaf and has children; <code>false</code> if
+ * the element is a leaf
+ */
+ public final boolean hasAnyChildren(Node node) {
+ return getAllChildrenSize(node) > 0;
+ }
+
+ /**
+ * Determines whether the element represented by this external form has anything specified:
+ * elements and attributes.
+ *
+ * @return <code>true</code> if the element has at least one child; <code>false</code> otherwise
+ */
+ public final boolean hasAnything() {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return hasChildren(element) || hasAttributes(element);
+ }
+
+ return false;
+ }
+
+ /**
+ * Determines whether the given element has an attribute with the given name.
+ *
+ * @param element The element used to check if an attribute with the given name exists
+ * @param elementName The name of the attribute
+ * @return <code>true</code> if the attribute is present; <code>false</code> otherwise
+ */
+ public final boolean hasAttribute(Element element, String elementName) {
+ return getAttribute(element, elementName) != null;
+ }
+
+ /**
+ * Determines whether the element represented by this external form has an attribute with the
+ * given name.
+ *
+ * @param attributeName The name of the attribute
+ * @return <code>true</code> if the attribute is present; <code>false</code> otherwise
+ */
+ public final boolean hasAttribute(String attributeName) {
+ return getAttribute(attributeName) != null;
+ }
+
+ /**
+ * Determines whether the given element has an attribute NS with the given name.
+ *
+ * @param element The element used to check if an attribute NS with the given name exists
+ * @param elementName The name of the attribute
+ * @return <code>true</code> if the attribute NS is present; <code>false</code> otherwise
+ */
+ public final boolean hasAttributeNS(Element element, String elementName) {
+ return getAttributeNS(element, elementName) != null;
+ }
+
+ /**
+ * Determines whether the element represented by this external form has an attribute NS with the given name.
+ *
+ * @param elementName The name of the attribute
+ * @return <code>true</code> if the attribute NS is present; <code>false</code> otherwise
+ */
+ public final boolean hasAttributeNS(String elementName) {
+ return getAttributeNS(elementName) != null;
+ }
+
+ /**
+ * Determines whether the element represented by this external form has any attributes.
+ *
+ * @return <code>true</code> if there is at least one attribute; <code>false</code> otherwise
+ */
+ public final boolean hasAttributes() {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return hasAttributes(element);
+ }
+
+ return false;
+ }
+
+ /**
+ * Determines whether the given element has any attributes.
+ *
+ * @param element The element to check if it has attributes
+ * @return <code>true</code> if there is at least one attribute; <code>false</code> otherwise
+ */
+ public final boolean hasAttributes(Element element) {
+
+ NamedNodeMap attributes = element.getAttributes();
+
+ if (attributes == null) {
+ return false;
+ }
+
+ return attributes.getLength() > 0;
+ }
+
+ /**
+ * Determines whether the given element has a child with the given element name.
+ *
+ * @param element The element used to check if it has a child with the given name
+ * @param elementName The name of the element
+ * @return <code>true</code> if a child with the given name was found; <code>false</code> otherwise
+ */
+ public final boolean hasChild(Element element, String elementName) {
+ return getChild(element, elementName) != null;
+ }
+
+ /**
+ * Determines whether the given element has a child with the given element name.
+ *
+ * @param element The element used to check if it has a child with the given name
+ * @param index The position of the child element to check it's existence, which is only based on
+ * the count of children of the same type and to make sure the index is smaller than the children size
+ * @param elementName The name of the element
+ * @return <code>true</code> if a child with the given name was found; <code>false</code> otherwise
+ */
+ public final boolean hasChild(Element element, String elementName, int index) {
+ return getChild(element, elementName, index) != null;
+ }
+
+ /**
+ * Determines whether the element represented by this external form has a child with the given element name.
+ *
+ * @param elementName The name of the element
+ * @return <code>true</code> if a child with the given name was found; <code>false</code> otherwise
+ */
+ public final boolean hasChild(String elementName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return hasChild(element, elementName);
+ }
+
+ return false;
+ }
+
+ /**
+ * Determines whether the element represented by this external form has a child with the given element name.
+ *
+ * @param elementName The name of the element
+ * @param index The position of the child element to check it's existence, which is only based on
+ * the count of children of the same type and to make sure the index is smaller than the children size
+ * @return <code>true</code> if a child with the given name was found; <code>false</code> otherwise
+ */
+ public final boolean hasChild(String elementName, int index) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return hasChild(element, elementName, index);
+ }
+
+ return false;
+ }
+
+ /**
+ * Determines whether the element represented by this external form has any children,
+ * non-elements are not included into the check.
+ *
+ * @return <code>true</code> if the element has at least one child; <code>false</code> otherwise
+ */
+ public final boolean hasChildren() {
+
+ Element element = getElement();
+
+ if (element != null) {
+ return hasChildren(element);
+ }
+
+ return false;
+ }
+
+ /**
+ * Determines whether the given element has any children, non-elements are not included into the check.
+ *
+ * @param element The element used to check if it has child elements
+ * @return <code>true</code> if the element has at least one child; <code>false</code> otherwise
+ */
+ public final boolean hasChildren(Element element) {
+
+ acquireReadLock();
+
+ try {
+ NodeList childrenList = element.getChildNodes();
+ int count = 0;
+
+ if (childrenList != null) {
+ for (int index = childrenList.getLength(); --index >= 0; ) {
+ Node child = childrenList.item(index);
+ if (isElement(child)) {
+ count++;
+ }
+ }
+
+ return (count > 0);
+ }
+
+ return false;
+ }
+ finally {
+ releaseReadLock();
+ }
+ }
+
+ /**
+ * Determines whether the element represented by this external form is present in the XML document.
+ *
+ * @return <code>true</code> if the element exists; <code>false</code> if it does not
+ */
+ public final boolean hasElement() {
+ return getElement() != null;
+ }
+
+ /**
+ * Returns the position of the given child within the given parent's children of the same element type.
+ *
+ * @param parent The parent element
+ * @param child The child element that was added
+ * @param elementName The name of the new child element
+ * @return The position of the given child
+ */
+ protected int index(Element parent, Element child, String elementName) {
+ return getChildren(parent, elementName).indexOf(child);
+ }
+
+ /**
+ * Initializes this external form.
+ */
+ protected void initialize() {
+ attributeNamesOrder = buildAttributeNamesOrder();
+ elementNamesOrder = buildElementNamesOrder();
+ }
+
+ /**
+ * Returns true if node is non-null and is of type ATTRIBUTE_NODE.
+ */
+ protected boolean isAttribute(Node node) {
+ return isNodeType(node, Node.ATTRIBUTE_NODE);
+ }
+
+ /**
+ * Returns true if node is non-null and is of type ELEMENT_NODE.
+ */
+ protected boolean isElement(Node node) {
+ return isNodeType(node, Node.ELEMENT_NODE);
+ }
+
+ /**
+ * Wrapper around {@link Node#getNodeType} test that returns false for a <code>null</code> node.
+ */
+ protected boolean isNodeType(Node node, int type) {
+ return (node != null) && (node.getNodeType() == type);
+ }
+
+ /**
+ * Returns true if node is non-null and is of type TEXT_NODE.
+ */
+ protected boolean isText(Node node) {
+ return isNodeType(node, Node.TEXT_NODE);
+ }
+
+ /**
+ * Retrieves the node that should follow the element with the given name by using the list of
+ * ordered node names.
+ *
+ * @param element The element to which a new child element will be added
+ * @param nodeName The name of the new node
+ * @param namesOrder The list of names used to determine the insertion point
+ * @return The node used to indicate the new node needs to be inserted before that node or
+ * <code>null</code> if no node was found
+ */
+ public final Node nodeOfInsertion(Element element,
+ List<? extends Node> children,
+ String nodeName,
+ List<String> namesOrder) {
+
+ if (namesOrder.isEmpty()) {
+ return null;
+ }
+
+ int count = namesOrder.size();
+
+ for (Node child : children) {
+ String childName = getNodeName(child);
+
+ for (int index = namesOrder.indexOf(nodeName) + 1; index < count; index++) {
+ String name = namesOrder.get(index);
+
+ if (ObjectTools.equals(childName, name)) {
+ return child;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Releases the previously acquired lock from the document.
+ */
+ public final void releaseReadLock() {
+ getHelper().releaseReadLock();
+ }
+
+ /**
+ * Removes the given element from its parent element. The parent element
+ * is the element encapsulated by this model.
+ *
+ * @param element The child element to remove from its parent
+ */
+ public final void remove(Element element) {
+
+ Element parent = getElement();
+
+ if (parent != null) {
+ remove(parent, element);
+ }
+ }
+
+ /**
+ * Removes the given element from its parent element.
+ *
+ * @param element The parent of the element to remove
+ * @param childElement The child to remove from its parent
+ */
+ public final void remove(Element element, Element childElement) {
+ getHelper().remove(this, element, childElement);
+ }
+
+ /**
+ * Removes the child element from its parent element at the given position. The parent element is
+ * the element encapsulated by this model.
+ *
+ * @param parent The parent of this external form used to retrieve the parent element
+ * @param elementName The name of the child element to remove
+ * @param index The index of the child that has the given element name to remove
+ */
+ public final void removeChild(AbstractExternalForm parent, String elementName, int index) {
+ removeChild(parent.getElement(), elementName, index);
+ }
+
+ /**
+ * Removes the child element from its parent element at the given position. The parent element is
+ * the element encapsulated by this model.
+ *
+ * @param element The element from which the child at the given index will be removed
+ * @param elementName The name of the child element to remove
+ * @param index The index of the child that has the given element name to remove
+ */
+ public final void removeChild(Element element, int index) {
+
+ Element childElement = getChild(element, index);
+
+ if (childElement != null) {
+ remove(element, childElement);
+ }
+ }
+
+ /**
+ * Removes the child element from its parent element at the given position. The parent element is
+ * the element encapsulated by this model.
+ *
+ * @param element The element from which the child with the given name will be removed
+ * @param elementName The name of the child element to remove
+ */
+ public final void removeChild(Element element, String elementName) {
+
+ Element childElement = getChild(element, elementName);
+
+ if (childElement != null) {
+ remove(element, childElement);
+ }
+ }
+
+ /**
+ * Removes the child element from its parent element at the given position. The parent element is
+ * the element encapsulated by this model.
+ *
+ * @param element The element from which the child at the given position with the given name will be removed
+ * @param elementName The name of the child element to remove
+ * @param index The index of the child that has the given element name to remove
+ */
+ public final void removeChild(Element element, String elementName, int index) {
+
+ Element childElement = getChild(element, elementName, index);
+
+ if (childElement != null) {
+ remove(element, childElement);
+ }
+ }
+
+ /**
+ * Removes the child element from its parent element. The parent element is the element
+ * encapsulated by this model.
+ *
+ * @param elementName The name of the child element to remove
+ */
+ public final void removeChild(String elementName) {
+
+ Element element = getChild(elementName);
+
+ if (element != null) {
+ remove(getElement(), element);
+ }
+ }
+
+ /**
+ * Removes the child element from its parent element at the given position. The parent element is
+ * the element encapsulated by this model.
+ *
+ * @param elementName The name of the child element to remove
+ * @param index The index of the child that has the given element name to remove
+ */
+ public final void removeChild(String elementName, int index) {
+ removeChild(getElement(), elementName, index);
+ }
+
+ /**
+ * Removes the child element from its parent element. The parent element is the element
+ * encapsulated by this model.
+ *
+ * @param node The node from which the children with the given name will be removed
+ * @param elementName The name of the child element to remove
+ */
+ public final void removeChildren(Node node, String elementName) {
+ getHelper().removeChildren(this, node, elementName);
+ }
+
+ /**
+ * Removes the child element from its parent element. The parent element is the element
+ * encapsulated by this model.
+ *
+ * @param elementName The name of the child element to remove
+ */
+ public final void removeChildren(String elementName) {
+
+ Element element = getElement();
+
+ if (element != null) {
+ removeChildren(element, elementName);
+ }
+ }
+
+ /**
+ * Removes this model's element from its parent element.
+ */
+ public void removeSelf() {
+
+ Element element = getElement();
+
+ if ((parent != null) && (element != null)) {
+ parent.remove(element);
+ }
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value.
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttribute(Element element, String attributeName, Boolean value) {
+ setAttribute(element, attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value.
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttribute(Element element,
+ String attributeName,
+ Boolean value,
+ List<String> attributeNamesOrder) {
+
+ setAttribute(
+ element,
+ attributeName,
+ (value != null) ? value.toString() : null,
+ attributeNamesOrder
+ );
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value.
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttribute(Element element, String attributeName, Enum<?> value) {
+ setAttribute(element, attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value.
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttribute(Element element,
+ String attributeName,
+ Enum<?> value,
+ List<String> attributeNamesOrder) {
+
+ setAttribute(
+ element,
+ attributeName,
+ (value != null) ? value.toString() : null,
+ attributeNamesOrder
+ );
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value.
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttribute(Element element, String attributeName, Number value) {
+ setAttribute(element, attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value.
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttribute(Element element,
+ String attributeName,
+ Number value,
+ List<String> attributeNamesOrder) {
+
+ setAttribute(
+ element,
+ attributeName,
+ (value != null) ? value.toString() : null,
+ attributeNamesOrder
+ );
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value.
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttribute(Element element, String attributeName, String value) {
+ setAttribute(element, attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value.
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttribute(Element element,
+ String attributeName,
+ String value,
+ List<String> attributeNamesOrder) {
+
+ getHelper().setAttribute(this, element, attributeName, value, attributeNamesOrder);
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value.
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttribute(String attributeName, Boolean value) {
+ setAttribute(attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value.
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttribute(String attributeName,
+ Boolean value,
+ List<String> attributeNamesOrder) {
+
+ Element element = getElement();
+
+ if ((element == null) && (value == null)) {
+ return;
+ }
+
+ if (element == null) {
+ element = addSelf();
+ }
+
+ setAttribute(element, attributeName, value, attributeNamesOrder);
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value.
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttribute(String attributeName, Enum<?> value) {
+ setAttribute(attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value.
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttribute(String attributeName,
+ Enum<?> value,
+ List<String> attributeNamesOrder) {
+
+ Element element = getElement();
+
+ if ((element == null) && (value == null)) {
+ return;
+ }
+
+ if (element == null) {
+ element = addSelf();
+ }
+
+ setAttribute(element, attributeName, value, attributeNamesOrder);
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value.
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttribute(String attributeName, Number value) {
+ setAttribute(attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value.
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttribute(String attributeName,
+ Number value,
+ List<String> attributeNamesOrder) {
+
+ Element element = getElement();
+
+ if ((element == null) && (value == null)) {
+ return;
+ }
+
+ if (element == null) {
+ element = addSelf();
+ }
+
+ setAttribute(element, attributeName, value, attributeNamesOrder);
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value.
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttribute(String attributeName, String value) {
+ setAttribute(attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value.
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttribute(String attributeName,
+ String value,
+ List<String> attributeNamesOrder) {
+
+ Element element = getElement();
+
+ if ((element == null) && (value == null)) {
+ return;
+ }
+
+ if (element == null) {
+ element = addSelf();
+ }
+
+ setAttribute(element, attributeName, value, attributeNamesOrder);
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value. The name will be formatted with
+ * the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttributeNS(Element element, String attributeName, Boolean value) {
+ setAttributeNS(element, attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value. The name will be formatted with
+ * the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttributeNS(Element element,
+ String attributeName,
+ Boolean value,
+ List<String> attributeNamesOrder) {
+
+ setAttributeNS(
+ element,
+ attributeName,
+ (value != null) ? value.toString() : null,
+ attributeNamesOrder
+ );
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value. The name will be formatted with
+ * the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
+ * will be removed
+ */
+ public final void setAttributeNS(Element element, String attributeName, Enum<?> value) {
+ setAttributeNS(element, attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value. The name will be formatted with
+ * the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttributeNS(Element element,
+ String attributeName,
+ Enum<?> value,
+ List<String> attributeNamesOrder) {
+
+ setAttributeNS(
+ element,
+ attributeName,
+ (value != null) ? value.toString() : null,
+ attributeNamesOrder
+ );
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value. The name will be formatted with
+ * the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttributeNS(Element element, String attributeName, Number value) {
+ setAttributeNS(element, attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value. The name will be formatted with
+ * the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttributeNS(Element element,
+ String attributeName,
+ Number value,
+ List<String> attributeNamesOrder) {
+
+ setAttributeNS(
+ element,
+ attributeName,
+ (value != null) ? value.toString() : null,
+ attributeNamesOrder
+ );
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value. The name will be formatted with
+ * the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttributeNS(Element element, String attributeName, String value) {
+ setAttributeNS(element, attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the given element with the given value. The name will be formatted with
+ * the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttributeNS(Element element,
+ String attributeName,
+ String value,
+ List<String> attributeNamesOrder) {
+
+ getHelper().setAttributeNS(this, element, attributeName, value, attributeNamesOrder);
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value. The
+ * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttributeNS(String attributeName, Boolean value) {
+ setAttributeNS(attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value. The
+ * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttributeNS(String attributeName,
+ Boolean value,
+ List<String> attributeNamesOrder) {
+
+ setAttributeNS(attributeName, value != null ? value.toString() : null, attributeNamesOrder);
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value. The
+ * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttributeNS(String attributeName, Enum<?> value) {
+ setAttributeNS(attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value. The
+ * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttributeNS(String attributeName,
+ Enum<?> value,
+ List<String> attributeNamesOrder) {
+
+ setAttributeNS(attributeName, value != null ? value.toString() : null, attributeNamesOrder);
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value. The
+ * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttributeNS(String attributeName, Number value) {
+ setAttributeNS(attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value. The
+ * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttributeNS(String attributeName,
+ Number value,
+ List<String> attributeNamesOrder) {
+
+ setAttributeNS(attributeName, value != null ? value.toString() : null, attributeNamesOrder);
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the
+ * given value. The name will be formatted with the namespace URI:
+ * "<namespaceURI>:attributeName".
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ */
+ public final void setAttributeNS(String attributeName, String value) {
+ setAttributeNS(attributeName, value, getAttributeNamesOrder());
+ }
+
+ /**
+ * Sets an attribute on the element represented by this external form with the given value. The
+ * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ public final void setAttributeNS(String attributeName,
+ String value,
+ List<String> attributeNamesOrder) {
+
+ Element element = getElement();
+
+ if ((element == null) && (value == null)) {
+ return;
+ }
+
+ if (element == null) {
+ element = addSelf();
+ }
+
+ setAttributeNS(element, attributeName, value, attributeNamesOrder);
+ }
+
+ /**
+ * Renames the given element represented by this external form.
+ *
+ * @param element The element to rename
+ * @param elementName The new name of the element
+ */
+ public final void setElementName(Element element, String elementName) {
+ getHelper().setElementName(this, element, elementName, getElementNamesOrder());
+ }
+
+ /**
+ * Sets the namespace with the given one.
+ *
+ * @param uri The URI of the namespace
+ */
+ public final void setNamespace(String uri) {
+ getHelper().setNamespace(this, uri);
+ }
+
+ /**
+ * Sets the schema location with the given one.
+ *
+ * @param uri The URI of the XML schema
+ */
+ public final void setSchemaLocation(String uri) {
+ getHelper().setSchemaLocation(this, uri);
+ }
+
+ /**
+ * Updates the given element's text value.
+ *
+ * @param element The element to update its text value
+ * @param value The new value of the given element
+ */
+ public final void setTextNode(Element element, String value) {
+ updateTextNode(element, getElementName(), value);
+ }
+
+ /**
+ * Updates this external form's element text value.
+ *
+ * @param value The new value of this form's element
+ */
+ public final void setTextNode(String value) {
+ updateTextNode(
+ getParent().getElement(),
+ getElementName(),
+ value,
+ getParent().getElementNamesOrder()
+ );
+ }
+
+ /**
+ * Sets the version attribute of this element to the provided version.
+ *
+ * @param version version attribute value.
+ */
+ public final void setVersion(String version) {
+ setAttribute(XSD_VERSION, version);
+ }
+
+ /**
+ * Updates the attribute's value of a child element.
+ *
+ * @param childName The name of the child to update one of its attributes
+ * @param attributeName The name of the attribute to update its value
+ * @param value The new value of the attribute
+ */
+ public final void updateChildAttribute(String childName, String attributeName, Boolean value) {
+ updateChildAttribute(childName, attributeName, (value != null) ? value.toString() : null);
+ }
+
+ /**
+ * Updates the attribute's value of a child element.
+ *
+ * @param childName The name of the child to update one of its attributes
+ * @param attributeName The name of the attribute to update its value
+ * @param value The new value of the attribute
+ */
+ public final void updateChildAttribute(String childName, String attributeName, Enum<?> value) {
+ updateChildAttribute(childName, attributeName, (value != null) ? value.name() : null);
+ }
+
+ /**
+ * Updates the attribute's value of a child element.
+ *
+ * @param childName The name of the child to update one of its attributes
+ * @param attributeName The name of the attribute to update its value
+ * @param value The new value of the attribute
+ */
+ public final void updateChildAttribute(String childName, String attributeName, Number value) {
+ updateChildAttribute(childName, attributeName, (value != null) ? value.toString() : null);
+ }
+
+ /**
+ * Updates the attribute's value of a child element.
+ *
+ * @param childName The name of the child to update one of its attributes
+ * @param attributeName The name of the attribute to update its value
+ * @param value The new value of the attribute
+ */
+ public final void updateChildAttribute(String childName, String attributeName, String value) {
+
+ Element element = getChild(childName);
+
+ if ((element == null) && (value != null)) {
+ element = addChild(childName);
+ }
+
+ if (value != null) {
+ setAttribute(element, attributeName, value);
+ }
+ else if (element != null) {
+ removeChild(childName);
+ }
+ }
+
+ /**
+ * Updates the child text node of a child element.
+ *
+ * @param parentChildName The name of the child to retrieve its child with the given child name
+ * @param childName The child of a child to update its text value
+ * @param value The new value of the text node
+ */
+ public final void updateChildChildTextNode(String parentChildName,
+ String childName,
+ Boolean value) {
+
+ updateChildChildTextNode(parentChildName, childName, (value != null) ? value.toString() : null);
+ }
+
+ /**
+ * Updates the child text node of a child element.
+ *
+ * @param parentChildName The name of the child to retrieve its child with the given child name
+ * @param childName The child of a child to update its text value
+ * @param value The new value of the text node
+ */
+ public final void updateChildChildTextNode(String parentChildName,
+ String childName,
+ Enum<?> value) {
+
+ updateChildChildTextNode(parentChildName, childName, (value != null) ? value.name() : null);
+ }
+
+ /**
+ * Updates the child text node of a child element.
+ *
+ * @param parentChildName The name of the child to retrieve its child with the given child name
+ * @param childName The child of a child to update its text value
+ * @param value The new value of the text node
+ */
+ public final void updateChildChildTextNode(String parentChildName,
+ String childName,
+ Number value) {
+
+ updateChildChildTextNode(parentChildName, childName, (value != null) ? value.toString() : null);
+ }
+
+ /**
+ * Updates the child text node of a child element.
+ *
+ * @param parentChildName The name of the child to retrieve its child with the given child name
+ * @param childName The child of a child to update its text value
+ * @param value The new value of the text node
+ */
+ public final void updateChildChildTextNode(String parentChildName, String childName, String value) {
+
+ Element element = getChild(parentChildName);
+
+ if ((element == null) && (value != null)) {
+ element = addChild(parentChildName);
+ }
+
+ updateTextNode(element, childName, value);
+ }
+
+ /**
+ * Updates the child element's text with the given value. If the value is <code>null</code>, then
+ * the element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param elementName The child element's name
+ * @param value The new element's text
+ */
+ public final void updateChildTextNode(String elementName, Boolean value) {
+ updateChildTextNode(elementName, value, getElementNamesOrder());
+ }
+
+ /**
+ * Updates the child element's text with the given value. If the value is <code>null</code>, then
+ * the element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param elementName The child element's name
+ * @param value The new element's text
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ */
+ public final void updateChildTextNode(String elementName,
+ Boolean value,
+ List<String> elementNamesOrder) {
+
+ updateChildTextNode(elementName, (value != null) ? value.toString() : null, elementNamesOrder);
+ }
+
+ /**
+ * Updates the child element's text with the given value. If the value is <code>null</code>, then
+ * the element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param elementName The child element's name
+ * @param value The new element's text
+ */
+ public final void updateChildTextNode(String elementName, Enum<?> value) {
+ updateChildTextNode(elementName, value, getElementNamesOrder());
+ }
+
+ /**
+ * Updates the child element's text with the given value. If the value is <code>null</code>, then
+ * the element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param elementName The child element's name
+ * @param value The new element's text
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ */
+ public final void updateChildTextNode(String elementName,
+ Enum<?> value,
+ List<String> elementNamesOrder) {
+
+ updateChildTextNode(elementName, (value != null) ? value.toString() : null, elementNamesOrder);
+ }
+
+ /**
+ * Updates the child element's text with the given value. If the value is <code>null</code>, then
+ * the element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param elementName The child element's name
+ * @param value The new element's text
+ */
+ public final void updateChildTextNode(String elementName, Number value) {
+ updateChildTextNode(elementName, value, getElementNamesOrder());
+ }
+
+ /**
+ * Updates the child element's text with the given value. If the value is <code>null</code>, then
+ * the element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param elementName The child element's name
+ * @param value The new element's text
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ */
+ public final void updateChildTextNode(String elementName,
+ Number value,
+ List<String> elementNamesOrder) {
+
+ updateChildTextNode(elementName, (value != null) ? value.toString() : null, elementNamesOrder);
+ }
+
+ /**
+ * Updates the child element's text with the given value. If the value is <code>null</code>, then
+ * the element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param elementName The child element's name
+ * @param value The new element's text
+ */
+ public final void updateChildTextNode(String elementName, String value) {
+ updateChildTextNode(elementName, value, getElementNamesOrder());
+ }
+
+ /**
+ * Updates the child element's text with the given value. If the value is <code>null</code>, then
+ * the element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param elementName The child element's name
+ * @param value The new element's text
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ */
+ public final void updateChildTextNode(String elementName,
+ String value,
+ List<String> elementNamesOrder) {
+
+ Element element = getElement();
+
+ // Nothing to change
+ if ((element == null) && (value == null)) {
+ return;
+ }
+
+ // Automatically create the element
+ if (element == null) {
+ element = addSelf();
+ }
+
+ // Create or update the child text node
+ updateTextNode(element, elementName, value, elementNamesOrder);
+ }
+
+ /**
+ * Updates the child text node with the given value. If the value is <code>null</code>, then the
+ * element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param element The parent element used to retrieve the child element
+ * @param elementName The child element's name
+ * @param value The new element's text
+ */
+ public final void updateTextNode(Element element, String elementName, Boolean value) {
+ updateTextNode(element, elementName, value, getElementNamesOrder());
+ }
+
+ /**
+ * Updates the child text node with the given value. If the value is <code>null</code>, then the
+ * element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param element The parent element used to retrieve the child element
+ * @param elementName The child element's name
+ * @param value The new element's text
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ */
+ public final void updateTextNode(Element element,
+ String elementName,
+ Boolean value,
+ List<String> elementNamesOrder) {
+
+ updateTextNode(element, elementName, (value == null) ? null : value.toString(), elementNamesOrder);
+ }
+
+ /**
+ * Updates the child text node with the given value. If the value is <code>null</code>, then the
+ * element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param element The parent element used to retrieve the child element
+ * @param elementName The child element's name
+ * @param value The new element's text
+ */
+ public final void updateTextNode(Element element, String elementName, Enum<?> value) {
+ updateTextNode(element, elementName, value, getElementNamesOrder());
+ }
+
+ /**
+ * Updates the child text node with the given value. If the value is <code>null</code>, then the
+ * element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param element The parent element used to retrieve the child element
+ * @param elementName The child element's name
+ * @param value The new element's text
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ */
+ public final void updateTextNode(Element element,
+ String elementName,
+ Enum<?> value,
+ List<String> elementNamesOrder) {
+
+ updateTextNode(element, elementName, (value != null) ? value.toString() : null, elementNamesOrder);
+ }
+
+ /**
+ * Updates the child text node with the given value. If the value is <code>null</code>, then the
+ * element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param element The parent element used to retrieve the child element
+ * @param elementName The child element's name
+ * @param value The new element's text
+ */
+ public final void updateTextNode(Element element, String elementName, Number value) {
+ updateTextNode(element, elementName, value, getElementNamesOrder());
+ }
+
+ /**
+ * Updates the child text node with the given value. If the value is <code>null</code>, then the
+ * element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param element The parent element used to retrieve the child element
+ * @param elementName The child element's name
+ * @param value The new element's text
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ */
+ public final void updateTextNode(Element element,
+ String elementName,
+ Number value,
+ List<String> elementNamesOrder) {
+
+ updateTextNode(element, elementName, (value != null) ? value.toString() : null, elementNamesOrder);
+ }
+
+ /**
+ * Updates the child text node with the given value. If the value is <code>null</code>, then the
+ * element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then it will be added.
+ *
+ * @param element The parent element used to retrieve the child element
+ * @param elementName The child element's name
+ * @param value The new element's text
+ */
+ public final void updateTextNode(Element element, String elementName, String value) {
+ updateTextNode(element, elementName, value, getElementNamesOrder());
+ }
+
+ /**
+ * Updates the child text node with the given value. If the value is <code>null</code>, then the
+ * child element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then the child will be added.
+ *
+ * @param element The parent element used to retrieve the child element
+ * @param elementName The child element's name
+ * @param value The new element's text
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ */
+ public final void updateTextNode(Element element,
+ String elementName,
+ String value,
+ List<String> elementNamesOrder) {
+
+ Element childElement = getChild(element, elementName);
+
+ // Remove the child element if the value is null
+ if ((childElement != null) && (value == null)) {
+ remove(element, childElement);
+ return;
+ }
+
+ boolean valueNotEmpty = !StringTools.isBlank(value);
+
+ // Add a text node if the element is null and the value isn't
+ if ((childElement == null) && valueNotEmpty) {
+ addChildTextNode(element, elementName, value, elementNamesOrder);
+ }
+ // Update the element's text content
+ else if ((childElement != null) && valueNotEmpty) {
+ getHelper().updateTextNode(this, elementName, childElement, value);
+ }
+ }
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/DefaultFormHelper.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/DefaultFormHelper.java
new file mode 100644
index 0000000..0110a88
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/DefaultFormHelper.java
@@ -0,0 +1,405 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping;
+
+import java.net.URL;
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.orm.ORMDocumentType;
+import org.eclipse.persistence.tools.mapping.orm.dom.ORMConfiguration;
+import org.eclipse.persistence.tools.mapping.persistence.PersistenceDocumentType;
+import org.eclipse.persistence.tools.mapping.persistence.dom.PersistenceConfiguration;
+import org.eclipse.persistence.tools.utility.TextRange;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+import static org.eclipse.persistence.tools.mapping.AbstractExternalForm.*;
+import static org.eclipse.persistence.tools.mapping.orm.ORMXmlConstants.*;
+import static org.eclipse.persistence.tools.mapping.persistence.PersistenceXmlConstants.*;
+
+/**
+ * The default implementation of {@link ExternalFormHelper} that directly manipulate the document.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.<p>
+ *
+ * @version 2.6
+ */
+@SuppressWarnings("nls")
+public class DefaultFormHelper implements ExternalFormHelper {
+
+ /**
+ * The XML document to manipulate.
+ */
+ private final Document document;
+
+ /**
+ * The location of the XML document on the file system.
+ */
+ private final URL location;
+
+ /**
+ * Creates a new <code>FormHelper</code>.
+ *
+ * @param document The XML document to manipulate
+ * @param location The location of the XML document on the file system
+ */
+ public DefaultFormHelper(Document document, URL location) {
+ super();
+ this.document = document;
+ this.location = location;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void acquireReadLock() {
+ // Nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Element addChild(AbstractExternalForm externalForm,
+ Element element,
+ String elementName,
+ List<String> elementNamesOrder) {
+
+ // Create the child node
+ Element childElement = document.createElement(elementName);
+
+ // Insert the new child node at the right location
+ Element elementOfInsertion = externalForm.elementOfInsertion(
+ element,
+ elementName,
+ elementNamesOrder
+ );
+
+ element.insertBefore(childElement, elementOfInsertion);
+
+ return childElement;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Element addChildTextNode(AbstractExternalForm externalForm,
+ Element element,
+ String elementName,
+ String value,
+ List<String> elementNamesOrder) {
+
+ // Create the child text node
+ Element childElement = getDocument().createElement(elementName);
+
+ Text text = getDocument().createTextNode(value);
+ text.setNodeValue(value);
+
+ childElement.appendChild(text);
+
+ // Insert the new child text node at the right location
+ Element elementOfInsertion = externalForm.elementOfInsertion(element, elementName, elementNamesOrder);
+ element.insertBefore(childElement, elementOfInsertion);
+
+ return childElement;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Element buildORMConfiguration(ORMConfiguration orm) {
+
+ Element element = document.createElementNS(ECLIPSELINK_ORM_NAMESPACE_URI, orm.getElementName());
+ element.setAttributeNS(XMLNS_URI, XMLNS_ATTRIBUTE, ECLIPSELINK_ORM_NAMESPACE_URI);
+ orm.addXmlns(element, "xsi", XSI_URI);
+ element.setAttributeNS(XSI_URI, XSI_SCHEMA_LOCATION, orm.buildSchemaLocation(ORMDocumentType.ECLIPELINK_2_6));
+ element.setAttribute(XSD_VERSION, orm.getBuildVersion());
+
+ document.appendChild(element);
+
+ return element;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Element buildPersistenceConfiguration(PersistenceConfiguration persistence) {
+
+ Element element = document.createElementNS(PERSISTENCE_NAMESPACE_URI, persistence.getElementName());
+ element.setAttributeNS(XMLNS_URI, XMLNS_ATTRIBUTE, PERSISTENCE_NAMESPACE_URI);
+ persistence.addXmlns(element, "xsi", XSI_URI);
+ element.setAttributeNS(XSI_URI, XSI_SCHEMA_LOCATION, persistence.buildSchemaLocation(PersistenceDocumentType.JPA_2_1));
+ element.setAttribute(XSD_VERSION, persistence.getBuildVersion());
+
+ document.appendChild(element);
+
+ return element;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Document getDocument() {
+ return document;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getElementNameTextRange(AbstractExternalForm externalForm, Element element) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public URL getLocation() {
+ return location;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getTextNodeTextRange(AbstractExternalForm externalForm, Node element) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getTextRange(AbstractExternalForm externalForm, Attr attribute) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getTextRange(AbstractExternalForm externalForm, Element element) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void releaseReadLock() {
+ // Nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void remove(AbstractExternalForm externalForm, Element element, Element childElement) {
+ element.removeChild(childElement);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeChildren(AbstractExternalForm externalForm, Node node, String elementName) {
+ for (Element childElement : externalForm.getChildren(node, elementName)) {
+ node.removeChild(childElement);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setAttribute(AbstractExternalForm externalForm,
+ Element element,
+ String attributeName,
+ String value,
+ List<String> attributeNamesOrder) {
+
+ // Remove the attribute
+ if (value == null) {
+ element.removeAttribute(attributeName);
+ }
+ // Update the attribute's value
+ else if (externalForm.hasAttribute(attributeName)) {
+ element.setAttribute(attributeName, value);
+ }
+ // Add a new attribute
+ else {
+
+ // Create the attribute node
+ Attr newAttribute = getDocument().createAttribute(attributeName);
+ newAttribute.setValue(value);
+
+ // Insert the new attribute node at the right location
+ List<Attr> attributes = externalForm.getAttributes(element);
+ Attr elementOfInsertion = (Attr) externalForm.nodeOfInsertion(element, attributes, attributeName, attributeNamesOrder);
+
+ // The attribute needs to be inserted before another attribute.
+ // Remove the attributes so they can be re-added in proper order
+ if (elementOfInsertion != null) {
+ int indexOfInsertion = attributes.indexOf(elementOfInsertion);
+
+ // Remove the attributes
+ for (int index = attributes.size(); --index >= 0; ) {
+ Node attributeNode = attributes.get(index);
+ element.removeAttribute(attributeNode.getNodeName());
+ }
+
+ // Inserts the new attribute at the right location
+ attributes.add(indexOfInsertion, newAttribute);
+
+ // Re-add the attributes
+ for (int index = 0; index < attributes.size(); index++) {
+ Attr attribute = attributes.get(index);
+ element.setAttributeNode(attribute);
+ }
+ }
+ // This will insert the attribute at the end of the list of attributes
+ else {
+ element.setAttribute(attributeName, value);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setAttributeNS(AbstractExternalForm externalForm,
+ Element element,
+ String attributeName,
+ String value,
+ List<String> attributeNamesOrder) {
+
+ // Remove the attribute
+ if (value == null) {
+ element.removeAttributeNS(XSI_URI, attributeName);
+ }
+ // Update the attribute's value
+ else if (externalForm.hasAttribute(attributeName)) {
+ attributeName = externalForm.buildQualifiedName(attributeName);
+ element.setAttributeNS(XSI_URI, attributeName, value);
+ }
+ // Add a new attribute
+ else {
+
+ // Create the attribute node
+ attributeName = externalForm.buildQualifiedName(attributeName);
+ Attr newAttribute = getDocument().createAttributeNS(XSI_URI, attributeName);
+ newAttribute.setValue(value);
+
+ // Insert the new attribute node at the right location
+ List<Attr> attributes = externalForm.getAttributes(element);
+
+ Attr elementOfInsertion = (Attr) externalForm.nodeOfInsertion(element, attributes, attributeName, attributeNamesOrder);
+
+ // The attribute needs to be inserted before another attribute.
+ // Remove the attributes so they can be re-added in proper order
+ if (elementOfInsertion != null) {
+ int indexOfInsertion = attributes.indexOf(elementOfInsertion);
+
+ // Remove the attributes
+ for (int index = attributes.size(); --index >= 0; ) {
+ Node attributeNode = attributes.get(index);
+ element.removeAttribute(attributeNode.getNodeName());
+ }
+
+ // Inserts the new attribute at the right location
+ attributes.add(indexOfInsertion, newAttribute);
+
+ // Re-add the attributes
+ for (int index = 0, count = attributes.size(); index < count; index++) {
+ Attr attribute = attributes.get(index);
+ element.setAttributeNode(attribute);
+ }
+ }
+ // This will insert the attribute at the end of the list of attributes
+ else {
+ element.setAttributeNS(XSI_URI, attributeName, value);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setElementName(AbstractExternalForm externalForm,
+ Element element,
+ String elementName,
+ List<String> elementNamesOrder) {
+
+ // First remove the existing node and add the new node
+ getDocument().removeChild(element);
+ Element newElement = externalForm.addSelf(elementName, elementNamesOrder);
+
+ // Now add the new node, which will have the new element name
+
+ // Copy all the children to the new node
+ for (Node childNode : externalForm.getAllChildren(element)) {
+ newElement.appendChild(childNode);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setNamespace(AbstractExternalForm externalForm, String uri) {
+ Element rootElement = externalForm.getRootElement();
+ rootElement.setAttributeNS(XMLNS_URI, XMLNS_ATTRIBUTE, uri);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setSchemaLocation(AbstractExternalForm externalForm, String uri) {
+ Element rootElement = externalForm.getRootElement();
+ rootElement.setAttributeNS(XSI_URI, XSI_SCHEMA_LOCATION, uri);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void updateTextNode(AbstractExternalForm externalForm,
+ String elementName,
+ Element childElement,
+ String value) {
+
+ Text text = externalForm.findTextNode(childElement);
+
+ if (text == null) {
+ text = getDocument().createTextNode(value);
+ childElement.appendChild(text);
+ }
+ else {
+ text.setNodeValue(value);
+ }
+ }
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalForm.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalForm.java
similarity index 73%
rename from tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalForm.java
rename to tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalForm.java
index 8d079b7..642be57 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalForm.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalForm.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -11,7 +11,9 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.persistence.tools.mapping.orm;
+package org.eclipse.persistence.tools.mapping;
+
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface is the root interface that any external form should extends.
@@ -21,8 +23,14 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
public interface ExternalForm {
+
+ /**
+ * Returns the {@link TextRange} for the entire element represented by this form.
+ *
+ * @return The {@link TextRange} of this form's element or <code>null</code> if the element does not exist
+ */
+ TextRange getTextRange();
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalFormHelper.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalFormHelper.java
new file mode 100644
index 0000000..6f82e8e
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalFormHelper.java
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping;
+
+import java.net.URL;
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.orm.dom.ORMConfiguration;
+import org.eclipse.persistence.tools.mapping.persistence.dom.PersistenceConfiguration;
+import org.eclipse.persistence.tools.utility.TextRange;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * This helper is used by {@link AbstractExternalForm} and completes its behavior when it needs to
+ * modify the document.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.<p>
+ *
+ * @version 2.6
+ */
+public interface ExternalFormHelper {
+
+ /**
+ * Acquires a lock before reading the document.
+ */
+ void acquireReadLock();
+
+ /**
+ * Adds a new child element to the given element. The child element will be added at the end of
+ * the list of children.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param element The element to which a new child element will be added
+ * @param elementName The name of the new child element
+ * @param elementNamesOrder The list of element names used to determine the insertion point
+ * @return The newly created child element
+ */
+ Element addChild(AbstractExternalForm externalForm,
+ Element element,
+ String elementName,
+ List<String> elementNamesOrder);
+
+ /**
+ * Adds a child text node to the given parent element.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param element The element to which a new child element will be added
+ * @param elementName The name of the new child element
+ * @param value The node's text
+ * @param index The index of insertion within the collection of children
+ * @return The newly created element
+ */
+ Element addChildTextNode(AbstractExternalForm externalForm,
+ Element element,
+ String elementName,
+ String value,
+ List<String> elementNamesOrder);
+
+ /**
+ *
+ * @param ormConfiguration
+ */
+ Element buildORMConfiguration(ORMConfiguration ormConfiguration);
+
+ /**
+ *
+ * @param persistence
+ */
+ Element buildPersistenceConfiguration(PersistenceConfiguration persistence);
+
+ /**
+ * Returns the document being modify by the external form.
+ *
+ * @return The document being modify by the external form
+ */
+ Document getDocument();
+
+ /**
+ * Retrieves the {@link TextRange} for the name of the given {@link Element} within the document.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param attribute The {@link Element} to retrieve the {@link TextRange} for its name
+ * @return The {@link TextRange} of the given {@link Element}'s name
+ */
+ TextRange getElementNameTextRange(AbstractExternalForm externalForm, Element element);
+
+ /**
+ * Returns the location on the file system of the document.
+ *
+ * @return The location on the file system of the document
+ */
+ URL getLocation();
+
+ /**
+ * Retrieves the {@link TextRange} of the given text node's value.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param element The node from which the {@link TextRange} is retrieved
+ * @return The {@link TextRange} of the node's text
+ */
+ TextRange getTextNodeTextRange(AbstractExternalForm externalForm, Node element);
+
+ /**
+ * Retrieves the {@link TextRange} for the given {@link Attr} within the document.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param attribute The {@link Attr} to retrieve its {@link TextRange}
+ * @return The {@link TextRange} of the given {@link Attr}'s value
+ */
+ TextRange getTextRange(AbstractExternalForm externalForm, Attr attribute);
+
+ /**
+ * Retrieves the {@link TextRange} of the given {@link Node}.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param element The node from which the {@link TextRange} is retrieved
+ * @return The {@link TextRange} of the given {@link Node}
+ */
+ TextRange getTextRange(AbstractExternalForm externalForm, Element element);
+
+ /**
+ * Releases the previously acquired lock from the document.
+ */
+ void releaseReadLock();
+
+ /**
+ * Removes the given {@link Element} from its parent {@link Element}.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param element The parent of the {@link Element} to remove
+ * @param childElement The child to remove from its parent
+ */
+ void remove(AbstractExternalForm externalForm, Element element, Element childElement);
+
+ /**
+ * Removes the child {@link Element} from the given {@link Element}.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param node The node from which the children with the given name will be removed
+ * @param elementName The name of the child element to remove
+ */
+ void removeChildren(AbstractExternalForm externalForm, Node node, String elementName);
+
+ /**
+ * Sets an attribute on the given element with the given value.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ void setAttribute(AbstractExternalForm externalForm,
+ Element element,
+ String attributeName,
+ String value,
+ List<String> attributeNamesOrder);
+
+ /**
+ * Sets an attribute on the given element with the given value. The name will be formatted with
+ * the namespace URI: "<namespaceURI>:attributeName".
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param element The element to have one of its attributes updated
+ * @param attributeName The name of the attribute
+ * @param value The value of the attribute. If the value is <code>null</code>, then the attribute will be removed
+ * @param attributeNamesOrder The list of attribute names used to determine the insertion
+ */
+ void setAttributeNS(AbstractExternalForm externalForm,
+ Element element,
+ String attributeName,
+ String value,
+ List<String> attributeNamesOrder);
+
+ /**
+ * Renames the given {@link Element}.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param element The {@link Element} to rename
+ * @param elementName The new name of the given {@link Element}
+ * @param elementNamesOrder
+ */
+ void setElementName(AbstractExternalForm externalForm,
+ Element element,
+ String elementName,
+ List<String> elementNamesOrder);
+
+ /**
+ * Sets the namespace with the given one.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param uri The URI of the namespace
+ */
+ void setNamespace(AbstractExternalForm externalForm, String uri);
+
+ /**
+ * Sets the schema location with the given one.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param uri The URI of the XML schema
+ */
+ void setSchemaLocation(AbstractExternalForm externalForm, String uri);
+
+ /**
+ * Updates the child text node with the given value. If the value is <code>null</code>, then the
+ * child element will be removed. If the value is not <code>null</code> but the element is
+ * <code>null</code> then the child will be added.
+ *
+ * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
+ * @param elementName The child element's name
+ * @param childElement The text node to change its value
+ * @param value The new element's text
+ */
+ void updateTextNode(AbstractExternalForm externalForm,
+ String elementName,
+ Element childElement,
+ String value);
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalProperty.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalProperty.java
similarity index 60%
rename from tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalProperty.java
rename to tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalProperty.java
index c033164..f75dc6f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalProperty.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalProperty.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -11,28 +11,43 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.persistence.tools.mapping.orm;
+package org.eclipse.persistence.tools.mapping;
+
+import org.eclipse.persistence.tools.utility.TextRange;
/**
- * This interface and inherited behavior describes the configurable properties for an property. One
- * or more property can be declared as part of an entity
+ * Represents a configuration property key/value pair listed in the properties section of a
+ * persistence unit defined in the persistence configuration xml.
* <p>
* Provisional API: This interface is part of an interim API that is still under development and
* expected to change significantly before reaching stability. It is available at this early stage
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @see org.eclipse.persistence.annotations.Property
- *
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalProperty extends ExternalForm {
/**
- * Returns the index of this element in its owning parent.
+ * The property name used to store and retrieve the name property.
*/
- int getIndex();
+ String NAME = "name";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String PROPERTY = "property";
+
+ /**
+ * The property name used to store and retrieve the value property.
+ */
+ String VALUE = "value";
+
+ /**
+ * The property name used to store and retrieve the value-type property.
+ */
+ String VALUE_TYPE = "value-type";
/**
* Returns the name of the property.
@@ -40,11 +55,21 @@
String getName();
/**
+ * Returns the {@link TextRange} for the name of the property.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Returns the value string for this property.
*/
String getValue();
/**
+ * Returns the {@link TextRange} for the value of the property.
+ */
+ TextRange getValueTextRange();
+
+ /**
* Returns the value type string for this property.
*/
String getValueType();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalPropertyHolder.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalPropertyHolder.java
new file mode 100644
index 0000000..c30659f
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalPropertyHolder.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping;
+
+import java.util.List;
+import org.eclipse.persistence.tools.utility.TextRange;
+
+/**
+ * Defines an external ORM object that holds on to {@link ExternalProperty}. Implementors of this
+ * interface know how to retrieve, remove, and create a property.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.<p>
+ *
+ * @version 2.6
+ */
+@SuppressWarnings("nls")
+public interface ExternalPropertyHolder extends ExternalForm {
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String PROPERTIES = "properties";
+
+ /**
+ * Adds a property to this form.
+ */
+ ExternalProperty addProperty(String name, String value);
+
+ /**
+ * Retrieves the external properties with the given name.
+ *
+ * @param name The name of the properties to retrieve
+ * @return The list of properties with the given name as its key. A list is returned since it's
+ * possible to have more than one properties with the same key
+ */
+ List<ExternalProperty> getProperties(String name);
+
+ /**
+ * Returns the a property with the given name and value. Callers of this method assume that only
+ * one property exists with the given name. If multiple properties exist, acquire the property by
+ * name and value.
+ *
+ * @param index The position of the property to retrieve within the list of properties
+ * @return The external form of the property
+ */
+ ExternalProperty getProperty(int index);
+
+ /**
+ * Retrieves the external property, if one was found, with the given name.
+ *
+ * @param name The name of the key used to retrieve the property
+ * @return The property with the given name or <code>null</code> if none could be found
+ */
+ ExternalProperty getProperty(String name);
+
+ /**
+ * Retrieves the property at the given index from the list of properties with the given name.
+ *
+ * @param name The name used to retrieve the property at the given index within the list of
+ * properties with that same name
+ * @param index The index of the property to retrieve
+ * @return The property at the given index with the given name
+ */
+ ExternalProperty getProperty(String name, int index);
+
+ /**
+ * Retrieves the external property, if one was found, with the given name and value.
+ *
+ * @param name The name used to retrieve the property
+ * @param value The value used to retrieve the property
+ * @return The external property matching the given name and value if one could be found
+ */
+ ExternalProperty getProperty(String name, String value);
+
+ /**
+ * Returns the {@link TextRange} for the value of the "name" attribute defined in a {@link
+ * Element} with the element name "property".
+ * <p>
+ * <<b>property</b> name="name" value="value"/>
+ *
+ * @param name The value of the name attribute
+ * @return The {@link TextRange} of the value of the "value" attribute
+ */
+ TextRange getPropertyNameTextRange(String name);
+
+ /**
+ * Returns the {@link TextRange} for the {@link Element} with the attribute with the given name.
+ * <p>
+ * <<b>property</b> name="name" value="value"/>
+ *
+ * @param name The value of the name attribute
+ * @return The {@link TextRange} of the {@link Element} itself
+ */
+ TextRange getPropertyTextRange(String name);
+
+ /**
+ * Returns the {@link TextRange} for the property with the given name and value.
+ */
+ TextRange getPropertyTextRange(String name, String value);
+
+ /**
+ * Returns the {@link TextRange} for the value of the "value" attribute associated with the
+ * attribute with the given name defined in a {@link Element} with the element name "property".
+ * <p>
+ * <<b>property</b> name="name" value="value"/>
+ *
+ * @param name The value of the name attribute
+ * @return The {@link TextRange} of the value of the "value" attribute
+ */
+ TextRange getPropertyValueTextRange(String name);
+
+ /**
+ * Returns a list of the properties defined for this form.
+ */
+ List<ExternalProperty> properties();
+
+ /**
+ * Returns the count of properties defined for this form.
+ */
+ int propertiesSize();
+
+ /**
+ * Returns the count of properties defined for this form that has the given name.
+ *
+ * @param name The name used to determine the count of properties where their key matches that name
+ * @return The count of properties defined with the given name
+ */
+ int propertiesSize(String name);
+
+ /**
+ * Removes the given property from this form.
+ *
+ * @param index The position of the external property to remove
+ */
+ void removeProperty(int index);
+
+ /**
+ * Removes the first occurrence of the given property from this form.
+ *
+ * @param name The name of the external property to remove
+ */
+ void removeProperty(String name);
+
+ /**
+ * Removes the first occurrence of the given property from this form.
+ *
+ * @param name The name of the external property to remove
+ * @param value The value of the external property to remove
+ */
+ void removeProperty(String name, String value);
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/AccessType.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/AccessType.java
new file mode 100644
index 0000000..e299249
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/AccessType.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping.orm;
+
+/**
+ * This enumeration defines the entity access types supported extending {@link javax.persistence.AccessType}
+ * to include VIRTUAL for dynamic entities.
+ *
+ * @version 2.6
+ */
+public enum AccessType {
+
+ /**
+ * Constant used to specify field access type.
+ */
+ FIELD,
+
+ /**
+ * Constant used to specify property access type.
+ */
+ PROPERTY,
+
+ /**
+ * Constant used to specify virtual access type.
+ */
+ VIRTUAL
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/DataFormatType.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/DataFormatType.java
index 07100b9..4065ef5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/DataFormatType.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/DataFormatType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -18,7 +18,6 @@
*
* @see NoSql
* @see org.eclipse.persistence.eis.EISDescriptor#setDataFormat(String)
- * @author James Sutherland
* @since EclipseLink 2.4
*/
public enum DataFormatType {
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternaNoSqlJoinFieldMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternaNoSqlJoinFieldMapping.java
index 7c3c29c..9ac3f7b 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternaNoSqlJoinFieldMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternaNoSqlJoinFieldMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,31 +13,30 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
/**
- * This inter
+ * This collection mapping can hold onto NoSQL join fields.
* <p>
* Provisional API: This interface is part of an interim API that is still under development and
* expected to change significantly before reaching stability. It is available at this early stage
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @since 2.5
+ * @version 2.6
*/
public interface ExternaNoSqlJoinFieldMapping extends ExternalForm {
/**
* Adds a new NoSQL join field with the given field name.
*/
- void addJoinField(int index, String name);
+ ExternalNoSqlJoinField addJoinField(String name);
/**
* Returns the list of NoSQL join fields.
*/
- ListIterable<ExternalNoSqlJoinField> joinFields();
+ List<ExternalNoSqlJoinField> joinFields();
/**
* Returns the count of NoSQL join fields.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAccessMethods.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAccessMethods.java
index 376f07a..0a9e54d 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAccessMethods.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAccessMethods.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface represents the access methods defined by the EclipseLink JPA spec that are
* available for configuration via the EclipseLink ORM xml.
@@ -22,22 +25,47 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalAccessMethods extends ExternalForm {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String ACCESS_METHODS = "access-methods";
+
+ /**
+ * The attribute name used to store and retrieve the get-method property.
+ */
+ String GET_METHOD = "get-method";
+
+ /**
+ * The attribute name used to store and retrieve the set-method property.
+ */
+ String SET_METHOD = "set-method";
+
+ /**
* Returns the get method.
*/
String getGetMethod();
/**
+ * Returns the {@link TextRange} of the get method.
+ */
+ TextRange getGetMethodTextRange();
+
+ /**
* Returns the set method.
*/
String getSetMethod();
/**
+ * Returns the {@link TextRange} of the get method.
+ */
+ TextRange getSetMethodTextRange();
+
+ /**
* Sets the get method.
*/
void setGetMethod(String getMethodName);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAccessType.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAccessType.java
new file mode 100644
index 0000000..27696c3
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAccessType.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping.orm;
+
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
+/**
+ * This interface defines the type of access used.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.<p>
+ *
+ * @version 2.6
+ */
+@SuppressWarnings("nls")
+public interface ExternalAccessType extends ExternalForm {
+
+ /**
+ * The attribute name used to store and retrieve the access property.
+ */
+ String ACCESS = "access";
+
+ /**
+ * Returns the default access type to be used for entities that comprise this persistence unit.
+ */
+ AccessType getAccessType();
+
+ /**
+ * Returns the {@link TextRange} for the access type for this mapping.
+ */
+ TextRange getAccessTypeTextRange();
+
+ /**
+ * Sets the access default type.
+ */
+ void setAccessType(AccessType type);
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAssociationOverride.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAssociationOverride.java
index 9a506b8..5bb203f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAssociationOverride.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAssociationOverride.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface describes the configurable properties for an association override in the ORM xml.
@@ -28,20 +29,35 @@
* @see javax.persistence.AssociationOverride
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalAssociationOverride extends ExternalForm {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String ASSOCIATION_OVERRIDE = "association-override";
+
+ /**
+ * The element name of the child text node for the description.
+ */
+ String DESCRIPTION = "description";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
* Adds a join column with the given name.
*/
- void addJoinColumn(int index, String name);
+ ExternalJoinColumn addJoinColumn(String name);
/**
* Creates new join table for this relationship mapping replacing the old one.
*/
- void addJoinTable(String tableName);
+ ExternalJoinTable addJoinTable(String tableName);
/**
* Returns the description of the attribute override.
@@ -64,9 +80,14 @@
String getName();
/**
+ * Returns the {@link TextRange} of this association override's name.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Returns the join columns for this association override.
*/
- ListIterable<ExternalJoinColumn> joinColumns();
+ List<ExternalJoinColumn> joinColumns();
/**
* Returns the count of all the join columns for this association override.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAttributeOverride.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAttributeOverride.java
index fd0eefa..d04c4e0 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAttributeOverride.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalAttributeOverride.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface describes the configurable properties for an attribute override in the ORM xml. An
* attribute override can be declared at the root entity level or as a property of an embedded mapping.
@@ -25,14 +28,13 @@
* @see javax.persistence.AttributeOverride
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
@SuppressWarnings("nls")
public interface ExternalAttributeOverride extends ExternalForm {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
+ * The node name used to store and retrieve the element encapsulated by this external form.
*/
String ATTRIBUTE_OVERRIDE = "attribute-override";
@@ -57,16 +59,16 @@
String getDescription();
/**
- * Returns the index of this external form.
- */
- int getIndex();
-
- /**
* Name of the attribute that is being overridden.
*/
String getName();
/**
+ * Returns the {@link TextRange} of the name of the attribute that is being overridden.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Removes the column named
*/
void removeColumn(int index);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicCollectionMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicCollectionMapping.java
index 1fdc226..bc25643 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicCollectionMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicCollectionMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,6 +15,7 @@
import javax.persistence.FetchType;
import org.eclipse.persistence.annotations.JoinFetchType;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface represents the basis for all basic collection mapping types defined by the
@@ -25,25 +26,45 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalBasicCollectionMapping extends ExternalConvertibleMapping {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String BASIC_COLLECTION = "basic-collection";
+
+ /**
+ * The attribute name used to store and retrieve the fetch property.
+ */
+ String FETCH = "fetch";
+
+ /**
+ * The element name used to store and retrieve the join-fetch child text node.
+ */
+ String JOIN_FETCH = "join-fetch";
+
+ /**
+ * The element name used to store and retrieve the value-column child node.
+ */
+ String VALUE_COLUMN = "value-column";
+
+ /**
* Adds a batch fetch to use.
*/
- void addBatchFetch();
+ ExternalBatchFetch addBatchFetch();
/**
* Adds a collection table to this mapping.
*/
- void addCollectionTable(String name);
+ ExternalCollectionTable addCollectionTable(String name);
/**
* Adds the value column for this mapping.
*/
- void addValueColumn(String columnName);
+ ExternalEntityColumn addValueColumn(String columnName);
/**
* Returns the batch fetch definition for this mapping.
@@ -61,11 +82,21 @@
FetchType getFetchType();
/**
+ * Returns the {@link TextRange} for the fetch type for this mapping.
+ */
+ TextRange getFetchTypeTextRange();
+
+ /**
* Returns the join fetch type for this mapping.
*/
JoinFetchType getJoinFetchType();
/**
+ * Returns the {@link TextRange} for the join fetch type for this mapping.
+ */
+ TextRange getJoinFetchTypeTextRange();
+
+ /**
* Returns the value column for this mapping.
*/
ExternalEntityColumn getValueColumn();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicColumn.java
index a2daf7e..d8fedff 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface describes the core definition of what a column is as pertains to the ORM xml.
* <p>
@@ -25,27 +28,107 @@
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html,
* persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalBasicColumn extends ExternalForm {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String COLUMN = "column";
+
+ /**
+ * The attribute name used to store and retrieve the column-definition property.
+ */
+ String COLUMN_DEFINITION = "column-definition";
+
+ /**
+ * The attribute name used to store and retrieve the insertable property.
+ */
+ String INSERTABLE = "insertable";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The attribute name used to store and retrieve the nullable property.
+ */
+ String NULLABLE = "nullable";
+
+ /**
+ * The attribute name used to store and retrieve the table property.
+ */
+ String TABLE = "table";
+
+ /**
+ * The attribute name used to store and retrieve the unique property.
+ */
+ String UNIQUE = "unique";
+
+ /**
+ * The attribute name used to store and retrieve the updatable property.
+ */
+ String UPDATABLE = "updatable";
+
+ /**
* Returns the native DDL or definition string representing this column.
*/
String getColumnDefinition();
/**
+ * Returns the {@link TextRange} of the native DDL or definition string representing this column.
+ */
+ TextRange getColumnDefinitionTextRange();
+
+ /**
+ * Returns the text range of the name attribute.
+ */
+ TextRange getColumnTextRange();
+
+ /**
+ * Returns the {@link TextRange} of the insertable value.
+ */
+ TextRange getInstertableTextRange();
+
+ /**
* Returns the column name.
*/
String getName();
/**
+ * Returns the {@link TextRange} of the column name.
+ */
+ TextRange getNameTextRange();
+
+ /**
+ * Returns the {@link TextRange} of the nullable value.
+ */
+ TextRange getNullableTextRange();
+
+ /**
* Returns name of the owning table for this column.
*/
String getTable();
/**
+ * Returns the {@link TextRange} of the name of the owning table for this column.
+ */
+ TextRange getTableTextRange();
+
+ /**
+ * Returns the {@link TextRange} of the unique value.
+ */
+ TextRange getUniqueTextRange();
+
+ /**
+ * Returns the {@link TextRange} of the updatable value.
+ */
+ TextRange getUpdatableTextRange();
+
+ /**
* Indicates whether this column is insertable.
*/
Boolean isInstertable();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicMapMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicMapMapping.java
index 3bc63e5..bb2c611 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicMapMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicMapMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface represents the basis for all basic map mapping types defined by the EclipseLink
* JPA spec that are available for configuration via the EclipseLink ORM xml.
@@ -22,15 +24,50 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalBasicMapMapping extends ExternalBasicCollectionMapping {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String BASIC_MAP = "basic-map";
+
+ /**
+ * The attribute name used to store and retrieve the fetch property.
+ */
+ String FETCH = "fetch";
+
+ /**
+ * The element name used to store and retrieve the join-fetch child text node.
+ */
+ String JOIN_FETCH = "join-fetch";
+
+ /**
+ * The element name used to store and retrieve the key-column child node.
+ */
+ String KEY_COLUMN = "key-column";
+
+ /**
+ * The element name used to store and retrieve the key-converter child text node.
+ */
+ String KEY_CONVERTER = "key-converter";
+
+ /**
+ * The element name used to store and retrieve the value-column child node.
+ */
+ String VALUE_COLUMN = "value-column";
+
+ /**
+ * The element name used to store and retrieve the value-converter child text node.
+ */
+ String VALUE_CONVERTER = "value-converter";
+
+ /**
* Adds the key column for this mapping.
*/
- void addKeyColumn(String columnName);
+ ExternalEntityColumn addKeyColumn(String columnName);
/**
* Adds the key converter string to the mapping.
@@ -48,9 +85,9 @@
ExternalConverter getKeyConverter();
/**
- * Returns the key converter string.
+ * Returns the {@link TextRange} for the key converter string.
*/
- String getKeyConveter();
+ TextRange getKeyConveterTextRange();
/**
* Returns the key object type converter for this mapping.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicMapping.java
index 78b72d5..c7078a1 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,7 @@
package org.eclipse.persistence.tools.mapping.orm;
import javax.persistence.EnumType;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and inherited behavior describes the configurable properties for a basic mapping
@@ -28,12 +29,62 @@
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html,
* persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalBasicMapping extends ExternalVersionMapping,
ExternalGeneratedMapping,
- ExternalMappedMapping {
+ ExternalMappedMapping {
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String BASIC = "basic";
+
+ /**
+ * The element name used to store and retrieve the expiry child text node.
+ */
+ String ENUMERATED = "enumerated";
+
+ /**
+ * The attribute name used to store and retrieve the fetch property.
+ */
+ String FETCH = "fetch";
+
+ /**
+ * The element name used to store and retrieve the lob child text node.
+ */
+ String LOB = "lob";
+
+ /**
+ * The attribute name used to store and retrieve the mutable property.
+ */
+ String MUTABLE = "mutable";
+
+ /**
+ * The attribute name used to store and retrieve the optional property.
+ */
+ String OPTIONAL = "optional";
+
+ /**
+ * Returns insert property.
+ */
+ String RETURN_INSERT = "return-insert";
+
+ /**
+ * Returns only on insert property.
+ */
+ String RETURN_ONLY = "return-only";
+
+ /**
+ * Returns update property.
+ */
+ String RETURN_UPDATE = "return-update";
+
+ /**
+ * The element name used to store and retrieve the temporal child text node.
+ */
+ String TEMPORAL = "temporal";
/**
* Returns the enumerated type of this mapping if one exists.
@@ -41,6 +92,31 @@
EnumType getEnumeratedType();
/**
+ * Returns the {@link TextRange} for the enumerated type value.
+ */
+ TextRange getEnumeratedTypeTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the LOB value.
+ */
+ TextRange getLobTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the return on insert value.
+ */
+ TextRange getReturnOnInsertTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the return only on insert value.
+ */
+ TextRange getReturnOnlyOnInsertTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the return on update value.
+ */
+ TextRange getReturnOnUpdateTextRange();
+
+ /**
* Indicates whether this basic mapping's column is a LOB.
*/
Boolean isLob();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicNamedQuery.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicNamedQuery.java
index 1fc67b0..001312f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicNamedQuery.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBasicNamedQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,7 @@
package org.eclipse.persistence.tools.mapping.orm;
import javax.persistence.LockModeType;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface extends that defined by {@link ExternalNamedQuery} to include the LockModeType
@@ -24,17 +25,32 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Billy Flanagan
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalBasicNamedQuery extends ExternalNamedQuery {
/**
+ * The attribute name used to store and retrieve the name property.
+ */
+ static final String LOCK_MODE = "lock-mode";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ static final String NAMED_QUERY = "named-query";
+
+ /**
* Returns the locking mode to be used for this query.
*/
LockModeType getLockModeType();
/**
+ * Returns the {@link TextRange} for the locking mode value.
+ */
+ TextRange getLockModeTypeTextRange();
+
+ /**
* Sets the locking mode to be used for this query.
*/
void setLockModeType(LockModeType lockModeType);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBatchFetch.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBatchFetch.java
index 9b62807..61a91ad 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBatchFetch.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalBatchFetch.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,8 @@
package org.eclipse.persistence.tools.mapping.orm;
import org.eclipse.persistence.annotations.BatchFetchType;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface represents the batch fetch defined by the EclipseLink JPA spec that are available
@@ -24,22 +26,47 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalBatchFetch extends ExternalForm {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String BATCH_FETCH = "batch-fetch";
+
+ /**
+ * The attribute name used to store and retrieve the size property.
+ */
+ String SIZE = "size";
+
+ /**
+ * The attribute name used to store and retrieve the type property.
+ */
+ String TYPE = "type";
+
+ /**
* Returns the size.
*/
int getSize();
/**
+ * Returns the {@link TextRange} of the size value.
+ */
+ TextRange getSizeTextRange();
+
+ /**
* Returns the batch fetch type.
*/
BatchFetchType getType();
/**
+ * Returns the {@link TextRange} of the batch fetch type.
+ */
+ TextRange getTypeTextRange();
+
+ /**
* Sets the size.
*/
void setSize(int size);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCache.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCache.java
index 1e59138..b004fdc 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCache.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCache.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -17,6 +17,8 @@
import org.eclipse.persistence.annotations.CacheType;
import org.eclipse.persistence.annotations.DatabaseChangeNotificationType;
import org.eclipse.persistence.config.CacheIsolationType;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and inherited behavior describe the configurable properties defined for an
@@ -29,15 +31,75 @@
*
* @see org.eclipse.persistence.annotations.Cache
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalCache extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the always-refresh property.
+ */
+ String ALWAYS_REFRESH = "always-refresh";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String CACHE = "cache";
+
+ /**
+ * The attribute name used to store and retrieve the coordination-type property.
+ */
+ String COORDINATION_TYPE = "coordination-type";
+
+ /**
+ * The attribute name used to store and retrieve the database-change-notification-type property.
+ */
+ String DATABASE_CHANGE_NOTIFICATION_TYPE = "database-change-notification-type";
+
+ /**
+ * The attribute name used to store and retrieve the disable-hits property.
+ */
+ String DISABLE_HITS = "disable-hits";
+
+ /**
+ * The element name used to store and retrieve the expiry child text node.
+ */
+ String EXPIRY = "expiry";
+
+ /**
+ * The attribute name used to store and retrieve the isolation property.
+ */
+ String ISOLATION = "isolation";
+
+ /**
+ * The attribute name used to store and retrieve the refresh-only-if-newer property.
+ */
+ String REFRESH_ONLY_IF_NEWER = "refresh-only-if-newer";
+
+ /**
+ * The attribute name used to store and retrieve the shared property.
+ */
+ String SHARED = "shared";
+
+ /**
+ * The attribute name used to store and retrieve the size property.
+ */
+ String SIZE = "size";
+
+ /**
+ * The attribute name used to store and retrieve the type property.
+ */
+ String TYPE = "type";
+
+ /**
* Adds the time of day for expiration for this cache.
*/
- void addExpiryTimeOfDay();
+ ExternalTimeOfDay addExpiryTimeOfDay();
+
+ /**
+ * Returns the {@link TextRange} for the always refreshed value.
+ */
+ TextRange getAlwaysRefreshTextRange();
/**
* Returns the coordination type for this cache.
@@ -45,36 +107,86 @@
CacheCoordinationType getCoordinationType();
/**
+ * Returns the {@link TextRange} for the coordination type for this cache.
+ */
+ TextRange getCoordinationTypeTextRange();
+
+ /**
* Returns the database change notification type for this cache.
*/
DatabaseChangeNotificationType getDatabaseChangeNotificationType();
/**
+ * Returns the {@link TextRange} for the database change notification type for this cache.
+ */
+ TextRange getDatabaseChangeNotificationTypeTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the cache disables hits value.
+ */
+ TextRange getDisableHitsTextRange();
+
+ /**
* Returns this cache's time of day for expiration.
*/
ExternalTimeOfDay getExpiryTimeOfDay();
/**
+ * Returns the {@link TextRange} for the time of day for expiration.
+ */
+ TextRange getExpiryTimeOfDayTextRange();
+
+ /**
* Returns this cache's time to live before expiration.
*/
Integer getExpiryTimeToLive();
/**
+ * Returns the {@link TextRange} for the cache's time to live before expiration.
+ */
+ TextRange getExpiryTimeToLiveTextRange();
+
+ /**
* Returns the isolation type for this cache
*/
CacheIsolationType getIsolationType();
/**
+ * Returns the isolation type's {@link TextRange} for this cache
+ */
+ TextRange getIsolationTypeTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the cache refreshes only if newer value.
+ */
+ TextRange getRefreshOnlyIfNewerTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the cache is shared value.
+ */
+ TextRange getSharedTextRange();
+
+ /**
* Returns the size of the cache.
*/
Integer getSize();
/**
+ * Returns the {@link TextRange} size of the cache.
+ */
+ TextRange getSizeTextRange();
+
+ /**
* Returns the type of this cache.
*/
CacheType getType();
/**
+ * Returns the {@link TextRange} for the type of this cache.
+ */
+ TextRange getTypeTextRange();
+
+ /**
* Returns whether this cache is always refreshed.
*/
Boolean isAlwaysRefresh();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalClassConverter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalClassConverter.java
index e547987..89efbcb 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalClassConverter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalClassConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior describes the configurable properties for an converter. One
* or more converters can be declared as part of an entity
@@ -24,19 +27,27 @@
*
* @see org.eclipse.persistence.annotations.Converter
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalClassConverter extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
* Returns the class name of the converter class.
*/
String getConverterClassName();
/**
- * Returns the index of this element in its owning parent.
+ * Returns the {@link TextRange} for the class name of the converter class.
*/
+ TextRange getConverterClassNameTextRange();
+
+ @Deprecated
int getIndex();
/**
@@ -45,6 +56,11 @@
String getName();
/**
+ * Returns the {@link TextRange} for the name of this converter.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Sets the class name of the converter class.
*/
void setConverterClassName(String classname);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCloneCopyPolicy.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCloneCopyPolicy.java
index 2b254d5..bacbcd2 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCloneCopyPolicy.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCloneCopyPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior describe the configurable properties defined for a clone
* copy policy in the EclipseLink 1.1 ORM xml.
@@ -24,22 +27,47 @@
*
* @see org.eclipse.persistence.annotations.CloneCopyPolicy
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalCloneCopyPolicy extends ExternalForm {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String CLONE_COPY_POLICY = "clone-copy-policy";
+
+ /**
+ * The attribute name used to store and retrieve the method property.
+ */
+ String METHOD = "method";
+
+ /**
+ * The attribute name used to store and retrieve the working-copy-method property.
+ */
+ String WORKING_COPY_METHOD = "working-copy-method";
+
+ /**
* Returns the name of the cloning method for this policy.
*/
String getMethod();
/**
+ * Returns the {@link TextRange} for the name of the cloning method for this policy.
+ */
+ TextRange getMethodTextRange();
+
+ /**
* Returns the name of the working copy method for this policy.
*/
String getWorkingCopyMethod();
/**
+ * Returns the {@link TextRange} for the name of the working copy method for this policy.
+ */
+ TextRange getWorkingCopyMethodTextRange();
+
+ /**
* Sets the method name for this policy.
*/
void setMethod(String methodName);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCollectionTable.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCollectionTable.java
index dbb9757..902dabc 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCollectionTable.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCollectionTable.java
@@ -15,8 +15,13 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalCollectionTable extends ExternalReferenceTable {
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String COLLECTION_TABLE = "collection-table";
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalColumnMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalColumnMapping.java
index b883725..7a07339 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalColumnMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalColumnMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,7 @@
package org.eclipse.persistence.tools.mapping.orm;
import javax.persistence.TemporalType;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form for a column mapping.
@@ -23,11 +24,22 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalColumnMapping extends ExternalConvertibleMapping {
/**
+ * The element name used to store and retrieve the temporal child text node.
+ */
+ String TEMPORAL = "temporal";
+
+ /**
+ * Adds the column definition that represents the column to be used as the version column.
+ */
+ ExternalEntityColumn addColumn();
+
+ /**
* Column definition that represents the column to be used as the version column.
*/
ExternalEntityColumn getColumn();
@@ -43,6 +55,11 @@
TemporalType getTemporalType();
/**
+ * Returns the {@link TextRange} for the temporal type of the column.
+ */
+ TextRange getTemporalTypeTextRange();
+
+ /**
* Creates new column definition to be used as the version column replacing the old one.
*/
void setColumn(String columnName);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalColumnResult.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalColumnResult.java
index 5fe2e39..ba0bff9 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalColumnResult.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalColumnResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+
/**
* This interface describes the configurable properties for a column result declared in the ORM xml.
* A column result is declared as part of a sql result set mapping.
@@ -25,15 +27,20 @@
* @see javax.persistence.ColumnResult
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalColumnResult extends ExternalForm {
/**
- * Returns the position of this column result within the list of column results owned by the parent.
+ * The node name used to store and retrieve the element encapsulated by this external form.
*/
- int getIndex();
+ String COLUMN_RESULT = "column-result";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
/**
* Name of the column result.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConversionValue.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConversionValue.java
index d5f93f6..a290b04 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConversionValue.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConversionValue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior describes the configurable properties for an conversion
* value. One or more conversion values can be declared as part of an object type converter.
@@ -24,20 +27,37 @@
*
* @see org.eclipse.persistence.annotations.ConversionValue
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalConversionValue extends ExternalForm {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String CONVERSION_VALUE = "conversion-value";
+
+ /**
+ * The attribute name used to store and retrieve the data-value property.
+ */
+ String DATA_VALUE = "data-value";
+
+ /**
+ * The attribute name used to store and retrieve the object-value property.
+ */
+ String OBJECT_VALUE = "object-value";
+
+ /**
* Returns the data value for this conversion.
*/
String getDataValue();
/**
- * Returns the position of this conversion value within the list of conversion values
- * owned by the parent.
+ * Returns the {@link TextRange} for the data value for this conversion.
*/
+ TextRange getDataValueTextRange();
+
+ @Deprecated
int getIndex();
/**
@@ -46,16 +66,16 @@
String getObjectValue();
/**
+ * Returns the {@link TextRange} for the object value for this conversion.
+ */
+ TextRange getObjectValueTextRange();
+
+ /**
* Sets the data value for this conversion.
*/
void setDataValue(String value);
/**
- * Sets the index for this conversion value within the list of conversion values.
- */
- void setIndex(int value);
-
- /**
* Sets the object value for this conversion.
*/
void setObjectValue(String value);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConverter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConverter.java
index 45bc67b..453b388 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConverter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -24,8 +24,18 @@
*
* @see org.eclipse.persistence.annotations.Converter
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalConverter extends ExternalClassConverter {
+
+ /**
+ * The attribute name used to store and retrieve the class property.
+ */
+ String CLASS = "class";
+
+ /**
+ * The attribute name used to store and retrieve the converter property.
+ */
+ String CONVERTER = "converter";
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConvertibleMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConvertibleMapping.java
index 2467417..42da132 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConvertibleMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalConvertibleMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface represents the basis for all convertible mapping types defined by the EclipseLink
* JPA spec that are available for configuration via the EclipseLink ORM xml.
@@ -22,17 +24,27 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalConvertibleMapping extends ExternalNonTransientMapping {
/**
+ * The element name used to store and retrieve the convert child text node.
+ */
+ String CONVERT = "convert";
+
+ /**
* Returns the converter string for this mapping.
*/
String getConvert();
/**
+ * Returns the {@link TextRange} for the converter string for this mapping.
+ */
+ TextRange getConvertTextRange();
+
+ /**
* Returns the value object type converter for this mapping.
*/
ExternalObjectTypeConverter getObjectTypeConverter();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCopyPolicy.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCopyPolicy.java
index 38d93c8..269d6b5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCopyPolicy.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalCopyPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior describe the configurable properties defined for a copy
* policy in the EclipseLink 1.1 ORM xml.
@@ -24,17 +27,32 @@
*
* @see org.eclipse.persistence.annotations.CopyPolicy
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalCopyPolicy extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the class property.
+ */
+ String CLASS = "class";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String COPY_POLICY = "copy-policy";
+
+ /**
* Returns the name of the cloning class for this policy.
*/
String getClassName();
/**
+ * Returns the {@link TextRange} for the name of the cloning class for this policy.
+ */
+ TextRange getClassNameTextRange();
+
+ /**
* Sets the class name for this policy.
*/
void setClassName(String className);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalDiscriminatorClass.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalDiscriminatorClass.java
index 9cd7457..d635b6f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalDiscriminatorClass.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalDiscriminatorClass.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface represents the basis for an discriminator class defined by the EclipseLink JPA
* spec that are available for configuration via the EclipseLink ORM xml.
@@ -22,23 +25,35 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalDiscriminatorClass extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the discriminator property.
+ */
+ String DISCRIMINATOR = "discriminator";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String DISCRIMINATOR_CLASS = "discriminator-class";
+
+ /**
+ * The attribute name used to store and retrieve the value property.
+ */
+ String VALUE = "value";
+
+ /**
* Returns the discriminator string.
*/
String getDiscriminator();
/**
- * Returns the position of this discriminator class within the list of discriminator classes
- * owned by the parent.
- *
- * @return The position of this external form in the list of the same type
+ * Returns the {@link TextRange} for the discriminator string.
*/
- int getIndex();
+ TextRange getDiscriminatorTextRange();
/**
* Returns the discriminator value.
@@ -46,6 +61,11 @@
String getValue();
/**
+ * Returns the {@link TextRange} for the discriminator value.
+ */
+ TextRange getValueTextRange();
+
+ /**
* Set the discriminator string
*/
void setDiscriminator(String discriminator);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalDiscriminatorColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalDiscriminatorColumn.java
index bca8c1e..f6226ba 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalDiscriminatorColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalDiscriminatorColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,8 @@
package org.eclipse.persistence.tools.mapping.orm;
import javax.persistence.DiscriminatorType;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface describes the configurable properties for a discriminator column in the ORM xml.
@@ -28,32 +30,77 @@
* @see javax.persistence.DiscriminatorColumn
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalDiscriminatorColumn extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the column-definition property.
+ */
+ String COLUMN_DEFINITION = "column-definition";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String DISCRIMINATOR_COLUMN = "discriminator-column";
+
+ /**
+ * The attribute name used to store and retrieve the discriminator-type property.
+ */
+ String DISCRIMINATOR_TYPE = "discriminator-type";
+
+ /**
+ * The attribute name used to store and retrieve the length property.
+ */
+ String LENGTH = "length";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
* Returns the SQL definition of the column.
*/
String getColumnDefinition();
/**
+ * Returns the {@link TextRange} for the SQL definition of the column.
+ */
+ TextRange getColumnDefinitionTextRange();
+
+ /**
* Type of the discriminator column.
*/
DiscriminatorType getDiscriminatorType();
/**
+ * Returns the {@link TextRange} for the type of the discriminator column.
+ */
+ TextRange getDiscriminatorTypeTextRange();
+
+ /**
* Returns the length of the column.
*/
Integer getLength();
/**
+ * Returns the {@link TextRange} for the length of the column.
+ */
+ TextRange getLengthTextRange();
+
+ /**
* Name of the discriminator column.
*/
String getName();
/**
+ * Returns the {@link TextRange} for the name of the discriminator column.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Set the column definition
*/
void setColumnDefinition(String definition);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalElementCollectionMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalElementCollectionMapping.java
index c5e14ff..4653bdc 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalElementCollectionMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalElementCollectionMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,6 +15,7 @@
import javax.persistence.EnumType;
import org.eclipse.persistence.annotations.JoinFetchType;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface represents the basis for all element collection mapping types defined by the
@@ -25,27 +26,92 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalElementCollectionMapping extends ExternalColumnMapping,
ExternalObjectCollectionMapping,
ExternalFetchableMapping {
/**
- * Adds a override with the given name.
+ * The attribute name used to store and retrieve the class property.
*/
- void addAssociationOverride(int index, String name);
+ String CLASS = "class";
+
+ /**
+ * The element name used to store and retrieve the convert-key child text node.
+ */
+ String CONVERT_KEY = "convert-key";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String ELEMENT_COLLECTION = "element-collection";
+
+ /**
+ * The element name used to store and retrieve the expiry child text node.
+ */
+ String ENUMERATED = "enumerated";
+
+ /**
+ * The element name used to store and retrieve the join-fetch child text node.
+ */
+ String JOIN_FETCH = "join-fetch";
+
+ /**
+ * The element name used to store and retrieve the lob child text node.
+ */
+ String LOB = "lob";
+
+ /**
+ * The element name used to store and retrieve the map-key-class child node.
+ */
+ String MAP_KEY_CLASS = "map-key-class";
+
+ /**
+ * The element name used to store and retrieve the map-key-convert child node.
+ */
+ String MAP_KEY_CONVERT = "map-key-convert";
+
+ /**
+ * The element name used to store and retrieve the map-key-enumerated child node.
+ */
+ String MAP_KEY_ENUMERATED = "map-key-enumerated";
+
+ /**
+ * The element name used to store and retrieve the map-key-temporal child node.
+ */
+ String MAP_KEY_TEMPORAL = "map-key-temporal";
+
+ /**
+ * The element name used to store and retrieve the order-by child text node.
+ */
+ String ORDER_BY = "order-by";
+
+ /**
+ * The attribute name used to store and retrieve the target-class property.
+ */
+ String TARGET_CLASS = "target-class";
+
+ /**
+ * The element name used to store and retrieve the temporal child text node.
+ */
+ String TEMPORAL = "temporal";
/**
* Adds a override with the given name.
*/
- void addAttributeOverride(int index, String name);
+ ExternalAssociationOverride addAssociationOverride(String name);
+
+ /**
+ * Adds a override with the given name.
+ */
+ ExternalAttributeOverride addAttributeOverride(String name);
/**
* Adds a batch fetch to use.
*/
- void addBatchFetch();
+ ExternalBatchFetch addBatchFetch();
/**
* Adds a collection table to this mapping.
@@ -68,16 +134,31 @@
String getConvertKey();
/**
+ * Returns the {@link TextRange} for the convert key for this mapping.
+ */
+ TextRange getConvertKeyTextRange();
+
+ /**
* Returns the enumerated type of this mapping if one exists.
*/
EnumType getEnumeratedType();
/**
+ * Returns the {@link TextRange} for the enumerated type of this mapping if one exists.
+ */
+ TextRange getEnumeratedTypeTextRange();
+
+ /**
* Returns the join fetch type for this mapping.
*/
JoinFetchType getJoinFetchType();
/**
+ * Returns the {@link TextRange} for the join fetch type for this mapping.
+ */
+ TextRange getJoinFetchTypeTextRange();
+
+ /**
* Returns the key converter for this mapping.
*/
ExternalConverter getKeyConverter();
@@ -98,10 +179,25 @@
ExternalTypeConverter getKeyTypeConverter();
/**
+ * Returns the {@link TextRange} for the LOB value.
+ */
+ TextRange getLobTextRange();
+
+ /**
+ * Returns the text range for this mapping's element declaration.
+ */
+ TextRange getMappingTextRange();
+
+ /**
* Returns the target class name for this mapping.
*/
String getTargetClassName();
-
+
+ /**
+ * Returns the target class name text range for this mapping.
+ */
+ TextRange getTargetClassNameTextRange();
+
/**
* Returns the target class short name for this mapping.
*/
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddableEntity.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddable.java
similarity index 70%
rename from tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddableEntity.java
rename to tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddable.java
index 75dfbfa..122685a 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddableEntity.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,10 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import java.util.List;
import org.eclipse.persistence.annotations.ChangeTrackingType;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
+import org.eclipse.persistence.tools.mapping.ExternalPropertyHolder;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface describes the configurable properties for an embeddable entity. One or more
@@ -28,15 +30,57 @@
* @see javax.persistence.Embeddable
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
-public interface ExternalEmbeddableEntity extends ExternalForm {
+@SuppressWarnings("nls")
+public interface ExternalEmbeddable extends ExternalAccessType,
+ ExternalPropertyHolder {
+
+ /**
+ * The element name used to store and retrieve the change-tracking child node.
+ */
+ String CHANGE_TRACKING = "change-tracking";
+
+ /**
+ * The attribute name used to store and retrieve the class property or the element name used to
+ * store and retrieve the class child text node of the customizer child node.
+ */
+ String CLASS = "class";
+
+ /**
+ * The element name used to store and retrieve the customizer child node.
+ */
+ String CUSTOMIZER = "customizer";
+
+ /**
+ * The element name used to store and retrieve the description child text node.
+ */
+ String DESCRIPTION = "description";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String EMBEDDABLE = "embeddable";
+
+ /**
+ * The attribute name used to store and retrieve the exclude-default-mappings property.
+ */
+ String EXCLUDE_DEFAULT_MAPPINGS = "exclude-default-mappings";
+
+ /**
+ * The attribute name used to store and retrieve the metadata-complete property.
+ */
+ String METADATA_COMPLETE = "metadata-complete";
+
+ /**
+ * The attribute name used to store and retrieve the type child text node of the change-tracking child node.
+ */
+ String TYPE = "type";
/**
* Adds the get and Sets method names for this mapping.
*/
- void addAccessMethods(String getMethodName, String setMethodName);
+ ExternalAccessMethods addAccessMethods(String getMethodName, String setMethodName);
/**
* Adds a basic collection mapping with the given name.
@@ -59,9 +103,9 @@
ExternalCloneCopyPolicy addCloneCopyPolicy();
/**
- * Adds a converter to this entity
+ * Adds a converter to this entity.
*/
- ExternalConverter addConverter(int index, String name);
+ ExternalConverter addConverter(String name);
/**
* Adds copy policy to this entity
@@ -83,7 +127,6 @@
*/
ExternalIDMapping addIdMapping(String name);
-
/**
* Adds instantiation copy policy to this entity
*/
@@ -105,9 +148,9 @@
ExternalNoSql addNoSql();
/**
- * Adds a object type converter to this entity
+ * Adds a object type converter to this entity.
*/
- ExternalObjectTypeConverter addObjectTypeConverter(int index, String name);
+ ExternalObjectTypeConverter addObjectTypeConverter(String name);
/**
* Adds a one-to-many mapping with the given name.
@@ -120,14 +163,9 @@
ExternalOneToOneMapping addOneToOneMapping(String name);
/**
- * Adds a property to this entity.
- */
- void addProperty(int index, String name, String value);
-
- /**
* Adds a struct converter to this entity.
*/
- ExternalStructConverter addStructConverter(int index, String name);
+ ExternalStructConverter addStructConverter(String name);
/**
* Adds a transient mapping with the given name.
@@ -137,12 +175,12 @@
/**
* Adds a type converter to this entity.
*/
- ExternalTypeConverter addTypeConverter(int index, String name);
+ ExternalTypeConverter addTypeConverter(String name);
/**
* Returns a list of the converters defined for this entity.
*/
- ListIterable<ExternalConverter> converters();
+ List<ExternalConverter> converters();
/**
* Returns the count of converters defined for this entity.
@@ -155,34 +193,37 @@
ExternalAccessMethods getAccessMethods();
/**
- * Returns the to be used in this entity.
- */
- String getAccessType();
-
- /**
* Returns the change tracking type for this entity
*/
ChangeTrackingType getChangeTrackingType();
/**
+ * Returns the {@link TextRange} for the change tracking type for this entity
+ */
+ TextRange getChangeTrackingTypeTextRange();
+
+ /**
* Returns the class name of the entity.
*/
String getClassName();
/**
+ * Returns the {@link TextRange} of the class name attribute's value.
+ */
+ TextRange getClassNameTextRange();
+
+ /**
* Returns the short class name of the entity.
*/
String getClassShortName();
-
/**
* Returns the clone copy policy for this entity.
*/
ExternalCloneCopyPolicy getCloneCopyPolicy();
/**
- * Returns the converter at the given index
- * @param index
+ * Returns the converter at the given position.
*/
ExternalConverter getConverter(int index);
@@ -197,13 +238,26 @@
String getCustomizerClassName();
/**
+ * Returns the {@link TextRange} for the customizer class name value.
+ */
+ TextRange getCustomizerClassNameTextRange();
+
+ /**
* Returns the description text for this entity.
*/
String getDescription();
/**
- * Returns the position of this entity within the list of entities owned by the parent.
+ * Returns the {@link TextRange} for the description text value.
*/
+ TextRange getDescriptionTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the default mappings should be excluded for this entity value.
+ */
+ TextRange getExcludeDefaultMappingsTextRange();
+
+ @Deprecated
int getIndex();
/**
@@ -217,34 +271,35 @@
ExternalMapping getMapping(String name);
/**
+ * Returns the {@link TextRange} for the meta data for this entity is completely described by the
+ * ORM definition value.
+ */
+ TextRange getMetadataCompleteTextRange();
+
+ /**
* Returns the external form of NoSql.
*/
ExternalNoSql getNoSql();
/**
- * Returns the object type converter at the given index.
+ * Returns the object type converter at the given position.
*/
ExternalObjectTypeConverter getObjectTypeConverter(int index);
/**
- * Returns the property at the given index.
- */
- ExternalProperty getProperty(int index);
-
- /**
- * Returns the struct type converter at the given index.
+ * Returns the struct type converter at the given position.
*/
ExternalStructConverter getStructConverter(int index);
/**
- * Returns the converter at the given index.
+ * Returns the converter at the given position.
*/
ExternalTypeConverter getTypeConverter(int index);
/**
* Returns a list of the id mappings defined for this entity.
*/
- ListIterable<ExternalIDMapping> idMappings();
+ List<ExternalIDMapping> idMappings();
/**
* Indicates whether default mappings should be excluded for this entity.
@@ -259,7 +314,7 @@
/**
* Returns a list of the attribute mappings defined for this entity.
*/
- ListIterable<ExternalMapping> mappings();
+ List<ExternalMapping> mappings();
/**
* Returns the count of attribute mappings defined for this entity.
@@ -269,7 +324,7 @@
/**
* Returns a list of the object type converters defined for this entity.
*/
- ListIterable<ExternalObjectTypeConverter> objectTypeConverters();
+ List<ExternalObjectTypeConverter> objectTypeConverters();
/**
* Returns the count of the object type converters defined for this entity.
@@ -277,16 +332,6 @@
int objectTypeConvertersSize();
/**
- * Returns a list of the properties defined for this entity.
- */
- ListIterable<ExternalProperty> properties();
-
- /**
- * Returns the count of properties defined for this entity.
- */
- int propertiesSize();
-
- /**
* Removes the access methods element from the mapping.
*/
void removeAccessMethods();
@@ -327,11 +372,6 @@
void removeObjectTypeConverter(int index);
/**
- * Removes the property specified at the given position.
- */
- void removeProperty(int index);
-
- /**
* Removes the struct converter specified at the given position.
*/
void removeStructConverter(int index);
@@ -342,12 +382,6 @@
void removeTypeConverter(int index);
/**
- * Sets the {@link AccessType} to be used for this entity. String
- * value used to support "VIRTUAL".
- */
- void setAccessType(String type);
-
- /**
* Sets the change tracking type for this entity.
*/
void setChangeTrackingType(ChangeTrackingType type);
@@ -380,7 +414,7 @@
/**
* Returns a list of the struct converters defined for this entity.
*/
- ListIterable<ExternalStructConverter> structConverters();
+ List<ExternalStructConverter> structConverters();
/**
* Returns the count of converters defined for this entity.
@@ -390,7 +424,7 @@
/**
* Returns a list of the converters defined for this entity.
*/
- ListIterable<ExternalTypeConverter> typeConverters();
+ List<ExternalTypeConverter> typeConverters();
/**
* Returns the count of type converters defined for this entity.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddedIDMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddedIDMapping.java
index 1f38dcf..e0fabd6 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddedIDMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddedIDMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,7 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
/**
* This interface and inherited describes the configurable properties for an embedded ID mapping. An
@@ -29,20 +28,25 @@
* @see javax.persistence.EmbeddedId
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalEmbeddedIDMapping extends ExternalNonTransientMapping {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String EMBEDDED_ID = "embedded-id";
+
+ /**
* Adds a override with the given name.
*/
- void addAttributeOverride(int index, String name);
+ ExternalAttributeOverride addAttributeOverride(String name);
/**
* Returns a list of overridden column mappings for embedded fields.
*/
- ListIterable<ExternalAttributeOverride> attributeOverrides();
+ List<ExternalAttributeOverride> attributeOverrides();
/**
* Returns the count of overridden column mappings for embedded fields.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddedMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddedMapping.java
index 0ba83a7..62c8e80 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddedMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEmbeddedMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,7 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
/**
* This interface and inherited describes the configurable properties for an embedded mapping.
@@ -27,25 +26,30 @@
* @see javax.persistence.Embedded
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalEmbeddedMapping extends ExternalNonTransientMapping {
/**
- * Adds a override with the given name
+ * The node name used to store and retrieve the element encapsulated by this external form.
*/
- ExternalAssociationOverride addAssociationOverride(int index);
+ String EMBEDDED = "embedded";
/**
* Adds a override with the given name
*/
- ExternalAttributeOverride addAttributeOverride(int index);
+ ExternalAssociationOverride addAssociationOverride();
+
+ /**
+ * Adds a override with the given name
+ */
+ ExternalAttributeOverride addAttributeOverride();
/**
* Returns a list of association overrides defined on this mapping.
*/
- ListIterable<ExternalAssociationOverride> associationOverrides();
+ List<ExternalAssociationOverride> associationOverrides();
/**
* Returns the count of association overrides defined on this entity.
@@ -55,7 +59,7 @@
/**
* Returns a list of overridden column mappings for embedded mapping.
*/
- ListIterable<ExternalAttributeOverride> attributeOverrides();
+ List<ExternalAttributeOverride> attributeOverrides();
/**
* Returns the count of overridden column mappings for embedded fields.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntity.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntity.java
index 1dcea6d..f507b95 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntity.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntity.java
@@ -6,8 +6,9 @@
*/
package org.eclipse.persistence.tools.mapping.orm;
+import java.util.List;
import javax.persistence.InheritanceType;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and inherited behavior describes the configurable properties for an entity. One or
@@ -21,20 +22,50 @@
* @see javax.persistence.Entity
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
-public interface ExternalEntity extends ExternalMappedSuperClassEntity {
+@SuppressWarnings("nls")
+public interface ExternalEntity extends ExternalMappedSuperClass {
+
+ /**
+ * The element name used to store and retrieve the class-extractor child node.
+ */
+ String CLASS_EXTRACTOR = "class-extractor";
+
+ /**
+ * The element name used to store and retrieve the column child text node.
+ */
+ String DISCRIMINATOR_VALUE = "discriminator-value";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String ENTITY = "entity";
+
+ /**
+ * The element name used to store and retrieve the inheritance child node.
+ */
+ String INHERITANCE = "inheritance";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The attribute name used to store and retrieve the strategy property of the inheritance child node.
+ */
+ String STRATEGY = "strategy";
/**
* Adds a override with the given name.
*/
- void addAssociationOverride(int index, String name);
+ ExternalAssociationOverride addAssociationOverride(String name);
/**
* Adds a override with the given name.
*/
- void addAttributeOverride(int index, String name);
+ ExternalAttributeOverride addAttributeOverride(String name);
/**
* Creates a new discriminator column definition replacing the old one.
@@ -44,17 +75,17 @@
/**
* Adds a named query with the given name.
*/
- void addNamedQuery(int index, String name);
+ ExternalNamedQuery addNamedQuery(String name);
/**
* Adds a native query with the given name.
*/
- void addNativeQuery(int index, String name);
+ ExternalNativeQuery addNativeQuery(String name);
/**
* Adds a primary key join column with the given name.
*/
- void addPrimaryKeyJoinColumn(int index, String name);
+ ExternalPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(String name);
/**
* Creates new primary table for this entity replacing the old one.
@@ -64,22 +95,22 @@
/**
* Adds a secondary table with the given name.
*/
- void addSecondaryTable(int index, String name, String catalog, String schema);
+ ExternalSecondaryTable addSecondaryTable(String name, String catalog, String schema);
/**
* Adds a sql result set mapping with the given name.
*/
- void addSqlResultSetMapping(int index, String name);
+ ExternalSQLResultSetMapping addSqlResultSetMapping(String name);
/**
* Adds a stored procedure query with the given name.
*/
- void addStoredProcedureQuery(int index, String name, String procedureName);
+ ExternalStoredProcedureQuery addStoredProcedureQuery(String name, String procedureName);
/**
* Returns a list of association overrides defined on this entity.
*/
- ListIterable<ExternalAssociationOverride> associationOverrides();
+ List<ExternalAssociationOverride> associationOverrides();
/**
* Returns the count of association overrides defined on this entity.
@@ -89,7 +120,7 @@
/**
* Returns a list of attribute overrides defined for this entity.
*/
- ListIterable<ExternalAttributeOverride> attributeOverrides();
+ List<ExternalAttributeOverride> attributeOverrides();
/**
* Returns the count attribute overrides defined for this entity.
@@ -112,6 +143,11 @@
String getClassExtractorClassName();
/**
+ * Returns the {@link TextRange} for the class extractor class name defined for this entity.
+ */
+ TextRange getClassExtractorClassNameTextRange();
+
+ /**
* Returns the discriminator column definition.
*/
ExternalDiscriminatorColumn getDiscriminatorColumn();
@@ -122,11 +158,21 @@
String getDiscriminatorValue();
/**
+ * Returns the {@link TextRange} for the discriminator value.
+ */
+ TextRange getDiscriminatorValueTextRange();
+
+ /**
* Returns the inheritance strategy type if one has been declared.
*/
InheritanceType getInheritenceStrategy();
/**
+ * Returns the {@link TextRange} for the inheritance strategy type if one has been declared.
+ */
+ TextRange getInheritenceStrategyTextRange();
+
+ /**
* Returns the name of the entity.
*/
String getName();
@@ -142,6 +188,11 @@
ExternalBasicNamedQuery getNamedQuery(int index, String name);
/**
+ * Returns the {@link TextRange} for the name of the entity.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Returns a native query with the given name.
*/
ExternalNativeQuery getNativeQuery(int index);
@@ -164,7 +215,7 @@
/**
* Returns a the secondary table definition for the given catalog, schema and table name.
*/
- ExternalEntitySecondaryTable getSecondaryTable(int index);
+ ExternalSecondaryTable getSecondaryTable(int index);
/**
* Returns the SQL Result Set Mappings at the given position.
@@ -184,7 +235,7 @@
/**
* Returns a list of named queries defined for this entity.
*/
- ListIterable<ExternalNamedQuery> namedQueries();
+ List<ExternalNamedQuery> namedQueries();
/**
* Returns the count of named queried defined for this entity.
@@ -194,7 +245,7 @@
/**
* Returns a list of native queries defined on this entity.
*/
- ListIterable<ExternalNativeQuery> nativeQueries();
+ List<ExternalNativeQuery> nativeQueries();
/**
* Returns the count of native queries defined on this entity.
@@ -204,7 +255,7 @@
/**
* Returns a list of the primary key join columns.
*/
- ListIterable<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ List<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns();
/**
* Returns the count of primary key join columns.
@@ -259,7 +310,7 @@
/**
* Returns a list of the secondary table definitions for this entity.
*/
- ListIterable<ExternalEntitySecondaryTable> secondaryTables();
+ List<ExternalSecondaryTable> secondaryTables();
/**
* Returns the count of secondary table definitions for this entity.
@@ -289,7 +340,7 @@
/**
* Returns a list of sql result set mappings defined on this entity.
*/
- ListIterable<ExternalSQLResultSetMapping> sqlResultSetMappings();
+ List<ExternalSQLResultSetMapping> sqlResultSetMappings();
/**
* Returns the count of SQL result set mappings defined on this entity.
@@ -299,7 +350,7 @@
/**
* Returns a list of named stored procedure queries defined for this entity.
*/
- ListIterable<ExternalStoredProcedureQuery> storedProcedureQueries();
+ List<ExternalStoredProcedureQuery> storedProcedureQueries();
/**
* Returns the count of named stored procedure queried defined for this entity.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityColumn.java
index 55c138f..b82e65f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior describes the configurable properties for a database column
* in the ORM xml.
@@ -25,15 +27,25 @@
* @see javax.persistence.Column
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalEntityColumn extends ExternalBasicColumn {
/**
- * Returns the position of this column if it's part of a list, otherwise -1 will be the position.
+ * The attribute name used to store and retrieve the length property.
*/
- int getIndex();
+ String LENGTH = "length";
+
+ /**
+ * The attribute name used to store and retrieve the precision property.
+ */
+ String PRECISION = "precision";
+
+ /**
+ * The attribute name used to store and retrieve the scale property.
+ */
+ String SCALE = "scale";
/**
* Returns the column length.
@@ -41,16 +53,31 @@
Integer getLength();
/**
+ * Returns the {@link TextRange} for the length value.
+ */
+ TextRange getLengthTextRange();
+
+ /**
* Returns the column precision.
*/
Integer getPrecision();
/**
+ * Returns the {@link TextRange} for the column precision value.
+ */
+ TextRange getPrecisionTextRange();
+
+ /**
* Returns the column scale.
*/
Integer getScale();
/**
+ * Returns the {@link TextRange} for the column scale value.
+ */
+ TextRange getScaleTextRange();
+
+ /**
* Set the length of the database column.
*/
void setLength(Integer length);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityIDGeneratedValue.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityIDGeneratedValue.java
index eeb01e7..bcc49ad 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityIDGeneratedValue.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityIDGeneratedValue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,8 @@
package org.eclipse.persistence.tools.mapping.orm;
import javax.persistence.GenerationType;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and describes the configurable properties defined for a generated value declared
@@ -27,22 +29,47 @@
* @see javax.persistence.GeneratedValue
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalEntityIDGeneratedValue extends ExternalForm {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String GENERATED_VALUE = "generated-value";
+
+ /**
+ * The attribute name used to store and retrieve the generator property.
+ */
+ String GENERATOR = "generator";
+
+ /**
+ * The attribute name used to store and retrieve the strategy property.
+ */
+ String STRATEGY = "strategy";
+
+ /**
* Returns the generation type for this value.
*/
GenerationType getGenerationType();
/**
+ * Returns the {@link TextRange} for the generation type for this value.
+ */
+ TextRange getGenerationTypeTextRange();
+
+ /**
* Returns the name of the id generator specified for this id's value.
*/
String getGeneratorName();
/**
+ * Returns the {@link TextRange} for the name of the id generator specified for this id's value.
+ */
+ TextRange getGeneratorNameTextRange();
+
+ /**
* Set the generation type for this value.
*/
void setGenerationType(GenerationType type);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityListener.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityListener.java
index 2911a33..5d06b03 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityListener.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and describes the configurable properties defined for an entity listener in the
* ORM xml. Entity listeners may be declared at the root of the ORM, on entities, or individual
@@ -26,24 +29,88 @@
* @see javax.persistence.EntityListeners
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalEntityListener extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the class property.
+ */
+ String CLASS = "class";
+
+ /**
+ * The element name used to store and retrieve the description child node.
+ */
+ String DESCRIPTION = "description";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String ENTITY_LISTENER = "entity-listener";
+
+ /**
+ * The element name used to store and retrieve the entity-listeners parent node encapsulating the
+ * element represented by this external form.
+ */
+ String ENTITY_LISTENERS = "entity-listeners";
+
+ /**
+ * The attribute name used to store and retrieve the method-name property of the callback child nodes.
+ */
+ String METHOD_NAME = "method-name";
+
+ /**
+ * The element name used to store and retrieve the post-load child node.
+ */
+ String POST_LOAD = "post-load";
+
+ /**
+ * The element name used to store and retrieve the post-persist child node.
+ */
+ String POST_PERSIST = "post-persist";
+
+ /**
+ * The element name used to store and retrieve the post-remove child node.
+ */
+ String POST_REMOVE = "post-remove";
+
+ /**
+ * The element name used to store and retrieve the post-update child node.
+ */
+ String POST_UPDATE = "post-update";
+
+ /**
+ * The element name used to store and retrieve the pre-persist child node.
+ */
+ String PRE_PERSIST = "pre-persist";
+
+ /**
+ * The element name used to store and retrieve the pre-remove child node.
+ */
+ String PRE_REMOVE = "pre-remove";
+
+ /**
+ * The element name used to store and retrieve the pre-update child node.
+ */
+ String PRE_UPDATE = "pre-update";
+
+ /**
* Returns the class name of this listener or entity.
*/
String getClassName();
/**
+ * Returns the {@link TextRange} of the class name.
+ */
+ TextRange getClassNameTextRange();
+
+ /**
* Returns the description.
*/
String getDescription();
- /**
- * Returns the position of this entity listener within the list of entity listeners.
- */
+ @Deprecated
int getIndex();
/**
@@ -57,6 +124,11 @@
String getPostLoadMethodDescription();
/**
+ * Returns the {@link TextRange} of the post-load method name.
+ */
+ TextRange getPostLoadMethodTextRange();
+
+ /**
* Returns the post-persist method name.
*/
String getPostPersistMethod();
@@ -67,6 +139,11 @@
String getPostPersistMethodDescription();
/**
+ * Returns the {@link TextRange} of the post-persist method name.
+ */
+ TextRange getPostPersistMethodTextRange();
+
+ /**
* Returns the post-remove method name.
*/
String getPostRemoveMethod();
@@ -77,6 +154,11 @@
String getPostRemoveMethodDescription();
/**
+ * Returns the {@link TextRange} of the post-remove method name.
+ */
+ TextRange getPostRemoveMethodTextRange();
+
+ /**
* Returns the post-update method name.
*/
String getPostUpdateMethod();
@@ -87,6 +169,11 @@
String getPostUpdateMethodDescription();
/**
+ * Returns the {@link TextRange} of the post-update method name.
+ */
+ TextRange getPostUpdateMethodTextRange();
+
+ /**
* Returns the pre-persist method name.
*/
String getPrePersistMethod();
@@ -97,6 +184,11 @@
String getPrePersistMethodDescription();
/**
+ * Returns the {@link TextRange} of the pre-persist method name.
+ */
+ TextRange getPrePersistMethodTextRange();
+
+ /**
* Returns the pre-remove method name.
*/
String getPreRemoveMethod();
@@ -107,6 +199,11 @@
String getPreRemoveMethodDescription();
/**
+ * Returns the {@link TextRange} of the pre-remove method name.
+ */
+ TextRange getPreRemoveMethodTextRange();
+
+ /**
* Returns the pre-update method name.
*/
String getPreUpdateMethod();
@@ -117,6 +214,11 @@
String getPreUpdateMethodDescription();
/**
+ * Returns the {@link TextRange} of the pre-update method name.
+ */
+ TextRange getPreUpdateMethodTextRange();
+
+ /**
* Sets the class name of this listener.
*/
void setClassName(String name);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityListenerHolder.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityListenerHolder.java
index 426ca88..90e8d4c 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityListenerHolder.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityListenerHolder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
/**
* Defines an external ORM object that holds on to {@link ExternalEntityListener}. Implementors of
@@ -25,20 +25,19 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
public interface ExternalEntityListenerHolder extends ExternalForm {
/**
* Adds a entity listener with the given name.
*/
- void addEntityListener(int index, String className);
+ ExternalEntityListener addEntityListener(String className);
/**
* Returns a list of entity listeners to be used in this external form.
*/
- ListIterable<ExternalEntityListener> entityListeners();
+ List<ExternalEntityListener> entityListeners();
/**
* Returns the count of entity listeners.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityResult.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityResult.java
index 64f9d35..8e0d557 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityResult.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and describes the configurable properties defined for a entity result in the ORM
@@ -29,20 +30,35 @@
* @see javax.persistence.EntityResult
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalEntityResult extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the discriminator-column property.
+ */
+ String DISCRIMINATOR_COLUMN = "discriminator-column";
+
+ /**
+ * The attribute name used to store and retrieve the entity-class property.
+ */
+ String ENTITY_CLASS = "entity-class";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String ENTITY_RESULT = "entity-result";
+
+ /**
* Adds a field result with the given name.
*/
- void addFieldResult(int index, String name);
+ ExternalFieldResult addFieldResult(String name);
/**
* Returns a list of field result mappings.
*/
- ListIterable<ExternalFieldResult> fieldResults();
+ List<ExternalFieldResult> fieldResults();
/**
* Returns the count of all the field result mappings.
@@ -55,22 +71,27 @@
String getDiscriminatorColumnName();
/**
+ * Returns the {@link TextRange} for the discriminator column name that identifies this result.
+ */
+ TextRange getDiscriminatorColumnNameTextRange();
+
+ /**
* Returns the name of the targeted entity class.
*/
String getEntityClassName();
/**
+ * Returns the {@link TextRange} for the name of the targeted entity class.
+ */
+ TextRange getEntityClassNameTextRange();
+
+ /**
* Returns the field result at the specified position.
*/
ExternalFieldResult getFieldResult(int index);
/**
- * Returns the position of this entity result within the list of entity results owned by the parent.
- */
- int getIndex();
-
- /**
- * Removes the field result at the specified position.
+ * Removes the field result at the given position.
*/
void removeFieldResult(int index);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityTable.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityTable.java
index 28003c3..aff0052 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityTable.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntityTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,7 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import java.util.ListIterator;
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.eclipse.persistence.tools.utility.iterable.ListIterable;
/**
@@ -29,15 +31,30 @@
* @see javax.persistence.Table
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalEntityTable extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the catalog property.
+ */
+ String CATALOG = "catalog";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The attribute name used to store and retrieve the schema property.
+ */
+ String SCHEMA = "schema";
+
+ /**
* Adds unique constraint with the provided column names.
*/
- void addUniqueConstraint(int index, ListIterator<String> columnNames);
+ ExternalUniqueConstraint addUniqueConstraint(ListIterable<String> columnNames);
/**
* Returns the name of this table's catalog.
@@ -45,16 +62,31 @@
String getCatalogName();
/**
+ * Returns the {@link TextRange} of the catalog.
+ */
+ TextRange getCatalogTextRange();
+
+ /**
* Returns the name of the table.
*/
String getName();
/**
+ * Returns the {@link TextRange} of the table name.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Returns the name of this table's schema.
*/
String getSchemaName();
/**
+ * Returns the {@link TextRange} of the schema name.
+ */
+ TextRange getSchemaTextRange();
+
+ /**
* Returns the unique constraints at the specified index.
*/
ExternalUniqueConstraint getUniqueConstraint(int index);
@@ -65,7 +97,7 @@
void removeAllUniqueConstraints();
/**
- * Remove the unique constraint at the specified index.
+ * Remove the unique constraint at the given position.
*/
void removeUniqueConstraint(int index);
@@ -87,7 +119,7 @@
/**
* Returns a list of all unique constraints defined for this table definition.
*/
- ListIterable<ExternalUniqueConstraint> uniqueConstraints();
+ List<ExternalUniqueConstraint> uniqueConstraints();
/**
* Returns the count of all unique constraints defined for this table definition.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFetchGroup.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFetchGroup.java
index 5973ef2..9957ebe 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFetchGroup.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFetchGroup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior describes the configurable properties for an fetch group.
* One or more fetch groups can be declared as part of an entity
@@ -24,20 +27,35 @@
*
* @see org.eclipse.persistence.annotations.FetchGroup
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalFetchGroup extends ExternalForm {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String FETCH_GROUP = "fetch-group";
+
+ /**
+ * The attribute name used to store and retrieve the load property.
+ */
+ String LOAD = "load";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
* Returns whether this fetch group loads.
*/
Boolean doesLoad();
/**
- * Returns the index of this element in its owning parent.
+ * Returns the {@link TextRange} for the this fetch group loads value.
*/
- int getIndex();
+ TextRange getDoesLoadTextRange();
/**
* Returns the name of fetch group.
@@ -45,6 +63,11 @@
String getName();
/**
+ * Returns the {@link TextRange} for the name of fetch group.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Sets the name for the fetch group.
*/
void setName(String name);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFetchableMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFetchableMapping.java
index b38c6b9..acd383b 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFetchableMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFetchableMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,7 @@
package org.eclipse.persistence.tools.mapping.orm;
import javax.persistence.FetchType;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface defines all of the behavior associated with all mappings that are fetchable {@link
@@ -26,16 +27,27 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html,persistence specificaton
*
- * @version 2.5
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalFetchableMapping extends ExternalNonTransientMapping {
/**
+ * The attribute name used to store and retrieve the fetch property.
+ */
+ String FETCH = "fetch";
+
+ /**
* Indicates the {@link FetchType} of this mapping.
*/
FetchType getFetchType();
/**
+ * Indicates the {@link TextRange} for the {@link FetchType} value.
+ */
+ TextRange getFetchTypeTextRange();
+
+ /**
* Sets the {@link FetchType} of this mapping.
*/
void setFetchType(FetchType type);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFieldResult.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFieldResult.java
index 1cae9af..6b8c11b 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFieldResult.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalFieldResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior describe the configurable properties defined for a field
* result in the ORM xml. Used inside an entity result to describe query result mapping.
@@ -25,20 +28,35 @@
* @see javax.persistence.NamedNativeQuery
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalFieldResult extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the map-key property.
+ */
+ String COLUMN = "column";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String FIELD_RESULT = "field-result";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
* Returns the column name associated with this result.
*/
String getColumnName();
/**
- * Returns the position of this field result within the list of field results owned by the parent.
+ * Returns the {@link TextRange} for the column name associated with this result.
*/
- int getIndex();
+ TextRange getColumnNameTextRange();
/**
* Returns the name of the field result.
@@ -46,6 +64,11 @@
String getName();
/**
+ * Returns the {@link TextRange} for the name of the field result.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Sets the column name.
*/
void setColumnName(String name);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalGeneratedMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalGeneratedMapping.java
index 73751d2..6a7c8ea 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalGeneratedMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalGeneratedMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -27,8 +27,7 @@
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html,
* persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
public interface ExternalGeneratedMapping extends ExternalMapping {
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalIDMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalIDMapping.java
index 0afa40a..18ac1c8 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalIDMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalIDMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -27,9 +27,19 @@
* @see javax.persistence.Id
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
-public interface ExternalIDMapping extends ExternalVersionMapping, ExternalGeneratedMapping {
+@SuppressWarnings("nls")
+public interface ExternalIDMapping extends ExternalVersionMapping,
+ ExternalGeneratedMapping {
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String ID = "id";
+
+ /**
+ * The element name used to store and retrieve the temporal child text node.
+ */
+ String TEMPORAL = "temporal";
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalInstantiationCopyPolicy.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalInstantiationCopyPolicy.java
index 54eac3d..6fe0370 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalInstantiationCopyPolicy.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalInstantiationCopyPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+
/**
* This interface and inherited behavior describe for a instantiation copy policy in the EclipseLink
* 1.1 ORM xml.
@@ -24,8 +26,13 @@
*
* @see org.eclipse.persistence.annotations.InstantiationCopyPolicy
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalInstantiationCopyPolicy extends ExternalForm {
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String INSTANTIATION_COPY_POLICY = "instantiation-copy-policy";
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalInverseJoinColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalInverseJoinColumn.java
new file mode 100644
index 0000000..51fd85e
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalInverseJoinColumn.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * This software is the proprietary information of Oracle Corporation.
+ * Use is subject to license terms.
+ */
+package org.eclipse.persistence.tools.mapping.orm;
+
+/**
+ * The external form of an inverse Join column.
+ *
+ * @see JoinTable
+ * @version 2.6
+ */
+@SuppressWarnings("nls")
+public interface ExternalInverseJoinColumn extends ExternalJoinColumn {
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String INVERSE_JOIN_COLUMN = "inverse-join-column";
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalJoinColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalJoinColumn.java
index d72a474..a18005f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalJoinColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalJoinColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior describe the configurable properties defined for a join
* column in the ORM xml. A join column is used inside a join table to describing multi table
@@ -26,27 +28,47 @@
* @see javax.persistence.JoinColumn
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalJoinColumn extends ExternalBasicColumn {
/**
+ * The attribute name used to store and retrieve the base property.
+ */
+ String BASE = "base";
+
+ /**
+ * The attribute name used to store and retrieve the contiguous property.
+ */
+ String CONTIGUOUS = "contiguous";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String JOIN_COLUMN = "join-column";
+
+ /**
+ * The attribute name used to store and retrieve the mapped-by property.
+ */
+ String REFERENCED_COLUMN_NAME = "referenced-column-name";
+
+ /**
* Returns the base integer for this column
*/
Integer getBase();
/**
- * The index of this join column among the list of join columns.
- */
- int getIndex();
-
- /**
* Returns the target column name referenced by this join column.
*/
String getReferenceColumnName();
/**
+ * Returns the {@link TextRange} for the target column name referenced by this join column.
+ */
+ TextRange getReferenceColumnNameTextRange();
+
+ /**
* Returns boolean indicating whether or not this column is contiguous
*/
Boolean isContiguous();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalJoinTable.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalJoinTable.java
index 0dd6374..f3319a6 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalJoinTable.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalJoinTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,7 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
/**
* This interface and inherited behavior describe the configurable properties defined for a join
@@ -28,15 +27,14 @@
* @see javax.persistence.JoinTable
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
public interface ExternalJoinTable extends ExternalReferenceTable {
/**
* Adds a inverse join column with the given name.
*/
- void addInverseJoinColumn(int index, String name);
+ ExternalJoinColumn addInverseJoinColumn(String name);
/**
* Returns the join column at the specified position.
@@ -46,7 +44,7 @@
/**
* Returns a list of inverse join columns used in this join table definition.
*/
- ListIterable<ExternalJoinColumn> inverseJoinColumns();
+ List<ExternalJoinColumn> inverseJoinColumns();
/**
* Returns the count of inverse join columns used in this join table definition.
@@ -54,7 +52,7 @@
int inverseJoinColumnsSize();
/**
- * Removes the inverse join column named
+ * Removes the inverse join column at the given position.
*/
void removeInverseJoinColumn(int index);
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalManyToManyMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalManyToManyMapping.java
index 6fca09b..0b28c8e 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalManyToManyMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalManyToManyMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -25,11 +25,15 @@
* @see javax.persistence.ManyToMany
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalManyToManyMapping extends ExternalMappableMapping,
ExternalObjectCollectionMapping,
ExternaNoSqlJoinFieldMapping {
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String MANY_TO_MANY = "many-to-many";
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalManyToOneMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalManyToOneMapping.java
index 22ef15a..a7b0b02 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalManyToOneMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalManyToOneMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and inherited behavior describe the configurable properties defined for a
@@ -28,16 +28,31 @@
* @see javax.persistence.ManyToOne
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalManyToOneMapping extends ExternalMappableMapping,
ExternaNoSqlJoinFieldMapping {
/**
+ * The attribute name used to store and retrieve the id property.
+ */
+ String ID = "id";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String MANY_TO_ONE = "many-to-one";
+
+ /**
+ * The attribute name used to store and retrieve the maps-id property.
+ */
+ String MAPS_ID = "maps-id";
+
+ /**
* Adds a join column with the given name
*/
- void addJoinColumn(int index, String name);
+ ExternalJoinColumn addJoinColumn(String name);
/**
* Returns the id property.
@@ -45,6 +60,11 @@
Boolean getId();
/**
+ * Returns the {@link TextRange} for the id property.
+ */
+ TextRange getIdTextRange();
+
+ /**
* Returns a join column with the given name.
*/
ExternalJoinColumn getJoinColumn(int index);
@@ -55,9 +75,14 @@
String getMapsId();
/**
+ * Returns the {@link TextRange} for the maps id value.
+ */
+ TextRange getMapsIdTextRange();
+
+ /**
* Returns the join column for this mapping.
*/
- ListIterable<ExternalJoinColumn> joinColumns();
+ List<ExternalJoinColumn> joinColumns();
/**
* Returns the count of join columns for this mapping.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappableMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappableMapping.java
index 0248c7a..f39773f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappableMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappableMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior define properties associated with "mappable" mappings that
* can be enumerated in the ORM xml. Mappable in this case means, that a mapping can designate
@@ -25,17 +27,27 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalMappableMapping extends ExternalRelationshipMapping {
/**
+ * The attribute name used to store and retrieve the mapped-by property.
+ */
+ String MAPPED_BY = "mapped-by-id";
+
+ /**
* Returns TODO.
*/
String getMappedByMappingName();
/**
+ * Returns the {@link TextRange} for the mapped by mapping name value.
+ */
+ TextRange getMappedByMappingNameTextRange();
+
+ /**
* Sets the name TODO.
*/
void setMappedByMappingName(String name);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappedMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappedMapping.java
index 040f78e..57b560a 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappedMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappedMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface defines all of the behavior associated with all non-transient
* mappings defined in the ORM xml.
@@ -24,12 +26,16 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html,persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
public interface ExternalMappedMapping extends ExternalFetchableMapping {
/**
+ * Returns the {@link TextRange} for the optional value.
+ */
+ TextRange getOptionalTextRange();
+
+ /**
* Indicates if the mapping is optional.
*/
Boolean isOptional();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappedSuperClass.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappedSuperClass.java
new file mode 100644
index 0000000..9f4a267
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappedSuperClass.java
@@ -0,0 +1,404 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping.orm;
+
+import java.util.List;
+import org.eclipse.persistence.annotations.ExistenceType;
+import org.eclipse.persistence.tools.utility.TextRange;
+
+/**
+ * This interface and inherited behavior describe the configurable properties defined for a
+ * mapped superclass entity in the ORM xml. One or more mapped superclass entity may be declared
+ * at the root of the ORM xml.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.<p>
+ *
+ * @see javax.persistence.MappedSuperclass
+ * @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
+ *
+ * @version 2.6
+ */
+@SuppressWarnings("nls")
+public interface ExternalMappedSuperClass extends ExternalEmbeddable,
+ ExternalEntityListener,
+ ExternalEntityListenerHolder {
+
+ /**
+ * The element name used to store and retrieve the cache-intercepter child node.
+ */
+ String CACHE_INTERCEPTOR = "cache-interceptor";
+
+ /**
+ * The attribute name used to store and retrieve the cacheable property
+ */
+ String CACHEABLE = "cacheable";
+
+ /**
+ * The element name used to store and retrieve the exclude-default-listeners child node.
+ */
+ String EXCLUDE_DEFAULT_LISTENERS = "exclude-default-listeners";
+
+ /**
+ * The element name used to store and retrieve the exclude-superclass-listeners child node.
+ */
+ String EXCLUDE_SUPERCLASS_LISTENERS = "exclude-superclass-listeners";
+
+ /**
+ * The attribute name used to store and retrieve the existence-checking property.
+ */
+ String EXISTENCE_CHECKING = "existence-checking";
+
+ /**
+ * The element name used to store and retrieve the id-class child node.
+ */
+ String ID_CLASS = "id-class";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String MAPPED_SUPERCLASS = "mapped-superclass";
+
+ /**
+ * The attribute name used to store and retrieve the method-name property of the callback child nodes.
+ */
+ String METHOD_NAME = "method-name";
+
+ /**
+ * The element name used to store and retrieve the multitenant child node.
+ */
+ String MULTITENANT = "multitenant";
+
+ /**
+ * The attribute name used to store and retrieve the optimistic-locking property.
+ */
+ String OPTIMISTIC_LOCKING = "optimistic-locking";
+
+ /**
+ * The element name used to store and retrieve the parent-class child node.
+ */
+ String PARENT_CLASS = "parent-class";
+
+ /**
+ * The element name used to store and retrieve the post-load child node.
+ */
+ String POST_LOAD = "post-load";
+
+ /**
+ * The element name used to store and retrieve the post-persist child node.
+ */
+ String POST_PERSIST = "post-persist";
+
+ /**
+ * The element name used to store and retrieve the post-remove child node.
+ */
+ String POST_REMOVE = "post-remove";
+
+ /**
+ * The element name used to store and retrieve the post-update child node.
+ */
+ String POST_UPDATE = "post-update";
+
+ /**
+ * The element name used to store and retrieve the pre-persist child node.
+ */
+ String PRE_PERSIST = "pre-persist";
+
+ /**
+ * The element name used to store and retrieve the pre-remove child node.
+ */
+ String PRE_REMOVE = "pre-remove";
+
+ /**
+ * The element name used to store and retrieve the pre-update child node.
+ */
+ String PRE_UPDATE = "pre-update";
+
+ /**
+ * The attribute name used to store and retrieve the primary-key property.
+ */
+ String PRIMARY_KEY = "primary-key";
+
+ /**
+ * The attribute name used to store and retrieve the read-only property.
+ */
+ String READ_ONLY = "read-only";
+
+ /**
+ * Adds a cache to this entity.
+ */
+ ExternalCache addCache();
+
+ /**
+ * Adds an embedded id mapping with the given name.
+ */
+ ExternalEmbeddedIDMapping addEmbeddedIdMapping(String name);
+
+ /**
+ * Adds a fetch group with the given name.
+ */
+ ExternalFetchGroup addFetchGroup(String name);
+
+ /**
+ * Adds multitenancy to this entity.
+ */
+ ExternalMultitenancyPolicy addMultitenancy();
+
+ /**
+ * Create new Optimistic locking for this entity replacing the old one.
+ */
+ ExternalOptimisticLocking addOptimisticLocking();
+
+ /**
+ * Creates new primary key for this entity replacing the old one.
+ */
+ ExternalPrimaryKey addPrimaryKey();
+
+ /**
+ * Creates a new sequence generator for this entity.
+ */
+ ExternalSequenceGenerator addSequenceGenerator();
+
+ /**
+ * Creates a new table generator for this entity.
+ */
+ ExternalTableGenerator addTableGenerator();
+
+ /**
+ * Adds a transformation mapping with the given name.
+ */
+ ExternalTransformationMapping addTransformationMapping(String name);
+
+ /**
+ * Adds a variable one-to-one mapping with the given name.
+ */
+ ExternalVariableOneToOneMapping addVariableOneToOneMapping(String name);
+
+ /**
+ * Adds a version mapping with the given name.
+ */
+ ExternalVersionMapping addVersionMapping(String name);
+
+ /**
+ * Returns a list of the fetch groups defined for this entity.
+ */
+ List<ExternalFetchGroup> fetchGroups();
+
+ /**
+ * Returns the count of fetch groups defined for this entity.
+ */
+ int fetchGroupsSize();
+
+ /**
+ * Returns the cache for this entity.
+ */
+ ExternalCache getCache();
+
+ /**
+ * Returns the {@link TextRange} of the cacheable property.
+ */
+ TextRange getCacheableTextRange();
+
+ /**
+ * Returns the cache intercepter class name defined for this entity.
+ */
+ String getCacheInterceptorClassName();
+
+ /**
+ * Returns the {@link TextRange} for the cache intercepter class name defined for this entity.
+ */
+ TextRange getCacheInterceptorClassNameTextRange();
+
+ /**
+ * Returns the {@link TextRange} of the excludes class listeners value.
+ */
+ TextRange getExcludesClassListenersTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the excludes superclass listeners value.
+ */
+ TextRange getExcludesSuperClassListenersTextRange();
+
+ /**
+ * Returns the existence type for this entity
+ */
+ ExistenceType getExistenceCheckingType();
+
+ /**
+ * Returns the {@link TextRange} for the existence type for this entity
+ */
+ TextRange getExistenceCheckingTypeTextRange();
+
+ /**
+ * Returns the fetch group at the given position.
+ */
+ ExternalFetchGroup getFetchGroup(int index);
+
+ /**
+ * Returns the ID class name defined for this entity.
+ */
+ String getIdClassName();
+
+ /**
+ * Returns the {@link TextRange} for the ID class name defined for this entity.
+ */
+ TextRange getIdClassNameTextRange();
+
+ /**
+ * Returns the description of the mappings in this entity
+ */
+ String getMappingsDescription();
+
+ /**
+ * Returns the multitenancy policy for this entity.
+ */
+ ExternalMultitenancyPolicy getMultitenant();
+
+ /**
+ * Returns the {@link TextRange} for the multitenant of this entity.
+ */
+ TextRange getMultitenantTextRange();
+
+ /**
+ * Returns the optimistic locking definition for this entity.
+ */
+ ExternalOptimisticLocking getOptimisticLocking();
+
+ /**
+ * Returns the name of the parent class of this entity.
+ */
+ String getParentClassName();
+
+ /**
+ * Returns the {@link TextRange} for the name of the parent class of this entity.
+ */
+ TextRange getParentClassNameTextRange();
+
+ /**
+ * Returns the primary key definition for this entity.
+ */
+ ExternalPrimaryKey getPrimaryKey();
+
+ /**
+ * Returns the {@link TextRange} of the read-only property.
+ */
+ TextRange getReadOnlyTextRange();
+
+ /**
+ * Returns the sequence generator defined for this entity if one exists.
+ */
+ ExternalSequenceGenerator getSequenceGenerator();
+
+ /**
+ * Returns the table generator for this entity if one exists.
+ */
+ ExternalTableGenerator getTableGenerator();
+
+ /**
+ * Returns whether this entity is cacheable.
+ */
+ Boolean isCacheable();
+
+ /**
+ * Returns whether this entity has multitenant.
+ */
+ Boolean isMultitenant();
+
+ /**
+ * Returns whether this entity is read only.
+ */
+ Boolean isReadOnly();
+
+ /**
+ * Removes the cache from this entity if it exists.
+ */
+ void removeCache();
+
+ /**
+ * Removes the fetch group specified at the given position.
+ */
+ void removeFetchGroup(int index);
+
+ /**
+ * Removes the multitenancy from this entity.
+ */
+ void removeMultiTenancy();
+
+ /**
+ * Removes the optimistic locking from this entity if it exists.
+ */
+ void removeOptimisticLocking();
+
+ /**
+ * Removes the primary Key definition from this entity if it exists.
+ */
+ void removePrimaryKey();
+
+ /**
+ * Sets whether this entity is cacheable or not.
+ */
+ void setCacheable(Boolean cacheable);
+
+ /**
+ * Sets the name of the cache intercepter class declared for this entity.
+ */
+ void setCacheInterceptorClassName(String className);
+
+ /**
+ * Sets if this entity should exclude default class listener methods.
+ */
+ void setExcludesClassListeners(Boolean excludeClassListeners);
+
+ /**
+ * Sets if this entity has declared to exclude listener methods defined on mapped superclasses.
+ */
+ void setExcludesSuperClassListeners(Boolean excludesSuperClassListeners);
+
+ /**
+ * Sets the existence checking type for this entity.
+ */
+ void setExistenceCheckingType(ExistenceType type);
+
+ /**
+ * Sets the name of the ID class declared for this entity.
+ */
+ void setIdClassName(String className);
+
+ /**
+ * Sets the description for the mappings on this entity.
+ */
+ void setMappingsDescription(String description);
+
+ /**
+ * Sets the name of the parent class of this entity.
+ */
+ void setParentClassName(String className);
+
+ /**
+ * Sets whether this entity is read only.
+ */
+ void setReadOnly(Boolean readOnly);
+
+ /**
+ * Returns if this entity has declared to exclude default listener methods.
+ */
+ Boolean shouldExcludesClassListeners();
+
+ /**
+ * Returns if this entity has declared to exclude listener methods defined on mapped superclasses.
+ */
+ Boolean shouldExcludesSuperClassListeners();
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappedSuperClassEntity.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappedSuperClassEntity.java
deleted file mode 100644
index 1afb92e..0000000
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMappedSuperClassEntity.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.persistence.tools.mapping.orm;
-
-import org.eclipse.persistence.annotations.ExistenceType;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
-/**
- * This interface and inherited behavior describe the configurable properties defined for a
- * mapped superclass entity in the ORM xml. One or more mapped superclass entity may be declared
- * at the root of the ORM xml.
- * <p>
- * Provisional API: This interface is part of an interim API that is still under development and
- * expected to change significantly before reaching stability. It is available at this early stage
- * to solicit feedback from pioneering adopters on the understanding that any code that uses this
- * API will almost certainly be broken (repeatedly) as the API evolves.<p>
- *
- * @see javax.persistence.MappedSuperclass
- * @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
- *
- * @version 2.5
- * @author John Bracken
- */
-public interface ExternalMappedSuperClassEntity extends ExternalEmbeddableEntity,
- ExternalEntityListener,
- ExternalEntityListenerHolder {
-
- /**
- * Adds a cache to this entity.
- */
- ExternalCache addCache();
-
- /**
- * Adds an embedded id mapping with the given name.
- */
- ExternalEmbeddedIDMapping addEmbeddedIdMapping(String name);
-
- /**
- * Adds a fetch group with the given name.
- */
- ExternalFetchGroup addFetchGroup(int index, String name);
-
- /**
- * Adds multitenancy
- */
- ExternalMultitenancyPolicy addMultitenancy();
-
- /**
- * Create new Optimistic locking for this entity replacing the old one.
- */
- ExternalOptimisticLocking addOptimisticLocking();
-
- /**
- * Creates new primary key for this entity replacing the old one.
- */
- ExternalPrimaryKey addPrimaryKey();
-
- /**
- * Creates a new sequence generator for this entity.
- */
- ExternalSequenceGenerator addSequenceGenerator();
-
- /**
- * Creates a new table generator for this entity.
- */
- ExternalTableGenerator addTableGenerator();
-
- /**
- * Adds a transformation mapping with the given name.
- */
- ExternalTransformationMapping addTransformationMapping(String name);
-
- /**
- * Adds a variable one-to-one mapping with the given name.
- */
- ExternalVariableOneToOneMapping addVariableOneToOneMapping(String name);
-
- /**
- * Adds a version mapping with the given name.
- */
- ExternalVersionMapping addVersionMapping(String name);
-
- /**
- * Returns a list of the fetch groups defined for this entity.
- */
- ListIterable<ExternalFetchGroup> fetchGroups();
-
- /**
- * Returns the count of fetch groups defined for this entity.
- */
- int fetchGroupsSize();
-
- /**
- * Returns the cache for this entity.
- */
- ExternalCache getCache();
-
- /**
- * Returns the cache intercepter class name defined for this entity.
- */
- String getCacheInterceptorClassName();
-
- /**
- * Returns the existence type for this entity
- */
- ExistenceType getExistenceCheckingType();
-
- /**
- * Returns the fetch group at the given index.
- */
- ExternalFetchGroup getFetchGroup(int index);
-
- /**
- * Returns the ID class name defined for this entity.
- */
- String getIdClassName();
-
- /**
- * Returns the description of the mappings in this entity
- */
- String getMappingsDescription();
-
- /**
- * Returns the multitenancy policy for this entity
- */
- ExternalMultitenancyPolicy getMultitenant();
-
- /**
- * Returns the optimistic locking definition for this entity.
- */
- ExternalOptimisticLocking getOptimisticLocking();
-
- /**
- * Returns the name of the parent class of this entity.
- */
- String getParentClassName();
-
- /**
- * Returns the primary key definition for this entity.
- */
- ExternalPrimaryKey getPrimaryKey();
-
- /**
- * Returns the sequence generator defined for this entity if one exists.
- */
- ExternalSequenceGenerator getSequenceGenerator();
-
- /**
- * Returns the table generator for this entity if one exists.
- */
- ExternalTableGenerator getTableGenerator();
-
- /**
- * Returns whether this entity is cacheable.
- */
- Boolean isCacheable();
-
- /**
- * Returns whether this eneity has multitenant
- */
- Boolean isMultitenant();
-
- /**
- * Returns whether this entity is read only.
- */
- Boolean isReadOnly();
-
- /**
- * Removes the cache from this entity if it exists.
- */
- void removeCache();
-
- /**
- * Removes the fetch group specified at the given position.
- */
- void removeFetchGroup(int index);
-
- /**
- * Removes multitenancy
- */
- void removeMultiTenancy();
-
- /**
- * Removes the optimistic locking from this entity if it exists.
- */
- void removeOptimisticLocking();
-
- /**
- * Removes the primary Key definition from this entity if it exists.
- */
- void removePrimaryKey();
-
- /**
- * Sets whether this entity is cacheable
- */
- void setCacheable(Boolean cacheable);
-
- /**
- * Sets the name of the cache intercepter class declared for this entity.
- */
- void setCacheInterceptorClassName(String className);
-
- /**
- * Sets if this entity should exclude default class listener methods.
- */
- void setExcludesClassListeners(Boolean excludeClassListeners);
-
- /**
- * Sets if this entity has declared to exclude listener methods defined on mapped superclasses.
- */
- void setExcludesSuperClassListeners(Boolean excludesSuperClassListeners);
-
- /**
- * Sets the existence checking type for this entity.
- */
- void setExistenceCheckingType(ExistenceType type);
-
- /**
- * Sets the name of the ID class declared for this entity.
- */
- void setIdClassName(String className);
-
- /**
- * Sets the description for the mappings on this entity
- */
- void setMappingsDescription(String description);
-
- /**
- * Sets the name of the parent class of this entity
- */
- void setParentClassName(String className);
-
- /**
- * Sets whether this entity is read only
- */
- void setReadOnly(Boolean readOnly);
-
- /**
- * Returns if this entity has declared to exclude default listener methods.
- */
- Boolean shouldExcludesClassListeners();
-
- /**
- * Returns if this entity has declared to exclude listener methods defined on mapped superclasses.
- */
- Boolean shouldExcludesSuperClassListeners();
-}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMapping.java
index c85436b..1d7fff5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface represents the basis for all mapping types defined by the JPA spec that are
@@ -25,70 +27,86 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalMapping extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the attribute type.
+ */
+ String ATTRIBUTE_TYPE = "attribute-type";
+
+ /**
+ * The element name used to store and retrieve the parent element of element represented by this external form.
+ */
+ String ATTRIBUTES = "attributes";
+
+ /**
+ * The attribute name used to store and retrieve the mapping's name.
+ */
+ String NAME = "name";
+
+ /**
* Returns the attribute type of this mapping.
*/
String getAttributeType();
-
+
/**
- * Returns the short name of the attribute type
- * of this mapping.
- */
+ * Returns the short name of the attribute type of this mapping.
+ */
String getAttributeTypeShortName();
-
+
+ /**
+ * Returns the {@link TextRange} for the attribute type value.
+ */
+ TextRange getAttributeTypeTextRange();
+
+ /**
+ * Derives a getter method name for this mapping's attribute.
+ */
+ String getGetMethodName();
+
/**
* Returns the name of the mapping.
*/
String getName();
-
+
/**
- * Indicates whether this mapping is of type
- * {@link Basic}.
+ * Returns the {@link TextRange} for the name of the mapping.
*/
- boolean isBasicMapping();
-
+ TextRange getNameTextRange();
+
/**
- * Indicates whether this mapping is of type
- * {@link ElementCollection}.
- */
- boolean isElementCollectionMapping();
-
- /**
- * Indicates whether this mapping is of type
- * {@link Embedded}.
- */
- boolean isEmbeddedMapping();
-
-
- /**
- * Derives a getter method name for this mapping's
- * attribute.
- */
- String getGetMethodName();
-
- /**
- * Derives a setter method name for this mapping's
- * attribute.
+ * Derives a setter method name for this mapping's attribute.
*/
String getSetMethodName();
-
+
/**
- * Indicates whether this mapping is of type
- * {@link Id}.
+ * Indicates whether this mapping is of type {@link Basic}.
+ */
+ boolean isBasicMapping();
+
+ /**
+ * Indicates whether this mapping is of type {@link ElementCollection}.
+ */
+ boolean isElementCollectionMapping();
+
+ /**
+ * Indicates whether this mapping is of type {@link Embedded}.
+ */
+ boolean isEmbeddedMapping();
+
+ /**
+ * Indicates whether this mapping is of type {@link Id}.
*/
boolean isIdMapping();
-
+
/**
* Sets the attribute type of this mapping.
*/
void setAttributeType(String attributeType);
-
/**
* Sets the name of the mapping.
*/
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMultitenancyPolicy.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMultitenancyPolicy.java
index b32ae2a..e2b77e6 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMultitenancyPolicy.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalMultitenancyPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,10 +14,11 @@
package org.eclipse.persistence.tools.mapping.orm;
import org.eclipse.persistence.annotations.MultitenantType;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and inherited behavior describes the configurable properties for an multitenant.
- * Multitenancy can be declared on Entites, MappedSuperclasse, and on the ORMConfiguration.
+ * Multitenancy can be declared on entities, mapped superclasses, and on the ORM configuration.
* <p>
* Provisional API: This interface is part of an interim API that is still under development and
* expected to change significantly before reaching stability. It is available at this early stage
@@ -26,18 +27,73 @@
*
* @see org.eclipse.persistence.annotations.Multitenant
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalMultitenancyPolicy extends ExternalTenantDiscriminatorColumnProvider {
/**
+ * The attribute name used to store and retrieve the include-criteria property.
+ */
+ String INCLUDE_CRITERIA = "include-criteria";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String MULTITENANT = "multitenant";
+
+ /**
+ * The attribute name used to store and retrieve the type property.
+ */
+ String TYPE = "type";
+
+ /**
+ * Adds the tenant table discriminator.
+ */
+ ExternalTenantTableDiscriminator addTenantTableDiscriminator();
+
+ /**
+ * Returns the {@link TextRange} for the include criteria property.
+ */
+ TextRange getIncludeCriteriaTextRange();
+
+ /**
* Returns the multitenant type.
*/
MultitenantType getMultitenantType();
/**
- * Sets the multitenant type.
+ * Returns the {@link TextRange} for the type.
+ */
+ TextRange getMultitenantTypeTextRange();
+
+ /**
+ * Returns the tenant table discriminator.
+ */
+ ExternalTenantTableDiscriminator getTenantTableDiscriminator();
+
+ /**
+ * Returns the {@link TextRange} for the tenant table discriminator.
+ */
+ TextRange getTenantTableDiscriminatorTextRange();
+
+ /**
+ * Determines whether the tenant criteria should be included.
+ */
+ Boolean isCriteriaIncluded();
+
+ /**
+ * removes the tenant table discriminator from this policy if it exists
+ */
+ void removeTenantTableDiscriminator();
+
+ /**
+ * Sets whether the tenant criteria should be included.
+ */
+ void setIncludeCriteria(Boolean value);
+
+ /**
+ * sets the multitenant type.
*/
void setMultitenantType(MultitenantType type);
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNamedQuery.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNamedQuery.java
index 1ee8501..def8d53 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNamedQuery.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNamedQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface defines all properties and behavior associated with named query configuration in
@@ -28,24 +29,37 @@
* @see javax.persistence.NamedQuery
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalNamedQuery extends ExternalForm {
/**
+ * The element name of the child text node for the description.
+ */
+ String DESCRIPTION = "description";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The element name used to store and retrieve the query child text node.
+ */
+ String QUERY = "query";
+
+ /**
* Adds a hint with the given name.
*/
- void addQueryHint(int index, String name, String value);
+ ExternalQueryHint addQueryHint(String name, String value);
/**
* Returns the description of query.
*/
String getDescription();
- /**
- * Returns the position of this named query within the list of named queries owned by the parent.
- */
+ @Deprecated
int getIndex();
/**
@@ -54,6 +68,11 @@
String getName();
/**
+ * Returns the {@link TextRange} for the name value.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Returns the string representing the JPAQL (EJBQL) for the queries expression.
*/
String getQuery();
@@ -64,9 +83,14 @@
ExternalQueryHint getQueryHint(int index);
/**
+ * Returns the {@link TextRange} of the JPQL query.
+ */
+ TextRange getQueryTextRange();
+
+ /**
* Returns a list of vender specific query hints associated with this query.
*/
- ListIterable<ExternalQueryHint> queryHints();
+ List<ExternalQueryHint> queryHints();
/**
* Returns the count of vender specific query hints associated with this query.
@@ -74,7 +98,7 @@
int queryHintsSize();
/**
- * Removes the hint named.
+ * Removes the query hint at the given position.
*/
void removeQueryHint(int index);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNativeQuery.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNativeQuery.java
index 63963a0..38366f2 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNativeQuery.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNativeQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior describe the configurable properties defined for a named,
* native query in the ORM xml. A named, native query may be declared at the root level of the ORM
@@ -26,23 +28,48 @@
* @see javax.persistence.NamedNativeQuery
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalNativeQuery extends ExternalNamedQuery {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String NAMED_NATIVE_QUERY = "named-native-query";
+
+ /**
+ * The attribute name used to store and retrieve the result-class property.
+ */
+ String RESULT_CLASS = "result-class";
+
+ /**
+ * The attribute name used to store and retrieve the result-set-mapping property.
+ */
+ String RESULT_SET_MAPPING = "result-set-mapping";
+
+ /**
* Returns the name of the class that will represent the result of this query.
*/
String getResultClassName();
/**
+ * Returns the {@link TextRange} of the result class name value.
+ */
+ TextRange getResultClassNameTextRange();
+
+ /**
* Returns a string representing how the result set from this mapping will be mapped to the give
* result class type.
*/
String getResultSetMapping();
/**
+ * Returns the {@link TextRange} of the result set mapping value.
+ */
+ TextRange getResultSetMappingTextRange();
+
+ /**
* Sets the name of the class that will represent the result of this query.
*/
void setResultClassName(String name);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSql.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSql.java
index 0023ef9..74eff04 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSql.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSql.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+
/**
* The external form representing the NoSQL database.
* <p>
@@ -21,12 +23,28 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
* @since 2.5
*/
+@SuppressWarnings("nls")
public interface ExternalNoSql extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the data format property.
+ */
+ String DATA_FORMAT = "data-format";
+
+ /**
+ * The attribute name used to store and retrieve the data type property.
+ */
+ String DATA_TYPE = "data-type";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String NO_SQL = "no-sql";
+
+ /**
* Returns the order of the fields contained in the database structure type.
*/
DataFormatType getDataFormat();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSqlField.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSqlField.java
index 40ce13d..92afaa7 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSqlField.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSqlField.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+
/**
* Define a structured data type's field name for an object mapped to NoSql data.
* <p>
@@ -21,12 +23,23 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
* @since 2.5
*/
+@SuppressWarnings("nls")
public interface ExternalNoSqlField extends ExternalForm {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String FIELD = "field";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
* Returns the data type's name of the field.
*/
String getName();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSqlJoinField.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSqlJoinField.java
index 70ff23e..00c93cf 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSqlJoinField.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNoSqlJoinField.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+
/**
* The external form of {@link org.eclipse.persistence.nosql.annotations.JoinField JoinField}.
* <p>
@@ -21,12 +23,27 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @since 2.5
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalNoSqlJoinField extends ExternalForm {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String JOIN_FIELD = "join-field";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The attribute name used to store and retrieve the referenced field name property.
+ */
+ String REFERENCED_FIELD_NAME = "referenced-field-name";
+
+ /**
* Returns the name of the foreign key/id reference field in the source record.
*/
String getName();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNonTransientMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNonTransientMapping.java
index e42c274..cd7feff 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNonTransientMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalNonTransientMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,7 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import javax.persistence.AccessType;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
+import org.eclipse.persistence.tools.mapping.ExternalPropertyHolder;
/**
* This interface represents the basis for all non-transient mapping types defined by the
@@ -25,20 +24,16 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-public interface ExternalNonTransientMapping extends ExternalMapping {
+public interface ExternalNonTransientMapping extends ExternalMapping,
+ ExternalAccessType,
+ ExternalPropertyHolder {
/**
* Adds the get and set method names for this mapping.
*/
- void addAccessMethods(String getMethodName, String setMethodName);
-
- /**
- * Adds a property with the given name/value pair to the mapping.
- */
- void addProperty(int index, String name, String value);
+ ExternalAccessMethods addAccessMethods(String getMethodName, String setMethodName);
/**
* Returns the access methods for this mapping.
@@ -46,37 +41,7 @@
ExternalAccessMethods getAccessMethods();
/**
- * Returns the access type for this mapping.
- */
- AccessType getAccessType();
-
- /**
- * Returns the property at the given index.
- */
- ExternalProperty getProperty(int index);
-
- /**
- * Returns a list of the properties defined for this entity.
- */
- ListIterable<ExternalProperty> properties();
-
- /**
- * Returns the count of properties defined for this entity.
- */
- int propertiesSize();
-
- /**
* Removes the access methods element from the mapping.
*/
void removeAccessMethods();
-
- /**
- * Removes the property specified at the given position.
- */
- void removeProperty(int index);
-
- /**
- * Sets the access type for this mapping.
- */
- void setAccessType(AccessType type);
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMConfiguration.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMConfiguration.java
index 716131a..cdf7115 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMConfiguration.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import javax.persistence.AccessType;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
+import java.net.URL;
+import java.util.List;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface defines the root-level contract for providing ORM.xml metadata. The properties
@@ -30,52 +31,61 @@
* @see oracle.toplink.workbench.mappingsmodel.spi.SPIManager
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
-public interface ExternalORMConfiguration extends ExternalTenantDiscriminatorColumnProvider {
+@SuppressWarnings("nls")
+public interface ExternalORMConfiguration extends ExternalTenantDiscriminatorColumnProvider,
+ ExternalAccessType {
+
+ /**
+ * The element name of the child text node for the default catalog name.
+ */
+ String CATALOG = "catalog";
+
+ /**
+ * The element name of the child text node for the description.
+ */
+ String DESCRIPTION = "description";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String ENTITY_MAPPINGS = "entity-mappings";
+
+ /**
+ * The element name of the child text node for the default package name.
+ */
+ String PACKAGE = "package";
+
+ /**
+ * The element name of the child text node for the default schema name.
+ */
+ String SCHEMA = "schema";
/**
* Adds a new converter.
*/
- ExternalConverter addConverter(int index);
-
- /**
- * Adds a embedded entity with the given name.
- */
- ExternalEmbeddableEntity addEmbeddableEntity(String embeddableClassName);
+ ExternalConverter addConverter();
/**
* Adds a embedded entity with the given name.
*/
- void addEmbeddableEntity(int index, String embeddableClassName);
+ ExternalEmbeddable addEmbeddable(String embeddableClassName);
/**
* Adds a entity for the given class name.
*/
- void addEntity(int index, String entityClassName);
-
-
- /**
- * Adds a entity for the given class name.
- */
ExternalEntity addEntity(String entityClassName);
-
-
+
/**
* Adds a mapped super class entity with the given name
*/
- void addMappedSuperClass(int index, String mappedClassName);
+ ExternalMappedSuperClass addMappedSuperClass(String mappedClassName);
/**
* Adds a native query with the given name.
*/
- void addNamedNativeQuery(int index, String name);
-
- /**
- * Adds a named query with the given name.
- */
- ExternalNamedQuery addNamedQuery(int index, String name);
+ ExternalNativeQuery addNamedNativeQuery(String name);
/**
* Adds a named query with the given name.
@@ -85,48 +95,47 @@
/**
* Adds an object type converter.
*/
- ExternalObjectTypeConverter addObjectTypeConverter(int index);
+ ExternalObjectTypeConverter addObjectTypeConverter();
+
+ /**
+ * Creates new persistence unit representing this ORM's persistence unit metadata.
+ */
+ ExternalPersistenceUnit addPersistenceUnitMetaData();
/**
* Adds a sequence generator with the given name
*/
- void addSequenceGenerator(int index, String name);
+ ExternalSequenceGenerator addSequenceGenerator(String name);
/**
* Adds a SQL result set mapping with the given name
*/
- void addSqlResultSetMapping(int index, String name);
+ ExternalSQLResultSetMapping addSqlResultSetMapping(String name);
/**
* Adds a stored procedure query with the given name
*/
- void addStoredProcedureQuery(int index, String name, String procedureName);
+ ExternalStoredProcedureQuery addStoredProcedureQuery(String name, String procedureName);
/**
* Adds a new struct converter.
*/
- ExternalStructConverter addStructConverter(int index);
+ ExternalStructConverter addStructConverter();
/**
* Adds a table generator with the given name
*/
- void addTableGenerator(int index, String name);
+ ExternalTableGenerator addTableGenerator(String name);
/**
* Adds a new type converter.
*/
- ExternalTypeConverter addTypeConverter(int index);
-
- /**
- * Creates new persistence unit representing this ORM's persistence unit metadata replacing
- * the old one.
- */
- ExternalPersistenceUnit buildPersistenceUnitMetaData();
+ ExternalTypeConverter addTypeConverter();
/**
* Returns a list of all converters defined globally for this ORM configuration.
*/
- ListIterable<ExternalConverter> converters();
+ List<ExternalConverter> converters();
/**
* Returns the count of all converters defined globally for this ORM configuration.
@@ -136,17 +145,17 @@
/**
* Returns a list of all embedded entities associated with this ORM configuration.
*/
- ListIterable<ExternalEmbeddableEntity> embeddableEntities();
+ List<ExternalEmbeddable> embeddables();
/**
* Returns the count of embedded entities associated with this ORM configuration.
*/
- int embeddableEntitiesSize();
+ int embeddablesSize();
/**
* Returns a list of all entities associated with this ORM configuration.
*/
- ListIterable<ExternalEntity> entities();
+ List<ExternalEntity> entities();
/**
* Returns the count of entities associated with this ORM configuration.
@@ -154,11 +163,6 @@
int entitiesSize();
/**
- * Returns the access type to be applied to all entities belonging to this ORM xml.
- */
- AccessType getAccessType();
-
- /**
* Returns the current build version of the product.
*
* @return The product's current version
@@ -171,6 +175,11 @@
String getCatalogName();
/**
+ * Returns the {@link TextRange} of the default catalog name value.
+ */
+ TextRange getCatalogNameTextRange();
+
+ /**
* Returns the converter with at the given index.
*/
ExternalConverter getConverter(int index);
@@ -186,39 +195,59 @@
ORMDocumentType getDocumentType();
/**
- * Returns the embeddable entity for the given class name
+ * Returns the embeddable at the given position.
*/
- ExternalEmbeddableEntity getEmbeddableEntity(int index);
+ ExternalEmbeddable getEmbeddable(int index);
/**
- * Returns the entity associated with this ORM configuration identified by the given
- * index.
+ * Returns the embeddable with the given class name.
+ */
+ ExternalEmbeddable getEmbeddable(String className);
+
+ /**
+ * Returns the entity associated with this ORM configuration identified by the given index.
*/
ExternalEntity getEntity(int index);
-
+
/**
- * Returns the entity associated with this ORM configuration identified by
- * the given class name.
+ * Returns the entity associated with this ORM configuration identified by the given class name.
*/
ExternalEntity getEntity(String className);
/**
- * Returns the mapped superclass for the given class name
+ * Returns the location on the file system of the ORM configuration file.
+ *
+ * @return The location on the file system of the ORM configuration file
*/
- ExternalMappedSuperClassEntity getMappedSuperClass(int index);
+ URL getLocation();
/**
- * Returns a native named query with the given name defined in this ORM configuration.
+ * Returns the mapped superclass at the given position.
+ */
+ ExternalMappedSuperClass getMappedSuperClass(int index);
+
+ /**
+ * Returns the mapped superclass for the given class name.
+ */
+ ExternalMappedSuperClass getMappedSuperClass(String className);
+
+ /**
+ * Returns a native named query at the given position.
*/
ExternalNativeQuery getNamedNativeQuery(int index);
/**
- * Returns the named query with the provided name.
+ * Returns the native SQL query with the given name.
+ */
+ ExternalNativeQuery getNamedNativeQuery(String queryName);
+
+ /**
+ * Returns the JPQL query at the given position.
*/
ExternalBasicNamedQuery getNamedQuery(int index);
/**
- * Returns the named query with the given name if it exists.
+ * Returns the JPQL query with the given name.
*/
ExternalBasicNamedQuery getNamedQuery(String queryName);
@@ -233,16 +262,31 @@
String getPackageName();
/**
+ * Returns the {@link TextRange} of the default package name value.
+ */
+ TextRange getPackageNameTextRange();
+
+ /**
* Returns the persistent unit representing this ORM's persistence unit metadata.
*/
ExternalPersistenceUnit getPersistenceUnitMetaData();
/**
+ * Returns the {@link TextRange} of the root element's name.
+ */
+ TextRange getRootElementTextRange();
+
+ /**
* Returns the default schema name to be applied to all referenced tables.
*/
String getSchemaName();
/**
+ * Returns the {@link TextRange} of the default schema name value.
+ */
+ TextRange getSchemaNameTextRange();
+
+ /**
* Returns the sequence generator with the given name.
*/
ExternalSequenceGenerator getSequenceGenerator(int index);
@@ -253,34 +297,34 @@
ExternalSQLResultSetMapping getSqlResultSetMapping(int index);
/**
- * Returns the stored procedure query at the index
+ * Returns the stored procedure query at the position.
*/
ExternalStoredProcedureQuery getStoredProcedureQuery(int index);
/**
- * Returns the stored procedure query with the given name
- */
- ExternalStoredProcedureQuery getStoredProcedureQuery(int index, String name);
-
- /**
- * Returns the struct converter with at the given index.
+ * Returns the struct converter with at the given position.
*/
ExternalStructConverter getStructConverter(int index);
/**
- * Returns a table generator with the specified name if it exists.
+ * Returns the table generator at the given position.
*/
ExternalTableGenerator getTableGenerator(int index);
/**
- * Returns the type converter with at the given index.
+ * Returns the type converter at the given position.
*/
ExternalTypeConverter getTypeConverter(int index);
/**
+ * Derives and returns the XML representation of this configuration.
+ */
+ String getXML();
+
+ /**
* Returns a list of all mapped super class entities associated with this ORM configuration.
*/
- ListIterable<ExternalMappedSuperClassEntity> mappedSuperClasses();
+ List<ExternalMappedSuperClass> mappedSuperClasses();
/**
* Returns the count of mapped super class entities associated with this ORM configuration.
@@ -290,7 +334,7 @@
/**
* Returns a list of all native queries declared globally for this ORM configuration.
*/
- ListIterable<ExternalNativeQuery> namedNativeQueries();
+ List<ExternalNativeQuery> namedNativeQueries();
/**
* Returns the count of all native queries declared globally for this ORM configuration.
@@ -300,7 +344,7 @@
/**
* Returns a list of all named queries declared globally for this ORM configuration.
*/
- ListIterable<ExternalNamedQuery> namedQueries();
+ List<ExternalNamedQuery> namedQueries();
/**
* Returns the count of all named queries declared globally for this ORM configuration.
@@ -310,7 +354,7 @@
/**
* Returns a list of all converters defined globally for this ORM configuration.
*/
- ListIterable<ExternalObjectTypeConverter> objectTypeConverters();
+ List<ExternalObjectTypeConverter> objectTypeConverters();
/**
* Returns the count of all converters defined globally for this ORM configuration.
@@ -318,17 +362,17 @@
int objectTypeConvertersSize();
/**
- * Removes the converter at index.
+ * Removes the converter at the given position.
*/
void removeConverter(int index);
/**
- * Removes the embedded entity named.
+ * Removes the embedded at the given position.
*/
- void removeEmbeddableEntity(int index);
+ void removeEmbeddable(int index);
/**
- * Removes the entity for the given class name.
+ * Removes the entity for the given position.
*/
void removeEntity(int index);
@@ -338,27 +382,27 @@
void removeEntity(String entityClassName);
/**
- * Removes the mapped super class entity named.
+ * Removes the mapped super class at the given position.
*/
void removeMappedSuperClass(int index);
/**
- * Removes the named query named
+ * Removes the JPQL query at the given position.
*/
void removeNamedQuery(int index);
/**
- * Removes the named query named
+ * Removes the JPQL query with the given name.
*/
void removeNamedQuery(String queryName);
/**
- * Removes the native query named.
+ * Removes the native query at the given position.
*/
void removeNativeQuery(int index);
/**
- * Removes the converter at index.
+ * Removes the converter at the given position.
*/
void removeObjectTypeConverter(int index);
@@ -368,39 +412,39 @@
void removePersistenceUnitMetaData();
/**
- * Removes the sequence generator named.
+ * Removes the sequence generator at the given position.
*/
void removeSequenceGenerator(int index);
/**
- * Removes the SQL result set mapping named.
+ * Removes the SQL result set mapping at the given position.
*/
void removeSqlResultSetMapping(int index);
/**
- * Removes the stored procedure query named.
+ * Removes the stored procedure query at the given position.
*/
void removeStoredProcedureQuery(int index);
/**
- * Removes the converter at index.
+ * Removes the converter at the given position.
*/
void removeStructConverter(int index);
/**
- * Removes the table generator named.
+ * Removes the table generator at the given position.
*/
void removeTableGenerator(int index);
/**
- * Removes the converter at index.
+ * Removes the converter at the given position.
*/
void removeTypeConverter(int index);
/**
* Returns a list of all sequence generators defined globally for this ORM configuration.
*/
- ListIterable<ExternalSequenceGenerator> sequenceGenerators();
+ List<ExternalSequenceGenerator> sequenceGenerators();
/**
* Returns the count of all sequence generators defined globally for this ORM configuration.
@@ -408,11 +452,6 @@
int sequenceGeneratorsSize();
/**
- * Set the access type.
- */
- void setAccessType(AccessType type);
-
- /**
* Set the catalog name.
*/
void setCatalogName(String catalog);
@@ -440,7 +479,7 @@
/**
* Returns a list of all SQL result set mappings declared globally for this ORM configuration.
*/
- ListIterable<ExternalSQLResultSetMapping> sqlResultSetMappings();
+ List<ExternalSQLResultSetMapping> sqlResultSetMappings();
/**
* Returns the count of all SQL result set mappings declared globally for this ORM configuration.
@@ -450,7 +489,7 @@
/**
* Returns a list of named stored procedure queries defined for this entity.
*/
- ListIterable<ExternalStoredProcedureQuery> storedProcedureQueries();
+ List<ExternalStoredProcedureQuery> storedProcedureQueries();
/**
* Returns the count of named stored procedure queried defined for this entity
@@ -460,7 +499,7 @@
/**
* Returns a list of all converters defined globally for this ORM configuration.
*/
- ListIterable<ExternalStructConverter> structConverters();
+ List<ExternalStructConverter> structConverters();
/**
* Returns the count of all converters defined globally for this ORM configuration.
@@ -470,7 +509,7 @@
/**
* Returns a list of all table generators defined globally for this ORM configuration.
*/
- ListIterable<ExternalTableGenerator> tableGenerators();
+ List<ExternalTableGenerator> tableGenerators();
/**
* Returns the count of all table generators defined globally for this ORM configuration.
@@ -478,14 +517,9 @@
int tableGeneratorsSize();
/**
- * Derives and returns the XML representation of this configuration.
- */
- String getXML();
-
- /**
* Returns a list of all converters defined globally for this ORM configuration.
*/
- ListIterable<ExternalTypeConverter> typeConverters();
+ List<ExternalTypeConverter> typeConverters();
/**
* Returns the count of all converters defined globally for this ORM configuration.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMRepository.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMRepository.java
index 6ae5450..6854522 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMRepository.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,28 +13,27 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import java.io.IOException;
+import java.net.URL;
+
/**
- * External repository contract for accessing ORM.xml meta data from inside the MW model. The vendor
- * specific implementation of this interfaces should be provided via the {@link ExternalORMRepositoryFactory}.
+ * External repository contract for accessing ORM.xml meta data from inside the MW model.
* <p>
* Provisional API: This interface is part of an interim API that is still under development and
* expected to change significantly before reaching stability. It is available at this early stage
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @see oracle.toplink.workbench.mappingsmodel.spi.jpa.orm.ExternalORMRepositoryFactory
- * @see oracle.toplink.workbench.mappingsmodel.spi.SPIManager
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
-public interface ExternalORMRepository extends ExternalForm {
+public interface ExternalORMRepository {
/**
* Creates an ORM configuration and the given location and returns the external representation of it.
*/
- ExternalORMConfiguration buildORMConfiguration(ORMDocumentType docType);
+ ExternalORMConfiguration buildORMConfiguration(URL location, ORMDocumentType docType) throws IOException;
/**
* Returns an {@link ExternalORMConfiguration} represented by the given ORM.xml's resource path.
@@ -43,5 +42,10 @@
* visible source paths from the root for this file by concatenating the relative path to known
* source paths.
*/
- ExternalORMConfiguration getORMConfiguration(String ormXML);
+ ExternalORMConfiguration getORMConfiguration(URL location);
+
+ /**
+ * Returns all ORM.xmls' configurations visible to this repository.
+ */
+ Iterable<URL> ormConfigurationLocations();
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalObjectCollectionMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalObjectCollectionMapping.java
index d430986..aba6fc6 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalObjectCollectionMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalObjectCollectionMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,9 +13,10 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import java.util.List;
import javax.persistence.EnumType;
import javax.persistence.TemporalType;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface represents some common API for one-to-many, many-to-many, and element collection mappings.
@@ -25,35 +26,90 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalObjectCollectionMapping extends ExternalNonTransientMapping {
/**
- * Adds a override with the given name.
+ * The attribute name used to store and retrieve the class property.
*/
- ExternalAssociationOverride addMapKeyAssociationOverride(int index);
+ String CLASS = "class";
+
+ /**
+ * The element name used to store and retrieve the map-key child node.
+ */
+ String MAP_KEY = "map-key";
+
+ /**
+ * The element name used to store and retrieve the map-key-association child nodes.
+ */
+ String MAP_KEY_ASSOCIATION_OVERRIDE = "map-key-association-override";
+
+ /**
+ * The element name used to store and retrieve the map-key-attribute child nodes.
+ */
+ String MAP_KEY_ATTRIBUTE_OVERRIDE = "map-key-attribute-override";
+
+ /**
+ * The element name used to store and retrieve the map-key-class child node.
+ */
+ String MAP_KEY_CLASS = "map-key-class";
+
+ /**
+ * The element name used to store and retrieve the map-key-column child node.
+ */
+ String MAP_KEY_COLUMN = "map-key-column";
+
+ /**
+ * The element name used to store and retrieve the map-key-convert child node.
+ */
+ String MAP_KEY_CONVERT = "map-key-convert";
+
+ /**
+ * The element name used to store and retrieve the map-key-enumerated child node.
+ */
+ String MAP_KEY_ENUMERATED = "map-key-enumerated";
+
+ /**
+ * The element name used to store and retrieve the map-key-join-column child node.
+ */
+ String MAP_KEY_JOIN_COLUMN = "map-key-join-column";
+
+ /**
+ * The element name used to store and retrieve the map-key-temporal child node.
+ */
+ String MAP_KEY_TEMPORAL = "map-key-temporal";
+
+ /**
+ * The element name used to store and retrieve the order-by child text node.
+ */
+ String ORDER_BY = "order-by";
/**
* Adds a override with the given name.
*/
- ExternalAttributeOverride addMapKeyAttributeOverride(int index);
+ ExternalAssociationOverride addMapKeyAssociationOverride();
+
+ /**
+ * Adds a override with the given name.
+ */
+ ExternalAttributeOverride addMapKeyAttributeOverride();
/**
* Adds the map key column for this mapping.
*/
- void addMapKeyColumn();
+ ExternalEntityColumn addMapKeyColumn();
/**
* Adds a map key join column with the given name.
*/
- void addMapKeyJoinColumn(int index, String name);
+ ExternalJoinColumn addMapKeyJoinColumn(String name);
/**
* Adds the order column for this mapping.
*/
- void addOrderColumn();
+ ExternalOrderColumn addOrderColumn();
/**
* Returns the map key.
@@ -76,6 +132,11 @@
String getMapKeyClassName();
/**
+ * Returns the {@link TextRange} for the map key class name.
+ */
+ TextRange getMapKeyClassNameTextRange();
+
+ /**
* Returns the map key column for this mapping.
*/
ExternalEntityColumn getMapKeyColumn();
@@ -86,11 +147,21 @@
String getMapKeyConverterName();
/**
+ * Returns the {@link TextRange} for the map key converter name for this mapping.
+ */
+ TextRange getMapKeyConverterNameTextRange();
+
+ /**
* Returns the map key enumerated type for this mapping.
*/
EnumType getMapKeyEnumeratedType();
/**
+ * Returns the {@link TextRange} for the map key enumerated type for this mapping.
+ */
+ TextRange getMapKeyEnumeratedTypeTextRange();
+
+ /**
* Returns a map key join column with the given name.
*/
ExternalJoinColumn getMapKeyJoinColumn(int index);
@@ -101,19 +172,39 @@
TemporalType getMapKeyTemporalType();
/**
+ * Returns the {@link TextRange} for the temporal type value.
+ */
+ TextRange getMapKeyTemporalTypeTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the map key value.
+ */
+ TextRange getMapKeyTextRange();
+
+ /**
* Returns the order by string.
*/
String getOrderByFieldName();
/**
+ * Returns the {@link TextRange> for the order by string value.
+ */
+ TextRange getOrderByFieldNameTextRange();
+
+ /**
* Returns the order column for this mapping.
*/
ExternalOrderColumn getOrderColumn();
/**
+ * Determines whether the order-by child is present or not.
+ */
+ boolean hasOrderByClause();
+
+ /**
* Returns a list of association overrides defined on this mapping.
*/
- ListIterable<ExternalAssociationOverride> mapKeyAssociationOverrides();
+ List<ExternalAssociationOverride> mapKeyAssociationOverrides();
/**
* Returns the count of association overrides defined on this entity.
@@ -123,7 +214,7 @@
/**
* Returns a list of overridden column mappings for embedded mapping.
*/
- ListIterable<ExternalAttributeOverride> mapKeyAttributeOverrides();
+ List<ExternalAttributeOverride> mapKeyAttributeOverrides();
/**
* Returns the count of overridden column mappings for embedded fields.
@@ -133,7 +224,7 @@
/**
* Returns the map key join column for this mapping.
*/
- ListIterable<ExternalJoinColumn> mapKeyJoinColumns();
+ List<ExternalJoinColumn> mapKeyJoinColumns();
/**
* Returns the count of map key join columns for this mapping.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalObjectTypeConverter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalObjectTypeConverter.java
index 8125b88..a4977d6 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalObjectTypeConverter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalObjectTypeConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and inherited behavior describes the configurable properties for an object type
@@ -27,20 +27,30 @@
*
* @see org.eclipse.persistence.annotations.ObjectTypeConverter
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalObjectTypeConverter extends ExternalTypeConverter {
/**
+ * The element name used to store and retrieve the default-object-value child text node.
+ */
+ String DEFAULT_OBJECT_VALUE = "default-object-value";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String OBJECT_TYPE_CONVERTER = "object-type-converter";
+
+ /**
* Adds a conversion value.
*/
- ExternalConversionValue addConversionValue(int index);
+ ExternalConversionValue addConversionValue();
/**
* Returns a list of all conversion values defined for this object type converter definition.
*/
- ListIterable<ExternalConversionValue> conversionValues();
+ List<ExternalConversionValue> conversionValues();
/**
* Returns the count of all conversion values defined for this object type converter definition.
@@ -58,6 +68,11 @@
String getDefaultValue();
/**
+ * Returns the {@link TextRange} for the default value for this converter.
+ */
+ TextRange getDefaultValueTextRange();
+
+ /**
* Removes all the conversion values owned by this object type converter.
*/
void removeAllConversionValue();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOneToManyMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOneToManyMapping.java
index dbf78fc..d64c0b3 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOneToManyMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOneToManyMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -25,12 +25,16 @@
* @see javax.persistence.OneToMany
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalOneToManyMapping extends ExternalManyToManyMapping,
ExternalManyToOneMapping,
ExternalPrivatelyOwnableMapping,
ExternalOrphanRemovableMapping {
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String ONE_TO_MANY = "one-to-many";
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOneToOneMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOneToOneMapping.java
index afafcc4..09b81f5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOneToOneMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOneToOneMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,7 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
/**
* This interface and inherited behavior describe all of the configurable properties defined for a
@@ -28,17 +27,22 @@
* @see javax.persistence.OneToOne
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalOneToOneMapping extends ExternalManyToOneMapping,
ExternalPrivatelyOwnableMapping,
ExternalOrphanRemovableMapping {
/**
- * Adds a primary key join column with the given name at the specified location.
+ * The node name used to store and retrieve the element encapsulated by this external form.
*/
- void addPrimaryKeyJoinColumn(int index, String name);
+ String ONE_TO_ONE = "one-to-one";
+
+ /**
+ * Adds a primary key join column with the given name.
+ */
+ ExternalPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(String name);
/**
* Returns the primary key join column at the given position.
@@ -48,7 +52,7 @@
/**
* Returns a list of all primary key join column associations defined for this mapping.
*/
- ListIterable<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ List<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns();
/**
* Returns the count of primary key join columns associations defined for this mapping.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOptimisticLocking.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOptimisticLocking.java
index 52f92ce..9b07a8b 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOptimisticLocking.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOptimisticLocking.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,10 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import java.util.List;
import org.eclipse.persistence.annotations.OptimisticLockingType;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and inherited behavior describe the configurable properties defined for an
@@ -27,20 +29,40 @@
*
* @see org.eclipse.persistence.annotations.OptimisticLocking
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalOptimisticLocking extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the cascade property.
+ */
+ String CASCADE = "cascade";
+
+ /**
+ * The attribute name used to store and retrieve the optimistic-locking property.
+ */
+ String OPTIMISTIC_LOCKING = "optimistic-locking";
+
+ /**
+ * The element name used to store and retrieve the base child node.
+ */
+ String SELECTED_COLUMN = "selected-column";
+
+ /**
+ * The attribute name used to store and retrieve the type property.
+ */
+ String TYPE = "type";
+
+ /**
* Adds column with the provided column name.
*/
- void addColumn(int index, String columnName);
+ ExternalEntityColumn addColumn(String columnName);
/**
* Returns a list of all columns defined for this primary key definition.
*/
- ListIterable<ExternalEntityColumn> columns();
+ List<ExternalEntityColumn> columns();
/**
* Returns the count of all columns defined for this table definition.
@@ -48,22 +70,37 @@
int columnsSize();
/**
+ * Returns the {@link TextRange} for the cascade value.
+ */
+ TextRange getCascadeTextRange();
+
+ /**
* Returns the column at the specified index.
*/
ExternalEntityColumn getColumn(int index);
/**
+ * Returns the {@link TextRange} of the column specified.
+ */
+ TextRange getColumnTextRange(String columnName);
+
+ /**
* Returns the locking type.
*/
OptimisticLockingType getOptimisticLockingType();
/**
+ * Returns the {@link TextRange} for the optimistic locking type value.
+ */
+ TextRange getOptimisticLockingTypeTextRange();
+
+ /**
* Removes all the columns owned by this primary key.
*/
void removeAllColumns();
/**
- * Removes the column at the specified index.
+ * Removes the column at the given position.
*/
void removeColumn(int index);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOrderColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOrderColumn.java
index 048cba3..158338b 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOrderColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOrderColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface describes the core definition of what an order column is as defined by the
* EclipseLink JPA spec that are available for configuration via the EclipseLink ORM xml.
@@ -22,32 +25,117 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalOrderColumn extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the base property.
+ */
+ String BASE = "base";
+
+ /**
+ * The attribute name used to store and retrieve the column-definition of the property.
+ */
+ String COLUMN_DEFINITION = "column-definition";
+
+ /**
+ * The attribute name used to store and retrieve the contiguous property.
+ */
+ String CONTIGUOUS = "contiguous";
+
+ /**
+ * The attribute name used to store and retrieve the insertable property.
+ */
+ String INSERTABLE = "insertable";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The attribute name used to store and retrieve the nullable property.
+ */
+ String NULLABLE = "nullable";
+
+ /**
+ * The attribute name used to store and retrieve the primary-key of the property.
+ */
+ String ORDER_COLUMN = "order-column";
+
+ /**
+ * The attribute name used to store and retrieve the table property.
+ */
+ String TABLE = "table";
+
+ /**
+ * The attribute name used to store and retrieve the updatable property.
+ */
+ String UPDATABLE = "updatable";
+
+ /**
* Returns the base for this column.
*/
Integer getBase();
/**
+ * Returns the {@link TextRange for the base value.
+ */
+ TextRange getBaseTextRange();
+
+ /**
* Returns the native DDL or definition string representing this column.
*/
String getColumnDefinition();
/**
+ * Returns the {@link TextRange} for the column definition value.
+ */
+ TextRange getColumnDefinitionTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the contiguous value.
+ */
+ TextRange getContiguousTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the insertable value.
+ */
+ TextRange getInstertableTextRange();
+
+ /**
* Returns the column name.
*/
String getName();
/**
+ * Returns the text range of the name attribute.
+ */
+ TextRange getNameTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the nullable value.
+ */
+ TextRange getNullableTextRange();
+
+ /**
* Returns name of the owning table for this column.
*/
String getTable();
/**
+ * Returns the {@link TextRange} for the owning table for this column.
+ */
+ TextRange getTableTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the updatable value.
+ */
+ TextRange getUpdatableTextRange();
+
+ /**
* Indicates whether this column is contiguous.
*/
Boolean isContiguous();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOrphanRemovableMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOrphanRemovableMapping.java
index 3ead64f..92f960f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOrphanRemovableMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalOrphanRemovableMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* TODO
* <p>
@@ -21,8 +24,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
@SuppressWarnings("nls")
public interface ExternalOrphanRemovableMapping extends ExternalForm {
@@ -30,7 +32,12 @@
/**
* The attribute name used to store and retrieve the orphan-removal property.
*/
- static final String ORPHAN_REMOVAL = "orphan-removal";
+ String ORPHAN_REMOVAL = "orphan-removal";
+
+ /**
+ * Returns the {@link TextRange} of the orphan removal value.
+ */
+ TextRange getOrphanRemovalTextRange();
/**
* Returns whether the mapping removes orphans.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPersistenceUnit.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPersistenceUnit.java
index d77d233..3d09e6b 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPersistenceUnit.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPersistenceUnit.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,7 +13,7 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import javax.persistence.AccessType;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* Represents a persistent unit's meta data as defined in the ORM.xml. The root of the ORM.xml
@@ -28,10 +28,61 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
-public interface ExternalPersistenceUnit extends ExternalEntityListenerHolder, ExternalTenantDiscriminatorColumnProvider {
+@SuppressWarnings("nls")
+public interface ExternalPersistenceUnit extends ExternalEntityListenerHolder,
+ ExternalTenantDiscriminatorColumnProvider {
+
+ /**
+ * The attribute name used to store and retrieve the cascade-persist property.
+ */
+ String CASCADE_PERSIST = "cascade-persist";
+
+ /**
+ * The attribute name used to store and retrieve the catalog property.
+ */
+ String CATALOG = "catalog";
+
+ /**
+ * The element name used to store and retrieve the delimited identifiers flag.
+ */
+ String DELIMITED_IDENTIFIERS = "delimited-identifiers";
+
+ /**
+ * The element name used to store and retrieve the description.
+ */
+ String DESCRIPTION = "description";
+
+ /**
+ * The attribute name used to store and retrieve the exclude-default-mappings property.
+ */
+ String EXCLUDE_DEFAULT_MAPPINGS = "exclude-default-mappings";
+
+ /**
+ * The attribute name used to store and retrieve the persistence-unit-defaults property.
+ */
+ String PERSISTENCE_UNIT_DEFAULTS = "persistence-unit-defaults";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String PERSISTENCE_UNIT_METADATA = "persistence-unit-metadata";
+
+ /**
+ * The attribute name used to store and retrieve the schema property.
+ */
+ String SCHEMA = "schema";
+
+ /**
+ * The attribute name used to store and retrieve the direction property.
+ */
+ String XML_MAPPING_METADATA_COMPLETE = "xml-mapping-metadata-complete";
+
+ /**
+ * Returns the {@link TextRange} for the default cascade option value.
+ */
+ TextRange getCascadePersistByDefaultTextRange();
/**
* Returns the default access type to be used for entities that comprise this persistence unit.
@@ -39,11 +90,21 @@
AccessType getDefaultAccessType();
/**
+ * Returns the {@link TextRange} for the default access type value.
+ */
+ TextRange getDefaultAccessTypeTextRange();
+
+ /**
* Returns the default catalog name to be used in the persistence unit.
*/
String getDefaultCatalogName();
/**
+ * Returns the {@link TextRange} of the default catalog name value.
+ */
+ TextRange getDefaultCatalogNameTextRange();
+
+ /**
* Returns the default description to be used in the persistence unit.
*/
String getDefaultDescription();
@@ -54,6 +115,11 @@
String getDefaultSchemaName();
/**
+ * Returns the {@link TextRange} of the default schema name value.
+ */
+ TextRange getDefaultSchemaNameTextRange();
+
+ /**
* Returns the description for the persistence unit.
*/
String getDescription();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKey.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKey.java
index bbae604..35fdfc6 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKey.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKey.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,9 +13,11 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import java.util.List;
import org.eclipse.persistence.annotations.CacheKeyType;
import org.eclipse.persistence.annotations.IdValidation;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and inherited behavior describe the configurable properties defined for a primary
@@ -28,20 +30,35 @@
*
* @see org.eclipse.persistence.annotations.PrimaryKey
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalPrimaryKey extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the cache-key-type of the property.
+ */
+ String CACHE_KEY_TYPE = "cache-key-type";
+
+ /**
+ * The attribute name used to store and retrieve the id-validation of the property.
+ */
+ String ID_VALIDATION = "id-validation";
+
+ /**
+ * The attribute name used to store and retrieve the primary-key of the property.
+ */
+ String PRIMARY_KEY = "primary-key";
+
+ /**
* Adds column with the provided column name.
*/
- void addColumn(int index, String columnName);
+ ExternalEntityColumn addColumn(String columnName);
/**
* Returns a list of all columns defined for this primary key definition.
*/
- ListIterable<ExternalEntityColumn> columns();
+ List<ExternalEntityColumn> columns();
/**
* Returns the count of all columns defined for this table definition.
@@ -54,6 +71,11 @@
CacheKeyType getCacheKey();
/**
+ * Returns the {@link TextRange} for the id cache key value.
+ */
+ TextRange getCacheKeyTextRange();
+
+ /**
* Returns the column at the specified index.
*/
ExternalEntityColumn getColumn(int index);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKeyGenerator.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKeyGenerator.java
index f88f88d..6f34384 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKeyGenerator.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKeyGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* Defines in the ORM.xml the abstract behavior inherent to all primary key generators.
* <p>
@@ -23,31 +26,67 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author Les Davis
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalPrimaryKeyGenerator extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the allocation-size of the property.
+ */
+ String ALLOCATION_SIZE = "allocation-size";
+
+ /**
+ * The attribute name used to store and retrieve the temporal property.
+ */
+ String CATALOG = "catalog";
+
+ /**
+ * The element name of the child text node for the description.
+ */
+ String DESCRIPTION = "description";
+
+ /**
+ * The attribute name used to store and retrieve the initial-value of the property.
+ */
+ String INITIAL_VALUE = "initial-value";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The attribute name used to store and retrieve the temporal property.
+ */
+ String SCHEMA = "schema";
+
+ /**
* Returns the allocation size for this generator.
*/
Integer getAllocationSize();
/**
+ * Returns the {@link TextRange} of the allocation size value.
+ */
+ TextRange getAllocationSizeTextRange();
+
+ /**
* Returns the name of the catalog for the table that will be generated.
*/
String getCatalogName();
/**
+ * Returns the {@link TextRange} for the catalog name.
+ */
+ TextRange getCatalogNameTextRange();
+
+ /**
* Returns the description noted in the ORM.xml.
*/
String getDescription();
- /**
- * Returns the position of this generator within the list of generators if the parent supports a
- * list. If not, then the index will be -1.
- */
+ @Deprecated
int getIndex();
/**
@@ -56,16 +95,31 @@
Integer getInitialValue();
/**
+ * Returns the {@link TextRange} of the initial value value.
+ */
+ TextRange getInitialValueTextRange();
+
+ /**
* Returns the name for this generator.
*/
String getName();
/**
+ * Returns the {@link TextRange} of the name value.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Returns the schema name for the table that will be generated.
*/
String getSchemaName();
/**
+ * Returns the {@link TextRange} for the schema name.
+ */
+ TextRange getSchemaNameTextRange();
+
+ /**
* Set the allocation size for this generator.
*/
void setAllocationSize(Integer size);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKeyJoinColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKeyJoinColumn.java
index 1577684..4a6d144 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKeyJoinColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrimaryKeyJoinColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* Represents a primary key join to associate rows of a given table as needed by the ORM.xml. A
* primary key join column definition can be used in an Entity or an Entity's secondary table
@@ -26,21 +29,40 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalPrimaryKeyJoinColumn extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the column-definition of the property.
+ */
+ String COLUMN_DEFINITION = "column-definition";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String PRIMARY_KEY_JOIN_COLUMN = "primary-key-join-column";
+
+ /**
+ * The attribute name used to store and retrieve the referenced-column-name property.
+ */
+ String REFERENCED_COLUMN_NAME = "referenced-column-name";
+
+ /**
* The DDL or other native sql definition of the column association.
*/
String getColumnDefinition();
/**
- * Returns the index of this primary key join column within the list of primary key join columns
- * owned by the parent.
+ * Returns the {@link TextRange} for the column definition.
*/
- int getIndex();
+ TextRange getColumnDefinitionTextRange();
/**
* Returns the name of the primary key column on the source table to join.
@@ -48,17 +70,27 @@
String getName();
/**
+ * Returns the {@link TextRange} for the name of the primary key column.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Returns the name of the reference pk column.
*/
String getReferenceColumnName();
/**
+ * Returns the {@link TextRange} for the name of the reference pk column.
+ */
+ TextRange getReferenceColumnNameTextRange();
+
+ /**
* Sets the column definition.
*/
void setColumnDefinition(String definition);
/**
- * Sets the name.
+ * Sets the name of the primary key join column.
*/
void setName(String name);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrivatelyOwnableMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrivatelyOwnableMapping.java
index 4e20f73..995b99f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrivatelyOwnableMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalPrivatelyOwnableMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* The properties defined for a privately ownabled mapping.
* <p>
@@ -25,12 +28,22 @@
* @see ExternalOneToOneMapping
* @see ExternalVariableOneToOneMapping
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalPrivatelyOwnableMapping extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the private-owned property.
+ */
+ String PRIVATE_OWNED = "private-owned";
+
+ /**
+ * Returns the {@link TextRange} for the private owned value.
+ */
+ TextRange getPrivateOwnedTextRange();
+
+ /**
* Returns whether the mapping is private owned.
*
* @return <code>true</code> if the mapping is privately owned; <code>false</code> otherwise
@@ -40,8 +53,7 @@
/**
* Sets whether the mapping is privately owned.
*
- * @param privateOwned <code>true</code> if the mapping is privately owned; <code>false</code>
- * otherwise
+ * @param privateOwned <code>true</code> if the mapping is privately owned; <code>false</code> otherwise
*/
void setPrivateOwned(Boolean privateOwned);
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalQueryHint.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalQueryHint.java
index fc49f27..1415554 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalQueryHint.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalQueryHint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* Simple key/value pair definition for query hints defined in the ORM.xml. A named query or a
* named, native query can have vendor specific hints associated with it to configure query properties.
@@ -24,19 +27,37 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalQueryHint extends ExternalForm {
/**
+ * The element name of the child text node for the description.
+ */
+ String DESCRIPTION = "description";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String HINT = "hint";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The attribute name used to store and retrieve the value property.
+ */
+ String VALUE = "value";
+
+ /**
* Returns the description of query.
*/
String getDescription();
- /**
- * Returns the position of this query hint within the list of query hints owned by the parent.
- */
+ @Deprecated
int getIndex();
/**
@@ -45,22 +66,32 @@
String getName();
/**
+ * Returns the {@link TextRange} for the name of this hint.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Returns the hint value.
*/
String getValue();
/**
+ * Returns the {@link TextRange} for the hint value.
+ */
+ TextRange getValueTextRange();
+
+ /**
* Set the description
*/
void setDescription(String description);
/**
- * set the name.
+ * Sets the query hint's name.
*/
void setName(String name);
/**
- * Set the hint value.
+ * Sets the query hint's value.
*/
void setValue(String value);
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalForm.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalReadTransformer.java
similarity index 69%
copy from tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalForm.java
copy to tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalReadTransformer.java
index 8d079b7..0a9ac31 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalForm.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalReadTransformer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,15 +14,21 @@
package org.eclipse.persistence.tools.mapping.orm;
/**
- * This interface is the root interface that any external form should extends.
+ * This interface represents the read transformer defined by the EclipseLink JPA spec that are
+ * available for configuration via the EclipseLink ORM xml.
* <p>
* Provisional API: This interface is part of an interim API that is still under development and
* expected to change significantly before reaching stability. It is available at this early stage
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
-public interface ExternalForm {
+@SuppressWarnings("nls")
+public interface ExternalReadTransformer extends ExternalTransformer {
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String READ_TRANSFORMER = "read-transformer";
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalReferenceTable.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalReferenceTable.java
index e422bfd..d7749be 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalReferenceTable.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalReferenceTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,7 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
/**
* This interface and inherited behavior describe the configurable properties defined for a table
@@ -29,18 +28,17 @@
* @see javax.persistence.Table
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
public interface ExternalReferenceTable extends ExternalEntityTable {
/**
* Adds a join column with the given name.
*/
- void addJoinColumn(int index, String name);
+ ExternalJoinColumn addJoinColumn(String name);
/**
- * Returns the join column at the specified position.
+ * Returns the join column at the given position.
*/
ExternalJoinColumn getJoinColumn(int index);
@@ -52,7 +50,7 @@
/**
* Returns a list of join columns used in this table.
*/
- ListIterable<ExternalJoinColumn> joinColumns();
+ List<ExternalJoinColumn> joinColumns();
/**
* Returns the count of all the join columns used in this table.
@@ -60,7 +58,7 @@
int joinColumnsSize();
/**
- * Removes the join column named.
+ * Removes the join column at the given position.
*/
void removeJoinColumn(int index);
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalRelationshipMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalRelationshipMapping.java
index 5c7644e..fad7386 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalRelationshipMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalRelationshipMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,9 +13,10 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import java.util.List;
import javax.persistence.CascadeType;
import org.eclipse.persistence.annotations.JoinFetchType;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* Captures the common properties associated with all relationship mappings defined by the JPA
@@ -28,12 +29,67 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalRelationshipMapping extends ExternalMappedMapping {
/**
+ * The element name used to store and retrieve the cascade child element.
+ */
+ String CASCADE = "cascade";
+
+ /**
+ * The element name used to store and retrieve the cascade-all child node of the cascade child.
+ */
+ String CASCADE_ALL = "cascade-all";
+
+ /**
+ * The element name used to store and retrieve the cascade-detach child node of the cascade child.
+ */
+ String CASCADE_DETACH = "cascade-detach";
+
+ /**
+ * The element name used to store and retrieve the cascade-merge child node of the cascade child.
+ */
+ String CASCADE_MERGE = "cascade-merge";
+
+ /**
+ * The element name used to store and retrieve the cascade-persist child node of the cascade child.
+ */
+ String CASCADE_PERSIST = "cascade-persist";
+
+ /**
+ * The element name used to store and retrieve the cascade-refresh child node of the cascade child.
+ */
+ String CASCADE_REFRESH = "cascade-refresh";
+
+ /**
+ * The element name used to store and retrieve the cascade-remove child node of the cascade child.
+ */
+ String CASCADE_REMOVE = "cascade-remove";
+
+ /**
+ * The attribute name used to store and retrieve the fetch property.
+ */
+ String FETCH = "fetch";
+
+ /**
+ * The element name used to store and retrieve the join-fetch child text node.
+ */
+ String JOIN_FETCH = "join-fetch";
+
+ /**
+ * The attribute name used to store and retrieve the optional property.
+ */
+ String OPTIONAL = "optional";
+
+ /**
+ * The attribute name used to store and retrieve the target-entity property.
+ */
+ String TARGET_ENTITY = "target-entity";
+
+ /**
* Adds a batch fetch to use.
*/
void addBatchFetch();
@@ -51,7 +107,7 @@
/**
* Returns the enum, CascadeType to use for this relationship.
*/
- ListIterable<CascadeType> cascadeTypes();
+ List<CascadeType> cascadeTypes();
/**
* Returns the batch fetch definition for this relationship mapping.
@@ -59,11 +115,21 @@
ExternalBatchFetch getBatchFetch();
/**
+ * Returns the {@link TextRange} of the cascade types.
+ */
+ TextRange getCascadeTypeTextRange();
+
+ /**
* Returns the join fetch type for this mapping.
*/
JoinFetchType getJoinFetchType();
/**
+ * Returns the {@link TextRange} for the join fetch type value.
+ */
+ TextRange getJoinFetchTypeTextRange();
+
+ /**
* Returns the join table definition for this relationship mapping.
*/
ExternalJoinTable getJoinTable();
@@ -74,6 +140,11 @@
String getTargetEntityName();
/**
+ * Returns the {@link TextRange} for the relationship partner name for this mapping.
+ */
+ TextRange getTargetEntityNameTextRange();
+
+ /**
* Removes the batch fetch.
*/
void removeBatchFetch();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalSQLResultSetMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalSQLResultSetMapping.java
index ce4d860..c3da8eb 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalSQLResultSetMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalSQLResultSetMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* Defines in the ORM.xml, how to map a SQL result set to an Entity view-type object. This object
@@ -28,25 +29,40 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalSQLResultSetMapping extends ExternalForm {
/**
+ * The element name of the child text node for the description.
+ */
+ String DESCRIPTION = "description";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String SQL_RESULT_SET_MAPPING = "sql-result-set-mapping";
+
+ /**
* Adds a column result with the given name.
*/
- void addColumnResult(int index, String name);
+ ExternalColumnResult addColumnResult(String name);
/**
* Adds a entity result with the given name.
*/
- void addEntityResult(int index, String className);
+ ExternalEntityResult addEntityResult(String className);
/**
* Returns a list of column results.
*/
- ListIterable<ExternalColumnResult> columnResults();
+ List<ExternalColumnResult> columnResults();
/**
* Returns the count of all the column results.
@@ -56,7 +72,7 @@
/**
* Returns a list of entity result sets.
*/
- ListIterable<ExternalEntityResult> entityResults();
+ List<ExternalEntityResult> entityResults();
/**
* Returns the count of all the entity result sets.
@@ -79,28 +95,27 @@
ExternalEntityResult getEntityResult(int index);
/**
- * Returns the position of this SQL result set mapping within the list of SQL result set mappings
- * owned by the parent.
- */
- int getIndex();
-
- /**
* Returns the name of this SQL result set mapping.
*/
String getName();
/**
+ * Returns the {@link TextRange} for the name value.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Removes the column result named
*/
void removeColumnResult(int index);
/**
- * Removes the entity result named
+ * Removes the entity result at the given position.
*/
void removeEntityResult(int index);
/**
- * Set the description
+ * Set the description.
*/
void setDescription(String description);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntitySecondaryTable.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalSecondaryTable.java
similarity index 81%
rename from tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntitySecondaryTable.java
rename to tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalSecondaryTable.java
index 3fa7e72..3f8b55d 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalEntitySecondaryTable.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalSecondaryTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,7 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
/**
* This interface and inherited behavior describe the configurable properties defined for a
@@ -29,20 +28,20 @@
* @see javax.persistence.SecondaryTable
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
-public interface ExternalEntitySecondaryTable extends ExternalEntityTable {
+@SuppressWarnings("nls")
+public interface ExternalSecondaryTable extends ExternalEntityTable {
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String SECONDARY_TABLE = "secondary-table";
/**
* Adds a primary key join column with the given name.
*/
- void addPrimaryKeyJoinColumn(int index, String name);
-
- /**
- * Returns the position of this secondary table within the list of secondary tables owned by the parent.
- */
- int getIndex();
+ ExternalPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(String name);
/**
* Returns the primary key join column with at the given position.
@@ -52,7 +51,7 @@
/**
* Returns a list of PK column joins that associate this secondary table to the primary table.
*/
- ListIterable<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ List<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns();
/**
* Returns the count of PK column joins that associate this secondary table to the primary table.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalSequenceGenerator.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalSequenceGenerator.java
index 9206b34..ad381ed 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalSequenceGenerator.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalSequenceGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* Defines in the ORM.xml a sequence generator that can be used to populate the ID field of an
* entity. A sequence generator may be defined at the root, ORM level, on an Entity or directly
@@ -25,18 +27,32 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author Les Davis
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalSequenceGenerator extends ExternalPrimaryKeyGenerator {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String SEQUENCE_GENERATOR = "sequence-generator";
+
+ /**
+ * The attribute name used to store and retrieve the sequence-name property.
+ */
+ String SEQUENCE_NAME = "sequence-name";
+
+ /**
* Returns the name for the sequence table/artifact to be created or used on the db.
*/
String getSequenceName();
/**
+ * Returns the {@link TextRange} for the name for the sequence table.
+ */
+ TextRange getSequenceNameTextRange();
+
+ /**
* Set the sequence name.
*/
void setSequenceName(String name);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStoredProcedureParameter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStoredProcedureParameter.java
index e31b324..af397f5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStoredProcedureParameter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStoredProcedureParameter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,8 @@
package org.eclipse.persistence.tools.mapping.orm;
import org.eclipse.persistence.annotations.Direction;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and inherited behavior describe the configurable properties defined for a stored
@@ -26,19 +28,57 @@
*
* @see org.eclipse.persistence.annotations.StoredProcedureQuery
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalStoredProcedureParameter extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the direction property.
+ */
+ String DIRECTION = "direction";
+
+ /**
+ * The attribute name used to store and retrieve the jdbc-type property.
+ */
+ String JDBC_TYPE = "jdbc-type";
+
+ /**
+ * The attribute name used to store and retrieve the jdbc-type-name property.
+ */
+ String JDBC_TYPE_NAME = "jdbc-type-name";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The attribute name used to store and retrieve the query-parameter property.
+ */
+ String QUERY_PARAMETER = "query-parameter";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String STORED_PROCEDURE_PARAMETER = "parameter";
+
+ /**
+ * The attribute name used to store and retrieve the type property.
+ */
+ String TYPE = "type";
+
+ /**
* Returns the direction type for this parameter.
*/
Direction getDirection();
/**
- * Returns the position of this parameter within its parent procedure.
+ * Returns the {@link TextRange} for the direction type value.
*/
+ TextRange getDirectionTextRange();
+
+ @Deprecated
int getIndex();
/**
@@ -52,21 +92,46 @@
String getJdbcTypeName();
/**
+ * Returns the {@link TextRange} for the jdbc type name value.
+ */
+ TextRange getJdbcTypeNameTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the jdbc type.
+ */
+ TextRange getJdbcTypeTextRange();
+
+ /**
* Returns the name of this parameter.
*/
String getName();
/**
+ * Returns the {@link TextRange} for the name value.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Returns the query parameter for this parameter.
*/
String getQueryParameter();
/**
+ * Returns the {@link TextRange} for the query parameter value.
+ */
+ TextRange getQueryParameterTextRange();
+
+ /**
* Returns the type name for this parameter.
*/
String getType();
/**
+ * Returns the {@link TextRange} for the type name value.
+ */
+ TextRange getTypeTextRange();
+
+ /**
* Sets the direction type for this parameter.
*/
void setDirection(Direction directionType);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStoredProcedureQuery.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStoredProcedureQuery.java
index 96bc61b..d33c66f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStoredProcedureQuery.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStoredProcedureQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and inherited behavior describe the configurable properties defined for a stored
@@ -27,15 +27,50 @@
*
* @see org.eclipse.persistence.annotations.Entity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalStoredProcedureQuery extends ExternalNamedQuery {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String NAMED_STORED_PROCEDURE_QUERY = "named-stored-procedure-query";
+
+ /**
+ * The attribute name used to store and retrieve the procedure-name property.
+ */
+ String PROCEDURE_NAME = "procedure-name";
+
+ /**
+ * The attribute name used to store and retrieve the result-class property.
+ */
+ String RESULT_CLASS = "result-class";
+
+ /**
+ * The attribute name used to store and retrieve the result-set-mapping property.
+ */
+ String RESULT_SET_MAPPING = "result-set-mapping";
+
+ /**
+ * The attribute name used to store and retrieve the returns-result-set property.
+ */
+ String RETURNS_RESULT_SET = "returns-result-set";
+
+ /**
* Adds a query parameter to this stored procedure.
*/
- ExternalStoredProcedureParameter addParameter(int index);
+ ExternalStoredProcedureParameter addParameter();
+
+ /**
+ * Adds a result class name to this stored procedure.
+ */
+ void addResultClassName(String name);
+
+ /**
+ * Adds a result class mapping to this stored procedure.
+ */
+ void addResultSetMapping(String mapping);
/**
* Returns whether this procedure returns a result set.
@@ -53,19 +88,34 @@
String getProcedureName();
/**
- * Returns the result set mapping class name.
+ * Returns the {@link TextRange} for the procedure name value.
*/
- String getResultClassName();
+ TextRange getProcedureNameTextRange();
/**
- * Returns the result set mapping.
+ * Returns the result class name at the given index.
*/
- String getResultSetMapping();
+ String getResultClassName(int index);
+
+ /**
+ * Returns the result set mapping at the given index.
+ */
+ String getResultSetMapping(int index);
+
+ /**
+ * Returns the result set mapping at the given index text range.
+ */
+ TextRange getResultSetMappingTextRange(int index);
+
+ /**
+ * Returns the {@link TextRange} for the return result set.
+ */
+ TextRange getReturnResultSetTextRange();
/**
* Returns all the parameters in this stored procedure.
*/
- ListIterable<ExternalStoredProcedureParameter> parameters();
+ List<ExternalStoredProcedureParameter> parameters();
/**
* Returns the number of parameters in this stored procedure.
@@ -78,6 +128,36 @@
void removeParameter(int index);
/**
+ * Removes the result class name at the specified index from the stored procedure.
+ */
+ void removeResultClassName(int index);
+
+ /**
+ * Removes the result set mapping at the specified index from the stored procedure.
+ */
+ void removeResultSetMapping(int index);
+
+ /**
+ * Returns all the result class names in this stored procedure.
+ */
+ List<String> resultClassNames();
+
+ /**
+ * Returns the number of result class names in this stored procedure.
+ */
+ int resultClassNameSize();
+
+ /**
+ * Returns all the result set mappings in this stored procedure.
+ */
+ List<String> resultSetMappings();
+
+ /**
+ * Returns the number of result set mappings in this stored procedure.
+ */
+ int resultSetMappingsSize();
+
+ /**
* Sets whether this procedure returns a result set.
*/
void setDoesReturnResultSet(Boolean returnResultSet);
@@ -86,14 +166,4 @@
* Sets the name of the procedure.
*/
void setProcedureName(String name);
-
- /**
- * Sets the result mapping class.
- */
- void setResultClassName(String resultSetMappingClass);
-
- /**
- * Sets the result set mapping.
- */
- void setResultSetMapping(String resultSetMapping);
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStructConverter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStructConverter.java
index 4d8ba43..0784bf1 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStructConverter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalStructConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -24,8 +24,18 @@
*
* @see org.eclipse.persistence.annotations.StructConverter
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalStructConverter extends ExternalClassConverter {
+
+ /**
+ * The attribute name used to store and retrieve the converter property.
+ */
+ String CONVERTER = "converter";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String STRUCT_CONVERTER = "struct-converter";
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTableGenerator.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTableGenerator.java
index 20b4de4..17e8ce6 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTableGenerator.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTableGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,7 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import java.util.ListIterator;
+import java.util.List;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.eclipse.persistence.tools.utility.iterable.ListIterable;
/**
@@ -27,16 +28,40 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author Les Davis
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalTableGenerator extends ExternalPrimaryKeyGenerator {
/**
+ * The attribute name used to store and retrieve the temporal property.
+ */
+ String PK_COLUMN_NAME = "pk-column-name";
+
+ /**
+ * The attribute name used to store and retrieve the temporal property.
+ */
+ String PK_COLUMN_VALUE = "pk-column-value";
+
+ /**
+ * The attribute name used to store and retrieve the temporal property.
+ */
+ String TABLE = "table";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String TABLE_GENERATOR = "table-generator";
+
+ /**
+ * The attribute name used to store and retrieve the temporal property.
+ */
+ String VALUE_COLUMN_NAME = "value-column-name";
+
+ /**
* Adds a unique constraint with the given column names to this table generator.
*/
- void addUniqueConstraint(int index, ListIterator<String> columnNames);
+ ExternalUniqueConstraint addUniqueConstraint(ListIterable<String> columnNames);
/**
* Returns the name of the Primary Key column for the generated table.
@@ -44,16 +69,31 @@
String getPKColumnName();
/**
+ * Returns the {@link TextRange} of the primary key column.
+ */
+ TextRange getPKColumnNameTextRange();
+
+ /**
* Returns the value for the primary key column.
*/
String getPKColumnValue();
/**
+ * Returns the {@link TextRange} of the primary key column value.
+ */
+ TextRange getPKColumnValueTextRange();
+
+ /**
* Returns the name of the table that will be generated.
*/
String getTableName();
/**
+ * Returns the {@link TextRange} of this generator's table name.
+ */
+ TextRange getTableNameTextRange();
+
+ /**
* Returns a unique constraint that has been defined at the given position.
*/
ExternalUniqueConstraint getUniqueConstraint(int index);
@@ -64,7 +104,12 @@
String getValueColumnName();
/**
- * Removes a unique constraint from this table generator at the specified position.
+ * Returns {@link TextRange} the value column name.
+ */
+ TextRange getValueColumnNameTextRange();
+
+ /**
+ * Removes a unique constraint from this table generator at the given position.
*/
void removeUniqueConstraint(int index);
@@ -91,7 +136,7 @@
/**
* List of all unique constraints known to this table generator.
*/
- ListIterable<ExternalUniqueConstraint> uniqueConstraints();
+ List<ExternalUniqueConstraint> uniqueConstraints();
/**
* The count of all unique constraints known to this table generator.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTenantDiscriminatorColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTenantDiscriminatorColumn.java
index b57c67a..f6a0ad3 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTenantDiscriminatorColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTenantDiscriminatorColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,8 @@
package org.eclipse.persistence.tools.mapping.orm;
import javax.persistence.DiscriminatorType;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface and inherited behavior describes the configurable properties for an tenant
@@ -26,29 +28,88 @@
*
* @see org.eclipse.persistence.annotations.TenantDiscriminatorColumn
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalTenantDiscriminatorColumn extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the column-definition property.
+ */
+ String COLUMN_DEFINITION = "column-definition";
+
+ /**
+ * The attribute name used to store and retrieve the context-property property.
+ */
+ String CONTEXT_PROPERTY = "context-property";
+
+ /**
+ * The attribute name used to store and retrieve the discriminator-type property.
+ */
+ String DISCRIMINATOR_TYPE = "discriminator-type";
+
+ /**
+ * The attribute name used to store and retrieve the length property.
+ */
+ String LENGTH = "length";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The attribute name used to store and retrieve the primary-key property.
+ */
+ String PRIMARY_KEY = "primary-key";
+
+ /**
+ * The attribute name used to store and retrieve the table property.
+ */
+ String TABLE = "table";
+
+ /**
+ * The node name used to store and retrieve the element
+ * encapsulated by this external form.
+ */
+ String TENANT_DISCRIMINATOR_COLUMN = "tenant-discriminator-column";
+
+ /**
* Returns the SQL definition of the column.
*/
String getColumnDefinition();
/**
+ * Returns the {@link TextRange} for the column definition of the column.
+ */
+ TextRange getColumnDefinitionTextRange();
+
+ /**
+ * Returns the text range of of the column.
+ */
+ TextRange getColumnTextRange();
+
+ /**
* Returns the context property of the column.
*/
String getContextProperty();
/**
+ * Returns the {@link TextRange} for the context property of the column.
+ */
+ TextRange getContextPropertyTextRange();
+
+ /**
* Type of the discriminator column.
*/
DiscriminatorType getDiscriminatorType();
/**
- * Index of this discriminator column.
+ * Returns the {@link TextRange} for the discriminator type of the column.
*/
+ TextRange getDiscriminatorTypeTextRange();
+
+ @Deprecated
int getIndex();
/**
@@ -57,14 +118,24 @@
Integer getLength();
/**
+ * Returns the {@link TextRange} for the length of the column.
+ */
+ TextRange getLengthTextRange();
+
+ /**
* Name of the discriminator column.
*/
String getName();
/**
- * Returns whether this column is part of the primary key
+ * Returns the {@link TextRange} for the name of the column.
*/
- Boolean isPrimaryKey();
+ TextRange getNameTextRange();
+
+ /**
+ * Returns the {@link TextRange} for the primary key of the column.
+ */
+ TextRange getPrimaryKeyTextRange();
/**
* Returns the table name that this column exists in
@@ -72,39 +143,44 @@
String getTableName();
/**
- * Set the column definition
+ * Returns the {@link TextRange} for the table name of the column.
+ */
+ TextRange getTableNameTextRange();
+
+ /**
+ * Returns whether this column is part of the primary key
+ */
+ Boolean isPrimaryKey();
+
+ /**
+ * Set the column definition.
*/
void setColumnDefinition(String definition);
/**
- * Set the context property for the column
+ * Set the context property for the column.
*/
void setContextProperty(String contextProperty);
/**
- * Set the discriminator type
+ * Set the discriminator type.
*/
void setDiscriminatorType(DiscriminatorType type);
/**
- * Set the index
- */
- void setIndex(int index);
-
- /**
- * Set the length
+ * Set the length.
*/
void setLength(Integer length);
/**
- * Sets the name of the column
+ * Sets the name of the column.
*/
void setName(String name);
/**
* Sets whether this column is part of the primary key
*/
- void setIsPrimaryKey(Boolean primaryKey);
+ void setPrimaryKey(Boolean primaryKey);
/**
* Sets the table name in which this column exists
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTenantDiscriminatorColumnProvider.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTenantDiscriminatorColumnProvider.java
index 2533364..6596f41 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTenantDiscriminatorColumnProvider.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTenantDiscriminatorColumnProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
/**
* Defines an external ORM object that holds on to {@link ExternalTenantDiscriminatorColumn}.
@@ -28,20 +28,19 @@
*
* @see ExternalTenantDiscriminatorColumn
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
public interface ExternalTenantDiscriminatorColumnProvider extends ExternalForm {
/**
- * Adds a new discriminator column at the given position.
+ * Adds a new discriminator column.
*/
- ExternalTenantDiscriminatorColumn addDiscriminatorColumn(int index);
+ ExternalTenantDiscriminatorColumn addDiscriminatorColumn();
/**
* Returns all discriminator columns.
*/
- ListIterable<ExternalTenantDiscriminatorColumn> discriminatorColumns();
+ List<ExternalTenantDiscriminatorColumn> discriminatorColumns();
/**
* Returns the number of discriminator columns.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTenantTableDiscriminator.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTenantTableDiscriminator.java
new file mode 100644
index 0000000..60d8da3
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTenantTableDiscriminator.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping.orm;
+
+import org.eclipse.persistence.annotations.TenantTableDiscriminatorType;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
+
+/**
+ * This interface and inherited behavior describes the configurable properties
+ * for an tenant table discriminator. One table can be declared on a Multitenant
+ *
+ * @see org.eclipse.persistence.annotations.TenantTableDiscriminator
+ *
+ * @version 2.6
+ */
+@SuppressWarnings("nls")
+public interface ExternalTenantTableDiscriminator extends ExternalForm {
+
+ /**
+ * The attribute name used to store and retrieve the context-property property.
+ */
+ String CONTEXT_PROPERTY = "context-property";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String TENANT_TABLE_DISCRIMINATOR = "tenant-table-discriminator";
+
+ /**
+ * The attribute name used to store and retrieve the tenant-table-discriminator-type property.
+ */
+ String TENANT_TABLE_DISCRIMINATOR_TYPE = "type";
+
+ /**
+ * Returns the context property of the table.
+ */
+ String getContextProperty();
+
+ /**
+ * Returns the {@link TextRange} for the context property of the table.
+ */
+ TextRange getContextPropertyTextRange();
+
+ /**
+ * Type of the discriminator.
+ */
+ TenantTableDiscriminatorType getDiscriminatorType();
+
+ /**
+ * Returns the {@link TextRange} for the discriminator type of the table.
+ */
+ TextRange getDiscriminatorTypeTextRange();
+
+ /**
+ * Set the context property for the column
+ */
+ void setContextProperty(String contextProperty);
+
+ /**
+ * Set the discriminator type
+ */
+ void setDiscriminatorType(TenantTableDiscriminatorType type);
+
+}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTimeOfDay.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTimeOfDay.java
index 0289bba..0504c7e 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTimeOfDay.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTimeOfDay.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior describe the configurable properties defined for a time of
* day definition in the EclipseLink 1.1 ORM xml.
@@ -24,32 +27,77 @@
*
* @see org.eclipse.persistence.annotations.TimeOfDay
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalTimeOfDay extends ExternalForm {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String EXPIRY_TIME_OF_DAY = "expiry-time-of-day";
+
+ /**
+ * The attribute name used to store and retrieve the hour property.
+ */
+ String HOUR = "hour";
+
+ /**
+ * The attribute name used to store and retrieve the millisecond property.
+ */
+ String MILLISECOND = "millisecond";
+
+ /**
+ * The attribute name used to store and retrieve the minute property.
+ */
+ String MINUTE = "minute";
+
+ /**
+ * The attribute name used to store and retrieve the second property.
+ */
+ String SECOND = "second";
+
+ /**
* Returns the hour value of the day.
*/
Integer getHour();
/**
+ * Returns the {@link TextRange} for the hour value of the day.
+ */
+ TextRange getHourTextRange();
+
+ /**
* Returns the millisecond value of the day.
*/
Integer getMillisecond();
/**
+ * Returns the {@link TextRange} for the millisecond value of the day.
+ */
+ TextRange getMillisecondTextRange();
+
+ /**
* Returns the minute value of the day.
*/
Integer getMinute();
/**
+ * Returns the {@link TextRange} for the minute value of the day.
+ */
+ TextRange getMinuteTextRange();
+
+ /**
* Returns the second value of the day.
*/
Integer getSecond();
/**
+ * Returns the {@link TextRange} for the second value of the day.
+ */
+ TextRange getSecondTextRange();
+
+ /**
* Sets the hour value for the day.
*/
void setHour(Integer hour);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransformationMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransformationMapping.java
index a86ec72..ce7d390 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransformationMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransformationMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-
+import java.util.List;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface represents the transformation mapping defined by the EclipseLink JPA spec that are
@@ -25,12 +25,32 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalTransformationMapping extends ExternalMappedMapping {
/**
+ * The attribute name used to store and retrieve the fetch property.
+ */
+ String FETCH = "fetch";
+
+ /**
+ * The attribute name used to store and retrieve the mutable property.
+ */
+ String MUTABLE = "mutable";
+
+ /**
+ * The attribute name used to store and retrieve the optional property.
+ */
+ String OPTIONAL = "optional";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String TRANSFORMATION = "transformation";
+
+ /**
* Adds the read transformer.
*/
ExternalTransformer addReadTransformer();
@@ -38,12 +58,17 @@
/**
* Adds a write transformer.
*/
- ExternalWriteTransformer addWriteTransformer(int index);
+ ExternalWriteTransformer addWriteTransformer();
+
+ /**
+ * Returns the {@link TextRange} for the mutable value.
+ */
+ TextRange getMutableTextRange();
/**
* Returns the read transformer.
*/
- ExternalTransformer getReadTransformer();
+ ExternalReadTransformer getReadTransformer();
/**
* Returns the write transformer at the index.
@@ -73,7 +98,7 @@
/**
* Returns all the write transformers.
*/
- ListIterable<ExternalWriteTransformer> writeTransformers();
+ List<ExternalWriteTransformer> writeTransformers();
/**
* Returns the number of write transformers.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransformer.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransformer.java
index bfa0bed..a331e5a 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransformer.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransformer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface represents the write/read transformer defined by the EclipseLink JPA spec that are
* available for configuration via the EclipseLink ORM xml.
@@ -22,22 +25,42 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalTransformer extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the method property.
+ */
+ String METHOD = "method";
+
+ /**
+ * The attribute name used to store and retrieve the transformer-class property.
+ */
+ String TRANSFORMER_CLASS = "transformer-class";
+
+ /**
* Returns the name of the transformer method.
*/
String getMethodName();
/**
+ * Returns the {@link TextRange} for the name of the transformer method.
+ */
+ TextRange getMethodNameTextRange();
+
+ /**
* Returns the name of the transformer class.
*/
String getTransfomerClassName();
/**
+ * Returns the {@link TextRange} for the name of the transformer class.
+ */
+ TextRange getTransfomerClassNameTextRange();
+
+ /**
* Sets the method name.
*/
void setMethodName(String name);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransientMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransientMapping.java
index 8effbe3..01579f6 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransientMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTransientMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -24,8 +24,13 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalTransientMapping extends ExternalMapping {
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String TRANSIENT = "transient";
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTypeConverter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTypeConverter.java
index 3a51dc1..e815190 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTypeConverter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalTypeConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* This interface and inherited behavior describes the configurable properties for an converter. One
* or more converters can be declared as part of an entity
@@ -24,19 +27,42 @@
*
* @see org.eclipse.persistence.annotations.TypeConverter
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalTypeConverter extends ExternalForm {
/**
+ * The attribute name used to store and retrieve the data-type property.
+ */
+ String DATA_TYPE = "data-type";
+
+ /**
+ * The attribute name used to store and retrieve the name property.
+ */
+ String NAME = "name";
+
+ /**
+ * The attribute name used to store and retrieve the object-type property.
+ */
+ String OBJECT_TYPE = "object-type";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String TYPE_CONVERTER = "type-converter";
+
+ /**
* Returns the data type name for this converter.
*/
String getDatatype();
/**
- * Returns the index of this element in its owning parent.
+ * Returns the {@link TextRange} for the data type name value.
*/
+ TextRange getDatatypeTextRange();
+
+ @Deprecated
int getIndex();
/**
@@ -45,11 +71,21 @@
String getName();
/**
+ * Returns the {@link TextRange} for the name value.
+ */
+ TextRange getNameTextRange();
+
+ /**
* Returns the object type name for this converter.
*/
String getObjecttype();
/**
+ * Returns the {@link TextRange} for the object type name value.
+ */
+ TextRange getObjecttypeTextRange();
+
+ /**
* Sets the data type name for this converter.
*/
void setDatatype(String datatypeName);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalUniqueConstraint.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalUniqueConstraint.java
index 8f52a70..b3d6129 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalUniqueConstraint.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalUniqueConstraint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,7 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
-import java.util.ListIterator;
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.eclipse.persistence.tools.utility.iterable.ListIterable;
/**
@@ -28,15 +30,25 @@
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html, persistence specificaton
* @see UniqueConstraint
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalUniqueConstraint extends ExternalForm {
/**
+ * The element name used to store and retrieve the column-name child element.
+ */
+ String COLUMN_NAME = "column-name";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String UNIQUE_CONSTRAINT = "unique-constraint";
+
+ /**
* Returns an {@link ListIterator} over all column names listed for this unique constraint.
*/
- ListIterable<String> columnNames();
+ List<String> columnNames();
/**
* Returns the count of the column names owned by this unique constraint.
@@ -44,13 +56,15 @@
int columnNamesSize();
/**
- * Returns the position of this unique constraints within the list of unique constraints owned
- * by the parent.
+ * Returns the {@link TextRange} for the column at the given position.
*/
+ TextRange getColumnTextRange(int index);
+
+ @Deprecated
int getIndex();
/**
* Updates the list of column names for this unique constraints.
*/
- void setColumnNames(ListIterator<String> columnNames);
+ void setColumnNames(ListIterable<String> columnNames);
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalVariableOneToOneMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalVariableOneToOneMapping.java
index 63beb10..9849fd5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalVariableOneToOneMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalVariableOneToOneMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,9 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import java.util.List;
import javax.persistence.CascadeType;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* This interface represents the basis for all variable one to one mapping types defined by the
@@ -25,42 +26,102 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalVariableOneToOneMapping extends ExternalMappedMapping,
ExternalPrivatelyOwnableMapping,
ExternalOrphanRemovableMapping {
/**
+ * The element name used to store and retrieve the mutable child text node.
+ */
+ String CASCADE = "cascade";
+
+ /**
+ * The name of the element used to specify the cascade-all property.
+ */
+ String CASCADE_ALL = "cascade-all";
+
+ /**
+ * The name of the element used to specify the cascade-detach property.
+ */
+ String CASCADE_DETACH = "cascade-detach";
+
+ /**
+ * The name of the element used to specify the cascade-merge property.
+ */
+ String CASCADE_MERGE = "cascade-merge";
+
+ /**
+ * The name of the element used to specify the cascade-persist property.
+ */
+ String CASCADE_PERSIST = "cascade-persist";
+
+ /**
+ * The name of the element used to specify the cascade-refresh property.
+ */
+ String CASCADE_REFRESH = "cascade-refresh";
+
+ /**
+ * The name of the element used to specify the cascade-remove property.
+ */
+ String CASCADE_REMOVE = "cascade-remove";
+
+ /**
+ * The attribute name used to store and retrieve the fetch property.
+ */
+ String FETCH = "fetch";
+
+ /**
+ * The attribute name used to store and retrieve the optional property.
+ */
+ String OPTIONAL = "optional";
+
+ /**
+ * The element name used to store and retrieve the private-owned element.
+ */
+ String PRIVATE_OWNED = "private-owned";
+
+ /**
+ * The attribute name used to store and retrieve the target-interface property.
+ */
+ String TARGET_INTERFACE = "target-interface";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String VARIABLE_ONE_TO_ONE = "variable-one-to-one";
+
+ /**
* Adds a cascaded type to use.
*/
void addCascadeType(CascadeType type);
/**
- * Adds a discriminator class with the given name.
+ * Adds a discriminator class with the given values.
*/
- void addDiscriminatorClass(int index, String discrimator, String value);
+ ExternalDiscriminatorClass addDiscriminatorClass(String discrimator, String value);
/**
* Creates a new discriminator column definition replacing the old one.
*/
- void addDiscriminatorColumn();
+ ExternalDiscriminatorColumn addDiscriminatorColumn();
/**
* Adds a join column with the given name.
*/
- void addJoinColumn(int index, String name);
+ ExternalJoinColumn addJoinColumn(String name);
/**
* Returns the enum, CascadeType to use for this relationship.
*/
- ListIterable<CascadeType> cascadeTypes();
+ List<CascadeType> cascadeTypes();
/**
* Returns the discriminator class for this mapping.
*/
- ListIterable<ExternalDiscriminatorClass> discriminatorClasses();
+ List<ExternalDiscriminatorClass> discriminatorClasses();
/**
* Returns the count of discriminator classes for this mapping.
@@ -88,9 +149,14 @@
String getTargetInterfaceName();
/**
+ * Returns the {@link TextRange} for the target interface name value.
+ */
+ TextRange getTargetInterfaceNameTextRange();
+
+ /**
* Returns the join column for this mapping.
*/
- ListIterable<ExternalJoinColumn> joinColumns();
+ List<ExternalJoinColumn> joinColumns();
/**
* Returns the count of join columns for this mapping.
@@ -103,7 +169,7 @@
void removeCascadeType(CascadeType type);
/**
- * Removes the discriminator class at the given index.
+ * Removes the discriminator class at the given position.
*/
void removeDiscriminatorClass(int index);
@@ -113,7 +179,7 @@
void removeDiscriminatorColumn();
/**
- * Removes the join column named.
+ * Removes the join column at the given position.
*/
void removeJoinColumn(int index);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalVersionMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalVersionMapping.java
index 959ede0..cf5248f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalVersionMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalVersionMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm;
+import org.eclipse.persistence.tools.utility.TextRange;
+
/**
* Describes the properties of a Version mapping defined in the ORM.xml. A Version mapping may be
* defined in the "attributes" section of an Entity or MappedSuperClass.
@@ -24,12 +26,27 @@
*
* @see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html,persistence specificaton
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalVersionMapping extends ExternalColumnMapping {
/**
+ * The attribute name used to store and retrieve the mutable property.
+ */
+ String MUTABLE = "mutable";
+
+ /**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String VERSION = "version";
+
+ /**
+ * Returns the {@link TextRange} for the mutable value.
+ */
+ TextRange getMutableTextRange();
+
+ /**
* Returns whether the mapping is mutable.
*/
Boolean isMutable();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalWriteTransformer.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalWriteTransformer.java
index 218bba3..6a6246f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalWriteTransformer.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalWriteTransformer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -22,12 +22,17 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
+@SuppressWarnings("nls")
public interface ExternalWriteTransformer extends ExternalTransformer {
/**
+ * The node name used to store and retrieve the element encapsulated by this external form.
+ */
+ String WRITE_TRANSFORMER = "write-transformer";
+
+ /**
* Add the column.
*/
void addColumn();
@@ -38,11 +43,6 @@
ExternalEntityColumn getColumn();
/**
- * Returns the index of this transformer in the mapping collection.
- */
- int getIndex();
-
- /**
* Removes the column.
*/
void removeColumn();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ORMDocumentType.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ORMDocumentType.java
index 11cc593..8e00734 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ORMDocumentType.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ORMDocumentType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,7 +16,6 @@
import java.util.ArrayList;
import java.util.List;
import org.eclipse.persistence.tools.utility.StringTools;
-
import static org.eclipse.persistence.tools.mapping.orm.ORMXmlConstants.*;
import static org.eclipse.persistence.tools.mapping.orm.XmlConstants.*;
@@ -28,7 +27,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
@SuppressWarnings("unused") // unused used for the import statement: see bug 330740
public enum ORMDocumentType {
@@ -69,6 +68,11 @@
ECLIPELINK_2_5(ECLIPSELINK_ORM_NAMESPACE_URI, VERSION_2_5, ECLIPSELINK_ORM_XSD_URI_2_5),
/**
+ * Indicates the JPA doc version is EclipseLink 2.6.
+ */
+ ECLIPELINK_2_6(ECLIPSELINK_ORM_NAMESPACE_URI, VERSION_2_6, ECLIPSELINK_ORM_XSD_URI_2_6),
+
+ /**
* Indicates the JPA doc version is 1.0.
*/
JPA_1_0(ORM_NAMESPACE_URI, VERSION_1_0, ORM_XSD_URI_1_0),
@@ -133,6 +137,7 @@
types.add(ECLIPELINK_2_3);
types.add(ECLIPELINK_2_4);
types.add(ECLIPELINK_2_5);
+ types.add(ECLIPELINK_2_6);
return types;
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ORMXmlConstants.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ORMXmlConstants.java
index 8145081..ae34e7d 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ORMXmlConstants.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ORMXmlConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -21,8 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author TopLink Team
+ * @version 2.6
*/
@SuppressWarnings("nls")
public interface ORMXmlConstants extends XmlConstants {
@@ -68,6 +67,11 @@
String ECLIPSELINK_ORM_XSD_URI_2_5 = "http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_5.xsd";
/**
+ * The URI of the EclipseLink ORM Configuration schema, version ORM 2.6.
+ */
+ String ECLIPSELINK_ORM_XSD_URI_2_6 = "http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_6.xsd";
+
+ /**
* The URI of the ORM namespace.
*/
String ORM_NAMESPACE_URI = "http://java.sun.com/xml/ns/persistence/orm";
@@ -116,4 +120,9 @@
* Static identifier for the document version 2.5.
*/
String VERSION_2_5 = "2.5";
+
+ /**
+ * Static identifier for the document version 2.6.
+ */
+ String VERSION_2_6 = "2.6";
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/XmlConstants.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/XmlConstants.java
index 42f03dc..24750fd 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/XmlConstants.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/XmlConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -21,8 +21,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author TopLink Team
+ * @version 2.6
*/
@SuppressWarnings("nls")
public interface XmlConstants {
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractColumn.java
index 5e0b877..4d7ffdf 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,71 +15,19 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalBasicColumn;
-import org.w3c.dom.Element;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of a basic column.
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
abstract class AbstractColumn extends AbstractExternalForm
implements ExternalBasicColumn {
/**
- * The attribute name used to store and retrieve the column-definition property.
- */
- static final String COLUMN_DEFINITION = "column-definition";
-
- /**
- * The attribute name used to store and retrieve the insertable property.
- */
- static final String INSERTABLE = "insertable";
-
- /**
- * The attribute name used to store and retrieve the length property.
- */
- static final String LENGTH = "length";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The attribute name used to store and retrieve the nullable property.
- */
- static final String NULLABLE = "nullable";
-
- /**
- * The attribute name used to store and retrieve the precision property.
- */
- static final String PRECISION = "precision";
-
- /**
- * The attribute name used to store and retrieve the scale property.
- */
- static final String SCALE = "scale";
-
- /**
- * The attribute name used to store and retrieve the table property.
- */
- static final String TABLE = "table";
-
- /**
- * The attribute name used to store and retrieve the unique property.
- */
- static final String UNIQUE = "unique";
-
- /**
- * The attribute name used to store and retrieve the updatable property.
- */
- static final String UPDATABLE = "updatable";
-
- /**
* Creates a new <code>Column</code>.
*
* @param parent The parent of this external form
@@ -87,7 +35,7 @@
AbstractColumn(AbstractExternalForm parent) {
super(parent);
}
-
+
/**
* {@inheritDoc}
*/
@@ -101,9 +49,6 @@
names.add(UPDATABLE);
names.add(COLUMN_DEFINITION);
names.add(TABLE);
- names.add(LENGTH);
- names.add(PRECISION);
- names.add(SCALE);
return names;
}
@@ -119,8 +64,24 @@
* {@inheritDoc}
*/
@Override
- public Element getElement() {
- return getChild(getParent(), getElementName());
+ public final TextRange getColumnDefinitionTextRange() {
+ return getAttributeTextRange(COLUMN_DEFINITION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final TextRange getColumnTextRange() {
+ return getTextNodeTextRange(getElement());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final TextRange getInstertableTextRange() {
+ return getAttributeTextRange(INSERTABLE);
}
/**
@@ -135,6 +96,22 @@
* {@inheritDoc}
*/
@Override
+ public final TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final TextRange getNullableTextRange() {
+ return getAttributeTextRange(NULLABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getTable() {
return getAttribute(TABLE);
}
@@ -143,6 +120,30 @@
* {@inheritDoc}
*/
@Override
+ public final TextRange getTableTextRange() {
+ return getAttributeTextRange(TABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final TextRange getUniqueTextRange() {
+ return getAttributeTextRange(UNIQUE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final TextRange getUpdatableTextRange() {
+ return getAttributeTextRange(UPDATABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final Boolean isInstertable() {
return getBooleanAttribute(INSERTABLE);
}
@@ -262,6 +263,11 @@
}
}
+ /**
+ * Determines whether this element should be removed when it has no children and no attributes.
+ *
+ * @return <code>true</code> to remove this element; <code>false</code> to not remove it
+ */
boolean shouldRemoveEmptyElement() {
return false;
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractExternalForm.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractExternalForm.java
deleted file mode 100644
index 3b08437..0000000
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractExternalForm.java
+++ /dev/null
@@ -1,3093 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.persistence.tools.mapping.orm.dom;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.persistence.tools.mapping.orm.ExternalForm;
-import org.eclipse.persistence.tools.utility.ObjectTools;
-import org.eclipse.persistence.tools.utility.StringTools;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-
-/**
- * This abstract implementation of an {@link ExternalForm} defines common behavior for accessing and
- * manipulating an XML document.
- * <p>
- * Provisional API: This interface is part of an interim API that is still under development and
- * expected to change significantly before reaching stability. It is available at this early stage
- * to solicit feedback from pioneering adopters on the understanding that any code that uses this
- * API will almost certainly be broken (repeatedly) as the API evolves.<p>
- *
- * @see ExternalForm
- *
- * @version 2.5
- * @author TopLink Workbench Team
- */
-@SuppressWarnings("nls")
-public abstract class AbstractExternalForm implements ExternalForm {
-
- /**
- * A list of attribute names that will be used to insert a property at the right position.
- */
- private List<String> attributeNamesOrder;
-
- /**
- * A list of element names that will be used to insert a new child element at the right position.
- */
- private List<String> elementNamesOrder;
-
- /**
- * The parent of this external form or <code>null</code> if this is the root object.
- */
- private AbstractExternalForm parent;
-
- /**
- * The attribute name of the child text node for version.
- */
- public static final String VERSION = "version";
-
- /**
- * The XML attribute identifier for the xml namespace.
- */
- protected static final String XMLNS_ATTRIBUTE = "xmlns";
-
- public static final java.lang.String XMLNS_URI = "http://www.w3.org/2000/xmlns/";
-
- public static final java.lang.String XMLNS_XSI = "xmlns:xsi";
-
- /**
- * The XML schema namespace.
- */
- protected static final String XSD_URI = "http://www.w3.org/2001/XMLSchema";
-
- /**
- * The XML attribute identifier for the schema location URI.
- */
- protected static final String XSD_URI_ATTRIBUTE = "xsi:schemaLocation";
-
- public static final java.lang.String XSI_SLOC = "xsi:schemaLocation";
-
- public static final java.lang.String XSI_URI = "http://www.w3.org/2001/XMLSchema-instance";
-
- /**
- * Creates a new <code>AbstractExternalForm</code>.
- *
- * @param parent The parent of this external form or <code>null</code> if this is the root object
- */
- protected AbstractExternalForm(AbstractExternalForm parent) {
- super();
- this.parent = parent;
- this.initialize();
- }
-
- /**
- * Adds a new child element to the element represented by the given parent external form. The
- * child element will be added at the end of the list of children.
- *
- * @param parent The external form representing the parent element where the child element will
- * be added
- * @param elementName The name of the new child element
- * @return The newly created child element
- */
- protected final Element addChild(AbstractExternalForm parent, String elementName) {
-
- Element element = parent.getElement();
-
- if (element == null) {
- element = parent.addSelf();
- }
-
- return addChild(element, elementName);
- }
-
- /**
- * Adds a new child element to the given element. The child element will be added at the end of
- * the list of children.
- *
- * @param parent The external form representing the parent element where the child element will
- * be added
- * @param elementName The name of the new child element
- * @param index The index of insertion within the collection of children
- * @return The newly created child element
- */
- protected final Element addChild(AbstractExternalForm parent, String elementName, int index) {
-
- Element element = parent.getElement();
-
- if (element == null) {
- element = parent.addSelf();
- }
-
- return addChild(element, elementName, index);
- }
-
- /**
- * Adds a new child element to the given element. The child element will be added at the end of
- * the list of children.
- *
- * @param parent The external form representing the parent element where the child element will
- * be added
- * @param elementName The name of the new child element
- * @param index The index of insertion within the collection of children
- * @param elementNamesOrder The list of element names used to determine the insertion point
- * @return The newly created child element
- */
- protected final Element addChild(AbstractExternalForm parent,
- String elementName,
- int index,
- List<String> elementNamesOrder) {
-
- Element element = parent.getElement();
-
- if (element == null) {
- element = parent.addSelf();
- }
-
- return addChild(element, elementName, index, elementNamesOrder);
- }
-
- /**
- * Adds a new child element to the given element. The child element will be added at the end of
- * the list of children.
- * <p>
- * Note: This method is used when the child elements have an order.
- *
- * @param parent The external form representing the parent element where the child element will
- * be added
- * @param elementName The name of the new child element
- * @param elementNamesOrder The list of element names used to determine the insertion point
- * @return The newly created child element
- */
- protected final Element addChild(AbstractExternalForm parent,
- String elementName,
- List<String> elementNamesOrder) {
-
- Element element = parent.getElement();
-
- if (element == null) {
- element = parent.addSelf();
- }
-
- return addChild(element, elementName, elementNamesOrder);
- }
-
- /**
- * Adds a new child element to the given element. The child element will be added at the end of
- * the list of children.
- *
- * @param element The element to which a new child element will be added
- * @param elementName The name of the new child element
- * @return The newly created child element
- */
- protected Element addChild(Element element, String elementName) {
- return addChild(element, elementName, getElementNamesOrder());
- }
-
- /**
- * Adds a new child element to the given element. The child element will be added at the end of
- * the list of children.
- *
- * @param element The element to which a new child element will be added
- * @param elementName The name of the new child element
- * @param index The index of insertion within the collection of children
- * @return The newly created child element
- */
- protected final Element addChild(Element element,
- String elementName,
- int index) {
-
- // Retrieve the child at the specified index in order to insert the new
- // child after it
- List<Element> children = getChildren(element);
- Element child = index < children.size() ? children.get(index) : null;
-
- // Insert the new child
- Element childElement = getDocument().createElement(elementName);
- element.insertBefore(childElement, child);
-
- return childElement;
- }
-
- /**
- * Adds a new child element to the given element. The child element will be added at the end of
- * the list of children.
- * <p>
- * Note: This method is used when the child elements have an order.
- *
- * @param element The element to which a new child element will be added
- * @param elementName The name of the new child element
- * @param index The index of insertion within the collection of children
- * @param elementNamesOrder The list of element names used to determine the insertion point
- * @return The newly created child element
- */
- protected final Element addChild(Element element,
- String elementName,
- int index,
- List<String> elementNamesOrder) {
-
- // Retrieve the child at the specified index in order to insert the new
- // child after it
- List<Element> children = getChildren(element, elementName);
- Element elementOfInsertion = index < children.size() ? children.get(index) : null;
-
- // No element of insertion was found, use the list instead
- if (elementOfInsertion == null) {
- elementOfInsertion = elementOfInsertion(element, elementName, elementNamesOrder);
- }
-
- // Insert the new child node at the right location
- Element childElement = getDocument().createElement(elementName);
- element.insertBefore(childElement, elementOfInsertion);
-
- return childElement;
- }
-
- /**
- * Adds a new child element to the given element. The child element will be added at the end of
- * the list of children.
- * <p>
- * Note: This method is used when the child elements have an order.
- *
- * @param element The element to which a new child element will be added
- * @param elementName The name of the new child element
- * @param elementNamesOrder The list of element names used to determine the insertion point
- * @return The newly created child element
- */
- protected final Element addChild(Element element,
- String elementName,
- List<String> elementNamesOrder) {
-
- // Create the child node
- Element childElement = getDocument().createElement(elementName);
-
- // Insert the new child node at the right location
- Element elementOfInsertion = elementOfInsertion(element, elementName, elementNamesOrder);
- element.insertBefore(childElement, elementOfInsertion);
-
- return childElement;
- }
-
- /**
- * Adds a new child element to the element represented by this external form. The child element
- * will be added at the end of the list of element's children.
- *
- * @param elementName The name of the new child element
- * @return The newly created child element
- */
- protected final Element addChild(String elementName) {
-
- Element element = getElement();
-
- if (element == null) {
- element = addSelf();
- }
-
- return addChild(element, elementName);
- }
-
- /**
- * Adds a new child element to the given element. The child element will be added at the end of
- * the list of element's children.
- *
- * @param elementName The name of the new child element
- * @param index The index of insertion within the children
- * @return The newly created child element
- */
- protected final Element addChild(String elementName, int index) {
-
- Element element = getElement();
-
- if (element == null) {
- element = addSelf();
- }
-
- return addChild(element, elementName, index);
- }
-
- /**
- * Adds a new child element to the element represented by this external form. The child element
- * will be added at the end of the list of element's children.
- *
- * @param elementName The name of the new child element
- * @param elementNamesOrder The list of element names used to determine the insertion point
- * @return The newly created child element
- */
- protected final Element addChild(String elementName, List<String> elementNamesOrder) {
-
- Element element = getElement();
-
- if (element == null) {
- element = addSelf();
- }
-
- return addChild(element, elementName, elementNamesOrder);
- }
-
- /**
- * Adds a child text node to the given parent element.
- *
- * @param element The element to which a new child element will be added
- * @param elementName The name of the new child element
- * @param value The node's text
- * @return The newly created element
- */
- protected final Element addChildTextNode(Element element, String elementName, String value) {
- return addChildTextNode(element, elementName, value, getElementNamesOrder());
- }
-
- /**
- * Adds a child text node to the given parent element.
- *
- * @param element The element to which a new child element will be added
- * @param elementName The name of the new child element
- * @param value The node's text
- * @param elementNamesOrder The list of element names used to determine the insertion point
- * @return The newly created element
- */
- protected final Element addChildTextNode(Element element,
- String elementName,
- String value,
- List<String> elementNamesOrder) {
-
- // It seems we can't create a text node with a value only containing
- // white spaces, so we ignore the addition
- if (StringTools.isBlank(value)) {
- return null;
- }
-
- // Create the child text node
- Element childElement = getDocument().createElement(elementName);
-
- Text text = getDocument().createTextNode(value);
- text.setNodeValue(value);
-
- childElement.appendChild(text);
-
- // Insert the new child text node at the right location
- Element elementOfInsertion = elementOfInsertion(element, elementName, elementNamesOrder);
- element.insertBefore(childElement, elementOfInsertion);
-
- return childElement;
- }
-
- /**
- * Adds a child text node to the given parent {@link Element}.
- *
- * @param elementName The name of the new child {@link Element}
- * @param value The node's text
- * @return The newly created {@link Element}
- */
- protected final Element addChildTextNode(String elementName, String value) {
- return addChildTextNode(elementName, value, getElementNamesOrder());
- }
-
- /**
- * Adds a child text node to the given parent {@link Element}.
- *
- * @param elementName The name of the new child {@link Element}
- * @param value The node's text
- * @param elementNamesOrder The list of element names used to determine the insertion point
- * @return The newly created {@link Element}
- */
- protected final Element addChildTextNode(String elementName, String value, List<String> elementNamesOrder) {
-
- Element element = getElement();
-
- if ((element == null) && (value == null)) {
- return null;
- }
-
- if (element == null) {
- element = addSelf();
- }
-
- return addChildTextNode(element, elementName, value, elementNamesOrder);
- }
-
- /**
- * Adds a new child element to the parent element that represents this model.
- *
- * @return The newly created child element
- */
- public Element addSelf() {
- return addSelf(getElementName());
- }
-
- /**
- * Adds a new child element to the parent element that represents this model.
- *
- * @param elementNamesOrder The list of element names used to determine the
- * insertion point
- * @return The newly created child element
- */
- protected Element addSelf(List<String> elementNamesOrder) {
- return addSelf(getElementName(), elementNamesOrder);
- }
-
- /**
- * Adds a new child element to the parent {@link Element} that represents this model.
- *
- * @param elementName The new name of the node
- * @return The newly created child element
- */
- protected Element addSelf(String elementName) {
- return addSelf(elementName, getParent().getElementNamesOrder());
- }
-
- /**
- * Adds a new child element to the parent element that represents this model.
- *
- * @param elementName The new name of the node
- * @param elementNamesOrder The list of element names used to determine the
- * insertion point
- * @return The newly created child element
- */
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, elementNamesOrder);
- }
-
- /**
- * Adds an xmlns: attribute to the given element to register the given prefix. Does no checking
- * for uniqueness. Also doesn't handle setting default namespace.
- */
- protected void addXmlns(Element ownerElement, String prefix, String uri) {
- ownerElement.setAttributeNS(XMLNS_URI, "xmlns:" + prefix, uri);
- }
-
- /**
- * Creates a list of attribute names that will be used to insert a property at the right position.
- *
- * @return The list of properties specifying the order
- */
- protected List<String> buildAttributeNamesOrder() {
- return Collections.emptyList();
- }
-
- /**
- * Creates a list of element names that will be used to insert a new child {@link Element} at the
- * right position.
- *
- * @return The list of element names specifying the order
- */
- protected List<String> buildElementNamesOrder() {
- return Collections.emptyList();
- }
-
- /**
- * Creates a fully qualified name by prepending the prefix to the given name.
- *
- * @param name The name to qualify with the prefix
- * @return The fully qualified name if a prefix exists; otherwise the given
- * name is returned
- */
- protected final String buildQualifiedName(String name) {
-
- String prefix = getPrefix();
-
- if (prefix == null) {
- return name;
- }
-
- StringBuilder qualifiedName = new StringBuilder();
- qualifiedName.append(prefix);
- qualifiedName.append(":");
- qualifiedName.append(name);
- return qualifiedName.toString();
- }
-
- /**
- * Retrieves the element that should follow the element with the given name by using the list of
- * ordered element names.
- *
- * @param element The element to which a new child element will be added
- * @param elementName The name of the new child element
- * @param elementNamesOrder The list of element names used to determine the insertion point
- */
- protected Element elementOfInsertion(Element element,
- String elementName,
- List<String> elementNamesOrder) {
-
- return (Element) nodeOfInsertion(
- element,
- getChildren(element),
- elementName,
- elementNamesOrder
- );
- }
-
- /**
- * Retrieves the {@link Text} node from the given element if one exists.
- *
- * @param element The {@link Element} from which its {@link Text} node will be returned
- * @return The child {@link Text} node if it exists or <code>null</code> if none was found
- */
- private Text findTextNode(Element element) {
-
- NodeList children = element.getChildNodes();
-
- if (children == null) {
- return null;
- }
-
- for (int index = children.getLength(); --index >= 0; ) {
- Node childNode = children.item(index);
-
- if (isText(childNode)) {
- return (Text) childNode;
- }
- }
-
- return null;
- }
-
- /**
- * Retrieves all the children of the element represented by this external form, elements and
- * non-elements are included in the list.
- *
- * @return The list of children or an empty list if no children are present
- */
- protected final List<Node> getAllChildren() {
-
- Element element = getElement();
-
- if (element != null) {
- return getAllChildren(element);
- }
-
- return Collections.emptyList();
- }
-
- /**
- * Retrieves all the children of the given element, elements and non-elements
- * are included in the list.
- *
- * @param node The node to retrieve its children
- * @return The list of children or an empty list if no children are present
- */
- protected final List<Node> getAllChildren(Node node) {
-
- List<Node> children = new ArrayList<Node>();
- NodeList childrenList = node.getChildNodes();
-
- if (childrenList != null) {
- for (int index = childrenList.getLength(); --index >= 0;) {
- Node child = childrenList.item(index);
- children.add(0, child);
- }
- }
-
- return children;
- }
-
- /**
- * Retrieves the count of the children the element represented by this external form. The count
- * includes any type of child (elements and comments).
- *
- * @return The total count of children
- */
- protected final int getAllChildrenSize() {
-
- Element element = getElement();
-
- if (element != null) {
- return getAllChildrenSize(element);
- }
-
- return 0;
- }
-
- /**
- * Retrieves all the children of the given node.
- *
- * @param node The parent node for which its children are requested
- * @return The children of the given node or an empty list is returned if none was found
- */
- protected final int getAllChildrenSize(Node node) {
-
- NodeList childrenList = node.getChildNodes();
-
- if (childrenList != null) {
- return childrenList.getLength();
- }
-
- return 0;
- }
-
- /**
- * Retrieves an attribute's value associated with the given property name from the given element.
- *
- * @param element The element used to retrieve the value of one of its properties
- * @param attributeName The attribute name to retrieve it's value
- * @return The value mapped to the given property name; an empty string is returned if it
- * couldn't be retrieved
- */
- protected final String getAttribute(Element element, String attributeName) {
- if (element.hasAttribute(attributeName)) {
- return element.getAttribute(attributeName);
- }
-
- return null;
- }
-
- /**
- * Retrieves the attribute's value having the given name from this model's element.
- *
- * @param attributeName The name of the attribute
- * @return The attribute's value
- */
- protected final String getAttribute(String attributeName) {
-
- Element element = getElement();
-
- if (element != null) {
- return getAttribute(element, attributeName);
- }
-
- return null;
- }
-
- /**
- * Returns the order of the attributes of the element represented by this external form.
- *
- * @return The list of property names that determines the order of insertion
- */
- protected final List<String> getAttributeNamesOrder() {
- return attributeNamesOrder;
- }
-
- /**
- * Retrieves an attribute's value associated with the given property name from the given element.
- *
- * @param element The element used to retrieve the value of one of its properties
- * @param attributeName The name of the attribute, which will be prepended by the namespace
- * @return The value mapped to the given property name; an empty string is returned if it
- * couldn't be retrieved
- */
- protected final String getAttributeNS(Element element, String attributeName) {
- if (element.hasAttributeNS(XSI_URI, attributeName)) {
- return element.getAttributeNS(XSI_URI, attributeName);
- }
-
- return null;
- }
-
- /**
- * Retrieves the attribute's value having the given name from this model's element.
- *
- * @param attributeName The name of the attribute, which will be prepended by the namespace
- * @return The attribute's value
- */
- protected final String getAttributeNS(String attributeName) {
-
- Element element = getElement();
-
- if (element != null) {
- return getAttributeNS(element, attributeName);
- }
-
- return null;
- }
-
- /**
- * Retrieves the list of attributes for the given element.
- *
- * @param element The element to retrieve its list of attributes
- * @return The attributes for the given element
- */
- private List<Attr> getAttributes(Element element) {
-
- List<Attr> attributes = new ArrayList<Attr>();
- NamedNodeMap map = element.getAttributes();
-
- if (map != null) {
- for (int index = map.getLength(); --index >= 0;) {
- Node node = map.item(index);
-
- if (isAttribute(node)) {
- attributes.add(0, (Attr) node);
- }
- }
- }
-
- return attributes;
- }
-
- /**
- * Retrieves the attribute's value having the given name from this model's element.
- *
- * @param element The element where the attribute's value is located
- * @param attributeName The name of the attribute
- * @return The attribute's value
- */
- protected final Boolean getBooleanAttribute(Element element, String attributeName) {
-
- String value = getAttribute(element, attributeName);
-
- if (value == null) {
- return null;
- }
-
- return Boolean.valueOf(value);
- }
-
- /**
- * Retrieves the attribute's value having the given name from this model's element.
- *
- * @param attributeName The name of the attribute
- * @return The attribute's value
- */
- protected final Boolean getBooleanAttribute(String attributeName) {
-
- Element element = getElement();
-
- if (element == null) {
- return null;
- }
-
- return getBooleanAttribute(element, attributeName);
- }
-
- /**
- * Retrieves the {@link Element} with the given name.
- *
- * @param parent The parent of this external form used to retrieve the parent element
- * @param elementName The name of the child to retrieve if it could not be found
- */
- protected final Element getChild(AbstractExternalForm parent, String elementName) {
- return getChild(parent.getElement(), elementName);
- }
-
- /**
- * Retrieves the {@link Element} with the given name.
- *
- * @param parent The parent of this external form used to retrieve the parent element
- * @param elementName The name of the child to retrieve
- * @param index The position of the child to retrieve among the children
- * @return The {@link Element} with the given name or <code>null</code> if it could not be found
- */
- protected final Element getChild(AbstractExternalForm parent, String elementName, int index) {
- return getChild(parent.getElement(), elementName, index);
- }
-
- /**
- * Retrieves the XML {@link Element} with the given name that is the direct child of the given
- * parent node.
- *
- * @param node The node for which one of its children is requested
- * @param index The position of the child to retrieve among the children
- * @return The {@link Element} at the given position if it was found; <code>null</code> otherwise
- */
- protected final Element getChild(Node node, int index) {
-
- List<Element> children = getChildren(node);
-
- if (index >= children.size()) {
- return null;
- }
-
- return children.get(index);
- }
-
- /**
- * Retrieves the XML {@link Element} with the given name that is the direct child of the given node.
- *
- * @param node The parent node for which one of its children is requested
- * @param elementName The name of the children to retrieve
- * @return The {@link Element} with the given name if it was found; <code>null</code> otherwise
- */
- protected final Element getChild(Node node, String elementName) {
- for (Element child : getChildren(node)) {
- if (ObjectTools.equals(child.getNodeName(), elementName)) {
- return child;
- }
- }
-
- return null;
- }
-
- /**
- * Retrieves the {@link Element} with the given name.
- *
- * @param node The parent element from which to search for the child element
- * @param elementName The name of the child to retrieve
- * @param index The position of the child to retrieve among the children
- * @return The {@link Element} with the given name or <code>null</code> if it could not be found
- */
- protected final Element getChild(Node node, String elementName, int index) {
-
- if (index < 0) {
- return null;
- }
-
- List<Element> children = getChildren(node, elementName);
-
- if (index >= children.size()) {
- return null;
- }
-
- return children.get(index);
- }
-
- /**
- * Retrieves the {@link Element} with the given name that is a child of the {@link Element}
- * represented by this model.
- *
- * @param elementName The name of the child element to retrieve
- * @return The {@link Element} with the given name or <code>null</code> if it could not be found
- */
- protected final Element getChild(String elementName) {
-
- Element element = getElement();
-
- if (element != null) {
- element = getChild(element, elementName);
- }
-
- return element;
- }
-
- /**
- * Retrieves the {@link Element} with the given name that is a child of the {@link Element}
- * represented by this model.
- *
- * @param elementName The name of the child element to retrieve
- * @param index
- * @return The {@link Element} with the given name or <code>null</code> if it could not be found
- */
- protected final Element getChild(String elementName, int index) {
-
- Element element = getElement();
-
- if (element != null) {
- element = getChild(element, elementName, index);
- }
-
- return element;
- }
-
- /**
- * Retrieves the attribute's value associated with the given attribute name that is defined in
- * the child element with the given name.
- *
- * @param childName The name of the child for which the attribute's value is retrieved
- * @param attributeName The name of the attribute to retrieve its value
- * @return The value of the attribute
- */
- protected final String getChildAttribute(String childName, String attributeName) {
-
- Element element = getChild(childName);
-
- if (element == null) {
- return null;
- }
-
- return getAttribute(element, attributeName);
- }
-
- /**
- * Returns the <code>Boolean</code> representation of the child node's text.
- *
- * @param elementName The name of the child element to retrieve its value
- * @return The <code>Boolean</code> value of the child node's value
- */
- protected final Boolean getChildBooleanNode(Node element, String elementName) {
-
- String value = getChildTextNode(element, elementName);
-
- if (value != null) {
- return Boolean.valueOf(value);
- }
-
- return null;
- }
-
- /**
- * Returns the <code>Boolean</code> representation of the child node's text.
- *
- * @param elementName The name of the child element to retrieve its value
- * @return The <code>Boolean</code> value of the child node's value
- */
- protected final Boolean getChildBooleanNode(String elementName) {
-
- Element element = getElement();
-
- if (element != null) {
- return getChildBooleanNode(element, elementName);
- }
-
- return null;
- }
-
- /**
- * Returns the {@link Enum} representation of the child node's text.
- *
- * @param node The parent node to retrieve its child
- * @param elementName The name of the child to retrieve
- * @param enumClass The type of the enumeration used to retrieve the constant
- * @param <T> The type of the enumeration
- * @return The {@link Enum} value of the child node's value
- */
- protected final <T extends Enum<T>> T getChildEnumNode(Node node,
- String elementName,
- Class<T> enumClass) {
-
- String value = getChildTextNode(node, elementName);
-
- if (value != null) {
- try {
- return Enum.valueOf(enumClass, value);
- }
- catch (Exception e) {
- // Ignore, it's not a valid enum constant
- }
- }
-
- return null;
- }
-
- /**
- * Returns the {@link Enum} representation of the child node's text.
- *
- * @param elementName The name of the child to retrieve
- * @param enumClass The type of the enumeration used to retrieve the constant
- * @param <T> The type of the enumeration
- * @return The {@link Enum} value of the child node's value
- */
- protected final <T extends Enum<T>> T getChildEnumNode(String elementName, Class<T> enumClass) {
-
- Element element = getElement();
-
- if (element != null) {
- return getChildEnumNode(element, elementName, enumClass);
- }
-
- return null;
- }
-
- /**
- * Returns the {@link Integer} value of a child text node that is the child of the given element.
- *
- * @param element The parent element
- * @param elementName The name of the child element to retrieve its value
- * @return The {@link Integer} of the child element or <code>null</code> if the element is not defined
- */
- protected final Integer getChildIntegerNode(Node element, String elementName) {
-
- String value = getChildTextNode(element, elementName);
-
- if (value == null) {
- return null;
- }
-
- try {
- return Integer.valueOf(value);
- }
- catch (Exception e) {
- return null;
- }
- }
-
- /**
- * Returns the {@link Integer} value of a child text node that is the child of the element
- * represented by this external form.
- *
- * @param elementName The name of the child element to retrieve its value
- * @return The {@link Integer} of the child element or <code>null</code> if the element is not defined
- */
- protected final Integer getChildIntegerNode(String elementName) {
-
- Element element = getElement();
-
- if (element != null) {
- return getChildIntegerNode(element, elementName);
- }
-
- return null;
- }
-
- /**
- * Retrieves the elements that are the direct children of the given parent node.
- *
- * @return The {@link Element}s that are children of the parent node or an empty list is returned
- * if none was found
- */
- protected final List<Element> getChildren() {
-
- Element element = getElement();
-
- if (element != null) {
- return getChildren(element);
- }
-
- return Collections.emptyList();
- }
-
- /**
- * Retrieves the XML {@link Element}s that are the direct children of the given parent node.
- *
- * @param node The node for which its children are requested
- * @return The {@link Element}s that are children of the parent node or an empty list is returned
- * if none was found
- */
- protected final List<Element> getChildren(Node node) {
-
- List<Element> children = new ArrayList<Element>();
- NodeList childrenList = node.getChildNodes();
-
- if (childrenList != null) {
- for (int index = childrenList.getLength(); --index >= 0;) {
- Node child = childrenList.item(index);
-
- if (isElement(child)) {
- children.add(0, (Element) child);
- }
- }
- }
-
- return children;
- }
-
- /**
- * Retrieves the XML {@link Element}s that are the direct children of the given parent node.
- *
- * @param node The parent node for which its children are requested
- * @param elementNames The collection of names that count as a child of the given node
- * @return The {@link Element}s that are children of the parent node or an empty list is returned
- * if none was found
- */
- protected final List<Element> getChildren(Node node, Collection<String> elementNames) {
-
- List<Element> children = getChildren(node);
-
- for (Iterator<Element> iter = children.iterator(); iter.hasNext();) {
- Element element = iter.next();
- String elementName = element.getNodeName();
-
- if (!elementNames.contains(elementName)) {
- iter.remove();
- }
- }
-
- return children;
- }
-
- /**
- * Retrieves the XML {@link Element}s that are the direct children of the given parent node.
- *
- * @param node The parent node for which its children are requested
- * @param elementName The name of the element to retrieve
- * @return The {@link Element}s that are children of the parent node or an empty list is returned
- * if none was found
- */
- protected final List<Element> getChildren(Node node, String elementName) {
-
- List<Element> children = getChildren(node);
-
- for (Iterator<Element> iter = children.iterator(); iter.hasNext();) {
- Element element = iter.next();
-
- if (ObjectTools.notEquals(element.getNodeName(), elementName)) {
- iter.remove();
- }
- }
-
- return children;
- }
-
- /**
- * Retrieves the XML {@link Element}s that are the direct children of the given parent node.
- *
- * @param elementName The name of the element to retrieve
- * @return The {@link Element}s that are children of the parent node or an empty list is returned
- * if none was found
- */
- protected final List<Element> getChildren(String elementName) {
-
- Element element = getElement();
-
- if (element != null) {
- return getChildren(element, elementName);
- }
-
- return Collections.emptyList();
- }
-
- /**
- * Retrieves the XML {@link Element}s that are the direct children of the given parent node.
- *
- * @return The count of child nodes
- */
- protected final int getChildrenSize() {
- return getChildren().size();
- }
-
- /**
- * Retrieves the XML {@link Element}s that are the direct children of the given parent node.
- *
- * @param node The count of children for this node
- * @return The count of child nodes listed under the given node
- */
- protected final int getChildrenSize(Node node) {
- return getChildren(node).size();
- }
-
- /**
- * Retrieves the XML {@link Element}s that are the direct children of the given parent node.
- *
- * @param element The parent element to retrieve the count of child nodes it has with the given
- * element name
- * @param elementNames The collection of names that count as a child of the given node
- * @return The count of child nodes with the given element name
- */
- protected final int getChildrenSize(Node element, Collection<String> elementNames) {
- return getChildren(element, elementNames).size();
- }
-
- /**
- * Retrieves the XML {@link Element}s that are the direct children of the given parent node.
- *
- * @param element The parent element to retrieve the count of child nodes it has with the given
- * element name
- * @param elementName The name of the element to retrieve
- * @return The count of child nodes with the given element name
- */
- protected final int getChildrenSize(Node element, String elementName) {
- return getChildren(element, elementName).size();
- }
-
- /**
- * Retrieves the XML {@link Element}s that are the direct children of the given parent node.
- *
- * @param elementName The name of the element to retrieve
- * @return The count of child nodes with the given element name
- */
- protected final int getChildrenSize(String elementName) {
- return getChildren(elementName).size();
- }
-
- /**
- * Returns the texts of the text nodes that are the children of the given parent.
- * <p>
- * Form: <elementName>text</elementName>.
- *
- * @param node The parent element
- * @param elementName The name of the child element to retrieve its value
- * @return The text of the child element or <code>null</code> if the element is not defined
- */
- protected final List<String> getChildrenTextNode(Node node, String elementName) {
-
- List<String> values = new ArrayList<String>();
-
- for (Element element : getChildren(node, elementName)) {
- values.add(element.getTextContent());
- }
-
- return values;
- }
-
- /**
- * Returns the texts of the text nodes that are the children of the given parent.
- * <p>
- * Form: <elementName>text</elementName>.
- *
- * @param elementName The name of the child element to retrieve its value
- * @return The text of the child element or <code>null</code> if the element is not defined
- */
- protected final List<String> getChildrenTextNode(String elementName) {
-
- Element element = getElement();
-
- if (element != null) {
- return getChildrenTextNode(element, elementName);
- }
-
- return Collections.emptyList();
- }
-
- /**
- * Returns the text of a child node that is the child of the given element.
- * <p>Form: <elementName>text</elementName>.
- *
- * @param node The parent node
- * @param elementName The name of the child element to retrieve its value
- * @return The text of the child element or <code>null</code> if the element is not defined
- */
- protected final String getChildTextNode(Node node, String elementName) {
-
- Element child = getChild(node, elementName);
-
- if (child != null) {
- return getTextNode(child);
- }
-
- return null;
- }
-
- /**
- * Returns the child node that is the child of the given element with the given text.
- * <p>Form: <elementName>text</elementName>.
- *
- * @param node The parent node
- * @param elementName The name of the child element to retrieve its value
- * @param text The text of the child element to retrieve its {@link TextRange}
- * @return The text of the child element or <code>null</code> if the element is not defined
- */
- protected final Element getChildTextNode(Node node, String elementName, String text) {
-
- for (Element child : getChildren(node, elementName)) {
- String childText = getTextNode(child);
- if (childText.equals(text)) {
- return child;
- }
- }
-
- return null;
- }
-
- /**
- * Returns the text of a child node: <elementName>text</elementName>.
- *
- * @param elementName The name of the child element to retrieve its value
- * @return The text of the child element or <code>null</code> if the element is not defined
- */
- protected final String getChildTextNode(String elementName) {
-
- Element element = getElement();
-
- if (element != null) {
- return getChildTextNode(element, elementName);
- }
-
- return null;
- }
-
- /**
- * Returns the text of a child node that is the child of the given element.
- * <p>Form: <elementName>text</elementName>.
- *
- * @param childName The child to retrieve it's child text node's value
- * @param elementName The name of the child element to retrieve its value
- * @return The text of the child element or <code>null</code> if the element is not defined
- */
- protected final String getChildTextNode(String childName, String elementName) {
-
- Element child = getChild(childName);
-
- if (child != null) {
- return getChildTextNode(child, elementName);
- }
-
- return null;
- }
-
- /**
- * Retrieves the XML document.
- *
- * @return The XML document
- */
- protected Document getDocument() {
- return getParent().getDocument();
- }
-
- /**
- * Retrieves the XML {@link Element} representing this model.
- *
- * @return The child element retrieved from its parent element that represents the XML structure
- * of this model
- */
- protected Element getElement() {
- return getChild(getParent(), getElementName());
- }
-
- /**
- * Returns the name used to store the information in the XML document.
- *
- * @return A non-<code>null</code> value used to retrieve the element from the XML document
- */
- protected abstract String getElementName();
-
- /**
- * Returns the order of the child elements.
- *
- * @return The list of element names that determines the order of insertion
- */
- protected final List<String> getElementNamesOrder() {
- return elementNamesOrder;
- }
-
- /**
- * Retrieves the attribute's value having the given name from this model's
- * element.
- *
- * @param element The element where the attribute's value is located
- * @param attributeName The name of the attribute
- * @return The attribute's value
- */
- protected final <T extends Enum<T>> T getEnumAttribute(Element element,
- String attributeName,
- Class<T> enumClass) {
-
- String value = getAttribute(element, attributeName);
-
- if (value != null) {
- try {
- return Enum.valueOf(enumClass, value);
- }
- catch (Exception e) {
- // Invalid property
- }
- }
-
- return null;
- }
-
- /**
- * Retrieves the attribute's value having the given name from this model's element.
- *
- * @param attributeName The name of the attribute
- * @return The attribute's value
- */
- protected final <T extends Enum<T>> T getEnumAttribute(String attributeName, Class<T> enumClass) {
-
- Element element = getElement();
-
- if (element == null) {
- return null;
- }
-
- return getEnumAttribute(element, attributeName, enumClass);
- }
-
- /**
- * Retrieves the attribute's value having the given name from this model's element.
- *
- * @param element The element where the attribute's value is located
- * @param attributeName The name of the attribute
- * @return The attribute's value
- */
- protected final Integer getIntegerAttribute(Element element, String attributeName) {
-
- String value = getAttribute(attributeName);
-
- if (value != null) {
- try {
- return Integer.valueOf(value);
- }
- catch (Exception e) {
- // Invalid property
- }
- }
-
- return null;
- }
-
- /**
- * Retrieves the attribute's value having the given name from this model's element.
- *
- * @param attributeName The name of the attribute
- * @return The attribute's value
- */
- protected final Integer getIntegerAttribute(String attributeName) {
-
- Element element = getElement();
-
- if (element == null) {
- return null;
- }
-
- return getIntegerAttribute(element, attributeName);
- }
-
- /**
- * Returns the namespace of the root element for this external form.
- *
- * @param uri The URI of the namespace
- */
- protected String getNamespace() {
- return getAttribute(XMLNS_ATTRIBUTE);
- }
-
- /**
- * Retrieves the name of the given node.
- * <p>
- * Example: <name>...</name> where "name" will be returned for the element.
- * <p>
- * Example: <node "key"="value"/> where "key" will be returned for the attribute.
- *
- * @param node The node to retrieve its name
- * @return The element name of the given node
- */
- protected final String getNodeName(Node node) {
- return node.getNodeName();
- }
-
- /**
- * Returns the parent of this object.
- *
- * @return The parent of this object, <code>null</code> is never returned
- */
- protected AbstractExternalForm getParent() {
- return parent;
- }
-
- /**
- * Retrieves the XML {@link Element} representing by the parent model.
- *
- * @return The {@link Element} of the parent form
- */
- protected final Element getParentElement() {
- return getParent().getElement();
- }
-
- /**
- * Retrieves the prefix representing the XML schema nodes. It is declared in the root element's
- * properties.
- *
- * @return The prefix defined in the root element properties or <code>null</code> if it is not defined
- */
- protected final String getPrefix() {
-
- // The root element needs to be retrieved before acquiring a read lock
- // in case the root element doesn't yet exist
- Element element = getRootElement();
-
- NamedNodeMap attributes = element.getAttributes();
-
- if (attributes != null) {
- for (int index = attributes.getLength(); --index >= 0;) {
- Node node = attributes.item(index);
- String localName = node.getNodeName();
- String value = node.getNodeValue();
-
- if (localName != null &&
- localName.startsWith("xmlns:") &&
- XSI_URI.equals(value)) {
-
- return localName.substring("xmlns:".length());
- }
- }
- }
-
- return null;
- }
-
- /**
- * Retrieves the root of the model object hierarchy.
- *
- * @return The top node of the model object hierarchy
- */
- protected final AbstractExternalForm getRoot() {
- return (parent == null) ? this : parent.getRoot();
- }
-
- /**
- * Retrieves the root element from the XML document. If the element could not be found, it will
- * be automatically added.
- *
- * @return The root of the XML model hierarchy
- */
- protected final Element getRootElement() {
-
- Document document = getDocument();
- String rootElementName = getRoot().getElementName();
- Element element = getChild(document, rootElementName);
-
- if (element == null) {
- // First make sure there are no root element with a different name
- for (Element child : getChildren(document)) {
- if (ObjectTools.notEquals(child.getNodeName(), rootElementName)) {
- // A root element was found, simply rename it to comply
- // with the document's XSD
- setElementName(child, rootElementName);
- return getRootElement();
- }
- }
-
- // No root element was found, simply create it
- element = addSelf();
- }
-
- return element;
- }
-
- /**
- * Returns the schema location defined in the root element of this form.
- *
- * @return URI of the XML schema.
- */
- protected String getSchemaLocation() {
- return getAttribute(XSD_URI_ATTRIBUTE);
- }
-
- /**
- * Retrieves the text content from the text node handled by this form.
- *
- * @return The text contained within the text node or <code>null</code> if the element does not exist
- */
- protected final String getTextNode() {
-
- Element element = getElement();
-
- if (element != null) {
- return getTextNode(element);
- }
-
- return null;
- }
-
- /**
- * Retrieves the text content from the given text node.
- *
- * @param element The node from which the text is retrieved
- * @return The text contained within the given text node
- */
- protected final String getTextNode(Node element) {
- return element.getTextContent();
- }
-
- /**
- * Returns the version attribute value specified on this form.
- *
- * @return The version attribute value specified on this form
- */
- public final String getVersion() {
- return getAttribute(VERSION);
- }
-
- /**
- * Determines whether the element represented by this external form has any children, which
- * includes comments and elements.
- *
- * @return <code>true</code> if the element is not a leaf and has children; <code>false</code> if
- * the element is a leaf
- */
- protected final boolean hasAnyChildren() {
-
- Element element = getElement();
-
- if (element != null) {
- return hasAnyChildren(element);
- }
-
- return false;
- }
-
- /**
- * Determines whether the given node has any children, which includes comments and elements.
- *
- * @param node The node checked for having children
- * @return <code>true</code> if the element is not a leaf and has children; <code>false</code> if
- * the element is a leaf
- */
- protected final boolean hasAnyChildren(Node node) {
- return getAllChildrenSize(node) > 0;
- }
-
- /**
- * Determines whether the given element has an attribute with the given name.
- *
- * @param element The element used to check if an attribute with the given name exists
- * @param elementName The name of the attribute
- * @return <code>true</code> if the attribute is present; <code>false</code> otherwise
- */
- protected final boolean hasAttribute(Element element, String elementName) {
- return getAttribute(element, elementName) != null;
- }
-
- /**
- * Determines whether the element represented by this external form has an attribute with the
- * given name.
- *
- * @param attributeName The name of the attribute
- * @return <code>true</code> if the attribute is present; <code>false</code> otherwise
- */
- protected final boolean hasAttribute(String attributeName) {
- return getAttribute(attributeName) != null;
- }
-
- /**
- * Determines whether the given element has an attribute NS with the given name.
- *
- * @param element The element used to check if an attribute NS with the given name exists
- * @param elementName The name of the attribute
- * @return <code>true</code> if the attribute NS is present; <code>false</code> otherwise
- */
- protected final boolean hasAttributeNS(Element element, String elementName) {
- return getAttributeNS(element, elementName) != null;
- }
-
- /**
- * Determines whether the element represented by this external form has an attribute NS with the
- * given name.
- *
- * @param elementName The name of the attribute
- * @return <code>true</code> if the attribute NS is present; <code>false</code> otherwise
- */
- protected final boolean hasAttributeNS(String elementName) {
- return getAttributeNS(elementName) != null;
- }
-
- /**
- * Determines whether the element represented by this external form has any attributes.
- *
- * @return <code>true</code> if there is at least one attribute; <code>false</code> otherwise
- */
- protected final boolean hasAttributes() {
-
- Element element = getElement();
-
- if (element != null) {
- return hasAttributes(element);
- }
-
- return false;
- }
-
- /**
- * Determines whether the given element has any attributes.
- *
- * @param element The element to check if it has attributes
- * @return <code>true</code> if there is at least one attribute; <code>false</code> otherwise
- */
- protected final boolean hasAttributes(Element element) {
-
- NamedNodeMap attributes = element.getAttributes();
-
- if (attributes == null) {
- return false;
- }
-
- return attributes.getLength() > 0;
- }
-
- /**
- * Determines whether the given element has a child with the given element name.
- *
- * @param element The element used to check if it has a child with the given name
- * @param elementName The name of the element
- * @return <code>true</code> if a child with the given name was found; <code>false</code> otherwise
- */
- protected final boolean hasChild(Element element, String elementName) {
- return getChild(element, elementName) != null;
- }
-
- /**
- * Determines whether the element represented by this external form has a child with the given
- * element name.
- *
- * @param elementName The name of the element
- * @return <code>true</code> if a child with the given name was found; <code>false</code> otherwise
- */
- protected final boolean hasChild(String elementName) {
-
- Element element = getElement();
-
- if (element != null) {
- return hasChild(element, elementName);
- }
-
- return false;
- }
-
- /**
- * Determines whether the {@link Element} represented by this external form has any children,
- * non-elements are not included into the check.
- *
- * @return <code>true</code> if the {@link Element} has at least one child; <code>false</code>
- * otherwise
- */
- protected final boolean hasChildren() {
-
- Element element = getElement();
-
- if (element != null) {
- return hasChildren(element);
- }
-
- return false;
- }
-
- /**
- * Determines whether the given {@link Element} has any children, non-elements are not included
- * into the check.
- *
- * @param element The {@link Element} used to check if it has child elements
- * @return <code>true</code> if the element has at least one child; <code>false</code> otherwise
- */
- protected final boolean hasChildren(Element element) {
- NodeList childrenList = element.getChildNodes();
- int count = 0;
-
- if (childrenList != null) {
- for (int index = childrenList.getLength(); --index >= 0;) {
- Node child = childrenList.item(index);
- if (isElement(child)) {
- count++;
- }
- }
-
- return (count > 0);
- }
-
- return false;
- }
-
- /**
- * Determines whether the {@link Element} represented by this external form is present in the XML
- * document.
- *
- * @return <code>true</code> if the element exists; <code>false</code> if it does not
- */
- protected final boolean hasElement() {
- return getElement() != null;
- }
-
- /**
- * Initializes this external form.
- */
- protected void initialize() {
- attributeNamesOrder = buildAttributeNamesOrder();
- elementNamesOrder = buildElementNamesOrder();
- }
-
- /**
- * Returns true if node is non-null and is of type ATTRIBUTE_NODE.
- */
- protected boolean isAttribute(Node node) {
- return isNodeType(node, Node.ATTRIBUTE_NODE);
- }
-
- /**
- * Returns true if node is non-null and is of type ELEMENT_NODE.
- */
- protected boolean isElement(Node node) {
- return isNodeType(node, Node.ELEMENT_NODE);
- }
-
- /**
- * Wrapper around {@link Node#getNodeType} test that returns false for a <code>null</code> node.
- */
- protected boolean isNodeType(Node node, int type) {
- return (node != null) && (node.getNodeType() == type);
- }
-
- /**
- * Returns true if node is non-null and is of type TEXT_NODE.
- */
- protected boolean isText(Node node) {
- return isNodeType(node, Node.TEXT_NODE);
- }
-
- /**
- * Retrieves the node that should follow the element with the given name by using the list of
- * ordered node names.
- *
- * @param element The element to which a new child element will be added
- * @param nodeName The name of the new node
- * @param namesOrder The list of names used to determine the insertion point
- * @return The node used to indicate the new node needs to be inserted before that node or
- * <code>null</code> if no node was found
- */
- private Node nodeOfInsertion(Element element,
- List<? extends Node> children,
- String nodeName,
- List<String> namesOrder) {
-
- if (namesOrder.isEmpty()) {
- return null;
- }
-
- int count = namesOrder.size();
-
- for (Node child : children) {
- String childName = getNodeName(child);
-
- for (int index = namesOrder.indexOf(nodeName) + 1; index < count; index++) {
- String name = namesOrder.get(index);
-
- if (ObjectTools.equals(childName, name)) {
- return child;
- }
- }
- }
-
- return null;
- }
-
- /**
- * Removes the given {@link Element} from its parent {@link Element}. The parent {@link Element}
- * is the {@link Element} encapsulated by this model.
- *
- * @param element The child element to remove from its parent
- */
- protected final void remove(Element element) {
-
- Element parent = getElement();
-
- if (parent != null) {
- remove(parent, element);
- }
- }
-
- /**
- * Removes the given {@link Element} from its parent {@link Element}.
- *
- * @param element The parent of the {@link Element} to remove
- * @param childElement The child to remove from its parent
- */
- protected final void remove(Element element, Element childElement) {
- element.removeChild(childElement);
- }
-
- /**
- * Removes the child {@link Element} from its parent {@link Element} at the given position. The
- * parent element is the element encapsulated by this model.
- *
- * @param parent The parent of this external form used to retrieve the parent element
- * @param elementName The name of the child element to remove
- * @param index The index of the child that has the given element name to remove
- */
- protected final void removeChild(AbstractExternalForm parent, String elementName, int index) {
- removeChild(parent.getElement(), elementName, index);
- }
-
- /**
- * Removes the child {@link Element} from its parent {@link Element} at the given position. The
- * parent {@link Element} is the element encapsulated by this model.
- *
- * @param element The {@link Element} from which the child at the given index will be removed
- * @param elementName The name of the child {@link Element} to remove
- * @param index The index of the child that has the given {@link Element} name to remove
- */
- protected final void removeChild(Element element, int index) {
-
- Element childElement = getChild(element, index);
-
- if (childElement != null) {
- remove(element, childElement);
- }
- }
-
- /**
- * Removes the child {@link Element} from its parent {@link Element} at the given position. The
- * parent {@link Element} is the element encapsulated by this model.
- *
- * @param element The {@link Element} from which the child with the given name will be removed
- * @param elementName The name of the child {@link Element} to remove
- */
- protected final void removeChild(Element element, String elementName) {
-
- Element childElement = getChild(element, elementName);
-
- if (childElement != null) {
- remove(element, childElement);
- }
- }
-
- /**
- * Removes the child element from its parent element at the given position. The parent element is
- * the element encapsulated by this model.
- *
- * @param element The element from which the child at the given position with the given name will
- * be removed
- * @param elementName The name of the child element to remove
- * @param index The index of the child that has the given element name to remove
- */
- protected final void removeChild(Element element, String elementName, int index) {
-
- Element childElement = getChild(element, elementName, index);
-
- if (childElement != null) {
- remove(element, childElement);
- }
- }
-
- /**
- * Removes the child element from its parent element. The parent element is the element
- * encapsulated by this model.
- *
- * @param elementName The name of the child element to remove
- */
- protected final void removeChild(String elementName) {
-
- Element element = getChild(elementName);
-
- if (element != null) {
- remove(getElement(), element);
- }
- }
-
- /**
- * Removes the child element from its parent element at the given position. The parent element is
- * the element encapsulated by this model.
- *
- * @param elementName The name of the child element to remove
- * @param index The index of the child that has the given element name to remove
- */
- protected final void removeChild(String elementName, int index) {
- removeChild(getElement(), elementName, index);
- }
-
- /**
- * Removes the child element from its parent element. The parent element is the element
- * encapsulated by this model.
- *
- * @param node The node from which the children with the given name will be removed
- * @param elementName The name of the child element to remove
- */
- protected final void removeChildren(Node node, String elementName) {
- for (Element childElement : getChildren(node, elementName)) {
- node.removeChild(childElement);
- }
- }
-
- /**
- * Removes the child element from its parent element. The parent element is the element
- * encapsulated by this model.
- *
- * @param elementName The name of the child element to remove
- */
- protected final void removeChildren(String elementName) {
-
- Element element = getElement();
-
- if (element != null) {
- removeChildren(element, elementName);
- }
- }
-
- /**
- * Removes this model's element from its parent element.
- */
- public void removeSelf() {
-
- Element element = getElement();
-
- if ((parent != null) && (element != null)) {
- parent.remove(element);
- }
- }
-
- /**
- * Sets an attribute on the given element with the given value.
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttribute(Element element, String attributeName, Boolean value) {
- setAttribute(element, attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the given element with the given value.
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttribute(Element element,
- String attributeName,
- Boolean value,
- List<String> attributeNamesOrder) {
-
- setAttribute(
- element,
- attributeName,
- (value != null) ? value.toString() : null,
- attributeNamesOrder
- );
- }
-
- /**
- * Sets an attribute on the given element with the given value.
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttribute(Element element, String attributeName, Enum<?> value) {
- setAttribute(element, attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the given element with the given value.
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttribute(Element element,
- String attributeName,
- Enum<?> value,
- List<String> attributeNamesOrder) {
-
- setAttribute(
- element,
- attributeName,
- (value != null) ? value.toString() : null,
- attributeNamesOrder
- );
- }
-
- /**
- * Sets an attribute on the given element with the given value.
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttribute(Element element, String attributeName, Number value) {
- setAttribute(element, attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the given element with the given value.
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttribute(Element element,
- String attributeName,
- Number value,
- List<String> attributeNamesOrder) {
-
- setAttribute(
- element,
- attributeName,
- (value != null) ? value.toString() : null,
- attributeNamesOrder
- );
- }
-
- /**
- * Sets an attribute on the given element with the given value.
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttribute(Element element, String attributeName, String value) {
- setAttribute(element, attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the given element with the given value.
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttribute(Element element,
- String attributeName,
- String value,
- List<String> attributeNamesOrder) {
- // Remove the attribute
- if (value == null) {
- element.removeAttribute(attributeName);
- }
- // Update the attribute's value
- else if (hasAttribute(attributeName)) {
- element.setAttribute(attributeName, value);
- }
- // Add a new attribute
- else {
-
- // Create the attribute node
- Attr newAttribute = getDocument().createAttribute(attributeName);
- newAttribute.setValue(value);
-
- // Insert the new attribute node at the right location
- List<Attr> attributes = getAttributes(element);
- Attr elementOfInsertion = (Attr) nodeOfInsertion(element, attributes, attributeName, attributeNamesOrder);
-
- // The attribute needs to be inserted before another attribute.
- // Remove the attributes so they can be re-added in proper order
- if (elementOfInsertion != null) {
- int indexOfInsertion = attributes.indexOf(elementOfInsertion);
-
- // Remove the attributes
- for (int index = attributes.size(); --index >= 0; ) {
- Node attributeNode = attributes.get(index);
- element.removeAttribute(attributeNode.getNodeName());
- }
-
- // Inserts the new attribute at the right location
- attributes.add(indexOfInsertion, newAttribute);
-
- // Re-add the attributes
- for (int index = 0; index < attributes.size(); index++) {
- Attr attribute = attributes.get(index);
- element.setAttributeNode(attribute);
- }
- }
- // This will insert the attribute at the end of the list of attributes
- else {
- element.setAttribute(attributeName, value);
- }
- }
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value.
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttribute(String attributeName, Boolean value) {
- setAttribute(attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value.
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttribute(String attributeName,
- Boolean value,
- List<String> attributeNamesOrder) {
-
- Element element = getElement();
-
- if ((element == null) && (value == null)) {
- return;
- }
-
- if (element == null) {
- element = addSelf();
- }
-
- setAttribute(element, attributeName, value, attributeNamesOrder);
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value.
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttribute(String attributeName, Enum<?> value) {
- setAttribute(attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value.
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttribute(String attributeName,
- Enum<?> value,
- List<String> attributeNamesOrder) {
-
- Element element = getElement();
-
- if ((element == null) && (value == null)) {
- return;
- }
-
- if (element == null) {
- element = addSelf();
- }
-
- setAttribute(element, attributeName, value, attributeNamesOrder);
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value.
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttribute(String attributeName, Number value) {
- setAttribute(attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value.
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttribute(String attributeName,
- Number value,
- List<String> attributeNamesOrder) {
-
- Element element = getElement();
-
- if ((element == null) && (value == null)) {
- return;
- }
-
- if (element == null) {
- element = addSelf();
- }
-
- setAttribute(element, attributeName, value, attributeNamesOrder);
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value.
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttribute(String attributeName, String value) {
- setAttribute(attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value.
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttribute(String attributeName,
- String value,
- List<String> attributeNamesOrder) {
-
- Element element = getElement();
-
- if ((element == null) && (value == null)) {
- return;
- }
-
- if (element == null) {
- element = addSelf();
- }
-
- setAttribute(element, attributeName, value, attributeNamesOrder);
- }
-
- /**
- * Sets an attribute on the given element with the given value. The name will be formatted with
- * the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttributeNS(Element element, String attributeName, Boolean value) {
- setAttributeNS(element, attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the given element with the given value. The name will be formatted with
- * the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttributeNS(Element element,
- String attributeName,
- Boolean value,
- List<String> attributeNamesOrder) {
-
- setAttributeNS(
- element,
- attributeName,
- (value != null) ? value.toString() : null,
- attributeNamesOrder
- );
- }
-
- /**
- * Sets an attribute on the given element with the given value. The name will be formatted with
- * the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttributeNS(Element element, String attributeName, Enum<?> value) {
- setAttributeNS(element, attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the given element with the given value. The name will be formatted with
- * the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttributeNS(Element element,
- String attributeName,
- Enum<?> value,
- List<String> attributeNamesOrder) {
-
- setAttributeNS(
- element,
- attributeName,
- (value != null) ? value.toString() : null,
- attributeNamesOrder
- );
- }
-
- /**
- * Sets an attribute on the given element with the given value. The name will
- * be formatted with the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>,
- * then the attribute will be removed
- */
- protected final void setAttributeNS(Element element, String attributeName, Number value) {
- setAttributeNS(element, attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the given element with the given value. The name will
- * be formatted with the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>,
- * then the attribute will be removed
- */
- protected final void setAttributeNS(Element element,
- String attributeName,
- Number value,
- List<String> attributeNamesOrder) {
-
- setAttributeNS(
- element,
- attributeName,
- (value != null) ? value.toString() : null,
- attributeNamesOrder
- );
- }
-
- /**
- * Sets an attribute on the given element with the given value. The name will
- * be formatted with the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>,
- * then the attribute will be removed
- */
- protected final void setAttributeNS(Element element, String attributeName, String value) {
- setAttributeNS(element, attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the given element with the given value. The name will be formatted with
- * the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param element The element to have one of its attributes updated
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttributeNS(Element element,
- String attributeName,
- String value,
- List<String> attributeNamesOrder) {
-
- StringBuilder sb = new StringBuilder();
- sb.append("Update attribute: ");
- sb.append(getPrefix());
- sb.append(":");
- sb.append(attributeName);
- sb.append(" = ");
- sb.append(value);
-
- // Remove the attribute
- if (value == null) {
- element.removeAttributeNS(XSI_URI, attributeName);
- }
- // Update the attribute's value
- else if (hasAttribute(attributeName)) {
- attributeName = buildQualifiedName(attributeName);
- element.setAttributeNS(XSI_URI, attributeName, value);
- }
- // Add a new attribute
- else {
-
- // Create the attribute node
- attributeName = buildQualifiedName(attributeName);
- Attr newAttribute = getDocument().createAttributeNS(XSI_URI, attributeName);
- newAttribute.setValue(value);
-
- // Insert the new attribute node at the right location
- List<Attr> attributes = getAttributes(element);
-
- Attr elementOfInsertion = (Attr) nodeOfInsertion(element, attributes, attributeName, attributeNamesOrder);
-
- // The attribute needs to be inserted before another attribute.
- // Remove the attributes so they can be re-added in proper order
- if (elementOfInsertion != null) {
- int indexOfInsertion = attributes.indexOf(elementOfInsertion);
-
- // Remove the attributes
- for (int index = attributes.size(); --index >= 0;) {
- Node attributeNode = attributes.get(index);
- element.removeAttribute(attributeNode.getNodeName());
- }
-
- // Inserts the new attribute at the right location
- attributes.add(indexOfInsertion, newAttribute);
-
- // Re-add the attributes
- for (int index = 0, count = attributes.size(); index < count; index++) {
- Attr attribute = attributes.get(index);
- element.setAttributeNode(attribute);
- }
- }
- // This will insert the attribute at the end of the list of attributes
- else {
- element.setAttributeNS(XSI_URI, attributeName, value);
- }
- }
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value. The
- * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttributeNS(String attributeName, Boolean value) {
- setAttributeNS(attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value. The
- * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttributeNS(String attributeName,
- Boolean value,
- List<String> attributeNamesOrder) {
-
- setAttributeNS(attributeName, value != null ? value.toString() : null, attributeNamesOrder);
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value. The
- * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttributeNS(String attributeName, Enum<?> value) {
- setAttributeNS(attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value. The
- * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttributeNS(String attributeName,
- Enum<?> value,
- List<String> attributeNamesOrder) {
-
- setAttributeNS(attributeName, value != null ? value.toString() : null, attributeNamesOrder);
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value. The
- * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttributeNS(String attributeName, Number value) {
- setAttributeNS(attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value. The
- * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttributeNS(String attributeName,
- Number value,
- List<String> attributeNamesOrder) {
-
- setAttributeNS(attributeName, value != null ? value.toString() : null, attributeNamesOrder);
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the
- * given value. The name will be formatted with the namespace URI:
- * "<namespaceURI>:attributeName".
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- */
- protected final void setAttributeNS(String attributeName, String value) {
- setAttributeNS(attributeName, value, getAttributeNamesOrder());
- }
-
- /**
- * Sets an attribute on the element represented by this external form with the given value. The
- * name will be formatted with the namespace URI: "<namespaceURI>:attributeName".
- *
- * @param attributeName The name of the attribute
- * @param value The value of the attribute. If the value is <code>null</code>, then the attribute
- * will be removed
- * @param attributeNamesOrder The list of attribute names used to determine the insertion
- */
- protected final void setAttributeNS(String attributeName,
- String value,
- List<String> attributeNamesOrder) {
-
- Element element = getElement();
-
- if ((element == null) && (value == null)) {
- return;
- }
-
- if (element == null) {
- element = addSelf();
- }
-
- setAttributeNS(element, attributeName, value, attributeNamesOrder);
- }
-
- /**
- * Renames the given element represented by this external form.
- *
- * @param element The element to rename
- * @param elementName The new name of the element
- */
- protected final void setElementName(Element element, String elementName) {
-
- // First remove the existing node and add the new node
- getDocument().removeChild(element);
- Element newElement = addSelf(elementName, getElementNamesOrder());
-
- // Now add the new node, which will have the new element name
-
- // Copy all the children to the new node
- for (Node childNode : getAllChildren(element)) {
- newElement.appendChild(childNode);
- }
- }
-
- /**
- * Sets the namespace with the given one.
- *
- * @param uri The URI of the namespace
- */
- protected final void setNamespace(String uri) {
- Element element = getRootElement();
- element.setAttributeNS("http://www.w3.org/2000/xmlns/", XMLNS_ATTRIBUTE, uri);
- }
-
- /**
- * Sets the schema location with the given one.
- *
- * @param uri The URI of the XML schema
- */
- protected final void setSchemaLocation(String uri) {
-
- Element element = getRootElement();
- element.setAttributeNS(XSI_URI, XSD_URI_ATTRIBUTE, uri);
- }
-
- /**
- * Updates the given {@link Element}'s text value.
- *
- * @param element The {@link Element} to update its text value
- * @param value The new value of the given {@link Element}
- */
- protected final void setTextNode(Element element, String value) {
- updateTextNode(element, getElementName(), value);
- }
-
- /**
- * Updates this external form's {@link Element} text value.
- *
- * @param value The new value of this form's {@link Element}
- */
- protected final void setTextNode(String value) {
- updateTextNode(
- getParent().getElement(),
- getElementName(),
- value,
- getParent().getElementNamesOrder()
- );
- }
-
- /**
- * Sets the version attribute of this element to the provided version.
- *
- * @param version version attribute value.
- */
- public final void setVersion(String version) {
- setAttribute(VERSION, version);
- }
-
- /**
- * Updates the attribute's value of a child {@link Element}.
- *
- * @param childName The name of the child to update one of its attributes
- * @param attributeName The name of the attribute to update its value
- * @param value The new value of the attribute
- */
- protected final void updateChildAttribute(String childName, String attributeName, Boolean value) {
- updateChildAttribute(childName, attributeName, (value != null) ? value.toString() : null);
- }
-
- /**
- * Updates the attribute's value of a child {@link Element}.
- *
- * @param childName The name of the child to update one of its attributes
- * @param attributeName The name of the attribute to update its value
- * @param value The new value of the attribute
- */
- protected final void updateChildAttribute(String childName, String attributeName, Enum<?> value) {
- updateChildAttribute(childName, attributeName, (value != null) ? value.name() : null);
- }
-
- /**
- * Updates the attribute's value of a child {@link Element}.
- *
- * @param childName The name of the child to update one of its attributes
- * @param attributeName The name of the attribute to update its value
- * @param value The new value of the attribute
- */
- protected final void updateChildAttribute(String childName, String attributeName, Number value) {
- updateChildAttribute(childName, attributeName, (value != null) ? value.toString() : null);
- }
-
- /**
- * Updates the attribute's value of a child {@link Element}.
- *
- * @param childName The name of the child to update one of its attributes
- * @param attributeName The name of the attribute to update its value
- * @param value The new value of the attribute
- */
- protected final void updateChildAttribute(String childName, String attributeName, String value) {
-
- Element element = getChild(childName);
-
- if ((element == null) && (value != null)) {
- element = addChild(childName);
- }
-
- if (value != null) {
- setAttribute(element, attributeName, value);
- }
- else if (element != null) {
- removeChild(childName);
- }
- }
-
- /**
- * Updates the child text node of a child element.
- *
- * @param parentChildName The name of the child to retrieve its child with the given child name
- * @param childName The child of a child to update its text value
- * @param value The new value of the text node
- */
- protected final void updateChildChildTextNode(String parentChildName,
- String childName,
- Boolean value) {
-
- updateChildChildTextNode(parentChildName, childName, (value != null) ? value.toString() : null);
- }
-
- /**
- * Updates the child text node of a child element.
- *
- * @param parentChildName The name of the child to retrieve its child with the given child name
- * @param childName The child of a child to update its text value
- * @param value The new value of the text node
- */
- protected final void updateChildChildTextNode(String parentChildName,
- String childName,
- Enum<?> value) {
-
- updateChildChildTextNode(parentChildName, childName, (value != null) ? value.name() : null);
- }
-
- /**
- * Updates the child text node of a child element.
- *
- * @param parentChildName The name of the child to retrieve its child with the given child name
- * @param childName The child of a child to update its text value
- * @param value The new value of the text node
- */
- protected final void updateChildChildTextNode(String parentChildName,
- String childName,
- Number value) {
-
- updateChildChildTextNode(parentChildName, childName, (value != null) ? value.toString() : null);
- }
-
- /**
- * Updates the child text node of a child element.
- *
- * @param parentChildName The name of the child to retrieve its child with the given child name
- * @param childName The child of a child to update its text value
- * @param value The new value of the text node
- */
- protected final void updateChildChildTextNode(String parentChildName, String childName, String value) {
-
- Element element = getChild(parentChildName);
-
- if ((element == null) && (value != null)) {
- element = addChild(parentChildName);
- }
-
- updateTextNode(element, childName, value);
- }
-
- /**
- * Updates the child element's text with the given value. If the value is <code>null</code>, then
- * the element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param elementName The child element's name
- * @param value The new element's text
- */
- protected final void updateChildTextNode(String elementName, Boolean value) {
- updateChildTextNode(elementName, value, getElementNamesOrder());
- }
-
- /**
- * Updates the child element's text with the given value. If the value is <code>null</code>, then
- * the element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param elementName The child element's name
- * @param value The new element's text
- * @param elementNamesOrder The list of element names used to determine the insertion point
- */
- protected final void updateChildTextNode(String elementName,
- Boolean value,
- List<String> elementNamesOrder) {
-
- updateChildTextNode(elementName, (value != null) ? value.toString() : null, elementNamesOrder);
- }
-
- /**
- * Updates the child element's text with the given value. If the value is <code>null</code>, then
- * the element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param elementName The child element's name
- * @param value The new element's text
- */
- protected final void updateChildTextNode(String elementName, Enum<?> value) {
- updateChildTextNode(elementName, value, getElementNamesOrder());
- }
-
- /**
- * Updates the child element's text with the given value. If the value is <code>null</code>, then
- * the element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param elementName The child element's name
- * @param value The new element's text
- * @param elementNamesOrder The list of element names used to determine the insertion point
- */
- protected final void updateChildTextNode(String elementName,
- Enum<?> value,
- List<String> elementNamesOrder) {
-
- updateChildTextNode(elementName, (value != null) ? value.toString() : null, elementNamesOrder);
- }
-
- /**
- * Updates the child element's text with the given value. If the value is <code>null</code>, then
- * the element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param elementName The child element's name
- * @param value The new element's text
- */
- protected final void updateChildTextNode(String elementName, Number value) {
- updateChildTextNode(elementName, value, getElementNamesOrder());
- }
-
- /**
- * Updates the child element's text with the given value. If the value is <code>null</code>, then
- * the element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param elementName The child element's name
- * @param value The new element's text
- * @param elementNamesOrder The list of element names used to determine the insertion point
- */
- protected final void updateChildTextNode(String elementName,
- Number value,
- List<String> elementNamesOrder) {
-
- updateChildTextNode(elementName, (value != null) ? value.toString() : null, elementNamesOrder);
- }
-
- /**
- * Updates the child element's text with the given value. If the value is <code>null</code>, then
- * the element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param elementName The child element's name
- * @param value The new element's text
- */
- protected final void updateChildTextNode(String elementName, String value) {
- updateChildTextNode(elementName, value, getElementNamesOrder());
- }
-
- /**
- * Updates the child element's text with the given value. If the value is <code>null</code>, then
- * the element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param elementName The child element's name
- * @param value The new element's text
- * @param elementNamesOrder The list of element names used to determine the insertion point
- */
- protected final void updateChildTextNode(String elementName,
- String value,
- List<String> elementNamesOrder) {
-
- Element element = getElement();
-
- // Nothing to change
- if ((element == null) && (value == null)) {
- return;
- }
-
- // Automatically create the element
- if (element == null) {
- element = addSelf();
- }
-
- // Create or update the child text node
- updateTextNode(element, elementName, value, elementNamesOrder);
- }
-
- /**
- * Updates the child text node with the given value. If the value is <code>null</code>, then the
- * element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param element The parent element used to retrieve the child element
- * @param elementName The child element's name
- * @param value The new element's text
- */
- protected final void updateTextNode(Element element, String elementName, Boolean value) {
- updateTextNode(element, elementName, value, getElementNamesOrder());
- }
-
- /**
- * Updates the child text node with the given value. If the value is <code>null</code>, then the
- * element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param element The parent element used to retrieve the child element
- * @param elementName The child element's name
- * @param value The new element's text
- * @param elementNamesOrder The list of element names used to determine the insertion point
- */
- protected final void updateTextNode(Element element,
- String elementName,
- Boolean value,
- List<String> elementNamesOrder) {
-
- updateTextNode(element, elementName, (value == null) ? null : value.toString(), elementNamesOrder);
- }
-
- /**
- * Updates the child text node with the given value. If the value is <code>null</code>, then the
- * element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param element The parent element used to retrieve the child element
- * @param elementName The child element's name
- * @param value The new element's text
- */
- protected final void updateTextNode(Element element, String elementName, Enum<?> value) {
- updateTextNode(element, elementName, value, getElementNamesOrder());
- }
-
- /**
- * Updates the child text node with the given value. If the value is <code>null</code>, then the
- * element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param element The parent element used to retrieve the child element
- * @param elementName The child element's name
- * @param value The new element's text
- * @param elementNamesOrder The list of element names used to determine the insertion point
- */
- protected final void updateTextNode(Element element,
- String elementName,
- Enum<?> value,
- List<String> elementNamesOrder) {
-
- updateTextNode(element, elementName, (value != null) ? value.toString() : null, elementNamesOrder);
- }
-
- /**
- * Updates the child text node with the given value. If the value is <code>null</code>, then the
- * element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be
- * added.
- *
- * @param element The parent element used to retrieve the child element
- * @param elementName The child element's name
- * @param value The new element's text
- */
- protected final void updateTextNode(Element element, String elementName, Number value) {
- updateTextNode(element, elementName, value, getElementNamesOrder());
- }
-
- /**
- * Updates the child text node with the given value. If the value is <code>null</code>, then the
- * element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be
- * added.
- *
- * @param element The parent element used to retrieve the child element
- * @param elementName The child element's name
- * @param value The new element's text
- * @param elementNamesOrder The list of element names used to determine the insertion point
- */
- protected final void updateTextNode(Element element,
- String elementName,
- Number value,
- List<String> elementNamesOrder) {
-
- updateTextNode(element, elementName, (value != null) ? value.toString() : null, elementNamesOrder);
- }
-
- /**
- * Updates the child text node with the given value. If the value is <code>null</code>, then the
- * element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then it will be added.
- *
- * @param element The parent element used to retrieve the child element
- * @param elementName The child element's name
- * @param value The new element's text
- */
- protected final void updateTextNode(Element element, String elementName, String value) {
- updateTextNode(element, elementName, value, getElementNamesOrder());
- }
-
- /**
- * Updates the child text node with the given value. If the value is <code>null</code>, then the
- * child element will be removed. If the value is not <code>null</code> but the element is
- * <code>null</code> then the child will be added.
- *
- * @param element The parent element used to retrieve the child element
- * @param elementName The child element's name
- * @param value The new element's text
- * @param elementNamesOrder The list of element names used to determine the insertion point
- */
- protected final void updateTextNode(Element element,
- String elementName,
- String value,
- List<String> elementNamesOrder) {
-
- // It seems we can't create a text node with a value only containing
- // white spaces, so we convert it into null. Maybe there is a way to
- // remove the validation?!?
- if (StringTools.isBlank(value)) {
- value = null;
- }
-
- Element childElement = getChild(element, elementName);
-
- // Remove the child element if the value is null
- if ((childElement != null) && (value == null)) {
- remove(element, childElement);
- return;
- }
-
- boolean valueNotEmpty = !StringTools.isBlank(value);
-
- // Add a text node if the element is null and the value isn't
- if ((childElement == null) && valueNotEmpty) {
- addChildTextNode(element, elementName, value, elementNamesOrder);
- }
- // Update the element's text content
- else if ((childElement != null) && valueNotEmpty) {
- Text text = findTextNode(childElement);
-
- if (text == null) {
- text = getDocument().createTextNode(value);
- childElement.appendChild(text);
- }
- else {
- text.setNodeValue(value);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Query.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractQuery.java
similarity index 64%
rename from tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Query.java
rename to tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractQuery.java
index f89885b..5228988 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Query.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,10 +15,10 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalNamedQuery;
import org.eclipse.persistence.tools.mapping.orm.ExternalQueryHint;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -28,12 +28,10 @@
* @see Entity
* @see ORMConfiguration
*
- * @version 2.5
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
-abstract class Query extends AbstractExternalForm
- implements ExternalNamedQuery {
+abstract class AbstractQuery extends AbstractExternalForm
+ implements ExternalNamedQuery {
/**
* The position of the element within the list of children with the same type owned by the parent.
@@ -41,40 +39,12 @@
private int index;
/**
- * The element name of the child text node for the description.
- */
- static final String DESCRIPTION = "description";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The element name used to store and retrieve the query child text node.
- */
- static final String QUERY = "query";
-
- /**
- * Creates a new <code>Query</code>.
+ * Creates a new <code>AbstractQuery</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- Query(Entity parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>Query</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- Query(ORMConfiguration parent, int index) {
+ AbstractQuery(AbstractExternalForm parent, int index) {
super(parent);
this.index = index;
}
@@ -83,20 +53,11 @@
* {@inheritDoc}
*/
@Override
- public final void addQueryHint(int index, String name, String value) {
- QueryHint queryHint = buildQueryHint(index);
- queryHint.addSelf();
+ public final ExternalQueryHint addQueryHint(String name, String value) {
+ QueryHint queryHint = buildQueryHint(-1);
queryHint.setName(name);
queryHint.setValue(value);
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
+ return queryHint;
}
/**
@@ -118,7 +79,15 @@
* {@inheritDoc}
*/
@Override
- public String getDescription() {
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final String getDescription() {
return getChildTextNode(DESCRIPTION);
}
@@ -130,11 +99,9 @@
return getChild(getParent(), getElementName(), index);
}
- /**
- * {@inheritDoc}
- */
@Override
- public final int getIndex() {
+ @Deprecated
+ public int getIndex() {
return index;
}
@@ -150,6 +117,14 @@
* {@inheritDoc}
*/
@Override
+ public final TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getQuery() {
return getChildTextNode(QUERY);
}
@@ -160,9 +135,7 @@
@Override
public final QueryHint getQueryHint(int index) {
- Element element = getChild(QueryHint.HINT, index);
-
- if (element != null) {
+ if (hasChild(QueryHint.HINT, index)) {
return buildQueryHint(index);
}
@@ -173,17 +146,24 @@
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalQueryHint> queryHints() {
+ public final TextRange getQueryTextRange() {
+ return getChildTextNodeTextRange(QUERY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final List<ExternalQueryHint> queryHints() {
int count = queryHintsSize();
List<ExternalQueryHint> queryHints = new ArrayList<ExternalQueryHint>(count);
- for (int index = count; --index >= 0;) {
- ExternalQueryHint queryHint = buildQueryHint(index);
- queryHints.add(0, queryHint);
+ for (int index = 0; index < count; index++) {
+ queryHints.add(buildQueryHint(index));
}
- return new ListListIterable<ExternalQueryHint>(queryHints);
+ return queryHints;
}
/**
@@ -215,7 +195,7 @@
* {@inheritDoc}
*/
@Override
- public void setDescription(String description) {
+ public final void setDescription(String description) {
updateChildTextNode(DESCRIPTION, description);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AccessMethods.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AccessMethods.java
index c776927..4b6c9fe 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AccessMethods.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AccessMethods.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,36 +15,21 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalAccessMethods;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of an access methods.
*
* @see NonTransientMapping
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class AccessMethods extends AbstractExternalForm
implements ExternalAccessMethods {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String ACCESS_METHODS = "access-methods";
-
- /**
- * The attribute name used to store and retrieve the get-method property.
- */
- static final String GET_METHOD = "get-method";
-
- /**
- * The attribute name used to store and retrieve the set-method property.
- */
- static final String SET_METHOD = "set-method";
-
- /**
* Creates a new <code>AccessMethods</code>.
*
* @param parent The parent of this external form
@@ -52,7 +37,7 @@
AccessMethods(AbstractExternalForm parent) {
super(parent);
}
-
+
/**
* {@inheritDoc}
*/
@@ -84,6 +69,14 @@
* {@inheritDoc}
*/
@Override
+ public final TextRange getGetMethodTextRange() {
+ return getAttributeTextRange(GET_METHOD);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getSetMethod() {
return getAttribute(SET_METHOD);
}
@@ -92,6 +85,14 @@
* {@inheritDoc}
*/
@Override
+ public final TextRange getSetMethodTextRange() {
+ return getAttributeTextRange(SET_METHOD);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setGetMethod(String getMethodName) {
setAttribute(GET_METHOD, getMethodName);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AssociationOverride.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AssociationOverride.java
index a77e750..bab1eda 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AssociationOverride.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AssociationOverride.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,11 +15,11 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalAssociationOverride;
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinTable;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -28,30 +28,12 @@
* @see ElementCollectionMapping
* @see Entity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class AssociationOverride extends AbstractExternalForm
implements ExternalAssociationOverride {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String ASSOCIATION_OVERRIDE = "association-override";
-
- /**
- * The element name of the child text node for the description.
- */
- static final String DESCRIPTION = "description";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
* The position of the element within the list of children with the same type owned by the parent.
*/
private int index;
@@ -63,43 +45,7 @@
* @param index The position of the element within the list of children with the same type owned
* by the parent
*/
- AssociationOverride(ElementCollectionMapping parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>AssociationOverride</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- AssociationOverride(EmbeddedMapping parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>AssociationOverride</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- AssociationOverride(Entity parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>AssociationOverride</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- AssociationOverride(ObjectCollectionMapping parent, int index) {
+ AssociationOverride(AbstractExternalForm parent, int index) {
super(parent);
this.index = index;
}
@@ -108,34 +54,26 @@
* {@inheritDoc}
*/
@Override
- public void addJoinColumn(int index, String name) {
- JoinColumn joinColumn = buildJoinColumn(index);
- joinColumn.addSelf();
+ public ExternalJoinColumn addJoinColumn(String name) {
+ JoinColumn joinColumn = buildJoinColumn(-1);
joinColumn.setName(name);
+ return joinColumn;
}
/**
* {@inheritDoc}
*/
@Override
- public final void addJoinTable(String tableName) {
+ public ExternalJoinTable addJoinTable(String tableName) {
JoinTable joinTable = buildJoinTable();
- joinTable.addSelf();
joinTable.setName(tableName);
+ return joinTable;
}
/**
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected List<String> buildElementNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(DESCRIPTION);
@@ -145,7 +83,7 @@
}
private JoinColumn buildJoinColumn(int index) {
- return new JoinColumn(this, index);
+ return new JoinColumn(this, JoinColumn.JOIN_COLUMN, index);
}
private JoinTable buildJoinTable() {
@@ -156,6 +94,14 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getDescription() {
return getChildTextNode(DESCRIPTION);
}
@@ -195,7 +141,7 @@
* {@inheritDoc}
*/
@Override
- public final ExternalJoinTable getJoinTable() {
+ public ExternalJoinTable getJoinTable() {
Element element = getChild(JoinTable.JOIN_TABLE);
@@ -218,17 +164,24 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalJoinColumn> joinColumns() {
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<ExternalJoinColumn> joinColumns() {
int count = joinColumnsSize();
List<ExternalJoinColumn> joinColumns = new ArrayList<ExternalJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalJoinColumn joinColumn = buildJoinColumn(index);
- joinColumns.add(0, joinColumn);
+ for (int index = 0; index < count; index++) {
+ joinColumns.add(buildJoinColumn(index));
}
- return new ListListIterable<ExternalJoinColumn>(joinColumns);
+ return joinColumns;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AttributeOverride.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AttributeOverride.java
index dd09399..993aec7 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AttributeOverride.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AttributeOverride.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,8 +15,10 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalAttributeOverride;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityColumn;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -27,9 +29,7 @@
* @see EmbeddedMapping
* @see Entity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
final class AttributeOverride extends AbstractExternalForm
implements ExternalAttributeOverride {
@@ -45,68 +45,15 @@
* @param parent The parent of this external form
* @param index The position of the external form of the mapping in the list of children
*/
- AttributeOverride(ElementCollectionMapping parent, int index) {
+ AttributeOverride(AbstractExternalForm parent, int index) {
super(parent);
this.index = index;
}
- /**
- * Creates a new <code>AttributeOverride</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- AttributeOverride(EmbeddedIDMapping parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>AttributeOverride</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the external form of the mapping in the list of children
- */
- AttributeOverride(EmbeddedMapping parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>AttributeOverride</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the external form of the mapping in the list of children
- */
- AttributeOverride(Entity parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>AttributeOverride</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the external form of the mapping in the list of children
- */
- AttributeOverride(ObjectCollectionMapping parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
private EntityColumn buildColumn(int index) {
- return new EntityColumn(this, index);
+ return new EntityColumn(this, EntityColumn.COLUMN, index);
}
-
+
/**
* {@inheritDoc}
*/
@@ -121,6 +68,14 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalEntityColumn getColumn() {
Element element = getChild(EntityColumn.COLUMN, index);
@@ -160,16 +115,16 @@
* {@inheritDoc}
*/
@Override
- public int getIndex() {
- return index;
+ public String getName() {
+ return getAttribute(NAME);
}
/**
* {@inheritDoc}
*/
@Override
- public String getName() {
- return getAttribute(NAME);
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
}
/**
@@ -201,7 +156,6 @@
column.removeSelf();
}
else {
- column.addSelf();
column.setName(name);
}
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicCollectionMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicCollectionMapping.java
index 6bac0ae..07375c6 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicCollectionMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicCollectionMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -21,47 +21,26 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalBatchFetch;
import org.eclipse.persistence.tools.mapping.orm.ExternalCollectionTable;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityColumn;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form for a basic collection mapping, which is a child of an entity.
*
* @see Entity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class BasicCollectionMapping extends ConvertibleMapping
implements ExternalBasicCollectionMapping {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String BASIC_COLLECTION = "basic-collection";
-
- /**
- * The attribute name used to store and retrieve the fetch property.
- */
- static final String FETCH = "fetch";
-
- /**
- * The element name used to store and retrieve the join-fetch child text node.
- */
- static final String JOIN_FETCH = "join-fetch";
-
- /**
- * The element name used to store and retrieve the value-column child node.
- */
- static final String VALUE_COLUMN = "value-column";
-
- /**
* Creates a new <code>BasicCollectionMapping</code>.
*
* @param parent The parent of this external form
* @param index The position of the element within the list of children with the same type owned
* by the parent
*/
- BasicCollectionMapping(EmbeddableEntity parent, int index) {
+ BasicCollectionMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -69,31 +48,32 @@
* {@inheritDoc}
*/
@Override
- public final void addBatchFetch() {
+ public ExternalBatchFetch addBatchFetch() {
BatchFetch batchFetch = buildBatchFetch();
batchFetch.addSelf();
+ return batchFetch;
}
/**
* {@inheritDoc}
*/
@Override
- public void addCollectionTable(String name) {
+ public ExternalCollectionTable addCollectionTable(String name) {
CollectionTable collectionTable = buildCollectionTable();
- collectionTable.addSelf();
collectionTable.setName(name);
+ return collectionTable;
}
/**
* {@inheritDoc}
*/
@Override
- public void addValueColumn(String columnName) {
+ public ExternalEntityColumn addValueColumn(String columnName) {
EntityColumn valueColumn = buildValueColumn();
- valueColumn.addSelf();
valueColumn.setName(columnName);
+ return valueColumn;
}
-
+
/**
* {@inheritDoc}
*/
@@ -105,7 +85,15 @@
names.add(ACCESS);
return names;
}
-
+
+ private BatchFetch buildBatchFetch() {
+ return new BatchFetch(this);
+ }
+
+ private CollectionTable buildCollectionTable() {
+ return new CollectionTable(this);
+ }
+
/**
* {@inheritDoc}
*/
@@ -126,24 +114,15 @@
return names;
}
- private BatchFetch buildBatchFetch() {
- return new BatchFetch(this);
- }
-
- private CollectionTable buildCollectionTable() {
- return new CollectionTable(this);
- }
-
-
private EntityColumn buildValueColumn() {
- return new EntityColumn(this, VALUE_COLUMN);
+ return new EntityColumn(this, VALUE_COLUMN, -1);
}
/**
* {@inheritDoc}
*/
@Override
- public final ExternalBatchFetch getBatchFetch() {
+ public ExternalBatchFetch getBatchFetch() {
if (hasChild(BatchFetch.BATCH_FETCH)) {
return buildBatchFetch();
@@ -185,6 +164,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getFetchTypeTextRange() {
+ return getAttributeTextRange(FETCH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public JoinFetchType getJoinFetchType() {
return getChildEnumNode(JOIN_FETCH, JoinFetchType.class);
}
@@ -193,6 +180,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getJoinFetchTypeTextRange() {
+ return getChildTextNodeTextRange(JOIN_FETCH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalEntityColumn getValueColumn() {
if (hasChild(VALUE_COLUMN)) {
@@ -206,7 +201,7 @@
* {@inheritDoc}
*/
@Override
- public final void removeBatchFetch() {
+ public void removeBatchFetch() {
removeChild(BatchFetch.BATCH_FETCH);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicColumn.java
index 9f3a7f4..989914f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,22 +13,17 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* The default implementation of a basic column.
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class BasicColumn extends AbstractColumn {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String COLUMN = "column";
-
- /**
* Creates a new <code>BasicColumn</code>.
*
* @param parent The parent of this external form
@@ -41,6 +36,22 @@
* {@inheritDoc}
*/
@Override
+ protected List<String> buildAttributeNamesOrder() {
+ List<String> names = new ArrayList<String>();
+ names.add(NAME);
+ names.add(UNIQUE);
+ names.add(NULLABLE);
+ names.add(INSERTABLE);
+ names.add(UPDATABLE);
+ names.add(COLUMN_DEFINITION);
+ names.add(TABLE);
+ return names;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected String getElementName() {
return COLUMN;
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicMapMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicMapMapping.java
index e892642..25d5bea 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicMapMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicMapMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -25,62 +25,26 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalObjectTypeConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalStructConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalTypeConverter;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form for a basic map mapping, which is a child of an entity.
*
* @see EmbeddableEntity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class BasicMapMapping extends ConvertibleMapping
implements ExternalBasicMapMapping {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String BASIC_MAP = "basic-map";
-
- /**
- * The attribute name used to store and retrieve the fetch property.
- */
- static final String FETCH = "fetch";
-
- /**
- * The element name used to store and retrieve the join-fetch child text node.
- */
- static final String JOIN_FETCH = "join-fetch";
-
- /**
- * The element name used to store and retrieve the key-column child node.
- */
- static final String KEY_COLUMN = "key-column";
-
- /**
- * The element name used to store and retrieve the key-converter child text node.
- */
- static final String KEY_CONVERTER = "key-converter";
-
- /**
- * The element name used to store and retrieve the value-column child node.
- */
- static final String VALUE_COLUMN = "value-column";
-
- /**
- * The element name used to store and retrieve the value-converter child text node.
- */
- static final String VALUE_CONVERTER = "value-converter";
-
- /**
* Creates a new <code>BasicMapMapping</code>.
*
* @param parent The parent of this external form
* @param index The position of the element within the list of children with the same type owned
* by the parent
*/
- BasicMapMapping(EmbeddableEntity parent, int index) {
+ BasicMapMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -88,29 +52,30 @@
* {@inheritDoc}
*/
@Override
- public final void addBatchFetch() {
+ public ExternalBatchFetch addBatchFetch() {
BatchFetch batchFetch = buildBatchFetch();
batchFetch.addSelf();
+ return batchFetch;
}
/**
* {@inheritDoc}
*/
@Override
- public void addCollectionTable(String name) {
+ public ExternalCollectionTable addCollectionTable(String name) {
CollectionTable collectionTable = buildCollectionTable();
- collectionTable.addSelf();
collectionTable.setName(name);
+ return collectionTable;
}
/**
* {@inheritDoc}
*/
@Override
- public void addKeyColumn(String columnName) {
+ public ExternalEntityColumn addKeyColumn(String columnName) {
EntityColumn column = buildColumn(KEY_COLUMN);
- column.addSelf();
column.setName(columnName);
+ return column;
}
/**
@@ -125,12 +90,12 @@
* {@inheritDoc}
*/
@Override
- public void addValueColumn(String columnName) {
+ public ExternalEntityColumn addValueColumn(String columnName) {
EntityColumn column = buildColumn(VALUE_COLUMN);
- column.addSelf();
column.setName(columnName);
+ return column;
}
-
+
/**
* {@inheritDoc}
*/
@@ -143,7 +108,6 @@
return names;
}
-
private BatchFetch buildBatchFetch() {
return new BatchFetch(this);
}
@@ -153,9 +117,9 @@
}
private EntityColumn buildColumn(String elementName) {
- return new EntityColumn(this, elementName);
+ return new EntityColumn(this, elementName, -1);
}
-
+
/**
* {@inheritDoc}
*/
@@ -179,26 +143,26 @@
}
private Converter buildKeyConverter() {
- return new Converter(this);
+ return new Converter(this, -1);
}
private ObjectTypeConverter buildKeyObjectTypeConverter() {
- return new ObjectTypeConverter(this);
+ return new ObjectTypeConverter(this, -1);
}
private StructConverter buildKeyStructConverter() {
- return new StructConverter(this);
+ return new StructConverter(this, -1);
}
private TypeConverter buildKeyTypeConverter() {
- return new TypeConverter(this);
+ return new TypeConverter(this, -1);
}
/**
* {@inheritDoc}
*/
@Override
- public final ExternalBatchFetch getBatchFetch() {
+ public ExternalBatchFetch getBatchFetch() {
if (hasChild(BatchFetch.BATCH_FETCH)) {
return buildBatchFetch();
@@ -248,6 +212,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getFetchTypeTextRange() {
+ return getAttributeTextRange(FETCH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public JoinFetchType getJoinFetchType() {
return getChildEnumNode(JOIN_FETCH, JoinFetchType.class);
}
@@ -256,6 +228,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getJoinFetchTypeTextRange() {
+ return getChildTextNodeTextRange(JOIN_FETCH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalEntityColumn getKeyColumn() {
if (hasChild(KEY_COLUMN)) {
@@ -271,7 +251,7 @@
@Override
public ExternalConverter getKeyConverter() {
- if (hasChild(Converter.CONVERTER)) {
+ if (hasChild(KEY_CONVERTER)) {
return buildKeyConverter();
}
@@ -282,8 +262,8 @@
* {@inheritDoc}
*/
@Override
- public String getKeyConveter() {
- return getChildTextNode(KEY_CONVERTER);
+ public TextRange getKeyConveterTextRange() {
+ return getChildTextNodeTextRange(KEY_CONVERTER);
}
/**
@@ -342,7 +322,7 @@
* {@inheritDoc}
*/
@Override
- public final void removeBatchFetch() {
+ public void removeBatchFetch() {
removeChild(BatchFetch.BATCH_FETCH);
}
@@ -368,7 +348,7 @@
* {@inheritDoc}
*/
@Override
- public final void removeKeyConverter() {
+ public void removeKeyConverter() {
removeChild(Converter.CONVERTER);
}
@@ -385,7 +365,7 @@
* {@inheritDoc}
*/
@Override
- public final void removeKeyObjectTypeConverter() {
+ public void removeKeyObjectTypeConverter() {
removeChild(ObjectTypeConverter.OBJECT_TYPE_CONVERTER);
}
@@ -393,7 +373,7 @@
* {@inheritDoc}
*/
@Override
- public final void removeKeyStructConverter() {
+ public void removeKeyStructConverter() {
removeChild(StructConverter.STRUCT_CONVERTER);
}
@@ -401,7 +381,7 @@
* {@inheritDoc}
*/
@Override
- public final void removeKeyTypeConverter() {
+ public void removeKeyTypeConverter() {
removeChild(TypeConverter.TYPE_CONVERTER);
}
@@ -425,7 +405,6 @@
removeChild(StructConverter.STRUCT_CONVERTER);
Converter valueConverter = buildKeyConverter();
- valueConverter.addSelf();
valueConverter.setName(name);
valueConverter.setConverterClassName(className);
}
@@ -441,7 +420,6 @@
removeChild(StructConverter.STRUCT_CONVERTER);
ObjectTypeConverter valueConverter = buildKeyObjectTypeConverter();
- valueConverter.addSelf();
valueConverter.setName(name);
}
@@ -456,7 +434,6 @@
removeChild(Converter.CONVERTER);
StructConverter valueConverter = buildKeyStructConverter();
- valueConverter.addSelf();
valueConverter.setName(name);
valueConverter.setConverterClassName(converter);
}
@@ -472,7 +449,6 @@
removeChild(StructConverter.STRUCT_CONVERTER);
TypeConverter valueConverter = buildKeyTypeConverter();
- valueConverter.addSelf();
valueConverter.setName(name);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicMapping.java
index 51ca0e2..f0c22ea 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BasicMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -24,6 +24,7 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSqlField;
import org.eclipse.persistence.tools.mapping.orm.ExternalSequenceGenerator;
import org.eclipse.persistence.tools.mapping.orm.ExternalTableGenerator;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -31,71 +32,18 @@
*
* @see EmbeddableEntity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class BasicMapping extends ConvertibleMapping
implements ExternalBasicMapping {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String BASIC = "basic";
-
- /**
- * The element name used to store and retrieve the expiry child text node.
- */
- static final String ENUMERATED = "enumerated";
-
- /**
- * The attribute name used to store and retrieve the fetch property.
- */
- static final String FETCH = "fetch";
-
- /**
- * The element name used to store and retrieve the lob child text node.
- */
- static final String LOB = "lob";
-
- /**
- * The attribute name used to store and retrieve the mutable property.
- */
- static final String MUTABLE = "mutable";
-
- /**
- * The attribute name used to store and retrieve the optional property.
- */
- static final String OPTIONAL = "optional";
-
- /**
- * Returns insert property.
- */
- static final String RETURN_INSERT = "return-insert";
-
- /**
- * Returns only on insert property.
- */
- static final String RETURN_ONLY = "return-only";
-
- /**
- * Returns update property.
- */
- static final String RETURN_UPDATE = "return-update";
-
- /**
- * The element name used to store and retrieve the temporal child text node.
- */
- static final String TEMPORAL = "temporal";
-
- /**
* Creates a new <code>BasicMapping</code>.
*
* @param parent The parent of this external form
* @param index The position of the external form of the mapping in the list of children
*/
- BasicMapping(EmbeddableEntity parent, int index) {
+ BasicMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -103,6 +51,16 @@
* {@inheritDoc}
*/
@Override
+ public ExternalEntityColumn addColumn() {
+ EntityColumn column = buildColumn();
+ column.addSelf();
+ return column;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalEntityIDGeneratedValue addGeneratedValue() {
EntityIDGeneratedValue generatedValue = buildGeneratedValue();
generatedValue.addSelf();
@@ -145,7 +103,7 @@
}
private EntityColumn buildColumn() {
- return new EntityColumn(this);
+ return new EntityColumn(this, EntityColumn.COLUMN, -1);
}
/**
@@ -183,11 +141,11 @@
}
private SequenceGenerator buildSequenceGenerator() {
- return new SequenceGenerator(this);
+ return new SequenceGenerator(this, -1);
}
private TableGenerator buildTableGenerator() {
- return new TableGenerator(this);
+ return new TableGenerator(this, -1);
}
/**
@@ -218,6 +176,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getEnumeratedTypeTextRange() {
+ return getChildTextNodeTextRange(ENUMERATED);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public FetchType getFetchType() {
return getEnumAttribute(FETCH, FetchType.class);
}
@@ -226,6 +192,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getFetchTypeTextRange() {
+ return getAttributeTextRange(FETCH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalEntityIDGeneratedValue getGeneratedValue() {
if (hasChild(EntityIDGeneratedValue.GENERATED_VALUE)) {
@@ -239,6 +213,22 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getLobTextRange() {
+ return getChildTextNodeTextRange(LOB);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getMutableTextRange() {
+ return getAttributeTextRange(MUTABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getNoSqlField() {
ExternalNoSqlField field = buildNoSqlField();
return field.getName();
@@ -248,14 +238,47 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getOptionalTextRange() {
+ return getAttributeTextRange(OPTIONAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getReturnOnInsertTextRange() {
+ return getChildTextRange(RETURN_INSERT);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getReturnOnlyOnInsertTextRange() {
+ return getChildAttributeTextRange(RETURN_INSERT, RETURN_ONLY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getReturnOnUpdateTextRange() {
+ return getChildTextRange(RETURN_UPDATE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalSequenceGenerator getSequenceGenerator() {
+
Element element = getChild(SequenceGenerator.SEQUENCE_GENERATOR);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildSequenceGenerator();
}
- return buildSequenceGenerator();
+ return null;
}
/**
@@ -263,13 +286,14 @@
*/
@Override
public ExternalTableGenerator getTableGenerator() {
+
Element element = getChild(TableGenerator.TABLE_GENERATOR);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildTableGenerator();
}
- return buildTableGenerator();
+ return null;
}
/**
@@ -284,10 +308,18 @@
* {@inheritDoc}
*/
@Override
- public final boolean isBasicMapping() {
+ public TextRange getTemporalTypeTextRange() {
+ return getChildTextNodeTextRange(TEMPORAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isBasicMapping() {
return true;
}
-
+
/**
* {@inheritDoc}
*/
@@ -321,12 +353,18 @@
generatedValue.removeSelf();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void removeSequenceGenerator() {
SequenceGenerator generator = buildSequenceGenerator();
generator.removeSelf();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void removeTableGenerator() {
TableGenerator generator = buildTableGenerator();
@@ -382,7 +420,6 @@
if (columnName != null) {
EntityColumn entityColumn = buildColumn();
- entityColumn.addSelf();
entityColumn.setName(columnName);
}
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BatchFetch.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BatchFetch.java
index f911cd8..f405b12 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BatchFetch.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/BatchFetch.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,7 +16,9 @@
import java.util.ArrayList;
import java.util.List;
import org.eclipse.persistence.annotations.BatchFetchType;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalBatchFetch;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of an batch fetch.
@@ -26,29 +28,12 @@
* @see BasicCollectionMapping
* @see BasicMapMapping
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class BatchFetch extends AbstractExternalForm
implements ExternalBatchFetch {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String BATCH_FETCH = "batch-fetch";
-
- /**
- * The attribute name used to store and retrieve the size property.
- */
- static final String SIZE = "size";
-
- /**
- * The attribute name used to store and retrieve the type property.
- */
- static final String TYPE = "type";
-
- /**
* Creates a new <code>BatchFetch<code>.
*
* @param parent The parent of this external form
@@ -56,7 +41,7 @@
BatchFetch(AbstractExternalForm parent) {
super(parent);
}
-
+
/**
* {@inheritDoc}
*/
@@ -88,10 +73,25 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getSizeTextRange() {
+ return getAttributeTextRange(SIZE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public BatchFetchType getType() {
return getEnumAttribute(TYPE, BatchFetchType.class);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getTypeTextRange() {
+ return getAttributeTextRange(TYPE);
+ }
/**
* {@inheritDoc}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Cache.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Cache.java
index 187b34b..b5339d8 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Cache.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Cache.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -19,77 +19,22 @@
import org.eclipse.persistence.annotations.CacheType;
import org.eclipse.persistence.annotations.DatabaseChangeNotificationType;
import org.eclipse.persistence.config.CacheIsolationType;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalCache;
import org.eclipse.persistence.tools.mapping.orm.ExternalTimeOfDay;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of a cache, which is a child of a mapped superclass entity.
*
* @see MappedSuperClassEntity
- *
- * @version 2.5
- * @author Les Davis
+ *
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class Cache extends AbstractExternalForm
implements ExternalCache {
/**
- * The attribute name used to store and retrieve the always-refresh property.
- */
- static final String ALWAYS_REFRESH = "always-refresh";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String CACHE = "cache";
-
- /**
- * The attribute name used to store and retrieve the coordination-type property.
- */
- static final String COORDINATION_TYPE = "coordination-type";
-
- /**
- * The attribute name used to store and retrieve the database-change-notification-type property.
- */
- static final String DATABASE_CHANGE_NOTIFICATION_TYPE = "database-change-notification-type";
-
- /**
- * The attribute name used to store and retrieve the disable-hits property.
- */
- static final String DISABLE_HITS = "disable-hits";
-
- /**
- * The element name used to store and retrieve the expiry child text node.
- */
- static final String EXPIRY = "expiry";
-
- /**
- * The attribute name used to store and retrieve the isolation property.
- */
- static final String ISOLATION = "isolation";
-
- /**
- * The attribute name used to store and retrieve the refresh-only-if-newer property.
- */
- static final String REFRESH_ONLY_IF_NEWER = "refresh-only-if-newer";
-
- /**
- * The attribute name used to store and retrieve the shared property.
- */
- static final String SHARED = "shared";
-
- /**
- * The attribute name used to store and retrieve the size property.
- */
- static final String SIZE = "size";
-
- /**
- * The attribute name used to store and retrieve the type property.
- */
- static final String TYPE = "type";
-
- /**
* Creates a new <code>Cache</code>.
*
* @param parent The parent of this external form
@@ -102,11 +47,12 @@
* {@inheritDoc}
*/
@Override
- public void addExpiryTimeOfDay() {
+ public ExternalTimeOfDay addExpiryTimeOfDay() {
TimeOfDay timeOfDay = buildTimeOfDay();
timeOfDay.addSelf();
+ return timeOfDay;
}
-
+
/**
* {@inheritDoc}
*/
@@ -142,6 +88,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getAlwaysRefreshTextRange() {
+ return getAttributeTextRange(ALWAYS_REFRESH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public CacheCoordinationType getCoordinationType() {
return getEnumAttribute(COORDINATION_TYPE, CacheCoordinationType.class);
}
@@ -150,10 +104,34 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getCoordinationTypeTextRange() {
+ return getAttributeTextRange(COORDINATION_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public DatabaseChangeNotificationType getDatabaseChangeNotificationType() {
return getEnumAttribute(DATABASE_CHANGE_NOTIFICATION_TYPE, DatabaseChangeNotificationType.class);
}
-
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getDatabaseChangeNotificationTypeTextRange() {
+ return getAttributeTextRange(DATABASE_CHANGE_NOTIFICATION_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getDisableHitsTextRange() {
+ return getAttributeTextRange(DISABLE_HITS);
+ }
+
/**
* {@inheritDoc}
*/
@@ -179,6 +157,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getExpiryTimeOfDayTextRange() {
+ return getChildTextRange(TimeOfDay.EXPIRY_TIME_OF_DAY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Integer getExpiryTimeToLive() {
return getChildIntegerNode(EXPIRY);
}
@@ -187,10 +173,42 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getExpiryTimeToLiveTextRange() {
+ return getChildTextNodeTextRange(EXPIRY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public CacheIsolationType getIsolationType() {
return getEnumAttribute(ISOLATION, CacheIsolationType.class);
}
-
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getIsolationTypeTextRange() {
+ return getAttributeTextRange(ISOLATION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getRefreshOnlyIfNewerTextRange() {
+ return getAttributeTextRange(REFRESH_ONLY_IF_NEWER);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getSharedTextRange() {
+ return getAttributeTextRange(SHARED);
+ }
+
/**
* {@inheritDoc}
*/
@@ -203,6 +221,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getSizeTextRange() {
+ return getAttributeTextRange(SIZE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public CacheType getType() {
return getEnumAttribute(TYPE, CacheType.class);
}
@@ -211,6 +237,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getTypeTextRange() {
+ return getAttributeTextRange(TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Boolean isAlwaysRefresh() {
return getBooleanAttribute(ALWAYS_REFRESH);
}
@@ -248,7 +282,7 @@
TimeOfDay timeOfDay = buildTimeOfDay();
timeOfDay.removeSelf();
- if (!hasAnyChildren() && !hasAttributes()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -261,7 +295,7 @@
setAttribute(ALWAYS_REFRESH, alwaysRefresh);
- if (!hasAnyChildren() && !hasAttributes()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -274,16 +308,20 @@
setAttribute(COORDINATION_TYPE, type);
- if (!hasAnyChildren() && !hasAttributes()) {
+ if (!hasAnything()) {
removeSelf();
}
}
-
+
+ /**
+ * {@inheritDoc}
+ */
@Override
public void setDatabaseChangeNotificationType(DatabaseChangeNotificationType type) {
+
setAttribute(DATABASE_CHANGE_NOTIFICATION_TYPE, type);
-
- if (!hasAnyChildren() && !hasAttributes()) {
+
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -296,7 +334,7 @@
setAttribute(DISABLE_HITS, disableHits);
- if (!hasAnyChildren() && !hasAttributes()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -309,16 +347,20 @@
updateChildTextNode(EXPIRY, timeToLive);
- if (!hasAnyChildren() && !hasAttributes()) {
+ if (!hasAnything()) {
removeSelf();
}
}
-
+
+ /**
+ * {@inheritDoc}
+ */
@Override
public void setIsolationType(CacheIsolationType isolationType) {
+
setAttribute(ISOLATION, isolationType);
- if (!hasAnyChildren() && !hasAttributes()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -331,7 +373,7 @@
setAttribute(REFRESH_ONLY_IF_NEWER, refreshOnlyIfNewer);
- if (!hasAnyChildren() && !hasAttributes()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -344,7 +386,7 @@
setAttribute(SHARED, shared);
- if (!hasAnyChildren() && !hasAttributes()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -357,7 +399,7 @@
setAttribute(SIZE, size);
- if (!hasAnyChildren() && !hasAttributes()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -370,7 +412,7 @@
setAttribute(TYPE, type);
- if (!hasAnyChildren() && !hasAttributes()) {
+ if (!hasAnything()) {
removeSelf();
}
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ClassConverter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ClassConverter.java
index d98ccda..80d5641 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ClassConverter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ClassConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,16 +15,16 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalClassConverter;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
* The abstract definition of an external class converter.
*
- * @version 2.5
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
abstract class ClassConverter extends AbstractExternalForm
implements ExternalClassConverter {
@@ -34,84 +34,17 @@
private int index;
/**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
* Creates a new <code>ClassConverter</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- ClassConverter(BasicMapMapping parent) {
- super(parent);
- this.index = -1;
- }
-
- /**
- * Creates a new <code>ClassConverter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- ClassConverter(ConvertibleMapping parent, int index) {
+ ClassConverter(AbstractExternalForm parent, int index) {
super(parent);
this.index = index;
}
/**
- * Creates a new <code>ClassConverter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- ClassConverter(ElementCollectionMapping parent) {
- super(parent);
- this.index = -1;
- }
-
- /**
- * Creates a new <code>ClassConverter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- ClassConverter(EmbeddableEntity parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>ClassConverter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- ClassConverter(ORMConfiguration parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected final Element addSelf(String elementName, List<String> elementNamesOrder) {
-
- if (index == -1) {
- return super.addSelf(elementName, elementNamesOrder);
- }
-
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
* {@inheritDoc}
*/
@Override
@@ -120,7 +53,15 @@
names.add(NAME);
return names;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
/**
* Returns the element name used to retrieve or store the converter class name.
*
@@ -140,6 +81,14 @@
* {@inheritDoc}
*/
@Override
+ public final TextRange getConverterClassNameTextRange() {
+ return getAttributeTextRange(getConverterClassElementName());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final Element getElement() {
if (index == -1) {
@@ -149,11 +98,9 @@
return getChild(getParent(), getElementName(), index);
}
- /**
- * {@inheritDoc}
- */
@Override
- public final int getIndex() {
+ @Deprecated
+ public int getIndex() {
return index;
}
@@ -169,6 +116,14 @@
* {@inheritDoc}
*/
@Override
+ public final TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final void removeSelf() {
if (index == -1) {
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CloneCopyPolicy.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CloneCopyPolicy.java
index 16ca82d..47313d1 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CloneCopyPolicy.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CloneCopyPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,44 +15,29 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalCloneCopyPolicy;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of a clone copy policy, which is a child of an entity.
*
* @see EmbeddableEntity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class CloneCopyPolicy extends AbstractExternalForm
implements ExternalCloneCopyPolicy {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String CLONE_COPY_POLICY = "clone-copy-policy";
-
- /**
- * The attribute name used to store and retrieve the method property.
- */
- static final String METHOD = "method";
-
- /**
- * The attribute name used to store and retrieve the working-copy-method property.
- */
- static final String WORKING_COPY_METHOD = "working-copy-method";
-
- /**
* Creates a new <code>CloneCopyPolicy</code>.
*
* @param parent The parent of this external form
*/
- CloneCopyPolicy(EmbeddableEntity parent) {
+ CloneCopyPolicy(Embeddable parent) {
super(parent);
}
-
+
/**
* {@inheritDoc}
*/
@@ -84,6 +69,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMethodTextRange() {
+ return getAttributeTextRange(METHOD);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getWorkingCopyMethod() {
return getAttribute(WORKING_COPY_METHOD);
}
@@ -92,6 +85,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getWorkingCopyMethodTextRange() {
+ return getAttributeTextRange(WORKING_COPY_METHOD);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setMethod(String methodName) {
setAttribute(METHOD, methodName);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CollectionTable.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CollectionTable.java
index 9a6bc81..8313515 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CollectionTable.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CollectionTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -17,9 +17,6 @@
import java.util.List;
import org.eclipse.persistence.tools.mapping.orm.ExternalCollectionTable;
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinColumn;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
-import org.w3c.dom.Element;
/**
* The external form for a collection table, which is a child of an element collection mapping.
@@ -28,43 +25,17 @@
* @see BasicMapMapping
* @see ElementCollectionMapping
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class CollectionTable extends Table
implements ExternalCollectionTable {
/**
- * The node name used to store and retrieve the <code>Element</code>
- * encapsulated by this external form.
- */
- static final String COLLECTION_TABLE = "collection-table";
-
- /**
* Creates a new <code>CollectionTable</code>.
*
* @param parent The parent of this external form
*/
- CollectionTable(BasicCollectionMapping parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>CollectionTable</code>.
- *
- * @param parent The parent of this external form
- */
- CollectionTable(BasicMapMapping parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>CollectionTable</code>.
- *
- * @param parent The parent of this external form
- */
- CollectionTable(ElementCollectionMapping parent) {
+ CollectionTable(ConvertibleMapping parent) {
super(parent);
}
@@ -72,12 +43,13 @@
* {@inheritDoc}
*/
@Override
- public void addJoinColumn(int index, String name) {
- JoinColumn joinColumn = buildJoinColumn(index);
+ public ExternalJoinColumn addJoinColumn(String name) {
+ JoinColumn joinColumn = buildJoinColumn(-1);
joinColumn.addSelf();
joinColumn.setName(name);
+ return joinColumn;
}
-
+
/**
* {@inheritDoc}
*/
@@ -102,7 +74,7 @@
}
private JoinColumn buildJoinColumn(int index) {
- return new JoinColumn(this, index);
+ return new JoinColumn(this, JoinColumn.JOIN_COLUMN, index);
}
/**
@@ -119,13 +91,11 @@
@Override
public ExternalJoinColumn getJoinColumn(int index) {
- Element element = getChild(JoinColumn.JOIN_COLUMN, index);
-
- if (element == null) {
- return null;
+ if (hasChild(JoinColumn.JOIN_COLUMN, index)) {
+ return buildJoinColumn(index);
}
- return buildJoinColumn(index);
+ return null;
}
/**
@@ -133,24 +103,23 @@
*/
@Override
public boolean isDefault() {
- return !(hasChildren() || hasAttributes());
+ return !hasAnything();
}
/**
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalJoinColumn> joinColumns() {
+ public List<ExternalJoinColumn> joinColumns() {
int count = joinColumnsSize();
List<ExternalJoinColumn> joinColumns = new ArrayList<ExternalJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalJoinColumn joinColumn = buildJoinColumn(index);
- joinColumns.add(0, joinColumn);
+ for (int index = 0; index < count; index++) {
+ joinColumns.add(buildJoinColumn(index));
}
- return new ListListIterable<ExternalJoinColumn>(joinColumns);
+ return joinColumns;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ColumnResult.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ColumnResult.java
index 32e9338..1b39702 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ColumnResult.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ColumnResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,7 +13,7 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
-import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalColumnResult;
import org.w3c.dom.Element;
@@ -22,11 +22,8 @@
*
* @see SQLResultSetMapping
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class ColumnResult extends AbstractExternalForm
implements ExternalColumnResult {
@@ -36,22 +33,10 @@
private int index;
/**
- * The node name used to store and retrieve the <code>Element</code>
- * encapsulated by this external form.
- */
- static final String COLUMN_RESULT = "column-result";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
* Creates a new <code>ColumnResult</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
ColumnResult(SQLResultSetMapping parent, int index) {
super(parent);
@@ -62,8 +47,8 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
}
/**
@@ -86,14 +71,6 @@
* {@inheritDoc}
*/
@Override
- public int getIndex() {
- return index;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public String getName() {
return getAttribute(NAME);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ConversionValue.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ConversionValue.java
index 717ab3d..54de7b9 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ConversionValue.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ConversionValue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalConversionValue;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -23,11 +25,10 @@
*
* @see ObjectTypeConverter
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
-final class ConversionValue extends AbstractExternalForm implements ExternalConversionValue {
+final class ConversionValue extends AbstractExternalForm
+ implements ExternalConversionValue {
/**
* The position of the element within the list of children with the same type owned by the parent.
@@ -35,26 +36,10 @@
private int index;
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String CONVERSION_VALUE = "conversion-value";
-
- /**
- * The attribute name used to store and retrieve the data-value property.
- */
- static final String DATA_VALUE = "data-value";
-
- /**
- * The attribute name used to store and retrieve the object-value property.
- */
- static final String OBJECT_VALUE = "object-value";
-
- /**
* Creates a new <code>ConversionValue</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
ConversionValue(ObjectTypeConverter parent, int index) {
super(parent);
@@ -65,19 +50,6 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
-
- if (index == -1) {
- return super.addSelf(elementName, elementNamesOrder);
- }
-
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(DATA_VALUE);
@@ -89,6 +61,14 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getDataValue() {
return getAttribute(DATA_VALUE);
}
@@ -97,6 +77,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDataValueTextRange() {
+ return getAttributeTextRange(DATA_VALUE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Element getElement() {
if (index == -1) {
@@ -114,10 +102,8 @@
return CONVERSION_VALUE;
}
- /**
- * {@inheritDoc}
- */
@Override
+ @Deprecated
public int getIndex() {
return index;
}
@@ -134,6 +120,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getObjectValueTextRange() {
+ return getAttributeTextRange(OBJECT_VALUE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeSelf() {
if (index == -1) {
@@ -156,14 +150,6 @@
* {@inheritDoc}
*/
@Override
- public void setIndex(int value) {
- this.index = value;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public void setObjectValue(String value) {
setAttribute(OBJECT_VALUE, value);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Converter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Converter.java
index 0bdc653..f80ee78 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Converter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Converter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,7 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalConverter;
/**
@@ -25,75 +26,18 @@
* @see EmbeddableEntity
* @see ORMConfiguration
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class Converter extends ClassConverter
implements ExternalConverter {
/**
- * The attribute name used to store and retrieve the class property.
- */
- static final String CLASS = "class";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String CONVERTER = "converter";
-
- /**
* Creates a new <code>Converter</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- Converter(BasicMapMapping parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>Converter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- Converter(ConvertibleMapping parent, int index) {
- super(parent, index);
- }
-
- /**
- * Creates a new <code>Converter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- Converter(ElementCollectionMapping parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>Converter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- Converter(EmbeddableEntity parent, int index) {
- super(parent, index);
- }
-
- /**
- * Creates a new <code>Converter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- Converter(ORMConfiguration parent, int index) {
+ Converter(AbstractExternalForm parent, int index) {
super(parent, index);
}
@@ -106,7 +50,7 @@
names.add(CLASS);
return names;
}
-
+
/**
* {@inheritDoc}
*/
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ConvertibleMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ConvertibleMapping.java
index 71a2728..7a164e8 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ConvertibleMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ConvertibleMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -20,35 +20,28 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalObjectTypeConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalStructConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalTypeConverter;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form for a convertible mapping, which is a child of an entity.
*
- * @see EmbeddableEntity
+ * @see Embeddable
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
abstract class ConvertibleMapping extends NonTransientMapping
implements ExternalConvertibleMapping {
/**
- * The element name used to store and retrieve the convert child text node.
- */
- static final String CONVERT = "convert";
-
- /**
* Creates a new <code>ConvertibleMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- ConvertibleMapping(EmbeddableEntity parent, int index) {
+ ConvertibleMapping(Embeddable parent, int index) {
super(parent, index);
}
-
+
/**
* {@inheritDoc}
*/
@@ -63,7 +56,7 @@
private Converter buildConverter() {
return new Converter(this, -1);
}
-
+
/**
* {@inheritDoc}
*/
@@ -89,7 +82,7 @@
}
private TypeConverter buildTypeConverter() {
- return new TypeConverter(this);
+ return new TypeConverter(this, -1);
}
/**
@@ -104,6 +97,14 @@
* {@inheritDoc}
*/
@Override
+ public final TextRange getConvertTextRange() {
+ return getChildTextNodeTextRange(CONVERT);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final ExternalObjectTypeConverter getObjectTypeConverter() {
if (hasChild(ObjectTypeConverter.OBJECT_TYPE_CONVERTER)) {
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CopyPolicy.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CopyPolicy.java
index c07e52f..d5e065f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CopyPolicy.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/CopyPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,39 +15,29 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalCopyPolicy;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of a copy policy, which is a child of an entity.
*
* @see EmbeddableEntity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class CopyPolicy extends AbstractExternalForm
implements ExternalCopyPolicy {
/**
- * The attribute name used to store and retrieve the class property.
- */
- static final String CLASS = "class";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String COPY_POLICY = "copy-policy";
-
- /**
* Creates a new <code>CopyPolicy</code>.
*
* @param parent The parent of this external form
*/
- CopyPolicy(EmbeddableEntity parent) {
+ CopyPolicy(Embeddable parent) {
super(parent);
}
-
+
/**
* {@inheritDoc}
*/
@@ -70,6 +60,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getClassNameTextRange() {
+ return getAttributeTextRange(CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected String getElementName() {
return COPY_POLICY;
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/DiscriminatorClass.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/DiscriminatorClass.java
index 65c5422..40e7c8f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/DiscriminatorClass.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/DiscriminatorClass.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalDiscriminatorClass;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -23,10 +25,8 @@
*
* @see VariableOneToOneMapping
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class DiscriminatorClass extends AbstractExternalForm
implements ExternalDiscriminatorClass {
@@ -36,26 +36,10 @@
private int index;
/**
- * The attribute name used to store and retrieve the discriminator property.
- */
- static final String DISCRIMINATOR = "discriminator";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String DISCRIMINATOR_CLASS = "discriminator-class";
-
- /**
- * The attribute name used to store and retrieve the value property.
- */
- static final String VALUE = "value";
-
- /**
* Creates a new <code>DiscriminatorClass</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
DiscriminatorClass(VariableOneToOneMapping parent, int index) {
super(parent);
@@ -66,14 +50,6 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(DISCRIMINATOR);
@@ -85,7 +61,15 @@
* {@inheritDoc}
*/
@Override
- public final String getDiscriminator() {
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDiscriminator() {
return getAttribute(DISCRIMINATOR);
}
@@ -93,7 +77,15 @@
* {@inheritDoc}
*/
@Override
- public final Element getElement() {
+ public TextRange getDiscriminatorTextRange() {
+ return getAttributeTextRange(DISCRIMINATOR);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Element getElement() {
return getChild(getParent(), DISCRIMINATOR_CLASS, index);
}
@@ -109,15 +101,7 @@
* {@inheritDoc}
*/
@Override
- public final int getIndex() {
- return index;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public final String getValue() {
+ public String getValue() {
return getAttribute(VALUE);
}
@@ -125,7 +109,15 @@
* {@inheritDoc}
*/
@Override
- public final void removeSelf() {
+ public TextRange getValueTextRange() {
+ return getAttributeTextRange(VALUE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeSelf() {
removeChild(getParent(), getElementName(), index);
}
@@ -133,7 +125,7 @@
* {@inheritDoc}
*/
@Override
- public final void setDiscriminator(String discriminator) {
+ public void setDiscriminator(String discriminator) {
setAttribute(DISCRIMINATOR, discriminator);
}
@@ -141,7 +133,7 @@
* {@inheritDoc}
*/
@Override
- public final void setValue(String value) {
+ public void setValue(String value) {
setAttribute(VALUE, value);
}
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/DiscriminatorColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/DiscriminatorColumn.java
index 21526a0..3df77fb 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/DiscriminatorColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/DiscriminatorColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,7 +16,9 @@
import java.util.ArrayList;
import java.util.List;
import javax.persistence.DiscriminatorType;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalDiscriminatorColumn;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of the discriminator column.
@@ -24,58 +26,21 @@
* @see Entity
* @see VariableOneToOneMapping
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class DiscriminatorColumn extends AbstractExternalForm
implements ExternalDiscriminatorColumn {
/**
- * The attribute name used to store and retrieve the column-definition property.
- */
- static final String COLUMN_DEFINITION = "column-definition";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String DISCRIMINATOR_COLUMN = "discriminator-column";
-
- /**
- * The attribute name used to store and retrieve the discriminator-type property.
- */
- static final String DISCRIMINATOR_TYPE = "discriminator-type";
-
- /**
- * The attribute name used to store and retrieve the length property.
- */
- static final String LENGTH = "length";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
* Creates a new <code>DiscriminatorColumn</code>.
*
* @param parent The parent of this external form
*/
- DiscriminatorColumn(Entity parent) {
+ DiscriminatorColumn(AbstractExternalForm parent) {
super(parent);
}
/**
- * Creates a new <code>DiscriminatorColumn</code>.
- *
- * @param parent The parent of this external form
- */
- DiscriminatorColumn(VariableOneToOneMapping parent) {
- super(parent);
- }
-
- /**
* {@inheritDoc}
*/
@Override
@@ -100,6 +65,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getColumnDefinitionTextRange() {
+ return getAttributeTextRange(COLUMN_DEFINITION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public DiscriminatorType getDiscriminatorType() {
return getEnumAttribute(DISCRIMINATOR_TYPE, DiscriminatorType.class);
}
@@ -108,6 +81,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDiscriminatorTypeTextRange() {
+ return getAttributeTextRange(DISCRIMINATOR_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected String getElementName() {
return DISCRIMINATOR_COLUMN;
}
@@ -124,6 +105,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getLengthTextRange() {
+ return getAttributeTextRange(LENGTH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getName() {
return getAttribute(NAME);
}
@@ -132,11 +121,19 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setColumnDefinition(String definition) {
setAttribute(COLUMN_DEFINITION, definition);
- if (!hasAttributes() && !hasAnyChildren()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -149,7 +146,7 @@
setAttribute(DISCRIMINATOR_TYPE, type);
- if (!hasAttributes() && !hasAnyChildren()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -162,7 +159,7 @@
setAttribute(LENGTH, length);
- if (!hasAttributes() && !hasAnyChildren()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -175,7 +172,7 @@
setAttribute(NAME, name);
- if (!hasAttributes() && !hasAnyChildren()) {
+ if (!hasAnything()) {
removeSelf();
}
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ElementCollectionMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ElementCollectionMapping.java
index e0464bf..0a2b64d 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ElementCollectionMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ElementCollectionMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -33,125 +33,25 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalStructConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalTypeConverter;
import org.eclipse.persistence.tools.utility.ClassNameTools;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
-import org.w3c.dom.Element;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form for a element collection mapping, which is a child of an entity.
*
* @see EmbeddableEntity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class ElementCollectionMapping extends ConvertibleMapping
implements ExternalElementCollectionMapping {
/**
- * The attribute name used to store and retrieve the class property.
- */
- static String CLASS = "class";
-
- /**
- * The element name used to store and retrieve the convert-key child text node.
- */
- static String CONVERT_KEY = "convert-key";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static String ELEMENT_COLLECTION = "element-collection";
-
- /**
- * The element name used to store and retrieve the expiry child text node.
- */
- static String ENUMERATED = "enumerated";
-
- /**
- * The attribute name used to store and retrieve the fetch property.
- */
- static String FETCH = "fetch";
-
- /**
- * The element name used to store and retrieve the join-fetch child text node.
- */
- static String JOIN_FETCH = "join-fetch";
-
- /**
- * The element name used to store and retrieve the lob child text node.
- */
- static String LOB = "lob";
-
- /**
- * The element name used to store and retrieve the map-key child node.
- */
- static String MAP_KEY = "map-key";
-
- /**
- * The element name used to store and retrieve the map-key-association child nodes.
- */
- static String MAP_KEY_ASSOCIATION_OVERRIDE = "map-key-association-override";
-
- /**
- * The element name used to store and retrieve the map-key-attribute child nodes.
- */
- static String MAP_KEY_ATTRIBUTE_OVERRIDE = "map-key-attribute-override";
-
- /**
- * The element name used to store and retrieve the map-key-class child node.
- */
- static String MAP_KEY_CLASS = "map-key-class";
-
- /**
- * The element name used to store and retrieve the map-key-column child node.
- */
- static String MAP_KEY_COLUMN = "map-key-column";
-
- /**
- * The element name used to store and retrieve the map-key-convert child node.
- */
- static String MAP_KEY_CONVERT = "map-key-convert";
-
- /**
- * The element name used to store and retrieve the map-key-enumerated child node.
- */
- static String MAP_KEY_ENUMERATED = "map-key-enumerated";
-
- /**
- * The element name used to store and retrieve the map-key-join-column child node.
- */
- static String MAP_KEY_JOIN_COLUMN = "map-key-join-column";
-
- /**
- * The element name used to store and retrieve the map-key-temporal child node.
- */
- static String MAP_KEY_TEMPORAL = "map-key-temporal";
-
- /**
- * The element name used to store and retrieve the order-by child text node.
- */
- static String ORDER_BY = "order-by";
-
- /**
- * The attribute name used to store and retrieve the target-class property.
- */
- static String TARGET_CLASS = "target-class";
-
- /**
- * The element name used to store and retrieve the temporal child text node.
- */
- static String TEMPORAL = "temporal";
-
- /**
* Creates a new <code>ElementCollectionMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- ElementCollectionMapping(EmbeddableEntity parent, int index) {
+ ElementCollectionMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -159,29 +59,30 @@
* {@inheritDoc}
*/
@Override
- public void addAssociationOverride(int index, String name) {
- AssociationOverride associationOverride = buildAssociationOverride(index);
- associationOverride.addSelf();
+ public ExternalAssociationOverride addAssociationOverride(String name) {
+ AssociationOverride associationOverride = buildAssociationOverride(-1);
associationOverride.setName(name);
+ return associationOverride;
}
/**
* {@inheritDoc}
*/
@Override
- public void addAttributeOverride(int index, String name) {
- AttributeOverride attributeOverride = buildAttributeOverride(index);
- attributeOverride.addSelf();
+ public ExternalAttributeOverride addAttributeOverride(String name) {
+ AttributeOverride attributeOverride = buildAttributeOverride(-1);
attributeOverride.setName(name);
+ return attributeOverride;
}
/**
* {@inheritDoc}
*/
@Override
- public void addBatchFetch() {
+ public ExternalBatchFetch addBatchFetch() {
BatchFetch batchFetch = buildBatchFetch();
batchFetch.addSelf();
+ return batchFetch;
}
/**
@@ -198,8 +99,18 @@
* {@inheritDoc}
*/
@Override
- public ExternalAssociationOverride addMapKeyAssociationOverride(int index) {
- AssociationOverride associationOverride = buildMapKeyAssociationOverride(mapKeyAssociationOverridesSize());
+ public ExternalEntityColumn addColumn() {
+ EntityColumn column = buildColumn(EntityColumn.COLUMN);
+ column.addSelf();
+ return column;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ExternalAssociationOverride addMapKeyAssociationOverride() {
+ AssociationOverride associationOverride = buildMapKeyAssociationOverride(-1);
associationOverride.addSelf();
return associationOverride;
}
@@ -208,8 +119,8 @@
* {@inheritDoc}
*/
@Override
- public ExternalAttributeOverride addMapKeyAttributeOverride(int index) {
- AttributeOverride attributeOverride = buildMapKeyAttributeOverride(mapKeyAttributeOverridesSize());
+ public ExternalAttributeOverride addMapKeyAttributeOverride() {
+ AttributeOverride attributeOverride = buildMapKeyAttributeOverride(-1);
attributeOverride.addSelf();
return attributeOverride;
}
@@ -218,28 +129,30 @@
* {@inheritDoc}
*/
@Override
- public void addMapKeyColumn() {
+ public ExternalEntityColumn addMapKeyColumn() {
EntityColumn column = buildColumn(MAP_KEY_COLUMN);
column.addSelf();
+ return column;
}
/**
* {@inheritDoc}
*/
@Override
- public void addMapKeyJoinColumn(int index, String name) {
- JoinColumn joinColumn = buildJoinColumn(MAP_KEY_JOIN_COLUMN, index);
- joinColumn.addSelf();
+ public ExternalJoinColumn addMapKeyJoinColumn(String name) {
+ JoinColumn joinColumn = buildJoinColumn(MAP_KEY_JOIN_COLUMN, -1);
joinColumn.setName(name);
+ return joinColumn;
}
/**
* {@inheritDoc}
*/
@Override
- public void addOrderColumn() {
+ public ExternalOrderColumn addOrderColumn() {
OrderColumn orderColumn = buildOrderColumn();
orderColumn.addSelf();
+ return orderColumn;
}
private AssociationOverride buildAssociationOverride(int index) {
@@ -273,7 +186,7 @@
}
private EntityColumn buildColumn(String elementName) {
- return new EntityColumn(this, elementName);
+ return new EntityColumn(this, elementName, -1);
}
/**
@@ -314,19 +227,19 @@
}
private Converter buildKeyConverter() {
- return new Converter(this);
+ return new Converter(this, -1);
}
private ObjectTypeConverter buildKeyObjectTypeConverter() {
- return new ObjectTypeConverter(this);
+ return new ObjectTypeConverter(this, -1);
}
private StructConverter buildKeyStructConverter() {
- return new StructConverter(this);
+ return new StructConverter(this, -1);
}
private TypeConverter buildKeyTypeConverter() {
- return new TypeConverter(this);
+ return new TypeConverter(this, -1);
}
private AssociationOverride buildMapKeyAssociationOverride(int index) {
@@ -396,6 +309,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getConvertKeyTextRange() {
+ return getChildTextNodeTextRange(CONVERT_KEY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected String getElementName() {
return ELEMENT_COLLECTION;
}
@@ -412,6 +333,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getEnumeratedTypeTextRange() {
+ return getChildTextNodeTextRange(ENUMERATED);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public FetchType getFetchType() {
return getEnumAttribute(FETCH, FetchType.class);
}
@@ -420,6 +349,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getFetchTypeTextRange() {
+ return getAttributeTextRange(FETCH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public JoinFetchType getJoinFetchType() {
return getChildEnumNode(JOIN_FETCH, JoinFetchType.class);
}
@@ -428,6 +365,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getJoinFetchTypeTextRange() {
+ return getChildTextNodeTextRange(JOIN_FETCH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalConverter getKeyConverter() {
if (hasChild(Converter.CONVERTER)) {
@@ -480,15 +425,16 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getLobTextRange() {
+ return getChildTextNodeTextRange(LOB);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getMapKey() {
-
- Element element = getChild(MAP_KEY);
-
- if (element == null) {
- return null;
- }
-
- return getAttribute(element, NAME);
+ return getChildAttribute(MAP_KEY, NAME);
}
/**
@@ -497,13 +443,11 @@
@Override
public ExternalAssociationOverride getMapKeyAssociationOverride(int index) {
- Element element = getChild(AssociationOverride.ASSOCIATION_OVERRIDE, index);
-
- if (element == null) {
- return null;
+ if (hasChild(AssociationOverride.ASSOCIATION_OVERRIDE, index)) {
+ return buildAssociationOverride(index);
}
- return buildAssociationOverride(index);
+ return null;
}
/**
@@ -512,13 +456,11 @@
@Override
public ExternalAttributeOverride getMapKeyAttributeOverride(int index) {
- Element element = getChild(AttributeOverride.ATTRIBUTE_OVERRIDE, index);
-
- if (element == null) {
- return null;
+ if (hasChild(AttributeOverride.ATTRIBUTE_OVERRIDE, index)) {
+ return buildAttributeOverride(index);
}
- return buildAttributeOverride(index);
+ return null;
}
/**
@@ -526,14 +468,15 @@
*/
@Override
public String getMapKeyClassName() {
+ return getChildAttribute(MAP_KEY_CLASS, CLASS);
+ }
- Element element = getChild(MAP_KEY_CLASS);
-
- if (element == null) {
- return null;
- }
-
- return getAttribute(element, CLASS);
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getMapKeyClassNameTextRange() {
+ return getChildAttributeTextRange(MAP_KEY_CLASS, CLASS);
}
/**
@@ -561,6 +504,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMapKeyConverterNameTextRange() {
+ return getChildTextNodeTextRange(MAP_KEY_CONVERT);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public EnumType getMapKeyEnumeratedType() {
return getChildEnumNode(MAP_KEY_ENUMERATED, EnumType.class);
}
@@ -569,15 +520,21 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMapKeyEnumeratedTypeTextRange() {
+ return getChildTextNodeTextRange(MAP_KEY_ENUMERATED);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalJoinColumn getMapKeyJoinColumn(int index) {
- Element element = getChild(MAP_KEY_JOIN_COLUMN, index);
-
- if (element == null) {
- return null;
+ if (hasChild(MAP_KEY_JOIN_COLUMN, index)) {
+ return buildJoinColumn(MAP_KEY_JOIN_COLUMN, index);
}
- return buildJoinColumn(MAP_KEY_JOIN_COLUMN, index);
+ return null;
}
/**
@@ -592,6 +549,30 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMapKeyTemporalTypeTextRange() {
+ return getChildTextNodeTextRange(MAP_KEY_TEMPORAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getMapKeyTextRange() {
+ return getChildAttributeTextRange(MAP_KEY, NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getMappingTextRange() {
+ return getElementNameTextRange(getElement());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getNoSqlField() {
ExternalNoSqlField field = buildNoSqlField();
return field.getName();
@@ -609,6 +590,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getOrderByFieldNameTextRange() {
+ return getAttributeTextRange(ORDER_BY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalOrderColumn getOrderColumn() {
if (hasChild(OrderColumn.ORDER_COLUMN)) {
@@ -630,6 +619,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getTargetClassNameTextRange() {
+ return getAttributeTextRange(TARGET_CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getTargetClassShortName() {
return ClassNameTools.simpleName(getTargetClassName());
}
@@ -646,6 +643,22 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getTemporalTypeTextRange() {
+ return getChildTextNodeTextRange(TEMPORAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean hasOrderByClause() {
+ return hasChild(ORDER_BY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public boolean isElementCollectionMapping() {
return true;
}
@@ -662,17 +675,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalAssociationOverride> mapKeyAssociationOverrides() {
+ public List<ExternalAssociationOverride> mapKeyAssociationOverrides() {
int count = mapKeyAssociationOverridesSize();
List<ExternalAssociationOverride> associationOverrides = new ArrayList<ExternalAssociationOverride>(count);
- for (int index = count; --index >= 0;) {
- ExternalAssociationOverride associationOverride = buildAssociationOverride(index);
- associationOverrides.add(0, associationOverride);
+ for (int index = 0; index < count; index++) {
+ associationOverrides.add(buildAssociationOverride(index));
}
- return new ListListIterable<ExternalAssociationOverride>(associationOverrides);
+ return associationOverrides;
}
/**
@@ -687,17 +699,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalAttributeOverride> mapKeyAttributeOverrides() {
+ public List<ExternalAttributeOverride> mapKeyAttributeOverrides() {
int count = mapKeyAttributeOverridesSize();
List<ExternalAttributeOverride> attributeOverrides = new ArrayList<ExternalAttributeOverride>(count);
- for (int index = count; --index >= 0;) {
- ExternalAttributeOverride attributeOverride = buildAttributeOverride(index);
- attributeOverrides.add(0, attributeOverride);
+ for (int index = 0; index < count; index++) {
+ attributeOverrides.add(buildAttributeOverride(index));
}
- return new ListListIterable<ExternalAttributeOverride>(attributeOverrides);
+ return attributeOverrides;
}
/**
@@ -712,17 +723,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalJoinColumn> mapKeyJoinColumns() {
+ public List<ExternalJoinColumn> mapKeyJoinColumns() {
int count = mapKeyJoinColumnsSize();
List<ExternalJoinColumn> joinColumns = new ArrayList<ExternalJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalJoinColumn joinColumn = buildJoinColumn(MAP_KEY_JOIN_COLUMN, index);
- joinColumns.add(0, joinColumn);
+ for (int index = 0; index < count; index++) {
+ joinColumns.add(buildJoinColumn(MAP_KEY_JOIN_COLUMN, index));
}
- return new ListListIterable<ExternalJoinColumn>(joinColumns);
+ return joinColumns;
}
/**
@@ -961,19 +971,7 @@
*/
@Override
public void setMapKey(String mapKey) {
-
- if (mapKey == null) {
- removeChild(MAP_KEY);
- }
- else {
- Element element = getChild(MAP_KEY);
-
- if (element == null) {
- element = addChild(MAP_KEY);
- }
-
- setAttribute(element, NAME, mapKey);
- }
+ updateChildAttribute(MAP_KEY, NAME, mapKey);
}
/**
@@ -981,19 +979,7 @@
*/
@Override
public void setMapKeyClassName(String className) {
-
- if (className == null) {
- removeChild(MAP_KEY_CLASS);
- }
- else {
- Element element = getChild(MAP_KEY_CLASS);
-
- if (element == null) {
- element = addChild(MAP_KEY_CLASS);
- }
-
- setAttribute(element, CLASS, className);
- }
+ updateChildAttribute(MAP_KEY_CLASS, CLASS, className);
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddableEntity.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Embeddable.java
similarity index 74%
rename from tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddableEntity.java
rename to tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Embeddable.java
index 7a98373..e1d63dd 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddableEntity.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Embeddable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,9 +14,12 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
-
import org.eclipse.persistence.annotations.ChangeTrackingType;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
+import org.eclipse.persistence.tools.mapping.ExternalProperty;
+import org.eclipse.persistence.tools.mapping.orm.AccessType;
import org.eclipse.persistence.tools.mapping.orm.ExternalAccessMethods;
import org.eclipse.persistence.tools.mapping.orm.ExternalBasicCollectionMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalBasicMapMapping;
@@ -25,7 +28,7 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalCopyPolicy;
import org.eclipse.persistence.tools.mapping.orm.ExternalElementCollectionMapping;
-import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddableEntity;
+import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddable;
import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddedMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalIDMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalInstantiationCopyPolicy;
@@ -36,16 +39,13 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalObjectTypeConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalOneToManyMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalOneToOneMapping;
-import org.eclipse.persistence.tools.mapping.orm.ExternalProperty;
import org.eclipse.persistence.tools.mapping.orm.ExternalStructConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalTransientMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalTypeConverter;
import org.eclipse.persistence.tools.utility.NameTools;
import org.eclipse.persistence.tools.utility.ObjectTools;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.eclipse.persistence.tools.utility.collection.ListTools;
-import org.eclipse.persistence.tools.utility.iterable.EmptyListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
import org.w3c.dom.Element;
/**
@@ -53,13 +53,10 @@
*
* @see ORMConfiguration
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
-class EmbeddableEntity extends AbstractExternalForm
- implements ExternalEmbeddableEntity {
+class Embeddable extends AbstractExternalForm
+ implements ExternalEmbeddable {
/**
* The position of the element within the list of children with the same type owned by the parent.
@@ -67,66 +64,17 @@
private int index;
/**
- * The order of the mapping element names in the <code>attributes</code>
- * element.
+ * The order of the mapping element names in the attributes element.
*/
private List<String> mappingElementNamesOrder;
-
- /**
- * The attribute name used to store and retrieve the access property.
- */
- static final String ACCESS = "access";
/**
- * The element name used to store and retrieve the change-tracking child node.
- */
- static final String CHANGE_TRACKING = "change-tracking";
-
- /**
- * The attribute name used to store and retrieve the class property or the element name used to
- * store and retrieve the class child text node of the customizer child node.
- */
- static final String CLASS = "class";
-
- /**
- * The element name used to store and retrieve the customizer child node.
- */
- static final String CUSTOMIZER = "customizer";
-
- /**
- * The element name used to store and retrieve the description child text node.
- */
- static final String DESCRIPTION = "description";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String EMBEDDABLE = "embeddable";
-
- /**
- * The attribute name used to store and retrieve the exclude-default-mappings property.
- */
- static final String EXCLUDE_DEFAULT_MAPPINGS = "exclude-default-mappings";
-
- /**
- * The attribute name used to store and retrieve the metadata-complete property.
- */
- static final String METADATA_COMPLETE = "metadata-complete";
-
- /**
- * The attribute name used to store and retrieve the type child text node of the change-tracking
- * child node.
- */
- static final String TYPE = "type";
-
- /**
- * Creates a new <code>EmbeddableEntity</code>.
+ * Creates a new <code>Embeddable</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- EmbeddableEntity(ORMConfiguration parent, int index) {
+ Embeddable(ORMConfiguration parent, int index) {
super(parent);
this.index = index;
this.mappingElementNamesOrder = buildMappingElementNamesOrder();
@@ -136,11 +84,11 @@
* {@inheritDoc}
*/
@Override
- public final void addAccessMethods(String getMethodName, String setMethodName) {
+ public final ExternalAccessMethods addAccessMethods(String getMethodName, String setMethodName) {
AccessMethods accessMethods = buildAccessMethods();
- accessMethods.addSelf();
accessMethods.setGetMethod(getMethodName);
accessMethods.setSetMethod(setMethodName);
+ return accessMethods;
}
/**
@@ -149,7 +97,6 @@
@Override
public final ExternalBasicCollectionMapping addBasicCollectionMapping(String name) {
BasicCollectionMapping mapping = buildBasicCollectionMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -160,7 +107,6 @@
@Override
public final ExternalBasicMapMapping addBasicMapMapping(String name) {
BasicMapMapping mapping = buildBasicMapMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -171,7 +117,6 @@
@Override
public final ExternalBasicMapping addBasicMapping(String name) {
BasicMapping mapping = buildBasicMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -190,9 +135,8 @@
* {@inheritDoc}
*/
@Override
- public final ExternalConverter addConverter(int index, String name) {
+ public final ExternalConverter addConverter(String name) {
Converter converter = buildConverter(index);
- converter.addSelf();
converter.setName(name);
return converter;
}
@@ -213,7 +157,6 @@
@Override
public final ExternalElementCollectionMapping addElementCollectionMapping(String name) {
ElementCollectionMapping mapping = buildElementCollectionMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -224,14 +167,12 @@
@Override
public final ExternalEmbeddedMapping addEmbeddedMapping(String name) {
EmbeddedMapping mapping = buildEmbeddedMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
/**
- * Embeddables don't currently support ID, but the implementation
- * is here for convenience.
+ * Embeddables don't currently support ID, but the implementation is here for convenience.
*
* {@inheritDoc}
*/
@@ -240,7 +181,6 @@
throw new UnsupportedOperationException();
}
-
/**
* {@inheritDoc}
*/
@@ -257,7 +197,6 @@
@Override
public final ExternalManyToManyMapping addManyToManyMapping(String name) {
ManyToManyMapping mapping = buildManyToManyMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -268,7 +207,6 @@
@Override
public final ExternalManyToOneMapping addManyToOneMapping(String name) {
ManyToOneMapping mapping = buildManyToOneMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -278,7 +216,7 @@
*/
@Override
public final ExternalNoSql addNoSql() {
- NoSql noSql = new NoSql(this);
+ NoSql noSql = buildNoSql();
noSql.addSelf();
return noSql;
}
@@ -287,9 +225,8 @@
* {@inheritDoc}
*/
@Override
- public final ExternalObjectTypeConverter addObjectTypeConverter(int index, String name) {
+ public final ExternalObjectTypeConverter addObjectTypeConverter(String name) {
ObjectTypeConverter converter = buildObjectTypeConverter(index);
- converter.addSelf();
converter.setName(name);
return converter;
}
@@ -300,7 +237,6 @@
@Override
public final ExternalOneToManyMapping addOneToManyMapping(String name) {
OneToManyMapping mapping = buildOneToManyMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -311,7 +247,6 @@
@Override
public final ExternalOneToOneMapping addOneToOneMapping(String name) {
OneToOneMapping mapping = buildOneToOneMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -320,28 +255,19 @@
* {@inheritDoc}
*/
@Override
- public final void addProperty(int index, String name, String value) {
+ public final ExternalProperty addProperty(String name, String value) {
Property property = buildProperty(index);
- property.addSelf();
property.setName(name);
property.setValue(value);
+ return property;
}
/**
* {@inheritDoc}
*/
@Override
- protected final Element addSelf(String elementName) {
- return addChild(getParent(), elementName, index, getParent().getElementNamesOrder());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public final ExternalStructConverter addStructConverter(int index, String name) {
+ public final ExternalStructConverter addStructConverter(String name) {
StructConverter converter = buildStructConverter(index);
- converter.addSelf();
converter.setName(name);
return converter;
}
@@ -352,7 +278,6 @@
@Override
public final ExternalTransientMapping addTransientMapping(String name) {
TransientMapping mapping = buildTransientMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -361,9 +286,8 @@
* {@inheritDoc}
*/
@Override
- public final ExternalTypeConverter addTypeConverter(int index, String name) {
+ public final ExternalTypeConverter addTypeConverter(String name) {
TypeConverter converter = buildTypeConverter(index);
- converter.addSelf();
converter.setName(name);
return converter;
}
@@ -531,12 +455,12 @@
names.add(EmbeddedMapping.EMBEDDED);
names.add(TransformationMapping.TRANSFORMATION);
names.add(TransientMapping.TRANSIENT);
-
+
return names;
}
-
- protected List<String> getMappingElementNamesOrder() {
- return this.mappingElementNamesOrder;
+
+ private NoSql buildNoSql() {
+ return new NoSql(this);
}
private ObjectTypeConverter buildObjectTypeConverter(int index) {
@@ -571,17 +495,24 @@
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalConverter> converters() {
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final List<ExternalConverter> converters() {
int count = convertersSize();
List<ExternalConverter> converters = new ArrayList<ExternalConverter>(count);
- for (int index = count; --index >= 0;) {
- ExternalConverter converter = buildConverter(index);
- converters.add(0, converter);
+ for (int index = 0; index < count; index++) {
+ converters.add(buildConverter(index));
}
- return new ListListIterable<ExternalConverter>(converters);
+ return converters;
}
/**
@@ -598,21 +529,27 @@
@Override
public final ExternalAccessMethods getAccessMethods() {
- Element element = getChild(AccessMethods.ACCESS_METHODS);
-
- if (element == null) {
- return null;
+ if (hasChild(AccessMethods.ACCESS_METHODS)) {
+ return buildAccessMethods();
}
- return buildAccessMethods();
+ return null;
}
/**
* {@inheritDoc}
*/
@Override
- public final String getAccessType() {
- return getAttribute(ACCESS);
+ public final AccessType getAccessType() {
+ return getEnumAttribute(ACCESS, AccessType.class);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getAccessTypeTextRange() {
+ return getAttributeTextRange(ACCESS);
}
/**
@@ -620,14 +557,15 @@
*/
@Override
public final ChangeTrackingType getChangeTrackingType() {
+ return getChildEnumAttribute(CHANGE_TRACKING, TYPE, ChangeTrackingType.class);
+ }
- Element element = getChild(CHANGE_TRACKING);
-
- if (element == null) {
- return null;
- }
-
- return getEnumAttribute(element, TYPE, ChangeTrackingType.class);
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getChangeTrackingTypeTextRange() {
+ return getChildAttributeTextRange(CHANGE_TRACKING, TYPE);
}
/**
@@ -637,7 +575,19 @@
public final String getClassName() {
return getAttribute(CLASS);
}
-
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getClassNameTextRange() {
+ return getAttributeTextRange(CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getClassShortName() {
return NameTools.shortNameForClassNamed(getClassName());
}
@@ -648,13 +598,11 @@
@Override
public final ExternalCloneCopyPolicy getCloneCopyPolicy() {
- Element element = getChild(CloneCopyPolicy.CLONE_COPY_POLICY);
-
- if (element == null) {
- return null;
+ if (hasChild(CloneCopyPolicy.CLONE_COPY_POLICY)) {
+ return buildCloneCopyPolicy();
}
- return buildCloneCopyPolicy();
+ return null;
}
/**
@@ -663,13 +611,11 @@
@Override
public final ExternalConverter getConverter(int index) {
- Element element = getChild(Converter.CONVERTER, index);
-
- if (element == null) {
- return null;
+ if (hasChild(Converter.CONVERTER, index)) {
+ return buildConverter(index);
}
- return buildConverter(index);
+ return null;
}
/**
@@ -678,13 +624,11 @@
@Override
public final ExternalCopyPolicy getCopyPolicy() {
- Element element = getChild(CopyPolicy.COPY_POLICY);
-
- if (element == null) {
- return null;
+ if (hasChild(CopyPolicy.COPY_POLICY)) {
+ return buildCopyPolicy();
}
- return buildCopyPolicy();
+ return null;
}
/**
@@ -699,6 +643,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getCustomizerClassNameTextRange() {
+ return getChildAttributeTextRange(CUSTOMIZER, CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getDescription() {
return getChildTextNode(DESCRIPTION);
}
@@ -707,6 +659,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDescriptionTextRange() {
+ return getChildTextNodeTextRange(DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final Element getElement() {
return getChild(getParent(), getElementName(), index);
}
@@ -723,7 +683,13 @@
* {@inheritDoc}
*/
@Override
- public final int getIndex() {
+ public TextRange getExcludeDefaultMappingsTextRange() {
+ return getAttributeTextRange(EXCLUDE_DEFAULT_MAPPINGS);
+ }
+
+ @Override
+ @Deprecated
+ public int getIndex() {
return index;
}
@@ -733,17 +699,11 @@
@Override
public final ExternalInstantiationCopyPolicy getInstantiationCopyPolicy() {
- Element element = getChild(InstantiationCopyPolicy.INSTANTIATION_COPY_POLICY);
-
- if (element == null) {
- return null;
+ if (hasChild(InstantiationCopyPolicy.INSTANTIATION_COPY_POLICY)) {
+ return buildInstantiationCopyPolicy();
}
- return buildInstantiationCopyPolicy();
- }
-
- public final List<ExternalMapping> getMappings() {
- return ListTools.list(mappings());
+ return null;
}
/**
@@ -762,6 +722,22 @@
return null;
}
+ protected List<String> getMappingElementNamesOrder() {
+ return this.mappingElementNamesOrder;
+ }
+
+ public final List<ExternalMapping> getMappings() {
+ return ListTools.list(mappings());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getMetadataCompleteTextRange() {
+ return getAttributeTextRange(METADATA_COMPLETE);
+ }
+
/**
* {@inheritDoc}
*/
@@ -769,7 +745,7 @@
public final ExternalNoSql getNoSql() {
if (hasChild(NoSql.NO_SQL)) {
- return new NoSql(this);
+ return buildNoSql();
}
return null;
@@ -781,21 +757,19 @@
@Override
public final ExternalObjectTypeConverter getObjectTypeConverter(int index) {
- Element element = getChild(ObjectTypeConverter.OBJECT_TYPE_CONVERTER, index);
-
- if (element == null) {
- return null;
+ if (hasChild(ObjectTypeConverter.OBJECT_TYPE_CONVERTER, index)) {
+ return buildObjectTypeConverter(index);
}
- return buildObjectTypeConverter(index);
+ return null;
}
/**
* {@inheritDoc}
*/
@Override
- protected final ORMConfiguration getParent() {
- return (ORMConfiguration) super.getParent();
+ public List<ExternalProperty> getProperties(String name) {
+ return null;
}
/**
@@ -804,13 +778,121 @@
@Override
public final ExternalProperty getProperty(int index) {
- Element element = getChild(Property.PROPERTY, index);
-
- if (element == null) {
- return null;
+ if (hasChild(Property.PROPERTY, index)) {
+ return buildProperty(index);
}
- return buildProperty(index);
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ExternalProperty getProperty(String name) {
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name)) {
+ return property;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ExternalProperty getProperty(String name, int index) {
+
+ ExternalProperty property = getProperty(index);
+
+ if ((property != null) && ObjectTools.equals(name, property.getName())) {
+ return property;
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ExternalProperty getProperty(String name, String value) {
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name) &&
+ ObjectTools.equals(property.getValue(), value)) {
+
+ return property;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPropertyNameTextRange(String name) {
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name)) {
+ return property.getNameTextRange();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPropertyTextRange(String name) {
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name)) {
+ return property.getTextRange();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPropertyTextRange(String name, String value) {
+
+ for (ExternalProperty property : properties()) {
+
+ if (ObjectTools.equals(property.getName(), name) &&
+ ObjectTools.equals(property.getValue(), value)) {
+
+ return property.getTextRange();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPropertyValueTextRange(String name) {
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name)) {
+ return property.getValueTextRange();
+ }
+ }
+
+ return null;
}
/**
@@ -819,13 +901,11 @@
@Override
public final ExternalStructConverter getStructConverter(int index) {
- Element element = getChild(StructConverter.STRUCT_CONVERTER, index);
-
- if (element == null) {
- return null;
+ if (hasChild(StructConverter.STRUCT_CONVERTER, index)) {
+ return buildStructConverter(index);
}
- return buildStructConverter(index);
+ return null;
}
/**
@@ -834,27 +914,29 @@
@Override
public final ExternalTypeConverter getTypeConverter(int index) {
- Element element = getChild(TypeConverter.TYPE_CONVERTER, index);
-
- if (element == null) {
- return null;
+ if (hasChild(TypeConverter.TYPE_CONVERTER, index)) {
+ return buildTypeConverter(index);
}
- return buildTypeConverter(index);
+ return null;
}
/**
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalIDMapping> idMappings() {
+ public final List<ExternalIDMapping> idMappings() {
+
List<ExternalIDMapping> idMappings = new ArrayList<ExternalIDMapping>();
+
+ // TODO: Use a filter
for (ExternalMapping mapping : mappings()) {
if (mapping instanceof ExternalIDMapping) {
idMappings.add((ExternalIDMapping)mapping);
}
}
- return new ListListIterable<ExternalIDMapping>(idMappings);
+
+ return idMappings;
}
/**
@@ -877,7 +959,7 @@
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalMapping> mappings() {
+ public final List<ExternalMapping> mappings() {
Element element = getChild(Mapping.ATTRIBUTES);
@@ -885,10 +967,10 @@
return mappings(element);
}
- return EmptyListIterable.instance();
+ return Collections.emptyList();
}
- private ListIterable<ExternalMapping> mappings(Element element) {
+ private List<ExternalMapping> mappings(Element element) {
List<ExternalMapping> mappings = new ArrayList<ExternalMapping>();
int index = 0;
@@ -902,7 +984,7 @@
}
}
- return new ListListIterable<ExternalMapping>(mappings);
+ return mappings;
}
/**
@@ -924,17 +1006,16 @@
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalObjectTypeConverter> objectTypeConverters() {
+ public final List<ExternalObjectTypeConverter> objectTypeConverters() {
int count = objectTypeConvertersSize();
List<ExternalObjectTypeConverter> converters = new ArrayList<ExternalObjectTypeConverter>(count);
- for (int index = count; --index >= 0;) {
- ExternalObjectTypeConverter converter = buildObjectTypeConverter(index);
- converters.add(0, converter);
+ for (int index = 0; index < count; index++) {
+ converters.add(buildObjectTypeConverter(index));
}
- return new ListListIterable<ExternalObjectTypeConverter>(converters);
+ return converters;
}
/**
@@ -949,17 +1030,16 @@
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalProperty> properties() {
+ public final List<ExternalProperty> properties() {
int count = propertiesSize();
- List<ExternalProperty> converters = new ArrayList<ExternalProperty>(count);
+ List<ExternalProperty> properties = new ArrayList<ExternalProperty>(count);
- for (int index = count; --index >= 0;) {
- ExternalProperty converter = buildProperty(index);
- converters.add(0, converter);
+ for (int index = 0; index < count; index++) {
+ properties.add(buildProperty(index));
}
- return new ListListIterable<ExternalProperty>(converters);
+ return properties;
}
/**
@@ -974,6 +1054,23 @@
* {@inheritDoc}
*/
@Override
+ public int propertiesSize(String name) {
+
+ int count = 0;
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name)) {
+ count++;
+ }
+ }
+
+ return count;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final void removeAccessMethods() {
removeChild(AccessMethods.ACCESS_METHODS);
}
@@ -1032,7 +1129,7 @@
*/
@Override
public final void removeNoSql() {
- NoSql noSql = new NoSql(this);
+ NoSql noSql = buildNoSql();
noSql.removeSelf();
}
@@ -1058,6 +1155,22 @@
* {@inheritDoc}
*/
@Override
+ public void removeProperty(String name) {
+ Property property = (Property) getProperty(name);
+ property.removeSelf();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeProperty(String name, String value) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final void removeSelf() {
removeChild(getParent(), getElementName(), index);
}
@@ -1084,7 +1197,7 @@
* {@inheritDoc}
*/
@Override
- public final void setAccessType(String type) {
+ public void setAccessType(AccessType type) {
setAttribute(ACCESS, type);
}
@@ -1093,23 +1206,7 @@
*/
@Override
public final void setChangeTrackingType(ChangeTrackingType type) {
-
- Element element = getChild(CHANGE_TRACKING);
-
- if ((element == null) && (type == null)) {
- return;
- }
-
- if ((element == null) && (type != null)) {
- element = addChild(CHANGE_TRACKING);
- }
-
- if (type != null) {
- setAttribute(element, TYPE, type);
- }
- else if (element != null) {
- removeChild(CHANGE_TRACKING);
- }
+ updateChildAttribute(CHANGE_TRACKING, TYPE, type);
}
/**
@@ -1125,19 +1222,7 @@
*/
@Override
public final void setCustomizerClassName(String name) {
-
- Element element = getChild(CUSTOMIZER);
-
- if ((element == null) && (name != null)) {
- element = addChild(CUSTOMIZER);
- }
-
- if (name != null) {
- setAttribute(element, CLASS, name);
- }
- else if (element != null) {
- removeChild(CUSTOMIZER);
- }
+ updateChildAttribute(CUSTOMIZER, CLASS, name);
}
/**
@@ -1168,17 +1253,16 @@
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalStructConverter> structConverters() {
+ public final List<ExternalStructConverter> structConverters() {
int count = structConvertersSize();
List<ExternalStructConverter> converters = new ArrayList<ExternalStructConverter>(count);
- for (int index = count; --index >= 0;) {
- ExternalStructConverter converter = buildStructConverter(index);
- converters.add(0, converter);
+ for (int index = 0; index < count; index++) {
+ converters.add(buildStructConverter(index));
}
- return new ListListIterable<ExternalStructConverter>(converters);
+ return converters;
}
/**
@@ -1193,17 +1277,16 @@
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalTypeConverter> typeConverters() {
+ public final List<ExternalTypeConverter> typeConverters() {
int count = typeConvertersSize();
List<ExternalTypeConverter> converters = new ArrayList<ExternalTypeConverter>(count);
- for (int index = count; --index >= 0;) {
- ExternalTypeConverter converter = buildTypeConverter(index);
- converters.add(0, converter);
+ for (int index = 0; index < count; index++) {
+ converters.add(buildTypeConverter(index));
}
- return new ListListIterable<ExternalTypeConverter>(converters);
+ return converters;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedIDMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedIDMapping.java
index 0002fd1..21e17df 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedIDMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedIDMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -17,39 +17,22 @@
import java.util.List;
import org.eclipse.persistence.tools.mapping.orm.ExternalAttributeOverride;
import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddedIDMapping;
-import org.eclipse.persistence.tools.utility.iterable.EmptyListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
/**
* The external form for a embedded ID mapping, which is a child of an entity.
*
* @see MappedSuperClassEntity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class EmbeddedIDMapping extends NonTransientMapping
implements ExternalEmbeddedIDMapping {
/**
- * The attribute name used to store and retrieve the access property.
- */
- static final String ACCESS = "access";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String EMBEDDED_ID = "embedded-id";
-
- /**
* Creates a new <code>EmbeddedIDMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
EmbeddedIDMapping(MappedSuperClassEntity parent, int index) {
super(parent, index);
@@ -59,31 +42,26 @@
* {@inheritDoc}
*/
@Override
- public void addAttributeOverride(int index, String name) {
- AttributeOverride attributeOverride = buildAttributeOverride(index);
- attributeOverride.addSelf();
+ public ExternalAttributeOverride addAttributeOverride(String name) {
+ AttributeOverride attributeOverride = buildAttributeOverride(-1);
attributeOverride.setName(name);
+ return attributeOverride;
}
/**
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalAttributeOverride> attributeOverrides() {
-
- if (!hasElement()) {
- return EmptyListIterable.instance();
- }
+ public List<ExternalAttributeOverride> attributeOverrides() {
int count = attributeOverridesSize();
List<ExternalAttributeOverride> attributeOverrides = new ArrayList<ExternalAttributeOverride>(count);
- for (int index = count; --index >= 0;) {
- ExternalAttributeOverride attributeOverride = buildAttributeOverride(index);
- attributeOverrides.add(0, attributeOverride);
+ for (int index = 0; index < count; index++) {
+ attributeOverrides.add(buildAttributeOverride(index));
}
- return new ListListIterable<ExternalAttributeOverride>(attributeOverrides);
+ return attributeOverrides;
}
/**
@@ -94,10 +72,6 @@
return getChildrenSize(AttributeOverride.ATTRIBUTE_OVERRIDE);
}
- private AttributeOverride buildAttributeOverride(int index) {
- return new AttributeOverride(this, index);
- }
-
/**
* {@inheritDoc}
*/
@@ -110,6 +84,10 @@
return names;
}
+ private AttributeOverride buildAttributeOverride(int index) {
+ return new AttributeOverride(this, index);
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedMapping.java
index dbb5caa..f826ad4 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -19,8 +19,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalAttributeOverride;
import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddedMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSqlField;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
import org.w3c.dom.Element;
/**
@@ -28,32 +26,18 @@
*
* @see MappedSuperClassEntity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class EmbeddedMapping extends NonTransientMapping
implements ExternalEmbeddedMapping {
/**
- * The attribute name used to store and retrieve the access property.
- */
- static final String ACCESS = "access";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String EMBEDDED = "embedded";
-
- /**
* Creates a new <code>EmbeddedMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with
- * the same type owned by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- EmbeddedMapping(EmbeddableEntity parent, int index) {
+ EmbeddedMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -61,8 +45,8 @@
* {@inheritDoc}
*/
@Override
- public ExternalAssociationOverride addAssociationOverride(int index) {
- AssociationOverride associationOverride = buildAssociationOverride(index);
+ public ExternalAssociationOverride addAssociationOverride() {
+ AssociationOverride associationOverride = buildAssociationOverride(-1);
associationOverride.addSelf();
return associationOverride;
}
@@ -71,8 +55,8 @@
* {@inheritDoc}
*/
@Override
- public ExternalAttributeOverride addAttributeOverride(int index) {
- AttributeOverride attributeOverride = buildAttributeOverride(index);
+ public ExternalAttributeOverride addAttributeOverride() {
+ AttributeOverride attributeOverride = buildAttributeOverride(-1);
attributeOverride.addSelf();
return attributeOverride;
}
@@ -81,17 +65,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalAssociationOverride> associationOverrides() {
+ public List<ExternalAssociationOverride> associationOverrides() {
int count = associationOverridesSize();
List<ExternalAssociationOverride> associationOverrides = new ArrayList<ExternalAssociationOverride>(count);
- for (int index = count; --index >= 0;) {
- ExternalAssociationOverride associationOverride = buildAssociationOverride(index);
- associationOverrides.add(0, associationOverride);
+ for (int index = 0; index < count; index++) {
+ associationOverrides.add(buildAssociationOverride(index));
}
- return new ListListIterable<ExternalAssociationOverride>(associationOverrides);
+ return associationOverrides;
}
/**
@@ -106,17 +89,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalAttributeOverride> attributeOverrides() {
+ public List<ExternalAttributeOverride> attributeOverrides() {
int count = attributeOverridesSize();
List<ExternalAttributeOverride> attributeOverrides = new ArrayList<ExternalAttributeOverride>(count);
- for (int index = count; --index >= 0;) {
- ExternalAttributeOverride attributeOverride = buildAttributeOverride(index);
- attributeOverrides.add(0, attributeOverride);
+ for (int index = 0; index < count; index++) {
+ attributeOverrides.add(buildAttributeOverride(index));
}
- return new ListListIterable<ExternalAttributeOverride>(attributeOverrides);
+ return attributeOverrides;
}
/**
@@ -172,11 +154,11 @@
Element element = getChild(AssociationOverride.ASSOCIATION_OVERRIDE, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildAssociationOverride(index);
}
- return buildAssociationOverride(index);
+ return null;
}
/**
@@ -187,11 +169,11 @@
Element element = getChild(AttributeOverride.ATTRIBUTE_OVERRIDE, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildAttributeOverride(index);
}
- return buildAttributeOverride(index);
+ return null;
}
/**
@@ -210,7 +192,7 @@
ExternalNoSqlField field = buildNoSqlField();
return field.getName();
}
-
+
/**
* {@inheritDoc}
*/
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Entity.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Entity.java
index 50dd016..e293fc2 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Entity.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Entity.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -20,17 +20,17 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalAttributeOverride;
import org.eclipse.persistence.tools.mapping.orm.ExternalBasicNamedQuery;
import org.eclipse.persistence.tools.mapping.orm.ExternalDiscriminatorColumn;
+import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddable;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntity;
-import org.eclipse.persistence.tools.mapping.orm.ExternalEntitySecondaryTable;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityTable;
import org.eclipse.persistence.tools.mapping.orm.ExternalNamedQuery;
import org.eclipse.persistence.tools.mapping.orm.ExternalNativeQuery;
import org.eclipse.persistence.tools.mapping.orm.ExternalPrimaryKeyJoinColumn;
+import org.eclipse.persistence.tools.mapping.orm.ExternalSecondaryTable;
import org.eclipse.persistence.tools.mapping.orm.ExternalSQLResultSetMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalStoredProcedureQuery;
import org.eclipse.persistence.tools.utility.ObjectTools;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -38,50 +38,16 @@
*
* @see ORMConfiguration
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class Entity extends MappedSuperClassEntity
- implements ExternalEntity {
-
- /**
- * The element name used to store and retrieve the class-extractor child node.
- */
- static final String CLASS_EXTRACTOR = "class-extractor";
-
- /**
- * The element name used to store and retrieve the column child text node.
- */
- static final String DISCRIMINATOR_VALUE = "discriminator-value";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String ENTITY = "entity";
-
- /**
- * The element name used to store and retrieve the inheritance child node.
- */
- static final String INHERITANCE = "inheritance";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The attribute name used to store and retrieve the strategy property of the inheritance child node.
- */
- static final String STRATEGY = "strategy";
+ implements ExternalEntity {
/**
* Creates a new <code>Entity</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
Entity(ORMConfiguration parent, int index) {
super(parent, index);
@@ -91,20 +57,20 @@
* {@inheritDoc}
*/
@Override
- public void addAssociationOverride(int index, String name) {
- AssociationOverride associationOverride = buildAssociationOverride(index);
- associationOverride.addSelf();
+ public ExternalAssociationOverride addAssociationOverride(String name) {
+ AssociationOverride associationOverride = buildAssociationOverride(-1);
associationOverride.setName(name);
+ return associationOverride;
}
/**
* {@inheritDoc}
*/
@Override
- public void addAttributeOverride(int index, String name) {
- AttributeOverride attributeOverride = buildAttributeOverride(index);
- attributeOverride.addSelf();
+ public ExternalAttributeOverride addAttributeOverride(String name) {
+ AttributeOverride attributeOverride = buildAttributeOverride(-1);
attributeOverride.setName(name);
+ return attributeOverride;
}
/**
@@ -128,30 +94,30 @@
* {@inheritDoc}
*/
@Override
- public void addNamedQuery(int index, String name) {
- NamedQuery namedQuery = buildNamedQuery(index);
- namedQuery.addSelf();
+ public ExternalNamedQuery addNamedQuery(String name) {
+ NamedQuery namedQuery = buildNamedQuery(-1);
namedQuery.setName(name);
+ return namedQuery;
}
/**
* {@inheritDoc}
*/
@Override
- public void addNativeQuery(int index, String name) {
- NamedNativeQuery namedNativeQuery = buildNamedNativeQuery(index);
- namedNativeQuery.addSelf();
+ public ExternalNativeQuery addNativeQuery(String name) {
+ NamedNativeQuery namedNativeQuery = buildNamedNativeQuery(-1);
namedNativeQuery.setName(name);
+ return namedNativeQuery;
}
/**
* {@inheritDoc}
*/
@Override
- public void addPrimaryKeyJoinColumn(int index, String name) {
- PrimaryKeyJoinColumn pkJoinColumn = buildPrimaryKeyJoinColumn(index);
- pkJoinColumn.addSelf();
+ public ExternalPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(String name) {
+ PrimaryKeyJoinColumn pkJoinColumn = buildPrimaryKeyJoinColumn(-1);
pkJoinColumn.setName(name);
+ return pkJoinColumn;
}
/**
@@ -169,50 +135,49 @@
* {@inheritDoc}
*/
@Override
- public void addSecondaryTable(int index, String name, String catalog, String schema) {
- SecondaryTable secondaryTable = buildSecondaryTable(index);
- secondaryTable.addSelf();
+ public ExternalSecondaryTable addSecondaryTable(String name, String catalog, String schema) {
+ SecondaryTable secondaryTable = buildSecondaryTable(-1);
secondaryTable.setName(name);
secondaryTable.setCatalogName(catalog);
secondaryTable.setSchemaName(schema);
+ return secondaryTable;
}
/**
* {@inheritDoc}
*/
@Override
- public void addSqlResultSetMapping(int index, String name) {
- SQLResultSetMapping sqlResultSetMapping = buildSqlResultSetMapping(index);
- sqlResultSetMapping.addSelf();
+ public ExternalSQLResultSetMapping addSqlResultSetMapping(String name) {
+ SQLResultSetMapping sqlResultSetMapping = buildSqlResultSetMapping(-1);
sqlResultSetMapping.setName(name);
+ return sqlResultSetMapping;
}
/**
* {@inheritDoc}
*/
@Override
- public void addStoredProcedureQuery(int index, String name, String procedureName) {
- NamedStoredProcedureQuery storedProcedureQuery = buildStoredProcedureQuery(index);
- storedProcedureQuery.addSelf();
+ public ExternalStoredProcedureQuery addStoredProcedureQuery(String name, String procedureName) {
+ NamedStoredProcedureQuery storedProcedureQuery = buildStoredProcedureQuery(-1);
storedProcedureQuery.setName(name);
storedProcedureQuery.setProcedureName(procedureName);
+ return storedProcedureQuery;
}
/**
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalAssociationOverride> associationOverrides() {
+ public List<ExternalAssociationOverride> associationOverrides() {
int count = associationOverridesSize();
List<ExternalAssociationOverride> associationOverrides = new ArrayList<ExternalAssociationOverride>(count);
- for (int index = count; --index >= 0;) {
- ExternalAssociationOverride associationOverride = buildAssociationOverride(index);
- associationOverrides.add(0, associationOverride);
+ for (int index = 0; index < count; index++) {
+ associationOverrides.add(buildAssociationOverride(index));
}
- return new ListListIterable<ExternalAssociationOverride>(associationOverrides);
+ return associationOverrides;
}
/**
@@ -227,17 +192,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalAttributeOverride> attributeOverrides() {
+ public List<ExternalAttributeOverride> attributeOverrides() {
int count = attributeOverridesSize();
List<ExternalAttributeOverride> attributeOverrides = new ArrayList<ExternalAttributeOverride>(count);
- for (int index = count; --index >= 0;) {
- ExternalAttributeOverride attributeOverride = buildAttributeOverride(index);
- attributeOverrides.add(0, attributeOverride);
+ for (int index = 0; index < count; index++) {
+ attributeOverrides.add(buildAttributeOverride(index));
}
- return new ListListIterable<ExternalAttributeOverride>(attributeOverrides);
+ return attributeOverrides;
}
/**
@@ -248,6 +212,10 @@
return getChildrenSize(AssociationOverride.ASSOCIATION_OVERRIDE);
}
+ private AssociationOverride buildAssociationOverride(int index) {
+ return new AssociationOverride(this, index);
+ }
+
/**
* {@inheritDoc}
*/
@@ -255,7 +223,7 @@
protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(NAME);
- names.add(CLASS);
+ names.add(ExternalEmbeddable.CLASS);
names.add(PARENT_CLASS);
names.add(ACCESS);
names.add(CACHEABLE);
@@ -266,10 +234,6 @@
return names;
}
- private AssociationOverride buildAssociationOverride(int index) {
- return new AssociationOverride(this, index);
- }
-
private AttributeOverride buildAttributeOverride(int index) {
return new AttributeOverride(this, index);
}
@@ -284,7 +248,7 @@
@Override
protected List<String> buildElementNamesOrder() {
List<String> names = new ArrayList<String>();
- names.add(DESCRIPTION);
+ names.add(ExternalEmbeddable.DESCRIPTION);
names.add(CUSTOMIZER);
names.add(CHANGE_TRACKING);
names.add(PrimaryTable.TABLE);
@@ -365,11 +329,11 @@
Element element = getChild(AssociationOverride.ASSOCIATION_OVERRIDE, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildAssociationOverride(index);
}
- return buildAssociationOverride(index);
+ return null;
}
/**
@@ -380,11 +344,11 @@
Element element = getChild(AttributeOverride.ATTRIBUTE_OVERRIDE, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildAttributeOverride(index);
}
- return buildAttributeOverride(index);
+ return null;
}
/**
@@ -392,7 +356,15 @@
*/
@Override
public String getClassExtractorClassName() {
- return getChildAttribute(CLASS_EXTRACTOR, CLASS);
+ return getChildAttribute(CLASS_EXTRACTOR, ExternalEmbeddable.CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getClassExtractorClassNameTextRange() {
+ return getChildAttributeTextRange(CLASS_EXTRACTOR, ExternalEmbeddable.CLASS);
}
/**
@@ -401,13 +373,11 @@
@Override
public DiscriminatorColumn getDiscriminatorColumn() {
- Element element = getChild(DiscriminatorColumn.DISCRIMINATOR_COLUMN);
-
- if (element == null) {
- return null;
+ if (hasChild(DiscriminatorColumn.DISCRIMINATOR_COLUMN)) {
+ return buildDiscriminatorColumn();
}
- return buildDiscriminatorColumn();
+ return null;
}
/**
@@ -422,6 +392,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDiscriminatorValueTextRange() {
+ return getChildTextNodeTextRange(DISCRIMINATOR_VALUE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected String getElementName() {
return ENTITY;
}
@@ -434,11 +412,19 @@
Element element = getChild(INHERITANCE);
- if (element == null) {
- return null;
+ if (element != null) {
+ return getEnumAttribute(element, STRATEGY, InheritanceType.class);
}
- return getEnumAttribute(element, STRATEGY, InheritanceType.class);
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getInheritenceStrategyTextRange() {
+ return getChildAttributeTextRange(INHERITANCE, STRATEGY);
}
/**
@@ -455,13 +441,11 @@
@Override
public ExternalBasicNamedQuery getNamedQuery(int index) {
- Element element = getChild(NamedQuery.NAMED_QUERY, index);
-
- if (element == null) {
- return null;
+ if (hasChild(NamedQuery.NAMED_QUERY, index)) {
+ return buildNamedQuery(index);
}
- return buildNamedQuery(index);
+ return null;
}
/**
@@ -487,15 +471,21 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalNativeQuery getNativeQuery(int index) {
- Element element = getChild(NamedNativeQuery.NAMED_NATIVE_QUERY, index);
-
- if (element == null) {
- return null;
+ if (hasChild(NamedNativeQuery.NAMED_NATIVE_QUERY, index)) {
+ return buildNamedNativeQuery(index);
}
- return buildNamedNativeQuery(index);
+ return null;
}
/**
@@ -523,13 +513,11 @@
@Override
public ExternalPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index) {
- Element element = getChild(PrimaryKeyJoinColumn.PRIMARY_KEY_JOIN_COLUMN, index);
-
- if (element == null) {
- return null;
+ if (hasChild(PrimaryKeyJoinColumn.PRIMARY_KEY_JOIN_COLUMN, index)) {
+ return buildPrimaryKeyJoinColumn(index);
}
- return buildPrimaryKeyJoinColumn(index);
+ return null;
}
/**
@@ -538,28 +526,24 @@
@Override
public ExternalEntityTable getPrimaryTable() {
- Element element = getChild(PrimaryTable.TABLE);
-
- if (element == null) {
- return null;
+ if (hasChild(PrimaryTable.TABLE)) {
+ return buildPrimaryTable();
}
- return buildPrimaryTable();
+ return null;
}
/**
* {@inheritDoc}
*/
@Override
- public ExternalEntitySecondaryTable getSecondaryTable(int index) {
+ public ExternalSecondaryTable getSecondaryTable(int index) {
- Element element = getChild(SecondaryTable.SECONDARY_TABLE);
-
- if (element == null) {
- return null;
+ if (hasChild(SecondaryTable.SECONDARY_TABLE)) {
+ return buildSecondaryTable(index);
}
- return buildSecondaryTable(index);
+ return null;
}
/**
@@ -568,13 +552,11 @@
@Override
public ExternalSQLResultSetMapping getSqlResultSetMapping(int index) {
- Element element = getChild(SQLResultSetMapping.SQL_RESULT_SET_MAPPING, index);
-
- if (element == null) {
- return null;
+ if (hasChild(SQLResultSetMapping.SQL_RESULT_SET_MAPPING, index)) {
+ return buildSqlResultSetMapping(index);
}
- return buildSqlResultSetMapping(index);
+ return null;
}
/**
@@ -583,13 +565,11 @@
@Override
public ExternalStoredProcedureQuery getStoredProcedureQuery(int index) {
- Element element = getChild(NamedStoredProcedureQuery.NAMED_STORED_PROCEDURE_QUERY, index);
-
- if (element == null) {
- return null;
+ if (hasChild(NamedStoredProcedureQuery.NAMED_STORED_PROCEDURE_QUERY, index)) {
+ return buildStoredProcedureQuery(index);
}
- return buildStoredProcedureQuery(index);
+ return null;
}
/**
@@ -615,17 +595,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalNamedQuery> namedQueries() {
+ public List<ExternalNamedQuery> namedQueries() {
int count = namedQueriesSize();
List<ExternalNamedQuery> namedQueries = new ArrayList<ExternalNamedQuery>(count);
- for (int index = count; --index >= 0;) {
- ExternalNamedQuery namedQuery = buildNamedQuery(index);
- namedQueries.add(0, namedQuery);
+ for (int index = 0; index < count; index++) {
+ namedQueries.add(buildNamedQuery(index));
}
- return new ListListIterable<ExternalNamedQuery>(namedQueries);
+ return namedQueries;
}
/**
@@ -640,17 +619,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalNativeQuery> nativeQueries() {
+ public List<ExternalNativeQuery> nativeQueries() {
int count = nativeQueriesSize();
List<ExternalNativeQuery> nativeQueries = new ArrayList<ExternalNativeQuery>(count);
- for (int index = count; --index >= 0;) {
- ExternalNativeQuery nativeQuery = buildNamedNativeQuery(index);
- nativeQueries.add(0, nativeQuery);
+ for (int index = 0; index < count; index++) {
+ nativeQueries.add(buildNamedNativeQuery(index));
}
- return new ListListIterable<ExternalNativeQuery>(nativeQueries);
+ return nativeQueries;
}
/**
@@ -665,17 +643,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ public List<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
int count = primaryKeyJoinColumnsSize();
List<ExternalPrimaryKeyJoinColumn> pkJoinColumns = new ArrayList<ExternalPrimaryKeyJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalPrimaryKeyJoinColumn pkJoinColumn = buildPrimaryKeyJoinColumn(index);
- pkJoinColumns.add(0, pkJoinColumn);
+ for (int index = 0; index < count; index++) {
+ pkJoinColumns.add(buildPrimaryKeyJoinColumn(index));
}
- return new ListListIterable<ExternalPrimaryKeyJoinColumn>(pkJoinColumns);
+ return pkJoinColumns;
}
/**
@@ -771,17 +748,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalEntitySecondaryTable> secondaryTables() {
+ public List<ExternalSecondaryTable> secondaryTables() {
int count = secondaryTablesSize();
- List<ExternalEntitySecondaryTable> secondaryTables = new ArrayList<ExternalEntitySecondaryTable>(count);
+ List<ExternalSecondaryTable> secondaryTables = new ArrayList<ExternalSecondaryTable>(count);
- for (int index = count; --index >= 0;) {
- ExternalEntitySecondaryTable secondaryTable = buildSecondaryTable(index);
- secondaryTables.add(0, secondaryTable);
+ for (int index = 0; index < count; index++) {
+ secondaryTables.add(buildSecondaryTable(index));
}
- return new ListListIterable<ExternalEntitySecondaryTable>(secondaryTables);
+ return secondaryTables;
}
/**
@@ -797,19 +773,7 @@
*/
@Override
public void setClassExtractorClassName(String className) {
-
- Element element = getChild(CLASS_EXTRACTOR);
-
- if ((element == null) && (className != null)) {
- element = addChild(CLASS_EXTRACTOR);
- }
-
- if (className != null) {
- setAttribute(element, CLASS, className);
- }
- else if (element != null) {
- removeChild(CLASS_EXTRACTOR);
- }
+ updateChildAttribute(CLASS_EXTRACTOR, ExternalEmbeddable.CLASS, className);
}
/**
@@ -825,23 +789,7 @@
*/
@Override
public void setInheritanceStrategy(InheritanceType value) {
-
- Element element = getChild(INHERITANCE);
-
- if ((element == null) && (value == null)) {
- return;
- }
-
- if ((element == null) && (value != null)) {
- element = addChild(INHERITANCE);
- }
-
- if (value != null) {
- setAttribute(element, STRATEGY, value);
- }
- else if (element != null) {
- removeChild(INHERITANCE);
- }
+ updateChildAttribute(INHERITANCE, STRATEGY, value);
}
/**
@@ -856,17 +804,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalSQLResultSetMapping> sqlResultSetMappings() {
+ public List<ExternalSQLResultSetMapping> sqlResultSetMappings() {
int count = sqlResultSetMappingsSize();
List<ExternalSQLResultSetMapping> sqlResultSetMappings = new ArrayList<ExternalSQLResultSetMapping>(count);
- for (int index = count; --index >= 0;) {
- ExternalSQLResultSetMapping sqlResultSetMapping = buildSqlResultSetMapping(index);
- sqlResultSetMappings.add(0, sqlResultSetMapping);
+ for (int index = 0; index < count; index++) {
+ sqlResultSetMappings.add(buildSqlResultSetMapping(index));
}
- return new ListListIterable<ExternalSQLResultSetMapping>(sqlResultSetMappings);
+ return sqlResultSetMappings;
}
/**
@@ -881,17 +828,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalStoredProcedureQuery> storedProcedureQueries() {
+ public List<ExternalStoredProcedureQuery> storedProcedureQueries() {
int count = storedProcedureQueriesSize();
List<ExternalStoredProcedureQuery> storedProcedureQueries = new ArrayList<ExternalStoredProcedureQuery>(count);
- for (int index = count; --index >= 0;) {
- ExternalStoredProcedureQuery nativeQuery = buildStoredProcedureQuery(index);
- storedProcedureQueries.add(0, nativeQuery);
+ for (int index = 0; index < count; index++) {
+ storedProcedureQueries.add(buildStoredProcedureQuery(index));
}
- return new ListListIterable<ExternalStoredProcedureQuery>(storedProcedureQueries);
+ return storedProcedureQueries;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityColumn.java
index 23f27d2..c76c47e 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,8 +13,11 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
+import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityColumn;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -25,11 +28,8 @@
* @see OptimisticLocking
* @see WriteTransfomer
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class EntityColumn extends AbstractColumn
implements ExternalEntityColumn {
@@ -44,110 +44,43 @@
private int index;
/**
- * The attribute name used to store and retrieve the column property.
- */
- static final String COLUMN = "column";
-
- /**
- * The attribute name used to store and retrieve the length property.
- */
- static final String LENGTH = "length";
-
- /**
- * The attribute name used to store and retrieve the precision property.
- */
- static final String PRECISION = "precision";
-
- /**
- * The attribute name used to store and retrieve the scale property.
- */
- static final String SCALE = "scale";
-
- /**
* Creates a new <code>EntityColumn</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- EntityColumn(AttributeOverride parent, int index) {
- super(parent);
- this.index = index;
- this.elementName = COLUMN;
- }
-
- /**
- * Creates a new <code>EntityColumn</code>.
- *
- * @param parent The parent of this external form
- */
- EntityColumn(Mapping parent) {
- this(parent, COLUMN);
- }
-
- /**
- * Creates a new <code>EntityColumn</code>.
- *
- * @param parent The parent of this external form
+ * @param index The position of the element within the list of children with the same type owned by the parent
* @param elementName The name of the element represented by this external form
*/
- EntityColumn(Mapping parent, String elementName) {
- super(parent);
- this.index = -1;
- this.elementName = elementName;
- }
-
- /**
- * Creates a new <code>EntityColumn</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- * @param elementName The name of the element represented by this external form
- */
- EntityColumn(OptimisticLocking parent, String elementName, int index) {
+ EntityColumn(AbstractExternalForm parent, String elementName, int index) {
super(parent);
this.index = index;
this.elementName = elementName;
}
/**
- * Creates a new <code>EntityColumn</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- EntityColumn(PrimaryKey parent, int index) {
- super(parent);
- this.index = index;
- this.elementName = COLUMN;
- }
-
- /**
- * Creates a new <code>EntityColumn</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- EntityColumn(WriteTransfomer parent, int index) {
- super(parent);
- this.index = index;
- this.elementName = COLUMN;
- }
-
- /**
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
+ protected List<String> buildAttributeNamesOrder() {
+ List<String> names = new ArrayList<String>();
+ names.add(NAME);
+ names.add(UNIQUE);
+ names.add(NULLABLE);
+ names.add(INSERTABLE);
+ names.add(UPDATABLE);
+ names.add(COLUMN_DEFINITION);
+ names.add(TABLE);
+ names.add(LENGTH);
+ names.add(PRECISION);
+ names.add(SCALE);
+ return names;
+ }
- if (index == -1) {
- return super.addSelf(elementName, elementNamesOrder);
- }
-
- return addChild(getParent(), elementName, index, elementNamesOrder);
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
}
/**
@@ -175,16 +108,16 @@
* {@inheritDoc}
*/
@Override
- public int getIndex() {
- return index;
+ public Integer getLength() {
+ return getIntegerAttribute(LENGTH);
}
/**
* {@inheritDoc}
*/
@Override
- public Integer getLength() {
- return getIntegerAttribute(LENGTH);
+ public TextRange getLengthTextRange() {
+ return getAttributeTextRange(LENGTH);
}
/**
@@ -199,6 +132,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getPrecisionTextRange() {
+ return getAttributeTextRange(PRECISION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Integer getScale() {
return getIntegerAttribute(SCALE);
}
@@ -207,6 +148,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getScaleTextRange() {
+ return getAttributeTextRange(SCALE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeSelf() {
if (index == -1) {
super.removeSelf();
@@ -224,7 +173,7 @@
setAttribute(LENGTH, length);
- if (shouldRemoveEmptyElement() && !hasAnyChildren() && !hasAttributes()) {
+ if (shouldRemoveSelf()) {
removeSelf();
}
}
@@ -237,7 +186,7 @@
setAttribute(PRECISION, precision);
- if (shouldRemoveEmptyElement() && !hasAnyChildren() && !hasAttributes()) {
+ if (shouldRemoveSelf()) {
removeSelf();
}
}
@@ -250,7 +199,7 @@
setAttribute(SCALE, scale);
- if (shouldRemoveEmptyElement() && !hasAnyChildren() && !hasAttributes()) {
+ if (shouldRemoveSelf()) {
removeSelf();
}
}
@@ -262,4 +211,8 @@
boolean shouldRemoveEmptyElement() {
return true;
}
+
+ private boolean shouldRemoveSelf() {
+ return shouldRemoveEmptyElement() && !hasAnything();
+ }
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityIDGeneratedValue.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityIDGeneratedValue.java
index 7d2369f..5c4c6a4 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityIDGeneratedValue.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityIDGeneratedValue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,36 +16,21 @@
import java.util.ArrayList;
import java.util.List;
import javax.persistence.GenerationType;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityIDGeneratedValue;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of a generated value.
*
* @see IdMapping
*
- * @version 2.5
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class EntityIDGeneratedValue extends AbstractExternalForm
implements ExternalEntityIDGeneratedValue {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String GENERATED_VALUE = "generated-value";
-
- /**
- * The attribute name used to store and retrieve the generator property.
- */
- static final String GENERATOR = "generator";
-
- /**
- * The attribute name used to store and retrieve the strategy property.
- */
- static final String STRATEGY = "strategy";
-
- /**
* Creates a new <code>EntityIDGeneratedValue</code>.
*
* @param parent The parent of this external form
@@ -53,7 +38,7 @@
EntityIDGeneratedValue(AbstractExternalForm parent) {
super(parent);
}
-
+
/**
* {@inheritDoc}
*/
@@ -85,6 +70,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getGenerationTypeTextRange() {
+ return getAttributeTextRange(STRATEGY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getGeneratorName() {
return getAttribute(GENERATOR);
}
@@ -93,6 +86,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getGeneratorNameTextRange() {
+ return getAttributeTextRange(GENERATOR);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setGenerationType(GenerationType type) {
setAttribute(STRATEGY, type);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityListener.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityListener.java
index 3e7886d..62b902c 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityListener.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityListener;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -24,11 +26,8 @@
* @see MappedSuperClassEntity
* @see PersistenceUnit
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class EntityListener extends AbstractExternalForm
implements ExternalEntityListener {
@@ -44,72 +43,10 @@
private int index;
/**
- * The attribute name used to store and retrieve the class property.
- */
- static String CLASS = "class";
-
- /**
- * The element name used to store and retrieve the description child node.
- */
- static String DESCRIPTION = "description";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static String ENTITY_LISTENER = "entity-listener";
-
- /**
- * The element name used to store and retrieve the entity-listeners parent node encapsulating the
- * {@link Element} represented by this external form.
- */
- static String ENTITY_LISTENERS = "entity-listeners";
-
- /**
- * The attribute name used to store and retrieve the method-name property of the callback child nodes.
- */
- static String METHOD_NAME = "method-name";
-
- /**
- * The element name used to store and retrieve the post-load child node.
- */
- static String POST_LOAD = "post-load";
-
- /**
- * The element name used to store and retrieve the post-persist child node.
- */
- static String POST_PERSIST = "post-persist";
-
- /**
- * The element name used to store and retrieve the post-remove child node.
- */
- static String POST_REMOVE = "post-remove";
-
- /**
- * The element name used to store and retrieve the post-update child node.
- */
- static String POST_UPDATE = "post-update";
-
- /**
- * The element name used to store and retrieve the pre-persist child node.
- */
- static String PRE_PERSIST = "pre-persist";
-
- /**
- * The element name used to store and retrieve the pre-remove child node.
- */
- static String PRE_REMOVE = "pre-remove";
-
- /**
- * The element name used to store and retrieve the pre-update child node.
- */
- static String PRE_UPDATE = "pre-update";
-
- /**
* Creates a new <code>EntityListener</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
EntityListener(MappedSuperClassEntity parent, int index) {
super(parent);
@@ -133,7 +70,7 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
+ public Element addSelf(String elementName, List<String> elementNamesOrder) {
Element parentElement;
@@ -155,12 +92,12 @@
Element element = getChild(parentElement, ENTITY_LISTENERS);
if (element == null) {
- element = addChild(parentElement, ENTITY_LISTENERS, index);
+ element = addChild(parentElement, ENTITY_LISTENERS);
}
return addChild(element, ENTITY_LISTENER);
}
-
+
/**
* {@inheritDoc}
*/
@@ -179,7 +116,6 @@
return names;
}
-
/**
* {@inheritDoc}
*/
@@ -192,6 +128,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getClassNameTextRange() {
+ return getAttributeTextRange(CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getDescription() {
return getChildTextNode(DESCRIPTION);
}
@@ -232,10 +176,8 @@
return ENTITY_LISTENER;
}
- /**
- * {@inheritDoc}
- */
@Override
+ @Deprecated
public int getIndex() {
return index;
}
@@ -260,6 +202,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getPostLoadMethodTextRange() {
+ return getChildAttributeTextRange(POST_LOAD, DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getPostPersistMethod() {
return getChildAttribute(POST_PERSIST, METHOD_NAME);
}
@@ -276,6 +226,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getPostPersistMethodTextRange() {
+ return getChildAttributeTextRange(POST_PERSIST, DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getPostRemoveMethod() {
return getChildAttribute(POST_REMOVE, METHOD_NAME);
}
@@ -292,6 +250,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getPostRemoveMethodTextRange() {
+ return getChildAttributeTextRange(POST_REMOVE, DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getPostUpdateMethod() {
return getChildAttribute(POST_UPDATE, METHOD_NAME);
}
@@ -308,6 +274,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getPostUpdateMethodTextRange() {
+ return getChildAttributeTextRange(POST_UPDATE, DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getPrePersistMethod() {
return getChildAttribute(PRE_PERSIST, METHOD_NAME);
}
@@ -324,6 +298,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getPrePersistMethodTextRange() {
+ return getChildAttributeTextRange(PRE_PERSIST, DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getPreRemoveMethod() {
return getChildAttribute(PRE_REMOVE, METHOD_NAME);
}
@@ -340,6 +322,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getPreRemoveMethodTextRange() {
+ return getChildAttributeTextRange(PRE_REMOVE, DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getPreUpdateMethod() {
return getChildAttribute(PRE_UPDATE, METHOD_NAME);
}
@@ -356,6 +346,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getPreUpdateMethodTextRange() {
+ return getChildAttributeTextRange(PRE_UPDATE, DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeSelf() {
Element parentElement = entity ? getParentElement() : getChild(getParent(), PersistenceUnit.PERSISTENCE_UNIT_DEFAULTS);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityResult.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityResult.java
index b14bde4..1eac3f5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityResult.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EntityResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,10 +15,10 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityResult;
import org.eclipse.persistence.tools.mapping.orm.ExternalFieldResult;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -26,11 +26,8 @@
*
* @see SQLResultSetMapping
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class EntityResult extends AbstractExternalForm
implements ExternalEntityResult {
@@ -40,26 +37,10 @@
private int index;
/**
- * The attribute name used to store and retrieve the discriminator-column property.
- */
- static final String DISCRIMINATOR_COLUMN = "discriminator-column";
-
- /**
- * The attribute name used to store and retrieve the entity-class property.
- */
- static final String ENTITY_CLASS = "entity-class";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String ENTITY_RESULT = "entity-result";
-
- /**
* Creates a new <code>EntityResult</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
EntityResult(SQLResultSetMapping parent, int index) {
super(parent);
@@ -70,24 +51,16 @@
* {@inheritDoc}
*/
@Override
- public void addFieldResult(int index, String name) {
- FieldResult fieldResult = buildFieldResult(index);
- fieldResult.addSelf();
+ public ExternalFieldResult addFieldResult(String name) {
+ FieldResult fieldResult = buildFieldResult(-1);
fieldResult.setName(name);
+ return fieldResult;
}
/**
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(ENTITY_CLASS);
@@ -103,17 +76,24 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalFieldResult> fieldResults() {
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<ExternalFieldResult> fieldResults() {
int count = fieldResultsSize();
List<ExternalFieldResult> fieldResults = new ArrayList<ExternalFieldResult>(count);
- for (int index = count; --index >= 0;) {
- ExternalFieldResult fieldResult = buildFieldResult(index);
- fieldResults.add(0, fieldResult);
+ for (int index = 0; index < count; index++) {
+ fieldResults.add(buildFieldResult(index));
}
- return new ListListIterable<ExternalFieldResult>(fieldResults);
+ return fieldResults;
}
/**
@@ -136,6 +116,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDiscriminatorColumnNameTextRange() {
+ return getAttributeTextRange(DISCRIMINATOR_COLUMN);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Element getElement() {
return getChild(getParent(), getElementName(), index);
}
@@ -160,23 +148,23 @@
* {@inheritDoc}
*/
@Override
- public ExternalFieldResult getFieldResult(int index) {
-
- Element element = getChild(FieldResult.FIELD_RESULT, index);
-
- if (element == null) {
- return null;
- }
-
- return buildFieldResult(index);
+ public TextRange getEntityClassNameTextRange() {
+ return getAttributeTextRange(ENTITY_CLASS);
}
/**
* {@inheritDoc}
*/
@Override
- public int getIndex() {
- return index;
+ public ExternalFieldResult getFieldResult(int index) {
+
+ Element element = getChild(FieldResult.FIELD_RESULT, index);
+
+ if (element != null) {
+ return buildFieldResult(index);
+ }
+
+ return null;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/FetchGroup.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/FetchGroup.java
index 9670117..04ad49d 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/FetchGroup.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/FetchGroup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,7 +14,9 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalFetchGroup;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -22,10 +24,8 @@
*
* @see EmbeddableEntity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class FetchGroup extends AbstractExternalForm
implements ExternalFetchGroup {
@@ -35,21 +35,6 @@
private int index;
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String FETCH_GROUP = "fetch-group";
-
- /**
- * The attribute name used to store and retrieve the load property.
- */
- static final String LOAD = "load";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
* Creates a new <code>FetchGroup</code>.
*
* @param parent The parent of this external form
@@ -64,19 +49,6 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
-
- if (index == -1) {
- return super.addSelf(elementName, elementNamesOrder);
- }
-
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected List<String> buildAttributeNamesOrder() {
List<String> names = super.buildAttributeNamesOrder();
names.add(NAME);
@@ -88,6 +60,14 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Boolean doesLoad() {
return getBooleanAttribute(LOAD);
}
@@ -96,6 +76,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDoesLoadTextRange() {
+ return getAttributeTextRange(LOAD);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected String getElementName() {
return FETCH_GROUP;
}
@@ -104,16 +92,16 @@
* {@inheritDoc}
*/
@Override
- public int getIndex() {
- return index;
+ public String getName() {
+ return getAttribute(NAME);
}
/**
* {@inheritDoc}
*/
@Override
- public String getName() {
- return getAttribute(NAME);
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/FieldResult.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/FieldResult.java
index 121224d..86899b7 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/FieldResult.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/FieldResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalFieldResult;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -23,11 +25,8 @@
*
* @see EntityResult
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class FieldResult extends AbstractExternalForm
implements ExternalFieldResult {
@@ -37,26 +36,10 @@
private int index;
/**
- * The attribute name used to store and retrieve the map-key property.
- */
- static final String COLUMN = "column";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String FIELD_RESULT = "field-result";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
* Creates a new <code>FieldResult</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with
- * the same type owned by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
FieldResult(EntityResult parent, int index) {
super(parent);
@@ -67,14 +50,6 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(NAME);
@@ -86,6 +61,14 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getColumnName() {
return getAttribute(COLUMN);
}
@@ -94,6 +77,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getColumnNameTextRange() {
+ return getAttributeTextRange(COLUMN);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Element getElement() {
return getChild(getParent(), getElementName(), index);
}
@@ -110,16 +101,16 @@
* {@inheritDoc}
*/
@Override
- public int getIndex() {
- return index;
+ public String getName() {
+ return getAttribute(NAME);
}
/**
* {@inheritDoc}
*/
@Override
- public String getName() {
- return getAttribute(NAME);
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/IdMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/IdMapping.java
index e0df0cc..dfe68d9 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/IdMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/IdMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,46 +16,29 @@
import java.util.ArrayList;
import java.util.List;
import javax.persistence.TemporalType;
+import org.eclipse.persistence.tools.mapping.orm.ExternalEntityColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityIDGeneratedValue;
import org.eclipse.persistence.tools.mapping.orm.ExternalIDMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSqlField;
import org.eclipse.persistence.tools.mapping.orm.ExternalSequenceGenerator;
import org.eclipse.persistence.tools.mapping.orm.ExternalTableGenerator;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form for a ID mapping, which is a child of an entity.
*
* @see MappedSuperClassEntity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class IdMapping extends ConvertibleMapping
implements ExternalIDMapping {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String ID = "id";
-
- /**
- * The attribute name used to store and retrieve the mutable property.
- */
- static final String MUTABLE = "mutable";
-
- /**
- * The element name used to store and retrieve the temporal child text node.
- */
- static final String TEMPORAL = "temporal";
-
- /**
* Creates a new <code>IdMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
IdMapping(MappedSuperClassEntity parent, int index) {
super(parent, index);
@@ -65,6 +48,16 @@
* {@inheritDoc}
*/
@Override
+ public ExternalEntityColumn addColumn() {
+ EntityColumn column = buildColumn();
+ column.addSelf();
+ return column;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalEntityIDGeneratedValue addGeneratedValue() {
EntityIDGeneratedValue generatedValue = buildGeneratedValue();
generatedValue.addSelf();
@@ -105,7 +98,7 @@
}
private EntityColumn buildColumn() {
- return new EntityColumn(this);
+ return new EntityColumn(this, EntityColumn.COLUMN, -1);
}
/**
@@ -141,11 +134,11 @@
}
private SequenceGenerator buildSequenceGenerator() {
- return new SequenceGenerator(this);
+ return new SequenceGenerator(this, -1);
}
private TableGenerator buildTableGenerator() {
- return new TableGenerator(this);
+ return new TableGenerator(this, -1);
}
/**
@@ -186,6 +179,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMutableTextRange() {
+ return getAttributeTextRange(MUTABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getNoSqlField() {
ExternalNoSqlField field = buildNoSqlField();
return field.getName();
@@ -229,6 +230,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getTemporalTypeTextRange() {
+ return getChildTextNodeTextRange(TEMPORAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final boolean isIdMapping() {
return true;
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/InstantiationCopyPolicy.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/InstantiationCopyPolicy.java
index 8d5819e..385d385 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/InstantiationCopyPolicy.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/InstantiationCopyPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,6 +13,7 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalInstantiationCopyPolicy;
/**
@@ -20,24 +21,17 @@
*
* @see EmbeddableEntity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class InstantiationCopyPolicy extends AbstractExternalForm
implements ExternalInstantiationCopyPolicy {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String INSTANTIATION_COPY_POLICY = "instantiation-copy-policy";
-
- /**
* Creates a new <code>InstantiationCopyPolicy</code>.
*
* @param parent The parent of this external form
*/
- InstantiationCopyPolicy(EmbeddableEntity parent) {
+ InstantiationCopyPolicy(Embeddable parent) {
super(parent);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/InverseJoinColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/InverseJoinColumn.java
index 8eb1a97..19ddd53 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/InverseJoinColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/InverseJoinColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,37 +13,25 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
+import org.eclipse.persistence.tools.mapping.orm.ExternalInverseJoinColumn;
+
/**
* The external form of an inverse Join column.
*
* @see JoinTable
*
- * @version 2.5
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
-final class InverseJoinColumn extends JoinColumn {
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String INVERSE_JOIN_COLUMN = "inverse-join-column";
+final class InverseJoinColumn extends JoinColumn
+ implements ExternalInverseJoinColumn {
/**
* Creates a new <code>InverseJoinColumn</code>.
*
* @param parent The parent of this external form
- * @param index The position of the external form of the join column in the list of children
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
InverseJoinColumn(JoinTable parent, int index) {
- super(parent, index);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getElementName() {
- return INVERSE_JOIN_COLUMN;
+ super(parent, INVERSE_JOIN_COLUMN, index);
}
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinColumn.java
index 175acd4..ef4d4cd 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinColumn;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -25,11 +27,8 @@
* @see JoinTable
* @see AssociationOverride
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
class JoinColumn extends AbstractColumn
implements ExternalJoinColumn {
@@ -41,46 +40,14 @@
/**
* The position of the element within the list of children with the same type owned by the parent.
*/
- private final int index;
-
- /**
- * The attribute name used to store and retrieve the base property.
- */
- static final String BASE = "base";
-
- /**
- * The attribute name used to store and retrieve the contiguous property.
- */
- static final String CONTIGUOUS = "contiguous";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String JOIN_COLUMN = "join-column";
-
- /**
- * The attribute name used to store and retrieve the mapped-by property.
- */
- static final String REFERENCED_COLUMN_NAME = "referenced-column-name";
-
- /**
- * Creates a new <code>JoinColumn</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- JoinColumn(AbstractExternalForm parent, int index) {
- this(parent, JOIN_COLUMN, index);
- }
+ private int index;
/**
* Creates a new <code>JoinColumn</code>.
*
* @param parent The parent of this external form
* @param elementName The name of the element represented by this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
JoinColumn(AbstractExternalForm parent, String elementName, int index) {
super(parent);
@@ -92,14 +59,6 @@
* {@inheritDoc}
*/
@Override
- protected final Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(NAME);
@@ -119,6 +78,14 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final Integer getBase() {
return getIntegerAttribute(BASE);
}
@@ -143,16 +110,16 @@
* {@inheritDoc}
*/
@Override
- public final int getIndex() {
- return index;
+ public final String getReferenceColumnName() {
+ return getAttribute(REFERENCED_COLUMN_NAME);
}
/**
* {@inheritDoc}
*/
@Override
- public final String getReferenceColumnName() {
- return getAttribute(REFERENCED_COLUMN_NAME);
+ public final TextRange getReferenceColumnNameTextRange() {
+ return getAttributeTextRange(REFERENCED_COLUMN_NAME);
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinTable.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinTable.java
index 49b880a..5b8f25f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinTable.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,10 +15,10 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
+import org.eclipse.persistence.tools.mapping.orm.ExternalInverseJoinColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinTable;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
import org.w3c.dom.Element;
/**
@@ -26,22 +26,20 @@
*
* @see RelationshipMapping
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
@SuppressWarnings("nls")
final class JoinTable extends Table
implements ExternalJoinTable {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
+ * The node name used to store and retrieve the element encapsulated by this external form.
*/
static final String JOIN_TABLE = "join-table";
/**
* Creates a new <code>JoinTable</code>.
- *
+ *
* @param parent The parent of this external form
*/
JoinTable(AbstractExternalForm parent) {
@@ -52,20 +50,20 @@
* {@inheritDoc}
*/
@Override
- public void addInverseJoinColumn(int index, String name) {
- InverseJoinColumn joinColumn = buildInverseJoinColumn(index);
- joinColumn.addSelf();
+ public ExternalInverseJoinColumn addInverseJoinColumn(String name) {
+ InverseJoinColumn joinColumn = buildInverseJoinColumn(-1);
joinColumn.setName(name);
+ return joinColumn;
}
/**
* {@inheritDoc}
*/
@Override
- public void addJoinColumn(int index, String name) {
- JoinColumn joinColumn = buildJoinColumn(index);
- joinColumn.addSelf();
+ public ExternalJoinColumn addJoinColumn(String name) {
+ JoinColumn joinColumn = buildJoinColumn(-1);
joinColumn.setName(name);
+ return joinColumn;
}
/**
@@ -85,7 +83,7 @@
}
private JoinColumn buildJoinColumn(int index) {
- return new JoinColumn(this, index);
+ return new JoinColumn(this, JoinColumn.JOIN_COLUMN, index);
}
/**
@@ -104,11 +102,11 @@
Element element = getChild(InverseJoinColumn.INVERSE_JOIN_COLUMN, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildInverseJoinColumn(index);
}
- return buildInverseJoinColumn(index);
+ return null;
}
/**
@@ -119,28 +117,27 @@
Element element = getChild(JoinColumn.JOIN_COLUMN, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildJoinColumn(index);
}
- return buildJoinColumn(index);
+ return null;
}
/**
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalJoinColumn> inverseJoinColumns() {
+ public List<ExternalJoinColumn> inverseJoinColumns() {
int count = inverseJoinColumnsSize();
List<ExternalJoinColumn> joinColumns = new ArrayList<ExternalJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalJoinColumn joinColumn = buildInverseJoinColumn(index);
- joinColumns.add(0, joinColumn);
+ for (int index = 0; index < count; index++) {
+ joinColumns.add(buildJoinColumn(index));
}
- return new ListListIterable<ExternalJoinColumn>(joinColumns);
+ return joinColumns;
}
/**
@@ -163,17 +160,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalJoinColumn> joinColumns() {
+ public List<ExternalJoinColumn> joinColumns() {
int count = joinColumnsSize();
List<ExternalJoinColumn> joinColumns = new ArrayList<ExternalJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalJoinColumn joinColumn = buildJoinColumn(index);
- joinColumns.add(0, joinColumn);
+ for (int index = 0; index < count; index++) {
+ joinColumns.add(buildJoinColumn(index));
}
- return new ListListIterable<ExternalJoinColumn>(joinColumns);
+ return joinColumns;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ManyToManyMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ManyToManyMapping.java
index 0663f8a..e899cd0 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ManyToManyMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ManyToManyMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -17,35 +17,25 @@
import java.util.List;
import org.eclipse.persistence.tools.mapping.orm.ExternalManyToManyMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSqlJoinField;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form for a M:M mapping, which is a child of an entity.
*
- * @see MappedSuperClassEntity
+ * @see MappedSuperClass
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class ManyToManyMapping extends ObjectCollectionMapping
implements ExternalManyToManyMapping {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String MANY_TO_MANY = "many-to-many";
-
- /**
* Creates a new <code>ManyToManyMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- ManyToManyMapping(EmbeddableEntity parent, int index) {
+ ManyToManyMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -53,9 +43,10 @@
* {@inheritDoc}
*/
@Override
- public void addJoinField(int index, String name) {
- ExternalNoSqlJoinField joinField = buildJoinField(index);
+ public ExternalNoSqlJoinField addJoinField(String name) {
+ ExternalNoSqlJoinField joinField = buildJoinField(-1);
joinField.setName(name);
+ return joinField;
}
/**
@@ -69,6 +60,7 @@
names.add(FETCH);
names.add(ACCESS);
names.add(MAPPED_BY);
+ names.add(ATTRIBUTE_TYPE);
return names;
}
@@ -98,7 +90,7 @@
return names;
}
- private ExternalNoSqlJoinField buildJoinField(int index) {
+ private NoSqlJoinField buildJoinField(int index) {
return new NoSqlJoinField(this, index);
}
@@ -122,17 +114,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalNoSqlJoinField> joinFields() {
+ public List<ExternalNoSqlJoinField> joinFields() {
int count = joinFieldSize();
List<ExternalNoSqlJoinField> joinFields = new ArrayList<ExternalNoSqlJoinField>(count);
- for (int index = count; --index >= 0;) {
- ExternalNoSqlJoinField joinField = buildJoinField(index);
- joinFields.add(0, joinField);
+ for (int index = 0; index < count; index++) {
+ joinFields.add(buildJoinField(index));
}
- return new ListListIterable<ExternalNoSqlJoinField>(joinFields);
+ return joinFields;
}
/**
@@ -158,4 +149,9 @@
public void setMappedByMappingName(String name) {
setAttribute(MAPPED_BY, name);
}
+
+ @Override
+ public TextRange getMappedByMappingNameTextRange() {
+ return null;
+ }
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ManyToOneMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ManyToOneMapping.java
index 8590745..4126fa0 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ManyToOneMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ManyToOneMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -18,51 +18,25 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalManyToOneMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSqlJoinField;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
-import org.w3c.dom.Element;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form for a M:1 mapping, which is a child of an entity.
*
* @see MappedSuperClassEntity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class ManyToOneMapping extends RelationshipMapping
implements ExternalManyToOneMapping {
/**
- * The attribute name used to store and retrieve the id property.
- */
- static final String ID = "id";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String MANY_TO_ONE = "many-to-one";
-
- /**
- * The attribute name used to store and retrieve the mapped-by property.
- */
- static final String MAPPED_BY = "mapped-by-id";
-
- /**
- * The attribute name used to store and retrieve the maps-id property.
- */
- static final String MAPS_ID = "maps-id";
-
- /**
* Creates a new <code>ManyToOneMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- ManyToOneMapping(EmbeddableEntity parent, int index) {
+ ManyToOneMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -70,20 +44,20 @@
* {@inheritDoc}
*/
@Override
- public void addJoinColumn(int index, String name) {
- JoinColumn joinColumn = buildJoinColumn(index);
- joinColumn.addSelf();
+ public ExternalJoinColumn addJoinColumn(String name) {
+ JoinColumn joinColumn = buildJoinColumn(-1);
joinColumn.setName(name);
+ return joinColumn;
}
-
/**
* {@inheritDoc}
*/
@Override
- public void addJoinField(int index, String name) {
- ExternalNoSqlJoinField joinField = buildJoinField(index);
+ public ExternalNoSqlJoinField addJoinField(String name) {
+ ExternalNoSqlJoinField joinField = buildJoinField(-1);
joinField.setName(name);
+ return joinField;
}
/**
@@ -103,7 +77,6 @@
return names;
}
-
/**
* {@inheritDoc}
*/
@@ -120,7 +93,7 @@
}
private JoinColumn buildJoinColumn(int index) {
- return new JoinColumn(this, index);
+ return new JoinColumn(this, JoinColumn.JOIN_COLUMN, index);
}
private ExternalNoSqlJoinField buildJoinField(int index) {
@@ -147,15 +120,21 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getIdTextRange() {
+ return getAttributeTextRange(ID);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalJoinColumn getJoinColumn(int index) {
- Element element = getChild(JoinColumn.JOIN_COLUMN, index);
-
- if (element == null) {
- return null;
+ if (hasChild(JoinColumn.JOIN_COLUMN, index)) {
+ return buildJoinColumn(index);
}
- return buildJoinColumn(index);
+ return null;
}
/**
@@ -170,6 +149,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMappedByMappingNameTextRange() {
+ return getAttributeTextRange(MAPPED_BY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getMapsId() {
return getAttribute(MAPS_ID);
}
@@ -178,17 +165,24 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalJoinColumn> joinColumns() {
+ public TextRange getMapsIdTextRange() {
+ return getAttributeTextRange(MAPS_ID);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<ExternalJoinColumn> joinColumns() {
int count = joinColumnsSize();
List<ExternalJoinColumn> joinColumns = new ArrayList<ExternalJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalJoinColumn joinColumn = buildJoinColumn(index);
- joinColumns.add(0, joinColumn);
+ for (int index = 0; index < count; index++) {
+ joinColumns.add(buildJoinColumn(index));
}
- return new ListListIterable<ExternalJoinColumn>(joinColumns);
+ return joinColumns;
}
/**
@@ -203,17 +197,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalNoSqlJoinField> joinFields() {
+ public List<ExternalNoSqlJoinField> joinFields() {
int count = joinFieldSize();
List<ExternalNoSqlJoinField> joinFields = new ArrayList<ExternalNoSqlJoinField>(count);
- for (int index = count; --index >= 0;) {
- ExternalNoSqlJoinField joinField = buildJoinField(index);
- joinFields.add(0, joinField);
+ for (int index = 0; index < count; index++) {
+ joinFields.add(buildJoinField(index));
}
- return new ListListIterable<ExternalNoSqlJoinField>(joinFields);
+ return joinFields;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MappedSuperClassEntity.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MappedSuperClassEntity.java
index d29fae3..94e0612 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MappedSuperClassEntity.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MappedSuperClassEntity.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,15 +14,16 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import org.eclipse.persistence.annotations.ExistenceType;
import org.eclipse.persistence.tools.mapping.orm.ExternalCache;
+import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddable;
import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddedIDMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityListener;
import org.eclipse.persistence.tools.mapping.orm.ExternalFetchGroup;
import org.eclipse.persistence.tools.mapping.orm.ExternalIDMapping;
-import org.eclipse.persistence.tools.mapping.orm.ExternalMappedSuperClassEntity;
+import org.eclipse.persistence.tools.mapping.orm.ExternalMappedSuperClass;
import org.eclipse.persistence.tools.mapping.orm.ExternalMultitenancyPolicy;
import org.eclipse.persistence.tools.mapping.orm.ExternalOptimisticLocking;
import org.eclipse.persistence.tools.mapping.orm.ExternalPrimaryKey;
@@ -32,9 +33,7 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalVariableOneToOneMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalVersionMapping;
import org.eclipse.persistence.tools.utility.ObjectTools;
-import org.eclipse.persistence.tools.utility.iterable.EmptyListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -42,125 +41,16 @@
*
* @see ORMConfiguration
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
-class MappedSuperClassEntity extends EmbeddableEntity
- implements ExternalMappedSuperClassEntity {
-
- /**
- * The element name used to store and retrieve the cache-intercepter child node.
- */
- static final String CACHE_INTERCEPTOR = "cache-interceptor";
-
- /**
- * The attribute name used to store and retrieve the cacheable property
- */
- static final String CACHEABLE = "cacheable";
-
- /**
- * The attribute name used to store and retrieve the class property of the id-class child node.
- */
- static final String CLASS = "class";
-
- /**
- * The element name used to store and retrieve the exclude-default-listeners child node.
- */
- static final String EXCLUDE_DEFAULT_LISTENERS = "exclude-default-listeners";
-
- /**
- * The element name used to store and retrieve the exclude-superclass-listeners child node.
- */
- static final String EXCLUDE_SUPERCLASS_LISTENERS = "exclude-superclass-listeners";
-
- /**
- * The attribute name used to store and retrieve the existence-checking property.
- */
- static final String EXISTENCE_CHECKING = "existence-checking";
-
- /**
- * The element name used to store and retrieve the id-class child node.
- */
- static final String ID_CLASS = "id-class";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String MAPPED_SUPERCLASS = "mapped-superclass";
-
- /**
- * The attribute name used to store and retrieve the method-name property of the callback child nodes.
- */
- static final String METHOD_NAME = "method-name";
-
- /**
- * The element name used to store and retrieve the multitenant child node.
- */
- static final String MULTITENANT = "multitenant";
-
- /**
- * The attribute name used to store and retrieve the optimistic-locking property.
- */
- static final String OPTIMISTIC_LOCKING = "optimistic-locking";
-
- /**
- * The element name used to store and retrieve the parent-class child node.
- */
- static final String PARENT_CLASS = "parent-class";
-
- /**
- * The element name used to store and retrieve the post-load child node.
- */
- static final String POST_LOAD = "post-load";
-
- /**
- * The element name used to store and retrieve the post-persist child node.
- */
- static final String POST_PERSIST = "post-persist";
-
- /**
- * The element name used to store and retrieve the post-remove child node.
- */
- static final String POST_REMOVE = "post-remove";
-
- /**
- * The element name used to store and retrieve the post-update child node.
- */
- static final String POST_UPDATE = "post-update";
-
- /**
- * The element name used to store and retrieve the pre-persist child node.
- */
- static final String PRE_PERSIST = "pre-persist";
-
- /**
- * The element name used to store and retrieve the pre-remove child node.
- */
- static final String PRE_REMOVE = "pre-remove";
-
- /**
- * The element name used to store and retrieve the pre-update child node.
- */
- static final String PRE_UPDATE = "pre-update";
-
- /**
- * The attribute name used to store and retrieve the primary-key property.
- */
- static final String PRIMARY_KEY = "primary-key";
-
- /**
- * The attribute name used to store and retrieve the read-only property.
- */
- static final String READ_ONLY = "read-only";
+class MappedSuperClassEntity extends Embeddable
+ implements ExternalMappedSuperClass {
/**
* Creates a new <code>MappedSuperClassEntity</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with
- * the same type owned by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
MappedSuperClassEntity(ORMConfiguration parent, int index) {
super(parent, index);
@@ -182,7 +72,6 @@
@Override
public final ExternalEmbeddedIDMapping addEmbeddedIdMapping(String name) {
EmbeddedIDMapping mapping = buildEmbeddedIdMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -191,19 +80,18 @@
* {@inheritDoc}
*/
@Override
- public final void addEntityListener(int index, String name) {
- EntityListener entityListener = buildEntityListener(index);
- entityListener.addSelf();
+ public final ExternalEntityListener addEntityListener(String name) {
+ EntityListener entityListener = buildEntityListener(-1);
entityListener.setClassName(name);
+ return entityListener;
}
/**
* {@inheritDoc}
*/
@Override
- public final ExternalFetchGroup addFetchGroup(int index, String name) {
- FetchGroup fetchGroup = buildFetchGroup(index);
- fetchGroup.addSelf();
+ public final ExternalFetchGroup addFetchGroup(String name) {
+ FetchGroup fetchGroup = buildFetchGroup(-1);
fetchGroup.setName(name);
return fetchGroup;
}
@@ -212,30 +100,22 @@
* {@inheritDoc}
*/
@Override
+ public final ExternalIDMapping addIdMapping(String name) {
+ IdMapping mapping = buildIdMapping(mappingsSize());
+ mapping.setName(name);
+ return mapping;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final ExternalMultitenancyPolicy addMultitenancy() {
MultitenancyPolicy multitenant = buildMultitenant();
multitenant.addSelf();
return multitenant;
}
- /** {@inheritDoc}
- */
- @Override
- public Boolean isMultitenant() {
- return getChild("multitenant") != null ? Boolean.TRUE : Boolean.FALSE;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public final ExternalIDMapping addIdMapping(String name) {
- IdMapping mapping = buildIdMapping(mappingsSize());
- mapping.addSelf();
- mapping.setName(name);
- return mapping;
- }
-
/**
* {@inheritDoc}
*/
@@ -256,7 +136,6 @@
return primaryKey;
}
-
/**
* {@inheritDoc}
*/
@@ -277,14 +156,12 @@
return tableGenerator;
}
-
/**
* {@inheritDoc}
*/
@Override
public final ExternalTransformationMapping addTransformationMapping(String name) {
TransformationMapping mapping = buildTransformationMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -295,7 +172,6 @@
@Override
public final ExternalVariableOneToOneMapping addVariableOneToOneMapping(String name) {
VariableOneToOneMapping mapping = buildVariableOneToOneMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -306,7 +182,6 @@
@Override
public final ExternalVersionMapping addVersionMapping(String name) {
VersionMapping mapping = buildVersionMapping(mappingsSize());
- mapping.addSelf();
mapping.setName(name);
return mapping;
}
@@ -317,7 +192,7 @@
@Override
protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
- names.add(CLASS);
+ names.add(ExternalEmbeddable.CLASS);
names.add(PARENT_CLASS);
names.add(ACCESS);
names.add(CACHEABLE);
@@ -338,7 +213,7 @@
@Override
protected List<String> buildElementNamesOrder() {
List<String> names = new ArrayList<String>();
- names.add(DESCRIPTION);
+ names.add(ExternalEmbeddable.DESCRIPTION);
names.add(CUSTOMIZER);
names.add(CHANGE_TRACKING);
names.add(ID_CLASS);
@@ -434,11 +309,11 @@
}
private SequenceGenerator buildSequenceGenerator() {
- return new SequenceGenerator(this);
+ return new SequenceGenerator(this, -1);
}
private TableGenerator buildTableGenerator() {
- return new TableGenerator(this);
+ return new TableGenerator(this, -1);
}
private TransformationMapping buildTransformationMapping(int index) {
@@ -457,23 +332,21 @@
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalEntityListener> entityListeners() {
-
- Element element = getChild(EntityListener.ENTITY_LISTENERS);
-
- if (element == null) {
- return EmptyListIterable.instance();
- }
+ public final List<ExternalEntityListener> entityListeners() {
int count = entityListenersSize();
- List<ExternalEntityListener> entityListeners = new ArrayList<ExternalEntityListener>(count);
- for (int index = count; --index >= 0;) {
- ExternalEntityListener entityListener = buildEntityListener(index);
- entityListeners.add(0, entityListener);
+ if (count == 0) {
+ return Collections.emptyList();
}
- return new ListListIterable<ExternalEntityListener>(entityListeners);
+ List<ExternalEntityListener> entityListeners = new ArrayList<ExternalEntityListener>(count);
+
+ for (int index = 0; index < count; index++) {
+ entityListeners.add(buildEntityListener(index));
+ }
+
+ return entityListeners;
}
/**
@@ -484,28 +357,27 @@
Element element = getChild(EntityListener.ENTITY_LISTENERS);
- if (element == null) {
- return 0;
+ if (element != null) {
+ return getChildrenSize(element, EntityListener.ENTITY_LISTENER);
}
- return getChildrenSize(element, EntityListener.ENTITY_LISTENER);
+ return 0;
}
/**
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalFetchGroup> fetchGroups() {
+ public final List<ExternalFetchGroup> fetchGroups() {
int count = fetchGroupsSize();
List<ExternalFetchGroup> fetchGroups = new ArrayList<ExternalFetchGroup>(count);
- for (int index = count; --index >= 0;) {
- ExternalFetchGroup fetchGroup = buildFetchGroup(index);
- fetchGroups.add(0, fetchGroup);
+ for (int index = 0; index < count; index++) {
+ fetchGroups.add(buildFetchGroup(index));
}
- return new ListListIterable<ExternalFetchGroup>(fetchGroups);
+ return fetchGroups;
}
/**
@@ -533,8 +405,24 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getCacheableTextRange() {
+ return getAttributeTextRange(CACHEABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getCacheInterceptorClassName() {
- return getChildAttribute(CACHE_INTERCEPTOR, CLASS);
+ return getChildAttribute(CACHE_INTERCEPTOR, ExternalEmbeddable.CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getCacheInterceptorClassNameTextRange() {
+ return getChildAttributeTextRange(CACHE_INTERCEPTOR, ExternalEmbeddable.CLASS);
}
/**
@@ -570,6 +458,22 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getExcludesClassListenersTextRange() {
+ return getChildTextRange(EXCLUDE_DEFAULT_LISTENERS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getExcludesSuperClassListenersTextRange() {
+ return getChildTextRange(EXCLUDE_SUPERCLASS_LISTENERS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final ExistenceType getExistenceCheckingType() {
return getEnumAttribute(EXISTENCE_CHECKING, ExistenceType.class);
}
@@ -578,15 +482,23 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getExistenceCheckingTypeTextRange() {
+ return getAttributeTextRange(EXISTENCE_CHECKING);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final ExternalFetchGroup getFetchGroup(int index) {
Element element = getChild(FetchGroup.FETCH_GROUP, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildFetchGroup(index);
}
- return buildFetchGroup(index);
+ return null;
}
/**
@@ -594,7 +506,15 @@
*/
@Override
public final String getIdClassName() {
- return getChildAttribute(ID_CLASS, CLASS);
+ return getChildAttribute(ID_CLASS, ExternalEmbeddable.CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getIdClassNameTextRange() {
+ return getChildAttributeTextRange(ID_CLASS, ExternalEmbeddable.CLASS);
}
/**
@@ -602,7 +522,7 @@
*/
@Override
public final String getMappingsDescription() {
- return getChildTextNode(Mapping.ATTRIBUTES, DESCRIPTION);
+ return getChildTextNode(Mapping.ATTRIBUTES, ExternalEmbeddable.DESCRIPTION);
}
/**
@@ -610,7 +530,20 @@
*/
@Override
public ExternalMultitenancyPolicy getMultitenant() {
- return buildMultitenant();
+
+ if (hasChild(MultitenancyPolicy.MULTITENANT)) {
+ return buildMultitenant();
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getMultitenantTextRange() {
+ return getChildTextRange(MULTITENANT);
}
/**
@@ -638,6 +571,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getParentClassNameTextRange() {
+ return getAttributeTextRange(PARENT_CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getPostLoadMethod() {
return getChildAttribute(POST_LOAD, METHOD_NAME);
}
@@ -647,7 +588,15 @@
*/
@Override
public final String getPostLoadMethodDescription() {
- return getChildTextNode(POST_LOAD, DESCRIPTION);
+ return getChildTextNode(POST_LOAD, ExternalEmbeddable.DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPostLoadMethodTextRange() {
+ return getChildTextNodeTextRange(POST_LOAD, ExternalEmbeddable.DESCRIPTION);
}
/**
@@ -663,7 +612,15 @@
*/
@Override
public final String getPostPersistMethodDescription() {
- return getChildTextNode(POST_PERSIST, DESCRIPTION);
+ return getChildTextNode(POST_PERSIST, ExternalEmbeddable.DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPostPersistMethodTextRange() {
+ return getChildTextNodeTextRange(POST_PERSIST, ExternalEmbeddable.DESCRIPTION);
}
/**
@@ -679,7 +636,15 @@
*/
@Override
public final String getPostRemoveMethodDescription() {
- return getChildTextNode(POST_REMOVE, DESCRIPTION);
+ return getChildTextNode(POST_REMOVE, ExternalEmbeddable.DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPostRemoveMethodTextRange() {
+ return getChildTextNodeTextRange(POST_REMOVE, ExternalEmbeddable.DESCRIPTION);
}
/**
@@ -695,7 +660,15 @@
*/
@Override
public final String getPostUpdateMethodDescription() {
- return getChildTextNode(POST_UPDATE, DESCRIPTION);
+ return getChildTextNode(POST_UPDATE, ExternalEmbeddable.DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPostUpdateMethodTextRange() {
+ return getChildTextNodeTextRange(POST_UPDATE, ExternalEmbeddable.DESCRIPTION);
}
/**
@@ -711,7 +684,15 @@
*/
@Override
public final String getPrePersistMethodDescription() {
- return getChildTextNode(PRE_PERSIST, DESCRIPTION);
+ return getChildTextNode(PRE_PERSIST, ExternalEmbeddable.DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPrePersistMethodTextRange() {
+ return getChildTextNodeTextRange(PRE_PERSIST, ExternalEmbeddable.DESCRIPTION);
}
/**
@@ -727,7 +708,15 @@
*/
@Override
public final String getPreRemoveMethodDescription() {
- return getChildTextNode(PRE_REMOVE, DESCRIPTION);
+ return getChildTextNode(PRE_REMOVE, ExternalEmbeddable.DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPreRemoveMethodTextRange() {
+ return getChildTextNodeTextRange(PRE_REMOVE, ExternalEmbeddable.DESCRIPTION);
}
/**
@@ -743,7 +732,15 @@
*/
@Override
public final String getPreUpdateMethodDescription() {
- return getChildTextNode(PRE_UPDATE, DESCRIPTION);
+ return getChildTextNode(PRE_UPDATE, ExternalEmbeddable.DESCRIPTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPreUpdateMethodTextRange() {
+ return getChildTextNodeTextRange(PRE_UPDATE, ExternalEmbeddable.DESCRIPTION);
}
/**
@@ -763,15 +760,21 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getReadOnlyTextRange() {
+ return getAttributeTextRange(READ_ONLY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public SequenceGenerator getSequenceGenerator() {
- Element element = getChild(SequenceGenerator.SEQUENCE_GENERATOR);
-
- if (element == null) {
- return null;
+ if (hasChild(SequenceGenerator.SEQUENCE_GENERATOR)) {
+ return buildSequenceGenerator();
}
- return buildSequenceGenerator();
+ return null;
}
/**
@@ -780,13 +783,11 @@
@Override
public TableGenerator getTableGenerator() {
- Element element = getChild(TableGenerator.TABLE_GENERATOR);
-
- if (element == null) {
- return null;
+ if (hasChild(TableGenerator.TABLE_GENERATOR)) {
+ return buildTableGenerator();
}
- return buildTableGenerator();
+ return null;
}
/**
@@ -801,6 +802,14 @@
* {@inheritDoc}
*/
@Override
+ public Boolean isMultitenant() {
+ return hasChild(MULTITENANT);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final Boolean isReadOnly() {
return getBooleanAttribute(READ_ONLY);
}
@@ -872,7 +881,7 @@
*/
@Override
public final void setCacheInterceptorClassName(String className) {
- updateChildAttribute(CACHE_INTERCEPTOR, CLASS, className);
+ updateChildAttribute(CACHE_INTERCEPTOR, ExternalEmbeddable.CLASS, className);
}
/**
@@ -914,7 +923,7 @@
*/
@Override
public final void setIdClassName(String className) {
- updateChildAttribute(ID_CLASS, CLASS, className);
+ updateChildAttribute(ID_CLASS, ExternalEmbeddable.CLASS, className);
}
/**
@@ -922,18 +931,7 @@
*/
@Override
public final void setMappingsDescription(String description) {
-
- Element element = getChild(Mapping.ATTRIBUTES);
-
- if ((element == null) && (description == null)) {
- return;
- }
-
- if (element == null) {
- element = addChild(Mapping.ATTRIBUTES);
- }
-
- updateTextNode(element, DESCRIPTION, description);
+ updateChildChildTextNode(Mapping.ATTRIBUTES, ExternalEmbeddable.DESCRIPTION, description);
}
/**
@@ -957,7 +955,7 @@
*/
@Override
public final void setPostLoadMethodDescription(String name) {
- updateChildChildTextNode(POST_LOAD, DESCRIPTION, name);
+ updateChildChildTextNode(POST_LOAD, ExternalEmbeddable.DESCRIPTION, name);
}
/**
@@ -973,7 +971,7 @@
*/
@Override
public final void setPostPersistMethodDescription(String name) {
- updateChildChildTextNode(POST_PERSIST, DESCRIPTION, name);
+ updateChildChildTextNode(POST_PERSIST, ExternalEmbeddable.DESCRIPTION, name);
}
/**
@@ -989,7 +987,7 @@
*/
@Override
public final void setPostRemoveMethodDescription(String name) {
- updateChildChildTextNode(POST_REMOVE, DESCRIPTION, name);
+ updateChildChildTextNode(POST_REMOVE, ExternalEmbeddable.DESCRIPTION, name);
}
/**
@@ -1005,7 +1003,7 @@
*/
@Override
public final void setPostUpdateMethodDescription(String name) {
- updateChildChildTextNode(POST_UPDATE, DESCRIPTION, name);
+ updateChildChildTextNode(POST_UPDATE, ExternalEmbeddable.DESCRIPTION, name);
}
/**
@@ -1021,7 +1019,7 @@
*/
@Override
public final void setPrePersistMethodDescription(String name) {
- updateChildChildTextNode(PRE_PERSIST, DESCRIPTION, name);
+ updateChildChildTextNode(PRE_PERSIST, ExternalEmbeddable.DESCRIPTION, name);
}
/**
@@ -1037,7 +1035,7 @@
*/
@Override
public final void setPreRemoveMethodDescription(String name) {
- updateChildChildTextNode(PRE_REMOVE, DESCRIPTION, name);
+ updateChildChildTextNode(PRE_REMOVE, ExternalEmbeddable.DESCRIPTION, name);
}
/**
@@ -1053,7 +1051,7 @@
*/
@Override
public final void setPreUpdateMethodDescription(String name) {
- updateChildChildTextNode(PRE_UPDATE, DESCRIPTION, name);
+ updateChildChildTextNode(PRE_UPDATE, ExternalEmbeddable.DESCRIPTION, name);
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Mapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Mapping.java
index 89f9c19..474ea8f 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Mapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Mapping.java
@@ -14,10 +14,11 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.util.List;
-
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalMapping;
import org.eclipse.persistence.tools.utility.ClassNameTools;
import org.eclipse.persistence.tools.utility.StringTools;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -25,9 +26,7 @@
*
* @see EmbeddableEntity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
@SuppressWarnings("nls")
abstract class Mapping extends AbstractExternalForm
@@ -39,42 +38,16 @@
private int index;
/**
- * The attribute name used to store and retrieve the attribute type.
- */
- static final String ATTRIBUTE_TYPE = "attribute-type";
-
- /**
- * The element name used to store and retrieve the parent element of element represented by this
- * external form.
- */
- static final String ATTRIBUTES = "attributes";
-
- /**
- * The attribute name used to store and retrieve the mapping's name.
- */
- static final String NAME = "name";
-
- /**
* Creates a new <code>Mapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- Mapping(EmbeddableEntity parent, int index) {
+ Mapping(Embeddable parent, int index) {
super(parent);
this.index = index;
}
-
- /**
- * Creates a new <code>Mapping</code>.
- *
- * @param parent The parent of this external form
- */
- Mapping(EmbeddableEntity parent) {
- super(parent);
- }
-
+
/**
* {@inheritDoc}
*/
@@ -82,24 +55,12 @@
protected Element addChild(Element element, String elementName) {
return addChild(element, elementName, getParent().getMappingElementNamesOrder());
}
-
+
/**
* {@inheritDoc}
*/
@Override
- public Element addSelf() {
- Element element = super.addSelf();
- Element attributeElement = getChild(getParent(), ATTRIBUTES);
- this.index = getChildren(attributeElement).indexOf(element);
-
- return element;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected final Element addSelf(String elementName, List<String> elementNamesOrder) {
+ public final Element addSelf(String elementName, List<String> elementNamesOrder) {
Element element = getChild(getParent(), ATTRIBUTES);
@@ -114,6 +75,16 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ if (elementName == getElementName()) {
+ index = index(parent, child, elementName);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getAttributeType() {
return getAttribute(ATTRIBUTE_TYPE);
}
@@ -130,15 +101,23 @@
* {@inheritDoc}
*/
@Override
+ public final TextRange getAttributeTypeTextRange() {
+ return getAttributeTextRange(ATTRIBUTE_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final Element getElement() {
Element element = getChild(getParent(), ATTRIBUTES);
- if (element == null) {
- return null;
+ if (element != null) {
+ return getChild(element, index);
}
- return getChild(element, index);
+ return null;
}
/**
@@ -161,8 +140,16 @@
* {@inheritDoc}
*/
@Override
- protected EmbeddableEntity getParent() {
- return (EmbeddableEntity) super.getParent();
+ public final TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Embeddable getParent() {
+ return (Embeddable) super.getParent();
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MultitenancyPolicy.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MultitenancyPolicy.java
index 5cfa678..5b728ec 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MultitenancyPolicy.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MultitenancyPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,33 +16,22 @@
import java.util.ArrayList;
import java.util.List;
import org.eclipse.persistence.annotations.MultitenantType;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalMultitenancyPolicy;
import org.eclipse.persistence.tools.mapping.orm.ExternalTenantDiscriminatorColumn;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.mapping.orm.ExternalTenantTableDiscriminator;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
* The external form of the multitenant.
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class MultitenancyPolicy extends AbstractExternalForm
implements ExternalMultitenancyPolicy {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String MULTITENANT = "multitenant";
-
- /**
- * The attribute name used to store and retrieve the type property.
- */
- static final String TYPE = "type";
-
- /**
* Creates a new <code>MultitenancyPolicy</code>.
*
* @param parent The parent of this external form
@@ -55,32 +44,44 @@
* {@inheritDoc}
*/
@Override
- public ExternalTenantDiscriminatorColumn addDiscriminatorColumn(int index) {
- TenantDiscriminatorColumn column = buildDiscriminatorColumn(index);
+ public ExternalTenantDiscriminatorColumn addDiscriminatorColumn() {
+ TenantDiscriminatorColumn column = buildDiscriminatorColumn(-1);
column.addSelf();
return column;
}
-
- private TenantDiscriminatorColumn buildDiscriminatorColumn(int index) {
- return new TenantDiscriminatorColumn(this, index);
- }
/**
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalTenantDiscriminatorColumn> discriminatorColumns() {
+ public ExternalTenantTableDiscriminator addTenantTableDiscriminator() {
+ TenantTableDiscriminator discriminator = buildTenantTableDiscriminator();
+ discriminator.addSelf();
+ return discriminator;
+ }
+
+ private TenantDiscriminatorColumn buildDiscriminatorColumn(int index) {
+ return new TenantDiscriminatorColumn(this, index);
+ }
+
+ private TenantTableDiscriminator buildTenantTableDiscriminator() {
+ return new TenantTableDiscriminator(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<ExternalTenantDiscriminatorColumn> discriminatorColumns() {
int count = discriminatorColumnSize();
List<ExternalTenantDiscriminatorColumn> columns = new ArrayList<ExternalTenantDiscriminatorColumn>(count);
- for (int index = count; --index >= 0; )
- {
- ExternalTenantDiscriminatorColumn column = buildDiscriminatorColumn(index);
- columns.add(0, column);
+ for (int index = 0; index < count; index++) {
+ columns.add(buildDiscriminatorColumn(index));
}
- return new ListListIterable<ExternalTenantDiscriminatorColumn>(columns);
+ return columns;
}
/**
@@ -99,11 +100,11 @@
Element element = getChild(TenantDiscriminatorColumn.TENANT_DISCRIMINATOR_COLUMN, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildDiscriminatorColumn(index);
}
- return buildDiscriminatorColumn(index);
+ return null;
}
/**
@@ -118,10 +119,26 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getIncludeCriteriaTextRange() {
+ return getAttributeTextRange(INCLUDE_CRITERIA);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public MultitenantType getMultitenantType() {
return getEnumAttribute(TYPE, MultitenantType.class);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getMultitenantTypeTextRange() {
+ return getAttributeTextRange(TYPE);
+ }
+
public Element getParentEntityElement() {
return getParentElement();
}
@@ -130,6 +147,35 @@
* {@inheritDoc}
*/
@Override
+ public ExternalTenantTableDiscriminator getTenantTableDiscriminator() {
+
+ if (hasChild(TenantTableDiscriminator.TENANT_TABLE_DISCRIMINATOR)) {
+ return buildTenantTableDiscriminator();
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getTenantTableDiscriminatorTextRange() {
+ return getChildTextRange(TenantTableDiscriminator.TENANT_TABLE_DISCRIMINATOR);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Boolean isCriteriaIncluded() {
+ return getBooleanAttribute(INCLUDE_CRITERIA);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeDiscriminatorColumn(int index) {
TenantDiscriminatorColumn column = buildDiscriminatorColumn(index);
column.removeSelf();
@@ -139,6 +185,23 @@
* {@inheritDoc}
*/
@Override
+ public void removeTenantTableDiscriminator() {
+ TenantTableDiscriminator table = buildTenantTableDiscriminator();
+ table.removeSelf();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setIncludeCriteria(Boolean value) {
+ setAttribute(INCLUDE_CRITERIA, value);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setMultitenantType(MultitenantType type) {
setAttribute(TYPE, type);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedNativeQuery.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedNativeQuery.java
index e6e9e68..e4f8ff8 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedNativeQuery.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedNativeQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalNativeQuery;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of a native query.
@@ -23,48 +25,18 @@
* @see Entity
* @see ORMConfiguration
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
-final class NamedNativeQuery extends Query
+final class NamedNativeQuery extends AbstractQuery
implements ExternalNativeQuery {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String NAMED_NATIVE_QUERY = "named-native-query";
-
- /**
- * The attribute name used to store and retrieve the result-class property.
- */
- static final String RESULT_CLASS = "result-class";
-
- /**
- * The attribute name used to store and retrieve the result-set-mapping property.
- */
- static final String RESULT_SET_MAPPING = "result-set-mapping";
-
- /**
* Creates a new <code>NamedNativeQuery</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- NamedNativeQuery(Entity parent, int index) {
- super(parent, index);
- }
-
- /**
- * Creates a new <code>NamedNativeQuery</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- NamedNativeQuery(ORMConfiguration parent, int index) {
+ NamedNativeQuery(AbstractExternalForm parent, int index) {
super(parent, index);
}
@@ -110,6 +82,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getResultClassNameTextRange() {
+ return getAttributeTextRange(RESULT_CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getResultSetMapping() {
return getAttribute(RESULT_SET_MAPPING);
}
@@ -118,6 +98,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getResultSetMappingTextRange() {
+ return getAttributeTextRange(RESULT_SET_MAPPING);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setResultClassName(String name) {
setAttribute(RESULT_CLASS, name);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedQuery.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedQuery.java
index 1797bc4..f56856c 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedQuery.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,50 +16,28 @@
import java.util.ArrayList;
import java.util.List;
import javax.persistence.LockModeType;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalBasicNamedQuery;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
- * The external form of a named query.
+ * The external form of a named JPQL query.
*
* @see Entity
* @see ORMConfiguration
*
- * @version 2.5
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
-final class NamedQuery extends Query
+final class NamedQuery extends AbstractQuery
implements ExternalBasicNamedQuery {
/**
- * The attribute name used to store and retrieve the name property.
- */
- static final String LOCK_MODE = "lock-mode";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String NAMED_QUERY = "named-query";
-
- /**
* Creates a new <code>NamedQuery</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- NamedQuery(Entity parent, int index) {
- super(parent, index);
- }
-
- /**
- * Creates a new <code>NamedQuery</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with
- * the same type owned by the parent
- */
- NamedQuery(ORMConfiguration parent, int index) {
+ NamedQuery(AbstractExternalForm parent, int index) {
super(parent, index);
}
@@ -72,7 +50,7 @@
names.add(DESCRIPTION);
return names;
}
-
+
/**
* {@inheritDoc}
*/
@@ -93,6 +71,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getLockModeTypeTextRange() {
+ return getChildTextNodeTextRange(LOCK_MODE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setLockModeType(LockModeType lockModeType) {
updateChildTextNode(LOCK_MODE, lockModeType);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedStoredProcedureQuery.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedStoredProcedureQuery.java
index 30d9cae..bf8fb07 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedStoredProcedureQuery.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedStoredProcedureQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,10 +15,10 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalStoredProcedureParameter;
import org.eclipse.persistence.tools.mapping.orm.ExternalStoredProcedureQuery;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -27,60 +27,47 @@
* @see Entity
* @see ORMConfiguration
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
-final class NamedStoredProcedureQuery extends Query
+final class NamedStoredProcedureQuery extends AbstractQuery
implements ExternalStoredProcedureQuery {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String NAMED_STORED_PROCEDURE_QUERY = "named-stored-procedure-query";
-
- /**
- * The attribute name used to store and retrieve the procedure-name property.
- */
- static final String PROCEDURE_NAME = "procedure-name";
-
- /**
- * The attribute name used to store and retrieve the result-class property.
- */
- static final String RESULT_CLASS = "result-class";
-
- /**
- * The attribute name used to store and retrieve the result-set-mapping property.
- */
- static final String RESULT_SET_MAPPING = "result-set-mapping";
-
- /**
- * The attribute name used to store and retrieve the returns-result-set property.
- */
- static final String RETURNS_RESULT_SET = "returns-result-set";
-
- /**
* Creates a new <code>NamedStoredProcedureQuery</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- NamedStoredProcedureQuery(Entity parent, int index) {
+ NamedStoredProcedureQuery(AbstractExternalForm parent, int index) {
super(parent, index);
}
/**
- * Creates a new <code>NamedStoredProcedureQuery</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * {@inheritDoc}
*/
- NamedStoredProcedureQuery(ORMConfiguration parent, int index) {
- super(parent, index);
+ @Override
+ public ExternalStoredProcedureParameter addParameter() {
+ StoredProcedureParameter parameter = buildParameter(-1);
+ parameter.addSelf();
+ return parameter;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addResultClassName(String name) {
+ addChildTextNode(RESULT_CLASS, name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addResultSetMapping(String mapping) {
+ addChildTextNode(RESULT_SET_MAPPING, mapping);
+ }
+
/**
* {@inheritDoc}
*/
@@ -105,16 +92,6 @@
return names;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public ExternalStoredProcedureParameter addParameter(int index) {
- StoredProcedureParameter parameter = buildParameter(index);
- parameter.addSelf();
- return parameter;
- }
-
private StoredProcedureParameter buildParameter(int index) {
return new StoredProcedureParameter(this, index);
}
@@ -143,11 +120,11 @@
Element element = getChild(StoredProcedureParameter.STORED_PROCEDURE_PARAMETER, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildParameter(index);
}
- return buildParameter(index);
+ return null;
}
/**
@@ -162,33 +139,56 @@
* {@inheritDoc}
*/
@Override
- public String getResultClassName() {
- return getAttribute(RESULT_CLASS);
+ public TextRange getProcedureNameTextRange() {
+ return getAttributeTextRange(PROCEDURE_NAME);
}
/**
* {@inheritDoc}
*/
@Override
- public String getResultSetMapping() {
- return getAttribute(RESULT_SET_MAPPING);
+ public String getResultClassName(int index) {
+ return getChildTextNode(RESULT_CLASS, index);
}
/**
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalStoredProcedureParameter> parameters() {
+ public String getResultSetMapping(int index) {
+ return getChildTextNode(RESULT_SET_MAPPING, index);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getResultSetMappingTextRange(int index) {
+ return getChildTextNodeTextRange(RESULT_SET_MAPPING, index);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getReturnResultSetTextRange() {
+ return getAttributeTextRange(RETURNS_RESULT_SET);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<ExternalStoredProcedureParameter> parameters() {
int count = parametersSize();
List<ExternalStoredProcedureParameter> parameters = new ArrayList<ExternalStoredProcedureParameter>(count);
- for (int index = count; --index >= 0;) {
- ExternalStoredProcedureParameter queryHint = buildParameter(index);
- parameters.add(0, queryHint);
+ for (int index = 0; index < count; index++) {
+ parameters.add(buildParameter(index));
}
- return new ListListIterable<ExternalStoredProcedureParameter>(parameters);
+ return parameters;
}
/**
@@ -204,7 +204,7 @@
*/
@Override
public void removeParameter(int index) {
- StoredProcedureParameter parameter = buildParameter(index);
+ StoredProcedureParameter parameter = buildParameter(-1);
parameter.removeSelf();
}
@@ -212,6 +212,70 @@
* {@inheritDoc}
*/
@Override
+ public void removeResultClassName(int index) {
+ removeChild(RESULT_CLASS, index);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeResultSetMapping(int index) {
+ removeChild(RESULT_SET_MAPPING, index);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<String> resultClassNames() {
+
+ int count = resultClassNameSize();
+ List<String> resultClassNames = new ArrayList<String>(count);
+
+ for (int index = 0; index < count; index++) {
+ resultClassNames.add(getResultClassName(index));
+ }
+
+ return resultClassNames;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int resultClassNameSize() {
+ return getChildrenSize(RESULT_CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<String> resultSetMappings() {
+
+ int count = resultSetMappingsSize();
+ List<String> resultSetMappings = new ArrayList<String>(count);
+
+ for (int index = 0; index < count; index++) {
+ resultSetMappings.add(getResultSetMapping(index));
+ }
+
+ return resultSetMappings;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int resultSetMappingsSize() {
+ return getChildrenSize(RESULT_SET_MAPPING);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setDoesReturnResultSet(Boolean returnResultSet) {
setAttribute(RETURNS_RESULT_SET, returnResultSet);
}
@@ -223,20 +287,4 @@
public void setProcedureName(String name) {
setAttribute(PROCEDURE_NAME, name);
}
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setResultClassName(String name) {
- setAttribute(RESULT_CLASS, name);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setResultSetMapping(String mappingName) {
- setAttribute(RESULT_SET_MAPPING, mappingName);
- }
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSql.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSql.java
index d4d2aa9..77ddae0 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSql.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSql.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,35 +13,20 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.DataFormatType;
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSql;
/**
* The external form of a NoSQL database.
*
- * @version 2.5
+ * @version 2.6
* @since 2.5
*/
-@SuppressWarnings("nls")
final class NoSql extends AbstractExternalForm
implements ExternalNoSql {
/**
- * The attribute name used to store and retrieve the data format property.
- */
- private static final String DATA_FORMAT = "data-format";
-
- /**
- * The attribute name used to store and retrieve the data type property.
- */
- private static final String DATA_TYPE = "data-type";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String NO_SQL = "no-sql";
-
- /**
* Creates a new <code>NoSql</code>.
*
* @param parent The parent of this external form
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSqlField.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSqlField.java
index e48975f..87cd560 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSqlField.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSqlField.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,29 +13,19 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSqlField;
/**
* The external form of a NoSQL field.
*
- * @version 2.5
+ * @version 2.6
* @since 2.5
*/
-@SuppressWarnings("nls")
final class NoSqlField extends AbstractExternalForm
implements ExternalNoSqlField {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String FIELD = "field";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
* Creates a new <code>NoSqlField</code>.
*
* @param parent The parent of this external form
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSqlJoinField.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSqlJoinField.java
index 6c24768..cad3bf5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSqlJoinField.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NoSqlJoinField.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,18 +13,16 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
-import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSqlJoinField;
import org.w3c.dom.Element;
/**
* The external form for {@link org.eclipse.persistence.nosql.annotations.JoinField JoinField}
*
- * @version 2.5
+ * @version 2.6
* @since 2.5
- * @author Pascal Filion
*/
-@SuppressWarnings("nls")
final class NoSqlJoinField extends AbstractExternalForm
implements ExternalNoSqlJoinField {
@@ -34,21 +32,6 @@
private int index;
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String JOIN_FIELD = "join-field";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- private static final String NAME = "name";
-
- /**
- * The attribute name used to store and retrieve the referenced field name property.
- */
- private static final String REFERENCED_FIELD_NAME = "referenced-field-name";
-
- /**
* Creates a new <code>NoSqlJoinField</code>.
*
* @param parent The parent of this external form
@@ -63,8 +46,16 @@
* {@inheritDoc}
*/
@Override
- protected final Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Element getElement() {
+ return getChild(getParent(), getElementName(), index);
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NonTransientMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NonTransientMapping.java
index 5fef92d..ba27ac4 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NonTransientMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NonTransientMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,39 +15,31 @@
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.AccessType;
+import org.eclipse.persistence.tools.mapping.ExternalProperty;
+import org.eclipse.persistence.tools.mapping.orm.AccessType;
import org.eclipse.persistence.tools.mapping.orm.ExternalAccessMethods;
import org.eclipse.persistence.tools.mapping.orm.ExternalNonTransientMapping;
-import org.eclipse.persistence.tools.mapping.orm.ExternalProperty;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.ObjectTools;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
* The external form for a non-transient mapping, which is a child of an entity.
*
- * @see EmbeddableEntity
+ * @see Embeddable
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
abstract class NonTransientMapping extends Mapping
implements ExternalNonTransientMapping {
/**
- * The attribute name used to store and retrieve the access property.
- */
- static final String ACCESS = "access";
-
- /**
* Creates a new <code>NonTransientMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- NonTransientMapping(EmbeddableEntity parent, int index) {
+ NonTransientMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -55,22 +47,22 @@
* {@inheritDoc}
*/
@Override
- public final void addAccessMethods(String getMethodName, String setMethodName) {
+ public final ExternalAccessMethods addAccessMethods(String getMethodName, String setMethodName) {
AccessMethods accessMethods = buildAccessMethods();
- accessMethods.addSelf();
accessMethods.setGetMethod(getMethodName);
accessMethods.setSetMethod(setMethodName);
+ return accessMethods;
}
/**
* {@inheritDoc}
*/
@Override
- public final void addProperty(int index, String name, String value) {
- Property property = buildProperty(index);
- property.addSelf();
+ public final ExternalProperty addProperty(String name, String value) {
+ Property property = buildProperty(-1);
property.setName(name);
property.setValue(value);
+ return property;
}
private AccessMethods buildAccessMethods() {
@@ -87,7 +79,7 @@
names.add(AccessMethods.ACCESS_METHODS);
return names;
}
-
+
private Property buildProperty(int index) {
return new Property(this, index);
}
@@ -100,11 +92,11 @@
Element element = getChild(AccessMethods.ACCESS_METHODS);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildAccessMethods();
}
- return buildAccessMethods();
+ return null;
}
/**
@@ -119,32 +111,166 @@
* {@inheritDoc}
*/
@Override
- public final ExternalProperty getProperty(int index) {
-
- Element element = getChild(Property.PROPERTY, index);
-
- if (element == null) {
- return null;
- }
-
- return buildProperty(index);
+ public final TextRange getAccessTypeTextRange() {
+ return getAttributeTextRange(ACCESS);
}
/**
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalProperty> properties() {
+ public final List<ExternalProperty> getProperties(String name) {
+
+ List<ExternalProperty> properties = new ArrayList<ExternalProperty>();
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name)) {
+ properties.add(property);
+ }
+ }
+
+ return properties;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final ExternalProperty getProperty(int index) {
+
+ Element element = getChild(Property.PROPERTY, index);
+
+ if (element != null) {
+ return buildProperty(index);
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final ExternalProperty getProperty(String name) {
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name)) {
+ return property;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final ExternalProperty getProperty(String name, int index) {
+
+ ExternalProperty property = getProperty(index);
+
+ if ((property != null) && ObjectTools.equals(name, property.getName())) {
+ return property;
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final ExternalProperty getProperty(String name, String value) {
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name) &&
+ ObjectTools.equals(property.getValue(), value)) {
+
+ return property;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final TextRange getPropertyNameTextRange(String name) {
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name)) {
+ return property.getNameTextRange();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final TextRange getPropertyTextRange(String name) {
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name)) {
+ return property.getTextRange();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final TextRange getPropertyTextRange(String name, String value) {
+
+ for (ExternalProperty property : properties()) {
+
+ if (ObjectTools.equals(property.getName(), name) &&
+ ObjectTools.equals(property.getValue(), value)) {
+
+ return property.getTextRange();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final TextRange getPropertyValueTextRange(String name) {
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name)) {
+ return property.getValueTextRange();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final List<ExternalProperty> properties() {
int count = propertiesSize();
List<ExternalProperty> properties = new ArrayList<ExternalProperty>(count);
- for (int index = count; --index >= 0;) {
- ExternalProperty associationOverride = buildProperty(index);
- properties.add(0, associationOverride);
+ for (int index = 0; index < count; index++) {
+ properties.add(buildProperty(index));
}
- return new ListListIterable<ExternalProperty>(properties);
+ return properties;
}
/**
@@ -159,6 +285,23 @@
* {@inheritDoc}
*/
@Override
+ public final int propertiesSize(String name) {
+
+ int count = 0;
+
+ for (ExternalProperty property : properties()) {
+ if (ObjectTools.equals(property.getName(), name)) {
+ count++;
+ }
+ }
+
+ return count;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final void removeAccessMethods() {
removeChild(AccessMethods.ACCESS_METHODS);
}
@@ -176,6 +319,24 @@
* {@inheritDoc}
*/
@Override
+ public void removeProperty(String name) {
+ Property property = (Property) getProperty(name);
+ property.removeSelf();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final void removeProperty(String name, String value) {
+ Property property = (Property) getProperty(name, value);
+ property.removeSelf();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final void setAccessType(AccessType type) {
setAttribute(ACCESS, type);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMConfiguration.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMConfiguration.java
index 3477db6..6a19288 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMConfiguration.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,27 +14,28 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import javax.persistence.AccessType;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
+import org.eclipse.persistence.tools.mapping.ExternalFormHelper;
+import org.eclipse.persistence.tools.mapping.orm.AccessType;
import org.eclipse.persistence.tools.mapping.orm.ExternalBasicNamedQuery;
import org.eclipse.persistence.tools.mapping.orm.ExternalConverter;
-import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddableEntity;
+import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddable;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntity;
-import org.eclipse.persistence.tools.mapping.orm.ExternalMappedSuperClassEntity;
+import org.eclipse.persistence.tools.mapping.orm.ExternalMappedSuperClass;
import org.eclipse.persistence.tools.mapping.orm.ExternalNamedQuery;
import org.eclipse.persistence.tools.mapping.orm.ExternalNativeQuery;
import org.eclipse.persistence.tools.mapping.orm.ExternalORMConfiguration;
import org.eclipse.persistence.tools.mapping.orm.ExternalObjectTypeConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalPersistenceUnit;
-import org.eclipse.persistence.tools.mapping.orm.ExternalSQLResultSetMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalSequenceGenerator;
+import org.eclipse.persistence.tools.mapping.orm.ExternalSQLResultSetMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalStoredProcedureQuery;
import org.eclipse.persistence.tools.mapping.orm.ExternalStructConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalTableGenerator;
@@ -42,84 +43,52 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalTypeConverter;
import org.eclipse.persistence.tools.mapping.orm.ORMDocumentType;
import org.eclipse.persistence.tools.utility.ObjectTools;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-
import static org.eclipse.persistence.tools.mapping.orm.ORMXmlConstants.*;
import static org.eclipse.persistence.tools.mapping.orm.XmlConstants.*;
/**
* The external form interacting with the XML document for the ORM Configuration file.
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
@SuppressWarnings({"nls", "unused"}) // unused used for the import statement: see bug 330740
-final class ORMConfiguration extends AbstractExternalForm
- implements ExternalORMConfiguration {
+public final class ORMConfiguration extends AbstractExternalForm
+ implements ExternalORMConfiguration {
/**
- * The root document that represents this orm config's xml.
+ * The helper is used when the document needs to be modified.
*/
- private Document document;
-
- /**
- * The element name of the child text node for the access type.
- */
- static final String ACCESS = "access";
-
- /**
- * The element name of the child text node for the default catalog name.
- */
- static final String CATALOG = "catalog";
-
- /**
- * The element name of the child text node for the description.
- */
- static final String DESCRIPTION = "description";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String ENTITY_MAPPINGS = "entity-mappings";
-
- /**
- * The element name of the child text node for the default package name.
- */
- static final String PACKAGE = "package";
-
- /**
- * The element name of the child text node for the default schema name.
- */
- static final String SCHEMA = "schema";
+ private final ExternalFormHelper helper;
/**
* Creates a new <code>ORMConfiguration</code>.
*
- * @param xmlModel The XML model containing the actual information
- * @param sourceRoot The root location of the ORM configuration file
+ * @param helper The helper is used when the document needs to be modified
*/
- ORMConfiguration(Document document) {
+ public ORMConfiguration(ExternalFormHelper helper) {
super(null);
- this.document = document;
+ this.helper = helper;
}
/**
* {@inheritDoc}
*/
@Override
- public ExternalConverter addConverter(int index) {
- Converter converter = buildConverter(index);
+ public ExternalConverter addConverter() {
+ Converter converter = buildConverter(-1);
converter.addSelf();
return converter;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public ExternalTenantDiscriminatorColumn addDiscriminatorColumn(int index) {
- TenantDiscriminatorColumn column = buildDiscriminatorColumn(index);
+ public ExternalTenantDiscriminatorColumn addDiscriminatorColumn() {
+ TenantDiscriminatorColumn column = buildDiscriminatorColumn(-1);
column.addSelf();
return column;
}
@@ -128,21 +97,21 @@
* {@inheritDoc}
*/
@Override
- public void addEmbeddableEntity(int index, String className) {
- EmbeddableEntity entity = buildEmbeddableEntity(index);
- entity.addSelf();
- entity.setClassName(className);
+ public ExternalEmbeddable addEmbeddable(String className) {
+ Embeddable embeddable = buildEmbeddable(-1);
+ embeddable.addSelf();
+ embeddable.setClassName(className);
+ return embeddable;
}
/**
* {@inheritDoc}
*/
@Override
- public ExternalEmbeddableEntity addEmbeddableEntity(String className) {
- EmbeddableEntity entity = buildEmbeddableEntity(embeddableEntitiesSize());
+ public ExternalEntity addEntity(String className) {
+ Entity entity = buildEntity(-1);
entity.addSelf();
entity.setClassName(className);
-
return entity;
}
@@ -150,54 +119,22 @@
* {@inheritDoc}
*/
@Override
- public void addEntity(int index, String className) {
- Entity entity = buildEntity(index);
- entity.addSelf();
- entity.setClassName(className);
+ public ExternalMappedSuperClass addMappedSuperClass(String className) {
+ MappedSuperClassEntity mappedSuperclass = buildMappedSuperclass(-1);
+ mappedSuperclass.addSelf();
+ mappedSuperclass.setClassName(className);
+ return mappedSuperclass;
}
/**
* {@inheritDoc}
*/
@Override
- public ExternalEntity addEntity(String entityClassName) {
-
- Entity entity = buildEntity(entitiesSize());
- entity.addSelf();
- entity.setClassName(entityClassName);
-
- return entity;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addMappedSuperClass(int index, String className) {
- MappedSuperClassEntity entity = buildMappedSuperclass(index);
- entity.addSelf();
- entity.setClassName(className);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addNamedNativeQuery(int index, String name) {
- NamedNativeQuery namedNativeQuery = buildNamedNativeQuery(index);
- namedNativeQuery.addSelf();
- namedNativeQuery.setName(name);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ExternalNamedQuery addNamedQuery(int index, String name) {
- NamedQuery namedQuery = buildNamedQuery(index);
- namedQuery.addSelf();
- namedQuery.setName(name);
- return namedQuery;
+ public ExternalNativeQuery addNamedNativeQuery(String name) {
+ NamedNativeQuery query = buildNamedNativeQuery(-1);
+ query.addSelf();
+ query.setName(name);
+ return query;
}
/**
@@ -205,18 +142,18 @@
*/
@Override
public ExternalNamedQuery addNamedQuery(String name) {
- NamedQuery namedQuery = buildNamedQuery(namedQueriesSize());
- namedQuery.addSelf();
- namedQuery.setName(name);
- return namedQuery;
+ NamedQuery query = buildNamedQuery(-1);
+ query.addSelf();
+ query.setName(name);
+ return query;
}
/**
* {@inheritDoc}
*/
@Override
- public ExternalObjectTypeConverter addObjectTypeConverter(int index) {
- ObjectTypeConverter converter = buildObjectTypeConverter(index);
+ public ExternalObjectTypeConverter addObjectTypeConverter() {
+ ObjectTypeConverter converter = buildObjectTypeConverter(-1);
converter.addSelf();
return converter;
}
@@ -225,6 +162,16 @@
* {@inheritDoc}
*/
@Override
+ public ExternalPersistenceUnit addPersistenceUnitMetaData() {
+ PersistenceUnit persistenceUnit = buildPersistenceUnit();
+ persistenceUnit.addSelf();
+ return persistenceUnit;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected Element addSelf(String elementName) {
return addSelf(elementName, Collections.<String>emptyList());
}
@@ -233,58 +180,50 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
-
- Document document = getDocument();
-
- Element element = document.createElementNS(ECLIPSELINK_ORM_NAMESPACE_URI, elementName);
- element.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", ECLIPSELINK_ORM_NAMESPACE_URI);
- addXmlns(element, "xsi", XSI_URI);
- element.setAttributeNS(XSI_URI, XSD_URI_ATTRIBUTE, buildSchemaLocation(ORMDocumentType.ECLIPELINK_2_5));
- element.setAttribute(VERSION, getBuildVersion());
-
- document.appendChild(element);
-
- return element;
+ public Element addSelf(String elementName, List<String> elementNamesOrder) {
+ return getHelper().buildORMConfiguration(this);
}
/**
* {@inheritDoc}
*/
@Override
- public void addSequenceGenerator(int index, String name) {
- SequenceGenerator sequenceGenerator = buildSequenceGenerator(index);
+ public ExternalSequenceGenerator addSequenceGenerator(String name) {
+ SequenceGenerator sequenceGenerator = buildSequenceGenerator(-1);
sequenceGenerator.addSelf();
sequenceGenerator.setName(name);
+ return sequenceGenerator;
}
/**
* {@inheritDoc}
*/
@Override
- public void addSqlResultSetMapping(int index, String name) {
- SQLResultSetMapping sqlResultSetMapping = buildSqlResultSetMapping(index);
+ public ExternalSQLResultSetMapping addSqlResultSetMapping(String name) {
+ SQLResultSetMapping sqlResultSetMapping = buildSqlResultSetMapping(-1);
sqlResultSetMapping.addSelf();
sqlResultSetMapping.setName(name);
+ return sqlResultSetMapping;
}
/**
* {@inheritDoc}
*/
@Override
- public void addStoredProcedureQuery(int index, String name, String procedureName) {
- NamedStoredProcedureQuery storedProcedureQuery = buildStoredProcedureQuery(index);
- storedProcedureQuery.addSelf();
- storedProcedureQuery.setName(name);
- storedProcedureQuery.setProcedureName(procedureName);
+ public ExternalStoredProcedureQuery addStoredProcedureQuery(String name, String procedureName) {
+ NamedStoredProcedureQuery query = buildStoredProcedureQuery(-1);
+ query.addSelf();
+ query.setName(name);
+ query.setProcedureName(procedureName);
+ return query;
}
/**
* {@inheritDoc}
*/
@Override
- public ExternalStructConverter addStructConverter(int index) {
- StructConverter converter = buildStructConverter(index);
+ public ExternalStructConverter addStructConverter() {
+ StructConverter converter = buildStructConverter(-1);
converter.addSelf();
return converter;
}
@@ -293,18 +232,19 @@
* {@inheritDoc}
*/
@Override
- public void addTableGenerator(int index, String name) {
- TableGenerator sequenceGenerator = buildTableGenerator(index);
- sequenceGenerator.addSelf();
- sequenceGenerator.setName(name);
+ public ExternalTableGenerator addTableGenerator(String name) {
+ TableGenerator generator = buildTableGenerator(-1);
+ generator.addSelf();
+ generator.setName(name);
+ return generator;
}
/**
* {@inheritDoc}
*/
@Override
- public ExternalTypeConverter addTypeConverter(int index) {
- TypeConverter converter = buildTypeConverter(index);
+ public ExternalTypeConverter addTypeConverter() {
+ TypeConverter converter = buildTypeConverter(-1);
converter.addSelf();
return converter;
}
@@ -342,12 +282,12 @@
names.add(SQLResultSetMapping.SQL_RESULT_SET_MAPPING);
names.add(MappedSuperClassEntity.MAPPED_SUPERCLASS);
names.add(Entity.ENTITY);
- names.add(EmbeddableEntity.EMBEDDABLE);
+ names.add(Embeddable.EMBEDDABLE);
return names;
}
- private EmbeddableEntity buildEmbeddableEntity(int index) {
- return new EmbeddableEntity(this, index);
+ private Embeddable buildEmbeddable(int index) {
+ return new Embeddable(this, index);
}
private Entity buildEntity(int index) {
@@ -374,17 +314,7 @@
return new PersistenceUnit(this);
}
- /**
- * {@inheritDoc}
- */
- @Override
- public ExternalPersistenceUnit buildPersistenceUnitMetaData() {
- PersistenceUnit persistenceUnit = buildPersistenceUnit();
- persistenceUnit.addSelf();
- return persistenceUnit;
- }
-
- private String buildSchemaLocation(ORMDocumentType version) {
+ public String buildSchemaLocation(ORMDocumentType version) {
StringBuilder sb = new StringBuilder();
sb.append(version.getXmlNamespace());
@@ -422,17 +352,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalConverter> converters() {
+ public List<ExternalConverter> converters() {
int count = convertersSize();
List<ExternalConverter> converters = new ArrayList<ExternalConverter>(count);
- for (int index = count; --index >= 0;) {
- ExternalConverter converter = buildConverter(index);
- converters.add(0, converter);
+ for (int index = 0; index < count; index++) {
+ converters.add(buildConverter(index));
}
- return new ListListIterable<ExternalConverter>(converters);
+ return converters;
}
/**
@@ -443,20 +372,25 @@
return getChildrenSize(Converter.CONVERTER);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public ListIterable<ExternalTenantDiscriminatorColumn> discriminatorColumns() {
+ public List<ExternalTenantDiscriminatorColumn> discriminatorColumns() {
+
int count = discriminatorColumnSize();
List<ExternalTenantDiscriminatorColumn> columns = new ArrayList<ExternalTenantDiscriminatorColumn>(count);
- for (int index = count; --index >= 0; )
- {
- ExternalTenantDiscriminatorColumn column = buildDiscriminatorColumn(index);
- columns.add(0, column);
+ for (int index = 0; index < count; index++) {
+ columns.add(buildDiscriminatorColumn(index));
}
- return new ListListIterable<ExternalTenantDiscriminatorColumn>(columns);
+ return columns;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public int discriminatorColumnSize() {
return getChildrenSize(TenantDiscriminatorColumn.TENANT_DISCRIMINATOR_COLUMN);
@@ -466,42 +400,40 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalEmbeddableEntity> embeddableEntities() {
+ public List<ExternalEmbeddable> embeddables() {
- int count = embeddableEntitiesSize();
- List<ExternalEmbeddableEntity> entities = new ArrayList<ExternalEmbeddableEntity>(count);
+ int count = embeddablesSize();
+ List<ExternalEmbeddable> embeddables = new ArrayList<ExternalEmbeddable>(count);
- for (int index = count; --index >= 0;) {
- ExternalEmbeddableEntity entity = buildEmbeddableEntity(index);
- entities.add(0, entity);
+ for (int index = 0; index < count; index++) {
+ embeddables.add(buildEmbeddable(index));
}
- return new ListListIterable<ExternalEmbeddableEntity>(entities);
+ return embeddables;
}
/**
* {@inheritDoc}
*/
@Override
- public int embeddableEntitiesSize() {
- return getChildrenSize(EmbeddableEntity.EMBEDDABLE);
+ public int embeddablesSize() {
+ return getChildrenSize(Embeddable.EMBEDDABLE);
}
/**
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalEntity> entities() {
+ public List<ExternalEntity> entities() {
int count = entitiesSize();
List<ExternalEntity> entities = new ArrayList<ExternalEntity>(count);
- for (int index = count; --index >= 0;) {
- ExternalEntity entity = buildEntity(index);
- entities.add(0, entity);
+ for (int index = 0; index < count; index++) {
+ entities.add(buildEntity(index));
}
- return new ListListIterable<ExternalEntity>(entities);
+ return entities;
}
/**
@@ -524,6 +456,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getAccessTypeTextRange() {
+ return getChildTextNodeTextRange(ACCESS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getBuildVersion() {
return VERSION_2_0;
}
@@ -540,15 +480,23 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getCatalogNameTextRange() {
+ return getChildTextNodeTextRange(CATALOG);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalConverter getConverter(int index) {
Element element = getChild(Converter.CONVERTER, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildConverter(index);
}
- return buildConverter(index);
+ return null;
}
/**
@@ -559,23 +507,17 @@
return getChildTextNode(DESCRIPTION);
}
- @Override
- public ExternalTenantDiscriminatorColumn getDiscriminatorColumn(int index) {
- Element element = getChild(TenantDiscriminatorColumn.TENANT_DISCRIMINATOR_COLUMN, index);
-
- if (element == null) {
- return null;
- }
-
- return buildDiscriminatorColumn(index);
- }
-
/**
* {@inheritDoc}
*/
@Override
- protected Document getDocument() {
- return this.document;
+ public ExternalTenantDiscriminatorColumn getDiscriminatorColumn(int index) {
+
+ if (hasChild(TenantDiscriminatorColumn.TENANT_DISCRIMINATOR_COLUMN, index)) {
+ return buildDiscriminatorColumn(index);
+ }
+
+ return null;
}
/**
@@ -598,7 +540,7 @@
* {@inheritDoc}
*/
@Override
- protected String getElementName() {
+ public String getElementName() {
return ENTITY_MAPPINGS;
}
@@ -606,15 +548,30 @@
* {@inheritDoc}
*/
@Override
- public ExternalEmbeddableEntity getEmbeddableEntity(int index) {
+ public ExternalEmbeddable getEmbeddable(int index) {
- Element element = getChild(EmbeddableEntity.EMBEDDABLE, index);
+ Element element = getChild(Embeddable.EMBEDDABLE, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildEmbeddable(index);
}
- return buildEmbeddableEntity(index);
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ExternalEmbeddable getEmbeddable(String className) {
+
+ for (ExternalEmbeddable embeddable : embeddables()) {
+ if (ObjectTools.equals(embeddable.getClassName(), className)) {
+ return embeddable;
+ }
+ }
+
+ return null;
}
/**
@@ -625,15 +582,19 @@
Element element = getChild(Entity.ENTITY, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildEntity(index);
}
- return buildEntity(index);
+ return null;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public ExternalEntity getEntity(String className) {
+
for (ExternalEntity entity : entities()) {
if (ObjectTools.equals(entity.getClassName(), className)) {
return entity;
@@ -647,15 +608,46 @@
* {@inheritDoc}
*/
@Override
- public ExternalMappedSuperClassEntity getMappedSuperClass(int index) {
+ protected ExternalFormHelper getHelper() {
+ return helper;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public URL getLocation() {
+ return helper.getLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ExternalMappedSuperClass getMappedSuperClass(int index) {
Element element = getChild(MappedSuperClassEntity.MAPPED_SUPERCLASS, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildMappedSuperclass(index);
}
- return buildMappedSuperclass(index);
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ExternalMappedSuperClass getMappedSuperClass(String className) {
+
+ for (ExternalMappedSuperClass entity : mappedSuperClasses()) {
+ if (ObjectTools.equals(entity.getClassName(), className)) {
+ return entity;
+ }
+ }
+
+ return null;
}
/**
@@ -666,11 +658,26 @@
Element element = getChild(NamedNativeQuery.NAMED_NATIVE_QUERY, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildNamedNativeQuery(index);
}
- return buildNamedNativeQuery(index);
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ExternalNativeQuery getNamedNativeQuery(String queryName) {
+
+ for (ExternalNativeQuery namedQuery : namedNativeQueries()) {
+ if (namedQuery.getName().equals(queryName)) {
+ return namedQuery;
+ }
+ }
+
+ return null;
}
/**
@@ -681,11 +688,11 @@
Element element = getChild(NamedQuery.NAMED_QUERY, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildNamedQuery(index);
}
- return buildNamedQuery(index);
+ return null;
}
/**
@@ -693,11 +700,13 @@
*/
@Override
public ExternalBasicNamedQuery getNamedQuery(String queryName) {
+
for (ExternalNamedQuery namedQuery : namedQueries()) {
if (namedQuery.getName().equals(queryName)) {
- return (ExternalBasicNamedQuery)namedQuery;
+ return (ExternalBasicNamedQuery) namedQuery;
}
}
+
return null;
}
@@ -709,7 +718,7 @@
Element element = getChild(ObjectTypeConverter.OBJECT_TYPE_CONVERTER, index);
- if (element == null) {
+ if (element != null) {
return null;
}
@@ -728,15 +737,31 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getPackageNameTextRange() {
+ return getChildTextNodeTextRange(PACKAGE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public PersistenceUnit getPersistenceUnitMetaData() {
Element element = getChild(PersistenceUnit.PERSISTENCE_UNIT_METADATA);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildPersistenceUnit();
}
- return buildPersistenceUnit();
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getRootElementTextRange() {
+ return getElementNameTextRange(getRootElement());
}
/**
@@ -751,15 +776,23 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getSchemaNameTextRange() {
+ return getChildTextNodeTextRange(SCHEMA);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalSequenceGenerator getSequenceGenerator(int index) {
Element element = getChild(SequenceGenerator.SEQUENCE_GENERATOR, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildSequenceGenerator(index);
}
- return buildSequenceGenerator(index);
+ return null;
}
/**
@@ -770,11 +803,11 @@
Element element = getChild(SQLResultSetMapping.SQL_RESULT_SET_MAPPING, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildSqlResultSetMapping(index);
}
- return buildSqlResultSetMapping(index);
+ return null;
}
/**
@@ -785,30 +818,11 @@
Element element = getChild(NamedStoredProcedureQuery.NAMED_STORED_PROCEDURE_QUERY, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildStoredProcedureQuery(index);
}
- return buildStoredProcedureQuery(index);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ExternalStoredProcedureQuery getStoredProcedureQuery(int index, String name) {
-
- ExternalStoredProcedureQuery storedProcedureQuery = getStoredProcedureQuery(index);
-
- if (storedProcedureQuery == null) {
- return null;
- }
-
- if (ObjectTools.notEquals(name, storedProcedureQuery.getName())) {
- storedProcedureQuery = null;
- }
-
- return storedProcedureQuery;
+ return null;
}
/**
@@ -819,11 +833,11 @@
Element element = getChild(StructConverter.STRUCT_CONVERTER, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildStructConverter(index);
}
- return buildStructConverter(index);
+ return null;
}
/**
@@ -834,11 +848,11 @@
Element element = getChild(TableGenerator.TABLE_GENERATOR, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildTableGenerator(index);
}
- return buildTableGenerator(index);
+ return null;
}
/**
@@ -849,11 +863,11 @@
Element element = getChild(TypeConverter.TYPE_CONVERTER, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildTypeConverter(index);
}
- return buildTypeConverter(index);
+ return null;
}
/**
@@ -861,6 +875,7 @@
*/
@Override
public String getXML() {
+
try {
// write the content into xml file
@@ -874,7 +889,8 @@
return ouput.toString();
- } catch (Exception e) {
+ }
+ catch (Exception e) {
throw new RuntimeException(e);
}
}
@@ -883,17 +899,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalMappedSuperClassEntity> mappedSuperClasses() {
+ public List<ExternalMappedSuperClass> mappedSuperClasses() {
int count = mappedSuperClassesSize();
- List<ExternalMappedSuperClassEntity> entities = new ArrayList<ExternalMappedSuperClassEntity>(count);
+ List<ExternalMappedSuperClass> mappedSuperclasses = new ArrayList<ExternalMappedSuperClass>(count);
- for (int index = count; --index >= 0;) {
- ExternalMappedSuperClassEntity entity = buildMappedSuperclass(index);
- entities.add(0, entity);
+ for (int index = 0; index < count; index++) {
+ mappedSuperclasses.add(buildMappedSuperclass(index));
}
- return new ListListIterable<ExternalMappedSuperClassEntity>(entities);
+ return mappedSuperclasses;
}
/**
@@ -908,17 +923,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalNativeQuery> namedNativeQueries() {
+ public List<ExternalNativeQuery> namedNativeQueries() {
int count = namedNativeQueriesSize();
List<ExternalNativeQuery> nativeQueries = new ArrayList<ExternalNativeQuery>(count);
- for (int index = count; --index >= 0;) {
- ExternalNativeQuery nativeQuery = buildNamedNativeQuery(index);
- nativeQueries.add(0, nativeQuery);
+ for (int index = 0; index < count; index++) {
+ nativeQueries.add(buildNamedNativeQuery(index));
}
- return new ListListIterable<ExternalNativeQuery>(nativeQueries);
+ return nativeQueries;
}
/**
@@ -933,17 +947,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalNamedQuery> namedQueries() {
+ public List<ExternalNamedQuery> namedQueries() {
int count = namedQueriesSize();
List<ExternalNamedQuery> namedQueries = new ArrayList<ExternalNamedQuery>(count);
- for (int index = count; --index >= 0;) {
- ExternalNamedQuery namedQuery = buildNamedQuery(index);
- namedQueries.add(0, namedQuery);
+ for (int index = 0; index < count; index++) {
+ namedQueries.add(buildNamedQuery(index));
}
- return new ListListIterable<ExternalNamedQuery>(namedQueries);
+ return namedQueries;
}
/**
@@ -958,17 +971,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalObjectTypeConverter> objectTypeConverters() {
+ public List<ExternalObjectTypeConverter> objectTypeConverters() {
int count = objectTypeConvertersSize();
List<ExternalObjectTypeConverter> converters = new ArrayList<ExternalObjectTypeConverter>(count);
- for (int index = count; --index >= 0;) {
- ExternalObjectTypeConverter converter = buildObjectTypeConverter(index);
- converters.add(0, converter);
+ for (int index = 0; index < count; index++) {
+ converters.add(buildObjectTypeConverter(index));
}
- return new ListListIterable<ExternalObjectTypeConverter>(converters);
+ return converters;
}
/**
@@ -988,6 +1000,9 @@
converter.removeSelf();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void removeDiscriminatorColumn(int index) {
TenantDiscriminatorColumn column = buildDiscriminatorColumn(index);
@@ -998,8 +1013,8 @@
* {@inheritDoc}
*/
@Override
- public void removeEmbeddableEntity(int index) {
- EmbeddableEntity entity = buildEmbeddableEntity(index);
+ public void removeEmbeddable(int index) {
+ Embeddable entity = buildEmbeddable(index);
entity.removeSelf();
}
@@ -1049,10 +1064,11 @@
*/
@Override
public void removeNamedQuery(String queryName) {
+
for (ExternalNamedQuery query : namedQueries()) {
- if (query.getName().equals(queryName)) {
+ if (ObjectTools.equals(query.getName(), queryName)) {
((NamedQuery)query).removeSelf();
- return;
+ break;
}
}
}
@@ -1142,17 +1158,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalSequenceGenerator> sequenceGenerators() {
+ public List<ExternalSequenceGenerator> sequenceGenerators() {
int count = sequenceGeneratorsSize();
- List<ExternalSequenceGenerator> sequenceGenerators = new ArrayList<ExternalSequenceGenerator>(count);
+ List<ExternalSequenceGenerator> generators = new ArrayList<ExternalSequenceGenerator>(count);
- for (int index = count; --index >= 0;) {
- ExternalSequenceGenerator sequenceGenerator = buildSequenceGenerator(index);
- sequenceGenerators.add(0, sequenceGenerator);
+ for (int index = 0; index < count; index++) {
+ generators.add(buildSequenceGenerator(index));
}
- return new ListListIterable<ExternalSequenceGenerator>(sequenceGenerators);
+ return generators;
}
/**
@@ -1216,17 +1231,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalSQLResultSetMapping> sqlResultSetMappings() {
+ public List<ExternalSQLResultSetMapping> sqlResultSetMappings() {
int count = sqlResultSetMappingsSize();
List<ExternalSQLResultSetMapping> sqlResultSetMappings = new ArrayList<ExternalSQLResultSetMapping>(count);
- for (int index = count; --index >= 0;) {
- ExternalSQLResultSetMapping sqlResultSetMapping = buildSqlResultSetMapping(index);
- sqlResultSetMappings.add(0, sqlResultSetMapping);
+ for (int index = 0; index < count; index++) {
+ sqlResultSetMappings.add(buildSqlResultSetMapping(index));
}
- return new ListListIterable<ExternalSQLResultSetMapping>(sqlResultSetMappings);
+ return sqlResultSetMappings;
}
/**
@@ -1241,17 +1255,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalStoredProcedureQuery> storedProcedureQueries() {
+ public List<ExternalStoredProcedureQuery> storedProcedureQueries() {
int count = storedProcedureQueriesSize();
List<ExternalStoredProcedureQuery> storedProcedureQueries = new ArrayList<ExternalStoredProcedureQuery>(count);
- for (int index = count; --index >= 0;) {
- ExternalStoredProcedureQuery nativeQuery = buildStoredProcedureQuery(index);
- storedProcedureQueries.add(0, nativeQuery);
+ for (int index = 0; index < count; index++) {
+ storedProcedureQueries.add(buildStoredProcedureQuery(index));
}
- return new ListListIterable<ExternalStoredProcedureQuery>(storedProcedureQueries);
+ return storedProcedureQueries;
}
/**
@@ -1266,16 +1279,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalStructConverter> structConverters() {
+ public List<ExternalStructConverter> structConverters() {
+
int count = structConvertersSize();
List<ExternalStructConverter> converters = new ArrayList<ExternalStructConverter>(count);
- for (int index = count; --index >= 0;) {
- ExternalStructConverter converter = buildStructConverter(index);
- converters.add(0, converter);
+ for (int index = 0; index < count; index++) {
+ converters.add(buildStructConverter(index));
}
- return new ListListIterable<ExternalStructConverter>(converters);
+ return converters;
}
/**
@@ -1290,17 +1303,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalTableGenerator> tableGenerators() {
+ public List<ExternalTableGenerator> tableGenerators() {
int count = tableGeneratorsSize();
- List<ExternalTableGenerator> tableGenerators = new ArrayList<ExternalTableGenerator>(count);
+ List<ExternalTableGenerator> generators = new ArrayList<ExternalTableGenerator>(count);
- for (int index = count; --index >= 0;) {
- ExternalTableGenerator tableGenerator = buildTableGenerator(index);
- tableGenerators.add(0, tableGenerator);
+ for (int index = 0; index < count; index++) {
+ generators.add(buildTableGenerator(index));
}
- return new ListListIterable<ExternalTableGenerator>(tableGenerators);
+ return generators;
}
/**
@@ -1315,17 +1327,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalTypeConverter> typeConverters() {
+ public List<ExternalTypeConverter> typeConverters() {
int count = typeConvertersSize();
List<ExternalTypeConverter> converters = new ArrayList<ExternalTypeConverter>(count);
- for (int index = count; --index >= 0;) {
- ExternalTypeConverter converter = buildTypeConverter(index);
- converters.add(0, converter);
+ for (int index = 0; index < count; index++) {
+ converters.add(buildTypeConverter(index));
}
- return new ListListIterable<ExternalTypeConverter>(converters);
+ return converters;
}
/**
@@ -1335,30 +1346,4 @@
public int typeConvertersSize() {
return getChildrenSize(TypeConverter.TYPE_CONVERTER);
}
-
- /**
- * Simple buffer implementation of an {@link OutputStream} that allows for capturing the stream as a String.
- */
- public class StringOutputStream extends OutputStream {
-
- private StringBuffer buffer = new StringBuffer();
-
- public StringOutputStream() {
- super();
- }
-
- public void clear() {
- this.buffer.delete(0, this.buffer.length());
- }
-
- @Override
- public String toString() {
- return this.buffer.toString();
- }
-
- @Override
- public void write(int bt) throws IOException {
- this.buffer.append((char) bt);
- }
- }
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMRepository.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMRepository.java
index feed239..91f539b 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMRepository.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,14 +14,19 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.eclipse.persistence.tools.mapping.DefaultFormHelper;
import org.eclipse.persistence.tools.mapping.orm.ExternalORMConfiguration;
import org.eclipse.persistence.tools.mapping.orm.ExternalORMRepository;
import org.eclipse.persistence.tools.mapping.orm.ORMDocumentType;
import org.eclipse.persistence.tools.utility.XMLTools;
+import org.eclipse.persistence.tools.utility.iterable.EmptyIterable;
import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
/**
* Defines the concrete implementation of {@link ExternalORMRepository}. This ORM repository knows
@@ -32,8 +37,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
- * @author John Bracken
+ * @version 2.6
*/
@SuppressWarnings("nls")
public final class ORMRepository implements ExternalORMRepository {
@@ -45,39 +49,79 @@
super();
}
- /**
- * {@inheritDoc}
- */
- @Override
- public ExternalORMConfiguration buildORMConfiguration(ORMDocumentType docType) {
-
- // Create the external form
- ORMConfiguration ormConfiguration = new ORMConfiguration(XMLTools.newDocument());
- ormConfiguration.addSelf();
- ormConfiguration.setDocumentType(docType);
-
- return ormConfiguration;
+ private DocumentBuilder buildDocumentBuilder() throws ParserConfigurationException {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(false);
+ return factory.newDocumentBuilder();
}
/**
* {@inheritDoc}
*/
@Override
+ public ExternalORMConfiguration buildORMConfiguration(URL location, ORMDocumentType docType) throws IOException {
+ DefaultFormHelper helper = new DefaultFormHelper(XMLTools.newDocument(), location);
+ ORMConfiguration ormConfiguration = new ORMConfiguration(helper);
+ ormConfiguration.setDocumentType(docType);
+ return ormConfiguration;
+ }
+
public ORMConfiguration getORMConfiguration(String ormXML) {
+
try {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setValidating(false);
- dbf.setNamespaceAware(false);
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document doc = db.parse(new InputSource(
+
+ Document document = buildDocumentBuilder().parse(
new ByteArrayInputStream(ormXML.getBytes("utf-8"))
- ));
- return new ORMConfiguration(doc);
+ );
+
+ DefaultFormHelper helper = new DefaultFormHelper(document, null);
+ return new ORMConfiguration(helper);
}
- catch (Exception e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
+ catch (Exception e) {
+ e.printStackTrace();
+ return null;
}
- return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @SuppressWarnings("resource")
+ public ORMConfiguration getORMConfiguration(URL location) {
+
+ InputStream inputStream = null;
+
+ try {
+
+ inputStream = location.openStream();
+ Document document = buildDocumentBuilder().parse(inputStream);
+
+ DefaultFormHelper helper = new DefaultFormHelper(document, location);
+ return new ORMConfiguration(helper);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ finally {
+ try {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Iterable<URL> ormConfigurationLocations() {
+ return EmptyIterable.instance();
}
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ObjectCollectionMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ObjectCollectionMapping.java
index a9af6cc..a04b7d4 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ObjectCollectionMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ObjectCollectionMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -23,8 +23,7 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalObjectCollectionMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalOrderColumn;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -32,81 +31,18 @@
*
* @see EmbeddableEntity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
abstract class ObjectCollectionMapping extends RelationshipMapping
implements ExternalObjectCollectionMapping {
/**
- * The attribute name used to store and retrieve the class property.
- */
- static final String CLASS = "class";
-
- /**
- * The element name used to store and retrieve the map-key child node.
- */
- static final String MAP_KEY = "map-key";
-
- /**
- * The element name used to store and retrieve the map-key-association child nodes.
- */
- static final String MAP_KEY_ASSOCIATION_OVERRIDE = "map-key-association-override";
-
- /**
- * The element name used to store and retrieve the map-key-attribute child nodes.
- */
- static final String MAP_KEY_ATTRIBUTE_OVERRIDE = "map-key-attribute-override";
-
- /**
- * The element name used to store and retrieve the map-key-class child node.
- */
- static final String MAP_KEY_CLASS = "map-key-class";
-
- /**
- * The element name used to store and retrieve the map-key-column child node.
- */
- static final String MAP_KEY_COLUMN = "map-key-column";
-
- /**
- * The element name used to store and retrieve the map-key-convert child node.
- */
- static final String MAP_KEY_CONVERT = "map-key-convert";
-
- /**
- * The element name used to store and retrieve the map-key-enumerated child node.
- */
- static final String MAP_KEY_ENUMERATED = "map-key-enumerated";
-
- /**
- * The element name used to store and retrieve the map-key-join-column child node.
- */
- static final String MAP_KEY_JOIN_COLUMN = "map-key-join-column";
-
- /**
- * The element name used to store and retrieve the map-key-temporal child node.
- */
- static final String MAP_KEY_TEMPORAL = "map-key-temporal";
-
- /**
- * The attribute name used to store and retrieve the mapped-by property.
- */
- static final String MAPPED_BY = "mapped-by";
-
- /**
- * The element name used to store and retrieve the order-by child text node.
- */
- static final String ORDER_BY = "order-by";
-
- /**
* Creates a new <code>ObjectCollectionMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- ObjectCollectionMapping(EmbeddableEntity parent, int index) {
+ ObjectCollectionMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -114,8 +50,8 @@
* {@inheritDoc}
*/
@Override
- public ExternalAssociationOverride addMapKeyAssociationOverride(int index) {
- AssociationOverride associationOverride = buildMapKeyAssociationOverride(mapKeyAssociationOverridesSize());
+ public ExternalAssociationOverride addMapKeyAssociationOverride() {
+ AssociationOverride associationOverride = buildMapKeyAssociationOverride(-1);
associationOverride.addSelf();
return associationOverride;
}
@@ -124,8 +60,8 @@
* {@inheritDoc}
*/
@Override
- public ExternalAttributeOverride addMapKeyAttributeOverride(int index) {
- AttributeOverride attributeOverride = buildMapKeyAttributeOverride(mapKeyAttributeOverridesSize());
+ public ExternalAttributeOverride addMapKeyAttributeOverride() {
+ AttributeOverride attributeOverride = buildMapKeyAttributeOverride(-1);
attributeOverride.addSelf();
return attributeOverride;
}
@@ -134,64 +70,34 @@
* {@inheritDoc}
*/
@Override
- public void addMapKeyColumn() {
+ public ExternalEntityColumn addMapKeyColumn() {
EntityColumn column = buildColumn(MAP_KEY_COLUMN);
column.addSelf();
+ return column;
}
/**
* {@inheritDoc}
*/
@Override
- public void addMapKeyJoinColumn(int index, String name) {
- JoinColumn joinColumn = buildJoinColumn(MAP_KEY_JOIN_COLUMN, index);
- joinColumn.addSelf();
+ public ExternalJoinColumn addMapKeyJoinColumn(String name) {
+ JoinColumn joinColumn = buildJoinColumn(MAP_KEY_JOIN_COLUMN, -1);
joinColumn.setName(name);
+ return joinColumn;
}
/**
* {@inheritDoc}
*/
@Override
- public void addOrderColumn() {
+ public ExternalOrderColumn addOrderColumn() {
OrderColumn orderColumn = buildOrderColumn();
orderColumn.addSelf();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected List<String> buildAttributeNamesOrder() {
- List<String> names = new ArrayList<String>();
- names.add(NAME);
- names.add(TARGET_ENTITY);
- names.add(FETCH);
- names.add(ACCESS);
- names.add(MAPPED_BY);
- names.add(ATTRIBUTE_TYPE);
- return names;
+ return orderColumn;
}
private EntityColumn buildColumn(String elementName) {
- return new EntityColumn(this, elementName);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected List<String> buildElementNamesOrder() {
- List<String> names = new ArrayList<String>();
- names.add(ORDER_BY);
- names.add(OrderColumn.ORDER_COLUMN);
- names.add(MAP_KEY);
- names.add(MAP_KEY_CLASS);
- names.add(MAP_KEY_COLUMN);
- names.add(MAP_KEY_JOIN_COLUMN);
- names.add(JoinTable.JOIN_TABLE);
- names.add(CASCADE);
- return names;
+ return new EntityColumn(this, elementName, -1);
}
final JoinColumn buildJoinColumn(String elementName, int index) {
@@ -226,11 +132,11 @@
Element element = getChild(MAP_KEY_ASSOCIATION_OVERRIDE, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildMapKeyAssociationOverride(index);
}
- return buildMapKeyAssociationOverride(index);
+ return null;
}
/**
@@ -241,11 +147,11 @@
Element element = getChild(MAP_KEY_ATTRIBUTE_OVERRIDE, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildMapKeyAttributeOverride(index);
}
- return buildMapKeyAttributeOverride(index);
+ return null;
}
/**
@@ -260,6 +166,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMapKeyClassNameTextRange() {
+ return getChildAttributeTextRange(MAP_KEY_CLASS, CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalEntityColumn getMapKeyColumn() {
if (hasChild(MAP_KEY_COLUMN)) {
@@ -281,6 +195,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMapKeyConverterNameTextRange() {
+ return getChildTextNodeTextRange(MAP_KEY_CONVERT);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public EnumType getMapKeyEnumeratedType() {
return getChildEnumNode(MAP_KEY_ENUMERATED, EnumType.class);
}
@@ -289,15 +211,23 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMapKeyEnumeratedTypeTextRange() {
+ return getChildTextNodeTextRange(MAP_KEY_ENUMERATED);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalJoinColumn getMapKeyJoinColumn(int index) {
Element element = getChild(MAP_KEY_JOIN_COLUMN, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildJoinColumn(MAP_KEY_JOIN_COLUMN, index);
}
- return buildJoinColumn(MAP_KEY_JOIN_COLUMN, index);
+ return null;
}
/**
@@ -312,6 +242,22 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMapKeyTemporalTypeTextRange() {
+ return getChildTextNodeTextRange(MAP_KEY_TEMPORAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getMapKeyTextRange() {
+ return getChildAttributeTextRange(MAP_KEY, NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getOrderByFieldName() {
return getChildTextNode(ORDER_BY);
}
@@ -320,6 +266,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getOrderByFieldNameTextRange() {
+ return getChildTextNodeTextRange(ORDER_BY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalOrderColumn getOrderColumn() {
if (hasChild(OrderColumn.ORDER_COLUMN)) {
@@ -333,17 +287,24 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalAssociationOverride> mapKeyAssociationOverrides() {
+ public boolean hasOrderByClause() {
+ return hasChild(ORDER_BY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<ExternalAssociationOverride> mapKeyAssociationOverrides() {
int count = mapKeyAssociationOverridesSize();
List<ExternalAssociationOverride> associationOverrides = new ArrayList<ExternalAssociationOverride>(count);
- for (int index = count; --index >= 0;) {
- ExternalAssociationOverride associationOverride = buildMapKeyAssociationOverride(index);
- associationOverrides.add(0, associationOverride);
+ for (int index = 0; index < count; index++) {
+ associationOverrides.add(buildMapKeyAssociationOverride(index));
}
- return new ListListIterable<ExternalAssociationOverride>(associationOverrides);
+ return associationOverrides;
}
/**
@@ -358,17 +319,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalAttributeOverride> mapKeyAttributeOverrides() {
+ public List<ExternalAttributeOverride> mapKeyAttributeOverrides() {
int count = mapKeyAttributeOverridesSize();
List<ExternalAttributeOverride> attributeOverrides = new ArrayList<ExternalAttributeOverride>(count);
- for (int index = count; --index >= 0;) {
- ExternalAttributeOverride attributeOverride = buildMapKeyAttributeOverride(index);
- attributeOverrides.add(0, attributeOverride);
+ for (int index = 0; index < count; index++) {
+ attributeOverrides.add(buildMapKeyAttributeOverride(index));
}
- return new ListListIterable<ExternalAttributeOverride>(attributeOverrides);
+ return attributeOverrides;
}
/**
@@ -383,17 +343,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalJoinColumn> mapKeyJoinColumns() {
+ public List<ExternalJoinColumn> mapKeyJoinColumns() {
int count = mapKeyJoinColumnsSize();
List<ExternalJoinColumn> joinColumns = new ArrayList<ExternalJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalJoinColumn joinColumn = buildJoinColumn(MAP_KEY_JOIN_COLUMN, index);
- joinColumns.add(0, joinColumn);
+ for (int index = 0; index < count; index++) {
+ joinColumns.add(buildJoinColumn(MAP_KEY_JOIN_COLUMN, index));
}
- return new ListListIterable<ExternalJoinColumn>(joinColumns);
+ return joinColumns;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ObjectTypeConverter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ObjectTypeConverter.java
index ac7abb3..474496b 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ObjectTypeConverter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ObjectTypeConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,19 +15,17 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalConversionValue;
import org.eclipse.persistence.tools.mapping.orm.ExternalObjectTypeConverter;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
* The external form of a object type converter.
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class ObjectTypeConverter extends AbstractExternalForm
implements ExternalObjectTypeConverter {
@@ -37,49 +35,10 @@
private int index;
/**
- * The attribute name used to store and retrieve the data-type property.
- */
- static final String DATA_TYPE = "data-type";
-
- /**
- * The element name used to store and retrieve the default-object-value child
- * text node.
- */
- static final String DEFAULT_OBJECT_VALUE = "default-object-value";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The attribute name used to store and retrieve the object-type property.
- */
- static final String OBJECT_TYPE = "object-type";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String OBJECT_TYPE_CONVERTER = "object-type-converter";
-
- /**
* Creates a new <code>ObjectTypeConverter</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- ObjectTypeConverter(AbstractExternalForm parent) {
- super(parent);
- this.index = -1;
- }
-
- /**
- * Creates a new <code>ObjectTypeConverter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
ObjectTypeConverter(AbstractExternalForm parent, int index) {
super(parent);
@@ -90,8 +49,8 @@
* {@inheritDoc}
*/
@Override
- public ExternalConversionValue addConversionValue(int index) {
- ConversionValue conversionValue = buildConversionValue(index);
+ public ExternalConversionValue addConversionValue() {
+ ConversionValue conversionValue = buildConversionValue(-1);
conversionValue.addSelf();
return conversionValue;
}
@@ -100,19 +59,6 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName) {
-
- if (index == -1) {
- return super.addSelf(elementName);
- }
-
- return addChild(getParent(), elementName, index);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(NAME);
@@ -124,7 +70,7 @@
private ConversionValue buildConversionValue(int index) {
return new ConversionValue(this, index);
}
-
+
/**
* {@inheritDoc}
*/
@@ -140,17 +86,24 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalConversionValue> conversionValues() {
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<ExternalConversionValue> conversionValues() {
int count = conversionValuesSize();
List<ExternalConversionValue> conversionValues = new ArrayList<ExternalConversionValue>(count);
- for (int index = count; --index >= 0;) {
- ExternalConversionValue column = buildConversionValue(index);
- conversionValues.add(0, column);
+ for (int index = 0; index < count; index++) {
+ conversionValues.add(buildConversionValue(index));
}
- return new ListListIterable<ExternalConversionValue>(conversionValues);
+ return conversionValues;
}
/**
@@ -169,11 +122,11 @@
Element element = getChild(ConversionValue.CONVERSION_VALUE, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildConversionValue(index);
}
- return buildConversionValue(index);
+ return null;
}
/**
@@ -188,6 +141,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDatatypeTextRange() {
+ return getAttributeTextRange(DATA_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getDefaultValue() {
return getChildTextNode(DEFAULT_OBJECT_VALUE);
}
@@ -196,6 +157,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDefaultValueTextRange() {
+ return getChildTextNodeTextRange(DEFAULT_OBJECT_VALUE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Element getElement() {
if (index == -1) {
@@ -213,10 +182,8 @@
return OBJECT_TYPE_CONVERTER;
}
- /**
- * {@inheritDoc}
- */
@Override
+ @Deprecated
public int getIndex() {
return index;
}
@@ -233,6 +200,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getObjecttype() {
return getAttribute(OBJECT_TYPE);
}
@@ -241,6 +216,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getObjecttypeTextRange() {
+ return getAttributeTextRange(OBJECT_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeAllConversionValue() {
removeChildren(ConversionValue.CONVERSION_VALUE);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToManyMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToManyMapping.java
index c3f5eb8..7ac2fe1 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToManyMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToManyMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,10 +16,10 @@
import java.util.ArrayList;
import java.util.List;
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinColumn;
+import org.eclipse.persistence.tools.mapping.orm.ExternalManyToOneMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSqlJoinField;
import org.eclipse.persistence.tools.mapping.orm.ExternalOneToManyMapping;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -27,42 +27,19 @@
*
* @see MappedSuperClassEntity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class OneToManyMapping extends ObjectCollectionMapping
implements ExternalOneToManyMapping {
/**
- * The attribute name used to store and retrieve the maps-id property.
- */
- static final String MAPS_ID = "maps-id";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String ONE_TO_MANY = "one-to-many";
-
- /**
- * The attribute name used to store and retrieve the orphan-removal property.
- */
- static final String ORPHAN_REMOVAL = "orphan-removal";
-
- /**
- * The attribute name used to store and retrieve the private-owned property.
- */
- static final String PRIVATE_OWNED = "private-owned";
-
- /**
* Creates a new <code>OneToManyMapping</code>.
*
* @param parent The parent of this external form
* @param index The position of the element within the list of children with the same type owned
* by the parent
*/
- OneToManyMapping(EmbeddableEntity parent, int index) {
+ OneToManyMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -70,19 +47,20 @@
* {@inheritDoc}
*/
@Override
- public void addJoinColumn(int index, String name) {
- JoinColumn joinColumn = buildJoinColumn(JoinColumn.JOIN_COLUMN, index);
- joinColumn.addSelf();
+ public ExternalJoinColumn addJoinColumn(String name) {
+ JoinColumn joinColumn = buildJoinColumn(JoinColumn.JOIN_COLUMN, -1);
joinColumn.setName(name);
+ return joinColumn;
}
/**
* {@inheritDoc}
*/
@Override
- public void addJoinField(int index, String name) {
- ExternalNoSqlJoinField joinField = buildJoinField(index);
+ public ExternalNoSqlJoinField addJoinField(String name) {
+ ExternalNoSqlJoinField joinField = buildJoinField(-1);
joinField.setName(name);
+ return joinField;
}
/**
@@ -95,9 +73,10 @@
names.add(TARGET_ENTITY);
names.add(FETCH);
names.add(ACCESS);
- names.add(MAPPED_BY);
+ names.add(ExternalManyToOneMapping.MAPPED_BY);
names.add(MAPS_ID);
names.add(ORPHAN_REMOVAL);
+ names.add(ATTRIBUTE_TYPE);
return names;
}
@@ -154,15 +133,24 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getIdTextRange() {
+ // Should not be used on this mapping
+ return getElementNameTextRange(getElement());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalJoinColumn getJoinColumn(int index) {
Element element = getChild(JoinColumn.JOIN_COLUMN, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildJoinColumn(JoinColumn.JOIN_COLUMN, index);
}
- return buildJoinColumn(JoinColumn.JOIN_COLUMN, index);
+ return null;
}
/**
@@ -170,7 +158,15 @@
*/
@Override
public String getMappedByMappingName() {
- return getAttribute(MAPPED_BY);
+ return getAttribute(ExternalManyToOneMapping.MAPPED_BY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getMappedByMappingNameTextRange() {
+ return getAttributeTextRange(ExternalManyToOneMapping.MAPPED_BY);
}
/**
@@ -185,6 +181,30 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMapsIdTextRange() {
+ return getAttributeTextRange(MAPS_ID);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getOrphanRemovalTextRange() {
+ return getAttributeTextRange(ORPHAN_REMOVAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPrivateOwnedTextRange() {
+ return getChildTextRange(PRIVATE_OWNED);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Boolean isOrphanRemoval() {
return getBooleanAttribute(ORPHAN_REMOVAL);
}
@@ -201,17 +221,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalJoinColumn> joinColumns() {
+ public List<ExternalJoinColumn> joinColumns() {
int count = joinColumnsSize();
List<ExternalJoinColumn> joinColumns = new ArrayList<ExternalJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalJoinColumn joinColumn = buildJoinColumn(JoinColumn.JOIN_COLUMN, index);
- joinColumns.add(0, joinColumn);
+ for (int index = 0; index < count; index++) {
+ joinColumns.add(buildJoinColumn(JoinColumn.JOIN_COLUMN, index));
}
- return new ListListIterable<ExternalJoinColumn>(joinColumns);
+ return joinColumns;
}
/**
@@ -226,17 +245,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalNoSqlJoinField> joinFields() {
+ public List<ExternalNoSqlJoinField> joinFields() {
int count = joinFieldSize();
List<ExternalNoSqlJoinField> joinFields = new ArrayList<ExternalNoSqlJoinField>(count);
- for (int index = count; --index >= 0;) {
- ExternalNoSqlJoinField joinField = buildJoinField(index);
- joinFields.add(0, joinField);
+ for (int index = 0; index < count; index++) {
+ joinFields.add(buildJoinField(index));
}
- return new ListListIterable<ExternalNoSqlJoinField>(joinFields);
+ return joinFields;
}
/**
@@ -277,7 +295,7 @@
*/
@Override
public void setMappedByMappingName(String name) {
- setAttribute(MAPPED_BY, name);
+ setAttribute(ExternalManyToOneMapping.MAPPED_BY, name);
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToOneMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToOneMapping.java
index a2bc9e9..f1290cb 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToOneMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToOneMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -19,8 +19,7 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSqlJoinField;
import org.eclipse.persistence.tools.mapping.orm.ExternalOneToOneMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalPrimaryKeyJoinColumn;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -28,52 +27,18 @@
*
* @see MappedSuperClassEntity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class OneToOneMapping extends RelationshipMapping
implements ExternalOneToOneMapping {
/**
- * The attribute name used to store and retrieve the id property.
- */
- static final String ID = "id";
-
- /**
- * The attribute name used to store and retrieve the mapped-by property.
- */
- static final String MAPPED_BY = "mapped-by";
-
- /**
- * The attribute name used to store and retrieve the maps-id property.
- */
- static final String MAPS_ID = "maps-id";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String ONE_TO_ONE = "one-to-one";
-
- /**
- * The attribute name used to store and retrieve the orphan-removal property.
- */
- static final String ORPHAN_REMOVAL = "orphan-removal";
-
- /**
- * The attribute name used to store and retrieve the private-owned property.
- */
- static final String PRIVATE_OWNED = "private-owned";
-
- /**
* Creates a new <code>OneToOneMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- OneToOneMapping(EmbeddableEntity parent, int index) {
+ OneToOneMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -81,29 +46,30 @@
* {@inheritDoc}
*/
@Override
- public void addJoinColumn(int index, String name) {
- JoinColumn joinColumn = buildJoinColumn(index);
- joinColumn.addSelf();
+ public ExternalJoinColumn addJoinColumn(String name) {
+ JoinColumn joinColumn = buildJoinColumn(-1);
joinColumn.setName(name);
+ return joinColumn;
}
/**
* {@inheritDoc}
*/
@Override
- public void addJoinField(int index, String name) {
- ExternalNoSqlJoinField joinField = buildJoinField(index);
+ public ExternalNoSqlJoinField addJoinField(String name) {
+ ExternalNoSqlJoinField joinField = buildJoinField(-1);
joinField.setName(name);
+ return joinField;
}
/**
* {@inheritDoc}
*/
@Override
- public void addPrimaryKeyJoinColumn(int index, String name) {
- PrimaryKeyJoinColumn pkJoinColumn = buildPrimaryKeyJoinColumn(index);
- pkJoinColumn.addSelf();
+ public ExternalPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(String name) {
+ PrimaryKeyJoinColumn pkJoinColumn = buildPrimaryKeyJoinColumn(-1);
pkJoinColumn.setName(name);
+ return pkJoinColumn;
}
/**
@@ -143,7 +109,7 @@
}
private JoinColumn buildJoinColumn(int index) {
- return new JoinColumn(this, index);
+ return new JoinColumn(this, JoinColumn.JOIN_COLUMN, index);
}
private ExternalNoSqlJoinField buildJoinField(int index) {
@@ -174,15 +140,23 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getIdTextRange() {
+ return getAttributeTextRange(ID);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalJoinColumn getJoinColumn(int index) {
Element element = getChild(JoinColumn.JOIN_COLUMN, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildJoinColumn(index);
}
- return buildJoinColumn(index);
+ return null;
}
/**
@@ -197,6 +171,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMappedByMappingNameTextRange() {
+ return getAttributeTextRange(MAPPED_BY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getMapsId() {
return getAttribute(MAPS_ID);
}
@@ -205,15 +187,39 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMapsIdTextRange() {
+ return getAttributeTextRange(MAPS_ID);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getOrphanRemovalTextRange() {
+ return getAttributeTextRange(ORPHAN_REMOVAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index) {
Element element = getChild(PrimaryKeyJoinColumn.PRIMARY_KEY_JOIN_COLUMN, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildPrimaryKeyJoinColumn(index);
}
- return buildPrimaryKeyJoinColumn(index);
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPrivateOwnedTextRange() {
+ return getChildTextRange(PRIVATE_OWNED);
}
/**
@@ -236,17 +242,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalJoinColumn> joinColumns() {
+ public List<ExternalJoinColumn> joinColumns() {
int count = joinColumnsSize();
List<ExternalJoinColumn> joinColumns = new ArrayList<ExternalJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalJoinColumn joinColumn = buildJoinColumn(index);
- joinColumns.add(0, joinColumn);
+ for (int index = 0; index < count; index++) {
+ joinColumns.add(buildJoinColumn(index));
}
- return new ListListIterable<ExternalJoinColumn>(joinColumns);
+ return joinColumns;
}
/**
@@ -261,17 +266,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalNoSqlJoinField> joinFields() {
+ public List<ExternalNoSqlJoinField> joinFields() {
int count = joinFieldSize();
List<ExternalNoSqlJoinField> joinFields = new ArrayList<ExternalNoSqlJoinField>(count);
- for (int index = count; --index >= 0;) {
- ExternalNoSqlJoinField joinField = buildJoinField(index);
- joinFields.add(0, joinField);
+ for (int index = 0; index < count; index++) {
+ joinFields.add(buildJoinField(index));
}
- return new ListListIterable<ExternalNoSqlJoinField>(joinFields);
+ return joinFields;
}
/**
@@ -286,17 +290,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ public List<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
int count = primaryKeyJoinColumnsSize();
List<ExternalPrimaryKeyJoinColumn> pkJoinColumns = new ArrayList<ExternalPrimaryKeyJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalPrimaryKeyJoinColumn pkJoinColumn = buildPrimaryKeyJoinColumn(index);
- pkJoinColumns.add(0, pkJoinColumn);
+ for (int index = 0; index < count; index++) {
+ pkJoinColumns.add(buildPrimaryKeyJoinColumn(index));
}
- return new ListListIterable<ExternalPrimaryKeyJoinColumn>(pkJoinColumns);
+ return pkJoinColumns;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OptimisticLocking.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OptimisticLocking.java
index 8773d99..fed35cb 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OptimisticLocking.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OptimisticLocking.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,10 +16,10 @@
import java.util.ArrayList;
import java.util.List;
import org.eclipse.persistence.annotations.OptimisticLockingType;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalOptimisticLocking;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -27,34 +27,12 @@
*
* @see MappedSuperClassEntity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class OptimisticLocking extends AbstractExternalForm
implements ExternalOptimisticLocking {
/**
- * The attribute name used to store and retrieve the cascade property.
- */
- static final String CASCADE = "cascade";
-
- /**
- * The attribute name used to store and retrieve the optimistic-locking property.
- */
- static final String OPTIMISTIC_LOCKING = "optimistic-locking";
-
- /**
- * The element name used to store and retrieve the base child node.
- */
- static final String SELECTED_COLUMN = "selected-column";
-
- /**
- * The attribute name used to store and retrieve the type property.
- */
- static final String TYPE = "type";
-
- /**
* Creates a new <code>OptimisticLocking</code>.
*
* @param parent The parent of this external form
@@ -67,12 +45,12 @@
* {@inheritDoc}
*/
@Override
- public void addColumn(int index, String columnName) {
- EntityColumn column = buildColumn(index);
- column.addSelf();
+ public ExternalEntityColumn addColumn(String columnName) {
+ EntityColumn column = buildColumn(-1);
column.setName(columnName);
+ return column;
}
-
+
/**
* {@inheritDoc}
*/
@@ -87,7 +65,7 @@
private EntityColumn buildColumn(int index) {
return new EntityColumn(this, SELECTED_COLUMN, index);
}
-
+
/**
* {@inheritDoc}
*/
@@ -102,17 +80,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalEntityColumn> columns() {
+ public List<ExternalEntityColumn> columns() {
int count = columnsSize();
List<ExternalEntityColumn> columns = new ArrayList<ExternalEntityColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalEntityColumn column = buildColumn(index);
- columns.add(0, column);
+ for (int index = 0; index < count; index++) {
+ columns.add(buildColumn(index));
}
- return new ListListIterable<ExternalEntityColumn>(columns);
+ return columns;
}
/**
@@ -127,15 +104,38 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getCascadeTextRange() {
+ return getAttributeTextRange(CASCADE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalEntityColumn getColumn(int index) {
Element element = getChild(SELECTED_COLUMN, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildColumn(index);
}
- return buildColumn(index);
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getColumnTextRange(String columnName) {
+
+ for (ExternalEntityColumn column : columns()) {
+ if (columnName.equals(column.getName())) {
+ return column.getTextRange();
+ }
+ }
+
+ return null;
}
/**
@@ -158,6 +158,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getOptimisticLockingTypeTextRange() {
+ return getAttributeTextRange(TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeAllColumns() {
removeChildren(SELECTED_COLUMN);
}
@@ -177,10 +185,16 @@
@Override
public void setOptimisticLockingType(OptimisticLockingType type) {
- setAttribute(TYPE, type);
-
if (type == null) {
- removeSelf();
+ if (!hasAnyChildren()) {
+ removeSelf();
+ }
+ else {
+ setAttribute(TYPE, type);
+ }
+ }
+ else {
+ setAttribute(TYPE, type);
}
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OrderColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OrderColumn.java
index ed53354..8acf297 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OrderColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OrderColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,80 +15,26 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalOrderColumn;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of a order column, which is a child of an element collection mapping.
*
* @see ElementCollectionMapping
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class OrderColumn extends AbstractExternalForm
implements ExternalOrderColumn {
/**
- * The attribute name used to store and retrieve the base property.
- */
- static final String BASE = "base";
-
- /**
- * The attribute name used to store and retrieve the column-definition of the property.
- */
- static final String COLUMN_DEFINITION = "column-definition";
-
- /**
- * The attribute name used to store and retrieve the contiguous property.
- */
- static final String CONTIGUOUS = "contiguous";
-
- /**
- * The attribute name used to store and retrieve the insertable property.
- */
- static final String INSERTABLE = "insertable";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The attribute name used to store and retrieve the nullable property.
- */
- static final String NULLABLE = "nullable";
-
- /**
- * The attribute name used to store and retrieve the primary-key of the property.
- */
- static final String ORDER_COLUMN = "order-column";
-
- /**
- * The attribute name used to store and retrieve the table property.
- */
- static final String TABLE = "table";
-
- /**
- * The attribute name used to store and retrieve the updatable property.
- */
- static final String UPDATABLE = "updatable";
-
- /**
* Creates a new <code>OrderColumn</code>.
*
* @param parent The parent of this external form
*/
- OrderColumn(ElementCollectionMapping parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>OrderColumn</code>.
- *
- * @param parent The parent of this external form
- */
- OrderColumn(ObjectCollectionMapping parent) {
+ OrderColumn(AbstractExternalForm parent) {
super(parent);
}
@@ -108,7 +54,7 @@
names.add(TABLE);
return names;
}
-
+
/**
* {@inheritDoc}
*/
@@ -121,6 +67,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getBaseTextRange() {
+ return getAttributeTextRange(BASE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getColumnDefinition() {
return getAttribute(COLUMN_DEFINITION);
}
@@ -129,6 +83,22 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getColumnDefinitionTextRange() {
+ return getAttributeTextRange(COLUMN_DEFINITION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getContiguousTextRange() {
+ return getAttributeTextRange(CONTIGUOUS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected String getElementName() {
return ORDER_COLUMN;
}
@@ -137,6 +107,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getInstertableTextRange() {
+ return getAttributeTextRange(INSERTABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getName() {
return getAttribute(NAME);
}
@@ -145,6 +123,22 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getNullableTextRange() {
+ return getAttributeTextRange(NULLABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getTable() {
return getAttribute(TABLE);
}
@@ -153,6 +147,22 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getTableTextRange() {
+ return getAttributeTextRange(TABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getUpdatableTextRange() {
+ return getAttributeTextRange(UPDATABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Boolean isContiguous() {
return getBooleanAttribute(CONTIGUOUS);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PersistenceUnit.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PersistenceUnit.java
index 6e2488b..77bcb58 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PersistenceUnit.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PersistenceUnit.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,12 +15,13 @@
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.AccessType;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
+import org.eclipse.persistence.tools.mapping.orm.AccessType;
+import org.eclipse.persistence.tools.mapping.orm.ExternalAccessType;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityListener;
import org.eclipse.persistence.tools.mapping.orm.ExternalPersistenceUnit;
import org.eclipse.persistence.tools.mapping.orm.ExternalTenantDiscriminatorColumn;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -28,64 +29,12 @@
*
* @see ORMConfiguration
*
- * @version 2.5
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class PersistenceUnit extends AbstractExternalForm
implements ExternalPersistenceUnit {
/**
- * The attribute name used to store and retrieve the access property.
- */
- static final String ACCESS = "access";
-
- /**
- * The attribute name used to store and retrieve the cascade-persist property.
- */
- static final String CASCADE_PERSIST = "cascade-persist";
-
- /**
- * The attribute name used to store and retrieve the catalog property.
- */
- static final String CATALOG = "catalog";
-
- /**
- * The element name used to store and retrieve the delimited identifiers flag.
- */
- static final String DELIMITED_IDENTIFIERS = "delimited-identifiers";
-
- /**
- * The element name used to store and retrieve the description.
- */
- static final String DESCRIPTION = "description";
-
- /**
- * The attribute name used to store and retrieve the exclude-default-mappings property.
- */
- static final String EXCLUDE_DEFAULT_MAPPINGS = "exclude-default-mappings";
-
- /**
- * The attribute name used to store and retrieve the persistence-unit-defaults property.
- */
- static final String PERSISTENCE_UNIT_DEFAULTS = "persistence-unit-defaults";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String PERSISTENCE_UNIT_METADATA = "persistence-unit-metadata";
-
- /**
- * The attribute name used to store and retrieve the schema property.
- */
- static final String SCHEMA = "schema";
-
- /**
- * The attribute name used to store and retrieve the direction property.
- */
- static final String XML_MAPPING_METADATA_COMPLETE = "xml-mapping-metadata-complete";
-
- /**
* Creates a new <code>PersistenceUnit</code>.
*
* @param parent The parent of this external form
@@ -98,8 +47,8 @@
* {@inheritDoc}
*/
@Override
- public ExternalTenantDiscriminatorColumn addDiscriminatorColumn(int index) {
- TenantDiscriminatorColumn column = buildDiscriminatorColumn(index);
+ public ExternalTenantDiscriminatorColumn addDiscriminatorColumn() {
+ TenantDiscriminatorColumn column = buildDiscriminatorColumn(-1);
column.addSelf();
return column;
}
@@ -108,10 +57,10 @@
* {@inheritDoc}
*/
@Override
- public void addEntityListener(int index, String className) {
- EntityListener entityListener = buildEntityListener(index);
- entityListener.addSelf();
+ public ExternalEntityListener addEntityListener(String className) {
+ EntityListener entityListener = buildEntityListener(-1);
entityListener.setClassName(className);
+ return entityListener;
}
private TenantDiscriminatorColumn buildDiscriminatorColumn(int index) {
@@ -140,16 +89,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalTenantDiscriminatorColumn> discriminatorColumns() {
+ public List<ExternalTenantDiscriminatorColumn> discriminatorColumns() {
+
int count = discriminatorColumnSize();
List<ExternalTenantDiscriminatorColumn> columns = new ArrayList<ExternalTenantDiscriminatorColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalTenantDiscriminatorColumn column = buildDiscriminatorColumn(index);
- columns.add(0, column);
+ for (int index = 0; index < count; index++) {
+ columns.add(buildDiscriminatorColumn(index));
}
- return new ListListIterable<ExternalTenantDiscriminatorColumn>(columns);
+ return columns;
}
/**
@@ -160,46 +109,27 @@
Element element = getChild(PERSISTENCE_UNIT_DEFAULTS);
- if (element == null) {
- return 0;
+ if (element != null) {
+ return getChildrenSize(element, TenantDiscriminatorColumn.TENANT_DISCRIMINATOR_COLUMN);
}
- return getChildrenSize(element, TenantDiscriminatorColumn.TENANT_DISCRIMINATOR_COLUMN);
+ return 0;
}
- @Override
- public ExternalTenantDiscriminatorColumn getDiscriminatorColumn(int index) {
- Element puElem = getChild(PERSISTENCE_UNIT_DEFAULTS);
-
- if (puElem == null) {
- return null;
- }
-
- Element element = getChild(puElem, TenantDiscriminatorColumn.TENANT_DISCRIMINATOR_COLUMN, index);
-
- if (element == null) {
- return null;
- }
-
- return buildDiscriminatorColumn(index);
- }
-
-
/**
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalEntityListener> entityListeners() {
+ public List<ExternalEntityListener> entityListeners() {
int count = entityListenersSize();
List<ExternalEntityListener> entityListeners = new ArrayList<ExternalEntityListener>(count);
- for (int index = count; --index >= 0;) {
- ExternalEntityListener entityListener = buildEntityListener(index);
- entityListeners.add(0, entityListener);
+ for (int index = 0; index < count; index++) {
+ entityListeners.add(buildEntityListener(index));
}
- return new ListListIterable<ExternalEntityListener>(entityListeners);
+ return entityListeners;
}
/**
@@ -227,12 +157,48 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getCascadePersistByDefaultTextRange() {
+
+ Element element = getChild(PERSISTENCE_UNIT_DEFAULTS);
+
+ if (element == null) {
+ return null;
+ }
+
+ element = getChild(element, CASCADE_PERSIST);
+
+ if (element == null) {
+ return null;
+ }
+
+ return getTextRange(element);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public AccessType getDefaultAccessType() {
Element element = getChild(PERSISTENCE_UNIT_DEFAULTS);
if (element != null) {
- return getChildEnumNode(element, ACCESS, AccessType.class);
+ return getChildEnumNode(element, ExternalAccessType.ACCESS, AccessType.class);
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getDefaultAccessTypeTextRange() {
+
+ Element element = getChild(PERSISTENCE_UNIT_DEFAULTS);
+
+ if (element != null) {
+ return getChildTextNodeTextRange(element, ExternalAccessType.ACCESS);
}
return null;
@@ -257,6 +223,21 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDefaultCatalogNameTextRange() {
+
+ Element element = getChild(PERSISTENCE_UNIT_DEFAULTS);
+
+ if (element != null) {
+ return getChildTextNodeTextRange(element, CATALOG);
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getDefaultDescription() {
Element element = getChild(PERSISTENCE_UNIT_DEFAULTS);
@@ -287,6 +268,21 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDefaultSchemaNameTextRange() {
+
+ Element element = getChild(PERSISTENCE_UNIT_DEFAULTS);
+
+ if (element != null) {
+ return getChildTextNodeTextRange(element, SCHEMA);
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getDescription() {
return getChildTextNode(DESCRIPTION);
}
@@ -295,6 +291,27 @@
* {@inheritDoc}
*/
@Override
+ public ExternalTenantDiscriminatorColumn getDiscriminatorColumn(int index) {
+
+ Element puElem = getChild(PERSISTENCE_UNIT_DEFAULTS);
+
+ if (puElem == null) {
+ return null;
+ }
+
+ Element element = getChild(puElem, TenantDiscriminatorColumn.TENANT_DISCRIMINATOR_COLUMN, index);
+
+ if (element == null) {
+ return null;
+ }
+
+ return buildDiscriminatorColumn(index);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected String getElementName() {
return PERSISTENCE_UNIT_METADATA;
}
@@ -334,17 +351,13 @@
return getAllChildrenSize() == 0;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public boolean isDelimitedIdentifers() {
-
Element element = getChild(PERSISTENCE_UNIT_DEFAULTS);
-
- if (element != null) {
- return hasChild(element, DELIMITED_IDENTIFIERS);
- }
- else {
- return false;
- }
+ return (element != null) && hasChild(element, DELIMITED_IDENTIFIERS);
}
/**
@@ -424,7 +437,7 @@
element = addChild(PERSISTENCE_UNIT_DEFAULTS);
}
- updateTextNode(element, ACCESS, type);
+ updateTextNode(element, ExternalAccessType.ACCESS, type);
if (!hasAnyChildren(element)) {
remove(element);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKey.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKey.java
index 6ee76d9..aeed572 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKey.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKey.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -17,10 +17,10 @@
import java.util.List;
import org.eclipse.persistence.annotations.CacheKeyType;
import org.eclipse.persistence.annotations.IdValidation;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalPrimaryKey;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -28,29 +28,12 @@
*
* @see MappedSuperClassEntity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class PrimaryKey extends AbstractExternalForm
implements ExternalPrimaryKey {
/**
- * The attribute name used to store and retrieve the cache-key-type of the property.
- */
- static final String CACHE_KEY_TYPE = "cache-key-type";
-
- /**
- * The attribute name used to store and retrieve the id-validation of the property.
- */
- static final String ID_VALIDATION = "id-validation";
-
- /**
- * The attribute name used to store and retrieve the primary-key of the property.
- */
- static final String PRIMARY_KEY = "primary-key";
-
- /**
* Creates a new <code>PrimaryKey</code>.
*
* @param parent The parent of this external form
@@ -63,10 +46,10 @@
* {@inheritDoc}
*/
@Override
- public void addColumn(int index, String columnName) {
- EntityColumn column = buildColumn(index);
- column.addSelf();
+ public ExternalEntityColumn addColumn(String columnName) {
+ EntityColumn column = buildColumn(-1);
column.setName(columnName);
+ return column;
}
/**
@@ -80,7 +63,7 @@
}
private EntityColumn buildColumn(int index) {
- return new EntityColumn(this, index);
+ return new EntityColumn(this, EntityColumn.COLUMN, index);
}
/**
@@ -97,17 +80,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalEntityColumn> columns() {
+ public List<ExternalEntityColumn> columns() {
int count = columnsSize();
List<ExternalEntityColumn> columns = new ArrayList<ExternalEntityColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalEntityColumn column = buildColumn(index);
- columns.add(0, column);
+ for (int index = 0; index < count; index++) {
+ columns.add(buildColumn(index));
}
- return new ListListIterable<ExternalEntityColumn>(columns);
+ return columns;
}
/**
@@ -130,15 +112,23 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getCacheKeyTextRange() {
+ return getAttributeTextRange(CACHE_KEY_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalEntityColumn getColumn(int index) {
Element element = getChild(EntityColumn.COLUMN, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildColumn(index);
}
- return buildColumn(index);
+ return null;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKeyGenerator.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKeyGenerator.java
index a354b0c..fade707 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKeyGenerator.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKeyGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalPrimaryKeyGenerator;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -24,11 +26,8 @@
* @see SequenceGenerator
* @see TableGenerator
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
abstract class PrimaryKeyGenerator extends AbstractExternalForm
implements ExternalPrimaryKeyGenerator {
@@ -38,46 +37,6 @@
private int index;
/**
- * The attribute name used to store and retrieve the allocation-size of the property.
- */
- static final String ALLOCATION_SIZE = "allocation-size";
-
- /**
- * The attribute name used to store and retrieve the temporal property.
- */
- static final String CATALOG = "catalog";
-
- /**
- * The element name of the child text node for the description.
- */
- static final String DESCRIPTION = "description";
-
- /**
- * The attribute name used to store and retrieve the initial-value of the property.
- */
- static final String INITIAL_VALUE = "initial-value";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The attribute name used to store and retrieve the temporal property.
- */
- static final String SCHEMA = "schema";
-
- /**
- * Creates a new <code>PrimaryKeyGenerator</code>.
- *
- * @param parent The parent of this external form
- */
- PrimaryKeyGenerator(AbstractExternalForm parent) {
- super(parent);
- index = -1;
- }
-
- /**
* Creates a new <code>PrimaryKeyGenerator</code>.
*
* @param parent The parent of this external form
@@ -93,23 +52,18 @@
* {@inheritDoc}
*/
@Override
- protected final Element addSelf(String elementName, List<String> elementNamesOrder) {
-
- if (index == -1) {
- return super.addSelf(elementName, elementNamesOrder);
- }
-
- return addChild(getParent(), elementName, index, elementNamesOrder);
+ protected List<String> buildElementNamesOrder() {
+ List<String> names = new ArrayList<String>();
+ names.add(DESCRIPTION);
+ return names;
}
/**
* {@inheritDoc}
*/
@Override
- protected List<String> buildElementNamesOrder() {
- List<String> names = new ArrayList<String>();
- names.add(DESCRIPTION);
- return names;
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
}
/**
@@ -124,6 +78,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getAllocationSizeTextRange() {
+ return getAttributeTextRange(ALLOCATION_SIZE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getCatalogName() {
return getAttribute(CATALOG);
}
@@ -132,6 +94,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getCatalogNameTextRange() {
+ return getAttributeTextRange(CATALOG);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getDescription() {
return getChildTextNode(DESCRIPTION);
}
@@ -149,11 +119,9 @@
return getChild(getParent(), getElementName(), index);
}
- /**
- * {@inheritDoc}
- */
@Override
- public final int getIndex() {
+ @Deprecated
+ public int getIndex() {
return index;
}
@@ -169,6 +137,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getInitialValueTextRange() {
+ return getAttributeTextRange(INITIAL_VALUE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getName() {
return getAttribute(NAME);
}
@@ -177,6 +153,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getSchemaName() {
return getAttribute(SCHEMA);
}
@@ -185,6 +169,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getSchemaNameTextRange() {
+ return getAttributeTextRange(SCHEMA);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final void removeSelf() {
if (index == -1) {
@@ -269,6 +261,6 @@
}
final boolean shouldBeRemoved() {
- return (index == -1) && !hasAnyChildren() && !hasAttributes();
+ return (index == -1) && !hasAnything();
}
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKeyJoinColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKeyJoinColumn.java
index 6572d66..0ed2a61 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKeyJoinColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKeyJoinColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalPrimaryKeyJoinColumn;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -25,11 +27,8 @@
* @see OneToOneMapping
* @see SecondaryTable
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class PrimaryKeyJoinColumn extends AbstractExternalForm
implements ExternalPrimaryKeyJoinColumn {
@@ -39,70 +38,17 @@
private int index;
/**
- * The attribute name used to store and retrieve the column-definition of the property.
- */
- static final String COLUMN_DEFINITION = "column-definition";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String PRIMARY_KEY_JOIN_COLUMN = "primary-key-join-column";
-
- /**
- * The attribute name used to store and retrieve the referenced-column-name property.
- */
- static final String REFERENCED_COLUMN_NAME = "referenced-column-name";
-
- /**
* Creates a new <code>PrimaryKeyJoinColumn</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- PrimaryKeyJoinColumn(Entity parent, int index) {
+ PrimaryKeyJoinColumn(AbstractExternalForm parent, int index) {
super(parent);
this.index = index;
}
/**
- * Creates a new <code>PrimaryKeyJoinColumn</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- PrimaryKeyJoinColumn(OneToOneMapping parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>PrimaryKeyJoinColumn</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- PrimaryKeyJoinColumn(SecondaryTable parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
* {@inheritDoc}
*/
@Override
@@ -118,6 +64,14 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getColumnDefinition() {
return getAttribute(COLUMN_DEFINITION);
}
@@ -126,6 +80,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getColumnDefinitionTextRange() {
+ return getAttributeTextRange(COLUMN_DEFINITION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Element getElement() {
return getChild(getParent(), getElementName(), index);
}
@@ -142,14 +104,6 @@
* {@inheritDoc}
*/
@Override
- public int getIndex() {
- return index;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public String getName() {
return getAttribute(NAME);
}
@@ -158,6 +112,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getReferenceColumnName() {
return getAttribute(REFERENCED_COLUMN_NAME);
}
@@ -166,6 +128,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getReferenceColumnNameTextRange() {
+ return getAttributeTextRange(REFERENCED_COLUMN_NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeSelf() {
removeChild(getParent(), getElementName(), index);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryTable.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryTable.java
index fe4aa7a..dca999a 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryTable.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -18,15 +18,13 @@
*
* @see Entity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
@SuppressWarnings("nls")
final class PrimaryTable extends Table {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
+ * The node name used to store and retrieve the element encapsulated by this external form.
*/
static final String TABLE = "table";
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Property.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Property.java
index 6f567c2..2490d2a 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Property.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Property.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.persistence.tools.mapping.orm.ExternalProperty;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
+import org.eclipse.persistence.tools.mapping.ExternalProperty;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -23,44 +25,21 @@
*
* @see Property
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class Property extends AbstractExternalForm
implements ExternalProperty {
/**
- * The index of this external property.
+ * The position of the element within the list of children with the same type owned by the parent.
*/
private int index;
/**
- * The property name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String PROPERTY = "property";
-
- /**
- * The property name used to store and retrieve the value property.
- */
- static final String VALUE = "value";
-
- /**
- * The property name used to store and retrieve the value-type property.
- */
- static final String VALUE_TYPE = "value-type";
-
- /**
* Creates a new <code>Property</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
Property(AbstractExternalForm parent, int index) {
super(parent);
@@ -71,15 +50,6 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(NAME);
@@ -88,6 +58,13 @@
return names;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
/**
* {@inheritDoc}
@@ -101,14 +78,6 @@
* {@inheritDoc}
*/
@Override
- public int getIndex() {
- return index;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public String getName() {
return getAttribute(NAME);
}
@@ -117,6 +86,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getValue() {
return getAttribute(VALUE);
}
@@ -125,6 +102,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getValueTextRange() {
+ return getAttributeTextRange(VALUE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getValueType() {
return getAttribute(VALUE_TYPE);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/QueryHint.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/QueryHint.java
index 5afe087..70aa0ea 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/QueryHint.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/QueryHint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalQueryHint;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -23,11 +25,8 @@
*
* @see Query
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class QueryHint extends AbstractExternalForm
implements ExternalQueryHint {
@@ -37,33 +36,12 @@
private int index;
/**
- * The element name of the child text node for the description.
- */
- static final String DESCRIPTION = "description";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String HINT = "hint";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The attribute name used to store and retrieve the value property.
- */
- static final String VALUE = "value";
-
- /**
* Creates a new <code>QueryHint</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- QueryHint(Query parent, int index) {
+ QueryHint(AbstractQuery parent, int index) {
super(parent);
this.index = index;
}
@@ -72,14 +50,6 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName) {
- return addChild(getParent(), elementName, index);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected List<String> buildElementNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(QueryHint.HINT);
@@ -90,6 +60,14 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getDescription() {
return getChildTextNode(DESCRIPTION);
}
@@ -110,10 +88,8 @@
return HINT;
}
- /**
- * {@inheritDoc}
- */
@Override
+ @Deprecated
public int getIndex() {
return index;
}
@@ -130,6 +106,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getValue() {
return getAttribute(VALUE);
}
@@ -138,6 +122,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getValueTextRange() {
+ return getAttributeTextRange(VALUE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeSelf() {
removeChild(getParent(), HINT, index);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ReadTransformer.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ReadTransformer.java
index cd62e0d..15d7bdc 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ReadTransformer.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ReadTransformer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,21 +13,17 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
+import org.eclipse.persistence.tools.mapping.orm.ExternalReadTransformer;
+
/**
* The external form of a read transformer.
*
* @see TransformationMapping
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
-final class ReadTransformer extends Transformer {
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String READ_TRANSFORMER = "read-transformer";
+final class ReadTransformer extends Transformer
+ implements ExternalReadTransformer {
/**
* Creates a new <code>ReadTransformer</code>.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/RelationshipMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/RelationshipMapping.java
index 08ce5f7..a22a7c5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/RelationshipMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/RelationshipMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,7 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.FetchType;
@@ -22,9 +23,7 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinTable;
import org.eclipse.persistence.tools.mapping.orm.ExternalRelationshipMapping;
import org.eclipse.persistence.tools.utility.ObjectTools;
-import org.eclipse.persistence.tools.utility.iterable.EmptyListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -32,11 +31,8 @@
*
* @see MappedSuperClassEntity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
abstract class RelationshipMapping extends NonTransientMapping
implements ExternalRelationshipMapping {
@@ -46,73 +42,12 @@
private List<String> cascadeTypeIndices;
/**
- * The attribute name used to store and retrieve the access property.
- */
- static final String ACCESS = "access";
-
- /**
- * The element name used to store and retrieve the cascade child element.
- */
- static final String CASCADE = "cascade";
-
- /**
- * The element name used to store and retrieve the cascade-all child node of the cascade child.
- */
- static final String CASCADE_ALL = "cascade-all";
-
- /**
- * The element name used to store and retrieve the cascade-detach child node of the cascade child.
- */
- static final String CASCADE_DETACH = "cascade-detach";
-
- /**
- * The element name used to store and retrieve the cascade-merge child node of the cascade child.
- */
- static final String CASCADE_MERGE = "cascade-merge";
-
- /**
- * The element name used to store and retrieve the cascade-persist child node of the cascade child.
- */
- static final String CASCADE_PERSIST = "cascade-persist";
-
- /**
- * The element name used to store and retrieve the cascade-refresh child node of the cascade child.
- */
- static final String CASCADE_REFRESH = "cascade-refresh";
-
- /**
- * The element name used to store and retrieve the cascade-remove child node of the cascade child.
- */
- static final String CASCADE_REMOVE = "cascade-remove";
-
- /**
- * The attribute name used to store and retrieve the fetch property.
- */
- static final String FETCH = "fetch";
-
- /**
- * The element name used to store and retrieve the join-fetch child text node.
- */
- static final String JOIN_FETCH = "join-fetch";
-
- /**
- * The attribute name used to store and retrieve the optional property.
- */
- static final String OPTIONAL = "optional";
-
- /**
- * The attribute name used to store and retrieve the target-entity property.
- */
- static final String TARGET_ENTITY = "target-entity";
-
- /**
* Creates a new <code>RelationshipMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- RelationshipMapping(EmbeddableEntity parent, int index) {
+ RelationshipMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -218,12 +153,12 @@
* {@inheritDoc}
*/
@Override
- public final ListIterable<CascadeType> cascadeTypes() {
+ public final List<CascadeType> cascadeTypes() {
Element element = getChild(CASCADE);
- if (element == null) {
- return EmptyListIterable.instance();
+ if (!hasChild(CASCADE)) {
+ return Collections.emptyList();
}
List<Element> children = getChildren(element);
@@ -236,7 +171,7 @@
}
}
- return new ListListIterable<CascadeType>(cascadeTypes);
+ return cascadeTypes;
}
/**
@@ -256,6 +191,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getCascadeTypeTextRange() {
+ return getChildTextRange(CASCADE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final FetchType getFetchType() {
return getEnumAttribute(FETCH, FetchType.class);
}
@@ -264,6 +207,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getFetchTypeTextRange() {
+ return getAttributeTextRange(FETCH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final JoinFetchType getJoinFetchType() {
return getChildEnumNode(JOIN_FETCH, JoinFetchType.class);
}
@@ -272,6 +223,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getJoinFetchTypeTextRange() {
+ return getChildTextNodeTextRange(JOIN_FETCH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final ExternalJoinTable getJoinTable() {
if (hasChild(JoinTable.JOIN_TABLE)) {
@@ -285,6 +244,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getOptionalTextRange() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getTargetEntityName() {
return getAttribute(TARGET_ENTITY);
}
@@ -293,6 +260,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getTargetEntityNameTextRange() {
+ return getAttributeTextRange(TARGET_ENTITY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected void initialize() {
super.initialize();
cascadeTypeIndices = buildCascadeTypeIndices();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SQLResultSetMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SQLResultSetMapping.java
index 842c10c..596ef04 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SQLResultSetMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SQLResultSetMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,11 +15,11 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalColumnResult;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityResult;
import org.eclipse.persistence.tools.mapping.orm.ExternalSQLResultSetMapping;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -28,11 +28,8 @@
* @see Entity
* @see ORMConfiguration
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class SQLResultSetMapping extends AbstractExternalForm
implements ExternalSQLResultSetMapping {
@@ -42,40 +39,12 @@
private int index;
/**
- * The element name of the child text node for the description.
- */
- static final String DESCRIPTION = "description";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String SQL_RESULT_SET_MAPPING = "sql-result-set-mapping";
-
- /**
* Creates a new <code>SQLResultSetMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- SQLResultSetMapping(Entity parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>SQLResultSetMapping</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- SQLResultSetMapping(ORMConfiguration parent, int index) {
+ SQLResultSetMapping(AbstractExternalForm parent, int index) {
super(parent);
this.index = index;
}
@@ -84,28 +53,20 @@
* {@inheritDoc}
*/
@Override
- public void addColumnResult(int index, String name) {
- ColumnResult entityResult = buildColumnResult(index);
- entityResult.addSelf();
+ public ExternalColumnResult addColumnResult(String name) {
+ ColumnResult entityResult = buildColumnResult(-1);
entityResult.setName(name);
+ return entityResult;
}
/**
* {@inheritDoc}
*/
@Override
- public void addEntityResult(int index, String className) {
+ public ExternalEntityResult addEntityResult(String className) {
EntityResult entityResult = buildEntityResult(index);
- entityResult.addSelf();
entityResult.setEntityClassName(className);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
+ return entityResult;
}
private ColumnResult buildColumnResult(int index) {
@@ -132,17 +93,24 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalColumnResult> columnResults() {
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<ExternalColumnResult> columnResults() {
int count = columnResultsSize();
List<ExternalColumnResult> columnResults = new ArrayList<ExternalColumnResult>(count);
- for (int index = count; --index >= 0;) {
- ExternalColumnResult columnResult = buildColumnResult(index);
- columnResults.add(0, columnResult);
+ for (int index = 0; index < count; index++) {
+ columnResults.add(buildColumnResult(index));
}
- return new ListListIterable<ExternalColumnResult>(columnResults);
+ return columnResults;
}
/**
@@ -157,17 +125,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalEntityResult> entityResults() {
+ public List<ExternalEntityResult> entityResults() {
int count = entityResultsSize();
List<ExternalEntityResult> entityResults = new ArrayList<ExternalEntityResult>(count);
- for (int index = count; --index >= 0;) {
- ExternalEntityResult entityResult = buildEntityResult(index);
- entityResults.add(0, entityResult);
+ for (int index = 0; index < count; index++) {
+ entityResults.add(buildEntityResult(index));
}
- return new ListListIterable<ExternalEntityResult>(entityResults);
+ return entityResults;
}
/**
@@ -186,11 +153,11 @@
Element element = getChild(ColumnResult.COLUMN_RESULT, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildColumnResult(index);
}
- return buildColumnResult(index);
+ return null;
}
/**
@@ -225,19 +192,11 @@
Element element = getChild(EntityResult.ENTITY_RESULT, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildEntityResult(index);
}
- return buildEntityResult(index);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getIndex() {
- return index;
+ return null;
}
/**
@@ -252,6 +211,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeColumnResult(int index) {
EntityResult entityResult = buildEntityResult(index);
entityResult.removeSelf();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SecondaryTable.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SecondaryTable.java
index 4ff630e..db64e37 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SecondaryTable.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SecondaryTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,10 +15,8 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.persistence.tools.mapping.orm.ExternalEntitySecondaryTable;
import org.eclipse.persistence.tools.mapping.orm.ExternalPrimaryKeyJoinColumn;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.mapping.orm.ExternalSecondaryTable;
import org.w3c.dom.Element;
/**
@@ -26,13 +24,10 @@
*
* @see Entity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class SecondaryTable extends Table
- implements ExternalEntitySecondaryTable {
+ implements ExternalSecondaryTable {
/**
* The position of the element within the list of children with the same type owned by the parent.
@@ -40,16 +35,10 @@
private int index;
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String SECONDARY_TABLE = "secondary-table";
-
- /**
* Creates a new <code>EntitySecondaryTable</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
SecondaryTable(Entity parent, int index) {
super(parent);
@@ -60,23 +49,10 @@
* {@inheritDoc}
*/
@Override
- public void addPrimaryKeyJoinColumn(int index, String name) {
- PrimaryKeyJoinColumn primaryKeyJoinColumn = buildPrimaryKeyJoinColumn(index);
- primaryKeyJoinColumn.addSelf();
+ public ExternalPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(String name) {
+ PrimaryKeyJoinColumn primaryKeyJoinColumn = buildPrimaryKeyJoinColumn(-1);
primaryKeyJoinColumn.setName(name);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
-
- if (index == -1) {
- return super.addSelf(elementName, elementNamesOrder);
- }
-
- return addChild(getParent(), elementName, index, elementNamesOrder);
+ return primaryKeyJoinColumn;
}
/**
@@ -98,6 +74,14 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Element getElement() {
if (index == -1) {
return super.getElement();
@@ -117,40 +101,31 @@
* {@inheritDoc}
*/
@Override
- public int getIndex() {
- return index;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public ExternalPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index) {
Element element = getChild(PrimaryKeyJoinColumn.PRIMARY_KEY_JOIN_COLUMN, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildPrimaryKeyJoinColumn(index);
}
- return buildPrimaryKeyJoinColumn(index);
+ return null;
}
/**
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ public List<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
int count = primaryKeyJoinColumnsSize();
List<ExternalPrimaryKeyJoinColumn> primaryKeyJoinColumns = new ArrayList<ExternalPrimaryKeyJoinColumn>(count);
- for (int index = count; --index >= 0; ) {
- ExternalPrimaryKeyJoinColumn primaryKeyJoinColumn = buildPrimaryKeyJoinColumn(index);
- primaryKeyJoinColumns.add(0, primaryKeyJoinColumn);
+ for (int index = 0; index < count; index++) {
+ primaryKeyJoinColumns.add(buildPrimaryKeyJoinColumn(index));
}
- return new ListListIterable<ExternalPrimaryKeyJoinColumn>(primaryKeyJoinColumns);
+ return primaryKeyJoinColumns;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SequenceGenerator.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SequenceGenerator.java
index 24835b0..684f4c3 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SequenceGenerator.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/SequenceGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalSequenceGenerator;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of a sequence generator.
@@ -25,60 +27,18 @@
* @see IdMapping
* @see ORMConfiguration
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class SequenceGenerator extends PrimaryKeyGenerator
implements ExternalSequenceGenerator {
/**
- * The node name used to store and retrieve the <code>Element</code> encapsulated by this
- * external form.
- */
- static final String SEQUENCE_GENERATOR = "sequence-generator";
-
- /**
- * The attribute name used to store and retrieve the sequence-name property.
- */
- static final String SEQUENCE_NAME = "sequence-name";
-
- /**
* Creates a new <code>SequenceGenerator</code>.
*
* @param parent The parent of this external form
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- SequenceGenerator(BasicMapping parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>SequenceGenerator</code>.
- *
- * @param parent The parent of this external form
- */
- SequenceGenerator(MappedSuperClassEntity parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>SequenceGenerator</code>.
- *
- * @param parent The parent of this external form
- */
- SequenceGenerator(IdMapping parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>SequenceGenerator</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- SequenceGenerator(ORMConfiguration parent, int index) {
+ SequenceGenerator(AbstractExternalForm parent, int index) {
super(parent, index);
}
@@ -97,7 +57,6 @@
return names;
}
-
/**
* {@inheritDoc}
*/
@@ -118,6 +77,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getSequenceNameTextRange() {
+ return getAttributeTextRange(SEQUENCE_NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setSequenceName(String name) {
setAttribute(SEQUENCE_NAME, name);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/StoredProcedureParameter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/StoredProcedureParameter.java
index a7e3e4a..82a379b 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/StoredProcedureParameter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/StoredProcedureParameter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,7 +16,9 @@
import java.util.ArrayList;
import java.util.List;
import org.eclipse.persistence.annotations.Direction;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalStoredProcedureParameter;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -25,10 +27,8 @@
*
* @see NamedStoredProcedureQuery
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class StoredProcedureParameter extends AbstractExternalForm
implements ExternalStoredProcedureParameter {
@@ -38,46 +38,10 @@
private int index;
/**
- * The attribute name used to store and retrieve the direction property.
- */
- static final String DIRECTION = "direction";
-
- /**
- * The attribute name used to store and retrieve the jdbc-type property.
- */
- static final String JDBC_TYPE = "jdbc-type";
-
- /**
- * The attribute name used to store and retrieve the jdbc-type-name property.
- */
- static final String JDBC_TYPE_NAME = "jdbc-type-name";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The attribute name used to store and retrieve the query-parameter property.
- */
- static final String QUERY_PARAMETER = "query-parameter";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String STORED_PROCEDURE_PARAMETER = "parameter";
-
- /**
- * The attribute name used to store and retrieve the type property.
- */
- static final String TYPE = "type";
-
- /**
* Creates a new <code>StoredProcedureParameter</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with
- * the same type owned by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
StoredProcedureParameter(NamedStoredProcedureQuery parent, int index) {
super(parent);
@@ -88,14 +52,6 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(DIRECTION);
@@ -111,6 +67,14 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Direction getDirection() {
return getEnumAttribute(DIRECTION, Direction.class);
}
@@ -119,6 +83,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDirectionTextRange() {
+ return getAttributeTextRange(DIRECTION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Element getElement() {
return getChild(getParent(), STORED_PROCEDURE_PARAMETER, index);
}
@@ -131,10 +103,8 @@
return STORED_PROCEDURE_PARAMETER;
}
- /**
- * {@inheritDoc}
- */
@Override
+ @Deprecated
public int getIndex() {
return index;
}
@@ -159,6 +129,22 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getJdbcTypeNameTextRange() {
+ return getAttributeTextRange(JDBC_TYPE_NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getJdbcTypeTextRange() {
+ return getAttributeTextRange(JDBC_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getName() {
return getAttribute(NAME);
}
@@ -167,6 +153,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getQueryParameter() {
return getAttribute(QUERY_PARAMETER);
}
@@ -175,6 +169,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getQueryParameterTextRange() {
+ return getAttributeTextRange(QUERY_PARAMETER);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getType() {
return getAttribute(TYPE);
}
@@ -183,6 +185,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getTypeTextRange() {
+ return getAttributeTextRange(TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeSelf() {
removeChild(getParent(), getElementName(), index);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/StructConverter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/StructConverter.java
index 8f331fe..7ec7a32 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/StructConverter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/StructConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,7 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalStructConverter;
/**
@@ -25,75 +26,18 @@
* @see EmbeddableEntity
* @see ORMConfiguration
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class StructConverter extends ClassConverter
implements ExternalStructConverter {
/**
- * The attribute name used to store and retrieve the converter property.
- */
- static final String CONVERTER = "converter";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String STRUCT_CONVERTER = "struct-converter";
-
- /**
* Creates a new <code>StructConverter</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- StructConverter(BasicMapMapping parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>StructConverter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- StructConverter(ConvertibleMapping parent, int index) {
- super(parent, index);
- }
-
- /**
- * Creates a new <code>StructConverter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- StructConverter(ElementCollectionMapping parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>StructConverter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- StructConverter(EmbeddableEntity parent, int index) {
- super(parent, index);
- }
-
- /**
- * Creates a new <code>StructConverter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- StructConverter(ORMConfiguration parent, int index) {
+ StructConverter(AbstractExternalForm parent, int index) {
super(parent, index);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Table.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Table.java
index ea52519..8a7839d 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Table.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Table.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,11 +15,11 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.ListIterator;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityTable;
import org.eclipse.persistence.tools.mapping.orm.ExternalUniqueConstraint;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
import org.w3c.dom.Element;
/**
@@ -27,27 +27,10 @@
*
* @see RelationshipMapping
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
-abstract class Table extends AbstractExternalForm implements ExternalEntityTable {
-
- /**
- * The attribute name used to store and retrieve the catalog property.
- */
- static final String CATALOG = "catalog";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The attribute name used to store and retrieve the schema property.
- */
- static final String SCHEMA = "schema";
+abstract class Table extends AbstractExternalForm
+ implements ExternalEntityTable {
/**
* Creates a new <code>Table</code>.
@@ -62,10 +45,10 @@
* {@inheritDoc}
*/
@Override
- public final void addUniqueConstraint(int index, ListIterator<String> columnNames) {
- UniqueConstraint uniqueConstraint = buildUniqueConstraint(index);
- uniqueConstraint.addSelf();
+ public ExternalUniqueConstraint addUniqueConstraint(ListIterable<String> columnNames) {
+ UniqueConstraint uniqueConstraint = buildUniqueConstraint(-1);
uniqueConstraint.setColumnNames(columnNames);
+ return uniqueConstraint;
}
/**
@@ -96,6 +79,14 @@
* {@inheritDoc}
*/
@Override
+ public final TextRange getCatalogTextRange() {
+ return getAttributeTextRange(CATALOG);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getName() {
return getAttribute(NAME);
}
@@ -104,6 +95,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public final String getSchemaName() {
return getAttribute(SCHEMA);
}
@@ -112,23 +111,30 @@
* {@inheritDoc}
*/
@Override
- public final ExternalUniqueConstraint getUniqueConstraint(int index) {
-
- Element element = getChild(UniqueConstraint.UNIQUE_CONSTRAINT, index);
-
- if (element == null) {
- return null;
- }
-
- return buildUniqueConstraint(index);
+ public TextRange getSchemaTextRange() {
+ return getAttributeTextRange(SCHEMA);
}
/**
* {@inheritDoc}
*/
@Override
- public final void removeAllUniqueConstraints()
- {
+ public final ExternalUniqueConstraint getUniqueConstraint(int index) {
+
+ Element element = getChild(UniqueConstraint.UNIQUE_CONSTRAINT, index);
+
+ if (element != null) {
+ return buildUniqueConstraint(index);
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final void removeAllUniqueConstraints() {
removeChildren(UniqueConstraint.UNIQUE_CONSTRAINT);
}
@@ -169,17 +175,16 @@
* {@inheritDoc}
*/
@Override
- public final ListIterable<ExternalUniqueConstraint> uniqueConstraints() {
+ public final List<ExternalUniqueConstraint> uniqueConstraints() {
int count = uniqueConstraintsSize();
List<ExternalUniqueConstraint> uniqueConstraints = new ArrayList<ExternalUniqueConstraint>(count);
- for (int index = count; --index >= 0;) {
- ExternalUniqueConstraint uniqueConstraint = buildUniqueConstraint(index);
- uniqueConstraints.add(0, uniqueConstraint);
+ for (int index = 0; index < count; index++) {
+ uniqueConstraints.add(buildUniqueConstraint(index));
}
- return new ListListIterable<ExternalUniqueConstraint>(uniqueConstraints);
+ return uniqueConstraints;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TableGenerator.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TableGenerator.java
index 5bc9371..993d510 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TableGenerator.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TableGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,11 +15,11 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.ListIterator;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalTableGenerator;
import org.eclipse.persistence.tools.mapping.orm.ExternalUniqueConstraint;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
import org.w3c.dom.Element;
/**
@@ -30,74 +30,18 @@
* @see IdMapping
* @see ORMConfiguration
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class TableGenerator extends PrimaryKeyGenerator
implements ExternalTableGenerator {
/**
- * The attribute name used to store and retrieve the temporal property.
- */
- static final String PK_COLUMN_NAME = "pk-column-name";
-
- /**
- * The attribute name used to store and retrieve the temporal property.
- */
- static final String PK_COLUMN_VALUE = "pk-column-value";
-
- /**
- * The attribute name used to store and retrieve the temporal property.
- */
- static final String TABLE = "table";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String TABLE_GENERATOR = "table-generator";
-
- /**
- * The attribute name used to store and retrieve the temporal property.
- */
- static final String VALUE_COLUMN_NAME = "value-column-name";
-
- /**
* Creates a new <code>TableGenerator</code>.
*
* @param parent The parent of this external form
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- TableGenerator(BasicMapping parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>TableGenerator</code>.
- *
- * @param parent The parent of this external form
- */
- TableGenerator(MappedSuperClassEntity parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>TableGenerator</code>.
- *
- * @param parent The parent of this external form
- */
- TableGenerator(IdMapping parent) {
- super(parent);
- }
-
- /**
- * Creates a new <code>TableGenerator</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- TableGenerator(ORMConfiguration parent, int index) {
+ TableGenerator(AbstractExternalForm parent, int index) {
super(parent, index);
}
@@ -105,10 +49,10 @@
* {@inheritDoc}
*/
@Override
- public void addUniqueConstraint(int index, ListIterator<String> columnNames) {
- UniqueConstraint uniqueConstraint = buildUniqueConstraint(index);
- uniqueConstraint.addSelf();
+ public ExternalUniqueConstraint addUniqueConstraint(ListIterable<String> columnNames) {
+ UniqueConstraint uniqueConstraint = buildUniqueConstraint(-1);
uniqueConstraint.setColumnNames(columnNames);
+ return uniqueConstraint;
}
/**
@@ -153,6 +97,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getPKColumnNameTextRange() {
+ return getAttributeTextRange(PK_COLUMN_NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getPKColumnValue() {
return getAttribute(PK_COLUMN_VALUE);
}
@@ -161,6 +113,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getPKColumnValueTextRange() {
+ return getAttributeTextRange(PK_COLUMN_VALUE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getTableName() {
return getAttribute(TABLE);
}
@@ -169,15 +129,23 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getTableNameTextRange() {
+ return getAttributeTextRange(TABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalUniqueConstraint getUniqueConstraint(int index) {
Element element = getChild(UniqueConstraint.UNIQUE_CONSTRAINT, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildUniqueConstraint(index);
}
- return buildUniqueConstraint(index);
+ return null;
}
/**
@@ -192,6 +160,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getValueColumnNameTextRange() {
+ return getAttributeTextRange(VALUE_COLUMN_NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeUniqueConstraint(int index) {
UniqueConstraint uniqueConstraint = buildUniqueConstraint(index);
@@ -258,17 +234,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalUniqueConstraint> uniqueConstraints() {
+ public List<ExternalUniqueConstraint> uniqueConstraints() {
int count = uniqueConstraintsSize();
List<ExternalUniqueConstraint> uniqueConstraints = new ArrayList<ExternalUniqueConstraint>(count);
- for (int index = count; --index >= 0;) {
- ExternalUniqueConstraint uniqueConstraint = buildUniqueConstraint(index);
- uniqueConstraints.add(0, uniqueConstraint);
+ for (int index = 0; index < count; index++) {
+ uniqueConstraints.add(buildUniqueConstraint(index));
}
- return new ListListIterable<ExternalUniqueConstraint>(uniqueConstraints);
+ return uniqueConstraints;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TenantDiscriminatorColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TenantDiscriminatorColumn.java
index dda83a1..2505ad7 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TenantDiscriminatorColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TenantDiscriminatorColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,7 +14,9 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import javax.persistence.DiscriminatorType;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalTenantDiscriminatorColumn;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -22,10 +24,8 @@
*
* @see MultitenancyPolicy
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class TenantDiscriminatorColumn extends AbstractExternalForm
implements ExternalTenantDiscriminatorColumn {
@@ -41,78 +41,16 @@
private boolean pUnit;
/**
- * The attribute name used to store and retrieve the column-definition property.
- */
- static final String COLUMN_DEFINITION = "column-definition";
-
- /**
- * The attribute name used to store and retrieve the context-property property.
- */
- static final String CONTEXT_PROPERTY = "context-property";
-
- /**
- * The attribute name used to store and retrieve the discriminator-type property.
- */
- static final String DISCRIMINATOR_TYPE = "discriminator-type";
-
- /**
- * The attribute name used to store and retrieve the length property.
- */
- static final String LENGTH = "length";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The attribute name used to store and retrieve the primary-key property.
- */
- static final String PRIMARY_KEY = "primary-key";
-
- /**
- * The attribute name used to store and retrieve the table property.
- */
- static final String TABLE = "table";
-
- /**
- * The node name used to store and retrieve the <code>Element</code>
- * encapsulated by this external form.
- */
- static final String TENANT_DISCRIMINATOR_COLUMN = "tenant-discriminator-column";
-
- /**
* Creates a new <code>TenantDiscriminatorColumn</code>.
*
* @param parent The parent of this external form
*/
- public TenantDiscriminatorColumn(MultitenancyPolicy parent, int index) {
+ public TenantDiscriminatorColumn(AbstractExternalForm parent, int index) {
super(parent);
this.index = index;
}
/**
- * Creates a new <code>TenantDiscriminatorColumn</code>.
- *
- * @param parent The parent of this external form
- */
- public TenantDiscriminatorColumn(ORMConfiguration parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>TenantDiscriminatorColumn</code>.
- *
- * @param parent The parent of this external form
- */
- public TenantDiscriminatorColumn(PersistenceUnit parent, int index) {
- super(parent);
- this.index = index;
- this.pUnit = true;
- }
-
- /**
* {@inheritDoc}
*/
@Override
@@ -127,11 +65,12 @@
PersistenceUnit.PERSISTENCE_UNIT_DEFAULTS
);
}
- } else {
+ }
+ else {
parentElement = getParentElement();
}
- return addChild(parentElement, elementName, index);
+ return addChild(parentElement, elementName);
}
/**
@@ -146,6 +85,22 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getColumnDefinitionTextRange() {
+ return getAttributeTextRange(COLUMN_DEFINITION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getColumnTextRange() {
+ return getTextNodeTextRange(getElement());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getContextProperty() {
return getAttribute(CONTEXT_PROPERTY);
}
@@ -154,6 +109,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getContextPropertyTextRange() {
+ return getAttributeTextRange(CONTEXT_PROPERTY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public DiscriminatorType getDiscriminatorType() {
return getEnumAttribute(DISCRIMINATOR_TYPE, DiscriminatorType.class);
}
@@ -162,6 +125,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDiscriminatorTypeTextRange() {
+ return getAttributeTextRange(DISCRIMINATOR_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected Element getElement() {
Element parentElement;
@@ -188,10 +159,8 @@
return TENANT_DISCRIMINATOR_COLUMN;
}
- /**
- * {@inheritDoc}
- */
@Override
+ @Deprecated
public int getIndex() {
return index;
}
@@ -208,6 +177,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getLengthTextRange() {
+ return getAttributeTextRange(LENGTH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getName() {
return getAttribute(NAME);
}
@@ -216,6 +193,22 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPrimaryKeyTextRange() {
+ return getAttributeTextRange(PRIMARY_KEY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getTableName() {
return getAttribute(TABLE);
}
@@ -224,6 +217,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getTableNameTextRange() {
+ return getAttributeTextRange(TABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Boolean isPrimaryKey() {
return getBooleanAttribute(PRIMARY_KEY);
}
@@ -258,7 +259,7 @@
setAttribute(COLUMN_DEFINITION, definition);
- if (!hasAttributes() && !hasAnyChildren()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -271,7 +272,7 @@
setAttribute(CONTEXT_PROPERTY, contextProperty);
- if (!hasAttributes() && !hasAnyChildren()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -284,28 +285,7 @@
setAttribute(DISCRIMINATOR_TYPE, type);
- if (!hasAttributes() && !hasAnyChildren()) {
- removeSelf();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setIndex(int index) {
- this.index = index;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setIsPrimaryKey(Boolean primaryKey) {
-
- setAttribute(PRIMARY_KEY, primaryKey);
-
- if (!hasAttributes() && !hasAnyChildren()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -318,7 +298,7 @@
setAttribute(LENGTH, length);
- if (!hasAttributes() && !hasAnyChildren()) {
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -331,7 +311,20 @@
setAttribute(NAME, name);
- if (!hasAttributes() && !hasAnyChildren()) {
+ if (!hasAnything()) {
+ removeSelf();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setPrimaryKey(Boolean primaryKey) {
+
+ setAttribute(PRIMARY_KEY, primaryKey);
+
+ if (!hasAnything()) {
removeSelf();
}
}
@@ -344,7 +337,7 @@
setAttribute(TABLE, tableName);
- if (!hasAttributes() && !hasAnyChildren()) {
+ if (!hasAnything()) {
removeSelf();
}
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TenantTableDiscriminator.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TenantTableDiscriminator.java
new file mode 100644
index 0000000..2676764
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TenantTableDiscriminator.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * This software is the proprietary information of Oracle Corporation.
+ * Use is subject to license terms.
+ */
+package org.eclipse.persistence.tools.mapping.orm.dom;
+
+import org.eclipse.persistence.annotations.TenantTableDiscriminatorType;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
+import org.eclipse.persistence.tools.mapping.orm.ExternalTenantTableDiscriminator;
+import org.eclipse.persistence.tools.utility.TextRange;
+import org.w3c.dom.Element;
+
+/**
+ * The external form of the tenant table discriminator.
+ *
+ * @version 2.6
+ */
+final class TenantTableDiscriminator extends AbstractExternalForm
+ implements ExternalTenantTableDiscriminator {
+
+ /**
+ * Creates a new <code>TenantTableDiscriminator</code>.
+ *
+ * @param parent The parent of this external form
+ */
+ public TenantTableDiscriminator(MultitenancyPolicy parent) {
+ super(parent);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getContextProperty() {
+ return getAttribute(CONTEXT_PROPERTY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getContextPropertyTextRange() {
+ return getAttributeTextRange(CONTEXT_PROPERTY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TenantTableDiscriminatorType getDiscriminatorType() {
+ return getEnumAttribute(TENANT_TABLE_DISCRIMINATOR_TYPE, TenantTableDiscriminatorType.class);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getDiscriminatorTypeTextRange() {
+ return getAttributeTextRange(TENANT_TABLE_DISCRIMINATOR_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Element getElement() {
+ return getChild(getParentElement(), TENANT_TABLE_DISCRIMINATOR);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getElementName() {
+ return TENANT_TABLE_DISCRIMINATOR;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setContextProperty(String contextProperty) {
+ setAttribute(CONTEXT_PROPERTY, contextProperty);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setDiscriminatorType(TenantTableDiscriminatorType type) {
+ setAttribute(TENANT_TABLE_DISCRIMINATOR_TYPE, type);
+ }
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TimeOfDay.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TimeOfDay.java
index e8bf0bd..99b6119 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TimeOfDay.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TimeOfDay.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,46 +15,21 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalTimeOfDay;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of a time of day, which is a child of an cache.
*
* @see Cache
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class TimeOfDay extends AbstractExternalForm
implements ExternalTimeOfDay {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String EXPIRY_TIME_OF_DAY = "expiry-time-of-day";
-
- /**
- * The attribute name used to store and retrieve the hour property.
- */
- static final String HOUR = "hour";
-
- /**
- * The attribute name used to store and retrieve the millisecond property.
- */
- static final String MILLISECOND = "millisecond";
-
- /**
- * The attribute name used to store and retrieve the minute property.
- */
- static final String MINUTE = "minute";
-
- /**
- * The attribute name used to store and retrieve the second property.
- */
- static final String SECOND = "second";
-
- /**
* Creates a new <code>TimeOfDay</code>.
*
* @param parent The parent of this external form
@@ -96,6 +71,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getHourTextRange() {
+ return getAttributeTextRange(HOUR);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Integer getMillisecond() {
return getIntegerAttribute(MILLISECOND);
}
@@ -104,6 +87,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMillisecondTextRange() {
+ return getAttributeTextRange(MILLISECOND);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Integer getMinute() {
return getIntegerAttribute(MINUTE);
}
@@ -112,6 +103,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMinuteTextRange() {
+ return getAttributeTextRange(MINUTE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Integer getSecond() {
return getIntegerAttribute(SECOND);
}
@@ -120,6 +119,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getSecondTextRange() {
+ return getAttributeTextRange(SECOND);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setHour(Integer hour) {
setAttribute(HOUR, hour);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransformationMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransformationMapping.java
index 83642f6..b2f9c48 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransformationMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransformationMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,11 +16,11 @@
import java.util.ArrayList;
import java.util.List;
import javax.persistence.FetchType;
+import org.eclipse.persistence.tools.mapping.orm.ExternalReadTransformer;
import org.eclipse.persistence.tools.mapping.orm.ExternalTransformationMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalTransformer;
import org.eclipse.persistence.tools.mapping.orm.ExternalWriteTransformer;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -28,46 +28,18 @@
*
* @see EmbeddableEntity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class TransformationMapping extends NonTransientMapping
implements ExternalTransformationMapping {
/**
- * The attribute name used to store and retrieve the access property.
- */
- static final String ACCESS = "access";
-
- /**
- * The attribute name used to store and retrieve the fetch property.
- */
- static final String FETCH = "fetch";
-
- /**
- * The attribute name used to store and retrieve the mutable property.
- */
- static final String MUTABLE = "mutable";
-
- /**
- * The attribute name used to store and retrieve the optional property.
- */
- static final String OPTIONAL = "optional";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String TRANSFORMATION = "transformation";
-
- /**
* Creates a new <code>TransformationMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with
- * the same type owned by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- TransformationMapping(EmbeddableEntity parent, int index) {
+ TransformationMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -85,8 +57,8 @@
* {@inheritDoc}
*/
@Override
- public ExternalWriteTransformer addWriteTransformer(int index) {
- WriteTransfomer writeTransformer = buildWriteTransformer(index);
+ public ExternalWriteTransformer addWriteTransformer() {
+ WriteTransfomer writeTransformer = buildWriteTransformer(-1);
writeTransformer.addSelf();
return writeTransformer;
}
@@ -147,7 +119,31 @@
* {@inheritDoc}
*/
@Override
- public ExternalTransformer getReadTransformer() {
+ public TextRange getFetchTypeTextRange() {
+ return getAttributeTextRange(FETCH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getMutableTextRange() {
+ return getAttributeTextRange(MUTABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getOptionalTextRange() {
+ return getAttributeTextRange(OPTIONAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ExternalReadTransformer getReadTransformer() {
if (hasChild(ReadTransformer.READ_TRANSFORMER)) {
return buildReadTransformer();
@@ -164,11 +160,11 @@
Element element = getChild(WriteTransfomer.WRITE_TRANSFORMER, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildWriteTransformer(index);
}
- return buildWriteTransformer(index);
+ return null;
}
/**
@@ -241,17 +237,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalWriteTransformer> writeTransformers() {
+ public List<ExternalWriteTransformer> writeTransformers() {
int count = writeTransformersSize();
- List<ExternalWriteTransformer> writeTransformers = new ArrayList<ExternalWriteTransformer>(count);
+ List<ExternalWriteTransformer> transformers = new ArrayList<ExternalWriteTransformer>(count);
- for (int index = count; --index >= 0;) {
- ExternalWriteTransformer joinColumn = buildWriteTransformer(index);
- writeTransformers.add(0, joinColumn);
+ for (int index = 0; index < count; index++) {
+ transformers.add(buildWriteTransformer(index));
}
- return new ListListIterable<ExternalWriteTransformer>(writeTransformers);
+ return transformers;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Transformer.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Transformer.java
index 0f252b7..ee17df7 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Transformer.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Transformer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,29 +15,19 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalTransformer;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form of a transformer.
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
abstract class Transformer extends AbstractExternalForm
implements ExternalTransformer {
/**
- * The attribute name used to store and retrieve the method property.
- */
- static final String METHOD = "method";
-
- /**
- * The attribute name used to store and retrieve the transformer-class property.
- */
- static final String TRANSFORMER_CLASS = "transformer-class";
-
- /**
* Creates a new <code>Transformer</code>.
*
* @param parent The parent of this external form
@@ -57,12 +47,11 @@
return names;
}
-
/**
* {@inheritDoc}
*/
@Override
- public String getMethodName() {
+ public final String getMethodName() {
return getAttribute(METHOD);
}
@@ -70,7 +59,15 @@
* {@inheritDoc}
*/
@Override
- public String getTransfomerClassName() {
+ public final TextRange getMethodNameTextRange() {
+ return getAttributeTextRange(METHOD);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final String getTransfomerClassName() {
return getAttribute(TRANSFORMER_CLASS);
}
@@ -78,7 +75,15 @@
* {@inheritDoc}
*/
@Override
- public void setMethodName(String name) {
+ public final TextRange getTransfomerClassNameTextRange() {
+ return getAttributeTextRange(TRANSFORMER_CLASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final void setMethodName(String name) {
setAttribute(METHOD, name);
}
@@ -86,7 +91,7 @@
* {@inheritDoc}
*/
@Override
- public void setTransformerClassName(String name) {
+ public final void setTransformerClassName(String name) {
setAttribute(TRANSFORMER_CLASS, name);
}
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransientMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransientMapping.java
index 07970a1..1ed36ed 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransientMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransientMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -20,27 +20,18 @@
*
* @see EmbeddableEntity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class TransientMapping extends Mapping
implements ExternalTransientMapping {
/**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String TRANSIENT = "transient";
-
- /**
* Creates a new <code>TransientMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- TransientMapping(EmbeddableEntity parent, int index) {
+ TransientMapping(Embeddable parent, int index) {
super(parent, index);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TypeConverter.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TypeConverter.java
index 6868b22..af695c9 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TypeConverter.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TypeConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -15,7 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalTypeConverter;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -25,10 +27,8 @@
* @see EmbeddableEntity
* @see ORMConfiguration
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class TypeConverter extends AbstractExternalForm
implements ExternalTypeConverter {
@@ -38,75 +38,17 @@
private int index;
/**
- * The attribute name used to store and retrieve the data-type property.
- */
- static final String DATA_TYPE = "data-type";
-
- /**
- * The attribute name used to store and retrieve the name property.
- */
- static final String NAME = "name";
-
- /**
- * The attribute name used to store and retrieve the object-type property.
- */
- static final String OBJECT_TYPE = "object-type";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String TYPE_CONVERTER = "type-converter";
-
- /**
* Creates a new <code>TypeConverter</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- TypeConverter(ConvertibleMapping parent) {
- super(parent);
- this.index = -1;
- }
-
- /**
- * Creates a new <code>TypeConverter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- TypeConverter(EmbeddableEntity parent, int index) {
+ TypeConverter(AbstractExternalForm parent, int index) {
super(parent);
this.index = index;
}
/**
- * Creates a new <code>TypeConverter</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- TypeConverter(ORMConfiguration parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
-
- if (index == -1) {
- return super.addSelf(elementName, elementNamesOrder);
- }
-
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
* {@inheritDoc}
*/
@Override
@@ -122,6 +64,14 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getDatatype() {
return getAttribute(DATA_TYPE);
}
@@ -130,6 +80,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getDatatypeTextRange() {
+ return getAttributeTextRange(DATA_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Element getElement() {
if (index == -1) {
@@ -147,10 +105,8 @@
return TYPE_CONVERTER;
}
- /**
- * {@inheritDoc}
- */
@Override
+ @Deprecated
public int getIndex() {
return index;
}
@@ -167,6 +123,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getObjecttype() {
return getAttribute(OBJECT_TYPE);
}
@@ -175,6 +139,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getObjecttypeTextRange() {
+ return getAttributeTextRange(OBJECT_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeSelf() {
if (index == -1) {
super.removeSelf();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/UniqueConstraint.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/UniqueConstraint.java
index 900e4d4..6f270c9 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/UniqueConstraint.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/UniqueConstraint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,10 +14,10 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.util.List;
-import java.util.ListIterator;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalUniqueConstraint;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
import org.w3c.dom.Element;
/**
@@ -25,11 +25,8 @@
*
* @see TableGenerator
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class UniqueConstraint extends AbstractExternalForm
implements ExternalUniqueConstraint {
@@ -39,35 +36,12 @@
private int index;
/**
- * The element name used to store and retrieve the column-name child element.
- */
- static final String COLUMN_NAME = "column-name";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String UNIQUE_CONSTRAINT = "unique-constraint";
-
- /**
* Creates a new <code>UniqueConstraint</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- UniqueConstraint(Table parent, int index) {
- super(parent);
- this.index = index;
- }
-
- /**
- * Creates a new <code>UniqueConstraint</code>.
- *
- * @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
- */
- UniqueConstraint(TableGenerator parent, int index) {
+ UniqueConstraint(AbstractExternalForm parent, int index) {
super(parent);
this.index = index;
}
@@ -76,16 +50,16 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
- return addChild(getParent(), elementName, index, elementNamesOrder);
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
}
/**
* {@inheritDoc}
*/
@Override
- public ListIterable<String> columnNames() {
- return new ListListIterable<String>(getChildrenTextNode(COLUMN_NAME));
+ public List<String> columnNames() {
+ return getChildrenTextNode(COLUMN_NAME);
}
/**
@@ -100,6 +74,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getColumnTextRange(int index) {
+ return getChildTextNodeTextRange(COLUMN_NAME, index);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Element getElement() {
return getChild(getParent(), getElementName(), index);
}
@@ -112,10 +94,8 @@
return UNIQUE_CONSTRAINT;
}
- /**
- * {@inheritDoc}
- */
@Override
+ @Deprecated
public int getIndex() {
return index;
}
@@ -132,12 +112,12 @@
* {@inheritDoc}
*/
@Override
- public void setColumnNames(ListIterator<String> columnNames) {
+ public void setColumnNames(ListIterable<String> columnNames) {
removeChildren(COLUMN_NAME);
- while (columnNames.hasNext()) {
- addChildTextNode(COLUMN_NAME, columnNames.next());
+ for (String columnName : columnNames) {
+ addChildTextNode(COLUMN_NAME, columnName);
}
}
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VariableOneToOneMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VariableOneToOneMapping.java
index 15c1a4d..8b331a7 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VariableOneToOneMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VariableOneToOneMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,7 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.FetchType;
@@ -22,9 +23,7 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalVariableOneToOneMapping;
import org.eclipse.persistence.tools.utility.ObjectTools;
-import org.eclipse.persistence.tools.utility.iterable.EmptyListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -32,10 +31,8 @@
*
* @see Entity
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class VariableOneToOneMapping extends NonTransientMapping
implements ExternalVariableOneToOneMapping {
@@ -45,73 +42,12 @@
private List<String> cascadeTypeIndices;
/**
- * The element name used to store and retrieve the mutable child text node.
- */
- static final String CASCADE = "cascade";
-
- /**
- * The name of the element used to specify the cascade-all property.
- */
- static final String CASCADE_ALL = "cascade-all";
-
- /**
- * The name of the element used to specify the cascade-detach property.
- */
- static final String CASCADE_DETACH = "cascade-detach";
-
- /**
- * The name of the element used to specify the cascade-merge property.
- */
- static final String CASCADE_MERGE = "cascade-merge";
-
- /**
- * The name of the element used to specify the cascade-persist property.
- */
- static final String CASCADE_PERSIST = "cascade-persist";
-
- /**
- * The name of the element used to specify the cascade-refresh property.
- */
- static final String CASCADE_REFRESH = "cascade-refresh";
-
- /**
- * The name of the element used to specify the cascade-remove property.
- */
- static final String CASCADE_REMOVE = "cascade-remove";
-
- /**
- * The attribute name used to store and retrieve the fetch property.
- */
- static final String FETCH = "fetch";
-
- /**
- * The attribute name used to store and retrieve the optional property.
- */
- static final String OPTIONAL = "optional";
-
- /**
- * The element name used to store and retrieve the private-owned element.
- */
- static final String PRIVATE_OWNED = "private-owned";
-
- /**
- * The attribute name used to store and retrieve the target-interface property.
- */
- static final String TARGET_INTERFACE = "target-interface";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String VARIABLE_ONE_TO_ONE = "variable-one-to-one";
-
- /**
* Creates a new <code>VariableOneToOneMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with
- * the same type owned by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
- VariableOneToOneMapping(EmbeddableEntity parent, int index) {
+ VariableOneToOneMapping(Embeddable parent, int index) {
super(parent, index);
}
@@ -134,30 +70,31 @@
* {@inheritDoc}
*/
@Override
- public void addDiscriminatorClass(int index, String discrimator, String value) {
- DiscriminatorClass discriminatorClass = buildDiscriminatorClass(index);
- discriminatorClass.addSelf();
+ public ExternalDiscriminatorClass addDiscriminatorClass(String discrimator, String value) {
+ DiscriminatorClass discriminatorClass = buildDiscriminatorClass(-1);
discriminatorClass.setDiscriminator(discrimator);
discriminatorClass.setValue(value);
+ return discriminatorClass;
}
/**
* {@inheritDoc}
*/
@Override
- public void addDiscriminatorColumn() {
+ public ExternalDiscriminatorColumn addDiscriminatorColumn() {
DiscriminatorColumn discriminatorColumn = buildDiscriminatorColumn();
discriminatorColumn.addSelf();
+ return discriminatorColumn;
}
/**
* {@inheritDoc}
*/
@Override
- public void addJoinColumn(int index, String name) {
- JoinColumn joinColumn = buildJoinColumn(index);
- joinColumn.addSelf();
+ public ExternalJoinColumn addJoinColumn(String name) {
+ JoinColumn joinColumn = buildJoinColumn(-1);
joinColumn.setName(name);
+ return joinColumn;
}
/**
@@ -210,7 +147,7 @@
}
private JoinColumn buildJoinColumn(int index) {
- return new JoinColumn(this, index);
+ return new JoinColumn(this, JoinColumn.JOIN_COLUMN, index);
}
private String cascadeType(CascadeType type) {
@@ -260,12 +197,12 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<CascadeType> cascadeTypes() {
+ public List<CascadeType> cascadeTypes() {
Element element = getChild(CASCADE);
if (element == null) {
- return EmptyListIterable.instance();
+ return Collections.emptyList();
}
List<Element> children = getChildren(element);
@@ -279,24 +216,23 @@
}
}
- return new ListListIterable<CascadeType>(cascadeTypes);
+ return cascadeTypes;
}
/**
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalDiscriminatorClass> discriminatorClasses() {
+ public List<ExternalDiscriminatorClass> discriminatorClasses() {
int count = discriminatorClassesSize();
List<ExternalDiscriminatorClass> discriminatorClasses = new ArrayList<ExternalDiscriminatorClass>(count);
- for (int index = count; --index >= 0;) {
- ExternalDiscriminatorClass discriminatorClass = buildDiscriminatorClass(index);
- discriminatorClasses.add(0, discriminatorClass);
+ for (int index = 0; index < count; index++) {
+ discriminatorClasses.add(buildDiscriminatorClass(index));
}
- return new ListListIterable<ExternalDiscriminatorClass>(discriminatorClasses);
+ return discriminatorClasses;
}
/**
@@ -315,7 +251,7 @@
int count = discriminatorClassesSize();
- for (int index = count; --index >= 0;) {
+ for (int index = 0; index < count; index++) {
ExternalDiscriminatorClass discriminatorClass = buildDiscriminatorClass(index);
if (ObjectTools.equals(discriminator, discriminatorClass.getDiscriminator()) &&
@@ -361,15 +297,47 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getFetchTypeTextRange() {
+ return getAttributeTextRange(FETCH);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalJoinColumn getJoinColumn(int index) {
Element element = getChild(JoinColumn.JOIN_COLUMN, index);
- if (element == null) {
- return null;
+ if (element != null) {
+ return buildJoinColumn(index);
}
- return buildJoinColumn(index);
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getOptionalTextRange() {
+ return getAttributeTextRange(OPTIONAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getOrphanRemovalTextRange() {
+ return getAttributeTextRange(ORPHAN_REMOVAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TextRange getPrivateOwnedTextRange() {
+ return getChildTextRange(PRIVATE_OWNED);
}
/**
@@ -384,6 +352,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getTargetInterfaceNameTextRange() {
+ return getAttributeTextRange(TARGET_INTERFACE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected void initialize() {
super.initialize();
cascadeTypeIndices = buildCascadeTypeIndices();
@@ -417,17 +393,16 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalJoinColumn> joinColumns() {
+ public List<ExternalJoinColumn> joinColumns() {
int count = joinColumnsSize();
List<ExternalJoinColumn> joinColumns = new ArrayList<ExternalJoinColumn>(count);
- for (int index = count; --index >= 0;) {
- ExternalJoinColumn joinColumn = buildJoinColumn(index);
- joinColumns.add(0, joinColumn);
+ for (int index = 0; index < count; index++) {
+ joinColumns.add(buildJoinColumn(index));
}
- return new ListListIterable<ExternalJoinColumn>(joinColumns);
+ return joinColumns;
}
/**
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VersionMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VersionMapping.java
index 6cb47fa..372e98a 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VersionMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VersionMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,66 +13,28 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
+import org.eclipse.persistence.tools.mapping.orm.ExternalEntityColumn;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.TemporalType;
import org.eclipse.persistence.tools.mapping.orm.ExternalVersionMapping;
+import org.eclipse.persistence.tools.utility.TextRange;
/**
* The external form for a version mapping, which is a child of an entity.
*
* @see MappedSuperClassEntity
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class VersionMapping extends ConvertibleMapping
implements ExternalVersionMapping {
/**
- * The element name used to store and retrieve the convert child text node.
- */
- static final String CONVERT = "convert";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getNoSqlField() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setNoSqlField(String field) {
- // No supported
- }
-
- /**
- * The attribute name used to store and retrieve the mutable property.
- */
- static final String MUTABLE = "mutable";
-
- /**
- * The element name used to store and retrieve the temporal child text node.
- */
- static final String TEMPORAL = "temporal";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String VERSION = "version";
-
- /**
* Creates a new <code>VersionMapping</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
VersionMapping(MappedSuperClassEntity parent, int index) {
super(parent, index);
@@ -82,6 +44,16 @@
* {@inheritDoc}
*/
@Override
+ public ExternalEntityColumn addColumn() {
+ EntityColumn column = buildColumn();
+ column.addSelf();
+ return column;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(NAME);
@@ -92,7 +64,7 @@
}
private EntityColumn buildColumn() {
- return new EntityColumn(this);
+ return new EntityColumn(this, EntityColumn.COLUMN, -1);
}
/**
@@ -146,6 +118,23 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getMutableTextRange() {
+ return getAttributeTextRange(MUTABLE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getNoSqlField() {
+ // No supported
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public TemporalType getTemporalType() {
return getChildEnumNode(TEMPORAL, TemporalType.class);
}
@@ -154,6 +143,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getTemporalTypeTextRange() {
+ return getChildTextNodeTextRange(TEMPORAL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Boolean isMutable() {
return getBooleanAttribute(MUTABLE);
}
@@ -208,6 +205,14 @@
* {@inheritDoc}
*/
@Override
+ public void setNoSqlField(String field) {
+ // No supported
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setTemporalType(TemporalType type) {
updateChildTextNode(TEMPORAL, type);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/WriteTransfomer.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/WriteTransfomer.java
index 316a60c..db695a6 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/WriteTransfomer.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/WriteTransfomer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -20,14 +20,12 @@
import org.w3c.dom.Element;
/**
- * The external form of a transformer.
+ * The external form of a write transformer.
*
* @see TransformationMapping
*
- * @version 2.5
- * @author Les Davis
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class WriteTransfomer extends Transformer
implements ExternalWriteTransformer {
@@ -37,17 +35,10 @@
private int index;
/**
- * The node name used to store and retrieve the <code>Element</code> encapsulated by this
- * external form.
- */
- static final String WRITE_TRANSFORMER = "write-transformer";
-
- /**
* Creates a new <code>WriteTransfomer</code>.
*
* @param parent The parent of this external form
- * @param index The position of the element within the list of children with the same type owned
- * by the parent
+ * @param index The position of the element within the list of children with the same type owned by the parent
*/
WriteTransfomer(TransformationMapping parent, int index) {
super(parent);
@@ -67,17 +58,7 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder)
- {
- return addChild(getParent(), elementName, index, elementNamesOrder);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected List<String> buildAttributeNamesOrder()
- {
+ protected List<String> buildAttributeNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(TRANSFORMER_CLASS);
names.add(METHOD);
@@ -85,15 +66,14 @@
}
private EntityColumn buildColumn() {
- return new EntityColumn(this, -1);
+ return new EntityColumn(this, EntityColumn.COLUMN, -1);
}
/**
* {@inheritDoc}
*/
@Override
- protected List<String> buildElementNamesOrder()
- {
+ protected List<String> buildElementNamesOrder() {
List<String> names = new ArrayList<String>();
names.add(EntityColumn.COLUMN);
return names;
@@ -103,15 +83,21 @@
* {@inheritDoc}
*/
@Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ index = index(parent, child, elementName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ExternalEntityColumn getColumn() {
- Element element = getChild(EntityColumn.COLUMN);
-
- if (element == null) {
- return null;
+ if (hasChild(EntityColumn.COLUMN)) {
+ return buildColumn();
}
- return buildColumn();
+ return null;
}
/**
@@ -139,14 +125,6 @@
* {@inheritDoc}
*/
@Override
- public int getIndex() {
- return index;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public void removeColumn() {
EntityColumn column = buildColumn();
column.removeSelf();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceConfiguration.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceConfiguration.java
index 9cfa4ce..55bf86d 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceConfiguration.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceConfiguration.java
Binary files differ
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceRepository.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceRepository.java
index 4c3ba88..f9cba16 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceRepository.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceRepository.java
Binary files differ
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceUnit.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceUnit.java
index ed3380a..b7f831c 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceUnit.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalPersistenceUnit.java
Binary files differ
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalProperty.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalProperty.java
deleted file mode 100644
index e53a63b..0000000
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/ExternalProperty.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.persistence.tools.mapping.persistence;
-
-import org.eclipse.persistence.tools.mapping.orm.ExternalForm;
-
-/**
- * Represents a configuration property key/value pair listed in the properties section of a
- * persistence unit defined in the persistence configuration xml.
- * <p>
- * Provisional API: This interface is part of an interim API that is still under development and
- * expected to change significantly before reaching stability. It is available at this early stage
- * to solicit feedback from pioneering adopters on the understanding that any code that uses this
- * API will almost certainly be broken (repeatedly) as the API evolves.<p>
- *
- * @version 2.5
- * @author John Bracken
- */
-public interface ExternalProperty extends ExternalForm {
-
- /**
- * Returns the position of this property.
- */
- int getIndex();
-
- /**
- * Returns the name of the property.
- */
- String getName();
-
- /**
- * Returns the value of the property.
- */
- String getValue();
-
- /**
- * Sets the name of the property.
- */
- void setName(String name);
-
- /**
- * Sets the value of the property.
- */
- void setValue(String value);
-}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/PersistenceDocumentType.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/PersistenceDocumentType.java
index 3a7aa0b..ed39236 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/PersistenceDocumentType.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/PersistenceDocumentType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -16,7 +16,6 @@
import java.util.ArrayList;
import java.util.List;
import org.eclipse.persistence.tools.utility.StringTools;
-
import static org.eclipse.persistence.tools.mapping.orm.XmlConstants.*;
import static org.eclipse.persistence.tools.mapping.persistence.PersistenceXmlConstants.*;
@@ -28,7 +27,7 @@
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.<p>
*
- * @version 2.5
+ * @version 2.6
*/
public enum PersistenceDocumentType {
@@ -89,7 +88,7 @@
List<PersistenceDocumentType> types = new ArrayList<PersistenceDocumentType>(2);
types.add(JPA_1_0);
types.add(JPA_2_0);
-// types.add(JPA_2_1); // Not supported yet
+ types.add(JPA_2_1);
return types;
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/PersistenceXmlConstants.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/PersistenceXmlConstants.java
index e6d3805..330e508 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/PersistenceXmlConstants.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/PersistenceXmlConstants.java
Binary files differ
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceConfiguration.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceConfiguration.java
index f1ef664..2a87f14 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceConfiguration.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -13,82 +13,50 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.persistence.dom;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.eclipse.persistence.tools.mapping.orm.dom.AbstractExternalForm;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
+import org.eclipse.persistence.tools.mapping.ExternalFormHelper;
import org.eclipse.persistence.tools.mapping.persistence.ExternalPersistenceConfiguration;
import org.eclipse.persistence.tools.mapping.persistence.ExternalPersistenceUnit;
import org.eclipse.persistence.tools.mapping.persistence.PersistenceDocumentType;
-import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.eclipse.persistence.tools.utility.iterable.ListListIterable;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import static org.eclipse.persistence.tools.mapping.persistence.PersistenceXmlConstants.*;
/**
* The external form interacting with the XML document for the Persistence Configuration file.
*
- * @version 2.5
- * @author Les Davis
- * @author Pascal Filion
+ * @version 2.6
*/
@SuppressWarnings("nls")
-final class PersistenceConfiguration extends AbstractExternalForm
- implements ExternalPersistenceConfiguration {
+public final class PersistenceConfiguration extends AbstractExternalForm
+ implements ExternalPersistenceConfiguration {
/**
- * The root document that represents this persistence.xml.
+ * The helper is used when the document needs to be modified.
*/
- private Document document;
-
- /**
- * The URI of the ORM namespace.
- */
- static final String NAMESPACE_URI = "http://java.sun.com/xml/ns/persistence";
-
- /**
- * The node name used to store and retrieve the {@link Element} encapsulated by this external form.
- */
- static final String PERSISTENCE = "persistence";
-
- /**
- * The URI of the Persistence Configuration schema, JPA 1.0.
- */
- private static final String PERSISTENCE_XSD_URI_1_0 = "http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";
-
- /**
- * The URI of the Persistence Configuration schema, JPA 2.0.
- */
- private static final String PERSISTENCE_XSD_URI_2_0 = "http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";
-
- /**
- * The URI of the Persistence Configuration schema, JPA 2.1.
- */
- private static final String PERSISTENCE_XSD_URI_2_1 = "http://java.sun.com/xml/ns/persistence/persistence_2_1.xsd";
-
- /**
- * The element name of the child text node for version of the Persistence Configuration file.
- */
- static final String VERSION = "version";
+ private final ExternalFormHelper helper;
/**
* Creates a new <code>PersistenceConfiguration</code>.
*
- * @param document The root document that represents this persistence.xml
+ * @param helper The helper is used when the document needs to be modified
*/
- PersistenceConfiguration(Document document) {
+ public PersistenceConfiguration(ExternalFormHelper helper) {
super(null);
- this.document = document;
+ this.helper = helper;
}
/**
* {@inheritDoc}
*/
@Override
- public void addPersistenceUnit(int index, String name) {
- PersistenceUnit persistenceUnit = buildPersistenceUnit(index);
- persistenceUnit.addSelf();
+ public ExternalPersistenceUnit addPersistenceUnit(String name) {
+ PersistenceUnit persistenceUnit = buildPersistenceUnit(-1);
persistenceUnit.setName(name);
+ return persistenceUnit;
}
/**
@@ -103,27 +71,19 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
-
- Element element = document.createElementNS(NAMESPACE_URI, elementName);
- element.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", NAMESPACE_URI);
- addXmlns(element, "xsi", XSI_URI);
- element.setAttributeNS(XSI_URI, "xsi:schemaLocation", buildSchemaLocation(PersistenceDocumentType.JPA_2_0));
- element.setAttribute(VERSION, getBuildVersion());
-
- document.appendChild(element);
-
- return element;
+ public Element addSelf(String elementName, List<String> elementNamesOrder) {
+ return getHelper().buildPersistenceConfiguration(this);
}
private PersistenceUnit buildPersistenceUnit(int index) {
return new PersistenceUnit(this, index);
}
- private String buildSchemaLocation(PersistenceDocumentType type) {
+ @SuppressWarnings("incomplete-switch")
+ public String buildSchemaLocation(PersistenceDocumentType type) {
StringBuilder sb = new StringBuilder();
- sb.append(NAMESPACE_URI);
+ sb.append(PERSISTENCE_NAMESPACE_URI);
sb.append(" ");
switch (type) {
@@ -140,38 +100,7 @@
*/
@Override
public String getBuildVersion() {
- return PersistenceDocumentType.JPA_2_0.getVersion();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Element getElement() {
- return getRootElement();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getElementName() {
- return PERSISTENCE;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ExternalPersistenceUnit getPersistenceUnit(int index) {
-
- Element element = getChild(PersistenceUnit.PERSISTENCE_UNIT, index);
-
- if (element == null) {
- return null;
- }
-
- return buildPersistenceUnit(index);
+ return PersistenceDocumentType.JPA_2_1.getVersion();
}
/**
@@ -186,17 +115,63 @@
* {@inheritDoc}
*/
@Override
- public ListIterable<ExternalPersistenceUnit> persistenceUnits() {
+ public Element getElement() {
+ return getRootElement();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getElementName() {
+ return PERSISTENCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ExternalFormHelper getHelper() {
+ return helper;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public URL getLocation() {
+ return helper.getLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ExternalPersistenceUnit getPersistenceUnit(int index) {
+
+ Element element = getChild(PersistenceUnit.PERSISTENCE_UNIT, index);
+
+ if (element != null) {
+ return buildPersistenceUnit(index);
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<ExternalPersistenceUnit> persistenceUnits() {
int count = getChildrenSize(PersistenceUnit.PERSISTENCE_UNIT);
List<ExternalPersistenceUnit> persistenceUnits = new ArrayList<ExternalPersistenceUnit>(count);
- for (int index = count; --index >= 0; ) {
- ExternalPersistenceUnit persistenceUnit = buildPersistenceUnit(index);
- persistenceUnits.add(0, persistenceUnit);
+ for (int index = 0; index < count; index++) {
+ persistenceUnits.add(buildPersistenceUnit(index));
}
- return new ListListIterable<ExternalPersistenceUnit>(persistenceUnits);
+ return persistenceUnits;
}
/**
@@ -221,7 +196,7 @@
*/
@Override
public void setDocumentType(PersistenceDocumentType type) {
- setAttribute(VERSION, type.getVersion());
+ setAttribute(XSD_VERSION, type.getVersion());
setSchemaLocation(buildSchemaLocation(type));
}
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceRepository.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceRepository.java
index bed73ce..39b9984 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceRepository.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceRepository.java
Binary files differ
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceUnit.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceUnit.java
index 7ea1ae5..67f3cd8 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceUnit.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/PersistenceUnit.java
Binary files differ
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/Property.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/Property.java
index e41fd86..6ca8760 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/Property.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/persistence/dom/Property.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,8 +14,10 @@
package org.eclipse.persistence.tools.mapping.persistence.dom;
import java.util.List;
-import org.eclipse.persistence.tools.mapping.orm.dom.AbstractExternalForm;
-import org.eclipse.persistence.tools.mapping.persistence.ExternalProperty;
+import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
+import org.eclipse.persistence.tools.mapping.ExternalProperty;
+import org.eclipse.persistence.tools.mapping.ExternalPropertyHolder;
+import org.eclipse.persistence.tools.utility.TextRange;
import org.w3c.dom.Element;
/**
@@ -23,10 +25,8 @@
*
* @see PersistenceUnit
*
- * @version 2.5
- * @author Pascal Filion
+ * @version 2.6
*/
-@SuppressWarnings("nls")
final class Property extends AbstractExternalForm
implements ExternalProperty {
@@ -36,26 +36,6 @@
private int index;
/**
- * The attribute name used to store the key mapping the value.
- */
- static final String NAME = "name";
-
- /**
- * The element name used of the XML node.
- */
- static final String PROPERTIES = "properties";
-
- /**
- * The element name used of the XML node.
- */
- static final String PROPERTY = "property";
-
- /**
- * The attribute name used to store the value mapped to a key.
- */
- static final String VALUE = "value";
-
- /**
* Creates a new <code>Property</code>.
*
* @param parent The parent of this external form
@@ -71,15 +51,25 @@
* {@inheritDoc}
*/
@Override
- protected Element addSelf(String elementName, List<String> elementNamesOrder) {
+ public Element addSelf(String elementName, List<String> elementNamesOrder) {
- Element element = getChild(getParent(), elementName);
+ Element element = getChild(getParent(), ExternalPropertyHolder.PROPERTIES);
if (element == null) {
- element = addChild(getParent(), elementName, elementNamesOrder);
+ element = addChild(getParent(), ExternalPropertyHolder.PROPERTIES, elementNamesOrder);
}
- return addChild(element, PROPERTY, index);
+ return addChild(element, PROPERTY);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void calculateInsertionIndex(Element parent, Element child, String elementName) {
+ if (elementName == PROPERTY) {
+ index = index(parent, child, elementName);
+ }
}
/**
@@ -88,13 +78,13 @@
@Override
public Element getElement() {
- Element element = getChild(getParent(), PROPERTIES);
+ Element element = getChild(getParent(), ExternalPropertyHolder.PROPERTIES);
- if (element == null) {
- return null;
+ if (element != null) {
+ return getChild(element, PROPERTY, index);
}
- return getChild(element, PROPERTY, index);
+ return null;
}
/**
@@ -102,15 +92,7 @@
*/
@Override
protected String getElementName() {
- return PROPERTIES;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getIndex() {
- return index;
+ return PROPERTY;
}
/**
@@ -125,6 +107,14 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public String getValue() {
return getAttribute(VALUE);
}
@@ -133,9 +123,25 @@
* {@inheritDoc}
*/
@Override
+ public TextRange getValueTextRange() {
+ return getAttributeTextRange(VALUE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getValueType() {
+ return getAttribute(VALUE_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void removeSelf() {
- Element element = getChild(getParent(), getElementName());
+ Element element = getChild(getParent(), ExternalPropertyHolder.PROPERTIES);
if (element != null) {
removeChild(element, PROPERTY, index);
@@ -161,4 +167,12 @@
public void setValue(String value) {
setAttribute(VALUE, value);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setValueType(String valueType) {
+ setAttribute(VALUE_TYPE, valueType);
+ }
}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.parent/pom.xml b/tools/org.eclipse.persistence.tools.parent/pom.xml
index 3fb7efb..2f0ceb0 100644
--- a/tools/org.eclipse.persistence.tools.parent/pom.xml
+++ b/tools/org.eclipse.persistence.tools.parent/pom.xml
@@ -1,252 +1,252 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <name>EclipseLink Tools Parent</name>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>org.eclipse.persistence.tools.parent</artifactId>
- <version>2.5.0-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <!-- tycho requires maven >= 3.0 -->
- <prerequisites>
- <maven>3.0</maven>
- </prerequisites>
-
- <properties>
- <!-- TOOL Properties -->
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <tycho.version>0.16.0</tycho.version>
- <junit4-version>4.8.1</junit4-version>
- <!-- maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format> Seems it must be in settings.xml -->
- <!-- PROJECT Properties -->
- <release.version>2.5.0</release.version>
- <!-- build.qualifier>v${maven.build.timestamp}</build.qualifier -->
- <!-- forceContextQualifier>${build.qualifier}</forceContextQualifier -->
- <build.type>SNAPSHOT</build.type>
- <!-- BUILD Properties -->
- <!-- orbit.drop>R20120119162704</orbit.drop -->
- <orbit.drop>R20120526062928</orbit.drop>
- <eclipse.drop>juno</eclipse.drop>
- </properties>
-
- <organization>
- <name>Eclipse.org - EclipseLink Project</name>
- <url>http://www.eclipse.org/eclipselink</url>
- </organization>
-
- <modules>
- <module>../org.eclipse.persistence.tools.utility</module>
- <module>../org.eclipse.persistence.tools.db</module>
- <module>../org.eclipse.persistence.tools.gen.db</module>
- <module>../org.eclipse.persistence.tools.mapping</module>
- <module>../org.eclipse.persistence.tools.gen.nosql</module>
- <module>../org.eclipse.persistence.tools.utility.tests</module>
- </modules>
-
- <profiles>
- <profile>
- <id>tycho.default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <repositories>
- <repository>
- <id>Eclipse</id>
- <layout>p2</layout>
- <url>http://download.eclipse.org/releases/${eclipse.drop}</url>
- </repository>
- <repository>
- <id>Orbit</id>
- <layout>p2</layout>
- <url>http://download.eclipse.org/tools/orbit/downloads/drops/${orbit.drop}/repository</url>
- </repository>
- <repository>
- <id>EL_CompDeps</id>
- <layout>p2</layout>
- <url>http://archive.eclipse.org/rt/eclipselink/compdeps25-update</url>
- </repository>
- </repositories>
- </profile>
- <profile>
- <id>tycho.local.compdeps</id>
- <activation>
- <property>
- <name>local.compdeps</name>
- <value>true</value>
- </property>
- </activation>
- <repositories>
- <repository>
- <id>Eclipse</id>
- <layout>p2</layout>
- <url>http://download.eclipse.org/releases/${eclipse.drop}</url>
- </repository>
- <repository>
- <id>Orbit</id>
- <layout>p2</layout>
- <url>http://download.eclipse.org/tools/orbit/downloads/drops/${orbit.drop}/repository</url>
- </repository>
- <repository>
- <id>Local_CompDeps</id>
- <layout>p2</layout>
- <url>file:/${basedir}/../../buildsystem/compdeps/p2repo</url>
- </repository>
- </repositories>
- </profile>
- </profiles>
-
- <build>
- <defaultGoal>verify</defaultGoal>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-compiler-plugin</artifactId>
- <version>${tycho.version}</version>
- <configuration>
- <!-- Set to force OSGi Compatability settings (defaults to "false") (Only available as of Tycho 0.16.0) -->
- <requireJREPackageImports>true</requireJREPackageImports>
- <!-- compilerArgument>-nowarn</compilerArgument> <disable all warnings -->
- <!-- compilerArgument>-warn:[+|-]warning_tokens_separated_by_comma - Specify the set of enabled warnings </compilerArgument -->
- <!-- compilerArgument>-err:warning_tokens_separated_by_comma - convert exactly the listed warnings to errors </compilerArgument -->
- <!-- compilerArgument>-err:+warning_tokens_separated_by_comma - convert additional warnings to errors</compilerArgument -->
- <!-- compilerArgument>-err:-warning_tokens_separated_by_comma - remove specific warnings from being converted to errors </compilerArgument -->
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-maven-plugin</artifactId>
- <version>${tycho.version}</version>
- <extensions>true</extensions>
- <configuration>
- <resolver>p2</resolver>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>target-platform-configuration</artifactId>
- <version>${tycho.version}</version>
- <configuration>
- <resolver>p2</resolver>
- <environments>
- <environment>
- <os>linux</os>
- <ws>gtk</ws>
- <arch>x86_64</arch>
- </environment>
- <environment>
- <os>linux</os>
- <ws>gtk</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>macosx</os>
- <ws>carbon</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>macosx</os>
- <ws>cocoa</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>macosx</os>
- <ws>cocoa</ws>
- <arch>x86_64</arch>
- </environment>
- <environment>
- <os>win32</os>
- <ws>win32</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>win32</os>
- <ws>win32</ws>
- <arch>x86_64</arch>
- </environment>
- </environments>
- <!-- target>
- <artifact>
- <groupId>${project.groupId}</groupId>
- <artifactId>${project.artifactId}</artifactId>
- <version>${project.version}</version>
- <classifier>${project.artifactId}_${release.version}.!!! issue here -> ${build.qualifier}!!! </classifier>
- </artifact>
- </target -->
- </configuration>
- </plugin>
- <!-- Mostly working source bundle generation -->
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-source-plugin</artifactId>
- <version>${tycho.version}</version>
- <executions>
- <execution>
- <id>plugin-source</id>
- <phase>package</phase>
- <goals>
- <goal>plugin-source</goal>
- </goals>
- <configuration>
- <finalName>${project.artifactId}.source_${release.version}.${build.qualifier}</finalName>
- <sourceBundle>true</sourceBundle>
- <sourceBundleSuffix>.source</sourceBundleSuffix>
- <qualifier>${build.qualifier}</qualifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.6</version>
- <executions>
- <execution>
- <id>inject-common-into-src-bundles</id>
- <phase>package</phase>
- <configuration>
- <target>
- <zip file="../target/${project.artifactId}.source_${release.version}.${build.qualifier}.jar" duplicate="preserve">
- <zipgroupfileset dir="../target">
- <include name="${project.artifactId}.source_${release.version}.${build.qualifier}-sources.jar"/>
- </zipgroupfileset>
- <fileset dir="../org.eclipse.persistence.tools.parent/resource" includes="*.html"/>
- </zip>
- <delete file="../target/${project.artifactId}.source_${release.version}.${build.qualifier}-sources.jar"/>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <directory>../target</directory>
- <sourceDirectory>./src</sourceDirectory>
- <outputDirectory>./target/classes</outputDirectory>
- <testOutputDirectory>../${testId}/target/classes</testOutputDirectory>
- <resources>
- <resource>
- <directory>../org.eclipse.persistence.tools.parent/resource</directory>
- </resource>
- </resources>
- <finalName>${project.artifactId}_${release.version}.${build.qualifier}</finalName>
- </build>
-
- <pluginRepositories>
- <pluginRepository>
- <id>tycho-0.16.0-staged</id>
- <url>https://oss.sonatype.org/content/repositories/orgeclipsetycho-207/</url>
- </pluginRepository>
- <pluginRepository>
- <id>tycho-public</id>
- <url>https://oss.sonatype.org/content/groups/public/</url>
- </pluginRepository>
- <pluginRepository>
- <id>maven-eclipse</id>
- <url>http://repo1.maven.org</url>
- </pluginRepository>
- </pluginRepositories>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>EclipseLink Tools Parent</name>
+ <groupId>org.eclipse.persistence</groupId>
+ <artifactId>org.eclipse.persistence.tools.parent</artifactId>
+ <version>2.6.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <!-- tycho requires maven >= 3.0 -->
+ <prerequisites>
+ <maven>3.0</maven>
+ </prerequisites>
+
+ <properties>
+ <!-- TOOL Properties -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <tycho.version>0.16.0</tycho.version>
+ <junit4-version>4.8.1</junit4-version>
+ <!-- maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format> Seems it must be in settings.xml -->
+ <!-- PROJECT Properties -->
+ <release.version>2.6.0</release.version>
+ <!-- build.qualifier>v${maven.build.timestamp}</build.qualifier -->
+ <!-- forceContextQualifier>${build.qualifier}</forceContextQualifier -->
+ <build.type>SNAPSHOT</build.type>
+ <!-- BUILD Properties -->
+ <!-- orbit.drop>R20120119162704</orbit.drop -->
+ <orbit.drop>R20120526062928</orbit.drop>
+ <eclipse.drop>juno</eclipse.drop>
+ </properties>
+
+ <organization>
+ <name>Eclipse.org - EclipseLink Project</name>
+ <url>http://www.eclipse.org/eclipselink</url>
+ </organization>
+
+ <modules>
+ <module>../org.eclipse.persistence.tools.utility</module>
+ <module>../org.eclipse.persistence.tools.db</module>
+ <module>../org.eclipse.persistence.tools.gen.db</module>
+ <module>../org.eclipse.persistence.tools.mapping</module>
+ <module>../org.eclipse.persistence.tools.gen.nosql</module>
+ <module>../org.eclipse.persistence.tools.utility.tests</module>
+ </modules>
+
+ <profiles>
+ <profile>
+ <id>tycho.default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>Eclipse</id>
+ <layout>p2</layout>
+ <url>http://download.eclipse.org/releases/${eclipse.drop}</url>
+ </repository>
+ <repository>
+ <id>Orbit</id>
+ <layout>p2</layout>
+ <url>http://download.eclipse.org/tools/orbit/downloads/drops/${orbit.drop}/repository</url>
+ </repository>
+ <repository>
+ <id>EL_CompDeps</id>
+ <layout>p2</layout>
+ <url>http://archive.eclipse.org/rt/eclipselink/compdeps25-update</url>
+ </repository>
+ </repositories>
+ </profile>
+ <profile>
+ <id>tycho.local.compdeps</id>
+ <activation>
+ <property>
+ <name>local.compdeps</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <repositories>
+ <repository>
+ <id>Eclipse</id>
+ <layout>p2</layout>
+ <url>http://download.eclipse.org/releases/${eclipse.drop}</url>
+ </repository>
+ <repository>
+ <id>Orbit</id>
+ <layout>p2</layout>
+ <url>http://download.eclipse.org/tools/orbit/downloads/drops/${orbit.drop}/repository</url>
+ </repository>
+ <repository>
+ <id>Local_CompDeps</id>
+ <layout>p2</layout>
+ <url>file:/${basedir}/../../buildsystem/compdeps/p2repo</url>
+ </repository>
+ </repositories>
+ </profile>
+ </profiles>
+
+ <build>
+ <defaultGoal>verify</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-compiler-plugin</artifactId>
+ <version>${tycho.version}</version>
+ <configuration>
+ <!-- Set to force OSGi Compatability settings (defaults to "false") (Only available as of Tycho 0.16.0) -->
+ <!-- <requireJREPackageImports>true</requireJREPackageImports> -->
+ <!-- compilerArgument>-nowarn</compilerArgument> <disable all warnings -->
+ <!-- compilerArgument>-warn:[+|-]warning_tokens_separated_by_comma - Specify the set of enabled warnings </compilerArgument -->
+ <!-- compilerArgument>-err:warning_tokens_separated_by_comma - convert exactly the listed warnings to errors </compilerArgument -->
+ <!-- compilerArgument>-err:+warning_tokens_separated_by_comma - convert additional warnings to errors</compilerArgument -->
+ <!-- compilerArgument>-err:-warning_tokens_separated_by_comma - remove specific warnings from being converted to errors </compilerArgument -->
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-maven-plugin</artifactId>
+ <version>${tycho.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <resolver>p2</resolver>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <version>${tycho.version}</version>
+ <configuration>
+ <resolver>p2</resolver>
+ <environments>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86_64</arch>
+ </environment>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>macosx</os>
+ <ws>carbon</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>macosx</os>
+ <ws>cocoa</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>macosx</os>
+ <ws>cocoa</ws>
+ <arch>x86_64</arch>
+ </environment>
+ <environment>
+ <os>win32</os>
+ <ws>win32</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>win32</os>
+ <ws>win32</ws>
+ <arch>x86_64</arch>
+ </environment>
+ </environments>
+ <!-- target>
+ <artifact>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <version>${project.version}</version>
+ <classifier>${project.artifactId}_${release.version}.!!! issue here -> ${build.qualifier}!!! </classifier>
+ </artifact>
+ </target -->
+ </configuration>
+ </plugin>
+ <!-- Mostly working source bundle generation -->
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ <version>${tycho.version}</version>
+ <executions>
+ <execution>
+ <id>plugin-source</id>
+ <phase>package</phase>
+ <goals>
+ <goal>plugin-source</goal>
+ </goals>
+ <configuration>
+ <finalName>${project.artifactId}.source_${release.version}.${build.qualifier}</finalName>
+ <sourceBundle>true</sourceBundle>
+ <sourceBundleSuffix>.source</sourceBundleSuffix>
+ <qualifier>${build.qualifier}</qualifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.6</version>
+ <executions>
+ <execution>
+ <id>inject-common-into-src-bundles</id>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <zip file="../target/${project.artifactId}.source_${release.version}.${build.qualifier}.jar" duplicate="preserve">
+ <zipgroupfileset dir="../target">
+ <include name="${project.artifactId}.source_${release.version}.${build.qualifier}-sources.jar"/>
+ </zipgroupfileset>
+ <fileset dir="../org.eclipse.persistence.tools.parent/resource" includes="*.html"/>
+ </zip>
+ <delete file="../target/${project.artifactId}.source_${release.version}.${build.qualifier}-sources.jar"/>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <directory>../target</directory>
+ <sourceDirectory>./src</sourceDirectory>
+ <outputDirectory>./target/classes</outputDirectory>
+ <testOutputDirectory>../${testId}/target/classes</testOutputDirectory>
+ <resources>
+ <resource>
+ <directory>../org.eclipse.persistence.tools.parent/resource</directory>
+ </resource>
+ </resources>
+ <finalName>${project.artifactId}_${release.version}.${build.qualifier}</finalName>
+ </build>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>tycho-0.16.0-staged</id>
+ <url>https://oss.sonatype.org/content/repositories/orgeclipsetycho-207/</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>tycho-public</id>
+ <url>https://oss.sonatype.org/content/groups/public/</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>maven-eclipse</id>
+ <url>http://repo1.maven.org</url>
+ </pluginRepository>
+ </pluginRepositories>
+
</project>
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.utility.tests/META-INF/MANIFEST.MF b/tools/org.eclipse.persistence.tools.utility.tests/META-INF/MANIFEST.MF
index 8e995f3..abdcc0d 100644
--- a/tools/org.eclipse.persistence.tools.utility.tests/META-INF/MANIFEST.MF
+++ b/tools/org.eclipse.persistence.tools.utility.tests/META-INF/MANIFEST.MF
@@ -18,10 +18,10 @@
org.eclipse.persistence.tools.utility.tests.swing,
org.eclipse.persistence.tools.utility.tests.transformer
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.eclipse.persistence.tools.utility;bundle-version="2.5.0",
+Require-Bundle: org.eclipse.persistence.tools.utility;bundle-version="2.6.0",
org.junit;bundle-version="[4.0.0,5.0.0)"
Bundle-SymbolicName: org.eclipse.persistence.tools.utility.tests
Bundle-Name: EclipseLink Tools Utility Tests
Bundle-Vendor: Eclipse.org - EclipseLink Project
-Bundle-Version: 2.5.0.qualifier
+Bundle-Version: 2.6.0.qualifier
Bundle-ManifestVersion: 2
diff --git a/tools/org.eclipse.persistence.tools.utility.tests/pom.xml b/tools/org.eclipse.persistence.tools.utility.tests/pom.xml
index c161060..31a7b3f 100644
--- a/tools/org.eclipse.persistence.tools.utility.tests/pom.xml
+++ b/tools/org.eclipse.persistence.tools.utility.tests/pom.xml
@@ -6,13 +6,13 @@
<name>EclipseLink Tools Utility Tests</name>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.tools.utility.tests</artifactId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<parent>
<artifactId>org.eclipse.persistence.tools.parent</artifactId>
<groupId>org.eclipse.persistence</groupId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<relativePath>../org.eclipse.persistence.tools.parent/pom.xml</relativePath>
</parent>
diff --git a/tools/org.eclipse.persistence.tools.utility/META-INF/MANIFEST.MF b/tools/org.eclipse.persistence.tools.utility/META-INF/MANIFEST.MF
index 982ee8a..7b66251 100644
--- a/tools/org.eclipse.persistence.tools.utility/META-INF/MANIFEST.MF
+++ b/tools/org.eclipse.persistence.tools.utility/META-INF/MANIFEST.MF
@@ -1,33 +1,33 @@
Manifest-Version: 1.0
-Export-Package: org.eclipse.persistence.tools.utility;version="2.5.0",
- org.eclipse.persistence.tools.utility.collection;version="2.5.0",
- org.eclipse.persistence.tools.utility.command;version="2.5.0",
- org.eclipse.persistence.tools.utility.enumeration;version="2.5.0",
- org.eclipse.persistence.tools.utility.filter;version="2.5.0",
- org.eclipse.persistence.tools.utility.io;version="2.5.0",
- org.eclipse.persistence.tools.utility.iterable;version="2.5.0",
- org.eclipse.persistence.tools.utility.iterator;version="2.5.0",
- org.eclipse.persistence.tools.utility.jdbc;version="2.5.0",
- org.eclipse.persistence.tools.utility.log;version="2.5.0",
- org.eclipse.persistence.tools.utility.model;version="2.5.0",
- org.eclipse.persistence.tools.utility.model.event;version="2.5.0",
- org.eclipse.persistence.tools.utility.model.listener;version="2.5.0",
- org.eclipse.persistence.tools.utility.model.listener.awt;version="2.5.0",
- org.eclipse.persistence.tools.utility.model.value;version="2.5.0",
- org.eclipse.persistence.tools.utility.model.value.prefs;version="2.5.0",
- org.eclipse.persistence.tools.utility.model.value.swing;version="2.5.0",
- org.eclipse.persistence.tools.utility.node;version="2.5.0",
- org.eclipse.persistence.tools.utility.prefs;version="2.5.0",
- org.eclipse.persistence.tools.utility.reference;version="2.5.0",
- org.eclipse.persistence.tools.utility.status;version="2.5.0",
- org.eclipse.persistence.tools.utility.swing;version="2.5.0",
- org.eclipse.persistence.tools.utility.transformer;version="2.5.0"
+Export-Package: org.eclipse.persistence.tools.utility;version="2.6.0",
+ org.eclipse.persistence.tools.utility.collection;version="2.6.0",
+ org.eclipse.persistence.tools.utility.command;version="2.6.0",
+ org.eclipse.persistence.tools.utility.enumeration;version="2.6.0",
+ org.eclipse.persistence.tools.utility.filter;version="2.6.0",
+ org.eclipse.persistence.tools.utility.io;version="2.6.0",
+ org.eclipse.persistence.tools.utility.iterable;version="2.6.0",
+ org.eclipse.persistence.tools.utility.iterator;version="2.6.0",
+ org.eclipse.persistence.tools.utility.jdbc;version="2.6.0",
+ org.eclipse.persistence.tools.utility.log;version="2.6.0",
+ org.eclipse.persistence.tools.utility.model;version="2.6.0",
+ org.eclipse.persistence.tools.utility.model.event;version="2.6.0",
+ org.eclipse.persistence.tools.utility.model.listener;version="2.6.0",
+ org.eclipse.persistence.tools.utility.model.listener.awt;version="2.6.0",
+ org.eclipse.persistence.tools.utility.model.value;version="2.6.0",
+ org.eclipse.persistence.tools.utility.model.value.prefs;version="2.6.0",
+ org.eclipse.persistence.tools.utility.model.value.swing;version="2.6.0",
+ org.eclipse.persistence.tools.utility.node;version="2.6.0",
+ org.eclipse.persistence.tools.utility.prefs;version="2.6.0",
+ org.eclipse.persistence.tools.utility.reference;version="2.6.0",
+ org.eclipse.persistence.tools.utility.status;version="2.6.0",
+ org.eclipse.persistence.tools.utility.swing;version="2.6.0",
+ org.eclipse.persistence.tools.utility.transformer;version="2.6.0"
Bundle-ClassPath: .
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-SymbolicName: org.eclipse.persistence.tools.utility
Bundle-Name: EclipseLink Tools Utility
Bundle-Vendor: Eclipse.org - EclipseLink Project
-Bundle-Version: 2.5.0.qualifier
+Bundle-Version: 2.6.0.qualifier
Bundle-ManifestVersion: 2
Import-Package: javax.xml.parsers;resolution:=optional,
javax.xml.transform;resolution:=optional,
diff --git a/tools/org.eclipse.persistence.tools.utility/pom.xml b/tools/org.eclipse.persistence.tools.utility/pom.xml
index 55c43f1..7585a1f 100644
--- a/tools/org.eclipse.persistence.tools.utility/pom.xml
+++ b/tools/org.eclipse.persistence.tools.utility/pom.xml
@@ -6,13 +6,13 @@
<name>EclipseLink Tools Utility</name>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.tools.utility</artifactId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<parent>
<artifactId>org.eclipse.persistence.tools.parent</artifactId>
<groupId>org.eclipse.persistence</groupId>
- <version>2.5.0-SNAPSHOT</version>
+ <version>2.6.0-SNAPSHOT</version>
<relativePath>../org.eclipse.persistence.tools.parent/pom.xml</relativePath>
</parent>
diff --git a/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/DefaultTextRange.java b/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/DefaultTextRange.java
new file mode 100644
index 0000000..504f648
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/DefaultTextRange.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.utility;
+
+/**
+ * The default implementation of {@link TextRange}.
+ *
+ * @version 2.6
+ */
+@SuppressWarnings("nls")
+public final class DefaultTextRange implements TextRange {
+
+ /**
+ * The length where the beginning is the offset location.
+ */
+ private int length;
+
+ /**
+ * The start position within the document.
+ */
+ private int offset;
+
+ /**
+ * Creates a new <code>DefaultTextRange</code>.
+ *
+ * @param offset The start position within the document
+ * @param length The length where the beginning is the offset location
+ */
+ public DefaultTextRange(int offset, int length) {
+ super();
+ this.offset = offset;
+ this.length = length;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getLength() {
+ return length;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getOffset() {
+ return offset;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("offset=");
+ sb.append(offset);
+ sb.append(", length=");
+ sb.append(length);
+ return sb.toString();
+ }
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/TextRange.java b/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/TextRange.java
new file mode 100644
index 0000000..e925940
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/TextRange.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.utility;
+
+/**
+ * A <code>TextRange</code> determines the location of a value within a document.
+ *
+ * @version 2.6
+ */
+public interface TextRange {
+
+ /**
+ * Returns the length of this problem where the beginning is the offset location.
+ *
+ * @return The length of this problem
+ */
+ int getLength();
+
+ /**
+ * Returns the start position of this problem within the document.
+ *
+ * @return The offset within the document of this problem
+ */
+ int getOffset();
+}
\ No newline at end of file