Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL]struts-config rules with MoDisco generix XML Model(Accessing formBean from action name)
[ATL]struts-config rules with MoDisco generix XML Model [message #667706] Sun, 01 May 2011 14:44 Go to next message
Rob is currently offline RobFriend
Messages: 17
Registered: February 2011
Junior Member
Hello

I'am doing a transformation on struts-config.xml with Modisco generic XML Model.

suppose having following simple struts config:

<struts-config>
    <formBeans>
        <formBean name="myBean" type="my.beans.MyBeanClass" />
        <formBean name="anotherBean" type="my.beans.AnotherBeanClass" />
    </formBeans>
    <action-mappings>
        <action path="/myPath" name="myBean" scope="session" />
        <action path="/anotherPath" name="anotherBean" scope="request" />
    </action-mapping>
</struts-config>


As you can see, the formBean name is referenced in the action-mappings with the name attribute again.

Suppose I would like to create an information model putting together some of the information from the struts config in a target model like

    <info name="myPath" scope="session" type="my.Beans.MyBeanClass" />



lazy rule CreateTypeAttribute {
  from
  	src : Xml!Attribute
  to
  	target : Xml!Attribute  (
  		name <- 'type'
  		value <-  ?????
  	)


At the point of the ????? I could easily get the name "myBean" from the action element, but what I would like to do at this place is, do a lookup in the formBeans section for the formBean by the referencedName "myBean" and retrieve the type information from it to put it in the target model.

Is there a best practice how to solve this?

I am not quite sure how to access other parts of the model because from my understanding the model parser is within the action section of the source model now. So how can I access the corresponding type information in the formBean section from this position?

Many thx in advance

Rob

[Updated on: Sun, 01 May 2011 14:50]

Report message to a moderator

Re: [ATL]struts-config rules with MoDisco generix XML Model [message #667725 is a reply to message #667706] Sun, 01 May 2011 18:04 Go to previous message
Rob is currently offline RobFriend
Messages: 17
Registered: February 2011
Junior Member
Never mind. Smile

I was able to manage it now.

If it is of interest. My solution is based on the idea with passing parameters in
http:// wiki.eclipse.org/ATL_Howtos#How_do_I_use_extern_parameters_i n_ATL_transformations.3F.

But another maybe stupid question. Wink

Is it possible to define local variables in helpers?


Thx

Rob
Previous Topic:[ATL] Transform EString identifier to EReference
Next Topic:[ATL] "Quick Fix" and syntax checker does not work
Goto Forum:
  


Current Time: Fri Apr 26 09:49:25 GMT 2024

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

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

Back to the top