Home » Modeling » UML2 » Coupling operations with activities, state machines and actions
|
Re: Coupling operations with activities, state machines and actions [message #477807 is a reply to message #477806] |
Fri, 10 October 2008 16:24 |
Rafael Chaves Messages: 362 Registered: July 2009 |
Senior Member |
|
|
Nick,
Operations can have one or more behaviors (BehavioralFeature#method,
opposite is Behavior#specification). An activity is a kind of behavior.
> For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an activity
> diagram and a matching java method.
What section of the spec are you referring to?
Cheers,
Rafael
Nick Betteridge wrote:
> Hi
>
> I'm new to uml2 and modeling, so I hope I don't sound as though I've
> really missed the point.
>
> I'm trying to understand how to map activities and state machines to
> operations in uml2. I've gone through the tutorials on creating models,
> packages, classes, attributes and operations. Now I would like to take
> this further and create activities and state machines (with the states
> containing actions).
>
> Does anyone know of a simple tutorial which demonstrates how to do this
> with uml2?
>
> For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an activity
> diagram and a matching java method. I really would like to create this
> model in uml2 and then parse though the model and create the source.
>
> Am I on the right track here?!
>
> Thanks in advance for any input.
>
> Nick
|
|
|
Re: Coupling operations with activities, state machines and actions [message #477810 is a reply to message #477807] |
Fri, 10 October 2008 19:55 |
Rafael Chaves Messages: 362 Registered: July 2009 |
Senior Member |
|
|
Btw, a StateMachine is also a Behavior.
Rafael Chaves wrote:
> Nick,
>
> Operations can have one or more behaviors (BehavioralFeature#method,
> opposite is Behavior#specification). An activity is a kind of behavior.
>
> > For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an activity
> > diagram and a matching java method.
>
> What section of the spec are you referring to?
>
> Cheers,
>
> Rafael
>
> Nick Betteridge wrote:
>> Hi
>>
>> I'm new to uml2 and modeling, so I hope I don't sound as though I've
>> really missed the point.
>>
>> I'm trying to understand how to map activities and state machines to
>> operations in uml2. I've gone through the tutorials on creating
>> models, packages, classes, attributes and operations. Now I would like
>> to take this further and create activities and state machines (with
>> the states containing actions).
>>
>> Does anyone know of a simple tutorial which demonstrates how to do
>> this with uml2?
>>
>> For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an
>> activity diagram and a matching java method. I really would like to
>> create this model in uml2 and then parse though the model and create
>> the source.
>>
>> Am I on the right track here?!
>>
>> Thanks in advance for any input.
>>
>> Nick
|
|
|
Re: Coupling operations with activities, state machines and actions [message #477816 is a reply to message #477807] |
Mon, 13 October 2008 16:44 |
Nick Betteridge Messages: 6 Registered: July 2009 |
Junior Member |
|
|
Hi Rafael
Thanks for replying. The section of the spec (Concrete Syntax for a UML
Action Language) was the appendix - a simple java method and the
corresponding activity diagram. I can see how to generate the class and
the operation, and also generate the activity with CallBehaviourActions.
So, from what you are saying, all I have to do is create the activity
and do a getMethods().add()?
ie:
class ListUtils {
boolean sameSizeLists(List listOne, List listTwo) {
if (listOne.size() == listTwo.size())
return true;
return false;
}
}
Class class = package_.createOwnedClass("ListUtils", isAbstract);
Operation op = class.createOwnedOperation("sameSizeLists", pNames,
pTypes, returnType);
Activity activity = (Activity)
class.createOwnedBehavior("sameSizeLists",
UMLPackage.eINSTANCE.getActivity());
CallBehaviorAction cba0 = (CallBehaviorAction)
activity.createNode(null,UMLPackage.eINSTANCE.getCallBehavio rAction());
.... add actions, nodes etc
op.getMethods().add(activity);
..... and then when it comes to traversing the model (for code
generation), look at the methods assigned to the operation and choose
the most appropriate?
Thanks again
Cheers
Nick
Rafael Chaves wrote:
> Nick,
>
> Operations can have one or more behaviors (BehavioralFeature#method,
> opposite is Behavior#specification). An activity is a kind of behavior.
>
> > For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an activity
> > diagram and a matching java method.
>
> What section of the spec are you referring to?
>
> Cheers,
>
> Rafael
>
> Nick Betteridge wrote:
>> Hi
>>
>> I'm new to uml2 and modeling, so I hope I don't sound as though I've
>> really missed the point.
>>
>> I'm trying to understand how to map activities and state machines to
>> operations in uml2. I've gone through the tutorials on creating
>> models, packages, classes, attributes and operations. Now I would like
>> to take this further and create activities and state machines (with
>> the states containing actions).
>>
>> Does anyone know of a simple tutorial which demonstrates how to do
>> this with uml2?
>>
>> For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an
>> activity diagram and a matching java method. I really would like to
>> create this model in uml2 and then parse though the model and create
>> the source.
>>
>> Am I on the right track here?!
>>
>> Thanks in advance for any input.
>>
>> Nick
|
|
|
Re: Coupling operations with activities, state machines and actions [message #477817 is a reply to message #477816] |
Mon, 13 October 2008 17:58 |
Rafael Chaves Messages: 362 Registered: July 2009 |
Senior Member |
|
|
Hi Nick,
> So, from what you are saying, all I have to do is create the activity
> and do a getMethods().add()?
>
> op.getMethods().add(activity);
What I actually do is activity.setSpecification(op), but it doesn't
matter as Behavior#specification and BehavioralFeature#methods are
opposite ends.
> .... and then when it comes to traversing the model (for code
> generation), look at the methods assigned to the operation and choose
> the most appropriate?
I really don't understand the use case for operations with multiple
methods. If it doesn't make sense in your case, you could enforce a rule
that did not allow that. I have to somehow constrain UML features once
in a while, as some of them seem unnecessary for the concrete case at
hand, or have to choose one possible interpretation or even invent
something because the specification is vague/incomplete.
Another thing you should do is to create parameter nodes, one for each
parameter in the 'specification' (i.e. your operation) of the activity
being built. They provide the means for data getting in and out of your
activity.
Good luck,
Rafael
Nick Betteridge wrote:
> Hi Rafael
>
> Thanks for replying. The section of the spec (Concrete Syntax for a UML
> Action Language) was the appendix - a simple java method and the
> corresponding activity diagram. I can see how to generate the class and
> the operation, and also generate the activity with CallBehaviourActions.
> So, from what you are saying, all I have to do is create the activity
> and do a getMethods().add()?
>
> ie:
>
> class ListUtils {
> boolean sameSizeLists(List listOne, List listTwo) {
> if (listOne.size() == listTwo.size())
> return true;
> return false;
> }
> }
>
> Class class = package_.createOwnedClass("ListUtils", isAbstract);
>
> Operation op = class.createOwnedOperation("sameSizeLists", pNames,
> pTypes, returnType);
>
> Activity activity = (Activity)
> class.createOwnedBehavior("sameSizeLists",
> UMLPackage.eINSTANCE.getActivity());
>
> CallBehaviorAction cba0 = (CallBehaviorAction)
> activity.createNode(null,UMLPackage.eINSTANCE.getCallBehavio rAction());
>
> ... add actions, nodes etc
>
> op.getMethods().add(activity);
>
>
> .... and then when it comes to traversing the model (for code
> generation), look at the methods assigned to the operation and choose
> the most appropriate?
>
>
> Thanks again
>
> Cheers
>
> Nick
>
>
>
> Rafael Chaves wrote:
>> Nick,
>>
>> Operations can have one or more behaviors (BehavioralFeature#method,
>> opposite is Behavior#specification). An activity is a kind of behavior.
>>
>> > For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an
>> activity
>> > diagram and a matching java method.
>>
>> What section of the spec are you referring to?
>>
>> Cheers,
>>
>> Rafael
>>
>> Nick Betteridge wrote:
>>> Hi
>>>
>>> I'm new to uml2 and modeling, so I hope I don't sound as though I've
>>> really missed the point.
>>>
>>> I'm trying to understand how to map activities and state machines to
>>> operations in uml2. I've gone through the tutorials on creating
>>> models, packages, classes, attributes and operations. Now I would
>>> like to take this further and create activities and state machines
>>> (with the states containing actions).
>>>
>>> Does anyone know of a simple tutorial which demonstrates how to do
>>> this with uml2?
>>>
>>> For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an
>>> activity diagram and a matching java method. I really would like to
>>> create this model in uml2 and then parse though the model and create
>>> the source.
>>>
>>> Am I on the right track here?!
>>>
>>> Thanks in advance for any input.
>>>
>>> Nick
|
|
|
Re: Coupling operations with activities, state machines and actions [message #627005 is a reply to message #477806] |
Fri, 10 October 2008 16:24 |
Rafael Chaves Messages: 362 Registered: July 2009 |
Senior Member |
|
|
Nick,
Operations can have one or more behaviors (BehavioralFeature#method,
opposite is Behavior#specification). An activity is a kind of behavior.
> For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an activity
> diagram and a matching java method.
What section of the spec are you referring to?
Cheers,
Rafael
Nick Betteridge wrote:
> Hi
>
> I'm new to uml2 and modeling, so I hope I don't sound as though I've
> really missed the point.
>
> I'm trying to understand how to map activities and state machines to
> operations in uml2. I've gone through the tutorials on creating models,
> packages, classes, attributes and operations. Now I would like to take
> this further and create activities and state machines (with the states
> containing actions).
>
> Does anyone know of a simple tutorial which demonstrates how to do this
> with uml2?
>
> For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an activity
> diagram and a matching java method. I really would like to create this
> model in uml2 and then parse though the model and create the source.
>
> Am I on the right track here?!
>
> Thanks in advance for any input.
>
> Nick
|
|
|
Re: Coupling operations with activities, state machines and actions [message #627007 is a reply to message #477807] |
Fri, 10 October 2008 19:55 |
Rafael Chaves Messages: 362 Registered: July 2009 |
Senior Member |
|
|
Btw, a StateMachine is also a Behavior.
Rafael Chaves wrote:
> Nick,
>
> Operations can have one or more behaviors (BehavioralFeature#method,
> opposite is Behavior#specification). An activity is a kind of behavior.
>
> > For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an activity
> > diagram and a matching java method.
>
> What section of the spec are you referring to?
>
> Cheers,
>
> Rafael
>
> Nick Betteridge wrote:
>> Hi
>>
>> I'm new to uml2 and modeling, so I hope I don't sound as though I've
>> really missed the point.
>>
>> I'm trying to understand how to map activities and state machines to
>> operations in uml2. I've gone through the tutorials on creating
>> models, packages, classes, attributes and operations. Now I would like
>> to take this further and create activities and state machines (with
>> the states containing actions).
>>
>> Does anyone know of a simple tutorial which demonstrates how to do
>> this with uml2?
>>
>> For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an
>> activity diagram and a matching java method. I really would like to
>> create this model in uml2 and then parse though the model and create
>> the source.
>>
>> Am I on the right track here?!
>>
>> Thanks in advance for any input.
>>
>> Nick
|
|
|
Re: Coupling operations with activities, state machines and actions [message #627013 is a reply to message #477807] |
Mon, 13 October 2008 16:44 |
Nick Betteridge Messages: 6 Registered: July 2009 |
Junior Member |
|
|
Hi Rafael
Thanks for replying. The section of the spec (Concrete Syntax for a UML
Action Language) was the appendix - a simple java method and the
corresponding activity diagram. I can see how to generate the class and
the operation, and also generate the activity with CallBehaviourActions.
So, from what you are saying, all I have to do is create the activity
and do a getMethods().add()?
ie:
class ListUtils {
boolean sameSizeLists(List listOne, List listTwo) {
if (listOne.size() == listTwo.size())
return true;
return false;
}
}
Class class = package_.createOwnedClass("ListUtils", isAbstract);
Operation op = class.createOwnedOperation("sameSizeLists", pNames,
pTypes, returnType);
Activity activity = (Activity)
class.createOwnedBehavior("sameSizeLists",
UMLPackage.eINSTANCE.getActivity());
CallBehaviorAction cba0 = (CallBehaviorAction)
activity.createNode(null,UMLPackage.eINSTANCE.getCallBehavio rAction());
.... add actions, nodes etc
op.getMethods().add(activity);
..... and then when it comes to traversing the model (for code
generation), look at the methods assigned to the operation and choose
the most appropriate?
Thanks again
Cheers
Nick
Rafael Chaves wrote:
> Nick,
>
> Operations can have one or more behaviors (BehavioralFeature#method,
> opposite is Behavior#specification). An activity is a kind of behavior.
>
> > For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an activity
> > diagram and a matching java method.
>
> What section of the spec are you referring to?
>
> Cheers,
>
> Rafael
>
> Nick Betteridge wrote:
>> Hi
>>
>> I'm new to uml2 and modeling, so I hope I don't sound as though I've
>> really missed the point.
>>
>> I'm trying to understand how to map activities and state machines to
>> operations in uml2. I've gone through the tutorials on creating
>> models, packages, classes, attributes and operations. Now I would like
>> to take this further and create activities and state machines (with
>> the states containing actions).
>>
>> Does anyone know of a simple tutorial which demonstrates how to do
>> this with uml2?
>>
>> For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an
>> activity diagram and a matching java method. I really would like to
>> create this model in uml2 and then parse though the model and create
>> the source.
>>
>> Am I on the right track here?!
>>
>> Thanks in advance for any input.
>>
>> Nick
|
|
|
Re: Coupling operations with activities, state machines and actions [message #627014 is a reply to message #477816] |
Mon, 13 October 2008 17:58 |
Rafael Chaves Messages: 362 Registered: July 2009 |
Senior Member |
|
|
Hi Nick,
> So, from what you are saying, all I have to do is create the activity
> and do a getMethods().add()?
>
> op.getMethods().add(activity);
What I actually do is activity.setSpecification(op), but it doesn't
matter as Behavior#specification and BehavioralFeature#methods are
opposite ends.
> .... and then when it comes to traversing the model (for code
> generation), look at the methods assigned to the operation and choose
> the most appropriate?
I really don't understand the use case for operations with multiple
methods. If it doesn't make sense in your case, you could enforce a rule
that did not allow that. I have to somehow constrain UML features once
in a while, as some of them seem unnecessary for the concrete case at
hand, or have to choose one possible interpretation or even invent
something because the specification is vague/incomplete.
Another thing you should do is to create parameter nodes, one for each
parameter in the 'specification' (i.e. your operation) of the activity
being built. They provide the means for data getting in and out of your
activity.
Good luck,
Rafael
Nick Betteridge wrote:
> Hi Rafael
>
> Thanks for replying. The section of the spec (Concrete Syntax for a UML
> Action Language) was the appendix - a simple java method and the
> corresponding activity diagram. I can see how to generate the class and
> the operation, and also generate the activity with CallBehaviourActions.
> So, from what you are saying, all I have to do is create the activity
> and do a getMethods().add()?
>
> ie:
>
> class ListUtils {
> boolean sameSizeLists(List listOne, List listTwo) {
> if (listOne.size() == listTwo.size())
> return true;
> return false;
> }
> }
>
> Class class = package_.createOwnedClass("ListUtils", isAbstract);
>
> Operation op = class.createOwnedOperation("sameSizeLists", pNames,
> pTypes, returnType);
>
> Activity activity = (Activity)
> class.createOwnedBehavior("sameSizeLists",
> UMLPackage.eINSTANCE.getActivity());
>
> CallBehaviorAction cba0 = (CallBehaviorAction)
> activity.createNode(null,UMLPackage.eINSTANCE.getCallBehavio rAction());
>
> ... add actions, nodes etc
>
> op.getMethods().add(activity);
>
>
> .... and then when it comes to traversing the model (for code
> generation), look at the methods assigned to the operation and choose
> the most appropriate?
>
>
> Thanks again
>
> Cheers
>
> Nick
>
>
>
> Rafael Chaves wrote:
>> Nick,
>>
>> Operations can have one or more behaviors (BehavioralFeature#method,
>> opposite is Behavior#specification). An activity is a kind of behavior.
>>
>> > For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an
>> activity
>> > diagram and a matching java method.
>>
>> What section of the spec are you referring to?
>>
>> Cheers,
>>
>> Rafael
>>
>> Nick Betteridge wrote:
>>> Hi
>>>
>>> I'm new to uml2 and modeling, so I hope I don't sound as though I've
>>> really missed the point.
>>>
>>> I'm trying to understand how to map activities and state machines to
>>> operations in uml2. I've gone through the tutorials on creating
>>> models, packages, classes, attributes and operations. Now I would
>>> like to take this further and create activities and state machines
>>> (with the states containing actions).
>>>
>>> Does anyone know of a simple tutorial which demonstrates how to do
>>> this with uml2?
>>>
>>> For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an
>>> activity diagram and a matching java method. I really would like to
>>> create this model in uml2 and then parse though the model and create
>>> the source.
>>>
>>> Am I on the right track here?!
>>>
>>> Thanks in advance for any input.
>>>
>>> Nick
|
|
|
Goto Forum:
Current Time: Sat Apr 20 03:09:43 GMT 2024
Powered by FUDForum. Page generated in 0.03127 seconds
|