Mark Fortner | 27 Mar 2012 23:04
Picon

Multiplicity Questions

I've been trying to figure out how the changing multiplicity between classes, effects the code that gets generated.

Let's say that you have a class like Department.  This class has multiple Employees.

Department <>----- [1..*]Employee

When I name the association to "employeeList", and add some documentation, and look at the source for the Department, I see this:

  /** 
   *  A list of employees in the Department.
   * <at> element-type Employee
   */
   public Vector employeeList

Ideally, I'd like to see private List<Employee> employeeList.  At a minimum, is there anyway to display the generic type for the list?  

If I select the endpoint within Department, and set the visibility to Private, the code still shows up as public.

Is there anyway of changing the type for an association?  For example, MultiMap<Skill, Employee>. 

Also, when I add something that has a multiplicity of 1, I still get a Vector.  Is there anyway of changing that?

Regards,

Mark
Linus Tolke Tigris | 28 Mar 2012 06:53
Picon

Re: Multiplicity Questions

Hello Mark!


I think you should point out that this is a Java generation question. Because we completely separate implementations for each language this kind of thing might work differently for C++, C#., PHP and SQL.

For Java, ideally the generation would create different code depending on the multiplicity and you would want to control the array/vector/list-type used when realizing links with multiplicity bigger than 1. I think it is now fixed to a Vector that is probably not a good choice in most cases since generics were introduced as you point out.

When I test to set the association end to visibility private I notice that it changes to private. Please check this again!

I am not sure where it would be natural to have a Map generated. I guess it would be for association classes or associations with three or more ends but I don't think that is supported in the code generation.

As a developer of ArgoUML you are most welcome to make the improvements you suggest here. It is a much-needed addition.

        /Linus



2012/3/27 Mark Fortner <phidias51 <at> gmail.com>
I've been trying to figure out how the changing multiplicity between classes, effects the code that gets generated.

Let's say that you have a class like Department.  This class has multiple Employees.

Department <>----- [1..*]Employee

When I name the association to "employeeList", and add some documentation, and look at the source for the Department, I see this:

  /** 
   *  A list of employees in the Department.
   * <at> element-type Employee
   */
   public Vector employeeList

Ideally, I'd like to see private List<Employee> employeeList.  At a minimum, is there anyway to display the generic type for the list?  

If I select the endpoint within Department, and set the visibility to Private, the code still shows up as public.

Is there anyway of changing the type for an association?  For example, MultiMap<Skill, Employee>. 

Also, when I add something that has a multiplicity of 1, I still get a Vector.  Is there anyway of changing that?

Regards,

Mark

Bob Tarling | 28 Mar 2012 08:37
Picon

Re: Multiplicity Questions

All of these are relevant defects and change requesst. None of them can be implemented in ArgoUML at the moment.


The change to define a generic List should be an improved standard behaviour for an anything to many relationship. Maybe we could even recognise some stereotype to use Set instead when relevant.

I think a close equivilent of MAP in UML is the qualifier value that can be set an association-end. This should be an indication to the code generator to create a Map instead. The qualifier would by the key for that map.

I think if you have set the multiplicity to 1 and our currently geting a vector that should be raised as a defect.

Please raise defects, enhancements as appropriate.

As Linus says you are free to try to implement. Hopefully you will find help on the dev list or maybe the subcomponent owner will come in to implement.

Regards

Bob


On 27 March 2012 22:04, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've been trying to figure out how the changing multiplicity between classes, effects the code that gets generated.

Let's say that you have a class like Department.  This class has multiple Employees.

Department <>----- [1..*]Employee

When I name the association to "employeeList", and add some documentation, and look at the source for the Department, I see this:

  /** 
   *  A list of employees in the Department.
   * <at> element-type Employee
   */
   public Vector employeeList

Ideally, I'd like to see private List<Employee> employeeList.  At a minimum, is there anyway to display the generic type for the list?  

If I select the endpoint within Department, and set the visibility to Private, the code still shows up as public.

Is there anyway of changing the type for an association?  For example, MultiMap<Skill, Employee>. 

Also, when I add something that has a multiplicity of 1, I still get a Vector.  Is there anyway of changing that?

Regards,

Mark

Mark Fortner | 28 Mar 2012 17:06
Picon

Re: Multiplicity Questions

Hi Linus,

I created the association again, clicked on the link in the Properties panel to go to the Department association end, and then clicked Private.  When I looked at the source tab, it still showed up as public.  Oddly enough, on the diagram we see "-employeeList" indicating that the association end is private.

What's also odd is the fact that Employee also ends up with a public Vector employeeList declaration.

From a useability perspective, it would be nice if the association ends listed in the Properties panel include the names of the classes they terminate in.  Even if the association names are unnamed, it makes it easier to select the right association end.

I'll right these up in one or two issues.  My usual MO when it comes to these things is to discuss the issue first on the user list (in case there's a workaround, or some UML weirdness that I don't understand), and then create an issue if necessary.  If there's a quick code change that I can figure out, I usually attach a patch and talk it over with whoever the issue's assigned to.  

I suspect changing Vectors into generified Lists, and fixing the Multiplicity=1 issue are probably trivial changes and I'll look into that within the next few days.  

Using other collections such as Maps and Sets would probably take longer to figure out, and would require someone with more UML expertise than me.  As Bob suggested, we could use stereotypes, but is this the "standard" way of representing this in UML.  If someone took the XMI for the model into a different application, would this kind of association be rendered properly, or generate the appropriate code?

Cheers,

Mark


On Tue, Mar 27, 2012 at 11:37 PM, Bob Tarling <bob.tarling <at> gmail.com> wrote:
All of these are relevant defects and change requesst. None of them can be implemented in ArgoUML at the moment.

The change to define a generic List should be an improved standard behaviour for an anything to many relationship. Maybe we could even recognise some stereotype to use Set instead when relevant.

I think a close equivilent of MAP in UML is the qualifier value that can be set an association-end. This should be an indication to the code generator to create a Map instead. The qualifier would by the key for that map.

I think if you have set the multiplicity to 1 and our currently geting a vector that should be raised as a defect.

Please raise defects, enhancements as appropriate.

As Linus says you are free to try to implement. Hopefully you will find help on the dev list or maybe the subcomponent owner will come in to implement.

Regards

Bob


On 27 March 2012 22:04, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've been trying to figure out how the changing multiplicity between classes, effects the code that gets generated.

Let's say that you have a class like Department.  This class has multiple Employees.

Department <>----- [1..*]Employee

When I name the association to "employeeList", and add some documentation, and look at the source for the Department, I see this:

  /** 
   *  A list of employees in the Department.
   * <at> element-type Employee
   */
   public Vector employeeList

Ideally, I'd like to see private List<Employee> employeeList.  At a minimum, is there anyway to display the generic type for the list?  

If I select the endpoint within Department, and set the visibility to Private, the code still shows up as public.

Is there anyway of changing the type for an association?  For example, MultiMap<Skill, Employee>. 

Also, when I add something that has a multiplicity of 1, I still get a Vector.  Is there anyway of changing that?

Regards,

Mark


Tom Morris | 28 Mar 2012 17:32
Picon
Gravatar

Re: Multiplicity Questions

On Wed, Mar 28, 2012 at 11:06 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
> Hi Linus,
> I created the association again, clicked on the link in the Properties panel
> to go to the Department association end, and then clicked Private.  When I
> looked at the source tab, it still showed up as public.  Oddly enough, on
> the diagram we see "-employeeList" indicating that the association end is
> private.

I've lost track of the ends now, but my impression from the original
message was that you were changing the visibility on the wrong
association end.  Remember that it's the *far* end that you need to
change for things like visibility and navigability.

> What's also odd is the fact that Employee also ends up with a public Vector
> employeeList declaration.

Is the association navigable in both directions? (the default)  If so,
you'll get data structures on both ends to allow you to get to the
other end.  Set isNavigable to false on the end opposite where you
want the data structure to disappear from.

> I suspect changing Vectors into generified Lists, and fixing the
> Multiplicity=1 issue are probably trivial changes and I'll look into that
> within the next few days.

Support for UML Templates and Java generics is only partially
implemented.  You could probably special case the code generation for
this specific use case without generics support, but you might need to
take backward compatibility into account (e.g. provide a preference
setting for what type to generate).

Note also that ArrayList and Vector have slightly different semantics,
particularly vis a vis synchronization, so the two types aren't
completely interchangeable.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=2941640

To unsubscribe from this discussion, e-mail: [users-unsubscribe <at> argouml.tigris.org].

Mark Fortner | 28 Mar 2012 18:33
Picon

Re: Multiplicity Questions

Thanks, Tom! 


I knew there had to be some UML-specific thing that I needed to do to get the employeeList in the right place.

As for generating the appropriate type, (ArrayLists vs Vectors), my thought was that I'd simply generate:

List<Employee> employeeList;

And let the user create the right-side of declaration if they want after the code has been generated.

Is there currently a preference that allows the user to specify what version of Java they want to use? Perhaps using the Java profile? Since Oracle doesn't support 1.4 anymore, is there a reason that we would need to support the non-generic list?

Mark


On Wed, Mar 28, 2012 at 8:32 AM, Tom Morris <tfmorris <at> gmail.com> wrote:
On Wed, Mar 28, 2012 at 11:06 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
> Hi Linus,
> I created the association again, clicked on the link in the Properties panel
> to go to the Department association end, and then clicked Private.  When I
> looked at the source tab, it still showed up as public.  Oddly enough, on
> the diagram we see "-employeeList" indicating that the association end is
> private.

I've lost track of the ends now, but my impression from the original
message was that you were changing the visibility on the wrong
association end.  Remember that it's the *far* end that you need to
change for things like visibility and navigability.

> What's also odd is the fact that Employee also ends up with a public Vector
> employeeList declaration.

Is the association navigable in both directions? (the default)  If so,
you'll get data structures on both ends to allow you to get to the
other end.  Set isNavigable to false on the end opposite where you
want the data structure to disappear from.

> I suspect changing Vectors into generified Lists, and fixing the
> Multiplicity=1 issue are probably trivial changes and I'll look into that
> within the next few days.

Support for UML Templates and Java generics is only partially
implemented.  You could probably special case the code generation for
this specific use case without generics support, but you might need to
take backward compatibility into account (e.g. provide a preference
setting for what type to generate).

Note also that ArrayList and Vector have slightly different semantics,
particularly vis a vis synchronization, so the two types aren't
completely interchangeable.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=2941640

To unsubscribe from this discussion, e-mail: [users-unsubscribe <at> argouml.tigris.org].

Mark Fortner | 29 Mar 2012 17:11
Picon

Re: Multiplicity Questions

I've created an issue for this:


If I get a chance this weekend, I'll take a look at the existing code for this.

Cheers,

Mark


On Wed, Mar 28, 2012 at 9:33 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
Thanks, Tom! 

I knew there had to be some UML-specific thing that I needed to do to get the employeeList in the right place.

As for generating the appropriate type, (ArrayLists vs Vectors), my thought was that I'd simply generate:

List<Employee> employeeList;

And let the user create the right-side of declaration if they want after the code has been generated.

Is there currently a preference that allows the user to specify what version of Java they want to use? Perhaps using the Java profile? Since Oracle doesn't support 1.4 anymore, is there a reason that we would need to support the non-generic list?

Mark



On Wed, Mar 28, 2012 at 8:32 AM, Tom Morris <tfmorris <at> gmail.com> wrote:
On Wed, Mar 28, 2012 at 11:06 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
> Hi Linus,
> I created the association again, clicked on the link in the Properties panel
> to go to the Department association end, and then clicked Private.  When I
> looked at the source tab, it still showed up as public.  Oddly enough, on
> the diagram we see "-employeeList" indicating that the association end is
> private.

I've lost track of the ends now, but my impression from the original
message was that you were changing the visibility on the wrong
association end.  Remember that it's the *far* end that you need to
change for things like visibility and navigability.

> What's also odd is the fact that Employee also ends up with a public Vector
> employeeList declaration.

Is the association navigable in both directions? (the default)  If so,
you'll get data structures on both ends to allow you to get to the
other end.  Set isNavigable to false on the end opposite where you
want the data structure to disappear from.

> I suspect changing Vectors into generified Lists, and fixing the
> Multiplicity=1 issue are probably trivial changes and I'll look into that
> within the next few days.

Support for UML Templates and Java generics is only partially
implemented.  You could probably special case the code generation for
this specific use case without generics support, but you might need to
take backward compatibility into account (e.g. provide a preference
setting for what type to generate).

Note also that ArrayList and Vector have slightly different semantics,
particularly vis a vis synchronization, so the two types aren't
completely interchangeable.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=2941640

To unsubscribe from this discussion, e-mail: [users-unsubscribe <at> argouml.tigris.org].


Mark Fortner | 4 Apr 2012 16:32
Picon

Re: Multiplicity Questions

I've fixed the multiplicity issues and altered the GeneratorJava class to return Lists instead of Vectors.  However, I can't seem to get the generateVisibility method to give me the appropriate visibility.  Here's what's happening:

  • When I debug into the method I find that a call to Model.getFacade().isPublic(obj) is always returning true.  It is being passed an AssociationEndImpl object, and when you get its visibility it returns Public.  When I try to inspect the AssociationEnd all I get are a ton of MOF IDs, and maps and lots of useless crap but no attribute called visibility that I can inspect.

  • When I make a call to getName on the Association, it returns null for both association ends, despite the fact that one of the association ends is named.  
My thought is that the Property panel is setting some other attribute of the Association End to private.  But I can't really confirm this.  Does anyone have any suggestions for how to proceed further?

Mark


On Thu, Mar 29, 2012 at 8:11 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've created an issue for this:

If I get a chance this weekend, I'll take a look at the existing code for this.

Cheers,

Mark



On Wed, Mar 28, 2012 at 9:33 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
Thanks, Tom! 

I knew there had to be some UML-specific thing that I needed to do to get the employeeList in the right place.

As for generating the appropriate type, (ArrayLists vs Vectors), my thought was that I'd simply generate:

List<Employee> employeeList;

And let the user create the right-side of declaration if they want after the code has been generated.

Is there currently a preference that allows the user to specify what version of Java they want to use? Perhaps using the Java profile? Since Oracle doesn't support 1.4 anymore, is there a reason that we would need to support the non-generic list?

Mark



On Wed, Mar 28, 2012 at 8:32 AM, Tom Morris <tfmorris <at> gmail.com> wrote:
On Wed, Mar 28, 2012 at 11:06 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
> Hi Linus,
> I created the association again, clicked on the link in the Properties panel
> to go to the Department association end, and then clicked Private.  When I
> looked at the source tab, it still showed up as public.  Oddly enough, on
> the diagram we see "-employeeList" indicating that the association end is
> private.

I've lost track of the ends now, but my impression from the original
message was that you were changing the visibility on the wrong
association end.  Remember that it's the *far* end that you need to
change for things like visibility and navigability.

> What's also odd is the fact that Employee also ends up with a public Vector
> employeeList declaration.

Is the association navigable in both directions? (the default)  If so,
you'll get data structures on both ends to allow you to get to the
other end.  Set isNavigable to false on the end opposite where you
want the data structure to disappear from.

> I suspect changing Vectors into generified Lists, and fixing the
> Multiplicity=1 issue are probably trivial changes and I'll look into that
> within the next few days.

Support for UML Templates and Java generics is only partially
implemented.  You could probably special case the code generation for
this specific use case without generics support, but you might need to
take backward compatibility into account (e.g. provide a preference
setting for what type to generate).

Note also that ArrayList and Vector have slightly different semantics,
particularly vis a vis synchronization, so the two types aren't
completely interchangeable.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=2941640

To unsubscribe from this discussion, e-mail: [users-unsubscribe <at> argouml.tigris.org].



Bob Tarling | 4 Apr 2012 18:54
Picon

[argouml-dev] Re: [argouml-users] Multiplicity Questions

I'll investigate when I get home from work.


Could we move this conversation to the dev list please and make this the last one to cc users

Regards

Bob

On 4 April 2012 15:32, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've fixed the multiplicity issues and altered the GeneratorJava class to return Lists instead of Vectors.  However, I can't seem to get the generateVisibility method to give me the appropriate visibility.  Here's what's happening:
  • When I debug into the method I find that a call to Model.getFacade().isPublic(obj) is always returning true.  It is being passed an AssociationEndImpl object, and when you get its visibility it returns Public.  When I try to inspect the AssociationEnd all I get are a ton of MOF IDs, and maps and lots of useless crap but no attribute called visibility that I can inspect.

  • When I make a call to getName on the Association, it returns null for both association ends, despite the fact that one of the association ends is named.  
My thought is that the Property panel is setting some other attribute of the Association End to private.  But I can't really confirm this.  Does anyone have any suggestions for how to proceed further?

Mark


On Thu, Mar 29, 2012 at 8:11 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've created an issue for this:

If I get a chance this weekend, I'll take a look at the existing code for this.

Cheers,

Mark



On Wed, Mar 28, 2012 at 9:33 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
Thanks, Tom! 

I knew there had to be some UML-specific thing that I needed to do to get the employeeList in the right place.

As for generating the appropriate type, (ArrayLists vs Vectors), my thought was that I'd simply generate:

List<Employee> employeeList;

And let the user create the right-side of declaration if they want after the code has been generated.

Is there currently a preference that allows the user to specify what version of Java they want to use? Perhaps using the Java profile? Since Oracle doesn't support 1.4 anymore, is there a reason that we would need to support the non-generic list?

Mark



On Wed, Mar 28, 2012 at 8:32 AM, Tom Morris <tfmorris <at> gmail.com> wrote:
On Wed, Mar 28, 2012 at 11:06 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
> Hi Linus,
> I created the association again, clicked on the link in the Properties panel
> to go to the Department association end, and then clicked Private.  When I
> looked at the source tab, it still showed up as public.  Oddly enough, on
> the diagram we see "-employeeList" indicating that the association end is
> private.

I've lost track of the ends now, but my impression from the original
message was that you were changing the visibility on the wrong
association end.  Remember that it's the *far* end that you need to
change for things like visibility and navigability.

> What's also odd is the fact that Employee also ends up with a public Vector
> employeeList declaration.

Is the association navigable in both directions? (the default)  If so,
you'll get data structures on both ends to allow you to get to the
other end.  Set isNavigable to false on the end opposite where you
want the data structure to disappear from.

> I suspect changing Vectors into generified Lists, and fixing the
> Multiplicity=1 issue are probably trivial changes and I'll look into that
> within the next few days.

Support for UML Templates and Java generics is only partially
implemented.  You could probably special case the code generation for
this specific use case without generics support, but you might need to
take backward compatibility into account (e.g. provide a preference
setting for what type to generate).

Note also that ArrayList and Vector have slightly different semantics,
particularly vis a vis synchronization, so the two types aren't
completely interchangeable.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=2941640

To unsubscribe from this discussion, e-mail: [users-unsubscribe <at> argouml.tigris.org].




Bob Tarling | 4 Apr 2012 18:54
Picon

Re: [argouml-users] Multiplicity Questions

I'll investigate when I get home from work.


Could we move this conversation to the dev list please and make this the last one to cc users

Regards

Bob

On 4 April 2012 15:32, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've fixed the multiplicity issues and altered the GeneratorJava class to return Lists instead of Vectors.  However, I can't seem to get the generateVisibility method to give me the appropriate visibility.  Here's what's happening:
  • When I debug into the method I find that a call to Model.getFacade().isPublic(obj) is always returning true.  It is being passed an AssociationEndImpl object, and when you get its visibility it returns Public.  When I try to inspect the AssociationEnd all I get are a ton of MOF IDs, and maps and lots of useless crap but no attribute called visibility that I can inspect.

  • When I make a call to getName on the Association, it returns null for both association ends, despite the fact that one of the association ends is named.  
My thought is that the Property panel is setting some other attribute of the Association End to private.  But I can't really confirm this.  Does anyone have any suggestions for how to proceed further?

Mark


On Thu, Mar 29, 2012 at 8:11 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've created an issue for this:

If I get a chance this weekend, I'll take a look at the existing code for this.

Cheers,

Mark



On Wed, Mar 28, 2012 at 9:33 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
Thanks, Tom! 

I knew there had to be some UML-specific thing that I needed to do to get the employeeList in the right place.

As for generating the appropriate type, (ArrayLists vs Vectors), my thought was that I'd simply generate:

List<Employee> employeeList;

And let the user create the right-side of declaration if they want after the code has been generated.

Is there currently a preference that allows the user to specify what version of Java they want to use? Perhaps using the Java profile? Since Oracle doesn't support 1.4 anymore, is there a reason that we would need to support the non-generic list?

Mark



On Wed, Mar 28, 2012 at 8:32 AM, Tom Morris <tfmorris <at> gmail.com> wrote:
On Wed, Mar 28, 2012 at 11:06 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
> Hi Linus,
> I created the association again, clicked on the link in the Properties panel
> to go to the Department association end, and then clicked Private.  When I
> looked at the source tab, it still showed up as public.  Oddly enough, on
> the diagram we see "-employeeList" indicating that the association end is
> private.

I've lost track of the ends now, but my impression from the original
message was that you were changing the visibility on the wrong
association end.  Remember that it's the *far* end that you need to
change for things like visibility and navigability.

> What's also odd is the fact that Employee also ends up with a public Vector
> employeeList declaration.

Is the association navigable in both directions? (the default)  If so,
you'll get data structures on both ends to allow you to get to the
other end.  Set isNavigable to false on the end opposite where you
want the data structure to disappear from.

> I suspect changing Vectors into generified Lists, and fixing the
> Multiplicity=1 issue are probably trivial changes and I'll look into that
> within the next few days.

Support for UML Templates and Java generics is only partially
implemented.  You could probably special case the code generation for
this specific use case without generics support, but you might need to
take backward compatibility into account (e.g. provide a preference
setting for what type to generate).

Note also that ArrayList and Vector have slightly different semantics,
particularly vis a vis synchronization, so the two types aren't
completely interchangeable.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=2941640

To unsubscribe from this discussion, e-mail: [users-unsubscribe <at> argouml.tigris.org].




Bob Tarling | 4 Apr 2012 18:54
Picon

[argouml-dev] Re: Multiplicity Questions

I'll investigate when I get home from work.


Could we move this conversation to the dev list please and make this the last one to cc users

Regards

Bob

On 4 April 2012 15:32, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've fixed the multiplicity issues and altered the GeneratorJava class to return Lists instead of Vectors.  However, I can't seem to get the generateVisibility method to give me the appropriate visibility.  Here's what's happening:
  • When I debug into the method I find that a call to Model.getFacade().isPublic(obj) is always returning true.  It is being passed an AssociationEndImpl object, and when you get its visibility it returns Public.  When I try to inspect the AssociationEnd all I get are a ton of MOF IDs, and maps and lots of useless crap but no attribute called visibility that I can inspect.

  • When I make a call to getName on the Association, it returns null for both association ends, despite the fact that one of the association ends is named.  
My thought is that the Property panel is setting some other attribute of the Association End to private.  But I can't really confirm this.  Does anyone have any suggestions for how to proceed further?

Mark


On Thu, Mar 29, 2012 at 8:11 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've created an issue for this:

If I get a chance this weekend, I'll take a look at the existing code for this.

Cheers,

Mark



On Wed, Mar 28, 2012 at 9:33 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
Thanks, Tom! 

I knew there had to be some UML-specific thing that I needed to do to get the employeeList in the right place.

As for generating the appropriate type, (ArrayLists vs Vectors), my thought was that I'd simply generate:

List<Employee> employeeList;

And let the user create the right-side of declaration if they want after the code has been generated.

Is there currently a preference that allows the user to specify what version of Java they want to use? Perhaps using the Java profile? Since Oracle doesn't support 1.4 anymore, is there a reason that we would need to support the non-generic list?

Mark



On Wed, Mar 28, 2012 at 8:32 AM, Tom Morris <tfmorris <at> gmail.com> wrote:
On Wed, Mar 28, 2012 at 11:06 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
> Hi Linus,
> I created the association again, clicked on the link in the Properties panel
> to go to the Department association end, and then clicked Private.  When I
> looked at the source tab, it still showed up as public.  Oddly enough, on
> the diagram we see "-employeeList" indicating that the association end is
> private.

I've lost track of the ends now, but my impression from the original
message was that you were changing the visibility on the wrong
association end.  Remember that it's the *far* end that you need to
change for things like visibility and navigability.

> What's also odd is the fact that Employee also ends up with a public Vector
> employeeList declaration.

Is the association navigable in both directions? (the default)  If so,
you'll get data structures on both ends to allow you to get to the
other end.  Set isNavigable to false on the end opposite where you
want the data structure to disappear from.

> I suspect changing Vectors into generified Lists, and fixing the
> Multiplicity=1 issue are probably trivial changes and I'll look into that
> within the next few days.

Support for UML Templates and Java generics is only partially
implemented.  You could probably special case the code generation for
this specific use case without generics support, but you might need to
take backward compatibility into account (e.g. provide a preference
setting for what type to generate).

Note also that ArrayList and Vector have slightly different semantics,
particularly vis a vis synchronization, so the two types aren't
completely interchangeable.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=2941640

To unsubscribe from this discussion, e-mail: [users-unsubscribe <at> argouml.tigris.org].




Bob Tarling | 4 Apr 2012 21:32
Picon

[argouml-dev] Re: [argouml-users] Multiplicity Questions

The property panel is using a different method and I would recommend you use that.


When you have an association end call this to return the visibility

    Model.getFacade().getVisibility(myAssociationEnd)

If you want to know if the visibility is public you can compare with the value returned by one of these

    Model.getVisibilityKind().getPublic()
    Model.getVisibilityKind().getPackage()
    Model.getVisibilityKind().getProtected()
    Model.getVisibilityKind().getPrivate()

You'll see the property panel example in VisibilityGetterSetter.get(Object modelElement, Class<?> type)

I'm confused when you say getName on an association returns null for association ends. You need to pass the assiocation end to getName.

Try something like this when you have an association

String assName = Model.getFacade().getName(myAssocation);
System.out.println("The association name is " + assName);
Collection assEnds = Model.getFacade().getAssociationEnds();
for (Object assEnd : assEnds) {
    String assEndName = Model.getFacade().getName(assEnd);
    System.out.println("The associationEnd name is " + assEndName);
    Object kind = Model.getFacade().getVisibility( myAssociationEnd);
    if (Model.getVisibilityKind().getPublic().equals(kind)) {
        System.out.println("public");
    } else if (Model.getVisibilityKind().getPackage().equals(kind)) {
        System.out.println("package");
    } else if (Model.getVisibilityKind().getProtected().equals(kind)) {
        System.out.println("protected");
    } else if (Model.getVisibilityKind().getPrivate().equals(kind)) {
        System.out.println("private");
    } else {
        System.out.println("public");
    }
}

Disclaimer - all code freetyped without checking

Does your new code generate a List with generics?

Regards

Bob

On 4 April 2012 15:32, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've fixed the multiplicity issues and altered the GeneratorJava class to return Lists instead of Vectors.  However, I can't seem to get the generateVisibility method to give me the appropriate visibility.  Here's what's happening:
  • When I debug into the method I find that a call to Model.getFacade().isPublic(obj) is always returning true.  It is being passed an AssociationEndImpl object, and when you get its visibility it returns Public.  When I try to inspect the AssociationEnd all I get are a ton of MOF IDs, and maps and lots of useless crap but no attribute called visibility that I can inspect.

  • When I make a call to getName on the Association, it returns null for both association ends, despite the fact that one of the association ends is named.  
My thought is that the Property panel is setting some other attribute of the Association End to private.  But I can't really confirm this.  Does anyone have any suggestions for how to proceed further?

Mark


On Thu, Mar 29, 2012 at 8:11 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've created an issue for this:

If I get a chance this weekend, I'll take a look at the existing code for this.

Cheers,

Mark



On Wed, Mar 28, 2012 at 9:33 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
Thanks, Tom! 

I knew there had to be some UML-specific thing that I needed to do to get the employeeList in the right place.

As for generating the appropriate type, (ArrayLists vs Vectors), my thought was that I'd simply generate:

List<Employee> employeeList;

And let the user create the right-side of declaration if they want after the code has been generated.

Is there currently a preference that allows the user to specify what version of Java they want to use? Perhaps using the Java profile? Since Oracle doesn't support 1.4 anymore, is there a reason that we would need to support the non-generic list?

Mark



On Wed, Mar 28, 2012 at 8:32 AM, Tom Morris <tfmorris <at> gmail.com> wrote:
On Wed, Mar 28, 2012 at 11:06 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
> Hi Linus,
> I created the association again, clicked on the link in the Properties panel
> to go to the Department association end, and then clicked Private.  When I
> looked at the source tab, it still showed up as public.  Oddly enough, on
> the diagram we see "-employeeList" indicating that the association end is
> private.

I've lost track of the ends now, but my impression from the original
message was that you were changing the visibility on the wrong
association end.  Remember that it's the *far* end that you need to
change for things like visibility and navigability.

> What's also odd is the fact that Employee also ends up with a public Vector
> employeeList declaration.

Is the association navigable in both directions? (the default)  If so,
you'll get data structures on both ends to allow you to get to the
other end.  Set isNavigable to false on the end opposite where you
want the data structure to disappear from.

> I suspect changing Vectors into generified Lists, and fixing the
> Multiplicity=1 issue are probably trivial changes and I'll look into that
> within the next few days.

Support for UML Templates and Java generics is only partially
implemented.  You could probably special case the code generation for
this specific use case without generics support, but you might need to
take backward compatibility into account (e.g. provide a preference
setting for what type to generate).

Note also that ArrayList and Vector have slightly different semantics,
particularly vis a vis synchronization, so the two types aren't
completely interchangeable.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=2941640

To unsubscribe from this discussion, e-mail: [users-unsubscribe <at> argouml.tigris.org].




Mark Fortner | 4 Apr 2012 22:02
Picon

Re: [argouml-dev] Re: [argouml-users] Multiplicity Questions

Hi Bob,
Yes, the code generates a list with generics (if multiplicity > 1), and a member variable if multiplicity = 1.

I'll attach a patch to the issue and the model so that you can see what the code does.  I've tried this both ways (passing the AssociationEnd and passing the VisibilityKind to the generateVisibility method) and the result is always public. When I pass AssociationEnd, the name is null, and the value is public.  When I pass VisibilityKind, the name is "public" and the value is also public.

When I click on the Association and navigate to the association end that I'm interested in, it's always set to private.


Hope this helps,

Mark

On Wed, Apr 4, 2012 at 12:32 PM, Bob Tarling <bob.tarling <at> gmail.com> wrote:
The property panel is using a different method and I would recommend you use that.

When you have an association end call this to return the visibility

    Model.getFacade().getVisibility(myAssociationEnd)

If you want to know if the visibility is public you can compare with the value returned by one of these

    Model.getVisibilityKind().getPublic()
    Model.getVisibilityKind().getPackage()
    Model.getVisibilityKind().getProtected()
    Model.getVisibilityKind().getPrivate()

You'll see the property panel example in VisibilityGetterSetter.get(Object modelElement, Class<?> type)

I'm confused when you say getName on an association returns null for association ends. You need to pass the assiocation end to getName.

Try something like this when you have an association

String assName = Model.getFacade().getName(myAssocation);
System.out.println("The association name is " + assName);
Collection assEnds = Model.getFacade().getAssociationEnds();
for (Object assEnd : assEnds) {
    String assEndName = Model.getFacade().getName(assEnd);
    System.out.println("The associationEnd name is " + assEndName);
    Object kind = Model.getFacade().getVisibility( myAssociationEnd);
    if (Model.getVisibilityKind().getPublic().equals(kind)) {
        System.out.println("public");
    } else if (Model.getVisibilityKind().getPackage().equals(kind)) {
        System.out.println("package");
    } else if (Model.getVisibilityKind().getProtected().equals(kind)) {
        System.out.println("protected");
    } else if (Model.getVisibilityKind().getPrivate().equals(kind)) {
        System.out.println("private");
    } else {
        System.out.println("public");
    }
}

Disclaimer - all code freetyped without checking

Does your new code generate a List with generics?

Regards

Bob


On 4 April 2012 15:32, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've fixed the multiplicity issues and altered the GeneratorJava class to return Lists instead of Vectors.  However, I can't seem to get the generateVisibility method to give me the appropriate visibility.  Here's what's happening:
  • When I debug into the method I find that a call to Model.getFacade().isPublic(obj) is always returning true.  It is being passed an AssociationEndImpl object, and when you get its visibility it returns Public.  When I try to inspect the AssociationEnd all I get are a ton of MOF IDs, and maps and lots of useless crap but no attribute called visibility that I can inspect.

  • When I make a call to getName on the Association, it returns null for both association ends, despite the fact that one of the association ends is named.  
My thought is that the Property panel is setting some other attribute of the Association End to private.  But I can't really confirm this.  Does anyone have any suggestions for how to proceed further?

Mark


On Thu, Mar 29, 2012 at 8:11 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've created an issue for this:

If I get a chance this weekend, I'll take a look at the existing code for this.

Cheers,

Mark



On Wed, Mar 28, 2012 at 9:33 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
Thanks, Tom! 

I knew there had to be some UML-specific thing that I needed to do to get the employeeList in the right place.

As for generating the appropriate type, (ArrayLists vs Vectors), my thought was that I'd simply generate:

List<Employee> employeeList;

And let the user create the right-side of declaration if they want after the code has been generated.

Is there currently a preference that allows the user to specify what version of Java they want to use? Perhaps using the Java profile? Since Oracle doesn't support 1.4 anymore, is there a reason that we would need to support the non-generic list?

Mark



On Wed, Mar 28, 2012 at 8:32 AM, Tom Morris <tfmorris <at> gmail.com> wrote:
On Wed, Mar 28, 2012 at 11:06 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
> Hi Linus,
> I created the association again, clicked on the link in the Properties panel
> to go to the Department association end, and then clicked Private.  When I
> looked at the source tab, it still showed up as public.  Oddly enough, on
> the diagram we see "-employeeList" indicating that the association end is
> private.

I've lost track of the ends now, but my impression from the original
message was that you were changing the visibility on the wrong
association end.  Remember that it's the *far* end that you need to
change for things like visibility and navigability.

> What's also odd is the fact that Employee also ends up with a public Vector
> employeeList declaration.

Is the association navigable in both directions? (the default)  If so,
you'll get data structures on both ends to allow you to get to the
other end.  Set isNavigable to false on the end opposite where you
want the data structure to disappear from.

> I suspect changing Vectors into generified Lists, and fixing the
> Multiplicity=1 issue are probably trivial changes and I'll look into that
> within the next few days.

Support for UML Templates and Java generics is only partially
implemented.  You could probably special case the code generation for
this specific use case without generics support, but you might need to
take backward compatibility into account (e.g. provide a preference
setting for what type to generate).

Note also that ArrayList and Vector have slightly different semantics,
particularly vis a vis synchronization, so the two types aren't
completely interchangeable.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=2941640

To unsubscribe from this discussion, e-mail: [users-unsubscribe <at> argouml.tigris.org].





Mark Fortner | 4 Apr 2012 22:02
Picon

Re: Re: [argouml-users] Multiplicity Questions

Hi Bob,
Yes, the code generates a list with generics (if multiplicity > 1), and a member variable if multiplicity = 1.

I'll attach a patch to the issue and the model so that you can see what the code does.  I've tried this both ways (passing the AssociationEnd and passing the VisibilityKind to the generateVisibility method) and the result is always public. When I pass AssociationEnd, the name is null, and the value is public.  When I pass VisibilityKind, the name is "public" and the value is also public.

When I click on the Association and navigate to the association end that I'm interested in, it's always set to private.


Hope this helps,

Mark

On Wed, Apr 4, 2012 at 12:32 PM, Bob Tarling <bob.tarling <at> gmail.com> wrote:
The property panel is using a different method and I would recommend you use that.

When you have an association end call this to return the visibility

    Model.getFacade().getVisibility(myAssociationEnd)

If you want to know if the visibility is public you can compare with the value returned by one of these

    Model.getVisibilityKind().getPublic()
    Model.getVisibilityKind().getPackage()
    Model.getVisibilityKind().getProtected()
    Model.getVisibilityKind().getPrivate()

You'll see the property panel example in VisibilityGetterSetter.get(Object modelElement, Class<?> type)

I'm confused when you say getName on an association returns null for association ends. You need to pass the assiocation end to getName.

Try something like this when you have an association

String assName = Model.getFacade().getName(myAssocation);
System.out.println("The association name is " + assName);
Collection assEnds = Model.getFacade().getAssociationEnds();
for (Object assEnd : assEnds) {
    String assEndName = Model.getFacade().getName(assEnd);
    System.out.println("The associationEnd name is " + assEndName);
    Object kind = Model.getFacade().getVisibility( myAssociationEnd);
    if (Model.getVisibilityKind().getPublic().equals(kind)) {
        System.out.println("public");
    } else if (Model.getVisibilityKind().getPackage().equals(kind)) {
        System.out.println("package");
    } else if (Model.getVisibilityKind().getProtected().equals(kind)) {
        System.out.println("protected");
    } else if (Model.getVisibilityKind().getPrivate().equals(kind)) {
        System.out.println("private");
    } else {
        System.out.println("public");
    }
}

Disclaimer - all code freetyped without checking

Does your new code generate a List with generics?

Regards

Bob


On 4 April 2012 15:32, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've fixed the multiplicity issues and altered the GeneratorJava class to return Lists instead of Vectors.  However, I can't seem to get the generateVisibility method to give me the appropriate visibility.  Here's what's happening:
  • When I debug into the method I find that a call to Model.getFacade().isPublic(obj) is always returning true.  It is being passed an AssociationEndImpl object, and when you get its visibility it returns Public.  When I try to inspect the AssociationEnd all I get are a ton of MOF IDs, and maps and lots of useless crap but no attribute called visibility that I can inspect.

  • When I make a call to getName on the Association, it returns null for both association ends, despite the fact that one of the association ends is named.  
My thought is that the Property panel is setting some other attribute of the Association End to private.  But I can't really confirm this.  Does anyone have any suggestions for how to proceed further?

Mark


On Thu, Mar 29, 2012 at 8:11 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've created an issue for this:

If I get a chance this weekend, I'll take a look at the existing code for this.

Cheers,

Mark



On Wed, Mar 28, 2012 at 9:33 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
Thanks, Tom! 

I knew there had to be some UML-specific thing that I needed to do to get the employeeList in the right place.

As for generating the appropriate type, (ArrayLists vs Vectors), my thought was that I'd simply generate:

List<Employee> employeeList;

And let the user create the right-side of declaration if they want after the code has been generated.

Is there currently a preference that allows the user to specify what version of Java they want to use? Perhaps using the Java profile? Since Oracle doesn't support 1.4 anymore, is there a reason that we would need to support the non-generic list?

Mark



On Wed, Mar 28, 2012 at 8:32 AM, Tom Morris <tfmorris <at> gmail.com> wrote:
On Wed, Mar 28, 2012 at 11:06 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
> Hi Linus,
> I created the association again, clicked on the link in the Properties panel
> to go to the Department association end, and then clicked Private.  When I
> looked at the source tab, it still showed up as public.  Oddly enough, on
> the diagram we see "-employeeList" indicating that the association end is
> private.

I've lost track of the ends now, but my impression from the original
message was that you were changing the visibility on the wrong
association end.  Remember that it's the *far* end that you need to
change for things like visibility and navigability.

> What's also odd is the fact that Employee also ends up with a public Vector
> employeeList declaration.

Is the association navigable in both directions? (the default)  If so,
you'll get data structures on both ends to allow you to get to the
other end.  Set isNavigable to false on the end opposite where you
want the data structure to disappear from.

> I suspect changing Vectors into generified Lists, and fixing the
> Multiplicity=1 issue are probably trivial changes and I'll look into that
> within the next few days.

Support for UML Templates and Java generics is only partially
implemented.  You could probably special case the code generation for
this specific use case without generics support, but you might need to
take backward compatibility into account (e.g. provide a preference
setting for what type to generate).

Note also that ArrayList and Vector have slightly different semantics,
particularly vis a vis synchronization, so the two types aren't
completely interchangeable.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=2941640

To unsubscribe from this discussion, e-mail: [users-unsubscribe <at> argouml.tigris.org].





Bob Tarling | 4 Apr 2012 21:32
Picon

Re: [argouml-users] Multiplicity Questions

The property panel is using a different method and I would recommend you use that.


When you have an association end call this to return the visibility

    Model.getFacade().getVisibility(myAssociationEnd)

If you want to know if the visibility is public you can compare with the value returned by one of these

    Model.getVisibilityKind().getPublic()
    Model.getVisibilityKind().getPackage()
    Model.getVisibilityKind().getProtected()
    Model.getVisibilityKind().getPrivate()

You'll see the property panel example in VisibilityGetterSetter.get(Object modelElement, Class<?> type)

I'm confused when you say getName on an association returns null for association ends. You need to pass the assiocation end to getName.

Try something like this when you have an association

String assName = Model.getFacade().getName(myAssocation);
System.out.println("The association name is " + assName);
Collection assEnds = Model.getFacade().getAssociationEnds();
for (Object assEnd : assEnds) {
    String assEndName = Model.getFacade().getName(assEnd);
    System.out.println("The associationEnd name is " + assEndName);
    Object kind = Model.getFacade().getVisibility( myAssociationEnd);
    if (Model.getVisibilityKind().getPublic().equals(kind)) {
        System.out.println("public");
    } else if (Model.getVisibilityKind().getPackage().equals(kind)) {
        System.out.println("package");
    } else if (Model.getVisibilityKind().getProtected().equals(kind)) {
        System.out.println("protected");
    } else if (Model.getVisibilityKind().getPrivate().equals(kind)) {
        System.out.println("private");
    } else {
        System.out.println("public");
    }
}

Disclaimer - all code freetyped without checking

Does your new code generate a List with generics?

Regards

Bob

On 4 April 2012 15:32, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've fixed the multiplicity issues and altered the GeneratorJava class to return Lists instead of Vectors.  However, I can't seem to get the generateVisibility method to give me the appropriate visibility.  Here's what's happening:
  • When I debug into the method I find that a call to Model.getFacade().isPublic(obj) is always returning true.  It is being passed an AssociationEndImpl object, and when you get its visibility it returns Public.  When I try to inspect the AssociationEnd all I get are a ton of MOF IDs, and maps and lots of useless crap but no attribute called visibility that I can inspect.

  • When I make a call to getName on the Association, it returns null for both association ends, despite the fact that one of the association ends is named.  
My thought is that the Property panel is setting some other attribute of the Association End to private.  But I can't really confirm this.  Does anyone have any suggestions for how to proceed further?

Mark


On Thu, Mar 29, 2012 at 8:11 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
I've created an issue for this:

If I get a chance this weekend, I'll take a look at the existing code for this.

Cheers,

Mark



On Wed, Mar 28, 2012 at 9:33 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
Thanks, Tom! 

I knew there had to be some UML-specific thing that I needed to do to get the employeeList in the right place.

As for generating the appropriate type, (ArrayLists vs Vectors), my thought was that I'd simply generate:

List<Employee> employeeList;

And let the user create the right-side of declaration if they want after the code has been generated.

Is there currently a preference that allows the user to specify what version of Java they want to use? Perhaps using the Java profile? Since Oracle doesn't support 1.4 anymore, is there a reason that we would need to support the non-generic list?

Mark



On Wed, Mar 28, 2012 at 8:32 AM, Tom Morris <tfmorris <at> gmail.com> wrote:
On Wed, Mar 28, 2012 at 11:06 AM, Mark Fortner <phidias51 <at> gmail.com> wrote:
> Hi Linus,
> I created the association again, clicked on the link in the Properties panel
> to go to the Department association end, and then clicked Private.  When I
> looked at the source tab, it still showed up as public.  Oddly enough, on
> the diagram we see "-employeeList" indicating that the association end is
> private.

I've lost track of the ends now, but my impression from the original
message was that you were changing the visibility on the wrong
association end.  Remember that it's the *far* end that you need to
change for things like visibility and navigability.

> What's also odd is the fact that Employee also ends up with a public Vector
> employeeList declaration.

Is the association navigable in both directions? (the default)  If so,
you'll get data structures on both ends to allow you to get to the
other end.  Set isNavigable to false on the end opposite where you
want the data structure to disappear from.

> I suspect changing Vectors into generified Lists, and fixing the
> Multiplicity=1 issue are probably trivial changes and I'll look into that
> within the next few days.

Support for UML Templates and Java generics is only partially
implemented.  You could probably special case the code generation for
this specific use case without generics support, but you might need to
take backward compatibility into account (e.g. provide a preference
setting for what type to generate).

Note also that ArrayList and Vector have slightly different semantics,
particularly vis a vis synchronization, so the two types aren't
completely interchangeable.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=449&dsMessageId=2941640

To unsubscribe from this discussion, e-mail: [users-unsubscribe <at> argouml.tigris.org].





Gmane