Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Initializing a containment list from the containing object?
Initializing a containment list from the containing object? [message #425383] Sun, 23 November 2008 18:34 Go to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
In my workflow model, WorkflowUnitOfWork has a containment list of
WorkflowParameter. Consider the use case where a designer extends
WorkflowUnitOfWork to perform a domain specific task that is
parameterized with a fixed set of parameters. Is there a good way to
initialize the parameter list from the extended class?

I can't initialize the parameter list in the constructor since I'll get
duplicate parameters when the model is de-serialized. I thought about
making the parameters transient, but that doesn't work because the
parameters are used (serialized references) by the WorkflowContext, and
therefore must have a container. Are there any hooks I can use to
determine that the instance is being constructed because it's loading
from serialized form vs being constructed from nothing? Any other
obvious solution to this problem?

One solution is to require the designer to specify the parameter list
using the generated editor and have the code make assumptions about the
order of the parameter list to locate a specific parameter. I really
don't like this solution.

Bryan
Re: Initializing a containment list from the containing object? [message #425384 is a reply to message #425383] Sun, 23 November 2008 19:15 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6476
Registered: July 2009
Senior Member
Bryan,

Because of the expected problem during deserialization it is not
possible to let a model implicitely create containment structures. Well,
you could inspect the stack to see if "you are in a load operation". But
this looks hacky. In general an EFactory is expected to create bare objects.

The only way is to add custom create methods to the factory which can be
used by the application, as you already indicated.

Cheers
/Eike

----
http://thegordian.blogspot.com



Bryan Hunt schrieb:
> In my workflow model, WorkflowUnitOfWork has a containment list of
> WorkflowParameter. Consider the use case where a designer extends
> WorkflowUnitOfWork to perform a domain specific task that is
> parameterized with a fixed set of parameters. Is there a good way to
> initialize the parameter list from the extended class?
>
> I can't initialize the parameter list in the constructor since I'll
> get duplicate parameters when the model is de-serialized. I thought
> about making the parameters transient, but that doesn't work because
> the parameters are used (serialized references) by the
> WorkflowContext, and therefore must have a container. Are there any
> hooks I can use to determine that the instance is being constructed
> because it's loading from serialized form vs being constructed from
> nothing? Any other obvious solution to this problem?
>
> One solution is to require the designer to specify the parameter list
> using the generated editor and have the code make assumptions about
> the order of the parameter list to locate a specific parameter. I
> really don't like this solution.
>
> Bryan
>


Previous Topic:Show Link under destination and source node
Next Topic:non-compact xml serialization
Goto Forum:
  


Current Time: Mon Feb 17 22:17:18 GMT 2020

Powered by FUDForum. Page generated in 0.01550 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top