Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Frank Crow on March 27, 2013, 12:02:13 pm
-
We are following a SoaML service interface scheme. That means that, in the PIM, the client provided responses are "conjugate" interfaces and are named as the primary interface with a leading tilde.
I'm creating new classes on transformation that realize these interfaces, but I want to give them more meaningful names. Transformation like this:
- WidgetFactory becomes WidgetFactoryService
- ~WidgetFactory becomes WidgetFactoryClient
I think that I could use some for of %if%, variable assignment and an expression, but I can't seem to figure it out from the documentation. Any advice greatly appreciated.
Thanks,
Frank
[/list]
-
This achieves what I think you are after:
Class Template %elemType%
{
%TRANSFORM_REFERENCE("Class")%
$first = %LEFT(className, 1)%
%if $first=="~"%
name=%qt%%MID(className, 1)%Client%qt%
%else%
name=%qt%%className%Server%qt%
%endIf%
}
But I question if you don't actually want a server and client generated out of the same class as follows.
Class Template %elemType%
{
%TRANSFORM_REFERENCE("Client")%
name=%qt%%className%Client%qt%
}
%elemType%
{
%TRANSFORM_REFERENCE("Server")%
name=%qt%%className%Server%qt%
}
Potentially linking them as shown at http://www.sparxsystems.com/enterprise_architect_user_guide/9.3/model_transformation/transform_connectors.html
-
Excellent, thanks!
-Frank
:) :) :)