/**
 */
package org.xtext.example.mydsl2.myDsl2.impl;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

import org.xtext.example.mydsl2.myDsl2.BasePermission;
import org.xtext.example.mydsl2.myDsl2.Group;
import org.xtext.example.mydsl2.myDsl2.MyDsl2Factory;
import org.xtext.example.mydsl2.myDsl2.MyDsl2Package;
import org.xtext.example.mydsl2.myDsl2.Principle;
import org.xtext.example.mydsl2.myDsl2.RoleAssignment;
import org.xtext.example.mydsl2.myDsl2.RoleDefinition;
import org.xtext.example.mydsl2.myDsl2.SitePermission;
import org.xtext.example.mydsl2.myDsl2.User;
import org.xtext.example.mydsl2.myDsl2.UserModel;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class MyDsl2PackageImpl extends EPackageImpl implements MyDsl2Package
{
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass userModelEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass sitePermissionEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass principleEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass groupEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass userEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass roleAssignmentEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass roleDefinitionEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EEnum basePermissionEEnum = 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.xtext.example.mydsl2.myDsl2.MyDsl2Package#eNS_URI
   * @see #init()
   * @generated
   */
  private MyDsl2PackageImpl()
  {
    super(eNS_URI, MyDsl2Factory.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 MyDsl2Package#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 MyDsl2Package init()
  {
    if (isInited) return (MyDsl2Package)EPackage.Registry.INSTANCE.getEPackage(MyDsl2Package.eNS_URI);

    // Obtain or create and register package
    MyDsl2PackageImpl theMyDsl2Package = (MyDsl2PackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof MyDsl2PackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new MyDsl2PackageImpl());

    isInited = true;

    // Create package meta-data objects
    theMyDsl2Package.createPackageContents();

    // Initialize created meta-data
    theMyDsl2Package.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theMyDsl2Package.freeze();

  
    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(MyDsl2Package.eNS_URI, theMyDsl2Package);
    return theMyDsl2Package;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getUserModel()
  {
    return userModelEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getUserModel_Name()
  {
    return (EAttribute)userModelEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getUserModel_Users()
  {
    return (EReference)userModelEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getUserModel_SitePermissions()
  {
    return (EReference)userModelEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getSitePermission()
  {
    return sitePermissionEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getSitePermission_Name()
  {
    return (EAttribute)sitePermissionEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getSitePermission_WebGUID()
  {
    return (EAttribute)sitePermissionEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getSitePermission_OwnedGroup()
  {
    return (EReference)sitePermissionEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getSitePermission_OwnedRoleDefinition()
  {
    return (EReference)sitePermissionEClass.getEStructuralFeatures().get(3);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getSitePermission_OwnedRoleAssignments()
  {
    return (EReference)sitePermissionEClass.getEStructuralFeatures().get(4);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getPrinciple()
  {
    return principleEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getPrinciple_Name()
  {
    return (EAttribute)principleEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getGroup()
  {
    return groupEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getGroup_Users()
  {
    return (EReference)groupEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getUser()
  {
    return userEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getRoleAssignment()
  {
    return roleAssignmentEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getRoleAssignment_Name()
  {
    return (EAttribute)roleAssignmentEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getRoleAssignment_Member()
  {
    return (EReference)roleAssignmentEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getRoleAssignment_RoleDefinitionBindings()
  {
    return (EReference)roleAssignmentEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getRoleDefinition()
  {
    return roleDefinitionEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getRoleDefinition_Name()
  {
    return (EAttribute)roleDefinitionEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getRoleDefinition_BasePermissions()
  {
    return (EAttribute)roleDefinitionEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EEnum getBasePermission()
  {
    return basePermissionEEnum;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public MyDsl2Factory getMyDsl2Factory()
  {
    return (MyDsl2Factory)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
    userModelEClass = createEClass(USER_MODEL);
    createEAttribute(userModelEClass, USER_MODEL__NAME);
    createEReference(userModelEClass, USER_MODEL__USERS);
    createEReference(userModelEClass, USER_MODEL__SITE_PERMISSIONS);

    sitePermissionEClass = createEClass(SITE_PERMISSION);
    createEAttribute(sitePermissionEClass, SITE_PERMISSION__NAME);
    createEAttribute(sitePermissionEClass, SITE_PERMISSION__WEB_GUID);
    createEReference(sitePermissionEClass, SITE_PERMISSION__OWNED_GROUP);
    createEReference(sitePermissionEClass, SITE_PERMISSION__OWNED_ROLE_DEFINITION);
    createEReference(sitePermissionEClass, SITE_PERMISSION__OWNED_ROLE_ASSIGNMENTS);

    principleEClass = createEClass(PRINCIPLE);
    createEAttribute(principleEClass, PRINCIPLE__NAME);

    groupEClass = createEClass(GROUP);
    createEReference(groupEClass, GROUP__USERS);

    userEClass = createEClass(USER);

    roleAssignmentEClass = createEClass(ROLE_ASSIGNMENT);
    createEAttribute(roleAssignmentEClass, ROLE_ASSIGNMENT__NAME);
    createEReference(roleAssignmentEClass, ROLE_ASSIGNMENT__MEMBER);
    createEReference(roleAssignmentEClass, ROLE_ASSIGNMENT__ROLE_DEFINITION_BINDINGS);

    roleDefinitionEClass = createEClass(ROLE_DEFINITION);
    createEAttribute(roleDefinitionEClass, ROLE_DEFINITION__NAME);
    createEAttribute(roleDefinitionEClass, ROLE_DEFINITION__BASE_PERMISSIONS);

    // Create enums
    basePermissionEEnum = createEEnum(BASE_PERMISSION);
  }

  /**
   * <!-- 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
    groupEClass.getESuperTypes().add(this.getPrinciple());
    userEClass.getESuperTypes().add(this.getPrinciple());

    // Initialize classes and features; add operations and parameters
    initEClass(userModelEClass, UserModel.class, "UserModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getUserModel_Name(), ecorePackage.getEString(), "name", null, 0, 1, UserModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getUserModel_Users(), this.getUser(), null, "users", null, 0, -1, UserModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getUserModel_SitePermissions(), this.getSitePermission(), null, "sitePermissions", null, 0, -1, UserModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(sitePermissionEClass, SitePermission.class, "SitePermission", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getSitePermission_Name(), ecorePackage.getEString(), "name", null, 0, 1, SitePermission.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getSitePermission_WebGUID(), ecorePackage.getEString(), "webGUID", null, 0, 1, SitePermission.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getSitePermission_OwnedGroup(), this.getGroup(), null, "ownedGroup", null, 0, -1, SitePermission.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getSitePermission_OwnedRoleDefinition(), this.getRoleDefinition(), null, "ownedRoleDefinition", null, 0, -1, SitePermission.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getSitePermission_OwnedRoleAssignments(), this.getRoleAssignment(), null, "ownedRoleAssignments", null, 0, -1, SitePermission.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(principleEClass, Principle.class, "Principle", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getPrinciple_Name(), ecorePackage.getEString(), "name", null, 0, 1, Principle.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(groupEClass, Group.class, "Group", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getGroup_Users(), this.getUser(), null, "users", null, 0, -1, Group.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(userEClass, User.class, "User", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

    initEClass(roleAssignmentEClass, RoleAssignment.class, "RoleAssignment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getRoleAssignment_Name(), ecorePackage.getEString(), "name", null, 0, 1, RoleAssignment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getRoleAssignment_Member(), this.getPrinciple(), null, "member", null, 0, 1, RoleAssignment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getRoleAssignment_RoleDefinitionBindings(), this.getRoleDefinition(), null, "roleDefinitionBindings", null, 0, -1, RoleAssignment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(roleDefinitionEClass, RoleDefinition.class, "RoleDefinition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getRoleDefinition_Name(), ecorePackage.getEString(), "name", null, 0, 1, RoleDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getRoleDefinition_BasePermissions(), this.getBasePermission(), "basePermissions", null, 0, -1, RoleDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    // Initialize enums and add enum literals
    initEEnum(basePermissionEEnum, BasePermission.class, "BasePermission");
    addEEnumLiteral(basePermissionEEnum, BasePermission.VIEW_LIST_ITEMS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.ADD_LIST_ITEMS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.EDIT_LIST_ITEMS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.DELETE_LIST_ITEMS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.APPROVE_ITEMS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.OPEN_ITEMS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.VIEW_VERSIONS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.DELETE_VERSIONS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.CANCEL_CHECKOUT);
    addEEnumLiteral(basePermissionEEnum, BasePermission.MANAGE_PERSONAL_VIEWS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.MANAGE_LISTS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.VIEW_FORM_PAGES);
    addEEnumLiteral(basePermissionEEnum, BasePermission.OPEN);
    addEEnumLiteral(basePermissionEEnum, BasePermission.ADD_AND_CUSTOMIZE_PAGES);
    addEEnumLiteral(basePermissionEEnum, BasePermission.APPLY_THEME_AND_BORDER);
    addEEnumLiteral(basePermissionEEnum, BasePermission.CREATE_SSC_SITE);
    addEEnumLiteral(basePermissionEEnum, BasePermission.BROWSE_DIRECTORIES);
    addEEnumLiteral(basePermissionEEnum, BasePermission.BROWSE_USER_INFO);
    addEEnumLiteral(basePermissionEEnum, BasePermission.ADD_DEL_PRIVATE_WEB_PARTS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.UPDATE_PERSONAL_WEB_PARTS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.USE_CLIENT_INTEGRATION);
    addEEnumLiteral(basePermissionEEnum, BasePermission.USE_REMOTE_AP_IS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.CREATE_ALERTS);
    addEEnumLiteral(basePermissionEEnum, BasePermission.EDIT_MY_USER_INFO);
    addEEnumLiteral(basePermissionEEnum, BasePermission.FULL_MASK);

    // Create resource
    createResource(eNS_URI);
  }

} //MyDsl2PackageImpl
