-
Notifications
You must be signed in to change notification settings - Fork 85
/
ActivityExchangeImpl.java
151 lines (122 loc) · 4.67 KB
/
ActivityExchangeImpl.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*******************************************************************************
* Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Thales - initial API and implementation
*******************************************************************************/
package org.polarsys.capella.common.data.activity.impl;
import java.util.Collection;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.EcoreEList;
import org.polarsys.capella.common.data.activity.ActivityEdge;
import org.polarsys.capella.common.data.activity.ActivityExchange;
import org.polarsys.capella.common.data.activity.ActivityPackage;
import org.polarsys.capella.common.data.modellingcore.impl.AbstractInformationFlowImpl;
import org.polarsys.capella.common.model.helpers.IHelper;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Exchange</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.polarsys.capella.common.data.activity.impl.ActivityExchangeImpl#getRealizingActivityFlows <em>Realizing Activity Flows</em>}</li>
* </ul>
*
* @generated
*/
public abstract class ActivityExchangeImpl extends AbstractInformationFlowImpl implements ActivityExchange {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ActivityExchangeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ActivityPackage.Literals.ACTIVITY_EXCHANGE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<ActivityEdge> getRealizingActivityFlows() {
Object result = null;
// Helper that can get value for current feature.
IHelper helper = null;
// If current object is adaptable, ask it to get its IHelper.
if (this instanceof IAdaptable) {
helper = (IHelper) ((IAdaptable) this).getAdapter(IHelper.class);
}
if (null == helper) {
// No helper found yet.
// Ask the platform to get the adapter 'IHelper.class' for current object.
IAdapterManager adapterManager = Platform.getAdapterManager();
helper = (IHelper) adapterManager.getAdapter(this, IHelper.class);
}
if (null == helper) {
EPackage package_l = eClass().getEPackage();
// Get the root package of the owner package.
EPackage rootPackage = org.polarsys.capella.common.mdsofa.common.helper.EcoreHelper.getRootPackage(package_l);
throw new org.polarsys.capella.common.model.helpers.HelperNotFoundException("No helper retrieved for nsURI " + rootPackage.getNsURI()); //$NON-NLS-1$
}
// A helper is found, let's use it.
EAnnotation annotation = ActivityPackage.Literals.ACTIVITY_EXCHANGE__REALIZING_ACTIVITY_FLOWS.getEAnnotation(org.polarsys.capella.common.model.helpers.IModelConstants.HELPER_ANNOTATION_SOURCE);
result = helper.getValue(this, ActivityPackage.Literals.ACTIVITY_EXCHANGE__REALIZING_ACTIVITY_FLOWS, annotation);
try {
@SuppressWarnings("unchecked")
Collection<ActivityEdge> resultAsList = (Collection<ActivityEdge>) result;
return new EcoreEList.UnmodifiableEList<ActivityEdge>(this, ActivityPackage.Literals.ACTIVITY_EXCHANGE__REALIZING_ACTIVITY_FLOWS, resultAsList.size(), resultAsList.toArray());
} catch (ClassCastException exception) {
exception.printStackTrace();
return org.eclipse.emf.common.util.ECollections.emptyEList();
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ActivityPackage.ACTIVITY_EXCHANGE__REALIZING_ACTIVITY_FLOWS:
return getRealizingActivityFlows();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ActivityPackage.ACTIVITY_EXCHANGE__REALIZING_ACTIVITY_FLOWS:
return !getRealizingActivityFlows().isEmpty();
}
return super.eIsSet(featureID);
}
} //ActivityExchangeImpl