/** * Copyright (c) 2011 - 2015, Lunifera GmbH (Gross Enzersdorf), Loetz KG (Heidelberg) * 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: * Florian Pirchner - Initial implementation */ package org.lunifera.dsl.semantic.dto.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.lunifera.dsl.semantic.dto.LDto; import org.lunifera.dsl.semantic.dto.LunDtoPackage; public class LDtoImplCustom extends LDtoImpl { /** * Overrides super type to ensure bidirectional proxy resolving */ @Override public LDto getSuperType() { if (superType != null && superType.eIsProxy()) { InternalEObject oldSuperType = (InternalEObject) superType; LDto oldSuperEntity = (LDto) oldSuperType; superType = (LDto) eResolveProxy(oldSuperType); if (superType != oldSuperType) { // ATENTION: inverse add must be called since bidirectional // references uses proxy resolution for lazy linking. And the // sub_types added to proxy must be added to new superType for (LDto subType : oldSuperEntity.getSubTypes()) { ((InternalEObject) superType).eInverseAdd( (InternalEObject) subType, LunDtoPackage.LDTO__SUB_TYPES, LDto.class, null); } if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, LunDtoPackage.LDTO__SUPER_TYPE, oldSuperType, superType)); } } return superType; } }