I recently was asked how to set failure rate mode of a "Failable" the right way. The attribute is of type FailureRateMode, but any attempt to set it failed, neither
element.failureRateMode = Metamodel.safetyModel.FailureRateMode.FROM_PARENT
nor
element.failureRateMode = "FROM_PARENT"
did work.
Well the reason behind is an obstacle in the way how Enumerations value are passed and represented in the Metamodle singleton (the EMF Enumerator basically). I don#t want to bore you with details but just tell the solution.
Whenever sou want to set an Enumeration value, you need to add ".instance" to it. So basically:
element.failureRateMode = Metamodel.safetyModel.FailureRateMode.FROM_PARENT.instance
should do the trick.
Happy Scripting
Jan