blob: d83be8c2224cc0da07091f9d80636de79eb32a48 [file] [log] [blame]
/**
* Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* EclipseSource Munich - initial API and implementation
*/
package org.eclipse.emf.ecp.makeithappen.model.task.impl;
import javax.xml.datatype.XMLGregorianCalendar;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EGenericType;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import org.eclipse.emf.ecp.makeithappen.model.task.Gender;
import org.eclipse.emf.ecp.makeithappen.model.task.Nationality;
import org.eclipse.emf.ecp.makeithappen.model.task.Task;
import org.eclipse.emf.ecp.makeithappen.model.task.TaskFactory;
import org.eclipse.emf.ecp.makeithappen.model.task.TaskPackage;
import org.eclipse.emf.ecp.makeithappen.model.task.User;
import org.eclipse.emf.ecp.makeithappen.model.task.UserGroup;
import org.eclipse.emf.ecp.makeithappen.model.task.util.TaskValidator;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Package</b>.
* <!-- end-user-doc -->
*
* @generated
*/
public class TaskPackageImpl extends EPackageImpl implements TaskPackage
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
private EClass taskEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
private EClass userEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
private EClass userGroupEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
private EEnum genderEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
private EEnum nationalityEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
private EDataType dateOfBirthEDataType = null;
/**
* Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry
* EPackage.Registry} by the package
* package URI value.
* <p>
* Note: the correct way to create the package is via the static factory method {@link #init init()}, which also
* performs initialization of the package, or returns the registered package, if one already exists. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see org.eclipse.emf.ecore.EPackage.Registry
* @see org.eclipse.emf.ecp.makeithappen.model.task.TaskPackage#eNS_URI
* @see #init()
* @generated
*/
private TaskPackageImpl()
{
super(eNS_URI, TaskFactory.eINSTANCE);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
private static boolean isInited = false;
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>
* This method is used to initialize {@link TaskPackage#eINSTANCE} when that field is accessed. Clients should not
* invoke it directly. Instead, they should simply access that field to obtain the package. <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #eNS_URI
* @see #createPackageContents()
* @see #initializePackageContents()
* @generated
*/
public static TaskPackage init()
{
if (isInited) {
return (TaskPackage) EPackage.Registry.INSTANCE.getEPackage(TaskPackage.eNS_URI);
}
// Obtain or create and register package
final TaskPackageImpl theTaskPackage = (TaskPackageImpl) (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof TaskPackageImpl ? EPackage.Registry.INSTANCE
.get(eNS_URI)
: new TaskPackageImpl());
isInited = true;
// Create package meta-data objects
theTaskPackage.createPackageContents();
// Initialize created meta-data
theTaskPackage.initializePackageContents();
// Register package validator
EValidator.Registry.INSTANCE.put
(theTaskPackage,
new EValidator.Descriptor()
{
@Override
public EValidator getEValidator()
{
return TaskValidator.INSTANCE;
}
});
// Mark meta-data to indicate it can't be changed
theTaskPackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(TaskPackage.eNS_URI, theTaskPackage);
return theTaskPackage;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EClass getTask()
{
return taskEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getTask_Name()
{
return (EAttribute) taskEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getTask_Description()
{
return (EAttribute) taskEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EReference getTask_Assignee()
{
return (EReference) taskEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getTask_DueDate()
{
return (EAttribute) taskEClass.getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EReference getTask_SubTasks()
{
return (EReference) taskEClass.getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getTask_Done()
{
return (EAttribute) taskEClass.getEStructuralFeatures().get(5);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EOperation getTask__HasName__DiagnosticChain_Map()
{
return taskEClass.getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EClass getUser()
{
return userEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getUser_FirstName()
{
return (EAttribute) userEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getUser_LastName()
{
return (EAttribute) userEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getUser_Gender()
{
return (EAttribute) userEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getUser_Active()
{
return (EAttribute) userEClass.getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getUser_TimeOfRegistration()
{
return (EAttribute) userEClass.getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getUser_Weight()
{
return (EAttribute) userEClass.getEStructuralFeatures().get(5);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getUser_Heigth()
{
return (EAttribute) userEClass.getEStructuralFeatures().get(6);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getUser_Nationality()
{
return (EAttribute) userEClass.getEStructuralFeatures().get(7);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getUser_DateOfBirth()
{
return (EAttribute) userEClass.getEStructuralFeatures().get(8);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getUser_Email()
{
return (EAttribute) userEClass.getEStructuralFeatures().get(9);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EReference getUser_Tasks()
{
return (EReference) userEClass.getEStructuralFeatures().get(10);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EClass getUserGroup()
{
return userGroupEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getUserGroup_Name()
{
return (EAttribute) userGroupEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EReference getUserGroup_Users()
{
return (EReference) userGroupEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EEnum getGender()
{
return genderEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EEnum getNationality()
{
return nationalityEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EDataType getDateOfBirth()
{
return dateOfBirthEDataType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public TaskFactory getTaskFactory()
{
return (TaskFactory) getEFactoryInstance();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
private boolean isCreated = false;
/**
* Creates the meta-model objects for the package. This method is
* guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void createPackageContents()
{
if (isCreated) {
return;
}
isCreated = true;
// Create classes and their features
taskEClass = createEClass(TASK);
createEAttribute(taskEClass, TASK__NAME);
createEAttribute(taskEClass, TASK__DESCRIPTION);
createEReference(taskEClass, TASK__ASSIGNEE);
createEAttribute(taskEClass, TASK__DUE_DATE);
createEReference(taskEClass, TASK__SUB_TASKS);
createEAttribute(taskEClass, TASK__DONE);
createEOperation(taskEClass, TASK___HAS_NAME__DIAGNOSTICCHAIN_MAP);
userEClass = createEClass(USER);
createEAttribute(userEClass, USER__FIRST_NAME);
createEAttribute(userEClass, USER__LAST_NAME);
createEAttribute(userEClass, USER__GENDER);
createEAttribute(userEClass, USER__ACTIVE);
createEAttribute(userEClass, USER__TIME_OF_REGISTRATION);
createEAttribute(userEClass, USER__WEIGHT);
createEAttribute(userEClass, USER__HEIGTH);
createEAttribute(userEClass, USER__NATIONALITY);
createEAttribute(userEClass, USER__DATE_OF_BIRTH);
createEAttribute(userEClass, USER__EMAIL);
createEReference(userEClass, USER__TASKS);
userGroupEClass = createEClass(USER_GROUP);
createEAttribute(userGroupEClass, USER_GROUP__NAME);
createEReference(userGroupEClass, USER_GROUP__USERS);
// Create enums
genderEEnum = createEEnum(GENDER);
nationalityEEnum = createEEnum(NATIONALITY);
// Create data types
dateOfBirthEDataType = createEDataType(DATE_OF_BIRTH);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
private boolean isInitialized = false;
/**
* Complete the initialization of the package and its meta-model. This
* method is guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void initializePackageContents()
{
if (isInitialized) {
return;
}
isInitialized = true;
// Initialize package
setName(eNAME);
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
// Initialize classes, features, and operations; add parameters
initEClass(taskEClass, Task.class, "Task", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
initEAttribute(
getTask_Name(),
ecorePackage.getEString(),
"name", null, 0, 1, Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getTask_Description(),
ecorePackage.getEString(),
"description", null, 0, 1, Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEReference(
getTask_Assignee(),
getUser(),
getUser_Tasks(),
"assignee", null, 0, 1, Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getTask_DueDate(),
ecorePackage.getEDate(),
"dueDate", null, 0, 1, Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEReference(
getTask_SubTasks(),
getTask(),
null,
"subTasks", null, 0, -1, Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getTask_Done(),
ecorePackage.getEBoolean(),
"done", null, 0, 1, Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
final EOperation op = initEOperation(getTask__HasName__DiagnosticChain_Map(), ecorePackage.getEBoolean(),
"hasName", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$
addEParameter(op, ecorePackage.getEDiagnosticChain(), "chain", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$
final EGenericType g1 = createEGenericType(ecorePackage.getEMap());
EGenericType g2 = createEGenericType();
g1.getETypeArguments().add(g2);
g2 = createEGenericType();
g1.getETypeArguments().add(g2);
addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$
initEClass(userEClass, User.class, "User", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
initEAttribute(
getUser_FirstName(),
ecorePackage.getEString(),
"firstName", null, 0, 1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getUser_LastName(),
ecorePackage.getEString(),
"lastName", null, 1, 1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getUser_Gender(),
getGender(),
"gender", null, 0, 1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getUser_Active(),
ecorePackage.getEBoolean(),
"active", null, 0, 1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getUser_TimeOfRegistration(),
ecorePackage.getEDate(),
"timeOfRegistration", null, 0, 1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getUser_Weight(),
ecorePackage.getEDouble(),
"weight", null, 0, 1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getUser_Heigth(),
ecorePackage.getEInt(),
"heigth", null, 0, 1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getUser_Nationality(),
getNationality(),
"nationality", null, 0, 1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getUser_DateOfBirth(),
getDateOfBirth(),
"dateOfBirth", null, 0, 1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(
getUser_Email(),
ecorePackage.getEString(),
"email", null, 1, 1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEReference(
getUser_Tasks(),
getTask(),
getTask_Assignee(),
"tasks", null, 0, -1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEClass(userGroupEClass, UserGroup.class,
"UserGroup", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
initEAttribute(
getUserGroup_Name(),
ecorePackage.getEString(),
"name", null, 0, 1, UserGroup.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEReference(
getUserGroup_Users(),
getUser(),
null,
"users", null, 0, -1, UserGroup.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
// Initialize enums and add enum literals
initEEnum(genderEEnum, Gender.class, "Gender"); //$NON-NLS-1$
addEEnumLiteral(genderEEnum, Gender.MALE);
addEEnumLiteral(genderEEnum, Gender.FEMALE);
initEEnum(nationalityEEnum, Nationality.class, "Nationality"); //$NON-NLS-1$
addEEnumLiteral(nationalityEEnum, Nationality.GERMAN);
addEEnumLiteral(nationalityEEnum, Nationality.FRENCH);
addEEnumLiteral(nationalityEEnum, Nationality.UK);
addEEnumLiteral(nationalityEEnum, Nationality.US);
addEEnumLiteral(nationalityEEnum, Nationality.SPANISH);
addEEnumLiteral(nationalityEEnum, Nationality.ITALIAN);
addEEnumLiteral(nationalityEEnum, Nationality.RUSSIAN);
// Initialize data types
initEDataType(dateOfBirthEDataType, XMLGregorianCalendar.class,
"DateOfBirth", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
// Create resource
createResource(eNS_URI);
}
} // TaskPackageImpl