diff options
author | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
---|---|---|
committer | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
commit | bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch) | |
tree | 38a92061c0793434c4be189f1d70c3458b6bc41d /branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer |
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer')
8 files changed, 1593 insertions, 0 deletions
diff --git a/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/CustomerFactory.java b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/CustomerFactory.java new file mode 100644 index 0000000000..fbac1f8e28 --- /dev/null +++ b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/CustomerFactory.java @@ -0,0 +1,79 @@ +/** + * + * 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.extensible.customer; + +import commonj.sdo.helper.HelperContext; + + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @generated + */ +public interface CustomerFactory +{ + + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CustomerFactory INSTANCE = com.example.extensible.customer.impl.CustomerFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Customers Type</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Customers Type</em>'. + * @generated + */ + CustomersType createCustomersType(); + + /** + * Returns a new object of class '<em>Type</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Type</em>'. + * @generated + */ + CustomerType createCustomerType(); + + /** + * Returns a new object of class '<em>Info Type</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Info Type</em>'. + * @generated + */ + InfoType createInfoType(); + + /** + * Registers the types supported by this Factory within the supplied scope.argument + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param scope an instance of HelperContext used to manage the scoping of types. + * @generated + */ + public void register(HelperContext scope); + +} //CustomerFactory diff --git a/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/CustomerType.java b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/CustomerType.java new file mode 100644 index 0000000000..34caf80111 --- /dev/null +++ b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/CustomerType.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.extensible.customer; + +import java.io.Serializable; + +import java.math.BigInteger; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Type</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link com.example.extensible.customer.CustomerType#getName <em>Name</em>}</li> + * <li>{@link com.example.extensible.customer.CustomerType#getNumber <em>Number</em>}</li> + * <li>{@link com.example.extensible.customer.CustomerType#getInfo <em>Info</em>}</li> + * </ul> + * </p> + * + * @extends Serializable + * @generated + */ +public interface CustomerType extends Serializable +{ + /** + * Returns the value of the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Name</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Name</em>' attribute. + * @see #isSetName() + * @see #unsetName() + * @see #setName(String) + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link com.example.extensible.customer.CustomerType#getName <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Name</em>' attribute. + * @see #isSetName() + * @see #unsetName() + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Unsets the value of the '{@link com.example.extensible.customer.CustomerType#getName <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isSetName() + * @see #getName() + * @see #setName(String) + * @generated + */ + void unsetName(); + + /** + * Returns whether the value of the '{@link com.example.extensible.customer.CustomerType#getName <em>Name</em>}' attribute is set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return whether the value of the '<em>Name</em>' attribute is set. + * @see #unsetName() + * @see #getName() + * @see #setName(String) + * @generated + */ + boolean isSetName(); + + /** + * Returns the value of the '<em><b>Number</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Number</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Number</em>' attribute. + * @see #isSetNumber() + * @see #unsetNumber() + * @see #setNumber(BigInteger) + * @generated + */ + BigInteger getNumber(); + + /** + * Sets the value of the '{@link com.example.extensible.customer.CustomerType#getNumber <em>Number</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Number</em>' attribute. + * @see #isSetNumber() + * @see #unsetNumber() + * @see #getNumber() + * @generated + */ + void setNumber(BigInteger value); + + /** + * Unsets the value of the '{@link com.example.extensible.customer.CustomerType#getNumber <em>Number</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isSetNumber() + * @see #getNumber() + * @see #setNumber(BigInteger) + * @generated + */ + void unsetNumber(); + + /** + * Returns whether the value of the '{@link com.example.extensible.customer.CustomerType#getNumber <em>Number</em>}' attribute is set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return whether the value of the '<em>Number</em>' attribute is set. + * @see #unsetNumber() + * @see #getNumber() + * @see #setNumber(BigInteger) + * @generated + */ + boolean isSetNumber(); + + /** + * Returns the value of the '<em><b>Info</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Info</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Info</em>' containment reference. + * @see #isSetInfo() + * @see #unsetInfo() + * @see #setInfo(InfoType) + * @generated + */ + InfoType getInfo(); + + /** + * Sets the value of the '{@link com.example.extensible.customer.CustomerType#getInfo <em>Info</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Info</em>' containment reference. + * @see #isSetInfo() + * @see #unsetInfo() + * @see #getInfo() + * @generated + */ + void setInfo(InfoType value); + + /** + * Unsets the value of the '{@link com.example.extensible.customer.CustomerType#getInfo <em>Info</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isSetInfo() + * @see #getInfo() + * @see #setInfo(InfoType) + * @generated + */ + void unsetInfo(); + + /** + * Returns whether the value of the '{@link com.example.extensible.customer.CustomerType#getInfo <em>Info</em>}' containment reference is set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return whether the value of the '<em>Info</em>' containment reference is set. + * @see #unsetInfo() + * @see #getInfo() + * @see #setInfo(InfoType) + * @generated + */ + boolean isSetInfo(); + +} // CustomerType diff --git a/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/CustomersType.java b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/CustomersType.java new file mode 100644 index 0000000000..5d24e228b2 --- /dev/null +++ b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/CustomersType.java @@ -0,0 +1,57 @@ +/** + * + * 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.extensible.customer; + +import java.io.Serializable; + +import java.util.List; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Customers Type</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link com.example.extensible.customer.CustomersType#getCustomer <em>Customer</em>}</li> + * </ul> + * </p> + * + * @extends Serializable + * @generated + */ +public interface CustomersType extends Serializable +{ + /** + * Returns the value of the '<em><b>Customer</b></em>' containment reference list. + * The list contents are of type {@link com.example.extensible.customer.CustomerType}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Customer</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Customer</em>' containment reference list. + * @generated + */ + List getCustomer(); + +} // CustomersType diff --git a/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/InfoType.java b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/InfoType.java new file mode 100644 index 0000000000..8bda4f74b2 --- /dev/null +++ b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/InfoType.java @@ -0,0 +1,35 @@ +/** + * + * 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.extensible.customer; + +import java.io.Serializable; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Info Type</b></em>'. + * <!-- end-user-doc --> + * + * + * @extends Serializable + * @generated + */ +public interface InfoType extends Serializable +{ +} // InfoType diff --git a/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/CustomerFactoryImpl.java b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/CustomerFactoryImpl.java new file mode 100644 index 0000000000..67bc859536 --- /dev/null +++ b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/CustomerFactoryImpl.java @@ -0,0 +1,410 @@ +/** + * + * 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.extensible.customer.impl; + +import commonj.sdo.helper.HelperContext; +import org.apache.tuscany.sdo.helper.TypeHelperImpl; + +import com.example.extensible.customer.*; + +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; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * Generator information: + * patternVersion=1.2; + * <!-- end-user-doc --> + * @generated + */ +public class CustomerFactoryImpl extends FactoryBase implements CustomerFactory +{ + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static final String NAMESPACE_URI = "http://www.example.com/extensible/customer"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static final String NAMESPACE_PREFIX = "customer"; + + /** + * The version of the generator pattern used to generate this class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static final String PATTERN_VERSION = "1.2"; + + public static final int CUSTOMERS_TYPE = 1; + public static final int CUSTOMER_TYPE = 2; + public static final int INFO_TYPE = 3; + public static final int CUST_NAME_TYPE = 4; + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomerFactoryImpl() + { + super(NAMESPACE_URI, NAMESPACE_PREFIX, "com.example.extensible.customer"); + } + + /** + * 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. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @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); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public DataObject create(int typeNumber) + { + switch (typeNumber) + { + case CUSTOMERS_TYPE: return (DataObject)createCustomersType(); + case CUSTOMER_TYPE: return (DataObject)createCustomerType(); + case INFO_TYPE: return (DataObject)createInfoType(); + default: + return super.create(typeNumber); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Object createFromString(int typeNumber, String initialValue) + { + switch (typeNumber) + { + case CUST_NAME_TYPE: + return createCustNameTypeFromString(initialValue); + default: + throw new IllegalArgumentException("The type number '" + typeNumber + "' is not a valid datatype"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String convertToString(int typeNumber, Object instanceValue) + { + switch (typeNumber) + { + case CUST_NAME_TYPE: + return convertCustNameTypeToString(instanceValue); + default: + throw new IllegalArgumentException("The type number '" + typeNumber + "' is not a valid datatype"); + } + } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomersType createCustomersType() + { + CustomersTypeImpl customersType = new CustomersTypeImpl(); + return customersType; + } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomerType createCustomerType() + { + CustomerTypeImpl customerType = new CustomerTypeImpl(); + return customerType; + } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public InfoType createInfoType() + { + InfoTypeImpl infoType = new InfoTypeImpl(); + return infoType; + } + + // Following creates and initializes SDO metadata for the supported types. + protected Type customersTypeType = null; + + public Type getCustomersType() + { + return customersTypeType; + } + + protected Type customerTypeType = null; + + public Type getCustomerType() + { + return customerTypeType; + } + + protected Type infoTypeType = null; + + public Type getInfoType() + { + return infoTypeType; + } + + protected Type custNameTypeType = null; + + public Type getCustNameType() + { + return custNameTypeType; + } + + + private static CustomerFactoryImpl instance = null; + public static CustomerFactoryImpl init() + { + if (instance != null ) return instance; + instance = new CustomerFactoryImpl(); + + // 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 + //theCustomerFactoryImpl.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 + customersTypeType = createType(false, CUSTOMERS_TYPE); + createProperty(false, customersTypeType,CustomersTypeImpl.INTERNAL_CUSTOMER); + customerTypeType = createType(false, CUSTOMER_TYPE); + createProperty(true, customerTypeType,CustomerTypeImpl.INTERNAL_NAME); + createProperty(true, customerTypeType,CustomerTypeImpl.INTERNAL_NUMBER); + createProperty(false, customerTypeType,CustomerTypeImpl.INTERNAL_INFO); + infoTypeType = createType(false, INFO_TYPE); + + // Create data types + custNameTypeType = createType(true, CUST_NAME_TYPE ); + } + + 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(customersTypeType, CustomersType.class, "CustomersType", false); + property = getLocalProperty(customersTypeType, 0); + initializeProperty(property, this.getCustomerType(), "customer", null, 1, -1, CustomersType.class, false, false, false, true , null); + + initializeType(customerTypeType, CustomerType.class, "CustomerType", false); + property = getLocalProperty(customerTypeType, 0); + initializeProperty(property, this.getCustNameType(), "name", null, 1, 1, CustomerType.class, false, true, false); + + property = getLocalProperty(customerTypeType, 1); + initializeProperty(property, theModelPackageImpl.getInteger(), "number", null, 1, 1, CustomerType.class, false, true, false); + + property = getLocalProperty(customerTypeType, 2); + initializeProperty(property, this.getInfoType(), "info", null, 1, 1, CustomerType.class, false, true, false, true , null); + + initializeType(infoTypeType, InfoType.class, "InfoType", false); + // Initialize data types + initializeType(custNameTypeType, String.class, "CustNameType", true, false); + + createXSDMetaData(theModelPackageImpl); + } + + protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl) + { + super.initXSD(); + + Property property = null; + + + addXSDMapping + (customersTypeType, + new String[] + { + "name", "CustomersType", + "kind", "elementOnly" + }); + + addXSDMapping + (getProperty(customersTypeType, CustomersTypeImpl.INTERNAL_CUSTOMER), + new String[] + { + "kind", "element", + "name", "customer", + "namespace", "##targetNamespace" + }); + + addXSDMapping + (customerTypeType, + new String[] + { + "name", "CustomerType", + "kind", "elementOnly" + }); + + addXSDMapping + (getProperty(customerTypeType, CustomerTypeImpl.INTERNAL_NAME), + new String[] + { + "kind", "element", + "name", "name", + "namespace", "##targetNamespace" + }); + + addXSDMapping + (getProperty(customerTypeType, CustomerTypeImpl.INTERNAL_NUMBER), + new String[] + { + "kind", "element", + "name", "number", + "namespace", "##targetNamespace" + }); + + addXSDMapping + (getProperty(customerTypeType, CustomerTypeImpl.INTERNAL_INFO), + new String[] + { + "kind", "element", + "name", "info" + }); + + property = createGlobalProperty + ("customer", + this.getCustomerType(), + new String[] + { + "kind", "element", + "name", "customer", + "namespace", "##targetNamespace" + }); + + property = createGlobalProperty + ("customers", + this.getCustomersType(), + new String[] + { + "kind", "element", + "name", "customers", + "namespace", "##targetNamespace" + }); + + addXSDMapping + (infoTypeType, + new String[] + { + "name", "InfoType", + "kind", "empty" + }); + + addXSDMapping + (custNameTypeType, + new String[] + { + "name", "CustNameType", + "baseType", "commonj.sdo#String" + }); + + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String createCustNameTypeFromString(String initialValue) + { + return (String)((ModelFactoryImpl)ModelFactory.INSTANCE).createStringFromString(initialValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String convertCustNameTypeToString(Object instanceValue) + { + return ((ModelFactoryImpl)ModelFactory.INSTANCE).convertStringToString(instanceValue); + } + +} //CustomerFactoryImpl diff --git a/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/CustomerTypeImpl.java b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/CustomerTypeImpl.java new file mode 100644 index 0000000000..216f1ba9ff --- /dev/null +++ b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/CustomerTypeImpl.java @@ -0,0 +1,524 @@ +/** + * + * 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.extensible.customer.impl; + +import com.example.extensible.customer.CustomerFactory; +import com.example.extensible.customer.CustomerType; +import com.example.extensible.customer.InfoType; + +import commonj.sdo.Type; + +import java.math.BigInteger; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Type</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link com.example.extensible.customer.impl.CustomerTypeImpl#getName <em>Name</em>}</li> + * <li>{@link com.example.extensible.customer.impl.CustomerTypeImpl#getNumber <em>Number</em>}</li> + * <li>{@link com.example.extensible.customer.impl.CustomerTypeImpl#getInfo <em>Info</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class CustomerTypeImpl extends DataObjectBase implements CustomerType +{ + + public final static int NAME = 0; + + public final static int NUMBER = 1; + + public final static int INFO = 2; + + public final static int SDO_PROPERTY_COUNT = 3; + + public final static int EXTENDED_PROPERTY_COUNT = 0; + + + /** + * The internal feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int INTERNAL_NAME = 0; + + /** + * The internal feature id for the '<em><b>Number</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int INTERNAL_NUMBER = 1; + + /** + * The internal feature id for the '<em><b>Info</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int INTERNAL_INFO = 2; + + /** + * The number of properties for this type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 3; + + protected int internalConvertIndex(int internalIndex) + { + switch (internalIndex) + { + case INTERNAL_NAME: return NAME; + case INTERNAL_NUMBER: return NUMBER; + case INTERNAL_INFO: return INFO; + } + return super.internalConvertIndex(internalIndex); + } + + + /** + * The default value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_DEFAULT_; + + /** + * This is true if the Name attribute has been set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + protected boolean name_set_ = false; + + /** + * The default value of the '{@link #getNumber() <em>Number</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getNumber() + * @generated + * @ordered + */ + protected static final BigInteger NUMBER_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getNumber() <em>Number</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getNumber() + * @generated + * @ordered + */ + protected BigInteger number = NUMBER_DEFAULT_; + + /** + * This is true if the Number attribute has been set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + protected boolean number_set_ = false; + + /** + * The cached value of the '{@link #getInfo() <em>Info</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getInfo() + * @generated + * @ordered + */ + + protected InfoType info = null; + + /** + * This is true if the Info containment reference has been set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + protected boolean info_set_ = false; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomerTypeImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Type getStaticType() + { + return ((CustomerFactoryImpl)CustomerFactory.INSTANCE).getCustomerType(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getName() + { + return name; + } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setName(String newName) + { + String oldName = name; + name = newName; + boolean oldName_set_ = name_set_; + name_set_ = true; + if (isNotifying()) + notify(ChangeKind.SET, INTERNAL_NAME, oldName, name, !oldName_set_); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unsetName() + { + String oldName = name; + boolean oldName_set_ = name_set_; + name = NAME_DEFAULT_; + name_set_ = false; + if (isNotifying()) + notify(ChangeKind.UNSET, INTERNAL_NAME, oldName, NAME_DEFAULT_, oldName_set_); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSetName() + { + return name_set_; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public BigInteger getNumber() + { + return number; + } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setNumber(BigInteger newNumber) + { + BigInteger oldNumber = number; + number = newNumber; + boolean oldNumber_set_ = number_set_; + number_set_ = true; + if (isNotifying()) + notify(ChangeKind.SET, INTERNAL_NUMBER, oldNumber, number, !oldNumber_set_); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unsetNumber() + { + BigInteger oldNumber = number; + boolean oldNumber_set_ = number_set_; + number = NUMBER_DEFAULT_; + number_set_ = false; + if (isNotifying()) + notify(ChangeKind.UNSET, INTERNAL_NUMBER, oldNumber, NUMBER_DEFAULT_, oldNumber_set_); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSetNumber() + { + return number_set_; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public InfoType getInfo() + { + return info; + } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ChangeContext basicSetInfo(InfoType newInfo, ChangeContext changeContext) + { + InfoType oldInfo = info; + info = newInfo; + boolean oldInfo_set_ = info_set_; + info_set_ = true; + if (isNotifying()) + { + addNotification(this, ChangeKind.SET, INTERNAL_INFO, oldInfo, newInfo, !oldInfo_set_, changeContext); + } + return changeContext; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setInfo(InfoType newInfo) + { + if (newInfo != info) + { + ChangeContext changeContext = null; + if (info != null) + changeContext = inverseRemove(info, this, OPPOSITE_FEATURE_BASE - INTERNAL_INFO, null, changeContext); + if (newInfo != null) + changeContext = inverseAdd(newInfo, this, OPPOSITE_FEATURE_BASE - INTERNAL_INFO, null, changeContext); + changeContext = basicSetInfo(newInfo, changeContext); + if (changeContext != null) dispatch(changeContext); + } + else + { + boolean oldInfo_set_ = info_set_; + info_set_ = true; + if (isNotifying()) + notify(ChangeKind.SET, INTERNAL_INFO, newInfo, newInfo, !oldInfo_set_); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ChangeContext basicUnsetInfo(ChangeContext changeContext) + { + InfoType oldInfo = info; + info = null; + boolean oldInfo_set_ = info_set_; + info_set_ = false; + if (isNotifying()) + { + addNotification(this, ChangeKind.UNSET, INTERNAL_INFO, oldInfo, null, !oldInfo_set_, changeContext); + } + return changeContext; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unsetInfo() + { + if (info != null) + { + ChangeContext changeContext = null; + changeContext = inverseRemove(info, this, EOPPOSITE_FEATURE_BASE - INTERNAL_INFO, null, changeContext); + changeContext = basicUnsetInfo(changeContext); + if (changeContext != null) dispatch(changeContext); + } + else + { + boolean oldInfo_set_ = info_set_; + info_set_ = false; + if (isNotifying()) + notify(ChangeKind.UNSET, INTERNAL_INFO, null, null, oldInfo_set_); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSetInfo() + { + return info_set_; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case INFO: + return basicUnsetInfo(changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case NAME: + return getName(); + case NUMBER: + return getNumber(); + case INFO: + return getInfo(); + } + return super.get(propertyIndex, resolve); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case NAME: + setName((String)newValue); + return; + case NUMBER: + setNumber((BigInteger)newValue); + return; + case INFO: + setInfo((InfoType)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case NAME: + unsetName(); + return; + case NUMBER: + unsetNumber(); + return; + case INFO: + unsetInfo(); + return; + } + super.unset(propertyIndex); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case NAME: + return isSetName(); + case NUMBER: + return isSetNumber(); + case INFO: + return isSetInfo(); + } + return super.isSet(propertyIndex); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String toString() + { + if (isProxy(this)) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); + if (name_set_) result.append(name); else result.append("<unset>"); + result.append(", number: "); + if (number_set_) result.append(number); else result.append("<unset>"); + result.append(')'); + return result.toString(); + } + +} //CustomerTypeImpl diff --git a/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/CustomersTypeImpl.java b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/CustomersTypeImpl.java new file mode 100644 index 0000000000..984fea97e9 --- /dev/null +++ b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/CustomersTypeImpl.java @@ -0,0 +1,206 @@ +/** + * + * 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.extensible.customer.impl; + +import com.example.extensible.customer.CustomerFactory; +import com.example.extensible.customer.CustomerType; +import com.example.extensible.customer.CustomersType; + +import commonj.sdo.Type; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Customers Type</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link com.example.extensible.customer.impl.CustomersTypeImpl#getCustomer <em>Customer</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class CustomersTypeImpl extends DataObjectBase implements CustomersType +{ + + public final static int CUSTOMER = 0; + + public final static int SDO_PROPERTY_COUNT = 1; + + public final static int EXTENDED_PROPERTY_COUNT = 0; + + + /** + * The internal feature id for the '<em><b>Customer</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int INTERNAL_CUSTOMER = 0; + + /** + * The number of properties for this type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 1; + + protected int internalConvertIndex(int internalIndex) + { + switch (internalIndex) + { + case INTERNAL_CUSTOMER: return CUSTOMER; + } + return super.internalConvertIndex(internalIndex); + } + + + /** + * The cached value of the '{@link #getCustomer() <em>Customer</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCustomer() + * @generated + * @ordered + */ + + protected List customer = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomersTypeImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Type getStaticType() + { + return ((CustomerFactoryImpl)CustomerFactory.INSTANCE).getCustomersType(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public List getCustomer() + { + if (customer == null) + { + customer = createPropertyList(ListKind.CONTAINMENT, CustomerType.class, CUSTOMER, 0); + } + return customer; + } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case CUSTOMER: + return removeFromList(getCustomer(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case CUSTOMER: + return getCustomer(); + } + return super.get(propertyIndex, resolve); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case CUSTOMER: + getCustomer().clear(); + getCustomer().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case CUSTOMER: + getCustomer().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case CUSTOMER: + return customer != null && !customer.isEmpty(); + } + return super.isSet(propertyIndex); + } + +} //CustomersTypeImpl diff --git a/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/InfoTypeImpl.java b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/InfoTypeImpl.java new file mode 100644 index 0000000000..66f3dc424a --- /dev/null +++ b/branches/sdo-1.0-incubating/tools/src/test/java/com/example/extensible/customer/impl/InfoTypeImpl.java @@ -0,0 +1,84 @@ +/** + * + * 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.extensible.customer.impl; + +import com.example.extensible.customer.CustomerFactory; +import com.example.extensible.customer.InfoType; + +import commonj.sdo.Type; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Info Type</b></em>'. + * <!-- end-user-doc --> + * <p> + * </p> + * + * @generated + */ +public class InfoTypeImpl extends DataObjectBase implements InfoType +{ + + public final static int SDO_PROPERTY_COUNT = 0; + + public final static int EXTENDED_PROPERTY_COUNT = 0; + + + /** + * The number of properties for this type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 0; + + protected int internalConvertIndex(int internalIndex) + { + switch (internalIndex) + { + } + return super.internalConvertIndex(internalIndex); + } + + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public InfoTypeImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Type getStaticType() + { + return ((CustomerFactoryImpl)CustomerFactory.INSTANCE).getInfoType(); + } + +} //InfoTypeImpl |