Book a Demo

Author Topic: EA 4.1.739: Some issues, please advise  (Read 3702 times)

Vladan_Strigo

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
EA 4.1.739: Some issues, please advise
« on: November 10, 2004, 04:43:04 am »
Hi,

Currently at my company I've bean se in charge for finding and testing an UML tool which we would use in the near future. I've downloaded your great product and am currently working on a trial version.

While working on your product (which hasn't bean so much still...) I have stumbeled across a few issues:

1. Namespace naming...

If I want to have something like a default namespace "Netmedia.ProjectName.BLL" and connect it to the equvivalent project in VS.NET, how do I do this ? I have tried to set a "Namespace root" for the package, but it doesnt work correctly (depending on where the object is, it ether adds a full namespace like Logical View/...., or it adds only the last package in it's hierarchy (BLL in my case)), or Iam missing something ? (my project layout in EA is: Logical View/Objects/BLL/...)

2. Readonly properties + attributes

Also can you help me please, and tell me how can I get the following code generated:

Private _myAtt As String

Public ReadOnly Property MyAtt() As String
Get
        Return _myAtt
End Get
End Property

If I try to turn of the "Write" part of the property (editing the attribute > then selecting property) I get something like:

Public Property MyAtt() As String
Get
        Return _myAtt
End Get
End Property

which is not correct,

of if I try to edit the property itself and apply the readonly attribute to it, I get:

Public Readonly Property MyAtt() As String
Get
        Return _myAtt
End Get
Set (byval value as string)
        _myAtt = value
End Set
End Property

which is again not correct ???

3. When I generate the code I get in almost every class that is not in the root package an Import PackageName statement, which again is not correct...

is there a way to solve this / these issues ?

thank you in advance,
Vladan

P.S. I really like your tool, and hope if we can solve a couple of these issues that we will have a good cooperation between our companies.
thanks,
Vladan Strigo,
NETMedia

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: EA 4.1.739: Some issues, please advise
« Reply #1 on: November 10, 2004, 01:56:22 pm »
Hello Vladan,

You are on the right track with setting the namespace root, but how it works is that you set the namespace root for any package at the root level.  So your packages under that package generate namespaces in the code.

To generate a readonly property first create the Get part of the property.  That will have created a new method in your class with the stereotype <<property>>.
Edit this operation and click the Advanced button.  Select ReadOnly from the list.

Then when you generate your code it will be readonly.

I'd need more details to help with your problem of incorrectly generated import statements.  So if you could give more details that would be great.  What is meant to happen here is that the appropriate import statement for every class that is needed by the classes in that file.

I'd also like to mention that there are code generation templates that allow customization of what is generated and there is also quite a few options that can be set that change how it works too.

Simon

Vladan_Strigo

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: EA 4.1.739: Some issues, please advise
« Reply #2 on: November 16, 2004, 02:40:51 am »
Hi Simon,

Quote
Hello Vladan,

You are on the right track with setting the namespace root, but how it works is that you set the namespace root for any package at the root level.  So your packages under that package generate namespaces in the code.


I still have the problem with the namespaces, but I've been able to bypass that by creating a new Root node called "CompanyName" and in it project like "Application" as a view, and in the view packages that correspond to my projects in VS.NET (like "BLL", "DAL", etc...) do you know a better way to do this ? (and have EA generate the correct namespace like "CompanyName.ApplicationName.ProjectName")

Quote
To generate a readonly property first create the Get part of the property.  That will have created a new method in your class with the stereotype <<property>>.
Edit this operation and click the Advanced button.  Select ReadOnly from the list.

Then when you generate your code it will be readonly.


This works now, altho I would suggest a little more user friendly approach to this in the future, it's a bit confusing (my idea was if you turn off the "read" or "write" part of the property that it automaticly gets the deserved "readonly" or "writeonly" attribute


Quote
I'd need more details to help with your problem of incorrectly generated import statements.  So if you could give more details that would be great.  What is meant to happen here is that the appropriate import statement for every class that is needed by the classes in that file.

I'd also like to mention that there are code generation templates that allow customization of what is generated and there is also quite a few options that can be set that change how it works too.

Simon



ok, about this part...

if I have something like:

RootNode is called "Netmedia"
Inside it a View is called "ApplicationName"
Inside that view I have a package called "BLL" which is something like my root package, inside that package I have two levels down:

Netmedia
---- ApplicationName
--------- Entities
------------- CategoryEntites
------------- ProductEntites
------------- *...Entites

and if I have inside of "ProductEntites" 2 classes, like "Class1" and "Class1Collection" which uses "Class1"

in the Class1Collection I will have:


Imports Entites.ProductEntites; (Plus the VBNet syntax does not have a ";")


Namespace Entites.ProductEntites

     Public Class Class1Collection

           Public _class1 As Class1

     End Class ' Class1Collection

End Namespace ' ProductEntites


which is not correct, because this Imports statement does not belong here.

so can you please tell me where to turn this off, or where in the templates I can find this (I've searched, but do not see it...)


ok, one last issue I found out for code generation is... I want my packages from the project in EA to be created as folders in my project in VS.NET (if you see the example from above with thoose sub packages, example is this:

Netmedia
---- ApplicationName
--------- Entities
------------- CategoryEntites
------------- ProductEntites
------------- *...Entites

any idea how to acomplish this ? (I've also tried to generate code, put then the classes into some directories named as packages, but EA afterwards just doesnt see them, and generates them again in the root of the project)


ok, thx allot for your efforts
hope to hearing from you soon
Vladan
thanks,
Vladan Strigo,
NETMedia

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
Re: EA 4.1.739: Some issues, please advise
« Reply #3 on: November 16, 2004, 11:10:00 pm »
Quote
I still have the problem with the namespaces, but I've been able to bypass that by creating a new Root node called "CompanyName" and in it project like "Application" as a view, and in the view packages that correspond to my projects in VS.NET (like "BLL", "DAL", etc...) do you know a better way to do this ? (and have EA generate the correct namespace like "CompanyName.ApplicationName.ProjectName")


I think setting packages herarchy same as in namespace path you want is the only way in EA. creating your own main pckage and then down the herarchy. I work with C++ not VB but it generated code fine for me (at least after being send some XML template to import by sparxs), and it looks like it works ok for you too.
it is a good way to force you designers to work properly (at least I'm happy to have mine working like this ;) )
Recursion definition:
If you don’t understand the definition read "Recursion definition".

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: EA 4.1.739: Some issues, please advise
« Reply #4 on: November 17, 2004, 04:20:32 pm »
Quote
do you know a better way to do this ? (and have EA generate the correct namespace like "CompanyName.ApplicationName.ProjectName")

I would create the package stucture to generate that namespace by creating a package "CompanyName" below "Logical Model" (And the appropriate packages below that.)  Set the namespace root on "Logical Model" and not on any other packages.  If this doesn't generate the correct namespace then either my instructions are ambiguous and you've interpreted them incorrectly (as I'm hoping happened with my previous post) or there is something wrong.

The "ReadOnly" user interface problem is because there is a difference between a property containing the "ReadOnly" keyword and one that only has a "Get".  The current behaviour is because a ReadOnly property is effectively stronger than one that only has a Get.  It may have been an incorrect assumption about the way VB.Net programmers (which we aren't) would use properties that resulted in not generating "ReadOnly" by default.  This has been changed when new properties are created for build 740 based on the comments of a few users including yourself.

I can happily say that the problem with the erroneous semi-colon will be fixed for build 740.  (Why is it that after I find a bug for myself I get a flow of bug reports about it?)

Let me just clarify, you don't want the Imports statement generated because the class being generated is in the same namespace as the Imports statement.  I am looking into correcting this at the moment.

In the mean time look at the "Import Section" template and remove the %fileImports% macro to stop all Imports statements being generated.  For more information look at the following thread where I described how to customise the Imports statements generated.  Except the template for VB.Net would look something like the following.

Code: [Select]
%if importPackagePath!=""%
Imports %importPackagePath%
%endIf%

To generate your files to folders based on the package structure try using the package generate dialog.  (One way to get it is Project | Source Code Engineering | Generate Package Source Code)  Select "Auto Generate Files" that should do what you want.