Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: a7da783ece4d5e8559fcaecceead31a586bdfca2 (plain) (blame)
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
/*****************************************************************************
 * Copyright (c) 2012 CEA LIST.
 *
 *    
 * 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:
 *  Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.uml.profilefacet.generation.factory;

import java.util.ArrayList;
import java.util.Collection;

import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.emf.facet.infra.query.ModelQuery;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.infra.emf.facet.queries.parametricquery.EStructuralFeatureArgument;
import org.eclipse.papyrus.infra.emf.facet.queries.parametricquery.ParametricQuery;
import org.eclipse.papyrus.infra.emf.facet.queries.parametricquery.ParametricqueryFactory;
import org.eclipse.papyrus.infra.emf.facet.queries.parametricquery.StringArgument;
import org.eclipse.papyrus.uml.profilefacet.generation.Activator;
import org.eclipse.papyrus.uml.profilefacet.generation.messages.Messages;
import org.eclipse.papyrus.uml.profilefacet.metamodel.profilefacet.ProfileFacetFactory;
import org.eclipse.papyrus.uml.profilefacet.metamodel.profilefacet.ProfileFacetSet;
import org.eclipse.papyrus.uml.profilefacet.metamodel.profilefacet.StereotypeFacet;
import org.eclipse.papyrus.uml.profilefacet.metamodel.profilefacet.StereotypePropertyFacetAttribute;
import org.eclipse.papyrus.uml.profilefacet.metamodel.profilefacet.StereotypePropertyFacetReference;
import org.eclipse.papyrus.uml.profilefacet.queries.registry.QueryRegistry;
import org.eclipse.papyrus.uml.profilefacet.utils.ArgumentUtils;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.PackageableElement;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.Type;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.Package;
/**
 * 
 * This factory allows to generate a ProfileEFacetSet from a UML Profile
 * 
 */
public class ProfileFacetGenericFactory {

	/** the string base_ used to identify stereotype properties */
	private static final String BASE_ = "base_"; //$NON-NLS-1$

	/** the string used for UML boolean */
	private static final String UML_BOOLEAN = "Boolean"; //$NON-NLS-1$

	/** the string used for UML integer */
	private static final String UML_INTEGER = "Integer"; //$NON-NLS-1$

	/** the string used for UML string */
	private static final String UML_STRING = "String"; //$NON-NLS-1$

	/** the string used for uml real */
	private static final String UML_REAL = "Real"; //$NON-NLS-1$

	/** the string used for uml unlimited natural */
	private static final String UML_UNLIMITED_NATURAL = "UnlimitedNatural"; //$NON-NLS-1$

	/** the facetOperation registry */
	private final QueryRegistry registry;

	/** String for the get query description */
	public static final String GET_QUERY_DESCRIPTION = Messages.ProfileFacetGenericFactory_GetterForStereotypeProperty;

	/** String for the set query description */
	public static final String SET_QUERY_DESCRIPTION = Messages.ProfileFacetGenericFactory_SetterForStereotypeProperty;

	/**
	 * 
	 * Constructor.
	 * 
	 * @param resourceSet
	 *        the resourceSet which will be used to find required FacetOperation for Getter and Setter
	 */
	public ProfileFacetGenericFactory() {
		this.registry = new QueryRegistry();
	}


	/**
	 * 
	 * @param profile
	 * @return
	 *         the ProfileFacetSet for this profile or <code>null</code> if the profile argument doesn't contains steretoypes with properties
	 */
	public ProfileFacetSet createProfileFacetSet(final Package profile) {
		final ProfileFacetSet set = ProfileFacetFactory.eINSTANCE.createProfileFacetSet();
		set.setName(profile.getName());
		set.setProfileQualifiedName(profile.getQualifiedName());
		set.setNsPrefix(profile.getName());
		set.setNsURI("http://www.eclipse.org/papyrus/profilefacet/" + profile.getQualifiedName()); //$NON-NLS-1$
		set.setExtendedPackage(UMLPackage.eINSTANCE);
		final XMIResource res = (XMIResource)profile.eResource();
		final String XMI_ID = res.getID(profile);
		set.setRepresentedElement_XMI_ID(XMI_ID);
		for(final PackageableElement packagedElement : profile.getPackagedElements()) {
			if(packagedElement instanceof Package) {
				final ProfileFacetSet subProfile = createProfileFacetSet((Package)packagedElement);
				//We ignore empty facetSet
				if(subProfile != null && (subProfile.getStereotypeFacets().size() != 0 || subProfile.getSubProfileFacetSet().size() != 0)) {
					set.getESubpackages().add(subProfile);
				}
			} else if(packagedElement instanceof Stereotype) {
				final StereotypeFacet stereotypeFacet = createFacet((Stereotype)packagedElement);

				//we ignore stereotypes without properties

				if(stereotypeFacet.getStereotypePropertyElements().size() != 0) {
					set.getEClassifiers().add(stereotypeFacet);
				}
			}
		}

		if(set.getStereotypeFacets().size() != 0 || set.getSubProfileFacetSet().size() != 0) {
			return set;
		}

		return null;

	}

	/**
	 * 
	 * @param stereotype
	 *        the stereotype for which we want to create the facet
	 * @return
	 *         the created facet for this stereotype or <code>null</code> if the stereotype doesn't contain property
	 */
	public StereotypeFacet createFacet(final Stereotype stereotype) {
		final StereotypeFacet facet = ProfileFacetFactory.eINSTANCE.createStereotypeFacet();
		final String stereotypeQualifiedName = stereotype.getQualifiedName();
		facet.setStereotypeQualifiedName(stereotypeQualifiedName);
		facet.setName(stereotype.getName());
		facet.getESuperTypes().add(UMLPackage.eINSTANCE.getElement());
		final XMIResource res = (XMIResource)stereotype.eResource();
		final String XMI_ID = res.getID(stereotype);
		facet.setRepresentedElement_XMI_ID(XMI_ID);
		final Collection<String> ignoredPropertyName = new ArrayList<String>();

		for(final Class extendedMetaclassName : stereotype.getAllExtendedMetaclasses()) {
			ignoredPropertyName.add(BASE_ + extendedMetaclassName.getName());
		}

		//		for(final Property attribute : stereotype.getAllAttributes()) { //in this case we duplicate facet properties for the same attribute
		for(final Property attribute : stereotype.getAttributes()) {
			if(ignoredPropertyName.contains(attribute.getName())) {
				continue;
			}
			if(attribute.getType() instanceof DataType) {
				final StereotypePropertyFacetAttribute attr = createFacetAttribute(attribute);
				if(attr != null) {
					facet.getEStructuralFeatures().add(attr);
				}
			} else if(attribute.getType() instanceof EObject) {
				final StereotypePropertyFacetReference ref = createFacetReference(attribute);
				if(ref != null) {
					facet.getEStructuralFeatures().add(ref);
				}
			}
		}


		//set the condition query (test on the appied stereotype)
		final ModelQuery query = getQueryForIsAppliedStereotype(stereotypeQualifiedName);
		facet.setConditionQuery(query);
		return facet;
	}

	/**
	 * 
	 * @param stereotypeQualifiedName
	 *        the stereotype qualified name
	 * @return
	 *         the query to test if the required stereotype is applied on the element
	 */
	protected ModelQuery getQueryForIsAppliedStereotype(final String stereotypeQualifiedName) {
		//1. create the returned query
		final ParametricQuery query = ParametricqueryFactory.eINSTANCE.createParametricQuery();
		query.setName("IsApplied_" + stereotypeQualifiedName + "_query"); //$NON-NLS-1$ //$NON-NLS-2$
		query.setLowerBound(0);
		query.setUpperBound(1);
		query.setReturnType(EcorePackage.eINSTANCE.getEBoolean());

		//2.create the argument for this query
		final StringArgument arg = ParametricqueryFactory.eINSTANCE.createStringArgument();
		arg.setArgumentName(ArgumentUtils.STEREOTYPE_QUALIFIED_NAME);
		arg.setValue(stereotypeQualifiedName);
		query.getArguments().add(arg);

		//3.set tge called query
		final ModelQuery testStereotypeCalledQuery = this.registry.getModelQuery(QueryRegistry.IS_APPLIED_REQUIRED_STEREOTYPE);
		query.setCalledQuery(testStereotypeCalledQuery);
		query.setDescription(NLS.bind("Test if the stereotype {0} or one of its specialization is applied on the element", stereotypeQualifiedName));
		return query;
	}

	/**
	 * 
	 * @param property
	 *        the property used to create the FacetReference
	 * @return
	 *         the created FacetReference for this property
	 */
	public StereotypePropertyFacetReference createFacetReference(final Property property) {
		final StereotypePropertyFacetReference facetReference = ProfileFacetFactory.eINSTANCE.createStereotypePropertyFacetReference();
		facetReference.setIsDerived(property.isDerived());
		facetReference.setChangeable(!property.isReadOnly());
		facetReference.setDerived(true);
		facetReference.setPropertyQualifiedName(property.getQualifiedName());
		final XMIResource res = (XMIResource)property.eResource();
		final String XMI_ID = res.getID(property);
		facetReference.setRepresentedElement_XMI_ID(XMI_ID);
		facetReference.setName(property.getName());
		final Type type = property.getType();
		final EClassifier eType = EcorePackage.eINSTANCE.getEObject();


		final int upperBound = property.upperBound();
		facetReference.setLowerBound(property.getLower());
		facetReference.setUpperBound(property.getUpper());

		ModelQuery getCalledQuery = null;
		ModelQuery setCalledQuery = null;

		//EObject reference
		if(type instanceof Element) {

			if(upperBound == -1 || upperBound > 1) {
				getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_EOBJECT_MULTI_REFERENCE_OPERATION_ID);
				setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_EOBJECT_MULTI_REFERENCE_OPERATION_ID);
			} else {
				getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_EOBJECT_SINGLE_REFERENCE_OPERATION_ID);
				setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_EOBJECT_SINGLE_REFERENCE_OPERATION_ID);
			}

		} else {
			return null;
		}
		//1. we create the getValueQuery
		ParametricQuery getQuery = getQuery = ParametricqueryFactory.eINSTANCE.createParametricQuery();
		getQuery.setName("get_" + property.getQualifiedName() + "_value"); //$NON-NLS-1$ //$NON-NLS-2$
		getQuery.setDescription(NLS.bind(GET_QUERY_DESCRIPTION, property.getQualifiedName()));

		getQuery.setLowerBound(facetReference.getLowerBound());
		getQuery.setUpperBound(facetReference.getUpperBound());
		getQuery.setReturnType(eType);

		getQuery.setCalledQuery(getCalledQuery);
		//1.bis we create the argument
		final EStructuralFeatureArgument getArgument = ParametricqueryFactory.eINSTANCE.createEStructuralFeatureArgument();
		getArgument.setArgumentName(ArgumentUtils.EDITED_FEATURE);
		getArgument.setValue(facetReference);
		getQuery.getArguments().add(getArgument);


		//2. we create the setValueQuery
		ParametricQuery setQuery = ParametricqueryFactory.eINSTANCE.createParametricQuery();
		setQuery.setName("set_" + property.getQualifiedName() + "_value"); //$NON-NLS-1$ //$NON-NLS-2$
		setQuery.setDescription(NLS.bind(SET_QUERY_DESCRIPTION, property.getQualifiedName()));
		setQuery.setLowerBound(0);
		setQuery.setUpperBound(1);
		setQuery.setReturnType(eType);
		setQuery.setCalledQuery(setCalledQuery);
		//2.bis we create the argument
		final EStructuralFeatureArgument setArgument = ParametricqueryFactory.eINSTANCE.createEStructuralFeatureArgument();
		setArgument.setArgumentName(ArgumentUtils.EDITED_FEATURE);
		setArgument.setValue(facetReference);
		setQuery.getArguments().add(setArgument);

		facetReference.setEType(eType);
		facetReference.setValueQuery(getQuery);
		facetReference.setSetQuery(setQuery);
		if(facetReference.isChangeable()  && upperBound==1){//unset is valable only for monovalued properties
			facetReference.setUnsettable(true);
		}
		return facetReference;
	}

	/**
	 * 
	 * @param property
	 *        the property used to create the FacetAttribute
	 * @return
	 *         the created FacetAttribute for this property
	 */
	public StereotypePropertyFacetAttribute createFacetAttribute(final Property property) {
		final Type type = property.getType();
		EClassifier eType = null;
		final int upperBound = property.upperBound();
		final StereotypePropertyFacetAttribute facetAttribute = ProfileFacetFactory.eINSTANCE.createStereotypePropertyFacetAttribute();
		facetAttribute.setIsDerived(property.isDerived());
		facetAttribute.setChangeable(!property.isReadOnly());
		facetAttribute.setDerived(true);

		facetAttribute.setPropertyQualifiedName(property.getQualifiedName());
		final XMIResource res = (XMIResource)property.eResource();
		final String XMI_ID = res.getID(property);
		facetAttribute.setRepresentedElement_XMI_ID(XMI_ID);

		facetAttribute.setName(property.getName());
		facetAttribute.setLowerBound(property.getLower());
		facetAttribute.setUpperBound(property.getUpper());
		ModelQuery getCalledQuery = null;
		ModelQuery setCalledQuery = null;
		//UML primitive type
		if(type instanceof PrimitiveType) {
			final PrimitiveType pType = (PrimitiveType)type;
			final String name = pType.getName();

			if(UML_BOOLEAN.equals(name)) {
				eType = EcorePackage.eINSTANCE.getEBoolean();
				if(upperBound == -1 || upperBound > 1) {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_BOOLEAN_MULTI_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_BOOLEAN_MULTI_VALUE_OPERATION_ID);
				} else {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_BOOLEAN_SINGLE_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_BOOLEAN_SINGLE_VALUE_OPERATION_ID);
				}
			} else if(UML_INTEGER.equals(name)) {
				eType = EcorePackage.eINSTANCE.getEInt();
				if(upperBound == -1 || upperBound > 1) {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_INTEGER_MULTI_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_INTEGER_MULTI_VALUE_OPERATION_ID);
				} else {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_INTEGER_SINGLE_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_INTEGER_SINGLE_VALUE_OPERATION_ID);
				}

			} else if(UML_REAL.equals(name)) {
				eType = EcorePackage.eINSTANCE.getEDouble();
				if(upperBound == -1 || upperBound > 1) {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_REAL_MULTI_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_REAL_MULTI_VALUE_OPERATION_ID);
				} else {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_REAL_SINGLE_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_REAL_SINGLE_VALUE_OPERATION_ID);
				}

			} else if(UML_STRING.equals(name)) {
				eType = EcorePackage.eINSTANCE.getEString();
				if(upperBound == -1 || upperBound > 1) {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_STRING_MULTI_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_STRING_MULTI_VALUE_OPERATION_ID);
				} else {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_STRING_SINGLE_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_STRING_SINGLE_VALUE_OPERATION_ID);
				}

			} else if(UML_UNLIMITED_NATURAL.equals(name)) {
				eType = EcorePackage.eINSTANCE.getEInt();
				if(upperBound == -1 || upperBound > 1) {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_UNLIMITED_NATURAL_MULTI_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_UNLIMITED_NATURAL_MULTI_VALUE_OPERATION_ID);
				} else {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_UNLIMITED_NATURAL_SINGLE_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_UNLIMITED_NATURAL_SINGLE_VALUE_OPERATION_ID);
				}

			}

		} else if(type instanceof Enumeration) {
			if(upperBound == -1 || upperBound > 1) {
				eType = UMLPackage.eINSTANCE.getEnumerationLiteral();
				getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_UML_ENUMERATION_MULTI_VALUE_OPERATION_ID);
				setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_UML_ENUMERATION_MULTI_VALUE_OPERATION_ID);
			} else {
				eType = UMLPackage.eINSTANCE.getEnumerationLiteral();
				getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_UML_ENUMERATION_SINGLE_VALUE_OPERATION_ID);
				setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_UML_ENUMERATION_SINGLE_VALUE_OPERATION_ID);
			}

		}

		if(eType == null) {
			if(type instanceof PrimitiveType) {
				eType = EcorePackage.eINSTANCE.getEString();
				if(upperBound == -1 || upperBound > 1) {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_PRIMITIVE_TYPE_MULTI_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_PRIMITIVE_TYPE_MULTI_VALUE_OPERATION_ID);
				} else {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_PRIMITIVE_TYPE_SINGLE_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_PRIMITIVE_TYPE_SINGLE_VALUE_OPERATION_ID);
				}
			} else if(type instanceof DataType) {
				eType = EcorePackage.eINSTANCE.getEString();
				if(upperBound == -1 || upperBound > 1) {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_DATATYPE_MULTI_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_DATATYPE_MULTI_VALUE_OPERATION_ID);
				} else {
					getCalledQuery = this.registry.getModelQuery(QueryRegistry.GET_DATATYPE_SINGLE_VALUE_OPERATION_ID);
					setCalledQuery = this.registry.getModelQuery(QueryRegistry.SET_DATATYPE_SINGLE_VALUE_OPERATION_ID);
				}
			} else {
				Activator.log.warn(NLS.bind(Messages.ProfileFacetGenericFactory_TheTypeIsNotManaged, type));
				return null;

			}
		}

		facetAttribute.setEType(eType);

		//1. we create the getValueQuery
		final ParametricQuery getQuery = ParametricqueryFactory.eINSTANCE.createParametricQuery();
		getQuery.setCalledQuery(getCalledQuery);
		getQuery.setName("get_" + property.getQualifiedName() + "_value"); //$NON-NLS-1$ //$NON-NLS-2$
		getQuery.setDescription(NLS.bind(GET_QUERY_DESCRIPTION, property.getQualifiedName()));
		getQuery.setLowerBound(facetAttribute.getLowerBound());
		getQuery.setUpperBound(facetAttribute.getUpperBound());
		getQuery.setReturnType(eType);

		//1.bis we prepare the argument
		final EStructuralFeatureArgument getArgument = ParametricqueryFactory.eINSTANCE.createEStructuralFeatureArgument();
		getArgument.setValue(facetAttribute);
		getArgument.setArgumentName(ArgumentUtils.EDITED_FEATURE);
		getQuery.getArguments().add(getArgument);

		facetAttribute.setValueQuery(getQuery);

		//2. we create the setValueQuery
		final ParametricQuery setQuery = ParametricqueryFactory.eINSTANCE.createParametricQuery();
		setQuery.setCalledQuery(setCalledQuery);
		setQuery.setName("set_" + property.getQualifiedName() + "_value"); //$NON-NLS-1$ //$NON-NLS-2$
		setQuery.setDescription(NLS.bind(SET_QUERY_DESCRIPTION, property.getQualifiedName()));
		setQuery.setLowerBound(0);
		setQuery.setUpperBound(1);
		setQuery.setReturnType(eType);

		//2.bis we prepare the argument
		final EStructuralFeatureArgument setArgument = ParametricqueryFactory.eINSTANCE.createEStructuralFeatureArgument();
		setArgument.setValue(facetAttribute);
		setArgument.setArgumentName(ArgumentUtils.EDITED_FEATURE);
		setQuery.getArguments().add(setArgument);

		facetAttribute.setSetQuery(setQuery);
		return facetAttribute;
	}

}

Back to the top