Book a Demo

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Stephane B

Pages: [1] 2 3
1
Suggestions and Requests / Tabs in MDA Transform exports
« on: May 21, 2013, 07:42:32 pm »
Hello,

I noticed that tabs in model transformation templates are not escaped to "	" while exporting to xml.
This is sad because when I parse the XML (so as to extract the templates to individual text files), all the tabs are changed to spaces*

That would be nice to fix that in future versions.

Thanks,
Stéphane

*according to the W3C specification : http://www.w3.org/TR/2006/REC-xml-20060816/#AVNormalize

2
General Board / Re: Pattern not found in model's resources
« on: July 19, 2013, 06:12:31 pm »
Great, it works! Many thanks.

In my toolbox definition I had PatternGroup::PatternName(UMLPattern), which is the right way when I import patterns and toolboxes model wide. But in order to have my patterns available up to the MDG Tech scope, it's indeed TechID::PatternName(UMLPattern).
The id, not even the name of the MDG Tech. I wouldn't have imagined that.

Some of my patterns included images that I lost in the process though...

3
General Board / Re: Pattern not found in model's resources
« on: July 19, 2013, 12:14:08 am »
I have the same problem except that I created an MDG Technology that includes patterns and a toolbox.

Still when I drag my patterns from my toolbox : "Pattern not found in model's resources".

I wonder why is that so. Does that mean the patterns should be installed in the model/project and their presence in the MDG technology not be sufficient? In that case what the use of including a pattern in an MDG tech ?

4
General Board / Re: Error while generating DDL : Database not defi
« on: July 18, 2013, 07:17:14 pm »
Yes indeed,

It's a two-step process : PIM class -> PSM Datamodel -> Generate DDL.

During first step, the data model template does picks the database property from general options and fills the field in the created class. If the general option was left blanked at that time, then the property is not set in the created class.

But during the second step, the DDL generator won't look at the general database option if your class' Database property is blank. I thought it could have...

I did set the option after step 1, hence the trouble.

5
General Board / Re: Error while generating DDL : Database not defi
« on: July 15, 2013, 07:06:47 pm »
OK, got it. There is a "Database" property that must be define on each «table»class.

Don't know why the default from Options doesn't apply when this field is left blank. *sigh*

6
General Board / Error while generating DDL : Database not defined
« on: July 15, 2013, 06:35:44 pm »
Hi everyone,

I'm trying to generate DDL from a data model, but I get an error pop-up saying "myclass: Database not defined". What am I doing wrong?

I understood that it normally happens when there is no target database defined in Tools > Options > Code Editors > Default database. I tried with several (PostgreSQL, MySQL...) with no success.

In the same file, I have a data model that generates the DDL fine, and a data model with which the error occurs. I checked the same options in both. I noticed that in the data model that doesn't work, the checkbox "IF EXISTS" next to "Create Drop SQL" is missing. Any clue ?

I'm using EA 9.0

Thanks for your help.


7
General Board / Re: Transformation. Copy field into new table.
« on: July 16, 2013, 07:34:18 pm »
Priviet!

If you just want an Id attribute and no real connection between these classes, and if you know by advance that the newly created class will be Capital, then it's rather easy.

Code: [Select]
+-------------+
|  Namespace  |
+-------------+

$COMMENT="Create your Capital Class in a suitable package.""
$COMMENT="Let's say you want it in the same package as your other classes."

%list="Class"%

Class {

      $COMMENT = "Give this class a good XRef in case you have to point to it"
      %TRANSFORM_REFERENCE("Capital")%
      name = "Capital"
      notes = "Manually created class"

      Attribute {
      ...
      }
}

+----------------+
|  Class         |
+----------------+

Class {
      
      %list="Attribute"%
}

+----------------+
|  Attribute     |
+----------------+

%if attType == "A"%
$newAttName = %attName% + "Id"

Attribute {
      

      type = "long"
      name = %qt%$newAttName%qt%

}
%endTemplate%

$COMMENT="continue with whatever you had in Attribute"

If, on the other hand, you have type A = City, and you want to dynamically create a new class (table) for each attribute that is a city, then it's more complicated.
Like if Country has a Capital attribute of type City(=A), and a MainCity of type City(=A) you create a new table Capital and a new table MainCity. And every time you meet an attribute of type City you create a new table by the attribute's name... (btw you just reinvented inheritance). I can see solutions, but first tell me if that is what you want to do.

8
General Board / Re: Some questions related to code generation / C+
« on: June 04, 2013, 06:18:58 pm »
Quote
user defined macros can be created? I've searched for such a possibility but did not found it.

After all, macros are nothing more than templates (or am I missing something?) with Template Type set to "<none>" and their names in upper case (by convention). But the IDE won't provide autocompletion.

Quote
The user guide doesn't tell much about this topic (just short description of existing but not all macros)

I'm afraid that's pretty much all there is. There are few macros in EA, but except the MATH_XXX, they are in the manual.

9
General Board / Re: Some questions related to code generation / C+
« on: June 03, 2013, 11:05:24 pm »
Quote
I'm invoking a list because your version will not work for me. The template will do nothing resulting in a line like "m_member = ;" with no parametername.

Have you tried with parentheses at the end of your call?

Quote
All attributes begin with m_ which is not wished

This seems to be an option in Tools >Options > Source code engineering > Attributes/Operations > Default name for associated.

Quote
if a way exist that I can convert the name in the right way

EA provides text handling macros (left, mid, right, trim, convert_name, to_lower, to_upper, find...). My advice is: build your own text handling macro that suits your needs and call it:
Code: [Select]
%MY_TEXT_HANDLING%($paramName)%In the template, you grab the argument like this:
Code: [Select]
$src = $parameter1
For instance, I made myself a LAST_INSTANCE_OF macro.
You have math macros that let you count characters, which are not in any EA user guide  : MATH_ADD, MATH_SUB, MATH_MULT.
Last caution : the RIGHT macro has a bug (%RIGHT("foo", "2")% renders "oo" but  %RIGHT("foo", "3")% yields "". Go figure...)

Do you perform a model transformation before the code generation? I always do a two step generation for Java: MDA transformation from platform independant model to Java specific model, then code generation. My imports are solved two ways : either I create a Dependency connector between my classes, or I add a tagged value to my class:
Code: [Select]
Tag{name="imports" value="import com.whatever.class;"}.
Both at MDA transform time.

Then I tuned the java code generation Class template to print the content of this tagged value by adding the line :
Code: [Select]
%classTag:"imports"%I think that could solve (part of) your namespace problem (though I don't know namespacing in C++).

Stéphane

10
General Board / Re: Some questions related to code generation / C+
« on: May 31, 2013, 01:42:28 am »
Hi,

New to EA too, and just gone though this kinda stuff (not for C++, which I don't know though).

About topic2 :
Quote
I know this can cause errors when a operation with more than one parameter has the stereo type "property set". So if there's still a better solution I'd like to know. A better solution I could think of is to access the first parameter, but I didn't found anything how I could implement that in the templates.

If your operation has several parameters, it will not cause an error, it will just concatenate the outputs of your mytemplate applied on each parameter.

But why invoke a list (which is a "foreach") when you have one parameter to your setter :
Code: [Select]
%elseIf opStereotype == "property set" and opTag:"attribute_name" != ""%
\t%opTag:"attribute_name"% = %Parameter__MyTemplate%;

(If your template is typed as Parameter, I guess it should be called Parameter__MyTemplate or something alike).

And what about this opTag:"attribute_name" ? Isn't it the name you want? or maybe with a conversion :

Code: [Select]
%elseIf opStereotype == "property set" and opTag:"attribute_name" != ""%
$paramName = %opTag:"attribute_name"%
$paramName = %CONVERT_NAME($paramName, "pascal case", "camel case")%
\t%opTag:"attribute_name"% = $paramName%;

to.4
Indeed, Namespace templates are not about declaring imports. What they do is process a package. Typically, Namespace calls itself to recursively enter the packages and reach the classes.

Hope this helps,

Stéphane

11
General Board / Re: WSDL: WS-addressing for wsdl:portType operatio
« on: May 07, 2013, 10:09:08 pm »
First of all, if it were to work, it would be a tagged value on the operation parameter, not on the operation. It is where you put the "use = "literal" tag.

Unfortunately, I tried a reverse+forward enginnering of an existing WSDL with your ws-addressing attribute : the attribute is lost in the process. Only the "use" tag is kept. Other tags are filtered out by the WSDL generation. As it is a built-in feature, I don't see how to customize it.

Stéphane.

12
General Board / Re: Tagged Value Note in Intermediary Language
« on: April 27, 2013, 01:25:16 am »
Reply to self... That was :

Tag {
        name = "xmlns"
        value = "<memo>"
        notes = "xmlns:xs=http://www.w3.org/2001/XMLSchema"
}

Reading the EA SDK guide sometimes help  ::)

13
General Board / Tagged Value Note in Intermediary Language
« on: April 26, 2013, 08:47:26 pm »
Hello all,

In Model Transformation, I'm trying to create an element that has a note attached to a tagged value. How am I supposed to write that in intermediary language ?

Some precisions :
-working with EA v9 (if relevant)
-I'm trying to generate a WSDL structure. If you look at a WSDL generated by EA, you will see that the XMLNS prefix-namespace associations are defined in a tagged value note. The note is attached to a tagged value which name is "xmlns" and which value is <memo>.

Thanks,
Stéphane


14
Bugs and Issues / Re: TemplateBinding error on model transformation
« on: October 25, 2013, 09:08:56 pm »
Yep, I asked a similar(ly unanswered) question. Thanks for the Generalization tip ; missed it.
If I understand well, you are doing a two-step PIM to C#Specific Model to C# code. In this case, there could be a hacky solution to get your substitution parameter back:

1st, you tune the PIM to C#model transformation to put the value of your substitution parameter in a particular tagged value, say "ParameterSubstitution".

2nd, you tune the C# code template so that when it encounters such tagged value, it outputs "<"+%Tag:ParameterSubstitution%+">".

Did something resembling with imports. Should work. Let us know.

Stéphane

15
Bugs and Issues / CTF : "if" statements are case INsensitive
« on: August 09, 2013, 11:57:30 pm »
Hello,

I noticed that, in code templates and transformation templates, if statements are case insensitive.

Firstly, this is the opposite of what if written in the user guide :
Quote
If conditional statements on strings are case sensitive, "a String" does not equal "A STRING". Hence in some situations it is better to set the variable $str= TO_LOWER(variable) or TO_UPPER(variable) then compare to a specific case.

Secondly, IMHO equality tests should be case sensitive, because you can always simulate insensitivity with TO_LOWER, but not the other way around. And for my own use, I don't want the same behaviour for operations returning long and Long.

Is it a bug in EA10 or a wrongness in the user guide ?

Thanks for your answers,

Stéphane

Pages: [1] 2 3