[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.m2m] [ATL] transforming UML to EJB

Hi all,

Please, tell me if I am not in the wrong place. I am trying to transform some UML model to an EJB model. The "parameter" target pattern is not working, and I think I need a lot more "distinct-foreach" !!! It seems that I need just one big "rule" with every possible target pattern there .

Thanks,
-walcir

=== UML model ====
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xmlns="UML">

<DataType name="String"/>
<DataType name="Integer"/>
<Class name="BreakfastOrder">
<feature xsi:type="Operation" name="calculatePrice">
<parameter name="year_price" type="/1"/>
<parameter name="rate" type="/1"/>
</feature>
<feature xsi:type="Attribute" name="deliveryStatus" type="/0"/>
<feature xsi:type="Attribute" name="deliveryDate" type="/0"/>
<feature xsi:type="AssociationEnd" name="customer" lower="1" upper="1" otherEnd="/3/@feature.3"/>
<feature xsi:type="AssociationEnd" name="breakfasts" lower="1" upper="-1" composition="true" otherEnd="/4/@feature.2"/>
</Class>
</xmi:XMI>
==== EJB model ====
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="EJB">
<EJBEntityComponent name="BreakfastOrder" usedTable="/1">
<feature xsi:type="EJBAttribute" name="deliveryStatus"/>
<feature xsi:type="EJBAttribute" name="deliveryDate"/>
<feature xsi:type="EJBAssociationEnd" name="customer" lower="1" upper="1"/>
<feature xsi:type="EJBAssociationEnd" name="breakfasts" lower="1" upper="-1" composition="true"/>
<feature xsi:type="EJBBusinessMethod" name="calculatePrice">
<parameter name="year_price" type="/1"/>
<parameter name="rate" type="/1"/>
</feature>
</EJBEntityComponent>
<Table/>
</xmi:XMI>





And I am using an ATL code like this:

.. some helpers deleted here ...
lazy rule kkkk {
	from umlOper : UML!Operation
	to Parameters : distinct EJB!EJBParameter
	   	foreach (par in umlOper.parameter) (
	   			name <- par.name	
	   		)	
}

rule ClassToEntityComponent{
	from class : UML!Class
	    ( not class.isAComposition()  )
	to entityComponent : EJB!EJBEntityComponent (
		name <- class.name.debug('debug here'),
        feature <- ATTRS->union(ASSOCENDS)->union(OPERS),
        usedTable <- EJBTable
	),
	EJBTable : EJB!Table (
	),
	OPERS : distinct EJB!EJBBusinessMethod
	  foreach (oper in class.operations()) (
	    name <- oper.name,
	    parameter <- oper->collect(e | thisModule.kkkk(e))
	),
	ATTRS : distinct EJB!EJBAttribute
	   foreach (attr in class.attributes())(
		  name <- attr.name
	),
	ASSOCENDS : distinct EJB!EJBAssociationEnd
	   foreach (assocEnd in class.getAssociationEnds())(
		  name <- assocEnd.name,
		  lower <-assocEnd.lower,
		  upper <- assocEnd.upper,
		  composition <- assocEnd.composition
	   )
}