blob: 5c44c3c6b11b39e56183ab11c7165e296d63f8c5 [file] [log] [blame]
/**
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
package org.eclipse.osbp.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.eclipse.osbp.dsl.semantic.dto.LDto;
import org.eclipse.osbp.dsl.semantic.dto.OSBPDtoPackage;
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,
OSBPDtoPackage.LDTO__SUB_TYPES, LDto.class, null);
}
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE,
OSBPDtoPackage.LDTO__SUPER_TYPE, oldSuperType,
superType));
}
}
return superType;
}
}