Home > Java, Life on Marama > Marama Code 122 ~ How to create entity and its attributes in Marama tool model automatically

Marama Code 122 ~ How to create entity and its attributes in Marama tool model automatically

Marama tool model is the diagram used to define tool project tool meta-model. To help user define the test tool (to be used with Marama model project), user need to specify the test tool shape properties. From there, a number of test entity (based on level of test) will be create automatically.

Due to the fact that when Marama tool model there is no underlying model created for it, the normal code to create shape cannot be applied to Marama tool model, shape definer and view definer. Here is the code to create and set the entity shape for Marama tool model:

MaramaShape testShape = this.createNewShape(MaramaConstants.ENTITY_METAMODEL_SHAPE, x, y, shapeWidth, shapeHeight); // create the entity shape
testShape.setPropertyValue(“name”, “TestSuite”); // set the attribute

MaramaShape testAttribute = this.createNewShape(MaramaConstants.ATTRIBUTE_SHAPE, x + 5, y + 5, shapeWidth, shapeHeight); // create the entity attribute shape
testAttribute.setPropertyValue(“iskey”, “key”); // set the attribute
testAttribute.setPropertyValue(“name”, “tid”);
testAttribute.setPropertyValue(“type”, “String”);

        processSubshapeAdded(testAttribute);

Hope you will understand it. Cheers.

p/s: credit to Jun for showing it to me

Categories: Java, Life on Marama
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.