[EMF/Genmodel] Filtering right instances in generated editor [message #648487] |
Thu, 13 January 2011 07:53 |
Vladimir Messages: 6 Registered: January 2011 |
Junior Member |
|
|
In EMF I modeled some metamodel of a data model. M y classes are: Table, KeyColumn and ExportLink. Table class has KeyColumns and ExportLink has KeyColumns as well. But ExportLink should have only instances of Table's KeyColumns. My problem is filtering Table's K eyColumns in generated editor. Multiline popup is populated by KeyColumn instances belonging to all Table instances and I am not able to filter th em efficiently.
My questions are:
1. What is the best (modeling or configuring) practice to solve this problem?
2. How can I simply transform my existing model instances in case of bad metamodel?
Thanks,
Vladimir
[Updated on: Thu, 13 January 2011 07:56] Report message to a moderator
|
|
|
|
|
Re: [EMF/Genmodel] Filtering right instances in generated editor [message #648755 is a reply to message #648749] |
Fri, 14 January 2011 12:41 |
Vladimir Messages: 6 Registered: January 2011 |
Junior Member |
|
|
> But OCL constraint is generated in a comment.
Sorry, I oversaw generated OCL constraints in the code:
protected void createOrgAnnotations() {
String source = "org.eclipse.ocl.ecore.OCL";
addAnnotation
(getExportLink_ExportedKeys(),
source,
new String[] {
"derivation", "if (self.relationship.master.oclIsUndefined()) then OrderedSet{} else self.relationship.master.keyColumns->asOrderedSet() endif"
});
addAnnotation
(getExportLink_ExportedFields(),
source,
new String[] {
"derivation", "if (self.relationship.master.oclIsUndefined()) then OrderedSet{} else self.relationship.master.columns->asOrderedSet() endif"
});
addAnnotation
(getImportLink_ForeignKeys(),
source,
new String[] {
"derivation", "if (self.relationship.detail.oclIsUndefined()) then OrderedSet{} else self.relationship.detail.keyColumns->asOrderedSet() endif"
});
addAnnotation
(getImportLink_ForeignFields(),
source,
new String[] {
"derivation", "if (self.relationship.detail.oclIsUndefined()) then OrderedSet{} else self.relationship.detail.columns->asOrderedSet() endif"
});
}
|
|
|
|
|
|
|
Re: [EMF/Genmodel] Filtering right instances in generated editor [message #648851 is a reply to message #648823] |
Fri, 14 January 2011 17:52 |
Vladimir Messages: 6 Registered: January 2011 |
Junior Member |
|
|
> I'm not sure I understand how you'd expect to use it for filtering; the
> property descriptors search the whole instance for valid candidates
> (objects of the right type), so I don't see how any form of setting
> delegate would impact that search. You might use OCL to implement a
> constraint...
Ed,
that was only an idea, rather my wish. If you type something like that
"self.relationship.master.keyColumns->asOrderedSet()"
in interactive OCL console, you get right collection, not constraint. It would be nice if OCL expression could supersede a relation. Maybe an operation instead of a relation is better for such feature.
Vladimir
[Updated on: Fri, 14 January 2011 17:56] Report message to a moderator
|
|
|
Re: [EMF/Genmodel] Filtering right instances in generated editor [message #648853 is a reply to message #648846] |
Fri, 14 January 2011 17:43 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Vladimir,
Sorry, I don't mean to insult you. I just wonder why I see it so
often. There are two obvious choices for casting. Cast to the
interface or cast to the implementation class. I would expect the
latter to be an uncompelling choice (the name isn't so pretty) so I
wonder why folks make the choice so often. I'm just very curious. I
imagine if the bundle didn't export the impl package folks wouldn't make
that mistake (but then their model wouldn't be extensible).
Vladimir wrote:
>> What compels you to use the Impl classes rather than the interfaces when
> casting?
>
> What compels me? Desperation? :)
> No, seriously: that snippet was only very working version. I've
> already corrected it. Don't crucify me :)
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04100 seconds