From 2a444004802173fa97afbc389fc4a6600b6d3f88 Mon Sep 17 00:00:00 2001 From: lresende Date: Tue, 10 Nov 2009 19:19:55 +0000 Subject: moving SDO branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@834614 13f79535-47bb-0310-9956-ffa450edef68 --- sdo-java/branches/sdo-1.1-incubating/tools/pom.xml | 163 + .../branches/sdo-1.1-incubating/tools/readme.htm | 44 + .../apache/tuscany/sdo/generate/JavaGenerator.java | 739 ++++ .../tuscany/sdo/generate/XSD2JavaGenerator.java | 500 +++ .../adapter/SDOGenClassGeneratorAdapter.java | 53 + .../adapter/SDOGenModelGeneratorAdapter.java | 38 + .../SDOGenModelGeneratorAdapterFactory.java | 63 + .../adapter/SDOGenPackageGeneratorAdapter.java | 59 + .../sdo/generate/templates/model/SDOClass.java | 4288 ++++++++++++++++++++ .../generate/templates/model/SDOFactoryClass.java | 1132 ++++++ .../tuscany/sdo/generate/util/SDOGenUtil.java | 326 ++ .../eclipse/jdt/core/formatter/CodeFormatter.java | 27 + .../tools/src/main/resources/META-INF/DISCLAIMER | 7 + .../tools/src/main/resources/META-INF/LICENSE.txt | 207 + .../tools/src/main/resources/META-INF/MANIFEST.MF | 21 + .../tools/src/main/resources/META-INF/NOTICE | 7 + .../tools/src/main/resources/META-INF/README.txt | 23 + .../test/java/com/example/repchoice/RCType.java | 103 + .../com/example/repchoice/RepchoiceFactory.java | 61 + .../com/example/repchoice/impl/RCTypeImpl.java | 332 ++ .../repchoice/impl/RepchoiceFactoryImpl.java | 269 ++ .../java/com/example/sequences/MixedQuote.java | 491 +++ .../example/sequences/MixedRepeatingChoice.java | 102 + .../com/example/sequences/RepeatingChoice.java | 88 + .../com/example/sequences/SequencesFactory.java | 97 + .../test/java/com/example/sequences/TwoRCs.java | 184 + .../java/com/example/sequences/TwoRCsMixed.java | 198 + .../com/example/sequences/impl/MixedQuoteImpl.java | 766 ++++ .../sequences/impl/MixedRepeatingChoiceImpl.java | 335 ++ .../sequences/impl/RepeatingChoiceImpl.java | 299 ++ .../sequences/impl/SequencesFactoryImpl.java | 770 ++++ .../com/example/sequences/impl/TwoRCsImpl.java | 521 +++ .../example/sequences/impl/TwoRCsMixedImpl.java | 499 +++ .../java/org/apache/tuscany/sdo/test/AllTests.java | 48 + .../sdo/test/GeneratedPackagesTestCase.java | 70 + .../tools/src/test/resources/TUSCANY1050.xsd | 44 + .../tools/src/test/resources/enum.xsd | 50 + .../resources/mixedRepeatingChoiceTestResult.xml | 20 + .../src/test/resources/mixedStaticTestResult.xml | 27 + .../tools/src/test/resources/repeatingChoice.xsd | 33 + .../test/resources/repeatingChoiceTestResult.xml | 25 + .../tools/src/test/resources/sdoModel.xsd | 28 + .../tools/src/test/resources/sequences.xsd | 100 + .../twoRepeatingChoicesMixedTestResult.xml | 20 + .../resources/twoRepeatingChoicesTestResult.xml | 28 + .../tools/templates/Header.javajetinc | 6 + .../tools/templates/models/SDOClass.javajet | 1968 +++++++++ .../tools/templates/models/SDOFactoryClass.javajet | 645 +++ .../tools/templates/models/generator.skeleton | 25 + 49 files changed, 15949 insertions(+) create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/pom.xml create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/readme.htm create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/JavaGenerator.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/XSD2JavaGenerator.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenClassGeneratorAdapter.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapter.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapterFactory.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenPackageGeneratorAdapter.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOClass.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/util/SDOGenUtil.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/eclipse/jdt/core/formatter/CodeFormatter.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/DISCLAIMER create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/LICENSE.txt create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/MANIFEST.MF create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/NOTICE create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/README.txt create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/RCType.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/RepchoiceFactory.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/impl/RCTypeImpl.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/impl/RepchoiceFactoryImpl.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/MixedQuote.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/RepeatingChoice.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/SequencesFactory.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/TwoRCs.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/TwoRCsMixed.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/MixedRepeatingChoiceImpl.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/RepeatingChoiceImpl.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/SequencesFactoryImpl.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/TwoRCsImpl.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/TwoRCsMixedImpl.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/org/apache/tuscany/sdo/test/AllTests.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/org/apache/tuscany/sdo/test/GeneratedPackagesTestCase.java create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/TUSCANY1050.xsd create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/enum.xsd create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/mixedRepeatingChoiceTestResult.xml create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/mixedStaticTestResult.xml create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/repeatingChoice.xsd create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/repeatingChoiceTestResult.xml create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/sdoModel.xsd create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/sequences.xsd create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/twoRepeatingChoicesMixedTestResult.xml create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/twoRepeatingChoicesTestResult.xml create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/templates/Header.javajetinc create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/templates/models/SDOClass.javajet create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/templates/models/SDOFactoryClass.javajet create mode 100644 sdo-java/branches/sdo-1.1-incubating/tools/templates/models/generator.skeleton (limited to 'sdo-java/branches/sdo-1.1-incubating/tools') diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/pom.xml b/sdo-java/branches/sdo-1.1-incubating/tools/pom.xml new file mode 100644 index 0000000000..1ac42effdb --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/pom.xml @@ -0,0 +1,163 @@ + + + + + org.apache.tuscany.sdo + tuscany-sdo + 1.1-incubating + + 4.0.0 + tuscany-sdo-tools + Tuscany SDO Tools + SDO Tools. + + + + org.apache.tuscany.sdo + tuscany-sdo-lib + ${sdo.version} + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + ${sdo.version} + compile + + + + org.eclipse.emf + common + ${emfVersion} + compile + + + + org.eclipse.emf + ecore + ${emfVersion} + compile + + + + org.eclipse.emf + codegen + ${emfVersion} + compile + + + + org.eclipse.emf + codegen-ecore + ${emfVersion} + compile + + + + org.eclipse.xsd + xsd + ${emfVersion} + compile + + + + junit + junit + 3.8.1 + test + + + + + stax + stax-api + 1.0.1 + test + + + + + + + maven-jar-plugin + + + + org.apache + 1.1-incubating + 1.4 + 1.4 + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.1 + + + + ${project.artifactId} + ${project.name} + ${project.organization.name} + ${version} + ${project.artifactId} + ${project.organization.name} + org.apache + ${project.version} + + org.eclipse.emf.common,org.eclipse.emf.ecore,org.eclipse.emf.ecore.change,org.eclipse.emf.ecore.xmi,org.eclipse.xsd,org.apache.tuscany.sdo.spec;visibility:=reexport + org.apache.tuscany.sdo.generate,org.apache.tuscany.sdo.generate.util + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.2 + + + 2.0 + + + + + + + + + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/readme.htm b/sdo-java/branches/sdo-1.1-incubating/tools/readme.htm new file mode 100644 index 0000000000..e7aa8d6718 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/readme.htm @@ -0,0 +1,44 @@ + + + + + + +Tuscany SDO Tools + + + + + +

Tuscany SDO Tools

+

Building SDO Tools

+ +To build the Tuscany SDO Java Generator tools, perform the following steps + +Note: only the Interface2JavaGenerator class requires Java 5. You can build the XSD2JavaGenerator tool using a Java 1.4 JDK by removing the Interface2JavaGenerator.java file before running the "mvn" command. + + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/JavaGenerator.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/JavaGenerator.java new file mode 100644 index 0000000000..c735e55e2a --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/JavaGenerator.java @@ -0,0 +1,739 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sdo.generate; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.StringTokenizer; + +import org.apache.tuscany.sdo.generate.adapter.SDOGenModelGeneratorAdapterFactory; +import org.apache.tuscany.sdo.helper.HelperContextImpl; +import org.apache.tuscany.sdo.impl.SDOPackageImpl; +import org.apache.tuscany.sdo.model.ModelFactory; +import org.apache.tuscany.sdo.model.internal.InternalFactory; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.codegen.ecore.generator.Generator; +import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory; +import org.eclipse.emf.codegen.ecore.genmodel.GenClass; +import org.eclipse.emf.codegen.ecore.genmodel.GenDelegationKind; +import org.eclipse.emf.codegen.ecore.genmodel.GenModel; +import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory; +import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage; +import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; +import org.eclipse.emf.codegen.ecore.genmodel.GenResourceKind; +import org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter; +import org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapterFactory; +import org.eclipse.emf.codegen.merge.java.JControlModel; +import org.eclipse.emf.codegen.util.CodeGenUtil; +import org.eclipse.emf.common.util.BasicMonitor; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.Diagnostician; +import org.eclipse.emf.ecore.util.ExtendedMetaData; +import org.eclipse.xsd.XSDSchema; + +import commonj.sdo.helper.XSDHelper; + +/** + * Abstract base class for static SDO code generators. See XSD2JavaGenerator and Interface2JavaGenerator for + * concrete generator commands. + * + * Supports the following command line options: + * + * [ -targetDirectory ] + * [ -javaPackage ] + * [ -prefix ] + * [ -noInterfaces ] + * [ -noContainment ] + * [ -noNotification ] + * [ -noUnsettable ] + * + * Not supported (future options): + * + * [ -arrayAccessors ] + * [ -generateLoader ] + * [ -interfaceDataObject ] + * [ -sparsePattern | -storePattern ] + * [ -noGenerate ] + * + * Basic options: + * + * -javaPackage + * Overrides the Java package for the generated classes. By default the package name is derived + * from the targetNamespace of the XML schema being generated. For example, if the targetNamespace is + * "http://www.example.com/simple", the default package will be "com.example.simple". + * -prefix + * Specifies the prefix string to use for naming the generated factory. For example "-prefix Foo" will + * result in a factory interface with the name "FooFactory". + * -targetDirectory + * Generates the Java source code in the specified directory. By default, the code is generated + * in the same directory as the input xsd or wsdl file. + * is not necessary. + * + * Extended options: + * + * -noContainment + * Turns off container management for containment properties. DataObject.getContainer() will always + * return null for data objects generated with this option, even if a containment reference is set. + * Setting a containment reference will also not automatically remove the target object from its + * previous container, if it had one, so it will need to be explicitly removed by the client. Use + * of this option is only recommended for scenarios where this kind of container movement/management + * -noInterfaces + * By default, each DataObject generates both a Java interface and a corresponding implementation + * class. If an SDO metamodel does not use multiple inheritance (which is always the case for + * XML Schema derived models), then this option can be used to eliminate the interface and to generate + * only an implementation class. + * -noNotification + * This option eliminates all change notification overhead in the generated classes. Changes to + * DataObjects generated using this option cannot be recorded, and consequently the classes cannot + * be used with an SDO ChangeSummary or DataGraph. + * -noUnsettable + * By default, some XML constructs result in SDO property implementations that maintain additional + * state information to record when the property has been set to the "default value", as opposed to + * being truly unset (see DataObject.isSet() and DataObject.unset()). The SDO specification allows an + * implementation to choose to provide this behavior or not. With this option, all generated properties + * will not record their unset state. The generated isSet() methods simply returns whether the current + * value is equal to the property's "default value". + * + * Following are planned but not supported yet: + * + * -arrayAccessors + * Generates Java array getters/setters for multiplicity-many properties. With this option, + * the set of "standard" JavaBean array accessor methods (e.g., Foo[] getFoo(), Foo getFoo(int), + * int getFooLength(), setFoo(Foo[]), and void setFoo(int, Foo)) are generated. The normal + * List-returning accessor is renamed with the suffix "List" (e.g., List getFooList()). The array + * returned by the generated method is not a copy, but instead a pointer to the underlying storage + * array, so directly modifying it can have undesirable consequences and should be avoided. + * -generateLoader + * Generate a fast XML parser/loader for instances of the model. The details of this option are + * subject to change, but currently it generates two additional classes in a "util" package: + * ResourceImpl and ResourceFactoryImpl. To use the generated loader at runtime, + * you need to pass an option to the XMLHelper.load() method like this: + * Map options = new HashMap(); + * options.put("GENERATED_LOADER", ResourceFactoryImpl.class); + * XMLDocument doc = XMLHelper.INSTANCE.load(new FileInputStream("somefile.xml"), null, options); + * Note: this option currently only works for simple schemas without substitution groups or wildcards. + * -interfaceDataObject + * This option is used to generate static interfaces that extend commonj.sdo.DataObject + * -sparsePattern + * For SDO metamodels that have classes with many properties of which only a few are typically set at + * runtime, this option can be used to produce a space-optimized implementation (at the expense of speed). + * -storePattern + * This option can be used to generate static classes that work with a Store-based DataObject + * implementation. It changes the generator pattern to generate accessors which delegate to the + * reflective methods (as opposed to the other way around) and changes the DataObject base class + * to org.apache.tuscany.sdo.impl.StoreDataObjectImpl. Note that this option generates classes that + * require a Store implementation to be provided before they can be run. + * -noGenerate + * A basic implementation of this switch is in place, but is not fully implemented. An intention + * behind this is to provide commentary on the artifacts that would be generated. + * + * + */ +public abstract class JavaGenerator +{ + public static int OPTION_NO_INTERFACES=0x1; + public static int OPTION_SPARSE_PATTERN=0x2; + public static int OPTION_STORE_PATTERN=0x4; + public static int OPTION_NO_CONTAINMENT=0x8; + public static int OPTION_NO_NOTIFICATION=0x10; + public static int OPTION_ARRAY_ACCESSORS=0x20; + public static int OPTION_GENERATE_LOADER=0x40; + public static int OPTION_NO_UNSETTABLE=0x80; + //FIXME Temporary, I need this option for now to get Switch classes generated for the SCDL models + public static int OPTION_GENERATE_SWITCH=0x100; + public static int OPTION_INTERFACE_DO=0x400; + public static int OPTION_NO_GENERATE=0x800; + + static + { + System.setProperty("EMF_NO_CONSTRAINTS", "true"); // never generate a validator class + } + + /** + * @deprecated replaced by XSD2JavaGenerator + */ + public static void main(String args[]) + { + try + { + JavaGenerator generator = new XSD2JavaGenerator(); + generator.processArguments(args); + generator.run(args); + } + catch (IllegalArgumentException e) + { + printUsage(); + } + } + + protected void processArguments(String args[]) + { + if (args.length == 0) + { + throw new IllegalArgumentException(); + } + + int index = 0; + while (args[index].startsWith("-")) + { + int newIndex = handleArgument(args, index); + if (newIndex == index) + { + throw new IllegalArgumentException(); + } + index = newIndex; + if (index == args.length) + { + throw new IllegalArgumentException(); + } + } + + inputIndex = index; + } + + protected String targetDirectory = null; + protected String javaPackage = null; + protected String prefix = null; + protected int genOptions = 0; + protected String xsdFileName; + protected int inputIndex; + + protected int handleArgument(String args[], int index) + { + if (args[index].equalsIgnoreCase("-targetDirectory")) + { + targetDirectory = args[++index]; + } + else if (args[index].equalsIgnoreCase("-javaPackage")) + { + javaPackage = args[++index]; + } + else if (args[index].equalsIgnoreCase("-prefix")) + { + prefix = args[++index]; + } + else if (args[index].equalsIgnoreCase("-noInterfaces")) + { + genOptions |= OPTION_NO_INTERFACES; + } + else if (args[index].equalsIgnoreCase("-sparsePattern")) + { + genOptions |= OPTION_SPARSE_PATTERN; + } + else if (args[index].equalsIgnoreCase("-storePattern")) + { + genOptions |= OPTION_STORE_PATTERN; + } + else if (args[index].equalsIgnoreCase("-noContainment")) + { + genOptions |= OPTION_NO_CONTAINMENT; + } + else if (args[index].equalsIgnoreCase("-noNotification")) + { + genOptions |= OPTION_NO_NOTIFICATION; + } + else if (args[index].equalsIgnoreCase("-arrayAccessors")) + { + genOptions |= OPTION_ARRAY_ACCESSORS; + } + else if (args[index].equalsIgnoreCase("-generateLoader")) + { + genOptions |= OPTION_GENERATE_LOADER; + } + else if (args[index].equalsIgnoreCase("-noUnsettable")) + { + genOptions |= OPTION_NO_UNSETTABLE; + } + else if (args[index].equalsIgnoreCase("-noEMF")) + { + System.out.println("Warning: -noEMF is deprecated. It is the default now."); + //genOptions |= OPTION_NO_EMF; + } + else if (args[index].equalsIgnoreCase("-interfaceDataObject")) + { + genOptions |= OPTION_INTERFACE_DO; + } + else if (args[index].equalsIgnoreCase("-noGenerate")) + { + genOptions |= OPTION_NO_GENERATE; + } + //else if (...) + else + { + return index; + } + + return index + 1; + } + + protected abstract void run(String args[]); + + /** + * @deprecated moved to XSD2JavaGenerator + */ + public static void generateFromXMLSchema(String xsdFileName, String targetDirectory, String javaPackage, String prefix, int genOptions) + { + DataObjectUtil.initRuntime(); + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); + XSDHelper xsdHelper = (new HelperContextImpl(extendedMetaData, false)).getXSDHelper(); + + try + { + File inputFile = new File(xsdFileName).getAbsoluteFile(); + InputStream inputStream = new FileInputStream(inputFile); + xsdHelper.define(inputStream, inputFile.toURI().toString()); + + if (targetDirectory == null) + { + targetDirectory = new File(xsdFileName).getCanonicalFile().getParent(); + } + else + { + targetDirectory = new File(targetDirectory).getCanonicalPath(); + } + + if (!packageRegistry.values().isEmpty()) + { + String packageURI = getSchemaNamespace(xsdFileName); + generatePackages(packageRegistry.values(), packageURI, null, targetDirectory, javaPackage, prefix, genOptions); + } + + /* + for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) + { + EPackage ePackage = (EPackage)iter.next(); + String basePackage = extractBasePackageName(ePackage, javaPackage); + if (prefix == null) + { + prefix = CodeGenUtil.capName(ePackage.getName()); + } + generateFromEPackage(ePackage, targetDirectory, basePackage, prefix, genOptions); + } + */ + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + protected static void generatePackages(Collection packageList, String packageURI, String shortName, String targetDirectory, String javaPackage, String prefix, int genOptions) + { + Hashtable packageInfoTable = new Hashtable(); + packageInfoTable.put(packageURI, new PackageInfo(javaPackage, prefix, packageURI, shortName )); + generatePackages(packageList, targetDirectory, packageInfoTable, genOptions, false); + } + + protected static GenModel generatePackages(Collection packageList, String targetDirectory, Hashtable packageInfoTable, int genOptions, boolean allNamespaces ) + { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + List usedGenPackages = new ArrayList(); + GenModel genModel = null; + ArrayList packagesToModel = new ArrayList(); + for (Iterator iter = packageList.iterator(); iter.hasNext();) + { + EPackage currentEPackage = (EPackage)iter.next(); + String packageNamespace = currentEPackage.getNsURI(); + PackageInfo packageInfo = (PackageInfo)packageInfoTable.get(packageNamespace); + boolean bTargetPackage = allNamespaces; + String javaPackage = null; + String prefix = null; + String shortName = null; + if( packageInfo != null ) + { + bTargetPackage = true; + javaPackage = packageInfo.getBasePackage(); + prefix = packageInfo.getPrefix(); + shortName = packageInfo.getShortName(); + } + String currentBasePackage = extractBasePackageName(currentEPackage, bTargetPackage ? javaPackage : null); + String currentPrefix = bTargetPackage && prefix != null ? prefix : CodeGenUtil.capName(shortName != null ? shortName : currentEPackage.getName()); + packageInfoTable.put(currentEPackage, new PackageInfo(currentBasePackage, currentPrefix, null, null )); + + if( allNamespaces || packageInfo != null ) + packagesToModel.add(currentEPackage); + else + { + GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage, currentPrefix, genOptions, resourceSet); + usedGenPackages.add(currentGenPackage); + } + } + genModel = createGenPackages(packagesToModel, packageInfoTable, genOptions, resourceSet); + + if (genModel == null) return null; // nothing to generate + + //TODO Figure out which predefined packages are really "used" + usedGenPackages.add(createGenPackage(SDOPackageImpl.eINSTANCE, "org.apache.tuscany", "SDO", 0, resourceSet)); + usedGenPackages.add(createGenPackage((EPackage)ModelFactory.INSTANCE, "org.apache.tuscany.sdo", "Model", 0, resourceSet)); + usedGenPackages.add(createGenPackage((EPackage)InternalFactory.INSTANCE, "org.apache.tuscany.sdo.model", "Internal", 0, resourceSet)); + //usedGenPackages.add(createGenPackage((EPackage)JavaFactory.INSTANCE, "org.apache.tuscany.sdo.model", "Java", 0, resourceSet)); + //usedGenPackages.add(createGenPackage((EPackage)XMLFactory.INSTANCE, "org.apache.tuscany.sdo.model", "XML", 0, resourceSet)); + + genModel.getUsedGenPackages().addAll(usedGenPackages); + + // If the display namespace option is selected, Don't generate + if( (genOptions & OPTION_NO_GENERATE) == 0) + { + // Invoke the SDO JavaGenerator to generate the SDO classes + try + { + generateFromGenModel(genModel, new File(targetDirectory).getCanonicalPath(), genOptions); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + return genModel; + } + + /** + * @deprecated + */ + public static String getSchemaNamespace(String xsdFileName) + { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + File inputFile = new File(xsdFileName).getAbsoluteFile(); + Resource model = resourceSet.getResource(URI.createURI(inputFile.toURI().toString()), true); + XSDSchema schema = (XSDSchema)model.getContents().get(0); + return schema.getTargetNamespace(); + } + + protected static GenModel createGenPackages(Collection ePackages, Hashtable packageInfoTable, int genOptions, ResourceSet resourceSet) + { + GenModel genModel = ecore2GenModel(ePackages, packageInfoTable, genOptions); + + for (Iterator iter = ePackages.iterator(); iter.hasNext();) + { + EPackage ePackage = (EPackage)iter.next(); + + URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore"); + URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel"); + + Resource ecoreResource = resourceSet.createResource(ecoreURI); + ecoreResource.getContents().add(ePackage); + + Resource genModelResource = resourceSet.createResource(genModelURI); + genModelResource.getContents().add(genModel); + } + + return genModel; + } + + public static GenPackage createGenPackage(EPackage ePackage, String basePackage, String prefix, int genOptions, ResourceSet resourceSet) + { + GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions); + + URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore"); + URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel"); + + Resource ecoreResource = resourceSet.createResource(ecoreURI); + ecoreResource.getContents().add(ePackage); + + Resource genModelResource = resourceSet.createResource(genModelURI); + genModelResource.getContents().add(genModel); + + return (GenPackage)genModel.getGenPackages().get(0); + } + + public static void generateFromEPackage(EPackage ePackage, String targetDirectory, String basePackage, String prefix, int genOptions) + { + GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions); + + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + URI ecoreURI = URI.createURI("file:///temp.ecore"); + URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel"); + + Resource ecoreResource = resourceSet.createResource(ecoreURI); + ecoreResource.getContents().add(ePackage); + + Resource genModelResource = resourceSet.createResource(genModelURI); + genModelResource.getContents().add(genModel); + + generateFromGenModel(genModel, targetDirectory, genOptions); + } + + public static void generateFromGenModel(GenModel genModel, String targetDirectory, int genOptions) + { + Resource resource = genModel.eResource(); + + // Return if nothing is found + if( resource == null ) + return; + + if (targetDirectory != null) + { + resource.getResourceSet().getURIConverter().getURIMap().put( + URI.createURI("platform:/resource/TargetProject/"), + URI.createFileURI(targetDirectory + "/")); + genModel.setModelDirectory("/TargetProject"); + } + + //genModel.gen(new BasicMonitor.Printing(System.out)); + GeneratorAdapterFactory.Descriptor.Registry.INSTANCE.addDescriptor + (GenModelPackage.eNS_URI, GenModelGeneratorAdapterFactory.DESCRIPTOR); + + //Generator generator = new Generator(); + Generator generator = new Generator() + { + public JControlModel getJControlModel() + { + if (jControlModel == null) + { + jControlModel = new JControlModel(); + } + return jControlModel; + } + }; + + + //if ((genOptions & OPTION_USE_EMF_PATTERNS) == 0) + { + generator.getAdapterFactoryDescriptorRegistry().addDescriptor + (GenModelPackage.eNS_URI, SDOGenModelGeneratorAdapterFactory.DESCRIPTOR); + } + + generator.setInput(genModel); + generator.generate(genModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, new BasicMonitor.Printing(System.out)); + + + for (Iterator j = resource.getContents().iterator(); j.hasNext();) + { + EObject eObject = (EObject)j.next(); + Diagnostic diagnostic = Diagnostician.INSTANCE.validate(eObject); + if (diagnostic.getSeverity() != Diagnostic.OK) + { + printDiagnostic(diagnostic, ""); + } + } + } + + public static GenModel ecore2GenModel(EPackage ePackage, String basePackage, String prefix, int genOptions) + { + ArrayList ePackages = new ArrayList(); + ePackages.add(ePackage); + Hashtable packageInfoTable = new Hashtable(); + packageInfoTable.put(ePackage, new PackageInfo(basePackage, prefix, null, null )); + return ecore2GenModel(ePackages, packageInfoTable, genOptions ); + } + + private static GenModel ecore2GenModel(Collection ePackages, Hashtable packageInfoTable, int genOptions) + { + GenModel genModel = GenModelFactory.eINSTANCE.createGenModel(); + genModel.initialize(ePackages); + + genModel.setRootExtendsInterface(""); + genModel.setRootImplementsInterface("commonj.sdo.DataObject"); + genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl"); + genModel.setFeatureMapWrapperInterface("commonj.sdo.Sequence"); + genModel.setFeatureMapWrapperInternalInterface("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setFeatureMapWrapperClass("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setSuppressEMFTypes(true); + genModel.setSuppressEMFMetaData(true); + genModel.setSuppressEMFModelTags(true); + genModel.setCanGenerate(true); + //FIXME workaround java.lang.NoClassDefFoundError: org/eclipse/jdt/core/jdom/IDOMNode with 02162006 build + genModel.setFacadeHelperClass("Hack"); + genModel.setForceOverwrite(true); + + if ((genOptions & OPTION_NO_INTERFACES) != 0) + { + genModel.setSuppressInterfaces(true); + } + + if ((genOptions & OPTION_SPARSE_PATTERN) != 0) + { + genModel.setFeatureDelegation(GenDelegationKind.VIRTUAL_LITERAL); + } + else if ((genOptions & OPTION_STORE_PATTERN) != 0) + { + genModel.setFeatureDelegation(GenDelegationKind.REFLECTIVE_LITERAL); + genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.StoreDataObjectImpl"); + } + + if ((genOptions & OPTION_NO_CONTAINMENT) != 0) + { + genModel.setSuppressContainment(true); + } + + if ((genOptions & OPTION_NO_NOTIFICATION) != 0) + { + genModel.setSuppressNotification(true); + } + + if ((genOptions & OPTION_ARRAY_ACCESSORS) != 0) + { + genModel.setArrayAccessors(true); + } + + if ((genOptions & OPTION_NO_UNSETTABLE) != 0) + { + genModel.setSuppressUnsettable(true); + } + + //if ((genOptions & OPTION_USE_EMF_PATTERNS) == 0) + { + genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.DataObjectBase"); + } + + if ((genOptions & OPTION_INTERFACE_DO) != 0) + { + genModel.setRootExtendsInterface("commonj.sdo.DataObject"); + } + else + { + genModel.setRootExtendsInterface("java.io.Serializable"); + } + + //GenPackage genPackage = (GenPackage)genModel.getGenPackages().get(0); + Collection packages = genModel.getGenPackages(); + for (Iterator iter1 = packages.iterator(); iter1.hasNext();) + { + GenPackage genPackage = (GenPackage)iter1.next(); + PackageInfo packageInfo = (PackageInfo)packageInfoTable.get(genPackage.getEcorePackage()); + + if (packageInfo.getBasePackage() != null) + { + genPackage.setBasePackage(packageInfo.getBasePackage()); + } + if (packageInfo.getPrefix() != null) + { + genPackage.setPrefix(packageInfo.getPrefix()); + } + + //FIXME Temporary, I need this option for now to get Switch classes generated for the SCDL models + if ((genOptions & OPTION_GENERATE_SWITCH) == 0) + { + genPackage.setAdapterFactory(false); + } + + if ((genOptions & OPTION_GENERATE_LOADER) != 0) + { + //FIXME workaround compile error with 02162006 build, generated code references non-existent EcoreResourceImpl class + genPackage.setResource(GenResourceKind.XML_LITERAL); + //genPackage.setDataTypeConverters(true); + } + else + { + genPackage.setResource(GenResourceKind.NONE_LITERAL); + for (Iterator iter2 = genPackage.getGenClasses().iterator(); iter2.hasNext();) + { + GenClass genClass = (GenClass)iter2.next(); + if ("DocumentRoot".equals(genClass.getName())) + { + genClass.setDynamic(true); // Don't generate DocumentRoot class + break; + } + } + } + } + return genModel; + } + + public static String extractBasePackageName(EPackage ePackage, String javaPackage) + { + String qualifiedName = javaPackage != null ? javaPackage : ePackage.getName(); + String name = /*CodeGenUtil.*/shortName(qualifiedName); + String baseName = qualifiedName.substring(0, qualifiedName.length() - name.length()); + if (javaPackage != null || !name.equals(qualifiedName)) + { + ePackage.setName(name); + } + return baseName != null ? /*CodeGenUtil.*/safeQualifiedName(baseName) : null; + } + + public static String shortName(String qualifiedName) + { + int index = qualifiedName.lastIndexOf("."); + return index != -1 ? qualifiedName.substring(index + 1) : qualifiedName; + } + + public static String safeQualifiedName(String qualifiedName) + { + StringBuffer safeQualifiedName = new StringBuffer(); + for (StringTokenizer stringTokenizer = new StringTokenizer(qualifiedName, "."); stringTokenizer.hasMoreTokens();) + { + String name = stringTokenizer.nextToken(); + safeQualifiedName.append(CodeGenUtil.safeName(name)); + if (stringTokenizer.hasMoreTokens()) + { + safeQualifiedName.append('.'); + } + } + return safeQualifiedName.toString(); + } + + protected static void printDiagnostic(Diagnostic diagnostic, String indent) + { + System.out.print(indent); + System.out.println(diagnostic.getMessage()); + for (Iterator i = diagnostic.getChildren().iterator(); i.hasNext();) + { + printDiagnostic((Diagnostic)i.next(), indent + " "); + } + } + + protected static void printUsage() + { + System.out.println("Usage: this is a deprecated command replaced by XSD2JavaGenerator"); + } + + public static class PackageInfo + { + private String basePackage; + private String prefix; + private String namespace; + private String shortName; + + public PackageInfo(String basePackage, String prefix, String namespace, String shortName ) + { + setBasePackage(basePackage); + setPrefix(prefix); + setNamespace(namespace); + setShortName(shortName); + } + + public void setBasePackage(String basePackage) { this.basePackage = basePackage; } + public String getBasePackage() { return basePackage; } + public void setPrefix(String prefix) { this.prefix = prefix; } + public String getPrefix() { return prefix; } + public void setNamespace(String namespace) { this.namespace = namespace; } + public String getNamespace() { return namespace; } + public void setShortName(String shortName) { this.shortName = shortName; } + public String getShortName() { return shortName; } + } +} diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/XSD2JavaGenerator.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/XSD2JavaGenerator.java new file mode 100644 index 0000000000..7e65549165 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/XSD2JavaGenerator.java @@ -0,0 +1,500 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sdo.generate; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.sdo.helper.HelperContextImpl; +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.codegen.ecore.genmodel.GenClass; +import org.eclipse.emf.codegen.ecore.genmodel.GenFeature; +import org.eclipse.emf.codegen.ecore.genmodel.GenModel; +import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.ExtendedMetaData; +import org.eclipse.xsd.XSDSchema; + +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.XSDHelper; + +public class XSD2JavaGenerator extends JavaGenerator +{ + /** + * Generate static SDOs from XML Schema + * + * Usage arguments: see JavaGenerator + * + * [ -targetDirectory ] + * [ -javaPackage ] + * [ -schemaNamespace ] + * [ -namespaceInfo ] + * [ other options ... ] + * | + * + * Options: + * + * -schemaNamespace + * Generate classes for XSD types in the specified targetNamespace. By default, types in the + * targetNamespace of the first schema in the specified xsd or wsdl file are generated. Specify + * 'all' and this parameter will act as a wildcard selecting all namespaces for code generation. + * -namespaceInfo + * Specifies the name of a file that should contain a list of namespaces and their associated package names. + * Optionally, a prefix may be assigned to each namespace as well. These values are separated by semicolons. + * So each line in the file would look something like this: + * + * some\namespace;custom.package.name;optionalPrefix + * + * NOTE: see the base class JavaGenerator for other options. + * + * Example: + * + * generate somedir/somefile.xsd + * + * See base class JavaGenerator for details and the other options. + * + */ + public static void main(String args[]) + { + try + { + XSD2JavaGenerator generator = new XSD2JavaGenerator(); + generator.processArguments(args); + generator.run(args); + } + catch (Exception e) + { + e.printStackTrace(); + printUsage(); + } + } + + + protected String schemaNamespace = null; + protected String namespaceInfo = null; + protected String generateBuiltIn = null; + protected static GeneratedPackages generatedPackages = null; + protected boolean allNamespaces = false; + + protected int handleArgument(String args[], int index) + { + if (args[index].equalsIgnoreCase("-schemaNamespace")) + { + schemaNamespace = args[++index]; + if( "all".equalsIgnoreCase(schemaNamespace) ) + { + schemaNamespace = null; + allNamespaces = true; + } + } + else if (args[index].equalsIgnoreCase("-generateBuiltIn")) + { + // Internal option used when regenerating one of the built-in (predefined) models (e.g., commonj.sdo). + generateBuiltIn = args[++index]; + } + else if (args[index].equalsIgnoreCase("-namespaceInfo")) + { + namespaceInfo = args[++index]; + } + else + { + return super.handleArgument(args, index); + } + + return index + 1; + } + + protected void run(String args[]) + { + String xsdFileName = args[inputIndex]; + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); + String packageURI = getSchemaNamespace(xsdFileName); + Hashtable packageInfoTable = createPackageInfoTable(packageURI, schemaNamespace, javaPackage, prefix, namespaceInfo ); + generateFromXMLSchema(xsdFileName, packageRegistry, extendedMetaData, targetDirectory, packageInfoTable, genOptions, generateBuiltIn, allNamespaces); + } + + /** + * This method was invoked by the SDO Mojo plugin + * + * @param xsdFileName + * @param namespace + * @param targetDirectory + * @param javaPackage + * @param prefix + * @param genOptions + */ + public static void generateFromXMLSchema(String xsdFileName, String namespace, String targetDirectory, String javaPackage, String prefix, int genOptions) + { + boolean allNamespaces = false; + + // Need to process the passed-in schemaNamespace value from Mojo plugin the same as the command line + if( "all".equalsIgnoreCase(namespace)) + { + namespace = null; + allNamespaces = true; + } + + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); + String packageURI = getSchemaNamespace(xsdFileName); + Hashtable packageInfoTable = createPackageInfoTable(packageURI, namespace, javaPackage, prefix, null ); + generateFromXMLSchema(xsdFileName, packageRegistry, extendedMetaData, targetDirectory, packageInfoTable, genOptions, null, allNamespaces); + } + + + protected static GenModel generateFromXMLSchema(String xsdFileName, + EPackage.Registry packageRegistry, + ExtendedMetaData extendedMetaData, + String targetDirectory, + Hashtable packageInfoTable, + int genOptions, + String regenerateBuiltIn, + boolean allNamespaces ) + { + GenModel genModel = null; + + HelperContext hc = new HelperContextImpl(extendedMetaData, false); + XSDHelper xsdHelper = hc.getXSDHelper(); + ((XSDHelperImpl)xsdHelper).setRedefineBuiltIn(regenerateBuiltIn); + + try + { + File inputFile = new File(xsdFileName).getAbsoluteFile(); + InputStream inputStream = new FileInputStream(inputFile); + xsdHelper.define(inputStream, inputFile.toURI().toString()); + + if (targetDirectory == null) + { + targetDirectory = new File(xsdFileName).getCanonicalFile().getParent(); + } + else + { + targetDirectory = new File(targetDirectory).getCanonicalPath(); + } + + if (!packageRegistry.values().isEmpty()) + { + genModel = generatePackages(packageRegistry.values(), targetDirectory, packageInfoTable, genOptions, allNamespaces ); + // For now, this option is not supported + /* + if( (genModel != null) ) + { + if((extendedMetaData != null)) + { + // Display only, will report all namespaces and associated packages found + List genPackages = genModel.getGenPackages(); + for (Iterator iter = genPackages.iterator(); iter.hasNext();) + { + GenPackage genPackage = (GenPackage)iter.next(); + EPackage ecorePackage = genPackage.getEcorePackage(); + if( (genOptions & OPTION_DISPLAY_NAMESPACES) != 0) + System.out.println(extendedMetaData.getNamespace(ecorePackage)+";"+genPackage.getInterfacePackageName()+"."+ecorePackage.getName()); + } + } + } + */ + } else { + System.err.println("Input schema file " + xsdFileName + " defined no metadata."); + } + + /* + for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) + { + EPackage ePackage = (EPackage)iter.next(); + String basePackage = extractBasePackageName(ePackage, javaPackage); + if (prefix == null) + { + prefix = CodeGenUtil.capName(ePackage.getName()); + } + generateFromEPackage(ePackage, targetDirectory, basePackage, prefix, genOptions); + } + */ + } + catch (IOException e) + { + e.printStackTrace(); + } + return genModel; + } + + public static String getSchemaNamespace(String xsdFileName) + { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + File inputFile = new File(xsdFileName).getAbsoluteFile(); + Resource model = resourceSet.getResource(URI.createURI(inputFile.toURI().toString()), true); + XSDSchema schema = (XSDSchema)model.getContents().get(0); + String targetNS = schema.getTargetNamespace(); + if (targetNS == null) { + targetNS = schema.getSchemaLocation(); + } + + return targetNS; + } + + protected static void printUsage() + { + System.out.println("Usage arguments:"); + System.out.println(" [ -targetDirectory ]"); + System.out.println(" [ -javaPackage ]"); + System.out.println(" [ -prefix ]"); + System.out.println(" [ -schemaNamespace ]"); + System.out.println(" [ -namespaceInfo ]"); + System.out.println(" [ -noInterfaces ]"); + System.out.println(" [ -noContainment ]"); + System.out.println(" [ -noNotification ]"); + System.out.println(" [ -noUnsettable ]"); + /* Future Option: System.out.println(" [ -sparsePattern | -storePattern ]"); */ + /* Future Option: System.out.println(" [ -arrayAccessors ]"); */ + /* Future Option: System.out.println(" [ -generateLoader ]"); */ + /* Future Option: System.out.println(" [ -interfaceDataObject ]"); */ + System.out.println(" | "); + System.out.println(""); + System.out.println("For example:"); + System.out.println(""); + System.out.println(" generate somedir/somefile.xsd"); + } + + public void generateFromXMLSchema(String args[]) + { + try + { + processArguments(args); + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); + String xsdFileName = args[inputIndex]; + String packageURI = getSchemaNamespace(xsdFileName); + Hashtable packageInfoTable = createPackageInfoTable(packageURI, schemaNamespace, javaPackage, prefix, namespaceInfo ); + GenModel genModel = generateFromXMLSchema(xsdFileName, packageRegistry, extendedMetaData, targetDirectory, packageInfoTable, genOptions, generateBuiltIn, allNamespaces); + generatedPackages = new GeneratedPackages(genModel,extendedMetaData); + } + catch (IllegalArgumentException e) + { + printUsage(); + } + } + + private static Hashtable createPackageInfoTable( String packageURI, String schemaNamespace, String javaPackage, String prefix, String namespaceInfo ) + { + Hashtable packageInfoTable = new Hashtable(); + + if( namespaceInfo != null ) + { + try + { + FileReader inputFile = new FileReader(namespaceInfo); + BufferedReader bufRead = new BufferedReader(inputFile); + + String line = bufRead.readLine(); + while( line != null ) + { + if( line.length() > 0 ) + { + String [] options = line.split(";"); + if( options.length > 1 ) + { + if( options.length > 2 ) + packageInfoTable.put(options[0], new PackageInfo(options[1], options[2], options[0], null )); + else + packageInfoTable.put(options[0], new PackageInfo(options[1], null, options[0], null )); + } + else + packageInfoTable.put(options[0], new PackageInfo(null, null, options[0], null )); + } + line = bufRead.readLine(); + } + } + catch (IOException e) + { + e.printStackTrace(); + } + } + else + { + if( schemaNamespace != null ) + packageInfoTable.put(schemaNamespace, new PackageInfo(javaPackage, prefix, schemaNamespace, null )); + else if( packageURI != null ) + packageInfoTable.put(packageURI, new PackageInfo(javaPackage, prefix, null, null )); + } + return packageInfoTable; + } + + public List getGeneratedPackageInfo() + { + if( generatedPackages != null ) + return generatedPackages.getPackageList(); + else + return null; + } + + protected class GeneratedPackages + { + private List genPackages = null; + + GeneratedPackages(GenModel genModel, ExtendedMetaData extendedMetaData) + { + List packages = genModel.getGenPackages(); + Hashtable genClasses = new Hashtable(); + for (Iterator iter = packages.iterator(); iter.hasNext();) + { + // loop through the list, once to build up the eclass to genclass mapper + GenPackage genPackage = (GenPackage)iter.next(); + List classes = genPackage.getGenClasses(); + for (Iterator classIter = classes.iterator(); classIter.hasNext();) + { + GenClass genClass = (GenClass)classIter.next(); + genClasses.put(genClass.getEcoreClass(), genClass); + } + } + genPackages = new ArrayList(); + for (Iterator iter = packages.iterator(); iter.hasNext();) + { + // now process the pckage list + GenPackage genPackage = (GenPackage)iter.next(); + genPackages.add(new GeneratedPackage(genPackage,extendedMetaData,genClasses)); + } + } + + List getPackageList() {return genPackages;} + } + + public class GeneratedPackage + { + private String namespace; + private Hashtable classes; + + public String getNamespace() {return namespace;} + public List getClasses() {return new ArrayList(classes.values());} + + GeneratedPackage(GenPackage genPackage, ExtendedMetaData extendedMetaData, Hashtable eclassGenClassMap ) + { + classes = new Hashtable(); + + EPackage ePackage = genPackage.getEcorePackage(); + namespace = extendedMetaData.getNamespace(ePackage); + + List genClasses = genPackage.getGenClasses(); + for (Iterator iterClass = genClasses.iterator(); iterClass.hasNext();) + { + GenClass genClass = (GenClass)iterClass.next(); + if ("DocumentRoot".equals(genClass.getEcoreClass().getName())) { + List features = genClass.getGenFeatures(); + for (Iterator iterFeatures = features.iterator(); iterFeatures.hasNext();) + { + GenFeature feature = (GenFeature)iterFeatures.next(); + addGlobalElement(feature.getEcoreFeature(),extendedMetaData, eclassGenClassMap); + } + } + } + } + + private void addGlobalElement(EStructuralFeature eFeature, ExtendedMetaData extendedMetaData, Hashtable eclassGenClassMap ) + { + + String name = eFeature.getName(); + String classname = ""; + boolean anonymous = false; + List propertyClassNames = null; + + EClassifier eClassifier = eFeature.getEType(); + + if( eClassifier instanceof EClass ) + { + // complex type + EClass eClass = (EClass)eClassifier; + GenClass genEClass = (GenClass)eclassGenClassMap.get(eClassifier); + if( genEClass != null ) + { + classname = genEClass.getGenPackage().getInterfacePackageName() + + '.' + genEClass.getInterfaceName(); + anonymous = extendedMetaData.isAnonymous(eClass); + + // Build list of property names + propertyClassNames = new ArrayList(); + List properties = eClass.getEStructuralFeatures(); + for (Iterator iterProperties = properties.iterator(); iterProperties.hasNext();) + { + EStructuralFeature property = (EStructuralFeature)iterProperties.next(); + EClassifier propertyType = property.getEType(); + if (propertyType instanceof EClass) + { + GenClass propertyGenClass = (GenClass)eclassGenClassMap.get(propertyType); + if( propertyGenClass != null ) + { + String propertyClassName = propertyGenClass.getGenPackage().getInterfacePackageName() + '.' + + propertyGenClass.getInterfaceName(); + propertyClassNames.add(propertyClassName); + } + } + else if (propertyType instanceof EClassifier) + { + String propertyClassName = propertyType.getInstanceClass().getName(); + propertyClassNames.add(propertyClassName); + } + } + } + } + else + { + // simple type + classname = eClassifier.getInstanceClass().getName(); + } + classes.put( name, new PackageClassInfo( name, classname, anonymous, propertyClassNames ) ); + } + + public class PackageClassInfo + { + private String name; + private String className = null; + private boolean anonymous = false; + private List properties = null; + + PackageClassInfo( String name, String className, boolean anonymous, List properties ) + { + this.name = name; + this.className = className; + this.anonymous = anonymous; + this.properties = properties; + } + + public String getName() {return name;} + public String getClassName() {return className;} + public boolean getAnonymous() {return anonymous;} + public List getProperties() {return properties;} + } + } +} diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenClassGeneratorAdapter.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenClassGeneratorAdapter.java new file mode 100644 index 0000000000..d522ad5fad --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenClassGeneratorAdapter.java @@ -0,0 +1,53 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sdo.generate.adapter; + +import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory; +import org.eclipse.emf.codegen.ecore.genmodel.generator.GenClassGeneratorAdapter; +import org.eclipse.emf.common.util.Monitor; + +public class SDOGenClassGeneratorAdapter extends GenClassGeneratorAdapter { + + public SDOGenClassGeneratorAdapter(GeneratorAdapterFactory generatorAdapterFactory) + { + super(generatorAdapterFactory); + } + + private static JETEmitterDescriptor[] jetEmitterDescriptors; + + protected JETEmitterDescriptor[] getJETEmitterDescriptors() + { + if (jetEmitterDescriptors == null) + { + JETEmitterDescriptor[] base = super.getJETEmitterDescriptors(); + jetEmitterDescriptors = new JETEmitterDescriptor[base.length]; + System.arraycopy(base, 0, jetEmitterDescriptors, 0, base.length); + jetEmitterDescriptors[CLASS_ID] = new JETEmitterDescriptor("model/SDOClass.javajet", "org.apache.tuscany.sdo.generate.templates.model.SDOClass"); + } + return jetEmitterDescriptors; + } + + protected void ensureProjectExists(String workspacePath, Object object, + Object projectType, boolean force, Monitor monitor) + { + // Do nothing -- this avoids differential behaviour according to whether we + // are running in Eclipse or not + } +} diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapter.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapter.java new file mode 100644 index 0000000000..16678e001b --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapter.java @@ -0,0 +1,38 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sdo.generate.adapter; + +import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory; +import org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapter; +import org.eclipse.emf.common.util.Monitor; + +public class SDOGenModelGeneratorAdapter extends GenModelGeneratorAdapter { + + public SDOGenModelGeneratorAdapter( + GeneratorAdapterFactory generatorAdapterFactory) { + super(generatorAdapterFactory); + } + + protected void ensureProjectExists(String workspacePath, Object object, + Object projectType, boolean force, Monitor monitor) { + // Do nothing -- this avoids differential behaviour according to whether we + // are running in Eclipse or not + } +} diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapterFactory.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapterFactory.java new file mode 100644 index 0000000000..dfe62878af --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapterFactory.java @@ -0,0 +1,63 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sdo.generate.adapter; + +import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory; +import org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapterFactory; +import org.eclipse.emf.common.notify.Adapter; + +public class SDOGenModelGeneratorAdapterFactory extends + GenModelGeneratorAdapterFactory { + + public static final GeneratorAdapterFactory.Descriptor DESCRIPTOR = new GeneratorAdapterFactory.Descriptor() + { + public GeneratorAdapterFactory createAdapterFactory() + { + return new SDOGenModelGeneratorAdapterFactory(); + } + }; + + public Adapter createGenClassAdapter() + { + if (genClassGeneratorAdapter == null) + { + genClassGeneratorAdapter = new SDOGenClassGeneratorAdapter(this); + } + return genClassGeneratorAdapter; + } + + public Adapter createGenPackageAdapter() + { + if (genPackageGeneratorAdapter == null) + { + genPackageGeneratorAdapter = new SDOGenPackageGeneratorAdapter(this); + } + return genPackageGeneratorAdapter; + } + + public Adapter createGenModelAdapter() + { + if (genModelGeneratorAdapter == null) + { + genModelGeneratorAdapter = new SDOGenModelGeneratorAdapter(this); + } + return genModelGeneratorAdapter; + } +} diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenPackageGeneratorAdapter.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenPackageGeneratorAdapter.java new file mode 100644 index 0000000000..6616be995c --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenPackageGeneratorAdapter.java @@ -0,0 +1,59 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sdo.generate.adapter; + +import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory; +import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; +import org.eclipse.emf.codegen.ecore.genmodel.generator.GenPackageGeneratorAdapter; +import org.eclipse.emf.common.util.Monitor; + +public class SDOGenPackageGeneratorAdapter extends GenPackageGeneratorAdapter +{ + public SDOGenPackageGeneratorAdapter(GeneratorAdapterFactory generatorAdapterFactory) + { + super(generatorAdapterFactory); + } + + private static JETEmitterDescriptor[] jetEmitterDescriptors; + + protected JETEmitterDescriptor[] getJETEmitterDescriptors() + { + if (jetEmitterDescriptors == null) + { + JETEmitterDescriptor[] base = super.getJETEmitterDescriptors(); + jetEmitterDescriptors = new JETEmitterDescriptor[base.length]; + System.arraycopy(base, 0, jetEmitterDescriptors, 0, base.length); + jetEmitterDescriptors[FACTORY_CLASS_ID] = new JETEmitterDescriptor("model/SDOFactoryClass.javajet", "org.apache.tuscany.sdo.generate.templates.model.SDOFactoryClass"); + } + return jetEmitterDescriptors; + } + + protected void generatePackageClass(GenPackage genPackage, Monitor monitor) + { + // do nothing + } + + protected void ensureProjectExists(String workspacePath, Object object, + Object projectType, boolean force, Monitor monitor) + { + // Do nothing -- this avoids differential behaviour according to whether we + // are running in Eclipse or not + } +} diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOClass.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOClass.java new file mode 100644 index 0000000000..74e6a77699 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOClass.java @@ -0,0 +1,4288 @@ +package org.apache.tuscany.sdo.generate.templates.model; + +import org.eclipse.emf.codegen.util.*; +import org.apache.tuscany.sdo.impl.*; +import java.util.*; +import org.eclipse.emf.codegen.ecore.genmodel.*; +import org.apache.tuscany.sdo.generate.util.*; + +public class SDOClass +{ + protected static String nl; + public static synchronized SDOClass create(String lineSeparator) + { + nl = lineSeparator; + SDOClass result = new SDOClass(); + nl = null; + return result; + } + + protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = ""; + protected final String TEXT_2 = "/**" + NL + " * " + NL + " * " + NL + " *" + NL + " * "; + protected final String TEXT_3 = "Id"; + protected final String TEXT_4 = NL + " */"; + protected final String TEXT_5 = NL + "package "; + protected final String TEXT_6 = ";"; + protected final String TEXT_7 = NL + "package "; + protected final String TEXT_8 = ";"; + protected final String TEXT_9 = NL; + protected final String TEXT_10 = NL; + protected final String TEXT_11 = NL + " // EYECATCHER 1"; + protected final String TEXT_12 = NL + "/**" + NL + " * " + NL + " * A representation of the model object '"; + protected final String TEXT_13 = "'." + NL + " * "; + protected final String TEXT_14 = NL + " *" + NL + " * " + NL + " * "; + protected final String TEXT_15 = NL + " * "; + protected final String TEXT_16 = NL + " *"; + protected final String TEXT_17 = NL + " *

" + NL + " * The following features are supported:" + NL + " *

    "; + protected final String TEXT_18 = NL + " *
  • {@link "; + protected final String TEXT_19 = "#"; + protected final String TEXT_20 = " "; + protected final String TEXT_21 = "}
  • "; + protected final String TEXT_22 = NL + " *
" + NL + " *

"; + protected final String TEXT_23 = NL + " *"; + protected final String TEXT_24 = NL + " * @see "; + protected final String TEXT_25 = "#get"; + protected final String TEXT_26 = "()"; + protected final String TEXT_27 = NL + " * @model "; + protected final String TEXT_28 = NL + " * "; + protected final String TEXT_29 = NL + " * @model"; + protected final String TEXT_30 = NL + " * @extends "; + protected final String TEXT_31 = NL + " * @generated" + NL + " */"; + protected final String TEXT_32 = NL + "/**" + NL + " * " + NL + " * An implementation of the model object '"; + protected final String TEXT_33 = "'." + NL + " * " + NL + " *

"; + protected final String TEXT_34 = NL + " * The following features are implemented:" + NL + " *

    "; + protected final String TEXT_35 = NL + " *
  • {@link "; + protected final String TEXT_36 = "#"; + protected final String TEXT_37 = " "; + protected final String TEXT_38 = "}
  • "; + protected final String TEXT_39 = NL + " *
"; + protected final String TEXT_40 = NL + " *

" + NL + " *" + NL + " * @generated" + NL + " */"; + protected final String TEXT_41 = NL + "public"; + protected final String TEXT_42 = " abstract"; + protected final String TEXT_43 = " class "; + protected final String TEXT_44 = NL + "public interface "; + protected final String TEXT_45 = NL + "{"; + protected final String TEXT_46 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_47 = " copyright = \""; + protected final String TEXT_48 = "\";"; + protected final String TEXT_49 = NL; + protected final String TEXT_50 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final "; + protected final String TEXT_51 = " mofDriverNumber = \""; + protected final String TEXT_52 = "\";"; + protected final String TEXT_53 = NL; + protected final String TEXT_54 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static final long serialVersionUID = 1L;" + NL; + protected final String TEXT_55 = NL + "\t/**" + NL + "\t * An array of objects representing the values of non-primitive features." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Object[] "; + protected final String TEXT_56 = " = null;" + NL; + protected final String TEXT_57 = NL + "\t/**" + NL + "\t * A bit field representing the indices of non-primitive feature values." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected int "; + protected final String TEXT_58 = " = 0;" + NL; + protected final String TEXT_59 = NL + "\t/**" + NL + "\t * A set of bit flags representing the values of boolean attributes and whether unsettable features have been set." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected int "; + protected final String TEXT_60 = " = 0;" + NL; + protected final String TEXT_61 = NL; + protected final String TEXT_62 = NL + "\tpublic final static int "; + protected final String TEXT_63 = " = "; + protected final String TEXT_64 = ";" + NL; + protected final String TEXT_65 = NL + "\tpublic final static int "; + protected final String TEXT_66 = " = "; + protected final String TEXT_67 = ";" + NL; + protected final String TEXT_68 = NL + "\tpublic final static int SDO_PROPERTY_COUNT = "; + protected final String TEXT_69 = ";" + NL; + protected final String TEXT_70 = NL + "\tpublic final static int EXTENDED_PROPERTY_COUNT = "; + protected final String TEXT_71 = ";" + NL + NL; + protected final String TEXT_72 = NL + "\t/**" + NL + "\t * The internal feature id for the '"; + protected final String TEXT_73 = "' "; + protected final String TEXT_74 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */"; + protected final String TEXT_75 = " " + NL + "\tpublic final static int _INTERNAL_"; + protected final String TEXT_76 = " = "; + protected final String TEXT_77 = ";" + NL; + protected final String TEXT_78 = NL + "\t/**" + NL + "\t * The number of properties for this type." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */"; + protected final String TEXT_79 = NL + "\tpublic final static int INTERNAL_PROPERTY_COUNT = "; + protected final String TEXT_80 = ";" + NL + "" + NL + "\tprotected int internalConvertIndex(int internalIndex)" + NL + "\t{" + NL + "\t\tswitch (internalIndex)" + NL + "\t\t{"; + protected final String TEXT_81 = NL + "\t\t\tcase _INTERNAL_"; + protected final String TEXT_82 = ": return "; + protected final String TEXT_83 = ";"; + protected final String TEXT_84 = NL + "\t\t}" + NL + "\t\treturn super.internalConvertIndex(internalIndex);" + NL + "\t}" + NL + NL; + protected final String TEXT_85 = NL + "\t/**" + NL + "\t * The cached value of the '{@link #"; + protected final String TEXT_86 = "() "; + protected final String TEXT_87 = "}' "; + protected final String TEXT_88 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @see #"; + protected final String TEXT_89 = "()" + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\t" + NL + "\tprotected "; + protected final String TEXT_90 = " "; + protected final String TEXT_91 = " = null;" + NL + "\t"; + protected final String TEXT_92 = NL + "\t/**" + NL + "\t * The empty value for the '{@link #"; + protected final String TEXT_93 = "() "; + protected final String TEXT_94 = "}' array accessor." + NL + "\t * " + NL + "\t * " + NL + "\t * @see #"; + protected final String TEXT_95 = "()" + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected static final "; + protected final String TEXT_96 = "[] "; + protected final String TEXT_97 = "_EEMPTY_ARRAY = new "; + protected final String TEXT_98 = " [0];" + NL; + protected final String TEXT_99 = NL + "\t/**" + NL + "\t * The default value of the '{@link #"; + protected final String TEXT_100 = "() "; + protected final String TEXT_101 = "}' "; + protected final String TEXT_102 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @see #"; + protected final String TEXT_103 = "()" + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected static final "; + protected final String TEXT_104 = " "; + protected final String TEXT_105 = "_DEFAULT_ = "; + protected final String TEXT_106 = ";"; + protected final String TEXT_107 = NL; + protected final String TEXT_108 = NL + "\t/**" + NL + "\t * An additional set of bit flags representing the values of boolean attributes and whether unsettable features have been set." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected int "; + protected final String TEXT_109 = " = 0;" + NL; + protected final String TEXT_110 = NL + "\t/**" + NL + "\t * The flag representing the value of the '{@link #"; + protected final String TEXT_111 = "() "; + protected final String TEXT_112 = "}' "; + protected final String TEXT_113 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @see #"; + protected final String TEXT_114 = "()" + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected static final int "; + protected final String TEXT_115 = "_EFLAG = 1 "; + protected final String TEXT_116 = ";" + NL; + protected final String TEXT_117 = NL + "\t/**" + NL + "\t * The cached value of the '{@link #"; + protected final String TEXT_118 = "() "; + protected final String TEXT_119 = "}' "; + protected final String TEXT_120 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @see #"; + protected final String TEXT_121 = "()" + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected "; + protected final String TEXT_122 = " "; + protected final String TEXT_123 = " = "; + protected final String TEXT_124 = "_DEFAULT_;" + NL; + protected final String TEXT_125 = NL + "\t/**" + NL + "\t * An additional set of bit flags representing the values of boolean attributes and whether unsettable features have been set." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected int "; + protected final String TEXT_126 = " = 0;" + NL; + protected final String TEXT_127 = NL + "\t/**" + NL + "\t * The flag representing whether the "; + protected final String TEXT_128 = " "; + protected final String TEXT_129 = " has been set." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected static final int "; + protected final String TEXT_130 = "_ESETFLAG = 1 "; + protected final String TEXT_131 = ";" + NL; + protected final String TEXT_132 = NL + "\t/**" + NL + "\t * This is true if the "; + protected final String TEXT_133 = " "; + protected final String TEXT_134 = " has been set." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected boolean "; + protected final String TEXT_135 = "_set_ = false;" + NL; + protected final String TEXT_136 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_137 = "()" + NL + "\t{" + NL + "\t\tsuper();"; + protected final String TEXT_138 = NL + "\t\t"; + protected final String TEXT_139 = " |= "; + protected final String TEXT_140 = "_EFLAG;"; + protected final String TEXT_141 = NL + "\t\tcreateChangeSummary("; + protected final String TEXT_142 = ");"; + protected final String TEXT_143 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_144 = " getStaticType()" + NL + "\t{" + NL + "\t\treturn (("; + protected final String TEXT_145 = ")"; + protected final String TEXT_146 = ".INSTANCE).get"; + protected final String TEXT_147 = "();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int getStaticPropertyCount()" + NL + "\t{" + NL + "\t\treturn INTERNAL_PROPERTY_COUNT;" + NL + "\t}" + NL; + protected final String TEXT_148 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_149 = NL + "\t"; + protected final String TEXT_150 = "[] "; + protected final String TEXT_151 = "();" + NL; + protected final String TEXT_152 = NL + "\tpublic "; + protected final String TEXT_153 = "[] "; + protected final String TEXT_154 = "()" + NL + "\t{"; + protected final String TEXT_155 = NL + "\t\t"; + protected final String TEXT_156 = " list = ("; + protected final String TEXT_157 = ")"; + protected final String TEXT_158 = "();" + NL + "\t\tif (list.isEmpty()) return "; + protected final String TEXT_159 = "_EEMPTY_ARRAY;"; + protected final String TEXT_160 = NL + "\t\tif ("; + protected final String TEXT_161 = " == null || "; + protected final String TEXT_162 = ".isEmpty()) return "; + protected final String TEXT_163 = "_EEMPTY_ARRAY;" + NL + "\t\t"; + protected final String TEXT_164 = " list = ("; + protected final String TEXT_165 = ")"; + protected final String TEXT_166 = ";"; + protected final String TEXT_167 = NL + "\t\tlist.shrink();" + NL + "\t\treturn ("; + protected final String TEXT_168 = "[])list.data();" + NL + "\t}" + NL; + protected final String TEXT_169 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_170 = NL + "\t"; + protected final String TEXT_171 = " get"; + protected final String TEXT_172 = "(int index);"; + protected final String TEXT_173 = NL + "\tpublic "; + protected final String TEXT_174 = " get"; + protected final String TEXT_175 = "(int index)" + NL + "\t{" + NL + "\t\treturn ("; + protected final String TEXT_176 = ")"; + protected final String TEXT_177 = "().get(index);" + NL + "\t}"; + protected final String TEXT_178 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_179 = NL + "\tint get"; + protected final String TEXT_180 = "Length();" + NL; + protected final String TEXT_181 = NL + "\tpublic int get"; + protected final String TEXT_182 = "Length()" + NL + "\t{"; + protected final String TEXT_183 = NL + "\t\treturn "; + protected final String TEXT_184 = "().size();"; + protected final String TEXT_185 = NL + "\t\treturn "; + protected final String TEXT_186 = " == null ? 0 : "; + protected final String TEXT_187 = ".size();"; + protected final String TEXT_188 = NL + "\t}" + NL; + protected final String TEXT_189 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_190 = NL + "\tvoid set"; + protected final String TEXT_191 = "("; + protected final String TEXT_192 = "[] new"; + protected final String TEXT_193 = ");" + NL; + protected final String TEXT_194 = NL + "\tpublic void set"; + protected final String TEXT_195 = "("; + protected final String TEXT_196 = "[] new"; + protected final String TEXT_197 = ")" + NL + "\t{" + NL + "\t\t(("; + protected final String TEXT_198 = ")"; + protected final String TEXT_199 = "()).setData(new"; + protected final String TEXT_200 = ".length, new"; + protected final String TEXT_201 = ");" + NL + "\t}" + NL; + protected final String TEXT_202 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_203 = NL + "\tvoid set"; + protected final String TEXT_204 = "(int index, "; + protected final String TEXT_205 = " element);" + NL; + protected final String TEXT_206 = NL + "\tpublic void set"; + protected final String TEXT_207 = "(int index, "; + protected final String TEXT_208 = " element)" + NL + "\t{" + NL + "\t\t"; + protected final String TEXT_209 = "().set(index, element);" + NL + "\t}" + NL; + protected final String TEXT_210 = NL + "\t/**" + NL + "\t * Returns the value of the '"; + protected final String TEXT_211 = "' "; + protected final String TEXT_212 = "."; + protected final String TEXT_213 = NL + "\t * The key is of type "; + protected final String TEXT_214 = "list of {@link "; + protected final String TEXT_215 = "}"; + protected final String TEXT_216 = "{@link "; + protected final String TEXT_217 = "}"; + protected final String TEXT_218 = "," + NL + "\t * and the value is of type "; + protected final String TEXT_219 = "list of {@link "; + protected final String TEXT_220 = "}"; + protected final String TEXT_221 = "{@link "; + protected final String TEXT_222 = "}"; + protected final String TEXT_223 = ","; + protected final String TEXT_224 = NL + "\t * The list contents are of type {@link "; + protected final String TEXT_225 = "}."; + protected final String TEXT_226 = NL + "\t * The default value is "; + protected final String TEXT_227 = "."; + protected final String TEXT_228 = NL + "\t * The literals are from the enumeration {@link "; + protected final String TEXT_229 = "}."; + protected final String TEXT_230 = NL + "\t * It is bidirectional and its opposite is '{@link "; + protected final String TEXT_231 = "#"; + protected final String TEXT_232 = " "; + protected final String TEXT_233 = "}'."; + protected final String TEXT_234 = NL + "\t * "; + protected final String TEXT_235 = NL + "\t *

" + NL + "\t * If the meaning of the '"; + protected final String TEXT_236 = "' "; + protected final String TEXT_237 = " isn't clear," + NL + "\t * there really should be more of a description here..." + NL + "\t *

"; + protected final String TEXT_238 = NL + "\t * "; + protected final String TEXT_239 = NL + "\t * " + NL + "\t * "; + protected final String TEXT_240 = NL + "\t * "; + protected final String TEXT_241 = NL + "\t * @return the value of the '"; + protected final String TEXT_242 = "' "; + protected final String TEXT_243 = "."; + protected final String TEXT_244 = NL + "\t * @see "; + protected final String TEXT_245 = NL + "\t * @see #isSet"; + protected final String TEXT_246 = "()"; + protected final String TEXT_247 = NL + "\t * @see #unset"; + protected final String TEXT_248 = "()"; + protected final String TEXT_249 = NL + "\t * @see #set"; + protected final String TEXT_250 = "("; + protected final String TEXT_251 = ")"; + protected final String TEXT_252 = NL + "\t * @see "; + protected final String TEXT_253 = "#get"; + protected final String TEXT_254 = "()"; + protected final String TEXT_255 = NL + "\t * @see "; + protected final String TEXT_256 = "#"; + protected final String TEXT_257 = NL + "\t * @model "; + protected final String TEXT_258 = NL + "\t * "; + protected final String TEXT_259 = NL + "\t * @model"; + protected final String TEXT_260 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_261 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_262 = NL + "\t"; + protected final String TEXT_263 = " "; + protected final String TEXT_264 = "();" + NL; + protected final String TEXT_265 = NL + "\tpublic "; + protected final String TEXT_266 = " "; + protected final String TEXT_267 = "()" + NL + "\t{"; + protected final String TEXT_268 = NL + "\t\treturn "; + protected final String TEXT_269 = "("; + protected final String TEXT_270 = "("; + protected final String TEXT_271 = ")get("; + protected final String TEXT_272 = ", true)"; + protected final String TEXT_273 = ")."; + protected final String TEXT_274 = "()"; + protected final String TEXT_275 = ";"; + protected final String TEXT_276 = NL + "\t\t"; + protected final String TEXT_277 = " "; + protected final String TEXT_278 = " = ("; + protected final String TEXT_279 = ")eVirtualGet("; + protected final String TEXT_280 = ");"; + protected final String TEXT_281 = NL + "\t\tif ("; + protected final String TEXT_282 = " == null)" + NL + "\t\t{"; + protected final String TEXT_283 = NL + "\t\t\teVirtualSet("; + protected final String TEXT_284 = ", "; + protected final String TEXT_285 = " = new "; + protected final String TEXT_286 = ");"; + protected final String TEXT_287 = NL + "\t\t "; + protected final String TEXT_288 = " = createSequence(_INTERNAL_"; + protected final String TEXT_289 = ");"; + protected final String TEXT_290 = NL + "\t\t "; + protected final String TEXT_291 = " = createPropertyList("; + protected final String TEXT_292 = ", "; + protected final String TEXT_293 = ".class, "; + protected final String TEXT_294 = ", "; + protected final String TEXT_295 = ");"; + protected final String TEXT_296 = NL + "\t\t}" + NL + "\t\treturn "; + protected final String TEXT_297 = ";"; + protected final String TEXT_298 = NL + "\t\tif (eContainerFeatureID != "; + protected final String TEXT_299 = ") return null;" + NL + "\t\treturn ("; + protected final String TEXT_300 = ")eContainer();"; + protected final String TEXT_301 = NL + "\t\t"; + protected final String TEXT_302 = " "; + protected final String TEXT_303 = " = ("; + protected final String TEXT_304 = ")eVirtualGet("; + protected final String TEXT_305 = ", "; + protected final String TEXT_306 = "_DEFAULT_"; + protected final String TEXT_307 = ");"; + protected final String TEXT_308 = NL + "\t\tif ("; + protected final String TEXT_309 = " != null && isProxy("; + protected final String TEXT_310 = "))" + NL + "\t\t{" + NL + "\t\t\tObject old"; + protected final String TEXT_311 = " = "; + protected final String TEXT_312 = ";" + NL + "\t\t\t"; + protected final String TEXT_313 = " = "; + protected final String TEXT_314 = "resolveProxy(old"; + protected final String TEXT_315 = ");" + NL + "\t\t\tif ("; + protected final String TEXT_316 = " != old"; + protected final String TEXT_317 = ")" + NL + "\t\t\t{"; + protected final String TEXT_318 = NL + "\t\t\t\t"; + protected final String TEXT_319 = " new"; + protected final String TEXT_320 = " = ("; + protected final String TEXT_321 = ")"; + protected final String TEXT_322 = ";"; + protected final String TEXT_323 = NL + "\t\t\t\tChangeContext changeContext = old"; + protected final String TEXT_324 = ".eInverseRemove(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_325 = ", null, null);"; + protected final String TEXT_326 = NL + "\t\t\t\t"; + protected final String TEXT_327 = " changeContext = old"; + protected final String TEXT_328 = ".eInverseRemove(this, "; + protected final String TEXT_329 = ", "; + protected final String TEXT_330 = ".class, null);"; + protected final String TEXT_331 = NL + "\t\t\t\tif (new"; + protected final String TEXT_332 = ".eInternalContainer() == null)" + NL + "\t\t\t\t{"; + protected final String TEXT_333 = NL + "\t\t\t\t\tchangeContext = new"; + protected final String TEXT_334 = ".eInverseAdd(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_335 = ", null, changeContext);"; + protected final String TEXT_336 = NL + "\t\t\t\t\tchangeContext = new"; + protected final String TEXT_337 = ".eInverseAdd(this, "; + protected final String TEXT_338 = ", "; + protected final String TEXT_339 = ".class, changeContext);"; + protected final String TEXT_340 = NL + "\t\t\t\t}" + NL + "\t\t\t\tif (changeContext != null) dispatch(changeContext);"; + protected final String TEXT_341 = NL + "\t\t\t\teVirtualSet("; + protected final String TEXT_342 = ", "; + protected final String TEXT_343 = ");"; + protected final String TEXT_344 = NL + "\t\t\t\tif (isNotifying())" + NL + "\t\t\t\t\tnotify(ChangeKind.RESOLVE, _INTERNAL_"; + protected final String TEXT_345 = ", old"; + protected final String TEXT_346 = ", "; + protected final String TEXT_347 = ");"; + protected final String TEXT_348 = NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_349 = NL + "\t\treturn ("; + protected final String TEXT_350 = ")eVirtualGet("; + protected final String TEXT_351 = ", "; + protected final String TEXT_352 = "_DEFAULT_"; + protected final String TEXT_353 = ");"; + protected final String TEXT_354 = NL + "\t\treturn ("; + protected final String TEXT_355 = " & "; + protected final String TEXT_356 = "_EFLAG) != 0;"; + protected final String TEXT_357 = NL + "\t\treturn "; + protected final String TEXT_358 = ";"; + protected final String TEXT_359 = NL + "\t\t"; + protected final String TEXT_360 = " "; + protected final String TEXT_361 = " = basicGet"; + protected final String TEXT_362 = "();" + NL + "\t\treturn "; + protected final String TEXT_363 = " != null && "; + protected final String TEXT_364 = ".isProxy() ? "; + protected final String TEXT_365 = "eResolveProxy(("; + protected final String TEXT_366 = ")"; + protected final String TEXT_367 = ") : "; + protected final String TEXT_368 = ";"; + protected final String TEXT_369 = NL + "\t\treturn create"; + protected final String TEXT_370 = "(get"; + protected final String TEXT_371 = "(), getType(), _INTERNAL_"; + protected final String TEXT_372 = ");"; + protected final String TEXT_373 = NL + "\t\treturn ("; + protected final String TEXT_374 = ")(("; + protected final String TEXT_375 = ")get"; + protected final String TEXT_376 = "()).list("; + protected final String TEXT_377 = ");"; + protected final String TEXT_378 = NL + "\t\treturn get"; + protected final String TEXT_379 = "(get"; + protected final String TEXT_380 = "(), getType(), _INTERNAL_"; + protected final String TEXT_381 = ");"; + protected final String TEXT_382 = NL + "\t\treturn (("; + protected final String TEXT_383 = ")get"; + protected final String TEXT_384 = "()).list("; + protected final String TEXT_385 = ");"; + protected final String TEXT_386 = NL + "\t\treturn "; + protected final String TEXT_387 = "("; + protected final String TEXT_388 = "("; + protected final String TEXT_389 = ")get(get"; + protected final String TEXT_390 = "(), getType(), _INTERNAL_"; + protected final String TEXT_391 = ")"; + protected final String TEXT_392 = ")."; + protected final String TEXT_393 = "()"; + protected final String TEXT_394 = ";"; + protected final String TEXT_395 = NL + "\t\treturn "; + protected final String TEXT_396 = "("; + protected final String TEXT_397 = "("; + protected final String TEXT_398 = ")get(get"; + protected final String TEXT_399 = "(), getType(), _INTERNAL_"; + protected final String TEXT_400 = ")"; + protected final String TEXT_401 = ")."; + protected final String TEXT_402 = "()"; + protected final String TEXT_403 = ";"; + protected final String TEXT_404 = NL + "\t\t// TODO: implement this method to return the '"; + protected final String TEXT_405 = "' "; + protected final String TEXT_406 = NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_407 = NL + "\t}"; + protected final String TEXT_408 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_409 = " basicGet"; + protected final String TEXT_410 = "()" + NL + "\t{"; + protected final String TEXT_411 = NL + "\t\tif (eContainerFeatureID != "; + protected final String TEXT_412 = ") return null;" + NL + "\t\treturn ("; + protected final String TEXT_413 = ")eInternalContainer();"; + protected final String TEXT_414 = NL + "\t\treturn ("; + protected final String TEXT_415 = ")eVirtualGet("; + protected final String TEXT_416 = ");"; + protected final String TEXT_417 = NL + "\t\treturn "; + protected final String TEXT_418 = ";"; + protected final String TEXT_419 = NL + "\t\treturn ("; + protected final String TEXT_420 = ")get(get"; + protected final String TEXT_421 = "(), getType(), _INTERNAL_"; + protected final String TEXT_422 = ");"; + protected final String TEXT_423 = NL + "\t\treturn ("; + protected final String TEXT_424 = ")get"; + protected final String TEXT_425 = "().get("; + protected final String TEXT_426 = ", false);"; + protected final String TEXT_427 = NL + "\t\t// TODO: implement this method to return the '"; + protected final String TEXT_428 = "' "; + protected final String TEXT_429 = NL + "\t\t// -> do not perform proxy resolution" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_430 = NL + "\t}" + NL; + protected final String TEXT_431 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext basicSet"; + protected final String TEXT_432 = "("; + protected final String TEXT_433 = " new"; + protected final String TEXT_434 = ", ChangeContext changeContext)" + NL + "\t{"; + protected final String TEXT_435 = NL + "\t\tObject old"; + protected final String TEXT_436 = " = eVirtualSet("; + protected final String TEXT_437 = ", new"; + protected final String TEXT_438 = ");"; + protected final String TEXT_439 = NL + "\t\t"; + protected final String TEXT_440 = " old"; + protected final String TEXT_441 = " = "; + protected final String TEXT_442 = ";" + NL + "\t\t"; + protected final String TEXT_443 = " = new"; + protected final String TEXT_444 = ";"; + protected final String TEXT_445 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_446 = " == EVIRTUAL_NO_VALUE;"; + protected final String TEXT_447 = NL + "\t\tboolean old"; + protected final String TEXT_448 = "_set_ = ("; + protected final String TEXT_449 = " & "; + protected final String TEXT_450 = "_ESETFLAG) != 0;" + NL + "\t\t"; + protected final String TEXT_451 = " |= "; + protected final String TEXT_452 = "_ESETFLAG;"; + protected final String TEXT_453 = NL + "\t\tboolean old"; + protected final String TEXT_454 = "_set_ = "; + protected final String TEXT_455 = "_set_;" + NL + "\t\t"; + protected final String TEXT_456 = "_set_ = true;"; + protected final String TEXT_457 = NL + "\t\tif (isNotifying())" + NL + "\t\t{"; + protected final String TEXT_458 = NL + "\t\t\taddNotification(this, ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_459 = ", "; + protected final String TEXT_460 = "isSetChange ? null : old"; + protected final String TEXT_461 = "old"; + protected final String TEXT_462 = ", new"; + protected final String TEXT_463 = ", "; + protected final String TEXT_464 = "isSetChange"; + protected final String TEXT_465 = "!old"; + protected final String TEXT_466 = "_set_"; + protected final String TEXT_467 = ", changeContext);"; + protected final String TEXT_468 = NL + "\t\t\taddNotification(this, ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_469 = ", "; + protected final String TEXT_470 = "old"; + protected final String TEXT_471 = " == EVIRTUAL_NO_VALUE ? null : old"; + protected final String TEXT_472 = "old"; + protected final String TEXT_473 = ", new"; + protected final String TEXT_474 = ", changeContext);"; + protected final String TEXT_475 = NL + "\t\t}"; + protected final String TEXT_476 = NL + "\t\treturn changeContext;"; + protected final String TEXT_477 = NL + "\t\treturn basicAdd(get"; + protected final String TEXT_478 = "(), getType(), _INTERNAL_"; + protected final String TEXT_479 = ", new"; + protected final String TEXT_480 = ", changeContext);"; + protected final String TEXT_481 = NL + "\t\treturn basicAdd(get"; + protected final String TEXT_482 = "(), getType(), _INTERNAL_"; + protected final String TEXT_483 = ", new"; + protected final String TEXT_484 = ", changeContext);"; + protected final String TEXT_485 = NL + "\t\t// TODO: implement this method to set the contained '"; + protected final String TEXT_486 = "' "; + protected final String TEXT_487 = NL + "\t\t// -> this method is automatically invoked to keep the containment relationship in synch" + NL + "\t\t// -> do not modify other features" + NL + "\t\t// -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first)" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_488 = NL + "\t}" + NL; + protected final String TEXT_489 = NL + "\t/**" + NL + "\t * Sets the value of the '{@link "; + protected final String TEXT_490 = "#"; + protected final String TEXT_491 = " "; + protected final String TEXT_492 = "}' "; + protected final String TEXT_493 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @param value the new value of the '"; + protected final String TEXT_494 = "' "; + protected final String TEXT_495 = "."; + protected final String TEXT_496 = NL + "\t * @see "; + protected final String TEXT_497 = NL + "\t * @see #isSet"; + protected final String TEXT_498 = "()"; + protected final String TEXT_499 = NL + "\t * @see #unset"; + protected final String TEXT_500 = "()"; + protected final String TEXT_501 = NL + "\t * @see #"; + protected final String TEXT_502 = "()" + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_503 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_504 = NL + "\tvoid set"; + protected final String TEXT_505 = "("; + protected final String TEXT_506 = " value);" + NL; + protected final String TEXT_507 = NL + "\tpublic void set"; + protected final String TEXT_508 = "("; + protected final String TEXT_509 = " new"; + protected final String TEXT_510 = ")" + NL + "\t{"; + protected final String TEXT_511 = NL + "\t\t_set_("; + protected final String TEXT_512 = ", "; + protected final String TEXT_513 = "new "; + protected final String TEXT_514 = "("; + protected final String TEXT_515 = "new"; + protected final String TEXT_516 = ")"; + protected final String TEXT_517 = ");"; + protected final String TEXT_518 = NL + "\t\tif (new"; + protected final String TEXT_519 = " != eInternalContainer() || (eContainerFeatureID != "; + protected final String TEXT_520 = " && new"; + protected final String TEXT_521 = " != null))" + NL + "\t\t{" + NL + "\t\t\tif ("; + protected final String TEXT_522 = ".isAncestor(this, "; + protected final String TEXT_523 = "new"; + protected final String TEXT_524 = "))" + NL + "\t\t\t\tthrow new "; + protected final String TEXT_525 = "(\"Recursive containment not allowed for \" + toString());"; + protected final String TEXT_526 = NL + "\t\t\tChangeContext changeContext = null;" + NL + "\t\t\tif (eInternalContainer() != null)" + NL + "\t\t\t\tchangeContext = eBasicRemoveFromContainer(changeContext);" + NL + "\t\t\tif (new"; + protected final String TEXT_527 = " != null)" + NL + "\t\t\t\tchangeContext = (("; + protected final String TEXT_528 = ")new"; + protected final String TEXT_529 = ").eInverseAdd(this, "; + protected final String TEXT_530 = ", "; + protected final String TEXT_531 = ".class, changeContext);" + NL + "\t\t\tchangeContext = eBasicSetContainer(("; + protected final String TEXT_532 = ")new"; + protected final String TEXT_533 = ", "; + protected final String TEXT_534 = ", changeContext);" + NL + "\t\t\tif (changeContext != null) dispatch(changeContext);" + NL + "\t\t}"; + protected final String TEXT_535 = NL + "\t\telse if (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_536 = ", new"; + protected final String TEXT_537 = ", new"; + protected final String TEXT_538 = ");"; + protected final String TEXT_539 = NL + "\t\t"; + protected final String TEXT_540 = " "; + protected final String TEXT_541 = " = ("; + protected final String TEXT_542 = ")eVirtualGet("; + protected final String TEXT_543 = ");"; + protected final String TEXT_544 = NL + "\t\tif (new"; + protected final String TEXT_545 = " != "; + protected final String TEXT_546 = ")" + NL + "\t\t{" + NL + "\t\t\tChangeContext changeContext = null;" + NL + "\t\t\tif ("; + protected final String TEXT_547 = " != null)"; + protected final String TEXT_548 = NL + "\t\t\t\tchangeContext = inverseRemove("; + protected final String TEXT_549 = ", this, OPPOSITE_FEATURE_BASE - _INTERNAL_"; + protected final String TEXT_550 = ", null, changeContext);" + NL + "\t\t\tif (new"; + protected final String TEXT_551 = " != null)" + NL + "\t\t\t\tchangeContext = inverseAdd(new"; + protected final String TEXT_552 = ", this, OPPOSITE_FEATURE_BASE - _INTERNAL_"; + protected final String TEXT_553 = ", null, changeContext);"; + protected final String TEXT_554 = NL + "\t\t\t\tchangeContext = inverseRemove("; + protected final String TEXT_555 = ", this, "; + protected final String TEXT_556 = ", "; + protected final String TEXT_557 = ".class, changeContext);" + NL + "\t\t\tif (new"; + protected final String TEXT_558 = " != null)" + NL + "\t\t\t\tchangeContext = inverseAdd(new"; + protected final String TEXT_559 = ", this, "; + protected final String TEXT_560 = ", "; + protected final String TEXT_561 = ".class, changeContext);"; + protected final String TEXT_562 = NL + "\t\t\tchangeContext = basicSet"; + protected final String TEXT_563 = "("; + protected final String TEXT_564 = "new"; + protected final String TEXT_565 = ", changeContext);" + NL + "\t\t\tif (changeContext != null) dispatch(changeContext);" + NL + "\t\t}"; + protected final String TEXT_566 = NL + "\t\telse" + NL + "\t\t{"; + protected final String TEXT_567 = NL + "\t\t\tboolean old"; + protected final String TEXT_568 = "_set_ = eVirtualIsSet("; + protected final String TEXT_569 = ");"; + protected final String TEXT_570 = NL + "\t\t\tboolean old"; + protected final String TEXT_571 = "_set_ = ("; + protected final String TEXT_572 = " & "; + protected final String TEXT_573 = "_ESETFLAG) != 0;"; + protected final String TEXT_574 = NL + "\t\t\t"; + protected final String TEXT_575 = " |= "; + protected final String TEXT_576 = "_ESETFLAG;"; + protected final String TEXT_577 = NL + "\t\t\tboolean old"; + protected final String TEXT_578 = "_set_ = "; + protected final String TEXT_579 = "_set_;"; + protected final String TEXT_580 = NL + "\t\t\t"; + protected final String TEXT_581 = "_set_ = true;"; + protected final String TEXT_582 = NL + "\t\t\tif (isNotifying())" + NL + "\t\t\t\tnotify(ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_583 = ", new"; + protected final String TEXT_584 = ", new"; + protected final String TEXT_585 = ", !old"; + protected final String TEXT_586 = "_set_);"; + protected final String TEXT_587 = NL + "\t\t}"; + protected final String TEXT_588 = NL + "\t\telse if (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_589 = ", new"; + protected final String TEXT_590 = ", new"; + protected final String TEXT_591 = ");"; + protected final String TEXT_592 = NL + "\t\t"; + protected final String TEXT_593 = " old"; + protected final String TEXT_594 = " = ("; + protected final String TEXT_595 = " & "; + protected final String TEXT_596 = "_EFLAG) != 0;"; + protected final String TEXT_597 = NL + "\t\tif (new"; + protected final String TEXT_598 = ") "; + protected final String TEXT_599 = " |= "; + protected final String TEXT_600 = "_EFLAG; else "; + protected final String TEXT_601 = " &= ~"; + protected final String TEXT_602 = "_EFLAG;"; + protected final String TEXT_603 = NL + "\t\t"; + protected final String TEXT_604 = " old"; + protected final String TEXT_605 = " = "; + protected final String TEXT_606 = ";"; + protected final String TEXT_607 = NL + "\t\t"; + protected final String TEXT_608 = " "; + protected final String TEXT_609 = " = new"; + protected final String TEXT_610 = " == null ? "; + protected final String TEXT_611 = "_DEFAULT_ : new"; + protected final String TEXT_612 = ";"; + protected final String TEXT_613 = NL + "\t\t"; + protected final String TEXT_614 = " = new"; + protected final String TEXT_615 = " == null ? "; + protected final String TEXT_616 = "_DEFAULT_ : new"; + protected final String TEXT_617 = ";"; + protected final String TEXT_618 = NL + "\t\t"; + protected final String TEXT_619 = " "; + protected final String TEXT_620 = " = "; + protected final String TEXT_621 = "new"; + protected final String TEXT_622 = ";"; + protected final String TEXT_623 = NL + "\t\t"; + protected final String TEXT_624 = " = "; + protected final String TEXT_625 = "new"; + protected final String TEXT_626 = ";"; + protected final String TEXT_627 = NL + "\t\tObject old"; + protected final String TEXT_628 = " = eVirtualSet("; + protected final String TEXT_629 = ", "; + protected final String TEXT_630 = ");"; + protected final String TEXT_631 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_632 = " == EVIRTUAL_NO_VALUE;"; + protected final String TEXT_633 = NL + "\t\tboolean old"; + protected final String TEXT_634 = "_set_ = ("; + protected final String TEXT_635 = " & "; + protected final String TEXT_636 = "_ESETFLAG) != 0;"; + protected final String TEXT_637 = NL + "\t\t"; + protected final String TEXT_638 = " |= "; + protected final String TEXT_639 = "_ESETFLAG;"; + protected final String TEXT_640 = NL + "\t\tboolean old"; + protected final String TEXT_641 = "_set_ = "; + protected final String TEXT_642 = "_set_;"; + protected final String TEXT_643 = NL + "\t\t"; + protected final String TEXT_644 = "_set_ = true;"; + protected final String TEXT_645 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_646 = ", "; + protected final String TEXT_647 = "isSetChange ? "; + protected final String TEXT_648 = "null"; + protected final String TEXT_649 = "_DEFAULT_"; + protected final String TEXT_650 = " : old"; + protected final String TEXT_651 = "old"; + protected final String TEXT_652 = ", "; + protected final String TEXT_653 = "new"; + protected final String TEXT_654 = ", "; + protected final String TEXT_655 = "isSetChange"; + protected final String TEXT_656 = "!old"; + protected final String TEXT_657 = "_set_"; + protected final String TEXT_658 = ");"; + protected final String TEXT_659 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_660 = ", "; + protected final String TEXT_661 = "old"; + protected final String TEXT_662 = " == EVIRTUAL_NO_VALUE ? "; + protected final String TEXT_663 = "null"; + protected final String TEXT_664 = "_DEFAULT_"; + protected final String TEXT_665 = " : old"; + protected final String TEXT_666 = "old"; + protected final String TEXT_667 = ", "; + protected final String TEXT_668 = "new"; + protected final String TEXT_669 = ");"; + protected final String TEXT_670 = NL + "\t\tset(get"; + protected final String TEXT_671 = "(), getType(), _INTERNAL_"; + protected final String TEXT_672 = ", "; + protected final String TEXT_673 = " new "; + protected final String TEXT_674 = "("; + protected final String TEXT_675 = "new"; + protected final String TEXT_676 = ")"; + protected final String TEXT_677 = ");"; + protected final String TEXT_678 = NL + "\t\t(("; + protected final String TEXT_679 = ".Internal)get"; + protected final String TEXT_680 = "()).set("; + protected final String TEXT_681 = ", "; + protected final String TEXT_682 = "new "; + protected final String TEXT_683 = "("; + protected final String TEXT_684 = "new"; + protected final String TEXT_685 = ")"; + protected final String TEXT_686 = ");"; + protected final String TEXT_687 = NL + "\t\t// TODO: implement this method to set the '"; + protected final String TEXT_688 = "' "; + protected final String TEXT_689 = NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_690 = NL + "\t}" + NL; + protected final String TEXT_691 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext basicUnset"; + protected final String TEXT_692 = "(ChangeContext changeContext)" + NL + "\t{"; + protected final String TEXT_693 = NL + "\t\tObject old"; + protected final String TEXT_694 = " = eVirtualUnset("; + protected final String TEXT_695 = ");"; + protected final String TEXT_696 = NL + "\t\t"; + protected final String TEXT_697 = " old"; + protected final String TEXT_698 = " = "; + protected final String TEXT_699 = ";" + NL + "\t\t"; + protected final String TEXT_700 = " = null;"; + protected final String TEXT_701 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_702 = " != EVIRTUAL_NO_VALUE;"; + protected final String TEXT_703 = NL + "\t\tboolean old"; + protected final String TEXT_704 = "_set_ = ("; + protected final String TEXT_705 = " & "; + protected final String TEXT_706 = "_ESETFLAG) != 0;" + NL + "\t\t"; + protected final String TEXT_707 = " &= ~"; + protected final String TEXT_708 = "_ESETFLAG;"; + protected final String TEXT_709 = NL + "\t\tboolean old"; + protected final String TEXT_710 = "_set_ = "; + protected final String TEXT_711 = "_set_;" + NL + "\t\t"; + protected final String TEXT_712 = "_set_ = false;"; + protected final String TEXT_713 = NL + "\t\tif (isNotifying())" + NL + "\t\t{"; + protected final String TEXT_714 = NL + "\t\t\taddNotification(this, ChangeKind.UNSET, _INTERNAL_"; + protected final String TEXT_715 = ", "; + protected final String TEXT_716 = "isSetChange ? null : old"; + protected final String TEXT_717 = "old"; + protected final String TEXT_718 = ", null, "; + protected final String TEXT_719 = "isSetChange"; + protected final String TEXT_720 = "!old"; + protected final String TEXT_721 = "_set_"; + protected final String TEXT_722 = ", changeContext);"; + protected final String TEXT_723 = NL + "\t\t\taddNotification(this, ChangeKind.UNSET, _INTERNAL_"; + protected final String TEXT_724 = ", "; + protected final String TEXT_725 = "old"; + protected final String TEXT_726 = " == EVIRTUAL_NO_VALUE ? null : old"; + protected final String TEXT_727 = "old"; + protected final String TEXT_728 = ", null, changeContext);"; + protected final String TEXT_729 = NL + "\t\t}"; + protected final String TEXT_730 = NL + "\t\treturn changeContext;"; + protected final String TEXT_731 = NL + "\t\t// TODO: implement this method to unset the contained '"; + protected final String TEXT_732 = "' "; + protected final String TEXT_733 = NL + "\t\t// -> this method is automatically invoked to keep the containment relationship in synch" + NL + "\t\t// -> do not modify other features" + NL + "\t\t// -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first)" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_734 = NL + "\t}" + NL; + protected final String TEXT_735 = NL + "\t/**" + NL + "\t * Unsets the value of the '{@link "; + protected final String TEXT_736 = "#"; + protected final String TEXT_737 = " "; + protected final String TEXT_738 = "}' "; + protected final String TEXT_739 = "." + NL + "\t * " + NL + "\t * "; + protected final String TEXT_740 = NL + "\t * @see #isSet"; + protected final String TEXT_741 = "()"; + protected final String TEXT_742 = NL + "\t * @see #"; + protected final String TEXT_743 = "()"; + protected final String TEXT_744 = NL + "\t * @see #set"; + protected final String TEXT_745 = "("; + protected final String TEXT_746 = ")"; + protected final String TEXT_747 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_748 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_749 = NL + "\tvoid unset"; + protected final String TEXT_750 = "();" + NL; + protected final String TEXT_751 = NL + "\tpublic void unset"; + protected final String TEXT_752 = "()" + NL + "\t{"; + protected final String TEXT_753 = NL + "\t\tunset("; + protected final String TEXT_754 = ");"; + protected final String TEXT_755 = NL + "\t\t(("; + protected final String TEXT_756 = ".Unsettable)get"; + protected final String TEXT_757 = "()).unset();"; + protected final String TEXT_758 = NL + "\t\t"; + protected final String TEXT_759 = " "; + protected final String TEXT_760 = " = ("; + protected final String TEXT_761 = ")eVirtualGet("; + protected final String TEXT_762 = ");"; + protected final String TEXT_763 = NL + "\t\tif ("; + protected final String TEXT_764 = " != null)" + NL + "\t\t{" + NL + "\t\t\tChangeContext changeContext = null;"; + protected final String TEXT_765 = NL + "\t\t\tchangeContext = inverseRemove("; + protected final String TEXT_766 = ", this, EOPPOSITE_FEATURE_BASE - _INTERNAL_"; + protected final String TEXT_767 = ", null, changeContext);"; + protected final String TEXT_768 = NL + "\t\t\tchangeContext = inverseRemove("; + protected final String TEXT_769 = ", this, "; + protected final String TEXT_770 = ", "; + protected final String TEXT_771 = ".class, changeContext);"; + protected final String TEXT_772 = NL + "\t\t\tchangeContext = basicUnset"; + protected final String TEXT_773 = "(changeContext);" + NL + "\t\t\tif (changeContext != null) dispatch(changeContext);" + NL + "\t\t}" + NL + "\t\telse" + NL + " \t{"; + protected final String TEXT_774 = NL + "\t\t\tboolean old"; + protected final String TEXT_775 = "_set_ = eVirtualIsSet("; + protected final String TEXT_776 = ");"; + protected final String TEXT_777 = NL + "\t\t\tboolean old"; + protected final String TEXT_778 = "_set_ = ("; + protected final String TEXT_779 = " & "; + protected final String TEXT_780 = "_ESETFLAG) != 0;"; + protected final String TEXT_781 = NL + "\t\t\t"; + protected final String TEXT_782 = " &= ~"; + protected final String TEXT_783 = "_ESETFLAG;"; + protected final String TEXT_784 = NL + "\t\t\tboolean old"; + protected final String TEXT_785 = "_set_ = "; + protected final String TEXT_786 = "_set_;"; + protected final String TEXT_787 = NL + "\t\t\t"; + protected final String TEXT_788 = "_set_ = false;"; + protected final String TEXT_789 = NL + "\t\t\tif (isNotifying())" + NL + "\t\t\t\tnotify(ChangeKind.UNSET, _INTERNAL_"; + protected final String TEXT_790 = ", null, null, old"; + protected final String TEXT_791 = "_set_);"; + protected final String TEXT_792 = NL + " \t}"; + protected final String TEXT_793 = NL + "\t\t"; + protected final String TEXT_794 = " old"; + protected final String TEXT_795 = " = ("; + protected final String TEXT_796 = " & "; + protected final String TEXT_797 = "_EFLAG) != 0;"; + protected final String TEXT_798 = NL + "\t\tObject old"; + protected final String TEXT_799 = " = eVirtualUnset("; + protected final String TEXT_800 = ");"; + protected final String TEXT_801 = NL + "\t\t"; + protected final String TEXT_802 = " old"; + protected final String TEXT_803 = " = "; + protected final String TEXT_804 = ";"; + protected final String TEXT_805 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_806 = " != EVIRTUAL_NO_VALUE;"; + protected final String TEXT_807 = NL + "\t\tboolean old"; + protected final String TEXT_808 = "_set_ = ("; + protected final String TEXT_809 = " & "; + protected final String TEXT_810 = "_ESETFLAG) != 0;"; + protected final String TEXT_811 = NL + "\t\tboolean old"; + protected final String TEXT_812 = "_set_ = "; + protected final String TEXT_813 = "_set_;"; + protected final String TEXT_814 = NL + "\t\t"; + protected final String TEXT_815 = " = null;"; + protected final String TEXT_816 = NL + "\t\t"; + protected final String TEXT_817 = " &= ~"; + protected final String TEXT_818 = "_ESETFLAG;"; + protected final String TEXT_819 = NL + "\t\t"; + protected final String TEXT_820 = "_set_ = false;"; + protected final String TEXT_821 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.UNSET, _INTERNAL_"; + protected final String TEXT_822 = ", "; + protected final String TEXT_823 = "isSetChange ? old"; + protected final String TEXT_824 = " : null"; + protected final String TEXT_825 = "old"; + protected final String TEXT_826 = ", null, "; + protected final String TEXT_827 = "isSetChange"; + protected final String TEXT_828 = "old"; + protected final String TEXT_829 = "_set_"; + protected final String TEXT_830 = ");"; + protected final String TEXT_831 = NL + "\t\tif ("; + protected final String TEXT_832 = "_DEFAULT_) "; + protected final String TEXT_833 = " |= "; + protected final String TEXT_834 = "_EFLAG; else "; + protected final String TEXT_835 = " &= ~"; + protected final String TEXT_836 = "_EFLAG;"; + protected final String TEXT_837 = NL + "\t\t"; + protected final String TEXT_838 = " = "; + protected final String TEXT_839 = "_DEFAULT_;"; + protected final String TEXT_840 = NL + "\t\t"; + protected final String TEXT_841 = " &= ~"; + protected final String TEXT_842 = "_ESETFLAG;"; + protected final String TEXT_843 = NL + "\t\t"; + protected final String TEXT_844 = "_set_ = false;"; + protected final String TEXT_845 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.UNSET, _INTERNAL_"; + protected final String TEXT_846 = ", "; + protected final String TEXT_847 = "isSetChange ? old"; + protected final String TEXT_848 = " : "; + protected final String TEXT_849 = "_DEFAULT_"; + protected final String TEXT_850 = "old"; + protected final String TEXT_851 = ", "; + protected final String TEXT_852 = "_DEFAULT_, "; + protected final String TEXT_853 = "isSetChange"; + protected final String TEXT_854 = "old"; + protected final String TEXT_855 = "_set_"; + protected final String TEXT_856 = ");"; + protected final String TEXT_857 = NL + " unset(get"; + protected final String TEXT_858 = "(), getType(), _INTERNAL_"; + protected final String TEXT_859 = ");"; + protected final String TEXT_860 = NL + " unset"; + protected final String TEXT_861 = "(get"; + protected final String TEXT_862 = "());"; + protected final String TEXT_863 = NL + "\t\t// TODO: implement this method to unset the '"; + protected final String TEXT_864 = "' "; + protected final String TEXT_865 = NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_866 = NL + "\t}" + NL; + protected final String TEXT_867 = NL + "\t/**" + NL + "\t * Returns whether the value of the '{@link "; + protected final String TEXT_868 = "#"; + protected final String TEXT_869 = " "; + protected final String TEXT_870 = "}' "; + protected final String TEXT_871 = " is set." + NL + "\t * " + NL + "\t * " + NL + "\t * @return whether the value of the '"; + protected final String TEXT_872 = "' "; + protected final String TEXT_873 = " is set."; + protected final String TEXT_874 = NL + "\t * @see #unset"; + protected final String TEXT_875 = "()"; + protected final String TEXT_876 = NL + "\t * @see #"; + protected final String TEXT_877 = "()"; + protected final String TEXT_878 = NL + "\t * @see #set"; + protected final String TEXT_879 = "("; + protected final String TEXT_880 = ")"; + protected final String TEXT_881 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_882 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_883 = NL + "\tboolean isSet"; + protected final String TEXT_884 = "();" + NL; + protected final String TEXT_885 = NL + "\tpublic boolean isSet"; + protected final String TEXT_886 = "()" + NL + "\t{"; + protected final String TEXT_887 = NL + "\t\treturn isSet("; + protected final String TEXT_888 = ");"; + protected final String TEXT_889 = NL + "\t\t"; + protected final String TEXT_890 = " "; + protected final String TEXT_891 = " = ("; + protected final String TEXT_892 = ")eVirtualGet("; + protected final String TEXT_893 = ");"; + protected final String TEXT_894 = NL + "\t\treturn "; + protected final String TEXT_895 = " != null && (("; + protected final String TEXT_896 = ".Unsettable)"; + protected final String TEXT_897 = ").isSet();"; + protected final String TEXT_898 = NL + "\t\treturn eVirtualIsSet("; + protected final String TEXT_899 = ");"; + protected final String TEXT_900 = NL + "\t\treturn ("; + protected final String TEXT_901 = " & "; + protected final String TEXT_902 = "_ESETFLAG) != 0;"; + protected final String TEXT_903 = NL + "\t\treturn "; + protected final String TEXT_904 = "_set_;"; + protected final String TEXT_905 = NL + " return isSet(get"; + protected final String TEXT_906 = "(), getType(), _INTERNAL_"; + protected final String TEXT_907 = ");"; + protected final String TEXT_908 = NL + "\t\treturn !(("; + protected final String TEXT_909 = ".Internal)get"; + protected final String TEXT_910 = "()).isEmpty("; + protected final String TEXT_911 = ");"; + protected final String TEXT_912 = NL + "\t\t// TODO: implement this method to return whether the '"; + protected final String TEXT_913 = "' "; + protected final String TEXT_914 = " is set" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_915 = NL + "\t}" + NL; + protected final String TEXT_916 = NL + "\t/**" + NL + "\t * " + NL + "\t * "; + protected final String TEXT_917 = NL + "\t * " + NL + "\t * "; + protected final String TEXT_918 = NL + "\t * "; + protected final String TEXT_919 = NL + "\t * @model "; + protected final String TEXT_920 = NL + "\t * "; + protected final String TEXT_921 = NL + "\t * @model"; + protected final String TEXT_922 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_923 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_924 = NL + "\t"; + protected final String TEXT_925 = " "; + protected final String TEXT_926 = "("; + protected final String TEXT_927 = ")"; + protected final String TEXT_928 = ";" + NL; + protected final String TEXT_929 = NL + "\tpublic "; + protected final String TEXT_930 = " "; + protected final String TEXT_931 = "("; + protected final String TEXT_932 = ")"; + protected final String TEXT_933 = NL + "\t{"; + protected final String TEXT_934 = NL + "\t\t"; + protected final String TEXT_935 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// -> specify the condition that violates the invariant" + NL + "\t\t// -> verify the details of the diagnostic, including severity and message" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tif (false)" + NL + "\t\t{" + NL + "\t\t\tif ("; + protected final String TEXT_936 = " != null)" + NL + "\t\t\t{" + NL + "\t\t\t\t"; + protected final String TEXT_937 = ".add" + NL + "\t\t\t\t\t(new "; + protected final String TEXT_938 = NL + "\t\t\t\t\t\t("; + protected final String TEXT_939 = ".ERROR," + NL + "\t\t\t\t\t\t "; + protected final String TEXT_940 = ".DIAGNOSTIC_SOURCE," + NL + "\t\t\t\t\t\t "; + protected final String TEXT_941 = "."; + protected final String TEXT_942 = "," + NL + "\t\t\t\t\t\t "; + protected final String TEXT_943 = ".INSTANCE.getString(\"_UI_GenericInvariant_diagnostic\", new Object[] { \""; + protected final String TEXT_944 = "\", "; + protected final String TEXT_945 = ".getObjectLabel(this, "; + protected final String TEXT_946 = ") }),"; + protected final String TEXT_947 = NL + "\t\t\t\t\t\t new Object [] { this }));" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn true;"; + protected final String TEXT_948 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_949 = NL + "\t}" + NL; + protected final String TEXT_950 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext eInverseAdd("; + protected final String TEXT_951 = " otherEnd, int propertyIndex, ChangeContext changeContext)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_952 = NL + "\t\t\tcase "; + protected final String TEXT_953 = ":"; + protected final String TEXT_954 = NL + "\t\t\t\treturn (("; + protected final String TEXT_955 = ")(("; + protected final String TEXT_956 = ".InternalMapView)"; + protected final String TEXT_957 = "()).eMap()).basicAdd(otherEnd, changeContext);"; + protected final String TEXT_958 = NL + "\t\t\t\treturn (("; + protected final String TEXT_959 = ")"; + protected final String TEXT_960 = "()).basicAdd(otherEnd, changeContext);"; + protected final String TEXT_961 = NL + "\t\t\t\tif (eInternalContainer() != null)" + NL + "\t\t\t\t\tchangeContext = eBasicRemoveFromContainer(changeContext);" + NL + "\t\t\t\treturn eBasicSetContainer(otherEnd, "; + protected final String TEXT_962 = ", changeContext);"; + protected final String TEXT_963 = NL + "\t\t\t\t"; + protected final String TEXT_964 = " "; + protected final String TEXT_965 = " = ("; + protected final String TEXT_966 = ")eVirtualGet("; + protected final String TEXT_967 = ");"; + protected final String TEXT_968 = NL + "\t\t\t\tif ("; + protected final String TEXT_969 = " != null)"; + protected final String TEXT_970 = NL + "\t\t\t\t\tchangeContext = (("; + protected final String TEXT_971 = ")"; + protected final String TEXT_972 = ").eInverseRemove(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_973 = ", null, changeContext);"; + protected final String TEXT_974 = NL + "\t\t\t\t\tchangeContext = (("; + protected final String TEXT_975 = ")"; + protected final String TEXT_976 = ").eInverseRemove(this, "; + protected final String TEXT_977 = ", "; + protected final String TEXT_978 = ".class, changeContext);"; + protected final String TEXT_979 = NL + "\t\t\t\treturn basicSet"; + protected final String TEXT_980 = "(("; + protected final String TEXT_981 = ")otherEnd, changeContext);"; + protected final String TEXT_982 = NL + "\t\t}"; + protected final String TEXT_983 = NL + "\t\treturn super.eInverseAdd(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_984 = NL + "\t\treturn eDynamicInverseAdd(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_985 = NL + "\t}" + NL; + protected final String TEXT_986 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext inverseRemove("; + protected final String TEXT_987 = " otherEnd, int propertyIndex, ChangeContext changeContext)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_988 = NL + "\t\t\tcase "; + protected final String TEXT_989 = ":"; + protected final String TEXT_990 = NL + "\t\t\t\treturn (("; + protected final String TEXT_991 = ")(("; + protected final String TEXT_992 = ".InternalMapView)"; + protected final String TEXT_993 = "()).eMap()).basicRemove(otherEnd, changeContext);"; + protected final String TEXT_994 = NL + "\t\t\t\treturn removeFrom"; + protected final String TEXT_995 = "("; + protected final String TEXT_996 = "(), otherEnd, changeContext);"; + protected final String TEXT_997 = NL + "\t\t\t\treturn removeFromList("; + protected final String TEXT_998 = "(), otherEnd, changeContext);"; + protected final String TEXT_999 = NL + "\t\t\t\treturn eBasicSetContainer(null, "; + protected final String TEXT_1000 = ", changeContext);"; + protected final String TEXT_1001 = NL + "\t\t\t\treturn basicUnset"; + protected final String TEXT_1002 = "(changeContext);"; + protected final String TEXT_1003 = NL + "\t\t\t\treturn basicSet"; + protected final String TEXT_1004 = "(null, changeContext);"; + protected final String TEXT_1005 = NL + "\t\t}"; + protected final String TEXT_1006 = NL + "\t\treturn super.inverseRemove(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_1007 = NL + "\t\treturn eDynamicInverseRemove(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_1008 = NL + "\t}" + NL; + protected final String TEXT_1009 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext eBasicRemoveFromContainerFeature(ChangeContext changeContext)" + NL + "\t{" + NL + "\t\tswitch (eContainerFeatureID)" + NL + "\t\t{"; + protected final String TEXT_1010 = NL + "\t\t\tcase "; + protected final String TEXT_1011 = ":" + NL + "\t\t\t\treturn eInternalContainer().eInverseRemove(this, "; + protected final String TEXT_1012 = ", "; + protected final String TEXT_1013 = ".class, changeContext);"; + protected final String TEXT_1014 = NL + "\t\t}"; + protected final String TEXT_1015 = NL + "\t\treturn super.eBasicRemoveFromContainerFeature(changeContext);"; + protected final String TEXT_1016 = NL + "\t\treturn eDynamicBasicRemoveFromContainer(changeContext);"; + protected final String TEXT_1017 = NL + "\t}" + NL; + protected final String TEXT_1018 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object get(int propertyIndex, boolean resolve)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1019 = NL + "\t\t\tcase "; + protected final String TEXT_1020 = ":"; + protected final String TEXT_1021 = NL + "\t\t\t\treturn "; + protected final String TEXT_1022 = "() ? Boolean.TRUE : Boolean.FALSE;"; + protected final String TEXT_1023 = NL + "\t\t\t\treturn new "; + protected final String TEXT_1024 = "("; + protected final String TEXT_1025 = "());"; + protected final String TEXT_1026 = NL + "\t\t\t\tif (resolve) return "; + protected final String TEXT_1027 = "();" + NL + "\t\t\t\treturn basicGet"; + protected final String TEXT_1028 = "();"; + protected final String TEXT_1029 = NL + "\t\t\t\tif (coreType) return (("; + protected final String TEXT_1030 = ".InternalMapView)"; + protected final String TEXT_1031 = "()).eMap();" + NL + "\t\t\t\telse return "; + protected final String TEXT_1032 = "();"; + protected final String TEXT_1033 = NL + "\t\t\t\tif (coreType) return "; + protected final String TEXT_1034 = "();" + NL + "\t\t\t\telse return "; + protected final String TEXT_1035 = "().map();"; + protected final String TEXT_1036 = NL + "\t\t\t\t// XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view" + NL + "\t\t\t\t//if (coreType) " + NL + "\t\t\t\treturn "; + protected final String TEXT_1037 = "();"; + protected final String TEXT_1038 = NL + "\t\t\t\tif (coreType) return "; + protected final String TEXT_1039 = "();" + NL + "\t\t\t\treturn (("; + protected final String TEXT_1040 = ".Internal)"; + protected final String TEXT_1041 = "()).getWrapper();"; + protected final String TEXT_1042 = NL + "\t\t\t\treturn "; + protected final String TEXT_1043 = "();"; + protected final String TEXT_1044 = NL + "\t\t}"; + protected final String TEXT_1045 = NL + "\t\treturn super.get(propertyIndex, resolve);"; + protected final String TEXT_1046 = NL + "\t\treturn eDynamicGet(propertyIndex, resolve, coreType);"; + protected final String TEXT_1047 = NL + "\t}" + NL; + protected final String TEXT_1048 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void set(int propertyIndex, Object newValue)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1049 = NL + "\t\t\tcase "; + protected final String TEXT_1050 = ":"; + protected final String TEXT_1051 = NL + " \tset"; + protected final String TEXT_1052 = "("; + protected final String TEXT_1053 = "(), newValue);"; + protected final String TEXT_1054 = NL + "\t\t\t\t(("; + protected final String TEXT_1055 = ".Internal)"; + protected final String TEXT_1056 = "()).set(newValue);"; + protected final String TEXT_1057 = NL + "\t\t\t\t(("; + protected final String TEXT_1058 = ".Setting)(("; + protected final String TEXT_1059 = ".InternalMapView)"; + protected final String TEXT_1060 = "()).eMap()).set(newValue);"; + protected final String TEXT_1061 = NL + "\t\t\t\t(("; + protected final String TEXT_1062 = ".Setting)"; + protected final String TEXT_1063 = "()).set(newValue);"; + protected final String TEXT_1064 = NL + "\t\t\t\t"; + protected final String TEXT_1065 = "().clear();" + NL + "\t\t\t\t"; + protected final String TEXT_1066 = "().addAll(("; + protected final String TEXT_1067 = ")newValue);"; + protected final String TEXT_1068 = NL + "\t\t\t\tset"; + protected final String TEXT_1069 = "((("; + protected final String TEXT_1070 = ")newValue)."; + protected final String TEXT_1071 = "());"; + protected final String TEXT_1072 = NL + "\t\t\t\tset"; + protected final String TEXT_1073 = "(("; + protected final String TEXT_1074 = ")newValue);"; + protected final String TEXT_1075 = NL + "\t\t\t\treturn;"; + protected final String TEXT_1076 = NL + "\t\t}"; + protected final String TEXT_1077 = NL + "\t\tsuper.set(propertyIndex, newValue);"; + protected final String TEXT_1078 = NL + "\t\teDynamicSet(propertyIndex, newValue);"; + protected final String TEXT_1079 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void unset(int propertyIndex)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1080 = NL + "\t\t\tcase "; + protected final String TEXT_1081 = ":"; + protected final String TEXT_1082 = NL + "\t\t\t\tunset"; + protected final String TEXT_1083 = "("; + protected final String TEXT_1084 = "());"; + protected final String TEXT_1085 = NL + "\t\t\t\t"; + protected final String TEXT_1086 = "().clear();"; + protected final String TEXT_1087 = NL + "\t\t\t\tunset"; + protected final String TEXT_1088 = "();"; + protected final String TEXT_1089 = NL + "\t\t\t\tset"; + protected final String TEXT_1090 = "(("; + protected final String TEXT_1091 = ")null);"; + protected final String TEXT_1092 = NL + "\t\t\t\tset"; + protected final String TEXT_1093 = "("; + protected final String TEXT_1094 = "_DEFAULT_);"; + protected final String TEXT_1095 = NL + "\t\t\t\treturn;"; + protected final String TEXT_1096 = NL + "\t\t}"; + protected final String TEXT_1097 = NL + "\t\tsuper.unset(propertyIndex);"; + protected final String TEXT_1098 = NL + "\t\teDynamicUnset(propertyIndex);"; + protected final String TEXT_1099 = NL + "\t}" + NL; + protected final String TEXT_1100 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isSet(int propertyIndex)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1101 = NL + "\t\t\tcase "; + protected final String TEXT_1102 = ":"; + protected final String TEXT_1103 = NL + "\t\t\t\treturn !is"; + protected final String TEXT_1104 = "Empty("; + protected final String TEXT_1105 = "());"; + protected final String TEXT_1106 = NL + "\t\t\t\treturn "; + protected final String TEXT_1107 = " != null && !is"; + protected final String TEXT_1108 = "Empty("; + protected final String TEXT_1109 = "());"; + protected final String TEXT_1110 = NL + "\t\t\t\treturn "; + protected final String TEXT_1111 = " != null && !"; + protected final String TEXT_1112 = ".isEmpty();"; + protected final String TEXT_1113 = NL + "\t\t\t\t"; + protected final String TEXT_1114 = " "; + protected final String TEXT_1115 = " = ("; + protected final String TEXT_1116 = ")eVirtualGet("; + protected final String TEXT_1117 = ");" + NL + "\t\t\t\treturn "; + protected final String TEXT_1118 = " != null && !"; + protected final String TEXT_1119 = ".isEmpty();"; + protected final String TEXT_1120 = NL + "\t\t\t\treturn !"; + protected final String TEXT_1121 = "().isEmpty();"; + protected final String TEXT_1122 = NL + "\t\t\t\treturn isSet"; + protected final String TEXT_1123 = "();"; + protected final String TEXT_1124 = NL + "\t\t\t\treturn "; + protected final String TEXT_1125 = " != null;"; + protected final String TEXT_1126 = NL + "\t\t\t\treturn eVirtualGet("; + protected final String TEXT_1127 = ") != null;"; + protected final String TEXT_1128 = NL + "\t\t\t\treturn basicGet"; + protected final String TEXT_1129 = "() != null;"; + protected final String TEXT_1130 = NL + "\t\t\t\treturn "; + protected final String TEXT_1131 = " != null;"; + protected final String TEXT_1132 = NL + "\t\t\t\treturn eVirtualGet("; + protected final String TEXT_1133 = ") != null;"; + protected final String TEXT_1134 = NL + "\t\t\t\treturn "; + protected final String TEXT_1135 = "() != null;"; + protected final String TEXT_1136 = NL + "\t\t\t\treturn (("; + protected final String TEXT_1137 = " & "; + protected final String TEXT_1138 = "_EFLAG) != 0) != "; + protected final String TEXT_1139 = "_DEFAULT_;"; + protected final String TEXT_1140 = NL + "\t\t\t\treturn "; + protected final String TEXT_1141 = " != "; + protected final String TEXT_1142 = "_DEFAULT_;"; + protected final String TEXT_1143 = NL + "\t\t\t\treturn eVirtualGet("; + protected final String TEXT_1144 = ", "; + protected final String TEXT_1145 = "_DEFAULT_) != "; + protected final String TEXT_1146 = "_DEFAULT_;"; + protected final String TEXT_1147 = NL + "\t\t\t\treturn "; + protected final String TEXT_1148 = "() != "; + protected final String TEXT_1149 = "_DEFAULT_;"; + protected final String TEXT_1150 = NL + "\t\t\t\treturn "; + protected final String TEXT_1151 = "_DEFAULT_ == null ? "; + protected final String TEXT_1152 = " != null : !"; + protected final String TEXT_1153 = "_DEFAULT_.equals("; + protected final String TEXT_1154 = ");"; + protected final String TEXT_1155 = NL + "\t\t\t\t"; + protected final String TEXT_1156 = " "; + protected final String TEXT_1157 = " = ("; + protected final String TEXT_1158 = ")eVirtualGet("; + protected final String TEXT_1159 = ", "; + protected final String TEXT_1160 = "_DEFAULT_);" + NL + "\t\t\t\treturn "; + protected final String TEXT_1161 = "_DEFAULT_ == null ? "; + protected final String TEXT_1162 = " != null : !"; + protected final String TEXT_1163 = "_DEFAULT_.equals("; + protected final String TEXT_1164 = ");"; + protected final String TEXT_1165 = NL + "\t\t\t\treturn "; + protected final String TEXT_1166 = "_DEFAULT_ == null ? "; + protected final String TEXT_1167 = "() != null : !"; + protected final String TEXT_1168 = "_DEFAULT_.equals("; + protected final String TEXT_1169 = "());"; + protected final String TEXT_1170 = NL + "\t\t}"; + protected final String TEXT_1171 = NL + "\t\treturn super.isSet(propertyIndex);"; + protected final String TEXT_1172 = NL + "\t\treturn eDynamicIsSet(propertyIndex);"; + protected final String TEXT_1173 = NL + "\t}" + NL; + protected final String TEXT_1174 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass)" + NL + "\t{"; + protected final String TEXT_1175 = NL + "\t\tif (baseClass == "; + protected final String TEXT_1176 = ".class)" + NL + "\t\t{" + NL + "\t\t\tswitch (derivedFeatureID)" + NL + "\t\t\t{"; + protected final String TEXT_1177 = NL + "\t\t\t\tcase "; + protected final String TEXT_1178 = ": return "; + protected final String TEXT_1179 = ";"; + protected final String TEXT_1180 = NL + "\t\t\t\tdefault: return -1;" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_1181 = NL + "\t\treturn super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass)" + NL + "\t{"; + protected final String TEXT_1182 = NL + "\t\tif (baseClass == "; + protected final String TEXT_1183 = ".class)" + NL + "\t\t{" + NL + "\t\t\tswitch (baseFeatureID)" + NL + "\t\t\t{"; + protected final String TEXT_1184 = NL + "\t\t\t\tcase "; + protected final String TEXT_1185 = ": return "; + protected final String TEXT_1186 = ";"; + protected final String TEXT_1187 = NL + "\t\t\t\tdefault: return -1;" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_1188 = NL + "\t\treturn super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);" + NL + "\t}" + NL; + protected final String TEXT_1189 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Object[] eVirtualValues()" + NL + "\t{" + NL + "\t\treturn "; + protected final String TEXT_1190 = ";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setVirtualValues(Object[] newValues)" + NL + "\t{" + NL + "\t\t"; + protected final String TEXT_1191 = " = newValues;" + NL + "\t}" + NL; + protected final String TEXT_1192 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected int eVirtualIndexBits(int offset)" + NL + "\t{" + NL + "\t\tswitch (offset)" + NL + "\t\t{"; + protected final String TEXT_1193 = NL + "\t\t\tcase "; + protected final String TEXT_1194 = " :" + NL + "\t\t\t\treturn "; + protected final String TEXT_1195 = ";"; + protected final String TEXT_1196 = NL + "\t\t\tdefault :" + NL + "\t\t\t\tthrow new IndexOutOfBoundsException();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setVirtualIndexBits(int offset, int newIndexBits)" + NL + "\t{" + NL + "\t\tswitch (offset)" + NL + "\t\t{"; + protected final String TEXT_1197 = NL + "\t\t\tcase "; + protected final String TEXT_1198 = " :" + NL + "\t\t\t\t"; + protected final String TEXT_1199 = " = newIndexBits;" + NL + "\t\t\t\tbreak;"; + protected final String TEXT_1200 = NL + "\t\t\tdefault :" + NL + "\t\t\t\tthrow new IndexOutOfBoundsException();" + NL + "\t\t}" + NL + "\t}" + NL; + protected final String TEXT_1201 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String toString()" + NL + "\t{" + NL + "\t\tif (isProxy(this)) return super.toString();" + NL + "" + NL + "\t\tStringBuffer result = new StringBuffer(super.toString());"; + protected final String TEXT_1202 = NL + "\t\tresult.append(\" ("; + protected final String TEXT_1203 = ": \");"; + protected final String TEXT_1204 = NL + "\t\tresult.append(\", "; + protected final String TEXT_1205 = ": \");"; + protected final String TEXT_1206 = NL + "\t\tif (eVirtualIsSet("; + protected final String TEXT_1207 = ")) result.append(eVirtualGet("; + protected final String TEXT_1208 = ")); else result.append(\"\");"; + protected final String TEXT_1209 = NL + "\t\tif ("; + protected final String TEXT_1210 = "("; + protected final String TEXT_1211 = " & "; + protected final String TEXT_1212 = "_ESETFLAG) != 0"; + protected final String TEXT_1213 = "_set_"; + protected final String TEXT_1214 = ") result.append(("; + protected final String TEXT_1215 = " & "; + protected final String TEXT_1216 = "_EFLAG) != 0); else result.append(\"\");"; + protected final String TEXT_1217 = NL + "\t\tif ("; + protected final String TEXT_1218 = "("; + protected final String TEXT_1219 = " & "; + protected final String TEXT_1220 = "_ESETFLAG) != 0"; + protected final String TEXT_1221 = "_set_"; + protected final String TEXT_1222 = ") result.append("; + protected final String TEXT_1223 = "); else result.append(\"\");"; + protected final String TEXT_1224 = NL + "\t\tresult.append(eVirtualGet("; + protected final String TEXT_1225 = ", "; + protected final String TEXT_1226 = "_DEFAULT_"; + protected final String TEXT_1227 = "));"; + protected final String TEXT_1228 = NL + "\t\tresult.append(("; + protected final String TEXT_1229 = " & "; + protected final String TEXT_1230 = "_EFLAG) != 0);"; + protected final String TEXT_1231 = NL + "\t\tresult.append("; + protected final String TEXT_1232 = ");"; + protected final String TEXT_1233 = NL + "\t\tresult.append(')');" + NL + "\t\treturn result.toString();" + NL + "\t}" + NL; + protected final String TEXT_1234 = NL + "\tpublic static class ConcreteBase extends "; + protected final String TEXT_1235 = NL + "\t{" + NL + "\t\tpublic ConcreteBase()" + NL + "\t\t{" + NL + "\t\t\tsuper();" + NL + "\t\t}" + NL + "\t}" + NL + "\t"; + protected final String TEXT_1236 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected int hash = -1;" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + " \t * @generated" + NL + " \t */" + NL + "\tpublic int getHash()" + NL + "\t{" + NL + "\t\tif (hash == -1)" + NL + "\t\t{" + NL + "\t\t\tObject theKey = getKey();" + NL + "\t\t\thash = (theKey == null ? 0 : theKey.hashCode());" + NL + "\t\t}" + NL + "\t\treturn hash;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + " \t * " + NL + " \t * " + NL + " \t * @generated" + NL + " \t */" + NL + "\tpublic void setHash(int hash)" + NL + "\t{" + NL + "\t\tthis.hash = hash;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + " \t * " + NL + " \t * " + NL + " \t * @generated" + NL + " \t */" + NL + "\tpublic Object getKey()" + NL + "\t{" + NL + " \t"; + protected final String TEXT_1237 = NL + "\t\treturn new "; + protected final String TEXT_1238 = "(getTypedKey());" + NL + " \t"; + protected final String TEXT_1239 = NL + "\t\treturn getTypedKey();" + NL + " \t"; + protected final String TEXT_1240 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setKey(Object key)" + NL + "\t{"; + protected final String TEXT_1241 = NL + "\t\tgetTypedKey().addAll(("; + protected final String TEXT_1242 = ")key);"; + protected final String TEXT_1243 = NL + "\t\tsetTypedKey((("; + protected final String TEXT_1244 = ")key)."; + protected final String TEXT_1245 = "());"; + protected final String TEXT_1246 = NL + "\t\tsetTypedKey(("; + protected final String TEXT_1247 = ")key);"; + protected final String TEXT_1248 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getValue()" + NL + "\t{" + NL + " \t"; + protected final String TEXT_1249 = NL + "\t\treturn new "; + protected final String TEXT_1250 = "(getTypedValue());" + NL + " \t"; + protected final String TEXT_1251 = NL + "\t\treturn getTypedValue();" + NL + " \t"; + protected final String TEXT_1252 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object setValue(Object value)" + NL + "\t{" + NL + "\t\tObject oldValue = getValue();" + NL + " \t"; + protected final String TEXT_1253 = NL + "\t\tgetTypedValue().clear();" + NL + "\t\tgetTypedValue().addAll(("; + protected final String TEXT_1254 = ")value);" + NL + " \t"; + protected final String TEXT_1255 = NL + "\t\tsetTypedValue((("; + protected final String TEXT_1256 = ")value)."; + protected final String TEXT_1257 = "());" + NL + " \t"; + protected final String TEXT_1258 = NL + "\t\tsetTypedValue(("; + protected final String TEXT_1259 = ")value);" + NL + " \t"; + protected final String TEXT_1260 = NL + "\t\treturn oldValue;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_1261 = " getEMap()" + NL + "\t{" + NL + "\t\t"; + protected final String TEXT_1262 = " container = eContainer();" + NL + "\t\treturn container == null ? null : ("; + protected final String TEXT_1263 = ")container.get(eContainmentFeature());" + NL + "\t}"; + protected final String TEXT_1264 = NL + "} //"; + protected final String TEXT_1265 = NL; + + public String generate(Object argument) + { + final StringBuffer stringBuffer = new StringBuffer(); + +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + GenClass genClass = (GenClass)((Object[])argument)[0]; GenPackage genPackage = genClass.getGenPackage(); GenModel genModel=genPackage.getGenModel(); + boolean isInterface = Boolean.TRUE.equals(((Object[])argument)[1]); boolean isImplementation = Boolean.TRUE.equals(((Object[])argument)[2]); + boolean isDebug = false; + String publicStaticFinalFlag = isImplementation ? "public static final " : ""; + /* + * Output preamble and javadoc header + */ + stringBuffer.append(TEXT_1); + stringBuffer.append(TEXT_2); + stringBuffer.append("$"); + stringBuffer.append(TEXT_3); + stringBuffer.append("$"); + stringBuffer.append(TEXT_4); + if (isInterface) { + stringBuffer.append(TEXT_5); + stringBuffer.append(genPackage.getInterfacePackageName()); + stringBuffer.append(TEXT_6); + } else { + stringBuffer.append(TEXT_7); + stringBuffer.append(genPackage.getClassPackageName()); + stringBuffer.append(TEXT_8); + } + stringBuffer.append(TEXT_9); + genModel.markImportLocation(stringBuffer, genPackage); + stringBuffer.append(TEXT_10); + if (isDebug) { // EYECATCHER 1 + stringBuffer.append(TEXT_11); + } + if (isInterface) { + stringBuffer.append(TEXT_12); + stringBuffer.append(genClass.getFormattedName()); + stringBuffer.append(TEXT_13); + if (genClass.hasDocumentation()) { + stringBuffer.append(TEXT_14); + stringBuffer.append(genClass.getDocumentation(genModel.getIndentation(stringBuffer))); + stringBuffer.append(TEXT_15); + } + stringBuffer.append(TEXT_16); + if (!genClass.getGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_17); + for (Iterator i=genClass.getGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genFeature.isSuppressedGetVisibility()) { + stringBuffer.append(TEXT_18); + stringBuffer.append(genClass.getQualifiedInterfaceName()); + stringBuffer.append(TEXT_19); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_20); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_21); + } + } + stringBuffer.append(TEXT_22); + } + stringBuffer.append(TEXT_23); + if (!genModel.isSuppressEMFMetaData()) { + stringBuffer.append(TEXT_24); + stringBuffer.append(genPackage.getQualifiedPackageInterfaceName()); + stringBuffer.append(TEXT_25); + stringBuffer.append(genClass.getClassifierAccessorName()); + stringBuffer.append(TEXT_26); + } + if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genClass.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false; + stringBuffer.append(TEXT_27); + stringBuffer.append(modelInfo); + } else { + stringBuffer.append(TEXT_28); + stringBuffer.append(modelInfo); + }} if (first) { + stringBuffer.append(TEXT_29); + }} + if (genClass.needsRootExtendsInterfaceExtendsTag()) { // does it need an @extends tag + stringBuffer.append(TEXT_30); + stringBuffer.append(genModel.getImportedName(genModel.getRootExtendsInterface())); + } + stringBuffer.append(TEXT_31); + } else { + stringBuffer.append(TEXT_32); + stringBuffer.append(genClass.getFormattedName()); + stringBuffer.append(TEXT_33); + if (!genClass.getImplementedGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_34); + for (Iterator i=genClass.getImplementedGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + stringBuffer.append(TEXT_35); + stringBuffer.append(genClass.getQualifiedClassName()); + stringBuffer.append(TEXT_36); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_37); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_38); + } + stringBuffer.append(TEXT_39); + } + stringBuffer.append(TEXT_40); + } + if (isImplementation) { + stringBuffer.append(TEXT_41); + if (genClass.isAbstract()) { + stringBuffer.append(TEXT_42); + } + stringBuffer.append(TEXT_43); + stringBuffer.append(genClass.getClassName()); + stringBuffer.append(genClass.getClassExtends()); + stringBuffer.append(genClass.getClassImplements()); + } else { + stringBuffer.append(TEXT_44); + stringBuffer.append(genClass.getInterfaceName()); + stringBuffer.append(genClass.getInterfaceExtends()); + } + stringBuffer.append(TEXT_45); + if (genModel.getCopyrightText() != null) { + stringBuffer.append(TEXT_46); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genModel.getImportedName("java.lang.String")); + stringBuffer.append(TEXT_47); + stringBuffer.append(genModel.getCopyrightText()); + stringBuffer.append(TEXT_48); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_49); + } + if (isImplementation && genModel.getDriverNumber() != null) { + stringBuffer.append(TEXT_50); + stringBuffer.append(genModel.getImportedName("java.lang.String")); + stringBuffer.append(TEXT_51); + stringBuffer.append(genModel.getDriverNumber()); + stringBuffer.append(TEXT_52); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_53); + } + if (isImplementation && genClass.isJavaIOSerializable()) { + stringBuffer.append(TEXT_54); + } + if (isImplementation && genModel.isVirtualDelegation()) { String eVirtualValuesField = genClass.getEVirtualValuesField(); + if (eVirtualValuesField != null) { + stringBuffer.append(TEXT_55); + stringBuffer.append(eVirtualValuesField); + stringBuffer.append(TEXT_56); + } + { List eVirtualIndexBitFields = genClass.getEVirtualIndexBitFields(new ArrayList()); + if (!eVirtualIndexBitFields.isEmpty()) { + for (Iterator i = eVirtualIndexBitFields.iterator(); i.hasNext();) { String eVirtualIndexBitField = (String)i.next(); + stringBuffer.append(TEXT_57); + stringBuffer.append(eVirtualIndexBitField); + stringBuffer.append(TEXT_58); + } + } + } + } + if (isImplementation && genClass.isModelRoot() && genModel.isBooleanFlagsEnabled() && genModel.getBooleanFlagsReservedBits() == -1) { + stringBuffer.append(TEXT_59); + stringBuffer.append(genModel.getBooleanFlagsField()); + stringBuffer.append(TEXT_60); + } + if (isImplementation && !genModel.isReflectiveDelegation()) { + stringBuffer.append(TEXT_61); + ClassImpl classImpl = (ClassImpl) genClass.getEcoreClass(); + List declaredProperties = classImpl.getDeclaredProperties(); + List extendedProperties = classImpl.getExtendedProperties(); + int declaredPropertiesCount = 0; + int extendedPropertiesCount = 0; + for (Iterator f=genClass.getAllGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); + if (declaredProperties.contains(genFeature.getEcoreFeature())){ + declaredPropertiesCount++; + String featureValue = ""; + List allFeatures = genClass.getAllGenFeatures(); + int g = allFeatures.indexOf(genFeature); + GenClass base = genClass.getBaseGenClass(); + if (base == null) + { + featureValue = Integer.toString(declaredProperties.indexOf(genFeature.getEcoreFeature())); + } else { + int baseCount = base.getFeatureCount(); + if (g < baseCount) + { + featureValue = base.getImportedClassName() + "." + genFeature.getUpperName(); + } else { + String baseCountID = base.getImportedClassName() + "." + "SDO_PROPERTY_COUNT"; + featureValue = baseCountID + " + " + Integer.toString(declaredProperties.indexOf(genFeature.getEcoreFeature())); + } + } + stringBuffer.append(TEXT_62); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_63); + stringBuffer.append(featureValue); + stringBuffer.append(TEXT_64); + } else if (extendedProperties.contains(genFeature.getEcoreFeature())){ + extendedPropertiesCount++; + String featureValue = ""; + List allFeatures = genClass.getAllGenFeatures(); + int g = allFeatures.indexOf(genFeature); + GenClass base = genClass.getBaseGenClass(); + if (base == null) + { + featureValue = Integer.toString(-1 - extendedProperties.indexOf(genFeature.getEcoreFeature())); + } else { + int baseCount = base.getFeatureCount(); + if (g < baseCount) + { + featureValue = base.getImportedClassName() + "." + genFeature.getUpperName(); + } else { + String baseCountID = base.getImportedClassName() + "." + "EXTENDED_PROPERTY_COUNT"; + featureValue = baseCountID + " + " + Integer.toString(-1 - extendedProperties.indexOf(genFeature.getEcoreFeature())); + } + } + stringBuffer.append(TEXT_65); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_66); + stringBuffer.append(featureValue); + stringBuffer.append(TEXT_67); + } + } + String featureCount = ""; + GenClass base = genClass.getBaseGenClass(); + if (base == null) + { + featureCount = Integer.toString(declaredPropertiesCount); + } + else { + String baseCountID = base.getImportedClassName() + "." + "SDO_PROPERTY_COUNT"; + featureCount = baseCountID + " + " + Integer.toString(declaredPropertiesCount); + } + stringBuffer.append(TEXT_68); + stringBuffer.append(featureCount); + stringBuffer.append(TEXT_69); + featureCount = ""; + base = genClass.getBaseGenClass(); + if (base == null) + { + featureCount = Integer.toString(extendedPropertiesCount*-1); + } + else { + String baseCountID = base.getImportedClassName() + "." + "EXTENDED_PROPERTY_COUNT"; + featureCount = baseCountID + " - " + Integer.toString(extendedPropertiesCount); + } + stringBuffer.append(TEXT_70); + stringBuffer.append(featureCount); + stringBuffer.append(TEXT_71); + for (Iterator f=genClass.getAllGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); + stringBuffer.append(TEXT_72); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_73); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_74); + String featureValue = ""; + List allFeatures = genClass.getAllGenFeatures(); + int g = allFeatures.indexOf(genFeature); + base = genClass.getBaseGenClass(); + if (base == null) + { + featureValue = Integer.toString(g); + } else { + int baseCount = base.getFeatureCount(); + if (g < baseCount) + { + featureValue = base.getImportedClassName() + "._INTERNAL_" + genFeature.getUpperName(); + } else { + String baseCountID = base.getImportedClassName() + "." + "INTERNAL_PROPERTY_COUNT"; + featureValue = baseCountID + " + " + Integer.toString(g - baseCount); + } + } + stringBuffer.append(TEXT_75); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_76); + stringBuffer.append(featureValue); + stringBuffer.append(TEXT_77); + } + stringBuffer.append(TEXT_78); + featureCount = ""; + base = genClass.getBaseGenClass(); + if (base == null) + { + featureCount = Integer.toString(genClass.getFeatureCount()); + } + else { + String baseCountID = base.getImportedClassName() + "." + "INTERNAL_PROPERTY_COUNT"; + featureCount = baseCountID + " + " + Integer.toString(genClass.getFeatureCount() - base.getFeatureCount()); + } + stringBuffer.append(TEXT_79); + stringBuffer.append(featureCount); + stringBuffer.append(TEXT_80); + for (Iterator f=genClass.getAllGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); + stringBuffer.append(TEXT_81); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_82); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_83); + } + stringBuffer.append(TEXT_84); + for (Iterator i=genClass.getDeclaredFieldGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (genFeature.isListType() || genFeature.isReferenceType()) { + if (genClass.isField(genFeature)) { + stringBuffer.append(TEXT_85); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_86); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_87); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_88); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_89); + stringBuffer.append(genModel.getImportedName(genFeature.getType())); + stringBuffer.append(TEXT_90); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_91); + } + if (genModel.isArrayAccessors() && !genFeature.isFeatureMapType() && !genFeature.isMapType()) { + stringBuffer.append(TEXT_92); + stringBuffer.append(genFeature.getGetArrayAccessor()); + stringBuffer.append(TEXT_93); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_94); + stringBuffer.append(genFeature.getGetArrayAccessor()); + stringBuffer.append(TEXT_95); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_96); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_97); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_98); + } + } else { + if (!genFeature.isVolatile() || !genModel.isReflectiveDelegation() && (!genFeature.hasDelegateFeature() || !genFeature.isUnsettable())) { + stringBuffer.append(TEXT_99); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_100); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_101); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_102); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_103); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_104); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_105); + stringBuffer.append(SDOGenUtil.getStaticDefaultValue(genFeature)); + stringBuffer.append(TEXT_106); + stringBuffer.append(genModel.getNonNLS(genFeature.getStaticDefaultValue())); + stringBuffer.append(TEXT_107); + } + if (genClass.isField(genFeature)) { + if (genClass.isFlag(genFeature)) { + if (genClass.getFlagIndex(genFeature) > 31 && genClass.getFlagIndex(genFeature) % 32 == 0) { + stringBuffer.append(TEXT_108); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_109); + } + stringBuffer.append(TEXT_110); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_111); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_112); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_113); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_114); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_115); + stringBuffer.append("<< " + genClass.getFlagIndex(genFeature) % 32 ); + stringBuffer.append(TEXT_116); + } else { + stringBuffer.append(TEXT_117); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_118); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_119); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_120); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_121); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_122); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_123); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_124); + } + } + } + if (genClass.isESetField(genFeature)) { + if (genClass.isESetFlag(genFeature)) { + if (genClass.getESetFlagIndex(genFeature) > 31 && genClass.getESetFlagIndex(genFeature) % 32 == 0) { + stringBuffer.append(TEXT_125); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_126); + } + stringBuffer.append(TEXT_127); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_128); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_129); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_130); + stringBuffer.append("<< " + genClass.getESetFlagIndex(genFeature) % 32 ); + stringBuffer.append(TEXT_131); + } else { + stringBuffer.append(TEXT_132); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_133); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_134); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_135); + } + } + } + //Class/declaredFieldGenFeature.override.javajetinc + } + if (isImplementation) { // create constructor + stringBuffer.append(TEXT_136); + stringBuffer.append(genClass.getClassName()); + stringBuffer.append(TEXT_137); + for (Iterator i=genClass.getFlagGenFeatures("true").iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + stringBuffer.append(TEXT_138); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_139); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_140); + } + if (SDOGenUtil.hasChangeSummaryProperty(genClass)) { + stringBuffer.append(TEXT_141); + stringBuffer.append(SDOGenUtil.getChangeSummaryProperty(genClass)); + stringBuffer.append(TEXT_142); + } + stringBuffer.append(TEXT_143); + stringBuffer.append(genModel.getImportedName("commonj.sdo.Type")); + stringBuffer.append(TEXT_144); + stringBuffer.append(genPackage.getImportedFactoryClassName()); + stringBuffer.append(TEXT_145); + stringBuffer.append(genPackage.getImportedFactoryInterfaceName()); + stringBuffer.append(TEXT_146); + stringBuffer.append(genClass.getClassifierAccessorName()); + stringBuffer.append(TEXT_147); + } + /* + * Output getter and setter interfaces / impls + */ + + for (Iterator i=(isImplementation ? genClass.getImplementedGenFeatures() : genClass.getDeclaredGenFeatures()).iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (genModel.isArrayAccessors() && genFeature.isListType() && !genFeature.isFeatureMapType() && !genFeature.isMapType()) { + stringBuffer.append(TEXT_148); + if (!isImplementation) { + stringBuffer.append(TEXT_149); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_150); + stringBuffer.append(genFeature.getGetArrayAccessor()); + stringBuffer.append(TEXT_151); + } else { + stringBuffer.append(TEXT_152); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_153); + stringBuffer.append(genFeature.getGetArrayAccessor()); + stringBuffer.append(TEXT_154); + if (genFeature.isVolatile()) { + stringBuffer.append(TEXT_155); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")); + stringBuffer.append(TEXT_156); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")); + stringBuffer.append(TEXT_157); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_158); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_159); + } else { + stringBuffer.append(TEXT_160); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_161); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_162); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_163); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")); + stringBuffer.append(TEXT_164); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")); + stringBuffer.append(TEXT_165); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_166); + } + stringBuffer.append(TEXT_167); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_168); + } + stringBuffer.append(TEXT_169); + if (!isImplementation) { + stringBuffer.append(TEXT_170); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_171); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_172); + } else { + stringBuffer.append(TEXT_173); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_174); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_175); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_176); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_177); + } + stringBuffer.append(TEXT_178); + if (!isImplementation) { + stringBuffer.append(TEXT_179); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_180); + } else { + stringBuffer.append(TEXT_181); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_182); + if (genFeature.isVolatile()) { + stringBuffer.append(TEXT_183); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_184); + } else { + stringBuffer.append(TEXT_185); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_186); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_187); + } + stringBuffer.append(TEXT_188); + } + stringBuffer.append(TEXT_189); + if (!isImplementation) { + stringBuffer.append(TEXT_190); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_191); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_192); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_193); + } else { + stringBuffer.append(TEXT_194); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_195); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_196); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_197); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")); + stringBuffer.append(TEXT_198); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_199); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_200); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_201); + } + stringBuffer.append(TEXT_202); + if (!isImplementation) { + stringBuffer.append(TEXT_203); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_204); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_205); + } else { + stringBuffer.append(TEXT_206); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_207); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_208); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_209); + } + } + if (genFeature.isGet() && (isImplementation || !genFeature.isSuppressedGetVisibility())) { + if (isInterface) { + stringBuffer.append(TEXT_210); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_211); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_212); + if (genFeature.isListType()) { + if (genFeature.isMapType()) { GenFeature keyFeature = genFeature.getMapEntryTypeGenClass().getMapEntryKeyFeature(); GenFeature valueFeature = genFeature.getMapEntryTypeGenClass().getMapEntryValueFeature(); + stringBuffer.append(TEXT_213); + if (keyFeature.isListType()) { + stringBuffer.append(TEXT_214); + stringBuffer.append(keyFeature.getQualifiedListItemType()); + stringBuffer.append(TEXT_215); + } else { + stringBuffer.append(TEXT_216); + stringBuffer.append(keyFeature.getType()); + stringBuffer.append(TEXT_217); + } + stringBuffer.append(TEXT_218); + if (valueFeature.isListType()) { + stringBuffer.append(TEXT_219); + stringBuffer.append(valueFeature.getQualifiedListItemType()); + stringBuffer.append(TEXT_220); + } else { + stringBuffer.append(TEXT_221); + stringBuffer.append(valueFeature.getType()); + stringBuffer.append(TEXT_222); + } + stringBuffer.append(TEXT_223); + } else if (!genFeature.isWrappedFeatureMapType() && !(genModel.isSuppressEMFMetaData() && "org.eclipse.emf.ecore.EObject".equals(genFeature.getQualifiedListItemType()))) { + stringBuffer.append(TEXT_224); + stringBuffer.append(genFeature.getQualifiedListItemType()); + stringBuffer.append(TEXT_225); + } + } else if (genFeature.isSetDefaultValue()) { + stringBuffer.append(TEXT_226); + stringBuffer.append(genFeature.getDefaultValue()); + stringBuffer.append(TEXT_227); + } + if (genFeature.getTypeGenEnum() != null) { + stringBuffer.append(TEXT_228); + stringBuffer.append(genFeature.getTypeGenEnum().getQualifiedName()); + stringBuffer.append(TEXT_229); + } + if (genFeature.isBidirectional() && !genFeature.getReverse().getGenClass().isMapEntry()) { GenFeature reverseGenFeature = genFeature.getReverse(); + if (!reverseGenFeature.isSuppressedGetVisibility()) { + stringBuffer.append(TEXT_230); + stringBuffer.append(reverseGenFeature.getGenClass().getQualifiedInterfaceName()); + stringBuffer.append(TEXT_231); + stringBuffer.append(reverseGenFeature.getGetAccessor()); + stringBuffer.append(TEXT_232); + stringBuffer.append(reverseGenFeature.getFormattedName()); + stringBuffer.append(TEXT_233); + } + } + stringBuffer.append(TEXT_234); + if (!genFeature.hasDocumentation()) { + stringBuffer.append(TEXT_235); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_236); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_237); + } + stringBuffer.append(TEXT_238); + if (genFeature.hasDocumentation()) { + stringBuffer.append(TEXT_239); + stringBuffer.append(genFeature.getDocumentation(genModel.getIndentation(stringBuffer))); + stringBuffer.append(TEXT_240); + } + stringBuffer.append(TEXT_241); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_242); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_243); + if (genFeature.getTypeGenEnum() != null) { + stringBuffer.append(TEXT_244); + stringBuffer.append(genFeature.getTypeGenEnum().getQualifiedName()); + } + if (genFeature.isUnsettable()) { + if (!genFeature.isSuppressedIsSetVisibility()) { + stringBuffer.append(TEXT_245); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_246); + } + if (genFeature.isChangeable() && !genFeature.isSuppressedUnsetVisibility()) { + stringBuffer.append(TEXT_247); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_248); + } + } + if (genFeature.isChangeable() && !genFeature.isListType() && !genFeature.isSuppressedSetVisibility()) { + stringBuffer.append(TEXT_249); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_250); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_251); + } + if (!genModel.isSuppressEMFMetaData()) { + stringBuffer.append(TEXT_252); + stringBuffer.append(genPackage.getQualifiedPackageInterfaceName()); + stringBuffer.append(TEXT_253); + stringBuffer.append(genFeature.getFeatureAccessorName()); + stringBuffer.append(TEXT_254); + } + if (genFeature.isBidirectional() && !genFeature.getReverse().getGenClass().isMapEntry()) { GenFeature reverseGenFeature = genFeature.getReverse(); + if (!reverseGenFeature.isSuppressedGetVisibility()) { + stringBuffer.append(TEXT_255); + stringBuffer.append(reverseGenFeature.getGenClass().getQualifiedInterfaceName()); + stringBuffer.append(TEXT_256); + stringBuffer.append(reverseGenFeature.getGetAccessor()); + } + } + if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genFeature.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false; + stringBuffer.append(TEXT_257); + stringBuffer.append(modelInfo); + } else { + stringBuffer.append(TEXT_258); + stringBuffer.append(modelInfo); + }} if (first) { + stringBuffer.append(TEXT_259); + }} + stringBuffer.append(TEXT_260); + } else { + stringBuffer.append(TEXT_261); + } + if (!isImplementation) { + stringBuffer.append(TEXT_262); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_263); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_264); + } else { + stringBuffer.append(TEXT_265); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_266); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_267); + if (genModel.isReflectiveDelegation()) { + stringBuffer.append(TEXT_268); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_269); + } + stringBuffer.append(TEXT_270); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_271); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_272); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_273); + stringBuffer.append(genFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_274); + } + stringBuffer.append(TEXT_275); + } else if (!genFeature.isVolatile()) { + if (genFeature.isListType()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_276); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_277); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_278); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_279); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_280); + } + stringBuffer.append(TEXT_281); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_282); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_283); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_284); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_285); + stringBuffer.append(genClass.getListConstructor(genFeature)); + stringBuffer.append(TEXT_286); + } else { + if (genFeature.getType().equals("commonj.sdo.Sequence")){ + stringBuffer.append(TEXT_287); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_288); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_289); + } else { + stringBuffer.append(TEXT_290); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_291); + stringBuffer.append(SDOGenUtil.getListKind(genFeature, genFeature.isUnsettable())); + stringBuffer.append(TEXT_292); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_293); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_294); + stringBuffer.append(genFeature.isBidirectional()?genFeature.getReverse().getUpperName():"0" ); + stringBuffer.append(TEXT_295); + }} + stringBuffer.append(TEXT_296); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes() ? ".map()" : ""); + stringBuffer.append(TEXT_297); + } else if (genFeature.isContainer()) { + stringBuffer.append(TEXT_298); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_299); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_300); + } else { + if (genFeature.isResolveProxies()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_301); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_302); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_303); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_304); + stringBuffer.append(genFeature.getUpperName()); + if (!genFeature.isReferenceType()) { + stringBuffer.append(TEXT_305); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_306); + } + stringBuffer.append(TEXT_307); + } + stringBuffer.append(TEXT_308); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_309); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_310); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_311); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_312); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_313); + stringBuffer.append(genFeature.getNonEObjectInternalTypeCast()); + stringBuffer.append(TEXT_314); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_315); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_316); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_317); + if (genFeature.isEffectiveContains()) { + stringBuffer.append(TEXT_318); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_319); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_320); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_321); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_322); + if (!genFeature.isBidirectional()) { + stringBuffer.append(TEXT_323); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_324); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_325); + } else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_326); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.notify.ChangeContext")); + stringBuffer.append(TEXT_327); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_328); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_329); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_330); + } + stringBuffer.append(TEXT_331); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_332); + if (!genFeature.isBidirectional()) { + stringBuffer.append(TEXT_333); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_334); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_335); + } else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_336); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_337); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_338); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_339); + } + stringBuffer.append(TEXT_340); + } else if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_341); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_342); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_343); + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_344); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_345); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_346); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_347); + } + stringBuffer.append(TEXT_348); + } + if (!genFeature.isResolveProxies() && genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_349); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_350); + stringBuffer.append(genFeature.getUpperName()); + if (!genFeature.isReferenceType()) { + stringBuffer.append(TEXT_351); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_352); + } + stringBuffer.append(TEXT_353); + } else if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_354); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_355); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_356); + } else { + stringBuffer.append(TEXT_357); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_358); + } + } + } else {//volatile + if (genFeature.isResolveProxies() && !genFeature.isListType()) { + stringBuffer.append(TEXT_359); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_360); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_361); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_362); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_363); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_364); + stringBuffer.append(genFeature.getNonEObjectInternalTypeCast()); + stringBuffer.append(TEXT_365); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_366); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_367); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_368); + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); // AAAA + if (genFeature.isFeatureMapType()) { + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_369); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_370); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_371); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_372); + } else { + stringBuffer.append(TEXT_373); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_374); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_375); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_376); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_377); + } + } else if (genFeature.isListType()) { + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_378); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_379); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_380); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_381); + } else { + stringBuffer.append(TEXT_382); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_383); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_384); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_385); + } + } else { + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_386); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_387); + } + stringBuffer.append(TEXT_388); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_389); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_390); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_391); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_392); + stringBuffer.append(genFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_393); + } + stringBuffer.append(TEXT_394); + } else { + stringBuffer.append(TEXT_395); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_396); + } + stringBuffer.append(TEXT_397); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_398); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_399); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_400); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_401); + stringBuffer.append(genFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_402); + } + stringBuffer.append(TEXT_403); + } + } + } else { + stringBuffer.append(TEXT_404); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_405); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_406); + //Class/getGenFeature.todo.override.javajetinc + } + } + stringBuffer.append(TEXT_407); + } + //Class/getGenFeature.override.javajetinc + } + if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicGet()) { + stringBuffer.append(TEXT_408); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_409); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_410); + if (genFeature.isContainer()) { + stringBuffer.append(TEXT_411); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_412); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_413); + } else if (!genFeature.isVolatile()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_414); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_415); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_416); + } else { + stringBuffer.append(TEXT_417); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_418); + } + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //BBBB + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_419); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_420); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_421); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_422); + } else { + stringBuffer.append(TEXT_423); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_424); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_425); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_426); + } + } else { + stringBuffer.append(TEXT_427); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_428); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_429); + //Class/basicGetGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_430); + //Class/basicGetGenFeature.override.javajetinc + } + if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicSet()) { + stringBuffer.append(TEXT_431); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_432); + stringBuffer.append(genFeature.getImportedInternalType()); + stringBuffer.append(TEXT_433); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_434); + if (!genFeature.isVolatile()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_435); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_436); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_437); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_438); + } else { + stringBuffer.append(TEXT_439); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_440); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_441); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_442); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_443); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_444); + } + if (genFeature.isUnsettable()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_445); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_446); + } else if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_447); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_448); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_449); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_450); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_451); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_452); + } else { + stringBuffer.append(TEXT_453); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_454); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_455); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_456); + } + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_457); + if (genFeature.isUnsettable()) { + stringBuffer.append(TEXT_458); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_459); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_460); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(TEXT_461); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_462); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_463); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_464); + } else { + stringBuffer.append(TEXT_465); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_466); + } + stringBuffer.append(TEXT_467); + } else { + stringBuffer.append(TEXT_468); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_469); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_470); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_471); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(TEXT_472); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_473); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_474); + } + stringBuffer.append(TEXT_475); + } + stringBuffer.append(TEXT_476); + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //CCCC + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_477); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_478); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_479); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_480); + } else { + stringBuffer.append(TEXT_481); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_482); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_483); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_484); + } + } else { + stringBuffer.append(TEXT_485); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_486); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_487); + //Class/basicSetGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_488); + //Class/basicSetGenFeature.override.javajetinc + } + if (genFeature.isSet() && (isImplementation || !genFeature.isSuppressedSetVisibility())) { + if (isInterface) { + stringBuffer.append(TEXT_489); + stringBuffer.append(genClass.getQualifiedInterfaceName()); + stringBuffer.append(TEXT_490); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_491); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_492); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_493); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_494); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_495); + if (genFeature.isEnumType()) { + stringBuffer.append(TEXT_496); + stringBuffer.append(genFeature.getTypeGenEnum().getQualifiedName()); + } + if (genFeature.isUnsettable()) { + if (!genFeature.isSuppressedIsSetVisibility()) { + stringBuffer.append(TEXT_497); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_498); + } + if (!genFeature.isSuppressedUnsetVisibility()) { + stringBuffer.append(TEXT_499); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_500); + } + } + stringBuffer.append(TEXT_501); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_502); + } else { + stringBuffer.append(TEXT_503); + } + if (!isImplementation) { + stringBuffer.append(TEXT_504); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_505); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_506); + } else { + stringBuffer.append(TEXT_507); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_508); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_509); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_510); + if (genModel.isReflectiveDelegation()) { + stringBuffer.append(TEXT_511); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_512); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_513); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_514); + } + stringBuffer.append(TEXT_515); + stringBuffer.append(genFeature.getCapName()); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_516); + } + stringBuffer.append(TEXT_517); + } else if (!genFeature.isVolatile()) { + if (genFeature.isContainer()) { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_518); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_519); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_520); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_521); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.EcoreUtil")); + stringBuffer.append(TEXT_522); + stringBuffer.append(genFeature.getEObjectCast()); + stringBuffer.append(TEXT_523); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_524); + stringBuffer.append(genModel.getImportedName("java.lang.IllegalArgumentException")); + stringBuffer.append(TEXT_525); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_526); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_527); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_528); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_529); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_530); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_531); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_532); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_533); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_534); + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_535); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_536); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_537); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_538); + } + } else if (genFeature.isBidirectional() || genFeature.isEffectiveContains()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_539); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_540); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_541); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_542); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_543); + } + stringBuffer.append(TEXT_544); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_545); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_546); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_547); + if (!genFeature.isBidirectional()) { + stringBuffer.append(TEXT_548); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_549); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_550); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_551); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_552); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_553); + } else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_554); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_555); + stringBuffer.append(SDOGenUtil.getQualifiedInternalPropertyID(reverseFeature)); + stringBuffer.append(TEXT_556); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_557); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_558); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_559); + stringBuffer.append(SDOGenUtil.getQualifiedInternalPropertyID(reverseFeature)); + stringBuffer.append(TEXT_560); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_561); + } + stringBuffer.append(TEXT_562); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_563); + stringBuffer.append(genFeature.getInternalTypeCast()); + stringBuffer.append(TEXT_564); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_565); + if (genFeature.isUnsettable()) { + stringBuffer.append(TEXT_566); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_567); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_568); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_569); + } else if (genClass.isESetFlag(genFeature)) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_570); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_571); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_572); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_573); + } + stringBuffer.append(TEXT_574); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_575); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_576); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_577); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_578); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_579); + } + stringBuffer.append(TEXT_580); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_581); + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_582); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_583); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_584); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_585); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_586); + } + stringBuffer.append(TEXT_587); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_588); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_589); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_590); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_591); + } + } + } else { + if (genClass.isFlag(genFeature)) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_592); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_593); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_594); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_595); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_596); + } + stringBuffer.append(TEXT_597); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_598); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_599); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_600); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_601); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_602); + } else { + if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_603); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_604); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_605); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_606); + } + } + if (genFeature.isEnumType()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_607); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_608); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_609); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_610); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_611); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_612); + } else { + stringBuffer.append(TEXT_613); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_614); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_615); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_616); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_617); + } + } else { + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_618); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_619); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_620); + stringBuffer.append(genFeature.getInternalTypeCast()); + stringBuffer.append(TEXT_621); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_622); + } else { + stringBuffer.append(TEXT_623); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_624); + stringBuffer.append(genFeature.getInternalTypeCast()); + stringBuffer.append(TEXT_625); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_626); + } + } + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_627); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_628); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_629); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_630); + } + } + if (genFeature.isUnsettable()) { + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_631); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_632); + } else if (genClass.isESetFlag(genFeature)) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_633); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_634); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_635); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_636); + } + stringBuffer.append(TEXT_637); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_638); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_639); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_640); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_641); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_642); + } + stringBuffer.append(TEXT_643); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_644); + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_645); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_646); + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_647); + if (genFeature.isReferenceType()) { + stringBuffer.append(TEXT_648); + } else { + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_649); + } + stringBuffer.append(TEXT_650); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(TEXT_651); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_652); + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_653); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(genFeature.getSafeName()); + } + stringBuffer.append(TEXT_654); + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_655); + } else { + stringBuffer.append(TEXT_656); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_657); + } + stringBuffer.append(TEXT_658); + } + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_659); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_660); + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_661); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_662); + if (genFeature.isReferenceType()) { + stringBuffer.append(TEXT_663); + } else { + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_664); + } + stringBuffer.append(TEXT_665); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(TEXT_666); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_667); + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_668); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(genFeature.getSafeName()); + } + stringBuffer.append(TEXT_669); + } + } + } + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); // DDDD + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_670); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_671); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_672); + if (genFeature.isPrimitiveType()){ + stringBuffer.append(TEXT_673); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_674); + } + stringBuffer.append(TEXT_675); + stringBuffer.append(genFeature.getCapName()); + if (genFeature.isPrimitiveType()){ + stringBuffer.append(TEXT_676); + } + stringBuffer.append(TEXT_677); + } else { + stringBuffer.append(TEXT_678); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_679); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_680); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_681); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_682); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_683); + } + stringBuffer.append(TEXT_684); + stringBuffer.append(genFeature.getCapName()); + if (genFeature.isPrimitiveType()){ + stringBuffer.append(TEXT_685); + } + stringBuffer.append(TEXT_686); + } + } else { + stringBuffer.append(TEXT_687); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_688); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_689); + //Class/setGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_690); + } + //Class/setGenFeature.override.javajetinc + } + if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicUnset()) { + stringBuffer.append(TEXT_691); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_692); + if (!genFeature.isVolatile()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_693); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_694); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_695); + } else { + stringBuffer.append(TEXT_696); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_697); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_698); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_699); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_700); + } + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_701); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_702); + } else if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_703); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_704); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_705); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_706); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_707); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_708); + } else { + stringBuffer.append(TEXT_709); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_710); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_711); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_712); + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_713); + if (genFeature.isUnsettable()) { + stringBuffer.append(TEXT_714); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_715); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_716); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(TEXT_717); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_718); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_719); + } else { + stringBuffer.append(TEXT_720); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_721); + } + stringBuffer.append(TEXT_722); + } else { + stringBuffer.append(TEXT_723); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_724); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_725); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_726); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(TEXT_727); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_728); + } + stringBuffer.append(TEXT_729); + } + stringBuffer.append(TEXT_730); + } else { + stringBuffer.append(TEXT_731); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_732); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_733); + //Class/basicUnsetGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_734); + //Class.basicUnsetGenFeature.override.javajetinc + } + if (genFeature.isUnset() && (isImplementation || !genFeature.isSuppressedUnsetVisibility())) { + if (isInterface) { + stringBuffer.append(TEXT_735); + stringBuffer.append(genClass.getQualifiedInterfaceName()); + stringBuffer.append(TEXT_736); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_737); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_738); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_739); + if (!genFeature.isSuppressedIsSetVisibility()) { + stringBuffer.append(TEXT_740); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_741); + } + stringBuffer.append(TEXT_742); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_743); + if (!genFeature.isListType() && !genFeature.isSuppressedSetVisibility()) { + stringBuffer.append(TEXT_744); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_745); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_746); + } + stringBuffer.append(TEXT_747); + } else { + stringBuffer.append(TEXT_748); + } + if (!isImplementation) { + stringBuffer.append(TEXT_749); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_750); + } else { + stringBuffer.append(TEXT_751); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_752); + if (genModel.isReflectiveDelegation()) { + stringBuffer.append(TEXT_753); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_754); + } else if (!genFeature.isVolatile()) { + if (genFeature.isListType()) { + stringBuffer.append(TEXT_755); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")); + stringBuffer.append(TEXT_756); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_757); + } else if (genFeature.isBidirectional() || genFeature.isEffectiveContains()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_758); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_759); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_760); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_761); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_762); + } + stringBuffer.append(TEXT_763); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_764); + if (!genFeature.isBidirectional()) { + stringBuffer.append(TEXT_765); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_766); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_767); + } else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_768); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_769); + stringBuffer.append(SDOGenUtil.getQualifiedInternalPropertyID(reverseFeature)); + stringBuffer.append(TEXT_770); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_771); + } + stringBuffer.append(TEXT_772); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_773); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_774); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_775); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_776); + } else if (genClass.isESetFlag(genFeature)) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_777); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_778); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_779); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_780); + } + stringBuffer.append(TEXT_781); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_782); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_783); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_784); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_785); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_786); + } + stringBuffer.append(TEXT_787); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_788); + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_789); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_790); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_791); + } + stringBuffer.append(TEXT_792); + } else { + if (genClass.isFlag(genFeature)) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_793); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_794); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_795); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_796); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_797); + } + } else if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_798); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_799); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_800); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_801); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_802); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_803); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_804); + } + } + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_805); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_806); + } else if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_807); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_808); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_809); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_810); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_811); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_812); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_813); + } + } + if (genFeature.isReferenceType()) { + stringBuffer.append(TEXT_814); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_815); + if (!genModel.isVirtualDelegation()) { + if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_816); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_817); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_818); + } else { + stringBuffer.append(TEXT_819); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_820); + } + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_821); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_822); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_823); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_824); + } else { + stringBuffer.append(TEXT_825); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_826); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_827); + } else { + stringBuffer.append(TEXT_828); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_829); + } + stringBuffer.append(TEXT_830); + } + } else { + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_831); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_832); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_833); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_834); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_835); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_836); + } else if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_837); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_838); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_839); + } + if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) { + if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_840); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_841); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_842); + } else { + stringBuffer.append(TEXT_843); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_844); + } + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_845); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_846); + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_847); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_848); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_849); + } else { + stringBuffer.append(TEXT_850); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_851); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_852); + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_853); + } else { + stringBuffer.append(TEXT_854); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_855); + } + stringBuffer.append(TEXT_856); + } + } + } + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //EEEE + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_857); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_858); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_859); + } else { + stringBuffer.append(TEXT_860); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_861); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_862); + } + } else { + stringBuffer.append(TEXT_863); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_864); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_865); + //Class/unsetGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_866); + } + //Class/unsetGenFeature.override.javajetinc + } + if (genFeature.isIsSet() && (isImplementation || !genFeature.isSuppressedIsSetVisibility())) { + if (isInterface) { + stringBuffer.append(TEXT_867); + stringBuffer.append(genClass.getQualifiedInterfaceName()); + stringBuffer.append(TEXT_868); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_869); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_870); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_871); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_872); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_873); + if (genFeature.isChangeable() && !genFeature.isSuppressedUnsetVisibility()) { + stringBuffer.append(TEXT_874); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_875); + } + stringBuffer.append(TEXT_876); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_877); + if (!genFeature.isListType() && genFeature.isChangeable() && !genFeature.isSuppressedSetVisibility()) { + stringBuffer.append(TEXT_878); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_879); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_880); + } + stringBuffer.append(TEXT_881); + } else { + stringBuffer.append(TEXT_882); + } + if (!isImplementation) { + stringBuffer.append(TEXT_883); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_884); + } else { + stringBuffer.append(TEXT_885); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_886); + if (genModel.isReflectiveDelegation()) { + stringBuffer.append(TEXT_887); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_888); + } else if (!genFeature.isVolatile()) { + if (genFeature.isListType()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_889); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_890); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_891); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_892); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_893); + } + stringBuffer.append(TEXT_894); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_895); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")); + stringBuffer.append(TEXT_896); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_897); + } else { + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_898); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_899); + } else if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_900); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_901); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_902); + } else { + stringBuffer.append(TEXT_903); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_904); + } + } + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //FFFF + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_905); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_906); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_907); + } else { + stringBuffer.append(TEXT_908); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_909); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_910); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_911); + } + } else { + stringBuffer.append(TEXT_912); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_913); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_914); + //Class/isSetGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_915); + } + //Class/isSetGenFeature.override.javajetinc + } + //Class/genFeature.override.javajetinc + }// end output getter and setter interfaces or impls + for (Iterator i= (isImplementation ? genClass.getImplementedGenOperations() : genClass.getDeclaredGenOperations()).iterator(); i.hasNext();) { GenOperation genOperation = (GenOperation)i.next(); + if (isInterface) { + stringBuffer.append(TEXT_916); + if (genOperation.hasDocumentation()) { + stringBuffer.append(TEXT_917); + stringBuffer.append(genOperation.getDocumentation(genModel.getIndentation(stringBuffer))); + stringBuffer.append(TEXT_918); + } + if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genOperation.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false; + stringBuffer.append(TEXT_919); + stringBuffer.append(modelInfo); + } else { + stringBuffer.append(TEXT_920); + stringBuffer.append(modelInfo); + }} if (first) { + stringBuffer.append(TEXT_921); + }} + stringBuffer.append(TEXT_922); + } else { + stringBuffer.append(TEXT_923); + } + if (!isImplementation) { + stringBuffer.append(TEXT_924); + stringBuffer.append(genOperation.getImportedType()); + stringBuffer.append(TEXT_925); + stringBuffer.append(genOperation.getName()); + stringBuffer.append(TEXT_926); + stringBuffer.append(genOperation.getParameters()); + stringBuffer.append(TEXT_927); + stringBuffer.append(genOperation.getThrows()); + stringBuffer.append(TEXT_928); + } else { + stringBuffer.append(TEXT_929); + stringBuffer.append(genOperation.getImportedType()); + stringBuffer.append(TEXT_930); + stringBuffer.append(genOperation.getName()); + stringBuffer.append(TEXT_931); + stringBuffer.append(genOperation.getParameters()); + stringBuffer.append(TEXT_932); + stringBuffer.append(genOperation.getThrows()); + stringBuffer.append(TEXT_933); + if (genOperation.hasBody()) { + stringBuffer.append(TEXT_934); + stringBuffer.append(genOperation.getBody(genModel.getIndentation(stringBuffer))); + } else if (genOperation.isInvariant()) {GenClass opClass = genOperation.getGenClass(); String diagnostics = ((GenParameter)genOperation.getGenParameters().get(0)).getName(); String context = ((GenParameter)genOperation.getGenParameters().get(1)).getName(); + stringBuffer.append(TEXT_935); + stringBuffer.append(diagnostics); + stringBuffer.append(TEXT_936); + stringBuffer.append(diagnostics); + stringBuffer.append(TEXT_937); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic")); + stringBuffer.append(TEXT_938); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")); + stringBuffer.append(TEXT_939); + stringBuffer.append(opClass.getGenPackage().getImportedValidatorClassName()); + stringBuffer.append(TEXT_940); + stringBuffer.append(opClass.getGenPackage().getImportedValidatorClassName()); + stringBuffer.append(TEXT_941); + stringBuffer.append(opClass.getOperationID(genOperation)); + stringBuffer.append(TEXT_942); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin")); + stringBuffer.append(TEXT_943); + stringBuffer.append(genOperation.getName()); + stringBuffer.append(TEXT_944); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.EObjectValidator")); + stringBuffer.append(TEXT_945); + stringBuffer.append(context); + stringBuffer.append(TEXT_946); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(genModel.getNonNLS(2)); + stringBuffer.append(TEXT_947); + } else { + stringBuffer.append(TEXT_948); + //Class/implementedGenOperation.todo.override.javajetinc + } + stringBuffer.append(TEXT_949); + } + //Class/implementedGenOperation.override.javajetinc + }//for + if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEInverseAddGenFeatures())) { + stringBuffer.append(TEXT_950); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_951); + for (Iterator i=genClass.getEInverseAddGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_952); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_953); + if (genFeature.isListType()) { + if (genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes()) { + stringBuffer.append(TEXT_954); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")); + stringBuffer.append(TEXT_955); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_956); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_957); + } else { + stringBuffer.append(TEXT_958); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")); + stringBuffer.append(TEXT_959); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_960); + } + } else if (genFeature.isContainer()) { + stringBuffer.append(TEXT_961); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_962); + } else { + if (genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_963); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_964); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_965); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_966); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_967); + } + stringBuffer.append(TEXT_968); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_969); + if (genFeature.isEffectiveContains()) { + stringBuffer.append(TEXT_970); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_971); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_972); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_973); + } else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_974); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_975); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_976); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_977); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_978); + } + stringBuffer.append(TEXT_979); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_980); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_981); + } + } + } + stringBuffer.append(TEXT_982); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_983); + } else { + stringBuffer.append(TEXT_984); + } + stringBuffer.append(TEXT_985); + } + if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEInverseRemoveGenFeatures())) { + stringBuffer.append(TEXT_986); + stringBuffer.append(genModel.getImportedName("java.lang.Object")); + stringBuffer.append(TEXT_987); + for (Iterator i=genClass.getEInverseRemoveGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_988); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_989); + if (genFeature.isListType()) { + if (genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes()) { + stringBuffer.append(TEXT_990); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")); + stringBuffer.append(TEXT_991); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_992); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_993); + } else if (genFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_994); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_995); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_996); + } else { + stringBuffer.append(TEXT_997); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_998); + } + } else if (genFeature.isContainer()) { + stringBuffer.append(TEXT_999); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1000); + } else if (genFeature.isUnsettable()) { + stringBuffer.append(TEXT_1001); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1002); + } else { + stringBuffer.append(TEXT_1003); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1004); + } + } + } + stringBuffer.append(TEXT_1005); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_1006); + } else { + stringBuffer.append(TEXT_1007); + } + stringBuffer.append(TEXT_1008); + } + if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEBasicRemoveFromContainerGenFeatures())) { + stringBuffer.append(TEXT_1009); + for (Iterator i=genClass.getEBasicRemoveFromContainerGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_1010); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1011); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_1012); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_1013); + } + } + stringBuffer.append(TEXT_1014); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_1015); + } else { + stringBuffer.append(TEXT_1016); + } + stringBuffer.append(TEXT_1017); + } + if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getImplementedGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_1018); + for (Iterator i=genClass.getAllGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_1019); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1020); + if (genFeature.isPrimitiveType()) { + if (genFeature.isBooleanType()) { + stringBuffer.append(TEXT_1021); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1022); + } else { + stringBuffer.append(TEXT_1023); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_1024); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1025); + } + } else if (genFeature.isResolveProxies() && !genFeature.isListType()) { + stringBuffer.append(TEXT_1026); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1027); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1028); + } else if (genFeature.isMapType()) { + if (genFeature.isEffectiveSuppressEMFTypes()) { + stringBuffer.append(TEXT_1029); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_1030); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1031); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1032); + } else { + stringBuffer.append(TEXT_1033); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1034); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1035); + } + } else if (genFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_1036); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1037); + } else if (genFeature.isFeatureMapType()) { + stringBuffer.append(TEXT_1038); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1039); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_1040); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1041); + } else { + stringBuffer.append(TEXT_1042); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1043); + } + } + } + stringBuffer.append(TEXT_1044); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_1045); + } else { + stringBuffer.append(TEXT_1046); + } + stringBuffer.append(TEXT_1047); + } + if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getESetGenFeatures())) { + stringBuffer.append(TEXT_1048); + for (Iterator i=genClass.getESetGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_1049); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1050); + if (genFeature.isListType()) { + if (genFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_1051); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1052); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1053); + } else if (genFeature.isFeatureMapType()) { + stringBuffer.append(TEXT_1054); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_1055); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1056); + } else if (genFeature.isMapType()) { + if (genFeature.isEffectiveSuppressEMFTypes()) { + stringBuffer.append(TEXT_1057); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); + stringBuffer.append(TEXT_1058); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_1059); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1060); + } else { + stringBuffer.append(TEXT_1061); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); + stringBuffer.append(TEXT_1062); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1063); + } + } else { + stringBuffer.append(TEXT_1064); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1065); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1066); + stringBuffer.append(genModel.getImportedName("java.util.Collection")); + stringBuffer.append(TEXT_1067); + } + } else if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1068); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1069); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_1070); + stringBuffer.append(genFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_1071); + } else { + stringBuffer.append(TEXT_1072); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1073); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1074); + } + stringBuffer.append(TEXT_1075); + } + } + stringBuffer.append(TEXT_1076); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_1077); + } else { + stringBuffer.append(TEXT_1078); + } + stringBuffer.append(TEXT_1079); + for (Iterator i=genClass.getESetGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_1080); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1081); + if (genFeature.isListType() && !genFeature.isUnsettable()) { + if (genFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_1082); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1083); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1084); + } else { + stringBuffer.append(TEXT_1085); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1086); + } + } else if (genFeature.isUnsettable()) { + stringBuffer.append(TEXT_1087); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1088); + } else if (genFeature.isReferenceType()) { + stringBuffer.append(TEXT_1089); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1090); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1091); + } else { + stringBuffer.append(TEXT_1092); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1093); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1094); + } + stringBuffer.append(TEXT_1095); + } + } + stringBuffer.append(TEXT_1096); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_1097); + } else { + stringBuffer.append(TEXT_1098); + } + stringBuffer.append(TEXT_1099); + } + if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getImplementedGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_1100); + for (Iterator i=genClass.getAllGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_1101); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1102); + if (genFeature.isListType() && !genFeature.isUnsettable()) { + if (genFeature.isWrappedFeatureMapType()) { + if (genFeature.isVolatile()) { + stringBuffer.append(TEXT_1103); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1104); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1105); + } else { + stringBuffer.append(TEXT_1106); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1107); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1108); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1109); + } + } else { + if (genClass.isField(genFeature)) { + stringBuffer.append(TEXT_1110); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1111); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1112); + } else { + if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_1113); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1114); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1115); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1116); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1117); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1118); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1119); + } else { + stringBuffer.append(TEXT_1120); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1121); + } + } + } + } else if (genFeature.isUnsettable()) { + stringBuffer.append(TEXT_1122); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1123); + } else if (genFeature.isResolveProxies()) { + if (genClass.isField(genFeature)) { + stringBuffer.append(TEXT_1124); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1125); + } else { + if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_1126); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1127); + } else { + stringBuffer.append(TEXT_1128); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1129); + } + } + } else if (genFeature.isReferenceType()) { + if (genClass.isField(genFeature)) { + stringBuffer.append(TEXT_1130); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1131); + } else { + if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_1132); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1133); + } else { + stringBuffer.append(TEXT_1134); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1135); + } + } + } else if (genFeature.isPrimitiveType() || genFeature.isEnumType()) { + if (genClass.isField(genFeature)) { + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_1136); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_1137); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1138); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1139); + } else { + stringBuffer.append(TEXT_1140); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1141); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1142); + } + } else { + if (genFeature.isEnumType() && genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_1143); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1144); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1145); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1146); + } else { + stringBuffer.append(TEXT_1147); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1148); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1149); + } + } + } else {//datatype + if (genClass.isField(genFeature)) { + stringBuffer.append(TEXT_1150); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1151); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1152); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1153); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1154); + } else { + if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_1155); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1156); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1157); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1158); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1159); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1160); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1161); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1162); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1163); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1164); + } else { + stringBuffer.append(TEXT_1165); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1166); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1167); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1168); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1169); + } + } + } + } + } + stringBuffer.append(TEXT_1170); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_1171); + } else { + stringBuffer.append(TEXT_1172); + } + stringBuffer.append(TEXT_1173); + //Class/eIsSet.override.javajetinc + } + if (isImplementation && !genClass.getMixinGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_1174); + for (Iterator m=genClass.getMixinGenClasses().iterator(); m.hasNext();) { GenClass mixinGenClass = (GenClass)m.next(); + stringBuffer.append(TEXT_1175); + stringBuffer.append(mixinGenClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_1176); + for (Iterator f=mixinGenClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); + stringBuffer.append(TEXT_1177); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1178); + stringBuffer.append(mixinGenClass.getQualifiedFeatureID(genFeature)); + stringBuffer.append(TEXT_1179); + } + stringBuffer.append(TEXT_1180); + } + stringBuffer.append(TEXT_1181); + for (Iterator m=genClass.getMixinGenClasses().iterator(); m.hasNext();) { GenClass mixinGenClass = (GenClass)m.next(); + stringBuffer.append(TEXT_1182); + stringBuffer.append(mixinGenClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_1183); + for (Iterator f=mixinGenClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); + stringBuffer.append(TEXT_1184); + stringBuffer.append(mixinGenClass.getQualifiedFeatureID(genFeature)); + stringBuffer.append(TEXT_1185); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1186); + } + stringBuffer.append(TEXT_1187); + } + stringBuffer.append(TEXT_1188); + } + if (isImplementation && genModel.isVirtualDelegation()) { String eVirtualValuesField = genClass.getEVirtualValuesField(); + if (eVirtualValuesField != null) { + stringBuffer.append(TEXT_1189); + stringBuffer.append(eVirtualValuesField); + stringBuffer.append(TEXT_1190); + stringBuffer.append(eVirtualValuesField); + stringBuffer.append(TEXT_1191); + } + { List eVirtualIndexBitFields = genClass.getEVirtualIndexBitFields(new ArrayList()); + if (!eVirtualIndexBitFields.isEmpty()) { List allEVirtualIndexBitFields = genClass.getAllEVirtualIndexBitFields(new ArrayList()); + stringBuffer.append(TEXT_1192); + for (int i = 0; i < allEVirtualIndexBitFields.size(); i++) { + stringBuffer.append(TEXT_1193); + stringBuffer.append(i); + stringBuffer.append(TEXT_1194); + stringBuffer.append(allEVirtualIndexBitFields.get(i)); + stringBuffer.append(TEXT_1195); + } + stringBuffer.append(TEXT_1196); + for (int i = 0; i < allEVirtualIndexBitFields.size(); i++) { + stringBuffer.append(TEXT_1197); + stringBuffer.append(i); + stringBuffer.append(TEXT_1198); + stringBuffer.append(allEVirtualIndexBitFields.get(i)); + stringBuffer.append(TEXT_1199); + } + stringBuffer.append(TEXT_1200); + } + } + } + if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getToStringGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_1201); + { boolean first = true; + for (Iterator i=genClass.getToStringGenFeatures().iterator(); i.hasNext(); ) { GenFeature genFeature = (GenFeature)i.next(); + if (first) { first = false; + stringBuffer.append(TEXT_1202); + stringBuffer.append(genFeature.getName()); + stringBuffer.append(TEXT_1203); + stringBuffer.append(genModel.getNonNLS()); + } else { + stringBuffer.append(TEXT_1204); + stringBuffer.append(genFeature.getName()); + stringBuffer.append(TEXT_1205); + stringBuffer.append(genModel.getNonNLS()); + } + if (genFeature.isUnsettable() && !genFeature.isListType()) { + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1206); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1207); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1208); + stringBuffer.append(genModel.getNonNLS()); + } else { + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_1209); + if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_1210); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_1211); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1212); + } else { + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_1213); + } + stringBuffer.append(TEXT_1214); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_1215); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1216); + stringBuffer.append(genModel.getNonNLS()); + } else { + stringBuffer.append(TEXT_1217); + if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_1218); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_1219); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1220); + } else { + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_1221); + } + stringBuffer.append(TEXT_1222); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1223); + stringBuffer.append(genModel.getNonNLS()); + } + } + } else { + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1224); + stringBuffer.append(genFeature.getUpperName()); + if (!genFeature.isListType() && !genFeature.isReferenceType()){ + stringBuffer.append(TEXT_1225); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1226); + } + stringBuffer.append(TEXT_1227); + } else { + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_1228); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_1229); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1230); + } else { + stringBuffer.append(TEXT_1231); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1232); + } + } + } + } + } + stringBuffer.append(TEXT_1233); + } + if (isImplementation && !genModel.isReflectiveDelegation() && genClass.isAbstract()) { + stringBuffer.append(TEXT_1234); + stringBuffer.append(genClass.getClassName()); + stringBuffer.append(TEXT_1235); + } + if (isImplementation && genClass.isMapEntry()) { GenFeature keyFeature = genClass.getMapEntryKeyFeature(); GenFeature valueFeature = genClass.getMapEntryValueFeature(); + stringBuffer.append(TEXT_1236); + if (keyFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1237); + stringBuffer.append(keyFeature.getObjectType()); + stringBuffer.append(TEXT_1238); + } else { + stringBuffer.append(TEXT_1239); + } + stringBuffer.append(TEXT_1240); + if (keyFeature.isListType()) { + stringBuffer.append(TEXT_1241); + stringBuffer.append(genModel.getImportedName("java.util.Collection")); + stringBuffer.append(TEXT_1242); + } else if (keyFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1243); + stringBuffer.append(keyFeature.getObjectType()); + stringBuffer.append(TEXT_1244); + stringBuffer.append(keyFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_1245); + } else { + stringBuffer.append(TEXT_1246); + stringBuffer.append(keyFeature.getImportedType()); + stringBuffer.append(TEXT_1247); + } + stringBuffer.append(TEXT_1248); + if (valueFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1249); + stringBuffer.append(valueFeature.getObjectType()); + stringBuffer.append(TEXT_1250); + } else { + stringBuffer.append(TEXT_1251); + } + stringBuffer.append(TEXT_1252); + if (valueFeature.isListType()) { + stringBuffer.append(TEXT_1253); + stringBuffer.append(genModel.getImportedName("java.util.Collection")); + stringBuffer.append(TEXT_1254); + } else if (valueFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1255); + stringBuffer.append(valueFeature.getObjectType()); + stringBuffer.append(TEXT_1256); + stringBuffer.append(valueFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_1257); + } else { + stringBuffer.append(TEXT_1258); + stringBuffer.append(valueFeature.getImportedType()); + stringBuffer.append(TEXT_1259); + } + stringBuffer.append(TEXT_1260); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_1261); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(TEXT_1262); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_1263); + } + stringBuffer.append(TEXT_1264); + stringBuffer.append(isInterface ? " " + genClass.getInterfaceName() : genClass.getClassName()); + // TODO fix the space above + genModel.emitSortedImports(); + stringBuffer.append(TEXT_1265); + return stringBuffer.toString(); + } +} diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java new file mode 100644 index 0000000000..4a86a29027 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java @@ -0,0 +1,1132 @@ +package org.apache.tuscany.sdo.generate.templates.model; + +import org.apache.tuscany.sdo.generate.util.*; +import java.util.*; +import org.eclipse.emf.codegen.ecore.genmodel.*; +import org.eclipse.emf.ecore.*; +import org.eclipse.emf.codegen.ecore.genmodel.impl.Literals; +import org.eclipse.emf.ecore.util.*; +import org.eclipse.emf.codegen.util.CodeGenUtil; + +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + public class SDOFactoryClass + { + protected static String nl; + public static synchronized SDOFactoryClass create(String lineSeparator) + { + nl = lineSeparator; + SDOFactoryClass result = new SDOFactoryClass(); + nl = null; + return result; + } + + protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = ""; + protected final String TEXT_2 = "/**" + NL + " * " + NL + " * " + NL + " *" + NL + " * "; + protected final String TEXT_3 = "Id"; + protected final String TEXT_4 = NL + " */"; + protected final String TEXT_5 = NL + "package "; + protected final String TEXT_6 = ";"; + protected final String TEXT_7 = NL + "package "; + protected final String TEXT_8 = ";"; + protected final String TEXT_9 = NL + NL + "import commonj.sdo.helper.HelperContext;" + NL + "import org.apache.tuscany.sdo.helper.HelperContextImpl;"; + protected final String TEXT_10 = NL + "import org.apache.tuscany.sdo.helper.TypeHelperImpl;"; + protected final String TEXT_11 = NL; + protected final String TEXT_12 = NL; + protected final String TEXT_13 = NL + "/**" + NL + " * " + NL + " * The Factory for the model." + NL + " * It provides a create method for each non-abstract class of the model." + NL + " * "; + protected final String TEXT_14 = NL + " * @see "; + protected final String TEXT_15 = NL + " * patternVersion="; + protected final String TEXT_16 = ";"; + protected final String TEXT_17 = NL + " * @generated" + NL + " */"; + protected final String TEXT_18 = NL + "/**" + NL + " * " + NL + " * An implementation of the model Factory." + NL + " * Generator information:" + NL + " * patternVersion="; + protected final String TEXT_19 = ";"; + protected final String TEXT_20 = NL + " * " + NL + " * @generated" + NL + " */"; + protected final String TEXT_21 = NL + "public class "; + protected final String TEXT_22 = " extends "; + protected final String TEXT_23 = " implements "; + protected final String TEXT_24 = NL + "public interface "; + protected final String TEXT_25 = " extends "; + protected final String TEXT_26 = NL + "{"; + protected final String TEXT_27 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_28 = " copyright = \""; + protected final String TEXT_29 = "\";"; + protected final String TEXT_30 = NL; + protected final String TEXT_31 = NL; + protected final String TEXT_32 = NL + "\t/**" + NL + "\t * The singleton instance of the factory." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_33 = " INSTANCE = "; + protected final String TEXT_34 = ".init();" + NL; + protected final String TEXT_35 = NL + "\t/**" + NL + "\t * The singleton instance of the factory." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_36 = " eINSTANCE = "; + protected final String TEXT_37 = ".init();" + NL; + protected final String TEXT_38 = NL + "\t/**" + NL + "\t * The package namespace URI." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_39 = " NAMESPACE_URI = \""; + protected final String TEXT_40 = "\";"; + protected final String TEXT_41 = NL + NL + "\t/**" + NL + "\t * The package namespace name." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_42 = " NAMESPACE_PREFIX = \""; + protected final String TEXT_43 = "\";"; + protected final String TEXT_44 = NL + NL + "\t/**" + NL + "\t * The version of the generator pattern used to generate this class." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_45 = " PATTERN_VERSION = \""; + protected final String TEXT_46 = "\";" + NL; + protected final String TEXT_47 = "\t" + NL + "\t"; + protected final String TEXT_48 = "int "; + protected final String TEXT_49 = " = "; + protected final String TEXT_50 = ";"; + protected final String TEXT_51 = NL + "\t"; + protected final String TEXT_52 = NL + "\t/**" + NL + "\t * Creates an instance of the factory." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_53 = "()" + NL + "\t{" + NL + "\t\tsuper(NAMESPACE_URI, NAMESPACE_PREFIX, \""; + protected final String TEXT_54 = "\");" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Registers the Factory instance so that it is available within the supplied scope." + NL + " * @argument scope a HelperContext instance that will make the types supported by this Factory available." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void register(HelperContext scope) " + NL + "\t{" + NL + "\t\tif(scope == null) {" + NL + "\t\t\tthrow new IllegalArgumentException(\"Scope can not be null\");" + NL + "\t\t}" + NL + "" + NL + "\t\tif (((HelperContextImpl)scope).getExtendedMetaData().getPackage(NAMESPACE_URI) != null)" + NL + "\t\t\treturn;" + NL + " " + NL + "\t\t// Register this package with provided scope " + NL + "\t\t((HelperContextImpl)scope).getExtendedMetaData().putPackage(NAMESPACE_URI, this);" + NL + "\t\t" + NL + "\t\t//Register dependent packages with provided scope"; + protected final String TEXT_55 = NL + "\t\t"; + protected final String TEXT_56 = ".INSTANCE.register(scope);"; + protected final String TEXT_57 = NL + " }" + NL + "\t" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_58 = " create(int typeNumber)" + NL + "\t{" + NL + "\t\tswitch (typeNumber)" + NL + "\t\t{"; + protected final String TEXT_59 = NL + "\t\t\tcase "; + protected final String TEXT_60 = ": return ("; + protected final String TEXT_61 = ")create"; + protected final String TEXT_62 = "();"; + protected final String TEXT_63 = NL + "\t\t\tdefault:" + NL + "\t\t\t\treturn super.create(typeNumber);" + NL + "\t\t}" + NL + "\t}" + NL; + protected final String TEXT_64 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object createFromString(int typeNumber, String initialValue)" + NL + "\t{" + NL + "\t\tswitch (typeNumber)" + NL + "\t\t{"; + protected final String TEXT_65 = NL + "\t\t\tcase "; + protected final String TEXT_66 = ":" + NL + "\t\t\t\treturn create"; + protected final String TEXT_67 = "FromString(initialValue);"; + protected final String TEXT_68 = NL + "\t\t\tdefault:" + NL + "\t\t\t\tthrow new IllegalArgumentException(\"The type number '\" + typeNumber + \"' is not a valid datatype\");"; + protected final String TEXT_69 = NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String convertToString(int typeNumber, Object instanceValue)" + NL + "\t{" + NL + "\t\tswitch (typeNumber)" + NL + "\t\t{"; + protected final String TEXT_70 = NL + "\t\t\tcase "; + protected final String TEXT_71 = ":" + NL + "\t\t\t\treturn convert"; + protected final String TEXT_72 = "ToString(instanceValue);"; + protected final String TEXT_73 = NL + "\t\t\tdefault:" + NL + "\t\t\t\tthrow new IllegalArgumentException(\"The type number '\" + typeNumber + \"' is not a valid datatype\");"; + protected final String TEXT_74 = NL + "\t\t}" + NL + "\t}"; + protected final String TEXT_75 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_76 = " create"; + protected final String TEXT_77 = "()" + NL + "\t{"; + protected final String TEXT_78 = NL + "\t\t"; + protected final String TEXT_79 = " "; + protected final String TEXT_80 = " = "; + protected final String TEXT_81 = "super.create("; + protected final String TEXT_82 = ");"; + protected final String TEXT_83 = NL + "\t\t"; + protected final String TEXT_84 = " "; + protected final String TEXT_85 = " = new "; + protected final String TEXT_86 = "()"; + protected final String TEXT_87 = "{}"; + protected final String TEXT_88 = ";"; + protected final String TEXT_89 = NL + "\t\treturn "; + protected final String TEXT_90 = ";" + NL + "\t}"; + protected final String TEXT_91 = NL + "\t" + NL + "\t// Following creates and initializes SDO metadata for the supported types."; + protected final String TEXT_92 = "\t"; + protected final String TEXT_93 = "\t" + NL + "\tprotected "; + protected final String TEXT_94 = " "; + protected final String TEXT_95 = "Type = null;" + NL + "" + NL + "\tpublic "; + protected final String TEXT_96 = " get"; + protected final String TEXT_97 = "()" + NL + "\t{" + NL + "\t\treturn "; + protected final String TEXT_98 = "Type;" + NL + "\t}" + NL; + protected final String TEXT_99 = "\t" + NL + "" + NL + "\tprivate static "; + protected final String TEXT_100 = " instance = null; " + NL + "\tpublic static "; + protected final String TEXT_101 = " init()" + NL + "\t{" + NL + "\t\tif (instance != null ) return instance;" + NL + "\t\tinstance = new "; + protected final String TEXT_102 = "();" + NL + "" + NL + "\t\t// Create package meta-data objects" + NL + "\t\tinstance.createMetaData();" + NL + "" + NL + "\t\t// Initialize created meta-data" + NL + "\t\tinstance.initializeMetaData();" + NL + "\t\t" + NL + "\t\t// Mark meta-data to indicate it can't be changed" + NL + "\t\t//the"; + protected final String TEXT_103 = ".freeze(); //FB do we need to freeze / should we freeze ????" + NL + "" + NL + "\t\treturn instance;" + NL + "\t}" + NL + " " + NL + "\tprivate boolean isCreated = false;" + NL + "" + NL + "\tpublic void createMetaData()" + NL + "\t{" + NL + "\t\tif (isCreated) return;" + NL + "\t\tisCreated = true;"; + protected final String TEXT_104 = "\t" + NL + "" + NL + "\t\t// Create types and their properties"; + protected final String TEXT_105 = NL + "\t\t"; + protected final String TEXT_106 = "Type = createType(false, "; + protected final String TEXT_107 = ");"; + protected final String TEXT_108 = NL + "\t\tcreateProperty("; + protected final String TEXT_109 = ", "; + protected final String TEXT_110 = "Type,"; + protected final String TEXT_111 = "._INTERNAL_"; + protected final String TEXT_112 = "); "; + protected final String TEXT_113 = NL + NL + "\t\t// Create data types"; + protected final String TEXT_114 = NL + "\t\t"; + protected final String TEXT_115 = "Type = createType(true, "; + protected final String TEXT_116 = " );"; + protected final String TEXT_117 = NL + "\t}" + NL + "\t" + NL + "\tprivate boolean isInitialized = false;" + NL + "" + NL + "\tpublic void initializeMetaData()" + NL + "\t{" + NL + "\t\tif (isInitialized) return;" + NL + "\t\tisInitialized = true;"; + protected final String TEXT_118 = NL + NL + "\t\t// Obtain other dependent packages"; + protected final String TEXT_119 = NL + "\t\t"; + protected final String TEXT_120 = " "; + protected final String TEXT_121 = " = ("; + protected final String TEXT_122 = ")"; + protected final String TEXT_123 = ".init();"; + protected final String TEXT_124 = NL + "\t\t"; + protected final String TEXT_125 = " property = null;" + NL + "" + NL + "\t\t// Add supertypes to types"; + protected final String TEXT_126 = NL + "\t\taddSuperType("; + protected final String TEXT_127 = "Type, "; + protected final String TEXT_128 = ".get"; + protected final String TEXT_129 = "());"; + protected final String TEXT_130 = NL + NL + "\t\t// Initialize types and properties"; + protected final String TEXT_131 = NL + "\t\tinitializeType("; + protected final String TEXT_132 = "Type, "; + protected final String TEXT_133 = ".class, \""; + protected final String TEXT_134 = "\", "; + protected final String TEXT_135 = ");"; + protected final String TEXT_136 = NL + "\t\tsetInstanceProperty ("; + protected final String TEXT_137 = "Type, \""; + protected final String TEXT_138 = "\", "; + protected final String TEXT_139 = ", "; + protected final String TEXT_140 = ");"; + protected final String TEXT_141 = NL + "\t\tproperty = getLocalProperty("; + protected final String TEXT_142 = "Type, "; + protected final String TEXT_143 = ");"; + protected final String TEXT_144 = NL + "\t\tinitializeProperty(property, "; + protected final String TEXT_145 = ", \""; + protected final String TEXT_146 = "\", "; + protected final String TEXT_147 = ", "; + protected final String TEXT_148 = ", "; + protected final String TEXT_149 = ", "; + protected final String TEXT_150 = ", "; + protected final String TEXT_151 = ", "; + protected final String TEXT_152 = ", "; + protected final String TEXT_153 = ", "; + protected final String TEXT_154 = " , "; + protected final String TEXT_155 = ");"; + protected final String TEXT_156 = NL + "\t\tinitializeProperty(property, "; + protected final String TEXT_157 = ", \""; + protected final String TEXT_158 = "\", "; + protected final String TEXT_159 = ", "; + protected final String TEXT_160 = ", "; + protected final String TEXT_161 = ", "; + protected final String TEXT_162 = ", "; + protected final String TEXT_163 = ", "; + protected final String TEXT_164 = ", "; + protected final String TEXT_165 = ");"; + protected final String TEXT_166 = NL + "\t\tsetInstanceProperty (property, \""; + protected final String TEXT_167 = "\", "; + protected final String TEXT_168 = ", "; + protected final String TEXT_169 = ");"; + protected final String TEXT_170 = NL; + protected final String TEXT_171 = NL + "\t\t// Initialize data types"; + protected final String TEXT_172 = NL + "\t\tinitializeType("; + protected final String TEXT_173 = "Type, "; + protected final String TEXT_174 = ".class, \""; + protected final String TEXT_175 = "\", "; + protected final String TEXT_176 = ", "; + protected final String TEXT_177 = ");"; + protected final String TEXT_178 = NL + "\t\tsetInstanceProperty ("; + protected final String TEXT_179 = "Type, \""; + protected final String TEXT_180 = "\", "; + protected final String TEXT_181 = ", "; + protected final String TEXT_182 = ");"; + protected final String TEXT_183 = NL; + protected final String TEXT_184 = NL + "\t\tcreateXSDMetaData("; + protected final String TEXT_185 = ");" + NL + "\t}" + NL + "\t " + NL + "\tprotected void createXSDMetaData("; + protected final String TEXT_186 = ")" + NL + "\t{" + NL + "\t\tsuper.initXSD();" + NL + "\t\t" + NL + "\t\t"; + protected final String TEXT_187 = " property = null;" + NL + "\t\t"; + protected final String TEXT_188 = NL + "\t\taddXSDMapping" + NL + "\t\t (new String[]" + NL + "\t\t\t {"; + protected final String TEXT_189 = NL + "\t\t\t "; + protected final String TEXT_190 = ", "; + protected final String TEXT_191 = NL + "\t\t\t }," + NL + "\t\t\t \""; + protected final String TEXT_192 = "\");" + NL; + protected final String TEXT_193 = NL; + protected final String TEXT_194 = NL + "\t\taddXSDMapping" + NL + "\t\t ("; + protected final String TEXT_195 = "Type," + NL + "\t\t\t new String[] " + NL + "\t\t\t {"; + protected final String TEXT_196 = NL + "\t\t\t "; + protected final String TEXT_197 = ", "; + protected final String TEXT_198 = NL + "\t\t\t });" + NL; + protected final String TEXT_199 = NL + "\t\tproperty = createGlobalProperty" + NL + "\t\t (\""; + protected final String TEXT_200 = "\"," + NL + "\t\t "; + protected final String TEXT_201 = ".get"; + protected final String TEXT_202 = "()," + NL + "\t\t\t new String[]" + NL + "\t\t\t {"; + protected final String TEXT_203 = NL + "\t\t\t "; + protected final String TEXT_204 = ", "; + protected final String TEXT_205 = NL + "\t\t\t }," + NL + "\t\t\t IS_ATTRIBUTE);"; + protected final String TEXT_206 = NL + "\t\t\t });"; + protected final String TEXT_207 = NL + " "; + protected final String TEXT_208 = NL + "\t\tsetInstanceProperty" + NL + "\t\t (property," + NL + "\t\t\t \""; + protected final String TEXT_209 = "\"," + NL + "\t\t\t "; + protected final String TEXT_210 = ", "; + protected final String TEXT_211 = ");"; + protected final String TEXT_212 = NL + " "; + protected final String TEXT_213 = " "; + protected final String TEXT_214 = NL + "\t\taddXSDMapping" + NL + "\t\t\t(getLocalProperty("; + protected final String TEXT_215 = "Type, "; + protected final String TEXT_216 = ")," + NL + "\t\t\t new String[]" + NL + "\t\t\t {"; + protected final String TEXT_217 = NL + "\t\t\t "; + protected final String TEXT_218 = ", "; + protected final String TEXT_219 = NL + "\t\t\t });" + NL; + protected final String TEXT_220 = NL + " }" + NL + " "; + protected final String TEXT_221 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_222 = " create"; + protected final String TEXT_223 = "FromString(String initialValue)" + NL + "\t{"; + protected final String TEXT_224 = NL + "\t\t"; + protected final String TEXT_225 = " result = "; + protected final String TEXT_226 = ".get(initialValue);" + NL + "\t\tif (result == null) throw new IllegalArgumentException(\"The value '\" + initialValue + \"' is not a valid enumerator of '\" + type.getName() + \"'\");"; + protected final String TEXT_227 = NL + "\t\treturn result;"; + protected final String TEXT_228 = NL + "\t\treturn ("; + protected final String TEXT_229 = ")create"; + protected final String TEXT_230 = "FromString(initialValue);"; + protected final String TEXT_231 = NL + "\t\treturn ("; + protected final String TEXT_232 = ")"; + protected final String TEXT_233 = ".create"; + protected final String TEXT_234 = "FromString(initialValue);"; + protected final String TEXT_235 = NL + "\t\tif (initialValue == null) return null;" + NL + "\t\t"; + protected final String TEXT_236 = " result = new "; + protected final String TEXT_237 = "();" + NL + "\t\tfor ("; + protected final String TEXT_238 = " stringTokenizer = new "; + protected final String TEXT_239 = "(initialValue); stringTokenizer.hasMoreTokens(); )" + NL + "\t\t{" + NL + "\t\t\tString item = stringTokenizer.nextToken();"; + protected final String TEXT_240 = NL + "\t\t\tresult.add(create"; + protected final String TEXT_241 = "FromString(item));"; + protected final String TEXT_242 = NL + "\t\t\tresult.add("; + protected final String TEXT_243 = ".create"; + protected final String TEXT_244 = "FromString(item));"; + protected final String TEXT_245 = NL + "\t\t}" + NL + "\t\treturn result;"; + protected final String TEXT_246 = NL + "\t\tif (initialValue == null) return null;" + NL + "\t\t"; + protected final String TEXT_247 = " result = null;" + NL + "\t\tRuntimeException exception = null;"; + protected final String TEXT_248 = NL + "\t\ttry" + NL + "\t\t{"; + protected final String TEXT_249 = NL + "\t\t\tresult = ("; + protected final String TEXT_250 = ")create"; + protected final String TEXT_251 = "FromString(initialValue);"; + protected final String TEXT_252 = NL + "\t\t\tresult = ("; + protected final String TEXT_253 = ")"; + protected final String TEXT_254 = ".create"; + protected final String TEXT_255 = "FromString(initialValue);"; + protected final String TEXT_256 = NL + "\t\t\tif (result != null/* && Diagnostician.INSTANCE.validate(type, result, null, null)*/)" + NL + "\t\t\t{" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tcatch (RuntimeException e)" + NL + "\t\t{" + NL + "\t\t\texception = e;" + NL + "\t\t}"; + protected final String TEXT_257 = NL + "\t\tif (result != null || exception == null) return result;" + NL + " " + NL + "\t\tthrow exception;"; + protected final String TEXT_258 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new "; + protected final String TEXT_259 = "();"; + protected final String TEXT_260 = NL + "\t\treturn ("; + protected final String TEXT_261 = ")super.createFromString("; + protected final String TEXT_262 = ", initialValue);"; + protected final String TEXT_263 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String convert"; + protected final String TEXT_264 = "ToString(Object instanceValue)" + NL + "\t{"; + protected final String TEXT_265 = NL + "\t\treturn instanceValue == null ? null : instanceValue.toString();"; + protected final String TEXT_266 = NL + "\t\treturn convert"; + protected final String TEXT_267 = "ToString(instanceValue);"; + protected final String TEXT_268 = NL + "\t\treturn "; + protected final String TEXT_269 = ".convert"; + protected final String TEXT_270 = "ToString(instanceValue);"; + protected final String TEXT_271 = NL + "\t\tif (instanceValue == null) return null;" + NL + "\t\t"; + protected final String TEXT_272 = " list = ("; + protected final String TEXT_273 = ")instanceValue;" + NL + "\t\tif (list.isEmpty()) return \"\";" + NL + "\t\t"; + protected final String TEXT_274 = " result = new "; + protected final String TEXT_275 = "();" + NL + "\t\tfor ("; + protected final String TEXT_276 = " i = list.iterator(); i.hasNext(); )" + NL + "\t\t{"; + protected final String TEXT_277 = NL + "\t\t\tresult.append(convert"; + protected final String TEXT_278 = "ToString(i.next()));"; + protected final String TEXT_279 = NL + "\t\t\tresult.append("; + protected final String TEXT_280 = ".convert"; + protected final String TEXT_281 = "ToString(i.next()));"; + protected final String TEXT_282 = NL + "\t\t\tresult.append(' ');" + NL + "\t\t}" + NL + "\t\treturn result.substring(0, result.length() - 1);"; + protected final String TEXT_283 = NL + "\t\tif (instanceValue == null) return null;"; + protected final String TEXT_284 = NL + "\t\tif ("; + protected final String TEXT_285 = ".isInstance(instanceValue))" + NL + "\t\t{" + NL + "\t\t\ttry" + NL + "\t\t\t{"; + protected final String TEXT_286 = NL + "\t\t\t\tString value = convert"; + protected final String TEXT_287 = "ToString(instanceValue);"; + protected final String TEXT_288 = NL + "\t\t\t\tString value = "; + protected final String TEXT_289 = ".convert"; + protected final String TEXT_290 = "ToString(instanceValue);"; + protected final String TEXT_291 = NL + "\t\t\t\tif (value != null) return value;" + NL + "\t\t\t}" + NL + "\t\t\tcatch (Exception e)" + NL + "\t\t\t{" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_292 = NL + "\t\tthrow new IllegalArgumentException(\"Invalid value: '\"+instanceValue+\"' for datatype :"; + protected final String TEXT_293 = "\");"; + protected final String TEXT_294 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new "; + protected final String TEXT_295 = "();"; + protected final String TEXT_296 = NL + "\t\treturn super.convertToString("; + protected final String TEXT_297 = ", instanceValue);"; + protected final String TEXT_298 = NL + "\t}" + NL; + protected final String TEXT_299 = NL + "\t/**" + NL + "\t * Returns a new object of class '"; + protected final String TEXT_300 = "'." + NL + "\t * " + NL + "\t * " + NL + "\t * @return a new object of class '"; + protected final String TEXT_301 = "'." + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_302 = " create"; + protected final String TEXT_303 = "();" + NL; + protected final String TEXT_304 = NL + " /**" + NL + " * Registers the types supported by this Factory within the supplied scope.argument" + NL + "\t * " + NL + "\t * " + NL + "\t * @param scope an instance of HelperContext used to manage the scoping of types." + NL + "\t * @generated" + NL + " */" + NL + " public void register(HelperContext scope);" + NL + " "; + protected final String TEXT_305 = NL + "\t/**" + NL + "\t * Returns an instance of data type '"; + protected final String TEXT_306 = "' corresponding the given literal." + NL + "\t * " + NL + "\t * " + NL + "\t * @param literal a literal of the data type." + NL + "\t * @return a new instance value of the data type." + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_307 = " create"; + protected final String TEXT_308 = "(String literal);" + NL + "" + NL + "\t/**" + NL + "\t * Returns a literal representation of an instance of data type '"; + protected final String TEXT_309 = "'." + NL + "\t * " + NL + "\t * " + NL + "\t * @param instanceValue an instance value of the data type." + NL + "\t * @return a literal representation of the instance value." + NL + "\t * @generated" + NL + "\t */" + NL + "\tString convert"; + protected final String TEXT_310 = "("; + protected final String TEXT_311 = " instanceValue);" + NL; + protected final String TEXT_312 = NL + "} //"; + protected final String TEXT_313 = NL; + + public String generate(Object argument) + { + final StringBuffer stringBuffer = new StringBuffer(); + +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + GenPackage genPackage = (GenPackage)((Object[])argument)[0]; GenModel genModel=genPackage.getGenModel(); + boolean isInterface = Boolean.TRUE.equals(((Object[])argument)[1]); boolean isImplementation = Boolean.TRUE.equals(((Object[])argument)[2]); + String factoryPatternVersion = "1.2"; + String publicStaticFinalFlag = isImplementation ? "public static final " : ""; + stringBuffer.append(TEXT_1); + stringBuffer.append(TEXT_2); + stringBuffer.append("$"); + stringBuffer.append(TEXT_3); + stringBuffer.append("$"); + stringBuffer.append(TEXT_4); + if (isInterface || genModel.isSuppressInterfaces()) { + stringBuffer.append(TEXT_5); + stringBuffer.append(genPackage.getReflectionPackageName()); + stringBuffer.append(TEXT_6); + } else { + stringBuffer.append(TEXT_7); + stringBuffer.append(genPackage.getClassPackageName()); + stringBuffer.append(TEXT_8); + } + stringBuffer.append(TEXT_9); + if (!isInterface || genModel.isSuppressInterfaces()) { + stringBuffer.append(TEXT_10); + } + stringBuffer.append(TEXT_11); + if (isImplementation) { + if (!genPackage.hasJavaLangConflict() && !genPackage.hasInterfaceImplConflict() && !genPackage.getClassPackageName().equals(genPackage.getInterfacePackageName())) genModel.addImport(genPackage.getInterfacePackageName() + ".*"); + } + genModel.markImportLocation(stringBuffer); + stringBuffer.append(TEXT_12); + if (isInterface) { + stringBuffer.append(TEXT_13); + if (!genModel.isSuppressEMFMetaData()) { + stringBuffer.append(TEXT_14); + stringBuffer.append(genPackage.getQualifiedPackageInterfaceName()); + } + if (genModel.isSuppressInterfaces()) { + stringBuffer.append(TEXT_15); + stringBuffer.append(factoryPatternVersion); + stringBuffer.append(TEXT_16); + stringBuffer.append(SDOGenUtil.printArguments(genPackage, genModel) ); + } + stringBuffer.append(TEXT_17); + } else { + stringBuffer.append(TEXT_18); + stringBuffer.append(factoryPatternVersion); + stringBuffer.append(TEXT_19); + stringBuffer.append(SDOGenUtil.printArguments(genPackage, genModel) ); + stringBuffer.append(TEXT_20); + } + if (isImplementation) { + stringBuffer.append(TEXT_21); + stringBuffer.append(genPackage.getFactoryClassName()); + stringBuffer.append(TEXT_22); + stringBuffer.append(genModel.getImportedName("org.apache.tuscany.sdo.impl.FactoryBase")); + if (!genModel.isSuppressInterfaces()) { + stringBuffer.append(TEXT_23); + stringBuffer.append(genPackage.getImportedFactoryInterfaceName()); + } + } else { + stringBuffer.append(TEXT_24); + stringBuffer.append(genPackage.getFactoryInterfaceName()); + if (!genModel.isSuppressEMFMetaData()) { + stringBuffer.append(TEXT_25); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EFactory")); + } + } + stringBuffer.append(TEXT_26); + if (genModel.getCopyrightText() != null) { + stringBuffer.append(TEXT_27); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genModel.getImportedName("java.lang.String")); + stringBuffer.append(TEXT_28); + stringBuffer.append(genModel.getCopyrightText()); + stringBuffer.append(TEXT_29); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_30); + } + stringBuffer.append(TEXT_31); + if (isInterface && genModel.isSuppressEMFMetaData()) { + stringBuffer.append(TEXT_32); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genPackage.getFactoryInterfaceName()); + stringBuffer.append(TEXT_33); + stringBuffer.append(genPackage.getQualifiedFactoryClassName()); + stringBuffer.append(TEXT_34); + } else if (isInterface && !genModel.isSuppressInterfaces()) { + stringBuffer.append(TEXT_35); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genPackage.getFactoryInterfaceName()); + stringBuffer.append(TEXT_36); + stringBuffer.append(genPackage.getQualifiedFactoryClassName()); + stringBuffer.append(TEXT_37); + } + if (isImplementation) { + stringBuffer.append(TEXT_38); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genModel.getImportedName("java.lang.String")); + stringBuffer.append(TEXT_39); + stringBuffer.append(genPackage.getNSURI()); + stringBuffer.append(TEXT_40); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_41); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genModel.getImportedName("java.lang.String")); + stringBuffer.append(TEXT_42); + stringBuffer.append(genPackage.getNSName()); + stringBuffer.append(TEXT_43); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_44); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genModel.getImportedName("java.lang.String")); + stringBuffer.append(TEXT_45); + stringBuffer.append(factoryPatternVersion); + stringBuffer.append(TEXT_46); + int genIndex = 1; +for (Iterator i=genPackage.getOrderedGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next(); + if (!genPackage.getClassifierID(genClassifier).equals("DOCUMENT_ROOT")) { + stringBuffer.append(TEXT_47); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(TEXT_48); + stringBuffer.append(genPackage.getClassifierID(genClassifier)); + stringBuffer.append(TEXT_49); + stringBuffer.append(genIndex); + stringBuffer.append(TEXT_50); + genIndex++; + } } + stringBuffer.append(TEXT_51); + String factoryType = genModel.isSuppressEMFMetaData() ? genPackage.getFactoryClassName() : genPackage.getImportedFactoryInterfaceName(); + stringBuffer.append(TEXT_52); + stringBuffer.append(genPackage.getFactoryClassName()); + stringBuffer.append(TEXT_53); + stringBuffer.append(genPackage.getReflectionPackageName()); + stringBuffer.append(TEXT_54); + for (Iterator p=genPackage.getPackageInitializationDependencies().iterator(); p.hasNext();) { GenPackage dep = (GenPackage)p.next(); + stringBuffer.append(TEXT_55); + stringBuffer.append(dep.getImportedFactoryInterfaceName()); + stringBuffer.append(TEXT_56); + } + stringBuffer.append(TEXT_57); + stringBuffer.append(genModel.getImportedName("commonj.sdo.DataObject")); + stringBuffer.append(TEXT_58); + for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next(); + if (!genClass.isAbstract() && !genClass.isDynamic()) { + stringBuffer.append(TEXT_59); + stringBuffer.append(genClass.getClassifierID()); + stringBuffer.append(TEXT_60); + stringBuffer.append(genModel.getImportedName("commonj.sdo.DataObject")); + stringBuffer.append(TEXT_61); + stringBuffer.append(genClass.getName()); + stringBuffer.append(TEXT_62); + } + } + stringBuffer.append(TEXT_63); + if (!genPackage.getAllGenDataTypes().isEmpty()) { + stringBuffer.append(TEXT_64); + for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next(); + if (genDataType.isSerializable()) { + stringBuffer.append(TEXT_65); + stringBuffer.append(genDataType.getClassifierID()); + stringBuffer.append(TEXT_66); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_67); + } + } + stringBuffer.append(TEXT_68); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(genModel.getNonNLS(2)); + stringBuffer.append(TEXT_69); + for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next(); + if (genDataType.isSerializable()) { + stringBuffer.append(TEXT_70); + stringBuffer.append(genDataType.getClassifierID()); + stringBuffer.append(TEXT_71); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_72); + } + } + stringBuffer.append(TEXT_73); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(genModel.getNonNLS(2)); + stringBuffer.append(TEXT_74); + } + for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next(); + if (!genClass.isAbstract() && !genClass.isDynamic()) { + stringBuffer.append(TEXT_75); + stringBuffer.append(genClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_76); + stringBuffer.append(genClass.getName()); + stringBuffer.append(TEXT_77); + if (genClass.isDynamic()) { + stringBuffer.append(TEXT_78); + stringBuffer.append(genClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_79); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_80); + stringBuffer.append(genClass.getCastFromEObject()); + stringBuffer.append(TEXT_81); + stringBuffer.append(genClass.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_82); + } else { + stringBuffer.append(TEXT_83); + stringBuffer.append(genClass.getImportedClassName()); + stringBuffer.append(TEXT_84); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_85); + stringBuffer.append(genClass.getImportedClassName()); + stringBuffer.append(TEXT_86); + if (genModel.isSuppressInterfaces() && !genPackage.getReflectionPackageName().equals(genPackage.getInterfacePackageName())) { + stringBuffer.append(TEXT_87); + } + stringBuffer.append(TEXT_88); + } + stringBuffer.append(TEXT_89); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_90); + } + } + stringBuffer.append(TEXT_91); + for (Iterator i=genPackage.getOrderedGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next(); + stringBuffer.append(TEXT_92); + if (!genPackage.getClassifierID(genClassifier).equals("DOCUMENT_ROOT")) { + stringBuffer.append(TEXT_93); + stringBuffer.append(genModel.getImportedName("commonj.sdo.Type")); + stringBuffer.append(TEXT_94); + stringBuffer.append(genClassifier.getSafeUncapName()); + stringBuffer.append(TEXT_95); + stringBuffer.append(genModel.getImportedName("commonj.sdo.Type")); + stringBuffer.append(TEXT_96); + stringBuffer.append(genClassifier.getClassifierAccessorName()); + stringBuffer.append(TEXT_97); + stringBuffer.append(genClassifier.getSafeUncapName()); + stringBuffer.append(TEXT_98); + } } + stringBuffer.append(TEXT_99); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_100); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_101); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_102); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_103); + if (!genPackage.getGenClasses().isEmpty()) { + stringBuffer.append(TEXT_104); + for (Iterator c=genPackage.getGenClasses().iterator(); c.hasNext();) { GenClass genClass = (GenClass)c.next(); + if (!genClass.isDynamic()) { + stringBuffer.append(TEXT_105); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_106); + stringBuffer.append(genPackage.getClassifierID(genClass)); + stringBuffer.append(TEXT_107); + for (Iterator j=genClass.getGenFeatures().iterator(); j.hasNext();) { GenFeature genFeature = (GenFeature)j.next(); + stringBuffer.append(TEXT_108); + stringBuffer.append(!genFeature.isReferenceType()); + stringBuffer.append(TEXT_109); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_110); + stringBuffer.append(genClass.getClassName()); + stringBuffer.append(TEXT_111); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_112); + } + } + } + } + if (!genPackage.getGenDataTypes().isEmpty()) { + stringBuffer.append(TEXT_113); + for (Iterator d=genPackage.getGenDataTypes().iterator(); d.hasNext();) { GenDataType genDataType = (GenDataType)d.next(); + stringBuffer.append(TEXT_114); + stringBuffer.append(genDataType.getSafeUncapName()); + stringBuffer.append(TEXT_115); + stringBuffer.append(genPackage.getClassifierID(genDataType)); + stringBuffer.append(TEXT_116); + } + } + stringBuffer.append(TEXT_117); + if (!genPackage.getPackageInitializationDependencies().isEmpty()) { + stringBuffer.append(TEXT_118); + for (Iterator p=genPackage.getPackageInitializationDependencies().iterator(); p.hasNext();) { GenPackage dep = (GenPackage)p.next(); + stringBuffer.append(TEXT_119); + stringBuffer.append(dep.getImportedFactoryClassName()); + stringBuffer.append(TEXT_120); + stringBuffer.append(genPackage.getPackageInstanceVariable(dep)); + stringBuffer.append(TEXT_121); + stringBuffer.append(dep.getImportedFactoryClassName()); + stringBuffer.append(TEXT_122); + stringBuffer.append(dep.getImportedFactoryClassName()); + stringBuffer.append(TEXT_123); + } + } + List annotationSources = genPackage.getAnnotationSources(); + annotationSources.remove(ExtendedMetaData.ANNOTATION_URI); + stringBuffer.append(TEXT_124); + stringBuffer.append(genModel.getImportedName("commonj.sdo.Property")); + stringBuffer.append(TEXT_125); + for (Iterator c=genPackage.getGenClasses().iterator(); c.hasNext();) { GenClass genClass = (GenClass)c.next(); + for (Iterator b=genClass.getBaseGenClasses().iterator(); b.hasNext();) { GenClass baseGenClass = (GenClass)b.next(); + stringBuffer.append(TEXT_126); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_127); + stringBuffer.append(genPackage.getPackageInstanceVariable(baseGenClass.getGenPackage())); + stringBuffer.append(TEXT_128); + stringBuffer.append(baseGenClass.getClassifierAccessorName()); + stringBuffer.append(TEXT_129); + } + } + stringBuffer.append(TEXT_130); + for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next(); + if (!genClass.isDynamic()) { + stringBuffer.append(TEXT_131); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_132); + stringBuffer.append(genClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_133); + stringBuffer.append(genClass.getName()); + stringBuffer.append(TEXT_134); + stringBuffer.append(genClass.isAbstract()); + stringBuffer.append(TEXT_135); + for (Iterator sources = annotationSources.iterator(); sources.hasNext();) { String annotationSource = (String)sources.next(); + EAnnotation classAnnotation = genClass.getEcoreClassifier().getEAnnotation(annotationSource); + if (classAnnotation != null) { + for (Iterator k = classAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel); + stringBuffer.append(TEXT_136); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_137); + stringBuffer.append(annotationSource); + stringBuffer.append(TEXT_138); + stringBuffer.append(key); + stringBuffer.append(TEXT_139); + stringBuffer.append(value); + stringBuffer.append(genModel.getNonNLS(key + value)); + stringBuffer.append(TEXT_140); + } + } + } + for (Iterator j=genClass.getGenFeatures().iterator(); j.hasNext();) {GenFeature genFeature = (GenFeature)j.next(); + String type = genFeature.getType().equals("commonj.sdo.Sequence") ? "getSequence()" : genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage()) + ".get" + genFeature.getTypeClassifierAccessorName() + "()"; + stringBuffer.append(TEXT_141); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_142); + stringBuffer.append(genClass.getLocalFeatureIndex(genFeature)); + stringBuffer.append(TEXT_143); + if (genFeature.isReferenceType()) { GenFeature reverseGenFeature = genFeature.getReverse(); + String reverse = reverseGenFeature == null ? "null" : genPackage.getPackageInstanceVariable(reverseGenFeature.getGenPackage()) + ".get" + reverseGenFeature.getFeatureAccessorName() + "()"; + stringBuffer.append(TEXT_144); + stringBuffer.append(type); + stringBuffer.append(TEXT_145); + stringBuffer.append(genFeature.getName()); + stringBuffer.append(TEXT_146); + stringBuffer.append(genFeature.getDefaultValue()); + stringBuffer.append(TEXT_147); + stringBuffer.append(genFeature.getLowerBound()); + stringBuffer.append(TEXT_148); + stringBuffer.append(genFeature.getUpperBound()); + stringBuffer.append(TEXT_149); + stringBuffer.append(genFeature.getContainerClass()); + stringBuffer.append(TEXT_150); + stringBuffer.append(genFeature.getChangeableFlag().equals("IS_CHANGEABLE") ? "false" : "true"); + stringBuffer.append(TEXT_151); + stringBuffer.append(genFeature.getUnsettableFlag().equals("IS_UNSETTABLE") ? "true": "false"); + stringBuffer.append(TEXT_152); + stringBuffer.append(genFeature.getDerivedFlag().equals("IS_DERIVED") ? "true" : "false"); + stringBuffer.append(TEXT_153); + stringBuffer.append(genFeature.getContainmentFlag().equals("IS_COMPOSITE")? "true": "false"); + stringBuffer.append(TEXT_154); + stringBuffer.append(reverse); + stringBuffer.append(TEXT_155); + }else{ + stringBuffer.append(TEXT_156); + stringBuffer.append(type); + stringBuffer.append(TEXT_157); + stringBuffer.append(genFeature.getName()); + stringBuffer.append(TEXT_158); + stringBuffer.append(genFeature.getDefaultValue()); + stringBuffer.append(TEXT_159); + stringBuffer.append(genFeature.getLowerBound()); + stringBuffer.append(TEXT_160); + stringBuffer.append(genFeature.getUpperBound()); + stringBuffer.append(TEXT_161); + stringBuffer.append(genFeature.getContainerClass()); + stringBuffer.append(TEXT_162); + stringBuffer.append(genFeature.getChangeableFlag().equals("IS_CHANGEABLE") ? "false" : "true"); + stringBuffer.append(TEXT_163); + stringBuffer.append(genFeature.getUnsettableFlag().equals("IS_UNSETTABLE") ? "true": "false"); + stringBuffer.append(TEXT_164); + stringBuffer.append(genFeature.getDerivedFlag().equals("IS_DERIVED") ? "true" : "false"); + stringBuffer.append(TEXT_165); + } + for (Iterator sources = annotationSources.iterator(); sources.hasNext();) { String annotationSource = (String)sources.next(); + EAnnotation featureAnnotation = genFeature.getEcoreFeature().getEAnnotation(annotationSource); + if (featureAnnotation != null) { + for (Iterator k = featureAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel); + stringBuffer.append(TEXT_166); + stringBuffer.append(annotationSource); + stringBuffer.append(TEXT_167); + stringBuffer.append(key); + stringBuffer.append(TEXT_168); + stringBuffer.append(value); + stringBuffer.append(genModel.getNonNLS(key + value)); + stringBuffer.append(TEXT_169); + } + } + } + stringBuffer.append(TEXT_170); + } + } + } + if (!genPackage.getGenDataTypes().isEmpty()) { + stringBuffer.append(TEXT_171); + for (Iterator d=genPackage.getGenDataTypes().iterator(); d.hasNext();) { GenDataType genDataType = (GenDataType)d.next(); + stringBuffer.append(TEXT_172); + stringBuffer.append(genDataType.getSafeUncapName()); + stringBuffer.append(TEXT_173); + stringBuffer.append(genDataType.getImportedInstanceClassName()); + stringBuffer.append(TEXT_174); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_175); + stringBuffer.append(genDataType.getSerializableFlag().equals("IS_SERIALIZABLE") ? "true" : "false"); + stringBuffer.append(TEXT_176); + stringBuffer.append(genDataType.getGeneratedInstanceClassFlag().equals("IS_GENERATED_INSTANCE_CLASS") ? "true" : "false" ); + stringBuffer.append(TEXT_177); + stringBuffer.append(genModel.getNonNLS()); + for (Iterator sources = annotationSources.iterator(); sources.hasNext();) { String annotationSource = (String)sources.next(); + EAnnotation dataTypeAnnotation = genDataType.getEcoreDataType().getEAnnotation(annotationSource); + if (dataTypeAnnotation != null) { + for (Iterator k = dataTypeAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel); + stringBuffer.append(TEXT_178); + stringBuffer.append(genDataType.getSafeUncapName()); + stringBuffer.append(TEXT_179); + stringBuffer.append(annotationSource); + stringBuffer.append(TEXT_180); + stringBuffer.append(key); + stringBuffer.append(TEXT_181); + stringBuffer.append(value); + stringBuffer.append(genModel.getNonNLS(key + value)); + stringBuffer.append(TEXT_182); + } + } + } + stringBuffer.append(TEXT_183); + } + } + stringBuffer.append(TEXT_184); + stringBuffer.append(SDOGenUtil.getDependentFactoryArgumentList(genPackage, false)); + stringBuffer.append(TEXT_185); + stringBuffer.append(SDOGenUtil.getDependentFactoryArgumentList(genPackage, true)); + stringBuffer.append(TEXT_186); + stringBuffer.append(genModel.getImportedName("commonj.sdo.Property")); + stringBuffer.append(TEXT_187); + String extendedMetaDataSource = ExtendedMetaData.ANNOTATION_URI; + EAnnotation packageAnnotation = genPackage.getEcorePackage().getEAnnotation(extendedMetaDataSource); + if (packageAnnotation != null){ + stringBuffer.append(TEXT_188); + for (Iterator k = packageAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel); + stringBuffer.append(TEXT_189); + stringBuffer.append(key); + stringBuffer.append(TEXT_190); + stringBuffer.append(value); + stringBuffer.append(k.hasNext() ? "," : ""); + stringBuffer.append(genModel.getNonNLS(key + value)); + } + stringBuffer.append(TEXT_191); + stringBuffer.append(packageAnnotation.getSource()); + stringBuffer.append(TEXT_192); + } + stringBuffer.append(TEXT_193); + for (Iterator i=genPackage.getGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next(); EAnnotation classAnnotation = genClassifier.getEcoreClassifier().getEAnnotation(extendedMetaDataSource); + if (classAnnotation != null && !genClassifier.getName().equals("DocumentRoot")) { + stringBuffer.append(TEXT_194); + stringBuffer.append(genClassifier.getSafeUncapName()); + stringBuffer.append(TEXT_195); + for (Iterator k = classAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel); + stringBuffer.append(TEXT_196); + stringBuffer.append(key); + stringBuffer.append(TEXT_197); + stringBuffer.append(value); + stringBuffer.append(k.hasNext() ? "," : ""); + stringBuffer.append(genModel.getNonNLS(key + value)); + } + stringBuffer.append(TEXT_198); + } + if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass) genClassifier; + for (Iterator j=genClass.getGenFeatures().iterator(); j.hasNext();) { GenFeature genFeature = (GenFeature)j.next(); + EAnnotation featureAnnotation = genFeature.getEcoreFeature().getEAnnotation(extendedMetaDataSource); + if (genClass.getName().equals("DocumentRoot")) { + if (!(genFeature.getName().equals("mixed") || genFeature.getName().equals("xMLNSPrefixMap") || genFeature.getName().equals("xSISchemaLocation"))) { + stringBuffer.append(TEXT_199); + stringBuffer.append(genFeature.getName()); + stringBuffer.append(TEXT_200); + stringBuffer.append(genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage())); + stringBuffer.append(TEXT_201); + stringBuffer.append(genFeature.getTypeClassifierAccessorName()); + stringBuffer.append(TEXT_202); + for (Iterator k = featureAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel); + stringBuffer.append(TEXT_203); + stringBuffer.append(key); + stringBuffer.append(TEXT_204); + stringBuffer.append(value); + stringBuffer.append(k.hasNext() ? "," : ""); + stringBuffer.append(genModel.getNonNLS(key + value)); + } + if (!genFeature.isReferenceType()) { + stringBuffer.append(TEXT_205); + } else { + stringBuffer.append(TEXT_206); + } + stringBuffer.append(TEXT_207); + for (Iterator sources = genPackage.getAnnotationSources().iterator(); sources.hasNext();) { String annotationSource = (String)sources.next(); + if (!annotationSource.equals(extendedMetaDataSource)) { + EAnnotation globalAnnotation = genFeature.getEcoreFeature().getEAnnotation(annotationSource); + if (globalAnnotation != null) { + for (Iterator k = globalAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel); + stringBuffer.append(TEXT_208); + stringBuffer.append(annotationSource); + stringBuffer.append(TEXT_209); + stringBuffer.append(key); + stringBuffer.append(TEXT_210); + stringBuffer.append(value); + stringBuffer.append(genModel.getNonNLS(key + value)); + stringBuffer.append(TEXT_211); + } + stringBuffer.append(TEXT_212); + } + } + stringBuffer.append(TEXT_213); + } + } + } else { + stringBuffer.append(TEXT_214); + stringBuffer.append(genClassifier.getSafeUncapName()); + stringBuffer.append(TEXT_215); + stringBuffer.append(genClass.getLocalFeatureIndex(genFeature)); + stringBuffer.append(TEXT_216); + for (Iterator k = featureAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel); + stringBuffer.append(TEXT_217); + stringBuffer.append(key); + stringBuffer.append(TEXT_218); + stringBuffer.append(value); + stringBuffer.append(k.hasNext() ? "," : ""); + stringBuffer.append(genModel.getNonNLS(key + value)); + } + stringBuffer.append(TEXT_219); + } + } + } + } + stringBuffer.append(TEXT_220); + for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next(); + if (genDataType.isSerializable()) { + stringBuffer.append(TEXT_221); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_222); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_223); + if (genDataType instanceof GenEnum) { + stringBuffer.append(TEXT_224); + stringBuffer.append(((GenEnum)genDataType).getImportedInstanceClassName()); + stringBuffer.append(TEXT_225); + stringBuffer.append(((GenEnum)genDataType).getImportedInstanceClassName()); + stringBuffer.append(TEXT_226); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(genModel.getNonNLS(2)); + stringBuffer.append(genModel.getNonNLS(3)); + stringBuffer.append(TEXT_227); + } else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); + if (genBaseType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_228); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_229); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_230); + } else { + stringBuffer.append(TEXT_231); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_232); + stringBuffer.append(SDOGenUtil.getFactoryImpl(genBaseType.getGenPackage())); + stringBuffer.append(TEXT_233); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_234); + } + } else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); + stringBuffer.append(TEXT_235); + stringBuffer.append(genModel.getImportedName("java.util.List")); + stringBuffer.append(TEXT_236); + stringBuffer.append(genModel.getImportedName("java.util.ArrayList")); + stringBuffer.append(TEXT_237); + stringBuffer.append(genModel.getImportedName("java.util.StringTokenizer")); + stringBuffer.append(TEXT_238); + stringBuffer.append(genModel.getImportedName("java.util.StringTokenizer")); + stringBuffer.append(TEXT_239); + if (genItemType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_240); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_241); + } else { + stringBuffer.append(TEXT_242); + stringBuffer.append(SDOGenUtil.getFactoryImpl(genItemType.getGenPackage())); + stringBuffer.append(TEXT_243); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_244); + } + stringBuffer.append(TEXT_245); + } else if (!genDataType.getMemberTypes().isEmpty()) { + stringBuffer.append(TEXT_246); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_247); + for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next(); + stringBuffer.append(TEXT_248); + if (genMemberType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_249); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_250); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_251); + } else { + stringBuffer.append(TEXT_252); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_253); + stringBuffer.append(SDOGenUtil.getFactoryImpl(genMemberType.getGenPackage())); + stringBuffer.append(TEXT_254); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_255); + } + stringBuffer.append(TEXT_256); + } + stringBuffer.append(TEXT_257); + } else if (genDataType.isArrayType()) { + stringBuffer.append(TEXT_258); + stringBuffer.append(genModel.getImportedName("java.lang.UnsupportedOperationException")); + stringBuffer.append(TEXT_259); + } else { + stringBuffer.append(TEXT_260); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_261); + stringBuffer.append(genDataType.getClassifierID()); + stringBuffer.append(TEXT_262); + } + stringBuffer.append(TEXT_263); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_264); + if (genDataType instanceof GenEnum) { + stringBuffer.append(TEXT_265); + } else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); + if (genBaseType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_266); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_267); + } else { + stringBuffer.append(TEXT_268); + stringBuffer.append(SDOGenUtil.getFactoryImpl(genBaseType.getGenPackage())); + stringBuffer.append(TEXT_269); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_270); + } + } else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); + stringBuffer.append(TEXT_271); + stringBuffer.append(genModel.getImportedName("java.util.List")); + stringBuffer.append(TEXT_272); + stringBuffer.append(genModel.getImportedName("java.util.List")); + stringBuffer.append(TEXT_273); + stringBuffer.append(genModel.getImportedName("java.lang.StringBuffer")); + stringBuffer.append(TEXT_274); + stringBuffer.append(genModel.getImportedName("java.lang.StringBuffer")); + stringBuffer.append(TEXT_275); + stringBuffer.append(genModel.getImportedName("java.util.Iterator")); + stringBuffer.append(TEXT_276); + if (genItemType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_277); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_278); + } else { + stringBuffer.append(TEXT_279); + stringBuffer.append(SDOGenUtil.getFactoryImpl(genItemType.getGenPackage())); + stringBuffer.append(TEXT_280); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_281); + } + stringBuffer.append(TEXT_282); + } else if (!genDataType.getMemberTypes().isEmpty()) { + stringBuffer.append(TEXT_283); + for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next(); + stringBuffer.append(TEXT_284); + stringBuffer.append(SDOGenUtil.getQualifiedTypeAccessor(genMemberType)); + stringBuffer.append(TEXT_285); + if (genMemberType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_286); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_287); + } else { + stringBuffer.append(TEXT_288); + stringBuffer.append(SDOGenUtil.getFactoryImpl(genMemberType.getGenPackage())); + stringBuffer.append(TEXT_289); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_290); + } + stringBuffer.append(TEXT_291); + } + stringBuffer.append(TEXT_292); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_293); + } else if (genDataType.isArrayType()) { + stringBuffer.append(TEXT_294); + stringBuffer.append(genModel.getImportedName("java.lang.UnsupportedOperationException")); + stringBuffer.append(TEXT_295); + } else { + stringBuffer.append(TEXT_296); + stringBuffer.append(genDataType.getClassifierID()); + stringBuffer.append(TEXT_297); + } + stringBuffer.append(TEXT_298); + } + } + } else { + for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next(); + if (genClass.hasFactoryInterfaceCreateMethod()) { + stringBuffer.append(TEXT_299); + stringBuffer.append(genClass.getFormattedName()); + stringBuffer.append(TEXT_300); + stringBuffer.append(genClass.getFormattedName()); + stringBuffer.append(TEXT_301); + stringBuffer.append(genClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_302); + stringBuffer.append(genClass.getName()); + stringBuffer.append(TEXT_303); + } + } + stringBuffer.append(TEXT_304); + if (genPackage.isDataTypeConverters()) { + for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next(); + if (genDataType.isSerializable()) { + stringBuffer.append(TEXT_305); + stringBuffer.append(genDataType.getFormattedName()); + stringBuffer.append(TEXT_306); + stringBuffer.append(genDataType.getImportedInstanceClassName()); + stringBuffer.append(TEXT_307); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_308); + stringBuffer.append(genDataType.getFormattedName()); + stringBuffer.append(TEXT_309); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_310); + stringBuffer.append(genDataType.getImportedInstanceClassName()); + stringBuffer.append(TEXT_311); + } + } + } + } + stringBuffer.append(TEXT_312); + stringBuffer.append(isInterface ? genPackage.getFactoryInterfaceName() : genPackage.getFactoryClassName()); + genModel.emitSortedImports(); + stringBuffer.append(TEXT_313); + return stringBuffer.toString(); + } +} diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/util/SDOGenUtil.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/util/SDOGenUtil.java new file mode 100644 index 0000000000..062580f4b8 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/apache/tuscany/sdo/generate/util/SDOGenUtil.java @@ -0,0 +1,326 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sdo.generate.util; + +import java.util.Iterator; + +import org.apache.tuscany.sdo.model.ModelFactory; +import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl; +import org.eclipse.emf.codegen.ecore.genmodel.GenClass; +import org.eclipse.emf.codegen.ecore.genmodel.GenClassifier; +import org.eclipse.emf.codegen.ecore.genmodel.GenDataType; +import org.eclipse.emf.codegen.ecore.genmodel.GenDelegationKind; +import org.eclipse.emf.codegen.ecore.genmodel.GenFeature; +import org.eclipse.emf.codegen.ecore.genmodel.GenModel; +import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; +import org.eclipse.emf.codegen.ecore.genmodel.impl.GenFeatureImpl; +import org.eclipse.emf.codegen.ecore.genmodel.impl.Literals; +import org.eclipse.emf.codegen.util.CodeGenUtil; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EcorePackage; + +import commonj.sdo.Type; + +public class SDOGenUtil { + + public static String getQualifiedTypeAccessor(GenClassifier genClassifier) + { + GenPackage genPackage = genClassifier.getGenPackage(); + return getFactoryImpl(genPackage) + ".get" + genClassifier.getClassifierAccessorName() + "()"; + } + + public static String getDependentFactoryArgumentList(GenPackage genPackage, boolean isFormalArguments) + { + StringBuffer result = new StringBuffer(); + for (Iterator iter = genPackage.getPackageInitializationDependencies().iterator(); iter.hasNext(); ) + { + GenPackage dep = (GenPackage)iter.next(); + if (isFormalArguments) + { + result.append(dep.getImportedFactoryClassName()); + result.append(" "); + } + result.append(genPackage.getPackageInstanceVariable(dep)); + if (iter.hasNext()) result.append(", "); + } + return result.toString(); + } + + public static String getFactoryImpl(GenPackage genPackage) + { + return "((" + genPackage.getImportedFactoryClassName() + ")" + + genPackage.getImportedFactoryInterfaceName() + ".INSTANCE)"; + } + + public static String getListKind(GenFeature genFeature, boolean suppressNotification ) + { + boolean unsettable = genFeature.isUnsettable(); + + if (suppressNotification) + { + return "ListKind.BASIC"; + } + else if (genFeature.isEffectiveContains()) + { + if (genFeature.isBidirectional()) + { + if (genFeature.isResolveProxies()) + { + if( unsettable ) + return "ListKind.CONTAINMENT_INVERSE_RESOLVING_UNSETTABLE"; + else + return "ListKind.CONTAINMENT_INVERSE_RESOLVING"; + } + else + { + if( unsettable ) + return "ListKind.CONTAINMENT_INVERSE_UNSETTABLE"; + else + return "ListKind.CONTAINMENT_INVERSE"; + } + } + else + { + if (genFeature.isResolveProxies()) + { + if( unsettable ) + return "ListKind.CONTAINMENT_RESOLVING_UNSETTABLE"; + else + return "ListKind.CONTAINMENT_RESOLVING"; + } + else + { + if( unsettable ) + return "ListKind.CONTAINMENT_UNSETTABLE"; + else + return "ListKind.CONTAINMENT"; + } + } + } + else if (genFeature.isReferenceType()) + { + if (genFeature.isBidirectional()) + { + GenFeature reverseFeature = genFeature.getReverse(); + if (genFeature.isResolveProxies()) + { + if (reverseFeature.isListType()) + { + if( unsettable ) + return "ListKind.NONCONTAINMENT_MANYINVERSE_RESOLVING_UNSETTABLE"; + else + return "ListKind.NONCONTAINMENT_MANYINVERSE_RESOLVING"; + } + else + { + if( unsettable ) + return "ListKind.NONCONTAINMENT_INVERSE_RESOLVING_UNSETTABLE"; + else + return "ListKind.NONCONTAINMENT_INVERSE_RESOLVING"; + } + } + else + { + if (reverseFeature.isListType()) + { + if( unsettable ) + return "ListKind.NONCONTAINMENT_MANYINVERSE_UNSETTABLE"; + else + return "ListKind.NONCONTAINMENT_MANYINVERSE"; + } + else + { + if( unsettable ) + return "ListKind.NONCONTAINMENT_INVERSE_UNSETTABLE"; + else + return "ListKind.NONCONTAINMENT_INVERSE"; + } + } + } + else + { + if (genFeature.isResolveProxies()) + { + if( unsettable ) + return "ListKind.NONCONTAINMENT_RESOLVING_UNSETTABLE"; + else + return "ListKind.NONCONTAINMENT_RESOLVING"; + } + else + { + if( unsettable ) + return "ListKind.NONCONTAINMENT_UNSETTABLE"; + else + return "ListKind.NONCONTAINMENT"; + } + } + } + else + { //datatype + if (genFeature.isUnique()) + { + if( unsettable ) + return "ListKind.DATATYPE_UNIQUE_UNSETTABLE"; + else + return "ListKind.DATATYPE_UNIQUE"; + } + else + { + if( unsettable ) + return "ListKind.DATATYPE_UNSETTABLE"; + else + return "ListKind.DATATYPE"; + } + } + } + + public static boolean hasChangeSummaryProperty(GenClass genClass) + { + return getChangeSummaryProperty(genClass) != null; + } + + public static String getQualifiedInternalPropertyID(GenFeature genFeature) + { + return genFeature.getGenClass().getImportedClassName() + ".INTERNAL_" + genFeature.getUpperName(); + } + + public static String getChangeSummaryProperty(GenClass genClass) + { + Type csType = ((ModelFactoryImpl)ModelFactory.INSTANCE).getChangeSummaryType(); + for (Iterator i = genClass.getGenFeatures().iterator(); i.hasNext(); ) + { + GenFeature genFeature = (GenFeature)i.next(); + EClassifier eClassifier = genFeature.getEcoreFeature().getEType(); + if (eClassifier instanceof Type) + { + Type type = (Type)eClassifier; + //if (csType == type)// this doesn't work when generating sdoModel.xsd + if (csType.getName().equals(type.getName()) && csType.getURI().equals(type.getURI())) + { + return genFeature.getUpperName(); + } + } + } + return null; + } + + public static String printArguments(GenPackage genPackage, GenModel genModel) { + StringBuffer result = new StringBuffer(); + if(!CodeGenUtil.capName(genPackage.getNSName()).equals(genPackage.getPrefix())) { + result.append(" -prefix " + genPackage.getPrefix()); + } + if (genModel.isSuppressInterfaces()) { + result.append(" -noInterfaces"); + } + if ( genModel.getFeatureDelegation() == GenDelegationKind.VIRTUAL_LITERAL) { + result.append(" -sparsePattern"); + } + if ("org.apache.tuscany.sdo.impl.StoreDataObjectImpl".equals(genModel.getRootExtendsClass())) { + result.append(" -storePattern"); + } + if (genModel.isSuppressNotification()) { + result.append(" -noNotification"); + } + if (genModel.isSuppressContainment()) { + result.append(" -noContainment"); + } + if (genModel.isArrayAccessors()) { + result.append(" -arrayAccessors"); + } + if (genModel.isSuppressUnsettable()) { + result.append(" -noUnsettable"); + } + + return result.toString(); + } + + /* + * EMF doesn't do what we want in all cases, so filter the cases we need to handle + * and drop through to EMF for all others. + */ + public static String getStaticDefaultValue(GenFeature genFeature) { + String result = "null"; + boolean defaultFound = false; + + String defaultString = genFeature.getEcoreFeature() + .getDefaultValueLiteral(); + EClassifier eType = genFeature.getEcoreFeature().getEType(); + if (eType instanceof EDataType) { + GenPackage genPackage = ((GenFeatureImpl) genFeature) + .findGenPackage(genFeature.getEcoreFeature().getEType().getEPackage()); + GenDataType gdt = null; + if (genPackage != null) { + for (Iterator iter = genPackage.getGenDataTypes().iterator(); iter + .hasNext() + && gdt == null;) { + GenDataType genDataType = (GenDataType) iter.next(); + if (eType.getName().equals(genDataType.getEcoreDataType().getName())) { + gdt = genDataType; + } + } + } + EClassifier eDataType = gdt.getEcoreDataType(); + if (eDataType.getEPackage() != EcorePackage.eINSTANCE + && defaultString != null) { + boolean replaced = false; + for (Iterator i = EcorePackage.eINSTANCE.getEClassifiers().iterator(); i + .hasNext();) { + EClassifier eClassifier = (EClassifier) i.next(); + if (eClassifier instanceof EDataType + && eClassifier.getInstanceClassName().equals( + eDataType.getInstanceClassName()) + && ((EDataType) eClassifier).isSerializable() + && eClassifier != EcorePackage.eINSTANCE.getEDate()) { + replaced = true; + eDataType = eClassifier; + break; + } + } + if (!replaced) { + result = "((" + genPackage.getFactoryClassName() + ")" + + genPackage.getFactoryInterfaceName() + "." + + genPackage.getFactoryInstanceName() + ")." + "create" + + gdt.getName() + "FromString(" + + Literals.toLiteral(defaultString) + ")"; + + + if (gdt.isPrimitiveType()) + { + result = "((" + gdt.getObjectInstanceClassName() + ")" + result + + ")." + gdt.getPrimitiveValueFunction() + "()"; + } else if (!gdt.isObjectType()) { + result = "(" + gdt.getImportedInstanceClassName() + ")" + result; + } + + defaultFound = true; + } + } + } + + if (!defaultFound) { + // the input didn't match any special case that we want to handle differently + // from EMF's default approach, so go ahead and get EMF to do it + result = genFeature.getStaticDefaultValue(); + } + + return result; + } +} diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/eclipse/jdt/core/formatter/CodeFormatter.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/eclipse/jdt/core/formatter/CodeFormatter.java new file mode 100644 index 0000000000..1c1f37682f --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/java/org/eclipse/jdt/core/formatter/CodeFormatter.java @@ -0,0 +1,27 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +/******************************************************************************* + * TEMPORARY dummy file to work around EMF generator dependency problem. + * This file will be deleted as soon as the EMF generator is fixed. + *******************************************************************************/ +package org.eclipse.jdt.core.formatter; + +public abstract class CodeFormatter { +} diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/DISCLAIMER b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/DISCLAIMER new file mode 100644 index 0000000000..a65af91c5a --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/DISCLAIMER @@ -0,0 +1,7 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. \ No newline at end of file diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/LICENSE.txt b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..9a90d375bc --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,207 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + + + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/MANIFEST.MF b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..8bb7dea1fe --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Extension-Name: tuscany-sdo-tools +Specification-Title: Tuscany SDO Tools Implementation +Specification-Vendor: Apache Software Foundation +Implementation-Vendor: Apache Software Foundation +Implementation-Vendor-Id: org.apache +Implementation-Title: tuscany-sdo-tools +Implementation-Version: incubating-M3 +Bundle-ManifestVersion: 2 +Bundle-Name: Tuscany SDO Tools Implementation +Bundle-SymbolicName: org.apache.tuscany.sdo.tools +Bundle-Version: 1.0.0 +Bundle-Vendor: Apache Software Foundation +Require-Bundle: org.eclipse.emf.common, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore.change, + org.eclipse.emf.ecore.xmi, + org.eclipse.xsd, + org.apache.tuscany.sdo.spec;visibility:=reexport +Export-Package: org.apache.tuscany.sdo.generate, + org.apache.tuscany.sdo.generate.util diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/NOTICE b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..9f9572a167 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/NOTICE @@ -0,0 +1,7 @@ +Apache Tuscany +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/README.txt b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..1b8144f7c5 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/main/resources/META-INF/README.txt @@ -0,0 +1,23 @@ +Apache Tuscany 1.1-incubating build (April 2008) +================================================ + +http://incubator.apache.org/tuscany/ + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/RCType.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/RCType.java new file mode 100644 index 0000000000..29a558b5a2 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/RCType.java @@ -0,0 +1,103 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.repchoice; + +import commonj.sdo.Sequence; + +import java.io.Serializable; + +import java.util.List; + +/** + * + * A representation of the model object 'RC Type'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link com.example.repchoice.RCType#getGroup Group}
  • + *
  • {@link com.example.repchoice.RCType#getS S}
  • + *
  • {@link com.example.repchoice.RCType#getI I}
  • + *
  • {@link com.example.repchoice.RCType#getF F}
  • + *
+ *

+ * + * @extends Serializable + * @generated + */ +public interface RCType extends Serializable +{ + /** + * Returns the value of the 'Group' attribute list. + * + *

+ * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'S' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'S' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'S' attribute list. + * @generated + */ + List getS(); + + /** + * Returns the value of the 'I' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

+ * If the meaning of the 'I' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'I' attribute list. + * @generated + */ + List getI(); + + /** + * Returns the value of the 'F' attribute list. + * The list contents are of type {@link java.lang.Float}. + * + *

+ * If the meaning of the 'F' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'F' attribute list. + * @generated + */ + List getF(); + +} // RCType diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/RepchoiceFactory.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/RepchoiceFactory.java new file mode 100644 index 0000000000..9a7c3033a5 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/RepchoiceFactory.java @@ -0,0 +1,61 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.repchoice; + +import commonj.sdo.helper.HelperContext; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface RepchoiceFactory +{ + + /** + * The singleton instance of the factory. + * + * + * @generated + */ + RepchoiceFactory INSTANCE = com.example.repchoice.impl.RepchoiceFactoryImpl.init(); + + /** + * Returns a new object of class 'RC Type'. + * + * + * @return a new object of class 'RC Type'. + * @generated + */ + RCType createRCType(); + + /** + * Registers the types supported by this Factory within the supplied scope.argument + * + * + * @param scope an instance of HelperContext used to manage the scoping of types. + * @generated + */ + public void register(HelperContext scope); + +} //RepchoiceFactory diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/impl/RCTypeImpl.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/impl/RCTypeImpl.java new file mode 100644 index 0000000000..322dc5a8e0 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/impl/RCTypeImpl.java @@ -0,0 +1,332 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.repchoice.impl; + +import com.example.repchoice.RCType; +import com.example.repchoice.RepchoiceFactory; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * + * An implementation of the model object 'RC Type'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link com.example.repchoice.impl.RCTypeImpl#getGroup Group}
  • + *
  • {@link com.example.repchoice.impl.RCTypeImpl#getS S}
  • + *
  • {@link com.example.repchoice.impl.RCTypeImpl#getI I}
  • + *
  • {@link com.example.repchoice.impl.RCTypeImpl#getF F}
  • + *
+ *

+ * + * @generated + */ +public class RCTypeImpl extends DataObjectBase implements RCType +{ + + public final static int GROUP = -1; + + public final static int S = 0; + + public final static int I = 1; + + public final static int F = 2; + + public final static int SDO_PROPERTY_COUNT = 3; + + public final static int EXTENDED_PROPERTY_COUNT = -1; + + + /** + * The internal feature id for the 'Group' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_GROUP = 0; + + /** + * The internal feature id for the 'S' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_S = 1; + + /** + * The internal feature id for the 'I' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_I = 2; + + /** + * The internal feature id for the 'F' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_F = 3; + + /** + * The number of properties for this type. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 4; + + protected int internalConvertIndex(int internalIndex) + { + switch (internalIndex) + { + case INTERNAL_GROUP: return GROUP; + case INTERNAL_S: return S; + case INTERNAL_I: return I; + case INTERNAL_F: return F; + } + return super.internalConvertIndex(internalIndex); + } + + + /** + * The cached value of the '{@link #getGroup() Group}' attribute list. + * + * + * @see #getGroup() + * @generated + * @ordered + */ + + protected Sequence group = null; + + /** + * + * + * @generated + */ + public RCTypeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getStaticType() + { + return ((RepchoiceFactoryImpl)RepchoiceFactory.INSTANCE).getRCType(); + } + + /** + * + * + * @generated + */ + public int getStaticPropertyCount() + { + return INTERNAL_PROPERTY_COUNT; + } + + /** + * + * + * @generated + */ + public Sequence getGroup() + { + if (group == null) + { + group = createSequence(INTERNAL_GROUP); + } + return group; + } + /** + * + * + * @generated + */ + public List getS() + { + return getList(getGroup(), getType(), INTERNAL_S); + } + /** + * + * + * @generated + */ + public List getI() + { + return getList(getGroup(), getType(), INTERNAL_I); + } + /** + * + * + * @generated + */ + public List getF() + { + return getList(getGroup(), getType(), INTERNAL_F); + } + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case GROUP: + return removeFromSequence(getGroup(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case GROUP: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup(); + case S: + return getS(); + case I: + return getI(); + case F: + return getF(); + } + return super.get(propertyIndex, resolve); + } + + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case GROUP: + setSequence(getGroup(), newValue); + return; + case S: + getS().clear(); + getS().addAll((Collection)newValue); + return; + case I: + getI().clear(); + getI().addAll((Collection)newValue); + return; + case F: + getF().clear(); + getF().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case GROUP: + unsetSequence(getGroup()); + return; + case S: + getS().clear(); + return; + case I: + getI().clear(); + return; + case F: + getF().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case GROUP: + return group != null && !isSequenceEmpty(getGroup()); + case S: + return !getS().isEmpty(); + case I: + return !getI().isEmpty(); + case F: + return !getF().isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy(this)) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (group: "); + result.append(group); + result.append(')'); + return result.toString(); + } + +} //RCTypeImpl diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/impl/RepchoiceFactoryImpl.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/impl/RepchoiceFactoryImpl.java new file mode 100644 index 0000000000..40d3e9eeec --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/repchoice/impl/RepchoiceFactoryImpl.java @@ -0,0 +1,269 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.repchoice.impl; + +import commonj.sdo.helper.HelperContext; +import org.apache.tuscany.sdo.helper.TypeHelperImpl; + +import com.example.repchoice.*; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +import org.apache.tuscany.sdo.impl.FactoryBase; + +import org.apache.tuscany.sdo.model.ModelFactory; + +import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl; + +/** + * + * An implementation of the model Factory. + * Generator information: + * patternVersion=1.2; + * + * @generated + */ +public class RepchoiceFactoryImpl extends FactoryBase implements RepchoiceFactory +{ + + /** + * The package namespace URI. + * + * + * @generated + */ + public static final String NAMESPACE_URI = "http://www.example.com/repchoice"; + + /** + * The package namespace name. + * + * + * @generated + */ + public static final String NAMESPACE_PREFIX = "repchoice"; + + /** + * The version of the generator pattern used to generate this class. + * + * + * @generated + */ + public static final String PATTERN_VERSION = "1.2"; + + public static final int RC_TYPE = 1; + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public RepchoiceFactoryImpl() + { + super(NAMESPACE_URI, NAMESPACE_PREFIX, "com.example.repchoice"); + } + + /** + * Registers the Factory instance so that it is available within the supplied scope. + * @argument scope a HelperContext instance that will make the types supported by this Factory available. + * + * + * @generated + */ + public void register(HelperContext scope) + { + if(scope == null) { + throw new IllegalArgumentException("Scope can not be null"); + } + + //Register dependent packages with provided scope + ModelFactory.INSTANCE.register(scope); + + // Initialize this package + TypeHelperImpl th = (TypeHelperImpl)scope.getTypeHelper(); + th.getExtendedMetaData().putPackage(NAMESPACE_URI, this); + } + + /** + * + * + * @generated + */ + public DataObject create(int typeNumber) + { + switch (typeNumber) + { + case RC_TYPE: return (DataObject)createRCType(); + default: + return super.create(typeNumber); + } + } + + /** + * + * + * @generated + */ + public RCType createRCType() + { + RCTypeImpl rcType = new RCTypeImpl(); + return rcType; + } + + // Following creates and initializes SDO metadata for the supported types. + protected Type rcTypeType = null; + + public Type getRCType() + { + return rcTypeType; + } + + + private static RepchoiceFactoryImpl instance = null; + public static RepchoiceFactoryImpl init() + { + if (instance != null ) return instance; + instance = new RepchoiceFactoryImpl(); + + // Initialize dependent packages + ModelFactory ModelFactoryInstance = ModelFactory.INSTANCE; + + // Create package meta-data objects + instance.createMetaData(); + + // Initialize created meta-data + instance.initializeMetaData(); + + // Mark meta-data to indicate it can't be changed + //theRepchoiceFactoryImpl.freeze(); //FB do we need to freeze / should we freeze ???? + + return instance; + } + + private boolean isCreated = false; + + public void createMetaData() + { + if (isCreated) return; + isCreated = true; + + // Create types and their properties + rcTypeType = createType(false, RC_TYPE); + createProperty(true, rcTypeType,RCTypeImpl.INTERNAL_GROUP); + createProperty(true, rcTypeType,RCTypeImpl.INTERNAL_S); + createProperty(true, rcTypeType,RCTypeImpl.INTERNAL_I); + createProperty(true, rcTypeType,RCTypeImpl.INTERNAL_F); + } + + private boolean isInitialized = false; + + public void initializeMetaData() + { + if (isInitialized) return; + isInitialized = true; + + // Obtain other dependent packages + ModelFactoryImpl theModelPackageImpl = (ModelFactoryImpl)ModelFactory.INSTANCE; + Property property = null; + + // Add supertypes to types + + // Initialize types and properties + initializeType(rcTypeType, RCType.class, "RCType", false); + property = getLocalProperty(rcTypeType, 0); + initializeProperty(property, getSequence(), "group", null, 0, -1, RCType.class, false, false, false); + + property = getLocalProperty(rcTypeType, 1); + initializeProperty(property, theModelPackageImpl.getString(), "s", null, 0, -1, RCType.class, false, false, true); + + property = getLocalProperty(rcTypeType, 2); + initializeProperty(property, theModelPackageImpl.getInt(), "i", null, 0, -1, RCType.class, false, false, true); + + property = getLocalProperty(rcTypeType, 3); + initializeProperty(property, theModelPackageImpl.getFloat(), "f", null, 0, -1, RCType.class, false, false, true); + + createXSDMetaData(theModelPackageImpl); + } + + protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl) + { + super.initXSD(); + + Property property = null; + + + property = createGlobalProperty + ("rc", + this.getRCType(), + new String[] + { + "kind", "element", + "name", "rc", + "namespace", "##targetNamespace" + }); + + addXSDMapping + (rcTypeType, + new String[] + { + "name", "RCType", + "kind", "elementOnly" + }); + + addXSDMapping + (getProperty(rcTypeType, RCTypeImpl.INTERNAL_GROUP), + new String[] + { + "kind", "group", + "name", "group:0" + }); + + addXSDMapping + (getProperty(rcTypeType, RCTypeImpl.INTERNAL_S), + new String[] + { + "kind", "element", + "name", "s", + "group", "#group:0" + }); + + addXSDMapping + (getProperty(rcTypeType, RCTypeImpl.INTERNAL_I), + new String[] + { + "kind", "element", + "name", "i", + "group", "#group:0" + }); + + addXSDMapping + (getProperty(rcTypeType, RCTypeImpl.INTERNAL_F), + new String[] + { + "kind", "element", + "name", "f", + "group", "#group:0" + }); + + } + +} //RepchoiceFactoryImpl diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/MixedQuote.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/MixedQuote.java new file mode 100644 index 0000000000..f1882ba616 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/MixedQuote.java @@ -0,0 +1,491 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences; + +import commonj.sdo.Sequence; + +import java.io.Serializable; + +import java.math.BigDecimal; + +import java.util.List; + +/** + * + * A representation of the model object 'Mixed Quote'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link com.example.sequences.MixedQuote#getMixed Mixed}
  • + *
  • {@link com.example.sequences.MixedQuote#getSymbol Symbol}
  • + *
  • {@link com.example.sequences.MixedQuote#getCompanyName Company Name}
  • + *
  • {@link com.example.sequences.MixedQuote#getPrice Price}
  • + *
  • {@link com.example.sequences.MixedQuote#getOpen1 Open1}
  • + *
  • {@link com.example.sequences.MixedQuote#getHigh High}
  • + *
  • {@link com.example.sequences.MixedQuote#getLow Low}
  • + *
  • {@link com.example.sequences.MixedQuote#getVolume Volume}
  • + *
  • {@link com.example.sequences.MixedQuote#getChange1 Change1}
  • + *
  • {@link com.example.sequences.MixedQuote#getQuotes Quotes}
  • + *
+ *

+ * + * @extends Serializable + * @generated + */ +public interface MixedQuote extends Serializable +{ + /** + * Returns the value of the 'Mixed' attribute list. + * + *

+ * If the meaning of the 'Mixed' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Mixed' attribute list. + * @generated + */ + Sequence getMixed(); + + /** + * Returns the value of the 'Symbol' attribute. + * + *

+ * If the meaning of the 'Symbol' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Symbol' attribute. + * @see #isSetSymbol() + * @see #unsetSymbol() + * @see #setSymbol(String) + * @generated + */ + String getSymbol(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getSymbol Symbol}' attribute. + * + * + * @param value the new value of the 'Symbol' attribute. + * @see #isSetSymbol() + * @see #unsetSymbol() + * @see #getSymbol() + * @generated + */ + void setSymbol(String value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getSymbol Symbol}' attribute. + * + * + * @see #isSetSymbol() + * @see #getSymbol() + * @see #setSymbol(String) + * @generated + */ + void unsetSymbol(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getSymbol Symbol}' attribute is set. + * + * + * @return whether the value of the 'Symbol' attribute is set. + * @see #unsetSymbol() + * @see #getSymbol() + * @see #setSymbol(String) + * @generated + */ + boolean isSetSymbol(); + + /** + * Returns the value of the 'Company Name' attribute. + * + *

+ * If the meaning of the 'Company Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Company Name' attribute. + * @see #isSetCompanyName() + * @see #unsetCompanyName() + * @see #setCompanyName(String) + * @generated + */ + String getCompanyName(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getCompanyName Company Name}' attribute. + * + * + * @param value the new value of the 'Company Name' attribute. + * @see #isSetCompanyName() + * @see #unsetCompanyName() + * @see #getCompanyName() + * @generated + */ + void setCompanyName(String value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getCompanyName Company Name}' attribute. + * + * + * @see #isSetCompanyName() + * @see #getCompanyName() + * @see #setCompanyName(String) + * @generated + */ + void unsetCompanyName(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getCompanyName Company Name}' attribute is set. + * + * + * @return whether the value of the 'Company Name' attribute is set. + * @see #unsetCompanyName() + * @see #getCompanyName() + * @see #setCompanyName(String) + * @generated + */ + boolean isSetCompanyName(); + + /** + * Returns the value of the 'Price' attribute. + * + *

+ * If the meaning of the 'Price' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Price' attribute. + * @see #isSetPrice() + * @see #unsetPrice() + * @see #setPrice(BigDecimal) + * @generated + */ + BigDecimal getPrice(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getPrice Price}' attribute. + * + * + * @param value the new value of the 'Price' attribute. + * @see #isSetPrice() + * @see #unsetPrice() + * @see #getPrice() + * @generated + */ + void setPrice(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getPrice Price}' attribute. + * + * + * @see #isSetPrice() + * @see #getPrice() + * @see #setPrice(BigDecimal) + * @generated + */ + void unsetPrice(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getPrice Price}' attribute is set. + * + * + * @return whether the value of the 'Price' attribute is set. + * @see #unsetPrice() + * @see #getPrice() + * @see #setPrice(BigDecimal) + * @generated + */ + boolean isSetPrice(); + + /** + * Returns the value of the 'Open1' attribute. + * + *

+ * If the meaning of the 'Open1' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Open1' attribute. + * @see #isSetOpen1() + * @see #unsetOpen1() + * @see #setOpen1(BigDecimal) + * @generated + */ + BigDecimal getOpen1(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getOpen1 Open1}' attribute. + * + * + * @param value the new value of the 'Open1' attribute. + * @see #isSetOpen1() + * @see #unsetOpen1() + * @see #getOpen1() + * @generated + */ + void setOpen1(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getOpen1 Open1}' attribute. + * + * + * @see #isSetOpen1() + * @see #getOpen1() + * @see #setOpen1(BigDecimal) + * @generated + */ + void unsetOpen1(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getOpen1 Open1}' attribute is set. + * + * + * @return whether the value of the 'Open1' attribute is set. + * @see #unsetOpen1() + * @see #getOpen1() + * @see #setOpen1(BigDecimal) + * @generated + */ + boolean isSetOpen1(); + + /** + * Returns the value of the 'High' attribute. + * + *

+ * If the meaning of the 'High' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'High' attribute. + * @see #isSetHigh() + * @see #unsetHigh() + * @see #setHigh(BigDecimal) + * @generated + */ + BigDecimal getHigh(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getHigh High}' attribute. + * + * + * @param value the new value of the 'High' attribute. + * @see #isSetHigh() + * @see #unsetHigh() + * @see #getHigh() + * @generated + */ + void setHigh(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getHigh High}' attribute. + * + * + * @see #isSetHigh() + * @see #getHigh() + * @see #setHigh(BigDecimal) + * @generated + */ + void unsetHigh(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getHigh High}' attribute is set. + * + * + * @return whether the value of the 'High' attribute is set. + * @see #unsetHigh() + * @see #getHigh() + * @see #setHigh(BigDecimal) + * @generated + */ + boolean isSetHigh(); + + /** + * Returns the value of the 'Low' attribute. + * + *

+ * If the meaning of the 'Low' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Low' attribute. + * @see #isSetLow() + * @see #unsetLow() + * @see #setLow(BigDecimal) + * @generated + */ + BigDecimal getLow(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getLow Low}' attribute. + * + * + * @param value the new value of the 'Low' attribute. + * @see #isSetLow() + * @see #unsetLow() + * @see #getLow() + * @generated + */ + void setLow(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getLow Low}' attribute. + * + * + * @see #isSetLow() + * @see #getLow() + * @see #setLow(BigDecimal) + * @generated + */ + void unsetLow(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getLow Low}' attribute is set. + * + * + * @return whether the value of the 'Low' attribute is set. + * @see #unsetLow() + * @see #getLow() + * @see #setLow(BigDecimal) + * @generated + */ + boolean isSetLow(); + + /** + * Returns the value of the 'Volume' attribute. + * + *

+ * If the meaning of the 'Volume' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Volume' attribute. + * @see #isSetVolume() + * @see #unsetVolume() + * @see #setVolume(double) + * @generated + */ + double getVolume(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getVolume Volume}' attribute. + * + * + * @param value the new value of the 'Volume' attribute. + * @see #isSetVolume() + * @see #unsetVolume() + * @see #getVolume() + * @generated + */ + void setVolume(double value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getVolume Volume}' attribute. + * + * + * @see #isSetVolume() + * @see #getVolume() + * @see #setVolume(double) + * @generated + */ + void unsetVolume(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getVolume Volume}' attribute is set. + * + * + * @return whether the value of the 'Volume' attribute is set. + * @see #unsetVolume() + * @see #getVolume() + * @see #setVolume(double) + * @generated + */ + boolean isSetVolume(); + + /** + * Returns the value of the 'Change1' attribute. + * + *

+ * If the meaning of the 'Change1' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Change1' attribute. + * @see #isSetChange1() + * @see #unsetChange1() + * @see #setChange1(double) + * @generated + */ + double getChange1(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getChange1 Change1}' attribute. + * + * + * @param value the new value of the 'Change1' attribute. + * @see #isSetChange1() + * @see #unsetChange1() + * @see #getChange1() + * @generated + */ + void setChange1(double value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getChange1 Change1}' attribute. + * + * + * @see #isSetChange1() + * @see #getChange1() + * @see #setChange1(double) + * @generated + */ + void unsetChange1(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getChange1 Change1}' attribute is set. + * + * + * @return whether the value of the 'Change1' attribute is set. + * @see #unsetChange1() + * @see #getChange1() + * @see #setChange1(double) + * @generated + */ + boolean isSetChange1(); + + /** + * Returns the value of the 'Quotes' containment reference list. + * The list contents are of type {@link com.example.sequences.MixedQuote}. + * + *

+ * If the meaning of the 'Quotes' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Quotes' containment reference list. + * @generated + */ + List getQuotes(); + +} // MixedQuote diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java new file mode 100644 index 0000000000..dba64b0487 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java @@ -0,0 +1,102 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences; + +import commonj.sdo.Sequence; + +import java.io.Serializable; + +import java.util.List; + +/** + * + * A representation of the model object 'Mixed Repeating Choice'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link com.example.sequences.MixedRepeatingChoice#getMixed Mixed}
  • + *
  • {@link com.example.sequences.MixedRepeatingChoice#getGroup Group}
  • + *
  • {@link com.example.sequences.MixedRepeatingChoice#getA A}
  • + *
  • {@link com.example.sequences.MixedRepeatingChoice#getB B}
  • + *
+ *

+ * + * @extends Serializable + * @generated + */ +public interface MixedRepeatingChoice extends Serializable +{ + /** + * Returns the value of the 'Mixed' attribute list. + * + *

+ * If the meaning of the 'Mixed' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Mixed' attribute list. + * @generated + */ + Sequence getMixed(); + + /** + * Returns the value of the 'Group' attribute list. + * + *

+ * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

+ * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + +} // MixedRepeatingChoice diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/RepeatingChoice.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/RepeatingChoice.java new file mode 100644 index 0000000000..3f0b0839f2 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/RepeatingChoice.java @@ -0,0 +1,88 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences; + +import commonj.sdo.Sequence; + +import java.io.Serializable; + +import java.util.List; + +/** + * + * A representation of the model object 'Repeating Choice'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link com.example.sequences.RepeatingChoice#getGroup Group}
  • + *
  • {@link com.example.sequences.RepeatingChoice#getA A}
  • + *
  • {@link com.example.sequences.RepeatingChoice#getB B}
  • + *
+ *

+ * + * @extends Serializable + * @generated + */ +public interface RepeatingChoice extends Serializable +{ + /** + * Returns the value of the 'Group' attribute list. + * + *

+ * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

+ * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + +} // RepeatingChoice diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/SequencesFactory.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/SequencesFactory.java new file mode 100644 index 0000000000..900b51ddc3 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/SequencesFactory.java @@ -0,0 +1,97 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences; + +import commonj.sdo.helper.HelperContext; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface SequencesFactory +{ + + /** + * The singleton instance of the factory. + * + * + * @generated + */ + SequencesFactory INSTANCE = com.example.sequences.impl.SequencesFactoryImpl.init(); + + /** + * Returns a new object of class 'Mixed Quote'. + * + * + * @return a new object of class 'Mixed Quote'. + * @generated + */ + MixedQuote createMixedQuote(); + + /** + * Returns a new object of class 'Mixed Repeating Choice'. + * + * + * @return a new object of class 'Mixed Repeating Choice'. + * @generated + */ + MixedRepeatingChoice createMixedRepeatingChoice(); + + /** + * Returns a new object of class 'Repeating Choice'. + * + * + * @return a new object of class 'Repeating Choice'. + * @generated + */ + RepeatingChoice createRepeatingChoice(); + + /** + * Returns a new object of class 'Two RCs'. + * + * + * @return a new object of class 'Two RCs'. + * @generated + */ + TwoRCs createTwoRCs(); + + /** + * Returns a new object of class 'Two RCs Mixed'. + * + * + * @return a new object of class 'Two RCs Mixed'. + * @generated + */ + TwoRCsMixed createTwoRCsMixed(); + + /** + * Registers the types supported by this Factory within the supplied scope.argument + * + * + * @param scope an instance of HelperContext used to manage the scoping of types. + * @generated + */ + public void register(HelperContext scope); + +} //SequencesFactory diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/TwoRCs.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/TwoRCs.java new file mode 100644 index 0000000000..c6e54e6598 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/TwoRCs.java @@ -0,0 +1,184 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences; + +import commonj.sdo.Sequence; + +import java.io.Serializable; + +import java.util.List; + +/** + * + * A representation of the model object 'Two RCs'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link com.example.sequences.TwoRCs#getGroup Group}
  • + *
  • {@link com.example.sequences.TwoRCs#getA A}
  • + *
  • {@link com.example.sequences.TwoRCs#getB B}
  • + *
  • {@link com.example.sequences.TwoRCs#getSplit Split}
  • + *
  • {@link com.example.sequences.TwoRCs#getGroup1 Group1}
  • + *
  • {@link com.example.sequences.TwoRCs#getY Y}
  • + *
  • {@link com.example.sequences.TwoRCs#getZ Z}
  • + *
+ *

+ * + * @extends Serializable + * @generated + */ +public interface TwoRCs extends Serializable +{ + /** + * Returns the value of the 'Group' attribute list. + * + *

+ * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

+ * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + + /** + * Returns the value of the 'Split' attribute. + * + *

+ * If the meaning of the 'Split' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Split' attribute. + * @see #isSetSplit() + * @see #unsetSplit() + * @see #setSplit(String) + * @generated + */ + String getSplit(); + + /** + * Sets the value of the '{@link com.example.sequences.TwoRCs#getSplit Split}' attribute. + * + * + * @param value the new value of the 'Split' attribute. + * @see #isSetSplit() + * @see #unsetSplit() + * @see #getSplit() + * @generated + */ + void setSplit(String value); + + /** + * Unsets the value of the '{@link com.example.sequences.TwoRCs#getSplit Split}' attribute. + * + * + * @see #isSetSplit() + * @see #getSplit() + * @see #setSplit(String) + * @generated + */ + void unsetSplit(); + + /** + * Returns whether the value of the '{@link com.example.sequences.TwoRCs#getSplit Split}' attribute is set. + * + * + * @return whether the value of the 'Split' attribute is set. + * @see #unsetSplit() + * @see #getSplit() + * @see #setSplit(String) + * @generated + */ + boolean isSetSplit(); + + /** + * Returns the value of the 'Group1' attribute list. + * + *

+ * If the meaning of the 'Group1' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Group1' attribute list. + * @generated + */ + Sequence getGroup1(); + + /** + * Returns the value of the 'Y' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'Y' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Y' attribute list. + * @generated + */ + List getY(); + + /** + * Returns the value of the 'Z' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

+ * If the meaning of the 'Z' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Z' attribute list. + * @generated + */ + List getZ(); + +} // TwoRCs diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/TwoRCsMixed.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/TwoRCsMixed.java new file mode 100644 index 0000000000..90d5f942b6 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/TwoRCsMixed.java @@ -0,0 +1,198 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences; + +import commonj.sdo.Sequence; + +import java.io.Serializable; + +import java.util.List; + +/** + * + * A representation of the model object 'Two RCs Mixed'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link com.example.sequences.TwoRCsMixed#getMixed Mixed}
  • + *
  • {@link com.example.sequences.TwoRCsMixed#getGroup Group}
  • + *
  • {@link com.example.sequences.TwoRCsMixed#getA A}
  • + *
  • {@link com.example.sequences.TwoRCsMixed#getB B}
  • + *
  • {@link com.example.sequences.TwoRCsMixed#getSplit Split}
  • + *
  • {@link com.example.sequences.TwoRCsMixed#getGroup1 Group1}
  • + *
  • {@link com.example.sequences.TwoRCsMixed#getY Y}
  • + *
  • {@link com.example.sequences.TwoRCsMixed#getZ Z}
  • + *
+ *

+ * + * @extends Serializable + * @generated + */ +public interface TwoRCsMixed extends Serializable +{ + /** + * Returns the value of the 'Mixed' attribute list. + * + *

+ * If the meaning of the 'Mixed' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Mixed' attribute list. + * @generated + */ + Sequence getMixed(); + + /** + * Returns the value of the 'Group' attribute list. + * + *

+ * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

+ * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + + /** + * Returns the value of the 'Split' attribute. + * + *

+ * If the meaning of the 'Split' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Split' attribute. + * @see #isSetSplit() + * @see #unsetSplit() + * @see #setSplit(String) + * @generated + */ + String getSplit(); + + /** + * Sets the value of the '{@link com.example.sequences.TwoRCsMixed#getSplit Split}' attribute. + * + * + * @param value the new value of the 'Split' attribute. + * @see #isSetSplit() + * @see #unsetSplit() + * @see #getSplit() + * @generated + */ + void setSplit(String value); + + /** + * Unsets the value of the '{@link com.example.sequences.TwoRCsMixed#getSplit Split}' attribute. + * + * + * @see #isSetSplit() + * @see #getSplit() + * @see #setSplit(String) + * @generated + */ + void unsetSplit(); + + /** + * Returns whether the value of the '{@link com.example.sequences.TwoRCsMixed#getSplit Split}' attribute is set. + * + * + * @return whether the value of the 'Split' attribute is set. + * @see #unsetSplit() + * @see #getSplit() + * @see #setSplit(String) + * @generated + */ + boolean isSetSplit(); + + /** + * Returns the value of the 'Group1' attribute list. + * + *

+ * If the meaning of the 'Group1' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Group1' attribute list. + * @generated + */ + Sequence getGroup1(); + + /** + * Returns the value of the 'Y' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'Y' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Y' attribute list. + * @generated + */ + List getY(); + + /** + * Returns the value of the 'Z' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

+ * If the meaning of the 'Z' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Z' attribute list. + * @generated + */ + List getZ(); + +} // TwoRCsMixed diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java new file mode 100644 index 0000000000..96fe832ef3 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java @@ -0,0 +1,766 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences.impl; + +import com.example.sequences.MixedQuote; +import com.example.sequences.SequencesFactory; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import java.math.BigDecimal; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * + * An implementation of the model object 'Mixed Quote'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link com.example.sequences.impl.MixedQuoteImpl#getMixed Mixed}
  • + *
  • {@link com.example.sequences.impl.MixedQuoteImpl#getSymbol Symbol}
  • + *
  • {@link com.example.sequences.impl.MixedQuoteImpl#getCompanyName Company Name}
  • + *
  • {@link com.example.sequences.impl.MixedQuoteImpl#getPrice Price}
  • + *
  • {@link com.example.sequences.impl.MixedQuoteImpl#getOpen1 Open1}
  • + *
  • {@link com.example.sequences.impl.MixedQuoteImpl#getHigh High}
  • + *
  • {@link com.example.sequences.impl.MixedQuoteImpl#getLow Low}
  • + *
  • {@link com.example.sequences.impl.MixedQuoteImpl#getVolume Volume}
  • + *
  • {@link com.example.sequences.impl.MixedQuoteImpl#getChange1 Change1}
  • + *
  • {@link com.example.sequences.impl.MixedQuoteImpl#getQuotes Quotes}
  • + *
+ *

+ * + * @generated + */ +public class MixedQuoteImpl extends DataObjectBase implements MixedQuote +{ + + public final static int MIXED = -1; + + public final static int SYMBOL = 0; + + public final static int COMPANY_NAME = 1; + + public final static int PRICE = 2; + + public final static int OPEN1 = 3; + + public final static int HIGH = 4; + + public final static int LOW = 5; + + public final static int VOLUME = 6; + + public final static int CHANGE1 = 7; + + public final static int QUOTES = 8; + + public final static int SDO_PROPERTY_COUNT = 9; + + public final static int EXTENDED_PROPERTY_COUNT = -1; + + + /** + * The internal feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_MIXED = 0; + + /** + * The internal feature id for the 'Symbol' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_SYMBOL = 1; + + /** + * The internal feature id for the 'Company Name' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_COMPANY_NAME = 2; + + /** + * The internal feature id for the 'Price' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_PRICE = 3; + + /** + * The internal feature id for the 'Open1' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_OPEN1 = 4; + + /** + * The internal feature id for the 'High' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_HIGH = 5; + + /** + * The internal feature id for the 'Low' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_LOW = 6; + + /** + * The internal feature id for the 'Volume' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_VOLUME = 7; + + /** + * The internal feature id for the 'Change1' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_CHANGE1 = 8; + + /** + * The internal feature id for the 'Quotes' containment reference list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_QUOTES = 9; + + /** + * The number of properties for this type. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 10; + + protected int internalConvertIndex(int internalIndex) + { + switch (internalIndex) + { + case INTERNAL_MIXED: return MIXED; + case INTERNAL_SYMBOL: return SYMBOL; + case INTERNAL_COMPANY_NAME: return COMPANY_NAME; + case INTERNAL_PRICE: return PRICE; + case INTERNAL_OPEN1: return OPEN1; + case INTERNAL_HIGH: return HIGH; + case INTERNAL_LOW: return LOW; + case INTERNAL_VOLUME: return VOLUME; + case INTERNAL_CHANGE1: return CHANGE1; + case INTERNAL_QUOTES: return QUOTES; + } + return super.internalConvertIndex(internalIndex); + } + + + /** + * The cached value of the '{@link #getMixed() Mixed}' attribute list. + * + * + * @see #getMixed() + * @generated + * @ordered + */ + + protected Sequence mixed = null; + + /** + * + * + * @generated + */ + public MixedQuoteImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getStaticType() + { + return ((SequencesFactoryImpl)SequencesFactory.INSTANCE).getMixedQuote(); + } + + /** + * + * + * @generated + */ + public int getStaticPropertyCount() + { + return INTERNAL_PROPERTY_COUNT; + } + + /** + * + * + * @generated + */ + public Sequence getMixed() + { + if (mixed == null) + { + mixed = createSequence(INTERNAL_MIXED); + } + return mixed; + } + /** + * + * + * @generated + */ + public String getSymbol() + { + return (String)get(getMixed(), getType(), INTERNAL_SYMBOL); + } + /** + * + * + * @generated + */ + public void setSymbol(String newSymbol) + { + set(getMixed(), getType(), INTERNAL_SYMBOL, newSymbol); + } + + /** + * + * + * @generated + */ + public void unsetSymbol() + { + unset(getMixed(), getType(), INTERNAL_SYMBOL); + } + + /** + * + * + * @generated + */ + public boolean isSetSymbol() + { + return isSet(getMixed(), getType(), INTERNAL_SYMBOL); + } + + /** + * + * + * @generated + */ + public String getCompanyName() + { + return (String)get(getMixed(), getType(), INTERNAL_COMPANY_NAME); + } + /** + * + * + * @generated + */ + public void setCompanyName(String newCompanyName) + { + set(getMixed(), getType(), INTERNAL_COMPANY_NAME, newCompanyName); + } + + /** + * + * + * @generated + */ + public void unsetCompanyName() + { + unset(getMixed(), getType(), INTERNAL_COMPANY_NAME); + } + + /** + * + * + * @generated + */ + public boolean isSetCompanyName() + { + return isSet(getMixed(), getType(), INTERNAL_COMPANY_NAME); + } + + /** + * + * + * @generated + */ + public BigDecimal getPrice() + { + return (BigDecimal)get(getMixed(), getType(), INTERNAL_PRICE); + } + /** + * + * + * @generated + */ + public void setPrice(BigDecimal newPrice) + { + set(getMixed(), getType(), INTERNAL_PRICE, newPrice); + } + + /** + * + * + * @generated + */ + public void unsetPrice() + { + unset(getMixed(), getType(), INTERNAL_PRICE); + } + + /** + * + * + * @generated + */ + public boolean isSetPrice() + { + return isSet(getMixed(), getType(), INTERNAL_PRICE); + } + + /** + * + * + * @generated + */ + public BigDecimal getOpen1() + { + return (BigDecimal)get(getMixed(), getType(), INTERNAL_OPEN1); + } + /** + * + * + * @generated + */ + public void setOpen1(BigDecimal newOpen1) + { + set(getMixed(), getType(), INTERNAL_OPEN1, newOpen1); + } + + /** + * + * + * @generated + */ + public void unsetOpen1() + { + unset(getMixed(), getType(), INTERNAL_OPEN1); + } + + /** + * + * + * @generated + */ + public boolean isSetOpen1() + { + return isSet(getMixed(), getType(), INTERNAL_OPEN1); + } + + /** + * + * + * @generated + */ + public BigDecimal getHigh() + { + return (BigDecimal)get(getMixed(), getType(), INTERNAL_HIGH); + } + /** + * + * + * @generated + */ + public void setHigh(BigDecimal newHigh) + { + set(getMixed(), getType(), INTERNAL_HIGH, newHigh); + } + + /** + * + * + * @generated + */ + public void unsetHigh() + { + unset(getMixed(), getType(), INTERNAL_HIGH); + } + + /** + * + * + * @generated + */ + public boolean isSetHigh() + { + return isSet(getMixed(), getType(), INTERNAL_HIGH); + } + + /** + * + * + * @generated + */ + public BigDecimal getLow() + { + return (BigDecimal)get(getMixed(), getType(), INTERNAL_LOW); + } + /** + * + * + * @generated + */ + public void setLow(BigDecimal newLow) + { + set(getMixed(), getType(), INTERNAL_LOW, newLow); + } + + /** + * + * + * @generated + */ + public void unsetLow() + { + unset(getMixed(), getType(), INTERNAL_LOW); + } + + /** + * + * + * @generated + */ + public boolean isSetLow() + { + return isSet(getMixed(), getType(), INTERNAL_LOW); + } + + /** + * + * + * @generated + */ + public double getVolume() + { + return ((Double)get(getMixed(), getType(), INTERNAL_VOLUME)).doubleValue(); + } + /** + * + * + * @generated + */ + public void setVolume(double newVolume) + { + set(getMixed(), getType(), INTERNAL_VOLUME, new Double(newVolume)); + } + + /** + * + * + * @generated + */ + public void unsetVolume() + { + unset(getMixed(), getType(), INTERNAL_VOLUME); + } + + /** + * + * + * @generated + */ + public boolean isSetVolume() + { + return isSet(getMixed(), getType(), INTERNAL_VOLUME); + } + + /** + * + * + * @generated + */ + public double getChange1() + { + return ((Double)get(getMixed(), getType(), INTERNAL_CHANGE1)).doubleValue(); + } + /** + * + * + * @generated + */ + public void setChange1(double newChange1) + { + set(getMixed(), getType(), INTERNAL_CHANGE1, new Double(newChange1)); + } + + /** + * + * + * @generated + */ + public void unsetChange1() + { + unset(getMixed(), getType(), INTERNAL_CHANGE1); + } + + /** + * + * + * @generated + */ + public boolean isSetChange1() + { + return isSet(getMixed(), getType(), INTERNAL_CHANGE1); + } + + /** + * + * + * @generated + */ + public List getQuotes() + { + return getList(getMixed(), getType(), INTERNAL_QUOTES); + } + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case MIXED: + return removeFromSequence(getMixed(), otherEnd, changeContext); + case QUOTES: + return removeFromList(getQuotes(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case MIXED: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getMixed(); + case SYMBOL: + return getSymbol(); + case COMPANY_NAME: + return getCompanyName(); + case PRICE: + return getPrice(); + case OPEN1: + return getOpen1(); + case HIGH: + return getHigh(); + case LOW: + return getLow(); + case VOLUME: + return new Double(getVolume()); + case CHANGE1: + return new Double(getChange1()); + case QUOTES: + return getQuotes(); + } + return super.get(propertyIndex, resolve); + } + + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case MIXED: + setSequence(getMixed(), newValue); + return; + case SYMBOL: + setSymbol((String)newValue); + return; + case COMPANY_NAME: + setCompanyName((String)newValue); + return; + case PRICE: + setPrice((BigDecimal)newValue); + return; + case OPEN1: + setOpen1((BigDecimal)newValue); + return; + case HIGH: + setHigh((BigDecimal)newValue); + return; + case LOW: + setLow((BigDecimal)newValue); + return; + case VOLUME: + setVolume(((Double)newValue).doubleValue()); + return; + case CHANGE1: + setChange1(((Double)newValue).doubleValue()); + return; + case QUOTES: + getQuotes().clear(); + getQuotes().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + unsetSequence(getMixed()); + return; + case SYMBOL: + unsetSymbol(); + return; + case COMPANY_NAME: + unsetCompanyName(); + return; + case PRICE: + unsetPrice(); + return; + case OPEN1: + unsetOpen1(); + return; + case HIGH: + unsetHigh(); + return; + case LOW: + unsetLow(); + return; + case VOLUME: + unsetVolume(); + return; + case CHANGE1: + unsetChange1(); + return; + case QUOTES: + getQuotes().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + return mixed != null && !isSequenceEmpty(getMixed()); + case SYMBOL: + return isSetSymbol(); + case COMPANY_NAME: + return isSetCompanyName(); + case PRICE: + return isSetPrice(); + case OPEN1: + return isSetOpen1(); + case HIGH: + return isSetHigh(); + case LOW: + return isSetLow(); + case VOLUME: + return isSetVolume(); + case CHANGE1: + return isSetChange1(); + case QUOTES: + return !getQuotes().isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy(this)) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mixed: "); + result.append(mixed); + result.append(')'); + return result.toString(); + } + +} //MixedQuoteImpl diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/MixedRepeatingChoiceImpl.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/MixedRepeatingChoiceImpl.java new file mode 100644 index 0000000000..d9cb3ac080 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/MixedRepeatingChoiceImpl.java @@ -0,0 +1,335 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences.impl; + +import com.example.sequences.MixedRepeatingChoice; +import com.example.sequences.SequencesFactory; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * + * An implementation of the model object 'Mixed Repeating Choice'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link com.example.sequences.impl.MixedRepeatingChoiceImpl#getMixed Mixed}
  • + *
  • {@link com.example.sequences.impl.MixedRepeatingChoiceImpl#getGroup Group}
  • + *
  • {@link com.example.sequences.impl.MixedRepeatingChoiceImpl#getA A}
  • + *
  • {@link com.example.sequences.impl.MixedRepeatingChoiceImpl#getB B}
  • + *
+ *

+ * + * @generated + */ +public class MixedRepeatingChoiceImpl extends DataObjectBase implements MixedRepeatingChoice +{ + + public final static int MIXED = -1; + + public final static int GROUP = -2; + + public final static int A = 0; + + public final static int B = 1; + + public final static int SDO_PROPERTY_COUNT = 2; + + public final static int EXTENDED_PROPERTY_COUNT = -2; + + + /** + * The internal feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_MIXED = 0; + + /** + * The internal feature id for the 'Group' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_GROUP = 1; + + /** + * The internal feature id for the 'A' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_A = 2; + + /** + * The internal feature id for the 'B' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_B = 3; + + /** + * The number of properties for this type. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 4; + + protected int internalConvertIndex(int internalIndex) + { + switch (internalIndex) + { + case INTERNAL_MIXED: return MIXED; + case INTERNAL_GROUP: return GROUP; + case INTERNAL_A: return A; + case INTERNAL_B: return B; + } + return super.internalConvertIndex(internalIndex); + } + + + /** + * The cached value of the '{@link #getMixed() Mixed}' attribute list. + * + * + * @see #getMixed() + * @generated + * @ordered + */ + + protected Sequence mixed = null; + + /** + * + * + * @generated + */ + public MixedRepeatingChoiceImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getStaticType() + { + return ((SequencesFactoryImpl)SequencesFactory.INSTANCE).getMixedRepeatingChoice(); + } + + /** + * + * + * @generated + */ + public int getStaticPropertyCount() + { + return INTERNAL_PROPERTY_COUNT; + } + + /** + * + * + * @generated + */ + public Sequence getMixed() + { + if (mixed == null) + { + mixed = createSequence(INTERNAL_MIXED); + } + return mixed; + } + /** + * + * + * @generated + */ + public Sequence getGroup() + { + return createSequence(getMixed(), getType(), INTERNAL_GROUP); + } + /** + * + * + * @generated + */ + public List getA() + { + return getList(getGroup(), getType(), INTERNAL_A); + } + /** + * + * + * @generated + */ + public List getB() + { + return getList(getGroup(), getType(), INTERNAL_B); + } + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case MIXED: + return removeFromSequence(getMixed(), otherEnd, changeContext); + case GROUP: + return removeFromSequence(getGroup(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case MIXED: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getMixed(); + case GROUP: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup(); + case A: + return getA(); + case B: + return getB(); + } + return super.get(propertyIndex, resolve); + } + + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case MIXED: + setSequence(getMixed(), newValue); + return; + case GROUP: + setSequence(getGroup(), newValue); + return; + case A: + getA().clear(); + getA().addAll((Collection)newValue); + return; + case B: + getB().clear(); + getB().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + unsetSequence(getMixed()); + return; + case GROUP: + unsetSequence(getGroup()); + return; + case A: + getA().clear(); + return; + case B: + getB().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + return mixed != null && !isSequenceEmpty(getMixed()); + case GROUP: + return !isSequenceEmpty(getGroup()); + case A: + return !getA().isEmpty(); + case B: + return !getB().isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy(this)) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mixed: "); + result.append(mixed); + result.append(')'); + return result.toString(); + } + +} //MixedRepeatingChoiceImpl diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/RepeatingChoiceImpl.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/RepeatingChoiceImpl.java new file mode 100644 index 0000000000..376a8471cf --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/RepeatingChoiceImpl.java @@ -0,0 +1,299 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences.impl; + +import com.example.sequences.RepeatingChoice; +import com.example.sequences.SequencesFactory; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * + * An implementation of the model object 'Repeating Choice'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link com.example.sequences.impl.RepeatingChoiceImpl#getGroup Group}
  • + *
  • {@link com.example.sequences.impl.RepeatingChoiceImpl#getA A}
  • + *
  • {@link com.example.sequences.impl.RepeatingChoiceImpl#getB B}
  • + *
+ *

+ * + * @generated + */ +public class RepeatingChoiceImpl extends DataObjectBase implements RepeatingChoice +{ + + public final static int GROUP = -1; + + public final static int A = 0; + + public final static int B = 1; + + public final static int SDO_PROPERTY_COUNT = 2; + + public final static int EXTENDED_PROPERTY_COUNT = -1; + + + /** + * The internal feature id for the 'Group' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_GROUP = 0; + + /** + * The internal feature id for the 'A' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_A = 1; + + /** + * The internal feature id for the 'B' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_B = 2; + + /** + * The number of properties for this type. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 3; + + protected int internalConvertIndex(int internalIndex) + { + switch (internalIndex) + { + case INTERNAL_GROUP: return GROUP; + case INTERNAL_A: return A; + case INTERNAL_B: return B; + } + return super.internalConvertIndex(internalIndex); + } + + + /** + * The cached value of the '{@link #getGroup() Group}' attribute list. + * + * + * @see #getGroup() + * @generated + * @ordered + */ + + protected Sequence group = null; + + /** + * + * + * @generated + */ + public RepeatingChoiceImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getStaticType() + { + return ((SequencesFactoryImpl)SequencesFactory.INSTANCE).getRepeatingChoice(); + } + + /** + * + * + * @generated + */ + public int getStaticPropertyCount() + { + return INTERNAL_PROPERTY_COUNT; + } + + /** + * + * + * @generated + */ + public Sequence getGroup() + { + if (group == null) + { + group = createSequence(INTERNAL_GROUP); + } + return group; + } + /** + * + * + * @generated + */ + public List getA() + { + return getList(getGroup(), getType(), INTERNAL_A); + } + /** + * + * + * @generated + */ + public List getB() + { + return getList(getGroup(), getType(), INTERNAL_B); + } + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case GROUP: + return removeFromSequence(getGroup(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case GROUP: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup(); + case A: + return getA(); + case B: + return getB(); + } + return super.get(propertyIndex, resolve); + } + + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case GROUP: + setSequence(getGroup(), newValue); + return; + case A: + getA().clear(); + getA().addAll((Collection)newValue); + return; + case B: + getB().clear(); + getB().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case GROUP: + unsetSequence(getGroup()); + return; + case A: + getA().clear(); + return; + case B: + getB().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case GROUP: + return group != null && !isSequenceEmpty(getGroup()); + case A: + return !getA().isEmpty(); + case B: + return !getB().isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy(this)) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (group: "); + result.append(group); + result.append(')'); + return result.toString(); + } + +} //RepeatingChoiceImpl diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/SequencesFactoryImpl.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/SequencesFactoryImpl.java new file mode 100644 index 0000000000..84631cb06d --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/SequencesFactoryImpl.java @@ -0,0 +1,770 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences.impl; + +import commonj.sdo.helper.HelperContext; +import org.apache.tuscany.sdo.helper.TypeHelperImpl; + +import com.example.sequences.*; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +import org.apache.tuscany.sdo.impl.FactoryBase; + +import org.apache.tuscany.sdo.model.ModelFactory; + +import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl; + +/** + * + * An implementation of the model Factory. + * Generator information: + * patternVersion=1.2; -prefix Sequences + * + * @generated + */ +public class SequencesFactoryImpl extends FactoryBase implements SequencesFactory +{ + + /** + * The package namespace URI. + * + * + * @generated + */ + public static final String NAMESPACE_URI = "http://www.example.com/sequences"; + + /** + * The package namespace name. + * + * + * @generated + */ + public static final String NAMESPACE_PREFIX = "seq"; + + /** + * The version of the generator pattern used to generate this class. + * + * + * @generated + */ + public static final String PATTERN_VERSION = "1.2"; + + public static final int MIXED_QUOTE = 1; + public static final int MIXED_REPEATING_CHOICE = 2; + public static final int REPEATING_CHOICE = 3; + public static final int TWO_RCS = 4; + public static final int TWO_RCS_MIXED = 5; + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public SequencesFactoryImpl() + { + super(NAMESPACE_URI, NAMESPACE_PREFIX, "com.example.sequences"); + } + + /** + * Registers the Factory instance so that it is available within the supplied scope. + * @argument scope a HelperContext instance that will make the types supported by this Factory available. + * + * + * @generated + */ + public void register(HelperContext scope) + { + if(scope == null) { + throw new IllegalArgumentException("Scope can not be null"); + } + + //Register dependent packages with provided scope + ModelFactory.INSTANCE.register(scope); + + // Initialize this package + TypeHelperImpl th = (TypeHelperImpl)scope.getTypeHelper(); + th.getExtendedMetaData().putPackage(NAMESPACE_URI, this); + } + + /** + * + * + * @generated + */ + public DataObject create(int typeNumber) + { + switch (typeNumber) + { + case MIXED_QUOTE: return (DataObject)createMixedQuote(); + case MIXED_REPEATING_CHOICE: return (DataObject)createMixedRepeatingChoice(); + case REPEATING_CHOICE: return (DataObject)createRepeatingChoice(); + case TWO_RCS: return (DataObject)createTwoRCs(); + case TWO_RCS_MIXED: return (DataObject)createTwoRCsMixed(); + default: + return super.create(typeNumber); + } + } + + /** + * + * + * @generated + */ + public MixedQuote createMixedQuote() + { + MixedQuoteImpl mixedQuote = new MixedQuoteImpl(); + return mixedQuote; + } + /** + * + * + * @generated + */ + public MixedRepeatingChoice createMixedRepeatingChoice() + { + MixedRepeatingChoiceImpl mixedRepeatingChoice = new MixedRepeatingChoiceImpl(); + return mixedRepeatingChoice; + } + /** + * + * + * @generated + */ + public RepeatingChoice createRepeatingChoice() + { + RepeatingChoiceImpl repeatingChoice = new RepeatingChoiceImpl(); + return repeatingChoice; + } + /** + * + * + * @generated + */ + public TwoRCs createTwoRCs() + { + TwoRCsImpl twoRCs = new TwoRCsImpl(); + return twoRCs; + } + /** + * + * + * @generated + */ + public TwoRCsMixed createTwoRCsMixed() + { + TwoRCsMixedImpl twoRCsMixed = new TwoRCsMixedImpl(); + return twoRCsMixed; + } + + // Following creates and initializes SDO metadata for the supported types. + protected Type mixedQuoteType = null; + + public Type getMixedQuote() + { + return mixedQuoteType; + } + + protected Type mixedRepeatingChoiceType = null; + + public Type getMixedRepeatingChoice() + { + return mixedRepeatingChoiceType; + } + + protected Type repeatingChoiceType = null; + + public Type getRepeatingChoice() + { + return repeatingChoiceType; + } + + protected Type twoRCsType = null; + + public Type getTwoRCs() + { + return twoRCsType; + } + + protected Type twoRCsMixedType = null; + + public Type getTwoRCsMixed() + { + return twoRCsMixedType; + } + + + private static SequencesFactoryImpl instance = null; + public static SequencesFactoryImpl init() + { + if (instance != null ) return instance; + instance = new SequencesFactoryImpl(); + + // Initialize dependent packages + ModelFactory ModelFactoryInstance = ModelFactory.INSTANCE; + + // Create package meta-data objects + instance.createMetaData(); + + // Initialize created meta-data + instance.initializeMetaData(); + + // Mark meta-data to indicate it can't be changed + //theSequencesFactoryImpl.freeze(); //FB do we need to freeze / should we freeze ???? + + return instance; + } + + private boolean isCreated = false; + + public void createMetaData() + { + if (isCreated) return; + isCreated = true; + + // Create types and their properties + mixedQuoteType = createType(false, MIXED_QUOTE); + createProperty(true, mixedQuoteType,MixedQuoteImpl.INTERNAL_MIXED); + createProperty(true, mixedQuoteType,MixedQuoteImpl.INTERNAL_SYMBOL); + createProperty(true, mixedQuoteType,MixedQuoteImpl.INTERNAL_COMPANY_NAME); + createProperty(true, mixedQuoteType,MixedQuoteImpl.INTERNAL_PRICE); + createProperty(true, mixedQuoteType,MixedQuoteImpl.INTERNAL_OPEN1); + createProperty(true, mixedQuoteType,MixedQuoteImpl.INTERNAL_HIGH); + createProperty(true, mixedQuoteType,MixedQuoteImpl.INTERNAL_LOW); + createProperty(true, mixedQuoteType,MixedQuoteImpl.INTERNAL_VOLUME); + createProperty(true, mixedQuoteType,MixedQuoteImpl.INTERNAL_CHANGE1); + createProperty(false, mixedQuoteType,MixedQuoteImpl.INTERNAL_QUOTES); + mixedRepeatingChoiceType = createType(false, MIXED_REPEATING_CHOICE); + createProperty(true, mixedRepeatingChoiceType,MixedRepeatingChoiceImpl.INTERNAL_MIXED); + createProperty(true, mixedRepeatingChoiceType,MixedRepeatingChoiceImpl.INTERNAL_GROUP); + createProperty(true, mixedRepeatingChoiceType,MixedRepeatingChoiceImpl.INTERNAL_A); + createProperty(true, mixedRepeatingChoiceType,MixedRepeatingChoiceImpl.INTERNAL_B); + repeatingChoiceType = createType(false, REPEATING_CHOICE); + createProperty(true, repeatingChoiceType,RepeatingChoiceImpl.INTERNAL_GROUP); + createProperty(true, repeatingChoiceType,RepeatingChoiceImpl.INTERNAL_A); + createProperty(true, repeatingChoiceType,RepeatingChoiceImpl.INTERNAL_B); + twoRCsType = createType(false, TWO_RCS); + createProperty(true, twoRCsType,TwoRCsImpl.INTERNAL_GROUP); + createProperty(true, twoRCsType,TwoRCsImpl.INTERNAL_A); + createProperty(true, twoRCsType,TwoRCsImpl.INTERNAL_B); + createProperty(true, twoRCsType,TwoRCsImpl.INTERNAL_SPLIT); + createProperty(true, twoRCsType,TwoRCsImpl.INTERNAL_GROUP1); + createProperty(true, twoRCsType,TwoRCsImpl.INTERNAL_Y); + createProperty(true, twoRCsType,TwoRCsImpl.INTERNAL_Z); + twoRCsMixedType = createType(false, TWO_RCS_MIXED); + createProperty(true, twoRCsMixedType,TwoRCsMixedImpl.INTERNAL_MIXED); + createProperty(true, twoRCsMixedType,TwoRCsMixedImpl.INTERNAL_GROUP); + createProperty(true, twoRCsMixedType,TwoRCsMixedImpl.INTERNAL_A); + createProperty(true, twoRCsMixedType,TwoRCsMixedImpl.INTERNAL_B); + createProperty(true, twoRCsMixedType,TwoRCsMixedImpl.INTERNAL_SPLIT); + createProperty(true, twoRCsMixedType,TwoRCsMixedImpl.INTERNAL_GROUP1); + createProperty(true, twoRCsMixedType,TwoRCsMixedImpl.INTERNAL_Y); + createProperty(true, twoRCsMixedType,TwoRCsMixedImpl.INTERNAL_Z); + } + + private boolean isInitialized = false; + + public void initializeMetaData() + { + if (isInitialized) return; + isInitialized = true; + + // Obtain other dependent packages + ModelFactoryImpl theModelPackageImpl = (ModelFactoryImpl)ModelFactory.INSTANCE; + Property property = null; + + // Add supertypes to types + + // Initialize types and properties + initializeType(mixedQuoteType, MixedQuote.class, "MixedQuote", false); + property = getLocalProperty(mixedQuoteType, 0); + initializeProperty(property, getSequence(), "mixed", null, 0, -1, MixedQuote.class, false, false, false); + + property = getLocalProperty(mixedQuoteType, 1); + initializeProperty(property, theModelPackageImpl.getString(), "symbol", null, 1, 1, MixedQuote.class, false, true, true); + + property = getLocalProperty(mixedQuoteType, 2); + initializeProperty(property, theModelPackageImpl.getString(), "companyName", null, 1, 1, MixedQuote.class, false, true, true); + + property = getLocalProperty(mixedQuoteType, 3); + initializeProperty(property, theModelPackageImpl.getDecimal(), "price", null, 1, 1, MixedQuote.class, false, true, true); + + property = getLocalProperty(mixedQuoteType, 4); + initializeProperty(property, theModelPackageImpl.getDecimal(), "open1", null, 1, 1, MixedQuote.class, false, true, true); + + property = getLocalProperty(mixedQuoteType, 5); + initializeProperty(property, theModelPackageImpl.getDecimal(), "high", null, 1, 1, MixedQuote.class, false, true, true); + + property = getLocalProperty(mixedQuoteType, 6); + initializeProperty(property, theModelPackageImpl.getDecimal(), "low", null, 1, 1, MixedQuote.class, false, true, true); + + property = getLocalProperty(mixedQuoteType, 7); + initializeProperty(property, theModelPackageImpl.getDouble(), "volume", null, 1, 1, MixedQuote.class, false, true, true); + + property = getLocalProperty(mixedQuoteType, 8); + initializeProperty(property, theModelPackageImpl.getDouble(), "change1", null, 1, 1, MixedQuote.class, false, true, true); + + property = getLocalProperty(mixedQuoteType, 9); + initializeProperty(property, this.getMixedQuote(), "quotes", null, 0, -1, MixedQuote.class, false, false, true, true , null); + + initializeType(mixedRepeatingChoiceType, MixedRepeatingChoice.class, "MixedRepeatingChoice", false); + property = getLocalProperty(mixedRepeatingChoiceType, 0); + initializeProperty(property, getSequence(), "mixed", null, 0, -1, MixedRepeatingChoice.class, false, false, false); + + property = getLocalProperty(mixedRepeatingChoiceType, 1); + initializeProperty(property, getSequence(), "group", null, 0, -1, MixedRepeatingChoice.class, false, false, true); + + property = getLocalProperty(mixedRepeatingChoiceType, 2); + initializeProperty(property, theModelPackageImpl.getString(), "a", null, 0, -1, MixedRepeatingChoice.class, false, false, true); + + property = getLocalProperty(mixedRepeatingChoiceType, 3); + initializeProperty(property, theModelPackageImpl.getInt(), "b", null, 0, -1, MixedRepeatingChoice.class, false, false, true); + + initializeType(repeatingChoiceType, RepeatingChoice.class, "RepeatingChoice", false); + property = getLocalProperty(repeatingChoiceType, 0); + initializeProperty(property, getSequence(), "group", null, 0, -1, RepeatingChoice.class, false, false, false); + + property = getLocalProperty(repeatingChoiceType, 1); + initializeProperty(property, theModelPackageImpl.getString(), "a", null, 0, -1, RepeatingChoice.class, false, false, true); + + property = getLocalProperty(repeatingChoiceType, 2); + initializeProperty(property, theModelPackageImpl.getInt(), "b", null, 0, -1, RepeatingChoice.class, false, false, true); + + initializeType(twoRCsType, TwoRCs.class, "TwoRCs", false); + property = getLocalProperty(twoRCsType, 0); + initializeProperty(property, getSequence(), "group", null, 0, -1, TwoRCs.class, false, false, false); + + property = getLocalProperty(twoRCsType, 1); + initializeProperty(property, theModelPackageImpl.getString(), "a", null, 0, -1, TwoRCs.class, false, false, true); + + property = getLocalProperty(twoRCsType, 2); + initializeProperty(property, theModelPackageImpl.getInt(), "b", null, 0, -1, TwoRCs.class, false, false, true); + + property = getLocalProperty(twoRCsType, 3); + initializeProperty(property, theModelPackageImpl.getString(), "split", null, 1, 1, TwoRCs.class, false, true, false); + + property = getLocalProperty(twoRCsType, 4); + initializeProperty(property, getSequence(), "group1", null, 0, -1, TwoRCs.class, false, false, false); + + property = getLocalProperty(twoRCsType, 5); + initializeProperty(property, theModelPackageImpl.getString(), "y", null, 0, -1, TwoRCs.class, false, false, true); + + property = getLocalProperty(twoRCsType, 6); + initializeProperty(property, theModelPackageImpl.getInt(), "z", null, 0, -1, TwoRCs.class, false, false, true); + + initializeType(twoRCsMixedType, TwoRCsMixed.class, "TwoRCsMixed", false); + property = getLocalProperty(twoRCsMixedType, 0); + initializeProperty(property, getSequence(), "mixed", null, 0, -1, TwoRCsMixed.class, false, false, false); + + property = getLocalProperty(twoRCsMixedType, 1); + initializeProperty(property, getSequence(), "group", null, 0, -1, TwoRCsMixed.class, false, false, true); + + property = getLocalProperty(twoRCsMixedType, 2); + initializeProperty(property, theModelPackageImpl.getString(), "a", null, 0, -1, TwoRCsMixed.class, false, false, true); + + property = getLocalProperty(twoRCsMixedType, 3); + initializeProperty(property, theModelPackageImpl.getInt(), "b", null, 0, -1, TwoRCsMixed.class, false, false, true); + + property = getLocalProperty(twoRCsMixedType, 4); + initializeProperty(property, theModelPackageImpl.getString(), "split", null, 1, 1, TwoRCsMixed.class, false, true, true); + + property = getLocalProperty(twoRCsMixedType, 5); + initializeProperty(property, getSequence(), "group1", null, 0, -1, TwoRCsMixed.class, false, false, true); + + property = getLocalProperty(twoRCsMixedType, 6); + initializeProperty(property, theModelPackageImpl.getString(), "y", null, 0, -1, TwoRCsMixed.class, false, false, true); + + property = getLocalProperty(twoRCsMixedType, 7); + initializeProperty(property, theModelPackageImpl.getInt(), "z", null, 0, -1, TwoRCsMixed.class, false, false, true); + + createXSDMetaData(theModelPackageImpl); + } + + protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl) + { + super.initXSD(); + + Property property = null; + + + property = createGlobalProperty + ("mixedStockQuote", + this.getMixedQuote(), + new String[] + { + "kind", "element", + "name", "mixedStockQuote", + "namespace", "##targetNamespace" + }); + + property = createGlobalProperty + ("mrc", + this.getMixedRepeatingChoice(), + new String[] + { + "kind", "element", + "name", "mrc", + "namespace", "##targetNamespace" + }); + + property = createGlobalProperty + ("mrc2", + this.getTwoRCsMixed(), + new String[] + { + "kind", "element", + "name", "mrc2", + "namespace", "##targetNamespace" + }); + + property = createGlobalProperty + ("rc", + this.getRepeatingChoice(), + new String[] + { + "kind", "element", + "name", "rc", + "namespace", "##targetNamespace" + }); + + property = createGlobalProperty + ("rc2", + this.getTwoRCs(), + new String[] + { + "kind", "element", + "name", "rc2", + "namespace", "##targetNamespace" + }); + + addXSDMapping + (mixedQuoteType, + new String[] + { + "name", "MixedQuote", + "kind", "mixed" + }); + + addXSDMapping + (getProperty(mixedQuoteType, MixedQuoteImpl.INTERNAL_MIXED), + new String[] + { + "kind", "elementWildcard", + "name", ":mixed" + }); + + addXSDMapping + (getProperty(mixedQuoteType, MixedQuoteImpl.INTERNAL_SYMBOL), + new String[] + { + "kind", "element", + "name", "symbol" + }); + + addXSDMapping + (getProperty(mixedQuoteType, MixedQuoteImpl.INTERNAL_COMPANY_NAME), + new String[] + { + "kind", "element", + "name", "companyName" + }); + + addXSDMapping + (getProperty(mixedQuoteType, MixedQuoteImpl.INTERNAL_PRICE), + new String[] + { + "kind", "element", + "name", "price" + }); + + addXSDMapping + (getProperty(mixedQuoteType, MixedQuoteImpl.INTERNAL_OPEN1), + new String[] + { + "kind", "element", + "name", "open1" + }); + + addXSDMapping + (getProperty(mixedQuoteType, MixedQuoteImpl.INTERNAL_HIGH), + new String[] + { + "kind", "element", + "name", "high" + }); + + addXSDMapping + (getProperty(mixedQuoteType, MixedQuoteImpl.INTERNAL_LOW), + new String[] + { + "kind", "element", + "name", "low" + }); + + addXSDMapping + (getProperty(mixedQuoteType, MixedQuoteImpl.INTERNAL_VOLUME), + new String[] + { + "kind", "element", + "name", "volume" + }); + + addXSDMapping + (getProperty(mixedQuoteType, MixedQuoteImpl.INTERNAL_CHANGE1), + new String[] + { + "kind", "element", + "name", "change1" + }); + + addXSDMapping + (getProperty(mixedQuoteType, MixedQuoteImpl.INTERNAL_QUOTES), + new String[] + { + "kind", "element", + "name", "quotes" + }); + + addXSDMapping + (mixedRepeatingChoiceType, + new String[] + { + "name", "MixedRepeatingChoice", + "kind", "mixed" + }); + + addXSDMapping + (getProperty(mixedRepeatingChoiceType, MixedRepeatingChoiceImpl.INTERNAL_MIXED), + new String[] + { + "kind", "elementWildcard", + "name", ":mixed" + }); + + addXSDMapping + (getProperty(mixedRepeatingChoiceType, MixedRepeatingChoiceImpl.INTERNAL_GROUP), + new String[] + { + "kind", "group", + "name", "group:1" + }); + + addXSDMapping + (getProperty(mixedRepeatingChoiceType, MixedRepeatingChoiceImpl.INTERNAL_A), + new String[] + { + "kind", "element", + "name", "a", + "group", "#group:1" + }); + + addXSDMapping + (getProperty(mixedRepeatingChoiceType, MixedRepeatingChoiceImpl.INTERNAL_B), + new String[] + { + "kind", "element", + "name", "b", + "group", "#group:1" + }); + + addXSDMapping + (repeatingChoiceType, + new String[] + { + "name", "RepeatingChoice", + "kind", "elementOnly" + }); + + addXSDMapping + (getProperty(repeatingChoiceType, RepeatingChoiceImpl.INTERNAL_GROUP), + new String[] + { + "kind", "group", + "name", "group:0" + }); + + addXSDMapping + (getProperty(repeatingChoiceType, RepeatingChoiceImpl.INTERNAL_A), + new String[] + { + "kind", "element", + "name", "a", + "group", "#group:0" + }); + + addXSDMapping + (getProperty(repeatingChoiceType, RepeatingChoiceImpl.INTERNAL_B), + new String[] + { + "kind", "element", + "name", "b", + "group", "#group:0" + }); + + addXSDMapping + (twoRCsType, + new String[] + { + "name", "TwoRCs", + "kind", "elementOnly" + }); + + addXSDMapping + (getProperty(twoRCsType, TwoRCsImpl.INTERNAL_GROUP), + new String[] + { + "kind", "group", + "name", "group:0" + }); + + addXSDMapping + (getProperty(twoRCsType, TwoRCsImpl.INTERNAL_A), + new String[] + { + "kind", "element", + "name", "a", + "group", "#group:0" + }); + + addXSDMapping + (getProperty(twoRCsType, TwoRCsImpl.INTERNAL_B), + new String[] + { + "kind", "element", + "name", "b", + "group", "#group:0" + }); + + addXSDMapping + (getProperty(twoRCsType, TwoRCsImpl.INTERNAL_SPLIT), + new String[] + { + "kind", "element", + "name", "split" + }); + + addXSDMapping + (getProperty(twoRCsType, TwoRCsImpl.INTERNAL_GROUP1), + new String[] + { + "kind", "group", + "name", "group:4" + }); + + addXSDMapping + (getProperty(twoRCsType, TwoRCsImpl.INTERNAL_Y), + new String[] + { + "kind", "element", + "name", "y", + "group", "#group:4" + }); + + addXSDMapping + (getProperty(twoRCsType, TwoRCsImpl.INTERNAL_Z), + new String[] + { + "kind", "element", + "name", "z", + "group", "#group:4" + }); + + addXSDMapping + (twoRCsMixedType, + new String[] + { + "name", "TwoRCsMixed", + "kind", "mixed" + }); + + addXSDMapping + (getProperty(twoRCsMixedType, TwoRCsMixedImpl.INTERNAL_MIXED), + new String[] + { + "kind", "elementWildcard", + "name", ":mixed" + }); + + addXSDMapping + (getProperty(twoRCsMixedType, TwoRCsMixedImpl.INTERNAL_GROUP), + new String[] + { + "kind", "group", + "name", "group:1" + }); + + addXSDMapping + (getProperty(twoRCsMixedType, TwoRCsMixedImpl.INTERNAL_A), + new String[] + { + "kind", "element", + "name", "a", + "group", "#group:1" + }); + + addXSDMapping + (getProperty(twoRCsMixedType, TwoRCsMixedImpl.INTERNAL_B), + new String[] + { + "kind", "element", + "name", "b", + "group", "#group:1" + }); + + addXSDMapping + (getProperty(twoRCsMixedType, TwoRCsMixedImpl.INTERNAL_SPLIT), + new String[] + { + "kind", "element", + "name", "split" + }); + + addXSDMapping + (getProperty(twoRCsMixedType, TwoRCsMixedImpl.INTERNAL_GROUP1), + new String[] + { + "kind", "group", + "name", "group:5" + }); + + addXSDMapping + (getProperty(twoRCsMixedType, TwoRCsMixedImpl.INTERNAL_Y), + new String[] + { + "kind", "element", + "name", "y", + "group", "#group:5" + }); + + addXSDMapping + (getProperty(twoRCsMixedType, TwoRCsMixedImpl.INTERNAL_Z), + new String[] + { + "kind", "element", + "name", "z", + "group", "#group:5" + }); + + } + +} //SequencesFactoryImpl diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/TwoRCsImpl.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/TwoRCsImpl.java new file mode 100644 index 0000000000..c1e385ec63 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/TwoRCsImpl.java @@ -0,0 +1,521 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences.impl; + +import com.example.sequences.SequencesFactory; +import com.example.sequences.TwoRCs; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * + * An implementation of the model object 'Two RCs'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link com.example.sequences.impl.TwoRCsImpl#getGroup Group}
  • + *
  • {@link com.example.sequences.impl.TwoRCsImpl#getA A}
  • + *
  • {@link com.example.sequences.impl.TwoRCsImpl#getB B}
  • + *
  • {@link com.example.sequences.impl.TwoRCsImpl#getSplit Split}
  • + *
  • {@link com.example.sequences.impl.TwoRCsImpl#getGroup1 Group1}
  • + *
  • {@link com.example.sequences.impl.TwoRCsImpl#getY Y}
  • + *
  • {@link com.example.sequences.impl.TwoRCsImpl#getZ Z}
  • + *
+ *

+ * + * @generated + */ +public class TwoRCsImpl extends DataObjectBase implements TwoRCs +{ + + public final static int GROUP = -1; + + public final static int A = 0; + + public final static int B = 1; + + public final static int SPLIT = 2; + + public final static int GROUP1 = -2; + + public final static int Y = 3; + + public final static int Z = 4; + + public final static int SDO_PROPERTY_COUNT = 5; + + public final static int EXTENDED_PROPERTY_COUNT = -2; + + + /** + * The internal feature id for the 'Group' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_GROUP = 0; + + /** + * The internal feature id for the 'A' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_A = 1; + + /** + * The internal feature id for the 'B' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_B = 2; + + /** + * The internal feature id for the 'Split' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_SPLIT = 3; + + /** + * The internal feature id for the 'Group1' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_GROUP1 = 4; + + /** + * The internal feature id for the 'Y' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_Y = 5; + + /** + * The internal feature id for the 'Z' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_Z = 6; + + /** + * The number of properties for this type. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 7; + + protected int internalConvertIndex(int internalIndex) + { + switch (internalIndex) + { + case INTERNAL_GROUP: return GROUP; + case INTERNAL_A: return A; + case INTERNAL_B: return B; + case INTERNAL_SPLIT: return SPLIT; + case INTERNAL_GROUP1: return GROUP1; + case INTERNAL_Y: return Y; + case INTERNAL_Z: return Z; + } + return super.internalConvertIndex(internalIndex); + } + + + /** + * The cached value of the '{@link #getGroup() Group}' attribute list. + * + * + * @see #getGroup() + * @generated + * @ordered + */ + + protected Sequence group = null; + + /** + * The default value of the '{@link #getSplit() Split}' attribute. + * + * + * @see #getSplit() + * @generated + * @ordered + */ + protected static final String SPLIT_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getSplit() Split}' attribute. + * + * + * @see #getSplit() + * @generated + * @ordered + */ + protected String split = SPLIT_DEFAULT_; + + /** + * This is true if the Split attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean split_set_ = false; + + /** + * The cached value of the '{@link #getGroup1() Group1}' attribute list. + * + * + * @see #getGroup1() + * @generated + * @ordered + */ + + protected Sequence group1 = null; + + /** + * + * + * @generated + */ + public TwoRCsImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getStaticType() + { + return ((SequencesFactoryImpl)SequencesFactory.INSTANCE).getTwoRCs(); + } + + /** + * + * + * @generated + */ + public int getStaticPropertyCount() + { + return INTERNAL_PROPERTY_COUNT; + } + + /** + * + * + * @generated + */ + public Sequence getGroup() + { + if (group == null) + { + group = createSequence(INTERNAL_GROUP); + } + return group; + } + /** + * + * + * @generated + */ + public List getA() + { + return getList(getGroup(), getType(), INTERNAL_A); + } + /** + * + * + * @generated + */ + public List getB() + { + return getList(getGroup(), getType(), INTERNAL_B); + } + /** + * + * + * @generated + */ + public String getSplit() + { + return split; + } + /** + * + * + * @generated + */ + public void setSplit(String newSplit) + { + String oldSplit = split; + split = newSplit; + boolean oldSplit_set_ = split_set_; + split_set_ = true; + if (isNotifying()) + notify(ChangeKind.SET, INTERNAL_SPLIT, oldSplit, split, !oldSplit_set_); + } + + /** + * + * + * @generated + */ + public void unsetSplit() + { + String oldSplit = split; + boolean oldSplit_set_ = split_set_; + split = SPLIT_DEFAULT_; + split_set_ = false; + if (isNotifying()) + notify(ChangeKind.UNSET, INTERNAL_SPLIT, oldSplit, SPLIT_DEFAULT_, oldSplit_set_); + } + + /** + * + * + * @generated + */ + public boolean isSetSplit() + { + return split_set_; + } + + /** + * + * + * @generated + */ + public Sequence getGroup1() + { + if (group1 == null) + { + group1 = createSequence(INTERNAL_GROUP1); + } + return group1; + } + /** + * + * + * @generated + */ + public List getY() + { + return getList(getGroup1(), getType(), INTERNAL_Y); + } + /** + * + * + * @generated + */ + public List getZ() + { + return getList(getGroup1(), getType(), INTERNAL_Z); + } + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case GROUP: + return removeFromSequence(getGroup(), otherEnd, changeContext); + case GROUP1: + return removeFromSequence(getGroup1(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case GROUP: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup(); + case A: + return getA(); + case B: + return getB(); + case SPLIT: + return getSplit(); + case GROUP1: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup1(); + case Y: + return getY(); + case Z: + return getZ(); + } + return super.get(propertyIndex, resolve); + } + + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case GROUP: + setSequence(getGroup(), newValue); + return; + case A: + getA().clear(); + getA().addAll((Collection)newValue); + return; + case B: + getB().clear(); + getB().addAll((Collection)newValue); + return; + case SPLIT: + setSplit((String)newValue); + return; + case GROUP1: + setSequence(getGroup1(), newValue); + return; + case Y: + getY().clear(); + getY().addAll((Collection)newValue); + return; + case Z: + getZ().clear(); + getZ().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case GROUP: + unsetSequence(getGroup()); + return; + case A: + getA().clear(); + return; + case B: + getB().clear(); + return; + case SPLIT: + unsetSplit(); + return; + case GROUP1: + unsetSequence(getGroup1()); + return; + case Y: + getY().clear(); + return; + case Z: + getZ().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case GROUP: + return group != null && !isSequenceEmpty(getGroup()); + case A: + return !getA().isEmpty(); + case B: + return !getB().isEmpty(); + case SPLIT: + return isSetSplit(); + case GROUP1: + return group1 != null && !isSequenceEmpty(getGroup1()); + case Y: + return !getY().isEmpty(); + case Z: + return !getZ().isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy(this)) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (group: "); + result.append(group); + result.append(", split: "); + if (split_set_) result.append(split); else result.append(""); + result.append(", group1: "); + result.append(group1); + result.append(')'); + return result.toString(); + } + +} //TwoRCsImpl diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/TwoRCsMixedImpl.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/TwoRCsMixedImpl.java new file mode 100644 index 0000000000..0d48a9df69 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/com/example/sequences/impl/TwoRCsMixedImpl.java @@ -0,0 +1,499 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.sequences.impl; + +import com.example.sequences.SequencesFactory; +import com.example.sequences.TwoRCsMixed; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * + * An implementation of the model object 'Two RCs Mixed'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link com.example.sequences.impl.TwoRCsMixedImpl#getMixed Mixed}
  • + *
  • {@link com.example.sequences.impl.TwoRCsMixedImpl#getGroup Group}
  • + *
  • {@link com.example.sequences.impl.TwoRCsMixedImpl#getA A}
  • + *
  • {@link com.example.sequences.impl.TwoRCsMixedImpl#getB B}
  • + *
  • {@link com.example.sequences.impl.TwoRCsMixedImpl#getSplit Split}
  • + *
  • {@link com.example.sequences.impl.TwoRCsMixedImpl#getGroup1 Group1}
  • + *
  • {@link com.example.sequences.impl.TwoRCsMixedImpl#getY Y}
  • + *
  • {@link com.example.sequences.impl.TwoRCsMixedImpl#getZ Z}
  • + *
+ *

+ * + * @generated + */ +public class TwoRCsMixedImpl extends DataObjectBase implements TwoRCsMixed +{ + + public final static int MIXED = -1; + + public final static int GROUP = -2; + + public final static int A = 0; + + public final static int B = 1; + + public final static int SPLIT = 2; + + public final static int GROUP1 = -3; + + public final static int Y = 3; + + public final static int Z = 4; + + public final static int SDO_PROPERTY_COUNT = 5; + + public final static int EXTENDED_PROPERTY_COUNT = -3; + + + /** + * The internal feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_MIXED = 0; + + /** + * The internal feature id for the 'Group' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_GROUP = 1; + + /** + * The internal feature id for the 'A' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_A = 2; + + /** + * The internal feature id for the 'B' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_B = 3; + + /** + * The internal feature id for the 'Split' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_SPLIT = 4; + + /** + * The internal feature id for the 'Group1' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_GROUP1 = 5; + + /** + * The internal feature id for the 'Y' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_Y = 6; + + /** + * The internal feature id for the 'Z' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_Z = 7; + + /** + * The number of properties for this type. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 8; + + protected int internalConvertIndex(int internalIndex) + { + switch (internalIndex) + { + case INTERNAL_MIXED: return MIXED; + case INTERNAL_GROUP: return GROUP; + case INTERNAL_A: return A; + case INTERNAL_B: return B; + case INTERNAL_SPLIT: return SPLIT; + case INTERNAL_GROUP1: return GROUP1; + case INTERNAL_Y: return Y; + case INTERNAL_Z: return Z; + } + return super.internalConvertIndex(internalIndex); + } + + + /** + * The cached value of the '{@link #getMixed() Mixed}' attribute list. + * + * + * @see #getMixed() + * @generated + * @ordered + */ + + protected Sequence mixed = null; + + /** + * + * + * @generated + */ + public TwoRCsMixedImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getStaticType() + { + return ((SequencesFactoryImpl)SequencesFactory.INSTANCE).getTwoRCsMixed(); + } + + /** + * + * + * @generated + */ + public int getStaticPropertyCount() + { + return INTERNAL_PROPERTY_COUNT; + } + + /** + * + * + * @generated + */ + public Sequence getMixed() + { + if (mixed == null) + { + mixed = createSequence(INTERNAL_MIXED); + } + return mixed; + } + /** + * + * + * @generated + */ + public Sequence getGroup() + { + return createSequence(getMixed(), getType(), INTERNAL_GROUP); + } + /** + * + * + * @generated + */ + public List getA() + { + return getList(getGroup(), getType(), INTERNAL_A); + } + /** + * + * + * @generated + */ + public List getB() + { + return getList(getGroup(), getType(), INTERNAL_B); + } + /** + * + * + * @generated + */ + public String getSplit() + { + return (String)get(getMixed(), getType(), INTERNAL_SPLIT); + } + /** + * + * + * @generated + */ + public void setSplit(String newSplit) + { + set(getMixed(), getType(), INTERNAL_SPLIT, newSplit); + } + + /** + * + * + * @generated + */ + public void unsetSplit() + { + unset(getMixed(), getType(), INTERNAL_SPLIT); + } + + /** + * + * + * @generated + */ + public boolean isSetSplit() + { + return isSet(getMixed(), getType(), INTERNAL_SPLIT); + } + + /** + * + * + * @generated + */ + public Sequence getGroup1() + { + return createSequence(getMixed(), getType(), INTERNAL_GROUP1); + } + /** + * + * + * @generated + */ + public List getY() + { + return getList(getGroup1(), getType(), INTERNAL_Y); + } + /** + * + * + * @generated + */ + public List getZ() + { + return getList(getGroup1(), getType(), INTERNAL_Z); + } + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case MIXED: + return removeFromSequence(getMixed(), otherEnd, changeContext); + case GROUP: + return removeFromSequence(getGroup(), otherEnd, changeContext); + case GROUP1: + return removeFromSequence(getGroup1(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case MIXED: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getMixed(); + case GROUP: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup(); + case A: + return getA(); + case B: + return getB(); + case SPLIT: + return getSplit(); + case GROUP1: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup1(); + case Y: + return getY(); + case Z: + return getZ(); + } + return super.get(propertyIndex, resolve); + } + + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case MIXED: + setSequence(getMixed(), newValue); + return; + case GROUP: + setSequence(getGroup(), newValue); + return; + case A: + getA().clear(); + getA().addAll((Collection)newValue); + return; + case B: + getB().clear(); + getB().addAll((Collection)newValue); + return; + case SPLIT: + setSplit((String)newValue); + return; + case GROUP1: + setSequence(getGroup1(), newValue); + return; + case Y: + getY().clear(); + getY().addAll((Collection)newValue); + return; + case Z: + getZ().clear(); + getZ().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + unsetSequence(getMixed()); + return; + case GROUP: + unsetSequence(getGroup()); + return; + case A: + getA().clear(); + return; + case B: + getB().clear(); + return; + case SPLIT: + unsetSplit(); + return; + case GROUP1: + unsetSequence(getGroup1()); + return; + case Y: + getY().clear(); + return; + case Z: + getZ().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + return mixed != null && !isSequenceEmpty(getMixed()); + case GROUP: + return !isSequenceEmpty(getGroup()); + case A: + return !getA().isEmpty(); + case B: + return !getB().isEmpty(); + case SPLIT: + return isSetSplit(); + case GROUP1: + return !isSequenceEmpty(getGroup1()); + case Y: + return !getY().isEmpty(); + case Z: + return !getZ().isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy(this)) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mixed: "); + result.append(mixed); + result.append(')'); + return result.toString(); + } + +} //TwoRCsMixedImpl diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/org/apache/tuscany/sdo/test/AllTests.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/org/apache/tuscany/sdo/test/AllTests.java new file mode 100644 index 0000000000..67b0e1a3fd --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/org/apache/tuscany/sdo/test/AllTests.java @@ -0,0 +1,48 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sdo.test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class AllTests extends TestCase { + + + public static TestSuite suite() { + + TestSuite suite = new TestSuite(); + + suite.addTestSuite(GeneratedPackagesTestCase.class); + + return suite; + } + + + + /** + * Runs the test suite using the textual runner. + */ + public static void main(String[] args) { + junit.textui.TestRunner.run(suite()); + } +} + + + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/org/apache/tuscany/sdo/test/GeneratedPackagesTestCase.java b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/org/apache/tuscany/sdo/test/GeneratedPackagesTestCase.java new file mode 100644 index 0000000000..290f27338a --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/java/org/apache/tuscany/sdo/test/GeneratedPackagesTestCase.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sdo.test; + +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.sdo.generate.XSD2JavaGenerator; + +import junit.framework.TestCase; + + +public class GeneratedPackagesTestCase extends TestCase +{ + static String expectedNamespace = "http://www.example.com/sequences"; + + public void testPackageValidity() + { + XSD2JavaGenerator codeGen = new XSD2JavaGenerator(); + String [] genArgs = { "-schemaNamespace", "all", "-noGenerate", "src/test/resources/sequences.xsd" }; + codeGen.generateFromXMLSchema( genArgs ); + List packages = codeGen.getGeneratedPackageInfo(); + + for (Iterator iter = packages.iterator(); iter.hasNext();) + { + XSD2JavaGenerator.GeneratedPackage packageInfo = (XSD2JavaGenerator.GeneratedPackage)iter.next(); + assertTrue(expectedNamespace.equals(packageInfo.getNamespace())); + + String name; + boolean validatedMixedQuote = false; + boolean validatedRC = false; + for (Iterator iterClass = packageInfo.getClasses().iterator(); iterClass.hasNext();) + { + XSD2JavaGenerator.GeneratedPackage.PackageClassInfo classInfo = (XSD2JavaGenerator.GeneratedPackage.PackageClassInfo)iterClass.next(); + name = classInfo.getName(); + + if( "mixedStockQuote".equals(name)) + { + assertTrue("com.example.sequences.MixedQuote".equals(classInfo.getClassName())); + validatedMixedQuote = true; + } + + if( "rc".equals(name)) + { + assertTrue("com.example.sequences.RepeatingChoice".equals(classInfo.getClassName())); + validatedRC = true; + } + } + assertTrue(validatedMixedQuote); + assertTrue(validatedRC); + } + } +} diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/TUSCANY1050.xsd b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/TUSCANY1050.xsd new file mode 100644 index 0000000000..a218eb574c --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/TUSCANY1050.xsd @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/enum.xsd b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/enum.xsd new file mode 100644 index 0000000000..6c906539a9 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/enum.xsd @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/mixedRepeatingChoiceTestResult.xml b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/mixedRepeatingChoiceTestResult.xml new file mode 100644 index 0000000000..0aa17bb50a --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/mixedRepeatingChoiceTestResult.xml @@ -0,0 +1,20 @@ + + +1foosome mixed textbar2 diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/mixedStaticTestResult.xml b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/mixedStaticTestResult.xml new file mode 100644 index 0000000000..9136f0780d --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/mixedStaticTestResult.xml @@ -0,0 +1,27 @@ + + + + fbnt + FlyByNightTechnology + some text + 2000.0 + more text + 1000.0 + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/repeatingChoice.xsd b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/repeatingChoice.xsd new file mode 100644 index 0000000000..1d566da671 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/repeatingChoice.xsd @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/repeatingChoiceTestResult.xml b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/repeatingChoiceTestResult.xml new file mode 100644 index 0000000000..2719457b6d --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/repeatingChoiceTestResult.xml @@ -0,0 +1,25 @@ + + + + 1 + foo + bar + 2 + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/sdoModel.xsd b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/sdoModel.xsd new file mode 100644 index 0000000000..6b596c5b36 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/sdoModel.xsd @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/sequences.xsd b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/sequences.xsd new file mode 100644 index 0000000000..b74a56eab7 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/sequences.xsd @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/twoRepeatingChoicesMixedTestResult.xml b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/twoRepeatingChoicesMixedTestResult.xml new file mode 100644 index 0000000000..a62cd66b58 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/twoRepeatingChoicesMixedTestResult.xml @@ -0,0 +1,20 @@ + + +1where will this appear?foobar2pea99fred diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/twoRepeatingChoicesTestResult.xml b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/twoRepeatingChoicesTestResult.xml new file mode 100644 index 0000000000..3585ad00d3 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/src/test/resources/twoRepeatingChoicesTestResult.xml @@ -0,0 +1,28 @@ + + + + 1 + foo + bar + 2 + banana + 99 + fred + diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/templates/Header.javajetinc b/sdo-java/branches/sdo-1.1-incubating/tools/templates/Header.javajetinc new file mode 100644 index 0000000000..27becf3645 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/templates/Header.javajetinc @@ -0,0 +1,6 @@ +/** + * + * + * + * <%="$"%>Id<%="$"%> + */ diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/templates/models/SDOClass.javajet b/sdo-java/branches/sdo-1.1-incubating/tools/templates/models/SDOClass.javajet new file mode 100644 index 0000000000..758f1126bd --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/templates/models/SDOClass.javajet @@ -0,0 +1,1968 @@ +<%@ jet package="org.apache.tuscany.sdo.generate.templates.model" imports="org.eclipse.emf.codegen.util.* org.apache.tuscany.sdo.impl.* java.util.* org.eclipse.emf.codegen.ecore.genmodel.* org.apache.tuscany.sdo.generate.util.*" class="SDOClass" version="$Id: Class.javajet,v 1.41 2006/02/15 19:58:39 emerks Exp $" %> +<% +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +%> +<%GenClass genClass = (GenClass)((Object[])argument)[0]; GenPackage genPackage = genClass.getGenPackage(); GenModel genModel=genPackage.getGenModel();%> +<%boolean isInterface = Boolean.TRUE.equals(((Object[])argument)[1]); boolean isImplementation = Boolean.TRUE.equals(((Object[])argument)[2]);%> +<%boolean isDebug = false;%> +<%String publicStaticFinalFlag = isImplementation ? "public static final " : "";%> +<%/*%> +<% * Output preamble and javadoc header%> +<% */%> +<%@ include file="../Header.javajetinc"%> +<%if (isInterface) {%> +package <%=genPackage.getInterfacePackageName()%>; +<%} else {%> +package <%=genPackage.getClassPackageName()%>; +<%}%> + +<%genModel.markImportLocation(stringBuffer, genPackage);%> + +<%if (isDebug) { // EYECATCHER 1 %> + // EYECATCHER 1 +<%}%> +<%if (isInterface) {%> +/** + * + * A representation of the model object '<%=genClass.getFormattedName()%>'. + * +<%if (genClass.hasDocumentation()) {%> + * + * + * <%=genClass.getDocumentation(genModel.getIndentation(stringBuffer))%> + * +<%}%> + * +<%if (!genClass.getGenFeatures().isEmpty()) {%> + *

+ * The following features are supported: + *

    +<%for (Iterator i=genClass.getGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genFeature.isSuppressedGetVisibility()) {%> + *
  • {@link <%=genClass.getQualifiedInterfaceName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}
  • + <%}%> +<%}%> + *
+ *

+<%}%> + * +<%if (!genModel.isSuppressEMFMetaData()) {%> + * @see <%=genPackage.getQualifiedPackageInterfaceName()%>#get<%=genClass.getClassifierAccessorName()%>() +<%}%> +<%if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genClass.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false;%> + * @model <%=modelInfo%> +<%} else {%> + * <%=modelInfo%> +<%}} if (first) {%> + * @model +<%}}%> +<%if (genClass.needsRootExtendsInterfaceExtendsTag()) { // does it need an @extends tag %> + * @extends <%=genModel.getImportedName(genModel.getRootExtendsInterface())%> +<%}%> + * @generated + */ +<%} else {%> +/** + * + * An implementation of the model object '<%=genClass.getFormattedName()%>'. + * + *

+<%if (!genClass.getImplementedGenFeatures().isEmpty()) {%> + * The following features are implemented: + *

    +<%for (Iterator i=genClass.getImplementedGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + *
  • {@link <%=genClass.getQualifiedClassName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}
  • +<%}%> + *
+<%}%> + *

+ * + * @generated + */ +<%}%> +<%if (isImplementation) {%> +public<%if (genClass.isAbstract()) {%> abstract<%}%> class <%=genClass.getClassName()%><%=genClass.getClassExtends()%><%=genClass.getClassImplements()%> +<%} else {%> +public interface <%=genClass.getInterfaceName()%><%=genClass.getInterfaceExtends()%> +<%}%> +{ +<%if (genModel.getCopyrightText() != null) {%> + /** + * + * + * @generated + */ + <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> copyright = "<%=genModel.getCopyrightText()%>";<%=genModel.getNonNLS()%> + +<%}%> +<%if (isImplementation && genModel.getDriverNumber() != null) {%> + /** + * + * + * @generated + */ + public static final <%=genModel.getImportedName("java.lang.String")%> mofDriverNumber = "<%=genModel.getDriverNumber()%>";<%=genModel.getNonNLS()%> + +<%}%> +<%if (isImplementation && genClass.isJavaIOSerializable()) {%> + /** + * + * + * @generated + */ + private static final long serialVersionUID = 1L; + +<%}%> +<%if (isImplementation && genModel.isVirtualDelegation()) { String eVirtualValuesField = genClass.getEVirtualValuesField();%> + <%if (eVirtualValuesField != null) {%> + /** + * An array of objects representing the values of non-primitive features. + * + * + * @generated + */ + protected Object[] <%=eVirtualValuesField%> = null; + + <%}%> + <%{ List eVirtualIndexBitFields = genClass.getEVirtualIndexBitFields(new ArrayList());%> + <%if (!eVirtualIndexBitFields.isEmpty()) {%> + <%for (Iterator i = eVirtualIndexBitFields.iterator(); i.hasNext();) { String eVirtualIndexBitField = (String)i.next();%> + /** + * A bit field representing the indices of non-primitive feature values. + * + * + * @generated + */ + protected int <%=eVirtualIndexBitField%> = 0; + + <%}%> + <%}%> + <%}%> +<%}%> +<%if (isImplementation && genClass.isModelRoot() && genModel.isBooleanFlagsEnabled() && genModel.getBooleanFlagsReservedBits() == -1) {%> + /** + * A set of bit flags representing the values of boolean attributes and whether unsettable features have been set. + * + * + * @generated + * @ordered + */ + protected int <%=genModel.getBooleanFlagsField()%> = 0; + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation()) {%> + + <%ClassImpl classImpl = (ClassImpl) genClass.getEcoreClass();%> + <%List declaredProperties = classImpl.getDeclaredProperties();%> + <%List extendedProperties = classImpl.getExtendedProperties();%> + <%int declaredPropertiesCount = 0;%> + <%int extendedPropertiesCount = 0;%> + <%for (Iterator f=genClass.getAllGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next();%> + <%if (declaredProperties.contains(genFeature.getEcoreFeature())){%> + <%declaredPropertiesCount++;%> + <%String featureValue = ""; + List allFeatures = genClass.getAllGenFeatures(); + int g = allFeatures.indexOf(genFeature); + GenClass base = genClass.getBaseGenClass(); + if (base == null) + { + featureValue = Integer.toString(declaredProperties.indexOf(genFeature.getEcoreFeature())); + } else { + int baseCount = base.getFeatureCount(); + if (g < baseCount) + { + featureValue = base.getImportedClassName() + "." + genFeature.getUpperName(); + } else { + String baseCountID = base.getImportedClassName() + "." + "SDO_PROPERTY_COUNT"; + featureValue = baseCountID + " + " + Integer.toString(declaredProperties.indexOf(genFeature.getEcoreFeature())); + } + }%> + public final static int <%=genFeature.getUpperName()%> = <%=featureValue%>; + + <%} else if (extendedProperties.contains(genFeature.getEcoreFeature())){%> + <%extendedPropertiesCount++;%> + <%String featureValue = ""; + List allFeatures = genClass.getAllGenFeatures(); + int g = allFeatures.indexOf(genFeature); + GenClass base = genClass.getBaseGenClass(); + if (base == null) + { + featureValue = Integer.toString(-1 - extendedProperties.indexOf(genFeature.getEcoreFeature())); + } else { + int baseCount = base.getFeatureCount(); + if (g < baseCount) + { + featureValue = base.getImportedClassName() + "." + genFeature.getUpperName(); + } else { + String baseCountID = base.getImportedClassName() + "." + "EXTENDED_PROPERTY_COUNT"; + featureValue = baseCountID + " + " + Integer.toString(-1 - extendedProperties.indexOf(genFeature.getEcoreFeature())); + } + }%> + public final static int <%=genFeature.getUpperName()%> = <%=featureValue%>; + + <%}%> + <%}%> + <%String featureCount = "";%> + <%GenClass base = genClass.getBaseGenClass();%> + <%if (base == null)%> + <%{%> + <%featureCount = Integer.toString(declaredPropertiesCount);%> + <%}%> + <%else {%> + <%String baseCountID = base.getImportedClassName() + "." + "SDO_PROPERTY_COUNT";%> + <%featureCount = baseCountID + " + " + Integer.toString(declaredPropertiesCount);%> + <%}%> + public final static int SDO_PROPERTY_COUNT = <%=featureCount%>; + + <%featureCount = "";%> + <%base = genClass.getBaseGenClass();%> + <%if (base == null)%> + <%{%> + <%featureCount = Integer.toString(extendedPropertiesCount*-1);%> + <%}%> + <%else {%> + <%String baseCountID = base.getImportedClassName() + "." + "EXTENDED_PROPERTY_COUNT";%> + <%featureCount = baseCountID + " - " + Integer.toString(extendedPropertiesCount);%> + <%}%> + public final static int EXTENDED_PROPERTY_COUNT = <%=featureCount%>; + + + <%for (Iterator f=genClass.getAllGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next();%> + /** + * The internal feature id for the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%>. + * + * + * @generated + * @ordered + */ + <%String featureValue = "";%> + <%List allFeatures = genClass.getAllGenFeatures();%> + <%int g = allFeatures.indexOf(genFeature);%> + <%base = genClass.getBaseGenClass();%> + <%if (base == null)%> + <%{%> + <%featureValue = Integer.toString(g);%> + <%} else {%> + <%int baseCount = base.getFeatureCount();%> + <%if (g < baseCount)%> + <%{%> + <%featureValue = base.getImportedClassName() + "._INTERNAL_" + genFeature.getUpperName();%> + <%} else {%> + <%String baseCountID = base.getImportedClassName() + "." + "INTERNAL_PROPERTY_COUNT";%> + <%featureValue = baseCountID + " + " + Integer.toString(g - baseCount);%> + <%}%> + <%}%> + public final static int _INTERNAL_<%=genFeature.getUpperName()%> = <%=featureValue%>; + + <%}%> + /** + * The number of properties for this type. + * + * + * @generated + * @ordered + */ + <%featureCount = ""; + base = genClass.getBaseGenClass(); + if (base == null) + { + featureCount = Integer.toString(genClass.getFeatureCount()); + } + else { + String baseCountID = base.getImportedClassName() + "." + "INTERNAL_PROPERTY_COUNT"; + featureCount = baseCountID + " + " + Integer.toString(genClass.getFeatureCount() - base.getFeatureCount()); + }%> + public final static int INTERNAL_PROPERTY_COUNT = <%=featureCount%>; + + protected int internalConvertIndex(int internalIndex) + { + switch (internalIndex) + { + <%for (Iterator f=genClass.getAllGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next();%> + case _INTERNAL_<%=genFeature.getUpperName()%>: return <%=genFeature.getUpperName()%>; + <%}%> + } + return super.internalConvertIndex(internalIndex); + } + + + <%for (Iterator i=genClass.getDeclaredFieldGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> +<%@ include file="Class/declaredFieldGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + <%if (genFeature.isListType() || genFeature.isReferenceType()) {%> + <%if (genClass.isField(genFeature)) {%> + /** + * The cached value of the '{@link #<%=genFeature.getGetAccessor()%>() <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + * @see #<%=genFeature.getGetAccessor()%>() + * @generated + * @ordered + */ + + protected <%=genModel.getImportedName(genFeature.getType())%> <%=genFeature.getSafeName()%> = null; + + <%}%> + <%if (genModel.isArrayAccessors() && !genFeature.isFeatureMapType() && !genFeature.isMapType()) {%> + /** + * The empty value for the '{@link #<%=genFeature.getGetArrayAccessor()%>() <%=genFeature.getFormattedName()%>}' array accessor. + * + * + * @see #<%=genFeature.getGetArrayAccessor()%>() + * @generated + * @ordered + */ + protected static final <%=genFeature.getListItemType()%>[] <%=genFeature.getUpperName()%>_EEMPTY_ARRAY = new <%=genFeature.getListItemType()%> [0]; + + <%}%> + <%} else {%> + <%if (!genFeature.isVolatile() || !genModel.isReflectiveDelegation() && (!genFeature.hasDelegateFeature() || !genFeature.isUnsettable())) {%> + /** + * The default value of the '{@link #<%=genFeature.getGetAccessor()%>() <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + * @see #<%=genFeature.getGetAccessor()%>() + * @generated + * @ordered + */ + protected static final <%=genFeature.getImportedType()%> <%=genFeature.getUpperName()%>_DEFAULT_ = <%=SDOGenUtil.getStaticDefaultValue(genFeature)%>;<%=genModel.getNonNLS(genFeature.getStaticDefaultValue())%> + + <%}%> + <%if (genClass.isField(genFeature)) {%> + <%if (genClass.isFlag(genFeature)) {%> + <%if (genClass.getFlagIndex(genFeature) > 31 && genClass.getFlagIndex(genFeature) % 32 == 0) {%> + /** + * An additional set of bit flags representing the values of boolean attributes and whether unsettable features have been set. + * + * + * @generated + * @ordered + */ + protected int <%=genClass.getFlagsField(genFeature)%> = 0; + + <%}%> + /** + * The flag representing the value of the '{@link #<%=genFeature.getGetAccessor()%>() <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + * @see #<%=genFeature.getGetAccessor()%>() + * @generated + * @ordered + */ + protected static final int <%=genFeature.getUpperName()%>_EFLAG = 1 <%="<< " + genClass.getFlagIndex(genFeature) % 32 %>; + + <%} else {%> + /** + * The cached value of the '{@link #<%=genFeature.getGetAccessor()%>() <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + * @see #<%=genFeature.getGetAccessor()%>() + * @generated + * @ordered + */ + protected <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = <%=genFeature.getUpperName()%>_DEFAULT_; + + <%}%> + <%}%> + <%}%> + <%if (genClass.isESetField(genFeature)) {%> + <%if (genClass.isESetFlag(genFeature)) {%> + <%if (genClass.getESetFlagIndex(genFeature) > 31 && genClass.getESetFlagIndex(genFeature) % 32 == 0) {%> + /** + * An additional set of bit flags representing the values of boolean attributes and whether unsettable features have been set. + * + * + * @generated + * @ordered + */ + protected int <%=genClass.getESetFlagsField(genFeature)%> = 0; + + <%}%> + /** + * The flag representing whether the <%=genFeature.getFormattedName()%> <%=genFeature.getFeatureKind()%> has been set. + * + * + * @generated + * @ordered + */ + protected static final int <%=genFeature.getUpperName()%>_ESETFLAG = 1 <%="<< " + genClass.getESetFlagIndex(genFeature) % 32 %>; + + <%} else {%> + /** + * This is true if the <%=genFeature.getFormattedName()%> <%=genFeature.getFeatureKind()%> has been set. + * + * + * @generated + * @ordered + */ + protected boolean <%=genFeature.getUncapName()%>_set_ = false; + + <%}%> + <%}%> + <%}%> +<%@ include file="Class/declaredFieldGenFeature.insert.javajetinc" fail="silent" %> +<%@ end %><%//Class/declaredFieldGenFeature.override.javajetinc%> +<%}%> +<%if (isImplementation) { // create constructor %> + /** + * + * + * @generated + */ + public <%=genClass.getClassName()%>() + { + super(); + <%for (Iterator i=genClass.getFlagGenFeatures("true").iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%=genClass.getFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_EFLAG; + <%}%> + <%if (SDOGenUtil.hasChangeSummaryProperty(genClass)) {%> + createChangeSummary(<%=SDOGenUtil.getChangeSummaryProperty(genClass)%>); + <%}%> + } + + /** + * + * + * @generated + */ + public <%=genModel.getImportedName("commonj.sdo.Type")%> getStaticType() + { + return ((<%=genPackage.getImportedFactoryClassName()%>)<%=genPackage.getImportedFactoryInterfaceName()%>.INSTANCE).get<%=genClass.getClassifierAccessorName()%>(); + } + + /** + * + * + * @generated + */ + public int getStaticPropertyCount() + { + return INTERNAL_PROPERTY_COUNT; + } + +<%}%> +<%/*%> +<% * Output getter and setter interfaces / impls%> +<% */%> +<%%> +<%for (Iterator i=(isImplementation ? genClass.getImplementedGenFeatures() : genClass.getDeclaredGenFeatures()).iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> +<%@ include file="Class/genFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + <%if (genModel.isArrayAccessors() && genFeature.isListType() && !genFeature.isFeatureMapType() && !genFeature.isMapType()) {%> + /** + * + * + * @generated + */ + <%if (!isImplementation) {%> + <%=genFeature.getListItemType()%>[] <%=genFeature.getGetArrayAccessor()%>(); + + <%} else {%> + public <%=genFeature.getListItemType()%>[] <%=genFeature.getGetArrayAccessor()%>() + { + <%if (genFeature.isVolatile()) {%> + <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")%> list = (<%=genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")%>)<%=genFeature.getGetAccessor()%>(); + if (list.isEmpty()) return <%=genFeature.getUpperName()%>_EEMPTY_ARRAY; + <%} else {%> + if (<%=genFeature.getSafeName()%> == null || <%=genFeature.getSafeName()%>.isEmpty()) return <%=genFeature.getUpperName()%>_EEMPTY_ARRAY; + <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")%> list = (<%=genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")%>)<%=genFeature.getSafeName()%>; + <%}%> + list.shrink(); + return (<%=genFeature.getListItemType()%>[])list.data(); + } + + <%}%> + /** + * + * + * @generated + */ + <%if (!isImplementation) {%> + <%=genFeature.getListItemType()%> get<%=genFeature.getAccessorName()%>(int index); + <%} else {%> + public <%=genFeature.getListItemType()%> get<%=genFeature.getAccessorName()%>(int index) + { + return (<%=genFeature.getListItemType()%>)<%=genFeature.getGetAccessor()%>().get(index); + } + <%}%> + /** + * + * + * @generated + */ + <%if (!isImplementation) {%> + int get<%=genFeature.getAccessorName()%>Length(); + + <%} else {%> + public int get<%=genFeature.getAccessorName()%>Length() + { + <%if (genFeature.isVolatile()) {%> + return <%=genFeature.getGetAccessor()%>().size(); + <%} else {%> + return <%=genFeature.getSafeName()%> == null ? 0 : <%=genFeature.getSafeName()%>.size(); + <%}%> + } + + <%}%> + /** + * + * + * @generated + */ + <%if (!isImplementation) {%> + void set<%=genFeature.getAccessorName()%>(<%=genFeature.getListItemType()%>[] new<%=genFeature.getCapName()%>); + + <%} else {%> + public void set<%=genFeature.getAccessorName()%>(<%=genFeature.getListItemType()%>[] new<%=genFeature.getCapName()%>) + { + ((<%=genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")%>)<%=genFeature.getGetAccessor()%>()).setData(new<%=genFeature.getCapName()%>.length, new<%=genFeature.getCapName()%>); + } + + <%}%> + /** + * + * + * @generated + */ + <%if (!isImplementation) {%> + void set<%=genFeature.getAccessorName()%>(int index, <%=genFeature.getListItemType()%> element); + + <%} else {%> + public void set<%=genFeature.getAccessorName()%>(int index, <%=genFeature.getListItemType()%> element) + { + <%=genFeature.getGetAccessor()%>().set(index, element); + } + + <%}%> + <%}%> + <%if (genFeature.isGet() && (isImplementation || !genFeature.isSuppressedGetVisibility())) {%> +<%@ include file="Class/getGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) {%> + /** + * Returns the value of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%>. + <%if (genFeature.isListType()) {%> + <%if (genFeature.isMapType()) { GenFeature keyFeature = genFeature.getMapEntryTypeGenClass().getMapEntryKeyFeature(); GenFeature valueFeature = genFeature.getMapEntryTypeGenClass().getMapEntryValueFeature(); %> + * The key is of type <%if (keyFeature.isListType()) {%>list of {@link <%=keyFeature.getQualifiedListItemType()%>}<%} else {%>{@link <%=keyFeature.getType()%>}<%}%>, + * and the value is of type <%if (valueFeature.isListType()) {%>list of {@link <%=valueFeature.getQualifiedListItemType()%>}<%} else {%>{@link <%=valueFeature.getType()%>}<%}%>, + <%} else if (!genFeature.isWrappedFeatureMapType() && !(genModel.isSuppressEMFMetaData() && "org.eclipse.emf.ecore.EObject".equals(genFeature.getQualifiedListItemType()))) {%> + * The list contents are of type {@link <%=genFeature.getQualifiedListItemType()%>}. + <%}%> + <%} else if (genFeature.isSetDefaultValue()) {%> + * The default value is <%=genFeature.getDefaultValue()%>. + <%}%> + <%if (genFeature.getTypeGenEnum() != null) {%> + * The literals are from the enumeration {@link <%=genFeature.getTypeGenEnum().getQualifiedName()%>}. + <%}%> + <%if (genFeature.isBidirectional() && !genFeature.getReverse().getGenClass().isMapEntry()) { GenFeature reverseGenFeature = genFeature.getReverse(); %> + <%if (!reverseGenFeature.isSuppressedGetVisibility()) {%> + * It is bidirectional and its opposite is '{@link <%=reverseGenFeature.getGenClass().getQualifiedInterfaceName()%>#<%=reverseGenFeature.getGetAccessor()%> <%=reverseGenFeature.getFormattedName()%>}'. + <%}%> + <%}%> + * + <%if (!genFeature.hasDocumentation()) {%> + *

+ * If the meaning of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> isn't clear, + * there really should be more of a description here... + *

+ <%}%> + * + <%if (genFeature.hasDocumentation()) {%> + * + * <%=genFeature.getDocumentation(genModel.getIndentation(stringBuffer))%> + * + <%}%> + * @return the value of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%>. + <%if (genFeature.getTypeGenEnum() != null) {%> + * @see <%=genFeature.getTypeGenEnum().getQualifiedName()%> + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (!genFeature.isSuppressedIsSetVisibility()) {%> + * @see #isSet<%=genFeature.getAccessorName()%>() + <%}%> + <%if (genFeature.isChangeable() && !genFeature.isSuppressedUnsetVisibility()) {%> + * @see #unset<%=genFeature.getAccessorName()%>() + <%}%> + <%}%> + <%if (genFeature.isChangeable() && !genFeature.isListType() && !genFeature.isSuppressedSetVisibility()) {%> + * @see #set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%>) + <%}%> + <%if (!genModel.isSuppressEMFMetaData()) {%> + * @see <%=genPackage.getQualifiedPackageInterfaceName()%>#get<%=genFeature.getFeatureAccessorName()%>() + <%}%> + <%if (genFeature.isBidirectional() && !genFeature.getReverse().getGenClass().isMapEntry()) { GenFeature reverseGenFeature = genFeature.getReverse(); %> + <%if (!reverseGenFeature.isSuppressedGetVisibility()) {%> + * @see <%=reverseGenFeature.getGenClass().getQualifiedInterfaceName()%>#<%=reverseGenFeature.getGetAccessor()%> + <%}%> + <%}%> + <%if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genFeature.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false;%> + * @model <%=modelInfo%> + <%} else {%> + * <%=modelInfo%> + <%}} if (first) {%> + * @model + <%}}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getGetAccessor()%>(); + +<%} else {%> + public <%=genFeature.getImportedType()%> <%=genFeature.getGetAccessor()%>() + { +<%@ include file="Class/getGenFeature.pre.insert.javajetinc" fail="silent" %> + <%if (genModel.isReflectiveDelegation()) {%> + return <%if (genFeature.isPrimitiveType()) {%>(<%}%>(<%=genFeature.getObjectType()%>)get(<%=genFeature.getQualifiedFeatureAccessor()%>, true)<%if (genFeature.isPrimitiveType()) {%>).<%=genFeature.getPrimitiveValueFunction()%>()<%}%>; + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isListType()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (<%=genFeature.getSafeName()%> == null) + { + <%if (genModel.isVirtualDelegation()) {%> + eVirtualSet(<%=genFeature.getUpperName()%>, <%=genFeature.getSafeName()%> = new <%=genClass.getListConstructor(genFeature)%>); + <%} else { + if (genFeature.getType().equals("commonj.sdo.Sequence")){%> + <%=genFeature.getSafeName()%> = createSequence(_INTERNAL_<%=genFeature.getUpperName()%>);<%} else {%> + <%=genFeature.getSafeName()%> = createPropertyList(<%=SDOGenUtil.getListKind(genFeature, genFeature.isUnsettable())%>, <%=genFeature.getListItemType()%>.class, <%=genFeature.getUpperName()%>, <%=genFeature.isBidirectional()?genFeature.getReverse().getUpperName():"0" %>);<%}}%> + } + return <%=genFeature.getSafeName()%><%=genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes() ? ".map()" : ""%>; + <%} else if (genFeature.isContainer()) {%> + if (eContainerFeatureID != <%=genFeature.getUpperName()%>) return null; + return (<%=genFeature.getImportedType()%>)eContainer(); + <%} else {%> + <%if (genFeature.isResolveProxies()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%><%if (!genFeature.isReferenceType()) {%>, <%=genFeature.getUpperName()%>_DEFAULT_<%}%>); + <%}%> + if (<%=genFeature.getSafeName()%> != null && isProxy(<%=genFeature.getSafeName()%>)) + { + Object old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%=genFeature.getSafeName()%> = <%=genFeature.getNonEObjectInternalTypeCast()%>resolveProxy(old<%=genFeature.getCapName()%>); + if (<%=genFeature.getSafeName()%> != old<%=genFeature.getCapName()%>) + { + <%if (genFeature.isEffectiveContains()) {%> + <%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%> new<%=genFeature.getCapName()%> = (<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>; + <%if (!genFeature.isBidirectional()) {%> + ChangeContext changeContext = old<%=genFeature.getCapName()%>.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, null); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + <%=genModel.getImportedName("org.eclipse.emf.common.notify.ChangeContext")%> changeContext = old<%=genFeature.getCapName()%>.eInverseRemove(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, null); + <%}%> + if (new<%=genFeature.getCapName()%>.eInternalContainer() == null) + { + <%if (!genFeature.isBidirectional()) {%> + changeContext = new<%=genFeature.getCapName()%>.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = new<%=genFeature.getCapName()%>.eInverseAdd(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + } + if (changeContext != null) dispatch(changeContext); + <%} else if (genModel.isVirtualDelegation()) {%> + eVirtualSet(<%=genFeature.getUpperName()%>, <%=genFeature.getSafeName()%>); + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.RESOLVE, _INTERNAL_<%=genFeature.getUpperName()%>, old<%=genFeature.getCapName()%>, <%=genFeature.getSafeName()%>); + <%}%> + } + } + <%}%> + <%if (!genFeature.isResolveProxies() && genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + return (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%><%if (!genFeature.isReferenceType()) {%>, <%=genFeature.getUpperName()%>_DEFAULT_<%}%>); + <%} else if (genClass.isFlag(genFeature)) {%> + return (<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0; + <%} else {%> + return <%=genFeature.getSafeName()%>; + <%}%> + <%}%> + <%} else {//volatile%> + <%if (genFeature.isResolveProxies() && !genFeature.isListType()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = basicGet<%=genFeature.getAccessorName()%>(); + return <%=genFeature.getSafeName()%> != null && <%=genFeature.getSafeName()%>.isProxy() ? <%=genFeature.getNonEObjectInternalTypeCast()%>eResolveProxy((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>) : <%=genFeature.getSafeName()%>; + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); // AAAA%> + <%if (genFeature.isFeatureMapType()) {%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return create<%=genFeature.getImportedType()%>(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>); + <%} else {%> + return (<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>)((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>)get<%=delegateFeature.getAccessorName()%>()).list(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%}%> + <%} else if (genFeature.isListType()) {%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return get<%=genFeature.getImportedType()%>(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>); + <%} else {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>)get<%=delegateFeature.getAccessorName()%>()).list(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%}%> + <%} else {%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return <%if (genFeature.isPrimitiveType()) {%>(<%}%>(<%=genFeature.getObjectType()%>)get(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>)<%if (genFeature.isPrimitiveType()) {%>).<%=genFeature.getPrimitiveValueFunction()%>()<%}%>; + <%} else {%> + return <%if (genFeature.isPrimitiveType()) {%>(<%}%>(<%=genFeature.getObjectType()%>)get(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>)<%if (genFeature.isPrimitiveType()) {%>).<%=genFeature.getPrimitiveValueFunction()%>()<%}%>; + <%}%> + <%}%> + <%} else {%> +<%@ include file="Class/getGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to return the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/getGenFeature.todo.override.javajetinc%> + <%}%> + <%}%> + } +<%}%> +<%@ end %><%//Class/getGenFeature.override.javajetinc%> + <%}%> + <%if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicGet()) {%> +<%@ include file="Class/basicGetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public <%=genFeature.getImportedType()%> basicGet<%=genFeature.getAccessorName()%>() + { +<%@ include file="Class/basicGetGenFeature.pre.insert.javajetinc" fail="silent" %> + <%if (genFeature.isContainer()) {%> + if (eContainerFeatureID != <%=genFeature.getUpperName()%>) return null; + return (<%=genFeature.getImportedType()%>)eInternalContainer(); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genModel.isVirtualDelegation()) {%> + return (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%} else {%> + return <%=genFeature.getSafeName()%>; + <%}%> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //BBBB%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return (<%=genFeature.getImportedType()%>)get(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>); + <%} else {%> + return (<%=genFeature.getImportedType()%>)get<%=delegateFeature.getAccessorName()%>().get(<%=genFeature.getQualifiedFeatureAccessor()%>, false); + <%}%> + <%} else {%> +<%@ include file="Class/basicGetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to return the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // -> do not perform proxy resolution + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/basicGetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%@ end %><%//Class/basicGetGenFeature.override.javajetinc%> + <%}%> + <%if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicSet()) {%> +<%@ include file="Class/basicSetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public ChangeContext basicSet<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedInternalType()%> new<%=genFeature.getCapName()%>, ChangeContext changeContext) + { + <%if (!genFeature.isVolatile()) {%> +<%@ include file="Class/basicSetGenFeature.pre.insert.javajetinc" fail="silent" %> + <%if (genModel.isVirtualDelegation()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualSet(<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>); + <%} else {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%=genFeature.getSafeName()%> = new<%=genFeature.getCapName()%>; + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (genModel.isVirtualDelegation()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%=genClass.getESetFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%=genFeature.getUncapName()%>_set_ = true; + <%}%> + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + { + <%if (genFeature.isUnsettable()) {%> + addNotification(this, ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange ? null : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, new<%=genFeature.getCapName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange<%} else {%>!old<%=genFeature.getCapName()%>_set_<%}%>, changeContext); + <%} else {%> + addNotification(this, ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE ? null : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, new<%=genFeature.getCapName()%>, changeContext); + <%}%> + } + <%}%> +<%@ include file="Class/basicSetGenFeature.post.insert.javajetinc" fail="silent" %> + return changeContext; + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //CCCC%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return basicAdd(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, changeContext); + <%} else {%> + return basicAdd(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, changeContext); + <%}%> + <%} else {%> +<%@ include file="Class/basicSetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to set the contained '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // -> this method is automatically invoked to keep the containment relationship in synch + // -> do not modify other features + // -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first) + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/basicSetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%@ end %><%//Class/basicSetGenFeature.override.javajetinc%> + <%}%> + <%if (genFeature.isSet() && (isImplementation || !genFeature.isSuppressedSetVisibility())) {%> +<%@ include file="Class/setGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) { %> + /** + * Sets the value of the '{@link <%=genClass.getQualifiedInterfaceName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + * @param value the new value of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%>. + <%if (genFeature.isEnumType()) {%> + * @see <%=genFeature.getTypeGenEnum().getQualifiedName()%> + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (!genFeature.isSuppressedIsSetVisibility()) {%> + * @see #isSet<%=genFeature.getAccessorName()%>() + <%}%> + <%if (!genFeature.isSuppressedUnsetVisibility()) {%> + * @see #unset<%=genFeature.getAccessorName()%>() + <%}%> + <%}%> + * @see #<%=genFeature.getGetAccessor()%>() + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) { %> + void set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%> value); + +<%} else {%> + public void set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%> new<%=genFeature.getCapName()%>) + { +<%@ include file="Class/setGenFeature.pre.insert.javajetinc" fail="alternative" %> + <%if (genModel.isReflectiveDelegation()) {%> + _set_(<%=genFeature.getQualifiedFeatureAccessor()%>, <%if (genFeature.isPrimitiveType()) {%>new <%=genFeature.getObjectType()%>(<%}%>new<%=genFeature.getCapName()%><%if (genFeature.isPrimitiveType()) {%>)<%}%>); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isContainer()) { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + if (new<%=genFeature.getCapName()%> != eInternalContainer() || (eContainerFeatureID != <%=genFeature.getUpperName()%> && new<%=genFeature.getCapName()%> != null)) + { + if (<%=genModel.getImportedName("org.eclipse.emf.ecore.util.EcoreUtil")%>.isAncestor(this, <%=genFeature.getEObjectCast()%>new<%=genFeature.getCapName()%>)) + throw new <%=genModel.getImportedName("java.lang.IllegalArgumentException")%>("Recursive containment not allowed for " + toString());<%=genModel.getNonNLS()%> + ChangeContext changeContext = null; + if (eInternalContainer() != null) + changeContext = eBasicRemoveFromContainer(changeContext); + if (new<%=genFeature.getCapName()%> != null) + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)new<%=genFeature.getCapName()%>).eInverseAdd(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + changeContext = eBasicSetContainer((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)new<%=genFeature.getCapName()%>, <%=genFeature.getUpperName()%>, changeContext); + if (changeContext != null) dispatch(changeContext); + } + <%if (!genModel.isSuppressNotification()) {%> + else if (isNotifying()) + notify(ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, new<%=genFeature.getCapName()%>); + <%}%> + <%} else if (genFeature.isBidirectional() || genFeature.isEffectiveContains()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (new<%=genFeature.getCapName()%> != <%=genFeature.getSafeName()%>) + { + ChangeContext changeContext = null; + if (<%=genFeature.getSafeName()%> != null) + <%if (!genFeature.isBidirectional()) {%> + changeContext = inverseRemove(<%=genFeature.getSafeName()%>, this, OPPOSITE_FEATURE_BASE - _INTERNAL_<%=genFeature.getUpperName()%>, null, changeContext); + if (new<%=genFeature.getCapName()%> != null) + changeContext = inverseAdd(new<%=genFeature.getCapName()%>, this, OPPOSITE_FEATURE_BASE - _INTERNAL_<%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = inverseRemove(<%=genFeature.getSafeName()%>, this, <%=SDOGenUtil.getQualifiedInternalPropertyID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + if (new<%=genFeature.getCapName()%> != null) + changeContext = inverseAdd(new<%=genFeature.getCapName()%>, this, <%=SDOGenUtil.getQualifiedInternalPropertyID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + changeContext = basicSet<%=genFeature.getAccessorName()%>(<%=genFeature.getInternalTypeCast()%>new<%=genFeature.getCapName()%>, changeContext); + if (changeContext != null) dispatch(changeContext); + } + <%if (genFeature.isUnsettable()) {%> + else + { + <%if (genModel.isVirtualDelegation()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = eVirtualIsSet(<%=genFeature.getUpperName()%>); + <%} else if (genClass.isESetFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%}%> + <%=genClass.getESetFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%=genFeature.getUncapName()%>_set_ = true; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, new<%=genFeature.getCapName()%>, !old<%=genFeature.getCapName()%>_set_); + <%}%> + } + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + else if (isNotifying()) + notify(ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, new<%=genFeature.getCapName()%>); + <%}%> + <%}%> + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = (<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0; + <%}%> + if (new<%=genFeature.getCapName()%>) <%=genClass.getFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_EFLAG; else <%=genClass.getFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_EFLAG; + <%} else {%> + <%if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%}%> + <%}%> + <%if (genFeature.isEnumType()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = new<%=genFeature.getCapName()%> == null ? <%=genFeature.getUpperName()%>_DEFAULT_ : new<%=genFeature.getCapName()%>; + <%} else {%> + <%=genFeature.getSafeName()%> = new<%=genFeature.getCapName()%> == null ? <%=genFeature.getUpperName()%>_DEFAULT_ : new<%=genFeature.getCapName()%>; + <%}%> + <%} else {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = <%=genFeature.getInternalTypeCast()%>new<%=genFeature.getCapName()%>; + <%} else {%> + <%=genFeature.getSafeName()%> = <%=genFeature.getInternalTypeCast()%>new<%=genFeature.getCapName()%>; + <%}%> + <%}%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualSet(<%=genFeature.getUpperName()%>, <%=genFeature.getSafeName()%>); + <%}%> + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%}%> + <%=genClass.getESetFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%=genFeature.getUncapName()%>_set_ = true; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange ? <%if (genFeature.isReferenceType()) {%>null<%} else {%><%=genFeature.getUpperName()%>_DEFAULT_<%}%> : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, <%if (genClass.isFlag(genFeature)) {%>new<%=genFeature.getCapName()%><%} else {%><%=genFeature.getSafeName()%><%}%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange<%} else {%>!old<%=genFeature.getCapName()%>_set_<%}%>); + <%}%> + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE ? <%if (genFeature.isReferenceType()) {%>null<%} else {%><%=genFeature.getUpperName()%>_DEFAULT_<%}%> : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, <%if (genClass.isFlag(genFeature)) {%>new<%=genFeature.getCapName()%><%} else {%><%=genFeature.getSafeName()%><%}%>); + <%}%> + <%}%> + <%}%> +<%@ include file="Class/setGenFeature.post.insert.javajetinc" fail="silent" %> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); // DDDD%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + set(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genFeature.isPrimitiveType()){%> new <%=genFeature.getObjectType()%>(<%}%>new<%=genFeature.getCapName()%><%if (genFeature.isPrimitiveType()){%>)<%}%>); + <%} else {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)get<%=delegateFeature.getAccessorName()%>()).set(<%=genFeature.getQualifiedFeatureAccessor()%>, <%if (genFeature.isPrimitiveType()) {%>new <%=genFeature.getObjectType()%>(<%}%>new<%=genFeature.getCapName()%><%if (genFeature.isPrimitiveType()){%>)<%}%>); + <%}%> + <%} else {%> +<%@ include file="Class/setGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to set the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/setGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ end %><%//Class/setGenFeature.override.javajetinc%> + <%}%> + <%if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicUnset()) {%> +<%@ include file="Class/basicUnsetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public ChangeContext basicUnset<%=genFeature.getAccessorName()%>(ChangeContext changeContext) + { + <%if (!genFeature.isVolatile()) {%> + <%if (genModel.isVirtualDelegation()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualUnset(<%=genFeature.getUpperName()%>); + <%} else {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%=genFeature.getSafeName()%> = null; + <%}%> + <%if (genModel.isVirtualDelegation()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> != EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + { + <%if (genFeature.isUnsettable()) {%> + addNotification(this, ChangeKind.UNSET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange ? null : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, null, <%if (genModel.isVirtualDelegation()) {%>isSetChange<%} else {%>!old<%=genFeature.getCapName()%>_set_<%}%>, changeContext); + <%} else {%> + addNotification(this, ChangeKind.UNSET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE ? null : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, null, changeContext); + <%}%> + } + <%}%> + return changeContext; + <%} else {%> +<%@ include file="Class/basicUnsetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to unset the contained '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // -> this method is automatically invoked to keep the containment relationship in synch + // -> do not modify other features + // -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first) + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/basicUnsetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%@ end %><%//Class.basicUnsetGenFeature.override.javajetinc%> + <%}%> + <%if (genFeature.isUnset() && (isImplementation || !genFeature.isSuppressedUnsetVisibility())) {%> +<%@ include file="Class/unsetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) {%> + /** + * Unsets the value of the '{@link <%=genClass.getQualifiedInterfaceName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + <%if (!genFeature.isSuppressedIsSetVisibility()) {%> + * @see #isSet<%=genFeature.getAccessorName()%>() + <%}%> + * @see #<%=genFeature.getGetAccessor()%>() + <%if (!genFeature.isListType() && !genFeature.isSuppressedSetVisibility()) {%> + * @see #set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%>) + <%}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + void unset<%=genFeature.getAccessorName()%>(); + +<%} else {%> + public void unset<%=genFeature.getAccessorName()%>() + { + <%if (genModel.isReflectiveDelegation()) {%> + unset(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isListType()) {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>.Unsettable)get<%=genFeature.getAccessorName()%>()).unset(); + <%} else if (genFeature.isBidirectional() || genFeature.isEffectiveContains()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (<%=genFeature.getSafeName()%> != null) + { + ChangeContext changeContext = null; + <%if (!genFeature.isBidirectional()) {%> + changeContext = inverseRemove(<%=genFeature.getSafeName()%>, this, EOPPOSITE_FEATURE_BASE - _INTERNAL_<%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = inverseRemove(<%=genFeature.getSafeName()%>, this, <%=SDOGenUtil.getQualifiedInternalPropertyID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + changeContext = basicUnset<%=genFeature.getAccessorName()%>(changeContext); + if (changeContext != null) dispatch(changeContext); + } + else + { + <%if (genModel.isVirtualDelegation()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = eVirtualIsSet(<%=genFeature.getUpperName()%>); + <%} else if (genClass.isESetFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%}%> + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.UNSET, _INTERNAL_<%=genFeature.getUpperName()%>, null, null, old<%=genFeature.getCapName()%>_set_); + <%}%> + } + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = (<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0; + <%}%> + <%} else if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualUnset(<%=genFeature.getUpperName()%>); + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%}%> + <%}%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> != EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%}%> + <%if (genFeature.isReferenceType()) {%> + <%=genFeature.getSafeName()%> = null; + <%if (!genModel.isVirtualDelegation()) {%> + <%if (genClass.isESetFlag(genFeature)) {%> + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.UNSET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange ? old<%=genFeature.getCapName()%> : null<%} else {%>old<%=genFeature.getCapName()%><%}%>, null, <%if (genModel.isVirtualDelegation()) {%>isSetChange<%} else {%>old<%=genFeature.getCapName()%>_set_<%}%>); + <%}%> + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + if (<%=genFeature.getUpperName()%>_DEFAULT_) <%=genClass.getFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_EFLAG; else <%=genClass.getFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_EFLAG; + <%} else if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) {%> + <%=genFeature.getSafeName()%> = <%=genFeature.getUpperName()%>_DEFAULT_; + <%}%> + <%if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) {%> + <%if (genClass.isESetFlag(genFeature)) {%> + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.UNSET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange ? old<%=genFeature.getCapName()%> : <%=genFeature.getUpperName()%>_DEFAULT_<%} else {%>old<%=genFeature.getCapName()%><%}%>, <%=genFeature.getUpperName()%>_DEFAULT_, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange<%} else {%>old<%=genFeature.getCapName()%>_set_<%}%>); + <%}%> + <%}%> + <%}%> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //EEEE%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + unset(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>); + <%} else {%> + unset<%=genFeature.getImportedType()%>(get<%=delegateFeature.getAccessorName()%>()); + <%}%> + <%} else {%> +<%@ include file="Class/unsetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to unset the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/unsetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ end %><%//Class/unsetGenFeature.override.javajetinc%> + <%}%> + <%if (genFeature.isIsSet() && (isImplementation || !genFeature.isSuppressedIsSetVisibility())) {%> +<%@ include file="Class/isSetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) {%> + /** + * Returns whether the value of the '{@link <%=genClass.getQualifiedInterfaceName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%> is set. + * + * + * @return whether the value of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> is set. + <%if (genFeature.isChangeable() && !genFeature.isSuppressedUnsetVisibility()) {%> + * @see #unset<%=genFeature.getAccessorName()%>() + <%}%> + * @see #<%=genFeature.getGetAccessor()%>() + <%if (!genFeature.isListType() && genFeature.isChangeable() && !genFeature.isSuppressedSetVisibility()) {%> + * @see #set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%>) + <%}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + boolean isSet<%=genFeature.getAccessorName()%>(); + +<%} else {%> + public boolean isSet<%=genFeature.getAccessorName()%>() + { + <%if (genModel.isReflectiveDelegation()) {%> + return isSet(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isListType()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + return <%=genFeature.getSafeName()%> != null && ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>.Unsettable)<%=genFeature.getSafeName()%>).isSet(); + <%} else {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + return eVirtualIsSet(<%=genFeature.getUpperName()%>); + <%} else if (genClass.isESetFlag(genFeature)) {%> + return (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%} else {%> + return <%=genFeature.getUncapName()%>_set_; + <%}%> + <%}%> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //FFFF%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return isSet(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>); + <%} else {%> + return !((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)get<%=delegateFeature.getAccessorName()%>()).isEmpty(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%}%> + <%} else {%> +<%@ include file="Class/isSetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to return whether the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> is set + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/isSetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ end %><%//Class/isSetGenFeature.override.javajetinc%> + <%}%> +<%@ include file="Class/genFeature.insert.javajetinc" fail="silent" %> +<%@ end %><%//Class/genFeature.override.javajetinc%> +<%}// end output getter and setter interfaces or impls%> +<%for (Iterator i= (isImplementation ? genClass.getImplementedGenOperations() : genClass.getDeclaredGenOperations()).iterator(); i.hasNext();) { GenOperation genOperation = (GenOperation)i.next();%> +<%@ include file="Class/genOperation.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) {%> + /** + * + * + <%if (genOperation.hasDocumentation()) {%> + * + * <%=genOperation.getDocumentation(genModel.getIndentation(stringBuffer))%> + * + <%}%> + <%if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genOperation.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false;%> + * @model <%=modelInfo%> + <%} else {%> + * <%=modelInfo%> + <%}} if (first) {%> + * @model + <%}}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + <%=genOperation.getImportedType()%> <%=genOperation.getName()%>(<%=genOperation.getParameters()%>)<%=genOperation.getThrows()%>; + +<%} else {%> + public <%=genOperation.getImportedType()%> <%=genOperation.getName()%>(<%=genOperation.getParameters()%>)<%=genOperation.getThrows()%> + { + <%if (genOperation.hasBody()) {%> + <%=genOperation.getBody(genModel.getIndentation(stringBuffer))%> + <%} else if (genOperation.isInvariant()) {GenClass opClass = genOperation.getGenClass(); String diagnostics = ((GenParameter)genOperation.getGenParameters().get(0)).getName(); String context = ((GenParameter)genOperation.getGenParameters().get(1)).getName();%> + // TODO: implement this method + // -> specify the condition that violates the invariant + // -> verify the details of the diagnostic, including severity and message + // Ensure that you remove @generated or mark it @generated NOT + if (false) + { + if (<%=diagnostics%> != null) + { + <%=diagnostics%>.add + (new <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic")%> + (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR, + <%=opClass.getGenPackage().getImportedValidatorClassName()%>.DIAGNOSTIC_SOURCE, + <%=opClass.getGenPackage().getImportedValidatorClassName()%>.<%=opClass.getOperationID(genOperation)%>, + <%=genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin")%>.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "<%=genOperation.getName()%>", <%=genModel.getImportedName("org.eclipse.emf.ecore.util.EObjectValidator")%>.getObjectLabel(this, <%=context%>) }),<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%> + new Object [] { this })); + } + return false; + } + return true; + <%} else {%> +<%@ include file="Class/implementedGenOperation.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/implementedGenOperation.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ include file="Class/genOperation.insert.javajetinc" fail="silent" %> +<%@ end %><%//Class/implementedGenOperation.override.javajetinc%> +<%}//for%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEInverseAddGenFeatures())) {%> + /** + * + * + * @generated + */ + public ChangeContext eInverseAdd(<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%> otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getEInverseAddGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType()) {%> + <%if (genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes()) {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>)((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap()).basicAdd(otherEnd, changeContext); + <%} else {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>)<%=genFeature.getGetAccessor()%>()).basicAdd(otherEnd, changeContext); + <%}%> + <%} else if (genFeature.isContainer()) {%> + if (eInternalContainer() != null) + changeContext = eBasicRemoveFromContainer(changeContext); + return eBasicSetContainer(otherEnd, <%=genFeature.getUpperName()%>, changeContext); + <%} else {%> + <%if (genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (<%=genFeature.getSafeName()%> != null) + <%if (genFeature.isEffectiveContains()) {%> + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>).eInverseRemove(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + return basicSet<%=genFeature.getAccessorName()%>((<%=genFeature.getImportedType()%>)otherEnd, changeContext); + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.eInverseAdd(otherEnd, propertyIndex, changeContext); +<%} else {%> + return eDynamicInverseAdd(otherEnd, propertyIndex, changeContext); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEInverseRemoveGenFeatures())) {%> + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(<%=genModel.getImportedName("java.lang.Object")%> otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getEInverseRemoveGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType()) {%> + <%if (genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes()) {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>)((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap()).basicRemove(otherEnd, changeContext); + <%} else if (genFeature.isWrappedFeatureMapType()) {%> + return removeFrom<%=genFeature.getImportedType()%>(<%=genFeature.getGetAccessor()%>(), otherEnd, changeContext); + <%} else {%> + return removeFromList(<%=genFeature.getGetAccessor()%>(), otherEnd, changeContext); + <%}%> + <%} else if (genFeature.isContainer()) {%> + return eBasicSetContainer(null, <%=genFeature.getUpperName()%>, changeContext); + <%} else if (genFeature.isUnsettable()) {%> + return basicUnset<%=genFeature.getAccessorName()%>(changeContext); + <%} else {%> + return basicSet<%=genFeature.getAccessorName()%>(null, changeContext); + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.inverseRemove(otherEnd, propertyIndex, changeContext); +<%} else {%> + return eDynamicInverseRemove(otherEnd, propertyIndex, changeContext); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEBasicRemoveFromContainerGenFeatures())) {%> + /** + * + * + * @generated + */ + public ChangeContext eBasicRemoveFromContainerFeature(ChangeContext changeContext) + { + switch (eContainerFeatureID) + { +<%for (Iterator i=genClass.getEBasicRemoveFromContainerGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + return eInternalContainer().eInverseRemove(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.eBasicRemoveFromContainerFeature(changeContext); +<%} else {%> + return eDynamicBasicRemoveFromContainer(changeContext); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getImplementedGenFeatures().isEmpty()) {%> + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getAllGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isPrimitiveType()) {%> + <%if (genFeature.isBooleanType()) {%> + return <%=genFeature.getGetAccessor()%>() ? Boolean.TRUE : Boolean.FALSE; + <%} else {%> + return new <%=genFeature.getObjectType()%>(<%=genFeature.getGetAccessor()%>()); + <%}%> + <%} else if (genFeature.isResolveProxies() && !genFeature.isListType()) {%> + if (resolve) return <%=genFeature.getGetAccessor()%>(); + return basicGet<%=genFeature.getAccessorName()%>(); + <%} else if (genFeature.isMapType()) {%> + <%if (genFeature.isEffectiveSuppressEMFTypes()) {%> + if (coreType) return ((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap(); + else return <%=genFeature.getGetAccessor()%>(); + <%} else {%> + if (coreType) return <%=genFeature.getGetAccessor()%>(); + else return <%=genFeature.getGetAccessor()%>().map(); + <%}%> + <%} else if (genFeature.isWrappedFeatureMapType()) {%> + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return <%=genFeature.getGetAccessor()%>(); + <%} else if (genFeature.isFeatureMapType()) {%> + if (coreType) return <%=genFeature.getGetAccessor()%>(); + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)<%=genFeature.getGetAccessor()%>()).getWrapper(); + <%} else {%> + return <%=genFeature.getGetAccessor()%>(); + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.get(propertyIndex, resolve); +<%} else {%> + return eDynamicGet(propertyIndex, resolve, coreType); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getESetGenFeatures())) {%> + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getESetGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType()) {%> + <%if (genFeature.isWrappedFeatureMapType()) {%> + set<%=genFeature.getImportedType()%>(<%=genFeature.getGetAccessor()%>(), newValue); + <%} else if (genFeature.isFeatureMapType()) {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)<%=genFeature.getGetAccessor()%>()).set(newValue); + <%} else if (genFeature.isMapType()) {%> + <%if (genFeature.isEffectiveSuppressEMFTypes()) {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%>.Setting)((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap()).set(newValue); + <%} else {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%>.Setting)<%=genFeature.getGetAccessor()%>()).set(newValue); + <%}%> + <%} else {%> + <%=genFeature.getGetAccessor()%>().clear(); + <%=genFeature.getGetAccessor()%>().addAll((<%=genModel.getImportedName("java.util.Collection")%>)newValue); + <%}%> + <%} else if (genFeature.isPrimitiveType()) {%> + set<%=genFeature.getAccessorName()%>(((<%=genFeature.getObjectType()%>)newValue).<%=genFeature.getPrimitiveValueFunction()%>()); + <%} else {%> + set<%=genFeature.getAccessorName()%>((<%=genFeature.getImportedType()%>)newValue); + <%}%> + return; + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + super.set(propertyIndex, newValue); +<%} else {%> + eDynamicSet(propertyIndex, newValue); +<%}%> + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getESetGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType() && !genFeature.isUnsettable()) {%> + <%if (genFeature.isWrappedFeatureMapType()) {%> + unset<%=genFeature.getImportedType()%>(<%=genFeature.getGetAccessor()%>()); + <%} else {%> + <%=genFeature.getGetAccessor()%>().clear(); + <%}%> + <%} else if (genFeature.isUnsettable()) {%> + unset<%=genFeature.getAccessorName()%>(); + <%} else if (genFeature.isReferenceType()) {%> + set<%=genFeature.getAccessorName()%>((<%=genFeature.getImportedType()%>)null); + <%} else {%> + set<%=genFeature.getAccessorName()%>(<%=genFeature.getUpperName()%>_DEFAULT_); + <%}%> + return; + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + super.unset(propertyIndex); +<%} else {%> + eDynamicUnset(propertyIndex); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getImplementedGenFeatures().isEmpty()) {%> +<%@ include file="Class/eIsSet.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getAllGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType() && !genFeature.isUnsettable()) {%> + <%if (genFeature.isWrappedFeatureMapType()) {%> + <%if (genFeature.isVolatile()) {%> + return !is<%=genFeature.getImportedType()%>Empty(<%=genFeature.getGetAccessor()%>()); + <%} else {%> + return <%=genFeature.getSafeName()%> != null && !is<%=genFeature.getImportedType()%>Empty(<%=genFeature.getGetAccessor()%>()); + <%}%> + <%} else {%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getSafeName()%> != null && !<%=genFeature.getSafeName()%>.isEmpty(); + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + return <%=genFeature.getSafeName()%> != null && !<%=genFeature.getSafeName()%>.isEmpty(); + <%} else {%> + return !<%=genFeature.getGetAccessor()%>().isEmpty(); + <%}%> + <%}%> + <%}%> + <%} else if (genFeature.isUnsettable()) {%> + return isSet<%=genFeature.getAccessorName()%>(); + <%} else if (genFeature.isResolveProxies()) {%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getSafeName()%> != null; + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + return eVirtualGet(<%=genFeature.getUpperName()%>) != null; + <%} else {%> + return basicGet<%=genFeature.getAccessorName()%>() != null; + <%}%> + <%}%> + <%} else if (genFeature.isReferenceType()) {%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getSafeName()%> != null; + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + return eVirtualGet(<%=genFeature.getUpperName()%>) != null; + <%} else {%> + return <%=genFeature.getGetAccessor()%>() != null; + <%}%> + <%}%> + <%} else if (genFeature.isPrimitiveType() || genFeature.isEnumType()) {%> + <%if (genClass.isField(genFeature)) {%> + <%if (genClass.isFlag(genFeature)) {%> + return ((<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0) != <%=genFeature.getUpperName()%>_DEFAULT_; + <%} else {%> + return <%=genFeature.getSafeName()%> != <%=genFeature.getUpperName()%>_DEFAULT_; + <%}%> + <%} else {%> + <%if (genFeature.isEnumType() && genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + return eVirtualGet(<%=genFeature.getUpperName()%>, <%=genFeature.getUpperName()%>_DEFAULT_) != <%=genFeature.getUpperName()%>_DEFAULT_; + <%} else {%> + return <%=genFeature.getGetAccessor()%>() != <%=genFeature.getUpperName()%>_DEFAULT_; + <%}%> + <%}%> + <%} else {//datatype%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getUpperName()%>_DEFAULT_ == null ? <%=genFeature.getSafeName()%> != null : !<%=genFeature.getUpperName()%>_DEFAULT_.equals(<%=genFeature.getSafeName()%>); + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>, <%=genFeature.getUpperName()%>_DEFAULT_); + return <%=genFeature.getUpperName()%>_DEFAULT_ == null ? <%=genFeature.getSafeName()%> != null : !<%=genFeature.getUpperName()%>_DEFAULT_.equals(<%=genFeature.getSafeName()%>); + <%} else {%> + return <%=genFeature.getUpperName()%>_DEFAULT_ == null ? <%=genFeature.getGetAccessor()%>() != null : !<%=genFeature.getUpperName()%>_DEFAULT_.equals(<%=genFeature.getGetAccessor()%>()); + <%}%> + <%}%> + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.isSet(propertyIndex); +<%} else {%> + return eDynamicIsSet(propertyIndex); +<%}%> + } + +<%@ end %><%//Class/eIsSet.override.javajetinc%> +<%}%> +<%if (isImplementation && !genClass.getMixinGenFeatures().isEmpty()) {%> + /** + * + * + * @generated + */ + public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) + { + <%for (Iterator m=genClass.getMixinGenClasses().iterator(); m.hasNext();) { GenClass mixinGenClass = (GenClass)m.next(); %> + if (baseClass == <%=mixinGenClass.getImportedInterfaceName()%>.class) + { + switch (derivedFeatureID) + { + <%for (Iterator f=mixinGenClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); %> + case <%=genFeature.getUpperName()%>: return <%=mixinGenClass.getQualifiedFeatureID(genFeature)%>; + <%}%> + default: return -1; + } + } + <%}%> + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * + * + * @generated + */ + public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) + { + <%for (Iterator m=genClass.getMixinGenClasses().iterator(); m.hasNext();) { GenClass mixinGenClass = (GenClass)m.next(); %> + if (baseClass == <%=mixinGenClass.getImportedInterfaceName()%>.class) + { + switch (baseFeatureID) + { + <%for (Iterator f=mixinGenClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); %> + case <%=mixinGenClass.getQualifiedFeatureID(genFeature)%>: return <%=genFeature.getUpperName()%>; + <%}%> + default: return -1; + } + } + <%}%> + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + +<%}%> +<%if (isImplementation && genModel.isVirtualDelegation()) { String eVirtualValuesField = genClass.getEVirtualValuesField();%> + <%if (eVirtualValuesField != null) {%> + /** + * + * + * @generated + */ + protected Object[] eVirtualValues() + { + return <%=eVirtualValuesField%>; + } + + /** + * + * + * @generated + */ + protected void setVirtualValues(Object[] newValues) + { + <%=eVirtualValuesField%> = newValues; + } + + <%}%> + <%{ List eVirtualIndexBitFields = genClass.getEVirtualIndexBitFields(new ArrayList());%> + <%if (!eVirtualIndexBitFields.isEmpty()) { List allEVirtualIndexBitFields = genClass.getAllEVirtualIndexBitFields(new ArrayList());%> + /** + * + * + * @generated + */ + protected int eVirtualIndexBits(int offset) + { + switch (offset) + { + <%for (int i = 0; i < allEVirtualIndexBitFields.size(); i++) {%> + case <%=i%> : + return <%=allEVirtualIndexBitFields.get(i)%>; + <%}%> + default : + throw new IndexOutOfBoundsException(); + } + } + + /** + * + * + * @generated + */ + protected void setVirtualIndexBits(int offset, int newIndexBits) + { + switch (offset) + { + <%for (int i = 0; i < allEVirtualIndexBitFields.size(); i++) {%> + case <%=i%> : + <%=allEVirtualIndexBitFields.get(i)%> = newIndexBits; + break; + <%}%> + default : + throw new IndexOutOfBoundsException(); + } + } + + <%}%> + <%}%> +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getToStringGenFeatures().isEmpty()) {%> + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy(this)) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + <%{ boolean first = true;%> + <%for (Iterator i=genClass.getToStringGenFeatures().iterator(); i.hasNext(); ) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (first) { first = false;%> + result.append(" (<%=genFeature.getName()%>: ");<%=genModel.getNonNLS()%> + <%} else {%> + result.append(", <%=genFeature.getName()%>: ");<%=genModel.getNonNLS()%> + <%}%> + <%if (genFeature.isUnsettable() && !genFeature.isListType()) {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + if (eVirtualIsSet(<%=genFeature.getUpperName()%>)) result.append(eVirtualGet(<%=genFeature.getUpperName()%>)); else result.append("");<%=genModel.getNonNLS()%> + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + if (<%if (genClass.isESetFlag(genFeature)) {%>(<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0<%} else {%><%=genFeature.getUncapName()%>_set_<%}%>) result.append((<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0); else result.append("");<%=genModel.getNonNLS()%> + <%} else {%> + if (<%if (genClass.isESetFlag(genFeature)) {%>(<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0<%} else {%><%=genFeature.getUncapName()%>_set_<%}%>) result.append(<%=genFeature.getSafeName()%>); else result.append("");<%=genModel.getNonNLS()%> + <%}%> + <%}%> + <%} else {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + result.append(eVirtualGet(<%=genFeature.getUpperName()%><%if (!genFeature.isListType() && !genFeature.isReferenceType()){%>, <%=genFeature.getUpperName()%>_DEFAULT_<%}%>)); + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + result.append((<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0); + <%} else {%> + result.append(<%=genFeature.getSafeName()%>); + <%}%> + <%}%> + <%}%> + <%}%> + <%}%> + result.append(')'); + return result.toString(); + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.isAbstract()) {%> + public static class ConcreteBase extends <%=genClass.getClassName()%> + { + public ConcreteBase() + { + super(); + } + } + +<%}%> +<%if (isImplementation && genClass.isMapEntry()) { GenFeature keyFeature = genClass.getMapEntryKeyFeature(); GenFeature valueFeature = genClass.getMapEntryValueFeature();%> + /** + * + * + * @generated + */ + protected int hash = -1; + + /** + * + * + * @generated + */ + public int getHash() + { + if (hash == -1) + { + Object theKey = getKey(); + hash = (theKey == null ? 0 : theKey.hashCode()); + } + return hash; + } + + /** + * + * + * @generated + */ + public void setHash(int hash) + { + this.hash = hash; + } + + /** + * + * + * @generated + */ + public Object getKey() + { + <%if (keyFeature.isPrimitiveType()) {%> + return new <%=keyFeature.getObjectType()%>(getTypedKey()); + <%} else {%> + return getTypedKey(); + <%}%> + } + + /** + * + * + * @generated + */ + public void setKey(Object key) + { + <%if (keyFeature.isListType()) {%> + getTypedKey().addAll((<%=genModel.getImportedName("java.util.Collection")%>)key); + <%} else if (keyFeature.isPrimitiveType()) {%> + setTypedKey(((<%=keyFeature.getObjectType()%>)key).<%=keyFeature.getPrimitiveValueFunction()%>()); + <%} else {%> + setTypedKey((<%=keyFeature.getImportedType()%>)key); + <%}%> + } + + /** + * + * + * @generated + */ + public Object getValue() + { + <%if (valueFeature.isPrimitiveType()) {%> + return new <%=valueFeature.getObjectType()%>(getTypedValue()); + <%} else {%> + return getTypedValue(); + <%}%> + } + + /** + * + * + * @generated + */ + public Object setValue(Object value) + { + Object oldValue = getValue(); + <%if (valueFeature.isListType()) {%> + getTypedValue().clear(); + getTypedValue().addAll((<%=genModel.getImportedName("java.util.Collection")%>)value); + <%} else if (valueFeature.isPrimitiveType()) {%> + setTypedValue(((<%=valueFeature.getObjectType()%>)value).<%=valueFeature.getPrimitiveValueFunction()%>()); + <%} else {%> + setTypedValue((<%=valueFeature.getImportedType()%>)value); + <%}%> + return oldValue; + } + + /** + * + * + * @generated + */ + public <%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%> getEMap() + { + <%=genModel.getImportedName("org.eclipse.emf.ecore.EObject")%> container = eContainer(); + return container == null ? null : (<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>)container.get(eContainmentFeature()); + } +<%}%> +<%@ include file="Class/insert.javajetinc" fail="silent" %> +} //<%=isInterface ? " " + genClass.getInterfaceName() : genClass.getClassName()%> +<%// TODO fix the space above%> +<%genModel.emitSortedImports();%> diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/templates/models/SDOFactoryClass.javajet b/sdo-java/branches/sdo-1.1-incubating/tools/templates/models/SDOFactoryClass.javajet new file mode 100644 index 0000000000..af5bdbee36 --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/templates/models/SDOFactoryClass.javajet @@ -0,0 +1,645 @@ +<%@ jet package="org.apache.tuscany.sdo.generate.templates.model" skeleton="generator.skeleton" imports="org.apache.tuscany.sdo.generate.util.* java.util.* org.eclipse.emf.codegen.ecore.genmodel.* org.eclipse.emf.ecore.* org.eclipse.emf.codegen.ecore.genmodel.impl.Literals org.eclipse.emf.ecore.util.* org.eclipse.emf.codegen.util.CodeGenUtil" class="SDOFactoryClass" version="$Id: SDOFactoryClass.javajet,v 1.23 2005/12/10 13:31:02 emerks Exp $" %> +<% +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +%> +<%GenPackage genPackage = (GenPackage)((Object[])argument)[0]; GenModel genModel=genPackage.getGenModel();%> +<%boolean isInterface = Boolean.TRUE.equals(((Object[])argument)[1]); boolean isImplementation = Boolean.TRUE.equals(((Object[])argument)[2]);%> +<%String factoryPatternVersion = "1.2";%> +<%String publicStaticFinalFlag = isImplementation ? "public static final " : "";%> +<%@ include file="../Header.javajetinc"%> +<%if (isInterface || genModel.isSuppressInterfaces()) {%> +package <%=genPackage.getReflectionPackageName()%>; +<%} else {%> +package <%=genPackage.getClassPackageName()%>; +<%}%> + +import commonj.sdo.helper.HelperContext; +import org.apache.tuscany.sdo.helper.HelperContextImpl; +<%if (!isInterface || genModel.isSuppressInterfaces()) {%> +import org.apache.tuscany.sdo.helper.TypeHelperImpl; +<%}%> + +<%if (isImplementation) {%> +<%if (!genPackage.hasJavaLangConflict() && !genPackage.hasInterfaceImplConflict() && !genPackage.getClassPackageName().equals(genPackage.getInterfacePackageName())) genModel.addImport(genPackage.getInterfacePackageName() + ".*");%> +<%}%> +<%genModel.markImportLocation(stringBuffer);%> + +<%if (isInterface) {%> +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * +<%if (!genModel.isSuppressEMFMetaData()) {%> + * @see <%=genPackage.getQualifiedPackageInterfaceName()%> +<%}%> +<%if (genModel.isSuppressInterfaces()) {%> + * patternVersion=<%=factoryPatternVersion%>;<%=SDOGenUtil.printArguments(genPackage, genModel) %> +<%}%> + * @generated + */ +<%} else {%> +/** + * + * An implementation of the model Factory. + * Generator information: + * patternVersion=<%=factoryPatternVersion%>;<%=SDOGenUtil.printArguments(genPackage, genModel) %> + * + * @generated + */ +<%}%> +<%if (isImplementation) {%> +public class <%=genPackage.getFactoryClassName()%> extends <%=genModel.getImportedName("org.apache.tuscany.sdo.impl.FactoryBase")%><%if (!genModel.isSuppressInterfaces()) {%> implements <%=genPackage.getImportedFactoryInterfaceName()%><%}%> +<%} else {%> +public interface <%=genPackage.getFactoryInterfaceName()%><%if (!genModel.isSuppressEMFMetaData()) {%> extends <%=genModel.getImportedName("org.eclipse.emf.ecore.EFactory")%><%}%> +<%}%> +{ +<%if (genModel.getCopyrightText() != null) {%> + /** + * + * + * @generated + */ + <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> copyright = "<%=genModel.getCopyrightText()%>";<%=genModel.getNonNLS()%> + +<%}%> + +<%if (isInterface && genModel.isSuppressEMFMetaData()) {%> + /** + * The singleton instance of the factory. + * + * + * @generated + */ + <%=publicStaticFinalFlag%><%=genPackage.getFactoryInterfaceName()%> INSTANCE = <%=genPackage.getQualifiedFactoryClassName()%>.init(); + +<%} else if (isInterface && !genModel.isSuppressInterfaces()) {%> + /** + * The singleton instance of the factory. + * + * + * @generated + */ + <%=publicStaticFinalFlag%><%=genPackage.getFactoryInterfaceName()%> eINSTANCE = <%=genPackage.getQualifiedFactoryClassName()%>.init(); + +<%}%> +<%if (isImplementation) {%> + /** + * The package namespace URI. + * + * + * @generated + */ + <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> NAMESPACE_URI = "<%=genPackage.getNSURI()%>";<%=genModel.getNonNLS()%> + + /** + * The package namespace name. + * + * + * @generated + */ + <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> NAMESPACE_PREFIX = "<%=genPackage.getNSName()%>";<%=genModel.getNonNLS()%> + + /** + * The version of the generator pattern used to generate this class. + * + * + * @generated + */ + <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> PATTERN_VERSION = "<%=factoryPatternVersion%>"; + +<%int genIndex = 1; +for (Iterator i=genPackage.getOrderedGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next();%> + <%if (!genPackage.getClassifierID(genClassifier).equals("DOCUMENT_ROOT")) { %> + <%=publicStaticFinalFlag%>int <%=genPackage.getClassifierID(genClassifier)%> = <%=genIndex%>; +<%genIndex++;%> +<% } }%> + +<%String factoryType = genModel.isSuppressEMFMetaData() ? genPackage.getFactoryClassName() : genPackage.getImportedFactoryInterfaceName();%> + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public <%=genPackage.getFactoryClassName()%>() + { + super(NAMESPACE_URI, NAMESPACE_PREFIX, "<%=genPackage.getReflectionPackageName()%>"); + } + + /** + * Registers the Factory instance so that it is available within the supplied scope. + * @argument scope a HelperContext instance that will make the types supported by this Factory available. + * + * + * @generated + */ + public void register(HelperContext scope) + { + if(scope == null) { + throw new IllegalArgumentException("Scope can not be null"); + } + + if (((HelperContextImpl)scope).getExtendedMetaData().getPackage(NAMESPACE_URI) != null) + return; + + // Register this package with provided scope + ((HelperContextImpl)scope).getExtendedMetaData().putPackage(NAMESPACE_URI, this); + + //Register dependent packages with provided scope + <%for (Iterator p=genPackage.getPackageInitializationDependencies().iterator(); p.hasNext();) { GenPackage dep = (GenPackage)p.next();%> + <%=dep.getImportedFactoryInterfaceName()%>.INSTANCE.register(scope); + <%}%> + } + + /** + * + * + * @generated + */ + public <%=genModel.getImportedName("commonj.sdo.DataObject")%> create(int typeNumber) + { + switch (typeNumber) + { +<%for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();%> +<%if (!genClass.isAbstract() && !genClass.isDynamic()) {%> + case <%=genClass.getClassifierID()%>: return (<%=genModel.getImportedName("commonj.sdo.DataObject")%>)create<%=genClass.getName()%>(); +<%}%> +<%}%> + default: + return super.create(typeNumber); + } + } + +<%if (!genPackage.getAllGenDataTypes().isEmpty()) {%> + /** + * + * + * @generated + */ + public Object createFromString(int typeNumber, String initialValue) + { + switch (typeNumber) + { +<%for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next();%> + <%if (genDataType.isSerializable()) {%> + case <%=genDataType.getClassifierID()%>: + return create<%=genDataType.getName()%>FromString(initialValue); + <%}%> +<%}%> + default: + throw new IllegalArgumentException("The type number '" + typeNumber + "' is not a valid datatype");<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%> + } + } + + /** + * + * + * @generated + */ + public String convertToString(int typeNumber, Object instanceValue) + { + switch (typeNumber) + { +<%for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next();%> + <%if (genDataType.isSerializable()) {%> + case <%=genDataType.getClassifierID()%>: + return convert<%=genDataType.getName()%>ToString(instanceValue); + <%}%> +<%}%> + default: + throw new IllegalArgumentException("The type number '" + typeNumber + "' is not a valid datatype");<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%> + } + } +<%}%> +<%for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();%> + <%if (!genClass.isAbstract() && !genClass.isDynamic()) {%> + /** + * + * + * @generated + */ + public <%=genClass.getImportedInterfaceName()%> create<%=genClass.getName()%>() + { + <%if (genClass.isDynamic()) {%> + <%=genClass.getImportedInterfaceName()%> <%=genClass.getSafeUncapName()%> = <%=genClass.getCastFromEObject()%>super.create(<%=genClass.getQualifiedClassifierAccessor()%>); + <%} else {%> + <%=genClass.getImportedClassName()%> <%=genClass.getSafeUncapName()%> = new <%=genClass.getImportedClassName()%>()<%if (genModel.isSuppressInterfaces() && !genPackage.getReflectionPackageName().equals(genPackage.getInterfacePackageName())) {%>{}<%}%>; + <%}%> + return <%=genClass.getSafeUncapName()%>; + } + <%}%> +<%}%> + + // Following creates and initializes SDO metadata for the supported types. +<%for (Iterator i=genPackage.getOrderedGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next();%> + <%if (!genPackage.getClassifierID(genClassifier).equals("DOCUMENT_ROOT")) { %> + protected <%=genModel.getImportedName("commonj.sdo.Type")%> <%=genClassifier.getSafeUncapName()%>Type = null; + + public <%=genModel.getImportedName("commonj.sdo.Type")%> get<%=genClassifier.getClassifierAccessorName()%>() + { + return <%=genClassifier.getSafeUncapName()%>Type; + } + +<%} }%> + + private static <%=factoryType%> instance = null; + public static <%=factoryType%> init() + { + if (instance != null ) return instance; + instance = new <%=factoryType%>(); + + // Create package meta-data objects + instance.createMetaData(); + + // Initialize created meta-data + instance.initializeMetaData(); + + // Mark meta-data to indicate it can't be changed + //the<%=factoryType%>.freeze(); //FB do we need to freeze / should we freeze ???? + + return instance; + } + + private boolean isCreated = false; + + public void createMetaData() + { + if (isCreated) return; + isCreated = true; + <%if (!genPackage.getGenClasses().isEmpty()) {%> + + // Create types and their properties + <%for (Iterator c=genPackage.getGenClasses().iterator(); c.hasNext();) { GenClass genClass = (GenClass)c.next();%> + <%if (!genClass.isDynamic()) {%> + <%=genClass.getSafeUncapName()%>Type = createType(false, <%=genPackage.getClassifierID(genClass)%>); + <%for (Iterator j=genClass.getGenFeatures().iterator(); j.hasNext();) { GenFeature genFeature = (GenFeature)j.next();%> + createProperty(<%=!genFeature.isReferenceType()%>, <%=genClass.getSafeUncapName()%>Type,<%=genClass.getClassName()%>._INTERNAL_<%=genFeature.getUpperName()%>); + <%}%> + <%}%> + <%}%> + <%}%> + <%if (!genPackage.getGenDataTypes().isEmpty()) {%> + + // Create data types + <%for (Iterator d=genPackage.getGenDataTypes().iterator(); d.hasNext();) { GenDataType genDataType = (GenDataType)d.next();%> + <%=genDataType.getSafeUncapName()%>Type = createType(true, <%=genPackage.getClassifierID(genDataType)%> ); + <%}%> + <%}%> + } + + private boolean isInitialized = false; + + public void initializeMetaData() + { + if (isInitialized) return; + isInitialized = true; + <%if (!genPackage.getPackageInitializationDependencies().isEmpty()) {%> + + // Obtain other dependent packages + <%for (Iterator p=genPackage.getPackageInitializationDependencies().iterator(); p.hasNext();) { GenPackage dep = (GenPackage)p.next();%> + <%=dep.getImportedFactoryClassName()%> <%=genPackage.getPackageInstanceVariable(dep)%> = (<%=dep.getImportedFactoryClassName()%>)<%=dep.getImportedFactoryClassName()%>.init(); + <%}%> + <%}%> + <%List annotationSources = genPackage.getAnnotationSources();%> + <%annotationSources.remove(ExtendedMetaData.ANNOTATION_URI);%> + <%=genModel.getImportedName("commonj.sdo.Property")%> property = null; + + // Add supertypes to types + <%for (Iterator c=genPackage.getGenClasses().iterator(); c.hasNext();) { GenClass genClass = (GenClass)c.next();%> + <%for (Iterator b=genClass.getBaseGenClasses().iterator(); b.hasNext();) { GenClass baseGenClass = (GenClass)b.next();%> + addSuperType(<%=genClass.getSafeUncapName()%>Type, <%=genPackage.getPackageInstanceVariable(baseGenClass.getGenPackage())%>.get<%=baseGenClass.getClassifierAccessorName()%>()); + <%}%> + <%}%> + + // Initialize types and properties + <%for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();%> + <%if (!genClass.isDynamic()) {%> + initializeType(<%=genClass.getSafeUncapName()%>Type, <%=genClass.getImportedInterfaceName()%>.class, "<%=genClass.getName()%>", <%=genClass.isAbstract()%>); + <%for (Iterator sources = annotationSources.iterator(); sources.hasNext();) { String annotationSource = (String)sources.next();%> + <%EAnnotation classAnnotation = genClass.getEcoreClassifier().getEAnnotation(annotationSource);%> + <%if (classAnnotation != null) { %> + <%for (Iterator k = classAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);%> + setInstanceProperty (<%=genClass.getSafeUncapName()%>Type, "<%=annotationSource%>", <%=key%>, <%=value%><%=genModel.getNonNLS(key + value)%>); + <%}%> + <%}%> + <%}%> + <%for (Iterator j=genClass.getGenFeatures().iterator(); j.hasNext();) {GenFeature genFeature = (GenFeature)j.next();%> + <%String type = genFeature.getType().equals("commonj.sdo.Sequence") ? "getSequence()" : genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage()) + ".get" + genFeature.getTypeClassifierAccessorName() + "()";%> + property = getLocalProperty(<%=genClass.getSafeUncapName()%>Type, <%=genClass.getLocalFeatureIndex(genFeature)%>); + <%if (genFeature.isReferenceType()) { GenFeature reverseGenFeature = genFeature.getReverse();%> + <%String reverse = reverseGenFeature == null ? "null" : genPackage.getPackageInstanceVariable(reverseGenFeature.getGenPackage()) + ".get" + reverseGenFeature.getFeatureAccessorName() + "()";%> + initializeProperty(property, <%=type%>, "<%=genFeature.getName()%>", <%=genFeature.getDefaultValue()%>, <%=genFeature.getLowerBound()%>, <%=genFeature.getUpperBound()%>, <%=genFeature.getContainerClass()%>, <%=genFeature.getChangeableFlag().equals("IS_CHANGEABLE") ? "false" : "true"%>, <%=genFeature.getUnsettableFlag().equals("IS_UNSETTABLE") ? "true": "false"%>, <%=genFeature.getDerivedFlag().equals("IS_DERIVED") ? "true" : "false"%>, <%=genFeature.getContainmentFlag().equals("IS_COMPOSITE")? "true": "false"%> , <%=reverse%>); + <%}else{%> + initializeProperty(property, <%=type%>, "<%=genFeature.getName()%>", <%=genFeature.getDefaultValue()%>, <%=genFeature.getLowerBound()%>, <%=genFeature.getUpperBound()%>, <%=genFeature.getContainerClass()%>, <%=genFeature.getChangeableFlag().equals("IS_CHANGEABLE") ? "false" : "true"%>, <%=genFeature.getUnsettableFlag().equals("IS_UNSETTABLE") ? "true": "false"%>, <%=genFeature.getDerivedFlag().equals("IS_DERIVED") ? "true" : "false"%>); + <%}%> + <%for (Iterator sources = annotationSources.iterator(); sources.hasNext();) { String annotationSource = (String)sources.next();%> + <%EAnnotation featureAnnotation = genFeature.getEcoreFeature().getEAnnotation(annotationSource);%> + <%if (featureAnnotation != null) { %> + <%for (Iterator k = featureAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);%> + setInstanceProperty (property, "<%=annotationSource%>", <%=key%>, <%=value%><%=genModel.getNonNLS(key + value)%>); + <%}%> + <%}%> + <%}%> + + <%}%> + <%}%> + <%}%> + <%if (!genPackage.getGenDataTypes().isEmpty()) {%> + // Initialize data types + <%for (Iterator d=genPackage.getGenDataTypes().iterator(); d.hasNext();) { GenDataType genDataType = (GenDataType)d.next();%> + initializeType(<%=genDataType.getSafeUncapName()%>Type, <%=genDataType.getImportedInstanceClassName()%>.class, "<%=genDataType.getName()%>", <%=genDataType.getSerializableFlag().equals("IS_SERIALIZABLE") ? "true" : "false"%>, <%=genDataType.getGeneratedInstanceClassFlag().equals("IS_GENERATED_INSTANCE_CLASS") ? "true" : "false" %>);<%=genModel.getNonNLS()%> + <%for (Iterator sources = annotationSources.iterator(); sources.hasNext();) { String annotationSource = (String)sources.next();%> + <%EAnnotation dataTypeAnnotation = genDataType.getEcoreDataType().getEAnnotation(annotationSource);%> + <%if (dataTypeAnnotation != null) { %> + <%for (Iterator k = dataTypeAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);%> + setInstanceProperty (<%=genDataType.getSafeUncapName()%>Type, "<%=annotationSource%>", <%=key%>, <%=value%><%=genModel.getNonNLS(key + value)%>); + <%}%> + <%}%> + <%}%> + + <%}%> + <%}%> + createXSDMetaData(<%=SDOGenUtil.getDependentFactoryArgumentList(genPackage, false)%>); + } + + protected void createXSDMetaData(<%=SDOGenUtil.getDependentFactoryArgumentList(genPackage, true)%>) + { + super.initXSD(); + + <%=genModel.getImportedName("commonj.sdo.Property")%> property = null; + + <%String extendedMetaDataSource = ExtendedMetaData.ANNOTATION_URI;%> + <%EAnnotation packageAnnotation = genPackage.getEcorePackage().getEAnnotation(extendedMetaDataSource);%> + <%if (packageAnnotation != null){ %> + addXSDMapping + (new String[] + { + <%for (Iterator k = packageAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);%> + <%=key%>, <%=value%><%=k.hasNext() ? "," : ""%><%=genModel.getNonNLS(key + value)%> + <%}%> + }, + "<%=packageAnnotation.getSource()%>"); + + <%}%> + + <%for (Iterator i=genPackage.getGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next(); EAnnotation classAnnotation = genClassifier.getEcoreClassifier().getEAnnotation(extendedMetaDataSource);%> + <%if (classAnnotation != null && !genClassifier.getName().equals("DocumentRoot")) {%> + addXSDMapping + (<%=genClassifier.getSafeUncapName()%>Type, + new String[] + { + <%for (Iterator k = classAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);%> + <%=key%>, <%=value%><%=k.hasNext() ? "," : ""%><%=genModel.getNonNLS(key + value)%> + <%}%> + }); + + <%}%> + <%if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass) genClassifier;%> + <%for (Iterator j=genClass.getGenFeatures().iterator(); j.hasNext();) { GenFeature genFeature = (GenFeature)j.next(); %> + <%EAnnotation featureAnnotation = genFeature.getEcoreFeature().getEAnnotation(extendedMetaDataSource);%> + <%if (genClass.getName().equals("DocumentRoot")) { %> + <%if (!(genFeature.getName().equals("mixed") || genFeature.getName().equals("xMLNSPrefixMap") || genFeature.getName().equals("xSISchemaLocation"))) { %> + property = createGlobalProperty + ("<%=genFeature.getName()%>", + <%=genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage())%>.get<%=genFeature.getTypeClassifierAccessorName()%>(), + new String[] + { + <%for (Iterator k = featureAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);%> + <%=key%>, <%=value%><%=k.hasNext() ? "," : ""%><%=genModel.getNonNLS(key + value)%> + <%}%> + <%if (!genFeature.isReferenceType()) {%> + }, + IS_ATTRIBUTE); + <%} else {%> + }); + <%}%> + + <%for (Iterator sources = genPackage.getAnnotationSources().iterator(); sources.hasNext();) { String annotationSource = (String)sources.next(); %> + <%if (!annotationSource.equals(extendedMetaDataSource)) {%> + <%EAnnotation globalAnnotation = genFeature.getEcoreFeature().getEAnnotation(annotationSource);%> + <%if (globalAnnotation != null) {%> + <%for (Iterator k = globalAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);%> + setInstanceProperty + (property, + "<%=annotationSource%>", + <%=key%>, <%=value%><%=genModel.getNonNLS(key + value)%>); + <%}%> + + <%}%> + <%}%> + <%}%> + <%}%> + <%} else {%> + addXSDMapping + (getLocalProperty(<%=genClassifier.getSafeUncapName()%>Type, <%=genClass.getLocalFeatureIndex(genFeature)%>), + new String[] + { + <%for (Iterator k = featureAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);%> + <%=key%>, <%=value%><%=k.hasNext() ? "," : ""%><%=genModel.getNonNLS(key + value)%> + <%}%> + }); + + <%}%> + <%}%> + <%}%> + <%}%> + } + +<%for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next();%> + <%if (genDataType.isSerializable()) {%> + /** + * + * + * @generated + */ + public <%=genDataType.getObjectInstanceClassName()%> create<%=genDataType.getName()%>FromString(String initialValue) + { + <%if (genDataType instanceof GenEnum) {%> + <%=((GenEnum)genDataType).getImportedInstanceClassName()%> result = <%=((GenEnum)genDataType).getImportedInstanceClassName()%>.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + type.getName() + "'");<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%><%=genModel.getNonNLS(3)%> + return result; + <%} else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); %> + <%if (genBaseType.getGenPackage() == genPackage) {%> + return (<%=genDataType.getObjectInstanceClassName()%>)create<%=genBaseType.getName()%>FromString(initialValue); + <%} else {%> + return (<%=genDataType.getObjectInstanceClassName()%>)<%=SDOGenUtil.getFactoryImpl(genBaseType.getGenPackage())%>.create<%=genBaseType.getName()%>FromString(initialValue); + <%}%> + <%} else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); %> + if (initialValue == null) return null; + <%=genModel.getImportedName("java.util.List")%> result = new <%=genModel.getImportedName("java.util.ArrayList")%>(); + for (<%=genModel.getImportedName("java.util.StringTokenizer")%> stringTokenizer = new <%=genModel.getImportedName("java.util.StringTokenizer")%>(initialValue); stringTokenizer.hasMoreTokens(); ) + { + String item = stringTokenizer.nextToken(); + <%if (genItemType.getGenPackage() == genPackage) {%> + result.add(create<%=genItemType.getName()%>FromString(item)); + <%} else {%> + result.add(<%=SDOGenUtil.getFactoryImpl(genItemType.getGenPackage())%>.create<%=genItemType.getName()%>FromString(item)); + <%}%> + } + return result; + <%} else if (!genDataType.getMemberTypes().isEmpty()) {%> + if (initialValue == null) return null; + <%=genDataType.getObjectInstanceClassName()%> result = null; + RuntimeException exception = null; + <%for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next();%> + try + { + <%if (genMemberType.getGenPackage() == genPackage) {%> + result = (<%=genDataType.getObjectInstanceClassName()%>)create<%=genMemberType.getName()%>FromString(initialValue); + <%} else {%> + result = (<%=genDataType.getObjectInstanceClassName()%>)<%=SDOGenUtil.getFactoryImpl(genMemberType.getGenPackage())%>.create<%=genMemberType.getName()%>FromString(initialValue); + <%}%> + if (result != null/* && Diagnostician.INSTANCE.validate(type, result, null, null)*/) + { + return result; + } + } + catch (RuntimeException e) + { + exception = e; + } + <%}%> + if (result != null || exception == null) return result; + + throw exception; + <%} else if (genDataType.isArrayType()) {%> + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new <%=genModel.getImportedName("java.lang.UnsupportedOperationException")%>(); + <%} else {%> + return (<%=genDataType.getObjectInstanceClassName()%>)super.createFromString(<%=genDataType.getClassifierID()%>, initialValue); + <%}%> + } + + /** + * + * + * @generated + */ + public String convert<%=genDataType.getName()%>ToString(Object instanceValue) + { + <%if (genDataType instanceof GenEnum) {%> + return instanceValue == null ? null : instanceValue.toString(); + <%} else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); %> + <%if (genBaseType.getGenPackage() == genPackage) {%> + return convert<%=genBaseType.getName()%>ToString(instanceValue); + <%} else {%> + return <%=SDOGenUtil.getFactoryImpl(genBaseType.getGenPackage())%>.convert<%=genBaseType.getName()%>ToString(instanceValue); + <%}%> + <%} else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); %> + if (instanceValue == null) return null; + <%=genModel.getImportedName("java.util.List")%> list = (<%=genModel.getImportedName("java.util.List")%>)instanceValue; + if (list.isEmpty()) return ""; + <%=genModel.getImportedName("java.lang.StringBuffer")%> result = new <%=genModel.getImportedName("java.lang.StringBuffer")%>(); + for (<%=genModel.getImportedName("java.util.Iterator")%> i = list.iterator(); i.hasNext(); ) + { + <%if (genItemType.getGenPackage() == genPackage) {%> + result.append(convert<%=genItemType.getName()%>ToString(i.next())); + <%} else {%> + result.append(<%=SDOGenUtil.getFactoryImpl(genItemType.getGenPackage())%>.convert<%=genItemType.getName()%>ToString(i.next())); + <%}%> + result.append(' '); + } + return result.substring(0, result.length() - 1); + <%} else if (!genDataType.getMemberTypes().isEmpty()) {%> + if (instanceValue == null) return null; + <%for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next();%> + if (<%=SDOGenUtil.getQualifiedTypeAccessor(genMemberType)%>.isInstance(instanceValue)) + { + try + { + <%if (genMemberType.getGenPackage() == genPackage) {%> + String value = convert<%=genMemberType.getName()%>ToString(instanceValue); + <%} else {%> + String value = <%=SDOGenUtil.getFactoryImpl(genMemberType.getGenPackage())%>.convert<%=genMemberType.getName()%>ToString(instanceValue); + <%}%> + if (value != null) return value; + } + catch (Exception e) + { + } + } + <%}%> + throw new IllegalArgumentException("Invalid value: '"+instanceValue+"' for datatype :<%=genDataType.getName()%>"); + <%} else if (genDataType.isArrayType()) {%> + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new <%=genModel.getImportedName("java.lang.UnsupportedOperationException")%>(); + <%} else {%> + return super.convertToString(<%=genDataType.getClassifierID()%>, instanceValue); + <%}%> + } + + <%}%> +<%}%> +<%} else {%> + <%for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();%> + <%if (genClass.hasFactoryInterfaceCreateMethod()) {%> + /** + * Returns a new object of class '<%=genClass.getFormattedName()%>'. + * + * + * @return a new object of class '<%=genClass.getFormattedName()%>'. + * @generated + */ + <%=genClass.getImportedInterfaceName()%> create<%=genClass.getName()%>(); + + <%}%> + <%}%> + /** + * Registers the types supported by this Factory within the supplied scope.argument + * + * + * @param scope an instance of HelperContext used to manage the scoping of types. + * @generated + */ + public void register(HelperContext scope); + + <%if (genPackage.isDataTypeConverters()) {%> + <%for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next();%> + <%if (genDataType.isSerializable()) {%> + /** + * Returns an instance of data type '<%=genDataType.getFormattedName()%>' corresponding the given literal. + * + * + * @param literal a literal of the data type. + * @return a new instance value of the data type. + * @generated + */ + <%=genDataType.getImportedInstanceClassName()%> create<%=genDataType.getName()%>(String literal); + + /** + * Returns a literal representation of an instance of data type '<%=genDataType.getFormattedName()%>'. + * + * + * @param instanceValue an instance value of the data type. + * @return a literal representation of the instance value. + * @generated + */ + String convert<%=genDataType.getName()%>(<%=genDataType.getImportedInstanceClassName()%> instanceValue); + + <%}%> + <%}%> + <%}%> +<%}%> +} //<%=isInterface ? genPackage.getFactoryInterfaceName() : genPackage.getFactoryClassName()%> +<%genModel.emitSortedImports();%> diff --git a/sdo-java/branches/sdo-1.1-incubating/tools/templates/models/generator.skeleton b/sdo-java/branches/sdo-1.1-incubating/tools/templates/models/generator.skeleton new file mode 100644 index 0000000000..5c123c01fd --- /dev/null +++ b/sdo-java/branches/sdo-1.1-incubating/tools/templates/models/generator.skeleton @@ -0,0 +1,25 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + public class CLASS + { + public String generate(Object argument) + { + return ""; + } + } \ No newline at end of file -- cgit v1.2.3