Class AutomatonMacroAPI

java.lang.Object
com.nomagic.magicdraw.automaton.AutomatonMacroAPI

@OpenApiAll public class AutomatonMacroAPI extends Object
The Class AutomatonMacroAPI. API to be called by script. WARNNING: Class signature shouldn't be changed. Some method signature souldn't be changed. It will impact ByteCode generation.
  • Field Details

    • METHOD_NAME_GET_PROP_VALUE

      public static final String METHOD_NAME_GET_PROP_VALUE
      The Constant METHOD_NAME_GET_PROP_VALUE.
      See Also:
    • METHOD_NAME_SET_PROP_VALUE

      public static final String METHOD_NAME_SET_PROP_VALUE
      The Constant METHOD_NAME_SET_PROP_VALUE.
      See Also:
  • Constructor Details

    • AutomatonMacroAPI

      public AutomatonMacroAPI()
  • Method Details

    • createElement

      public static Object createElement(String metaName) throws Exception
      Creates the new dsl element. (User script API)
      Parameters:
      metaName - the dsl meta name
      Returns:
      the object
      Throws:
      Exception - the exception throws when cannot create Element with meta-class names metaName
    • createRelationship

      public static Object createRelationship(com.nomagic.magicdraw.automaton.AutomatonOpaqueObject source, com.nomagic.magicdraw.automaton.AutomatonOpaqueObject target, String relationName) throws Exception
      Creates the relationship. (User script API)
      Parameters:
      source - the source
      target - the target
      relationName - the relation name
      Returns:
      opaque object of relation element
      Throws:
      Exception - the exception throws when not found a relation for relationName
    • getOpaqueObjectByPath

      public static Object getOpaqueObjectByPath(String elementPath) throws Exception
      New dsl instance. (User script API)
      Parameters:
      elementPath - the element path
      Returns:
      the object
      Throws:
      Exception - the exception throws when not found an element for path elementPath
    • getOpaqueObject

      public static Object getOpaqueObject(Object element)
      Gets the opaque object.
      Parameters:
      element - the element
      Returns:
      the opaque object
    • getPropertyValue

      public static Object getPropertyValue(com.nomagic.magicdraw.automaton.AutomatonOpaqueObject macroObj, String name, String qualifierPath)
      Gets the property value. (User script API) WARNNING: Do not change this method signature. It will impact ByteCode generation
      Parameters:
      macroObj - the macroObj
      name - the name
      qualifierPath - the qualifierPath
      Returns:
      the property value
    • getPropertyValue

      public static Object getPropertyValue(com.nomagic.magicdraw.automaton.AutomatonOpaqueObject macroObj, String name, String qualifierPath, boolean withException)
    • setPropertyValue

      public static void setPropertyValue(com.nomagic.magicdraw.automaton.AutomatonOpaqueObject macroObject, String name, String qualifierPath, Object value) throws Exception
      Sets the property value. (User script API) WARNNING: Do not change this method signature. It will impact ByteCode generation
      Parameters:
      macroObject - the macroObject
      name - the name
      qualifierPath - the qualifierPath
      value - the value
      Throws:
      Exception - the exception throws when cannot set the property value
    • getOpaqueMetaClass

      public static com.nomagic.magicdraw.automaton.AutomatonOpaqueObject getOpaqueMetaClass(String name)
    • removeElement

      public static void removeElement(Object obj) throws jakarta.activation.UnsupportedDataTypeException, Exception
      Removes the element. (User script API)
      Parameters:
      obj - the obj
      Throws:
      jakarta.activation.UnsupportedDataTypeException - the unsupported data type exception
      Exception - the exception throws when not found the element
    • addStereotype

      public static Object addStereotype(com.nomagic.magicdraw.automaton.AutomatonOpaqueObject marcoElement, com.nomagic.magicdraw.automaton.AutomatonOpaqueObject marcoStereotype) throws Exception
      Adds the stereotype. (User script API)
      Parameters:
      marcoElement - the element
      marcoStereotype - the stereotype
      Returns:
      a new opaque object which contains getters and setters with regards to the applied stereotype's properties.
      Throws:
      Exception - the exception throws when marcoStereotype is not a stereotype
    • addStereotypeByStereotypeName

      public static Object addStereotypeByStereotypeName(com.nomagic.magicdraw.automaton.AutomatonOpaqueObject marcoElement, String stereotypeName) throws Exception
      Adds the stereotype by stereotype name. (User script API)
      Parameters:
      marcoElement - the marco element
      stereotypeName - the stereotype name
      Returns:
      the object
      Throws:
      Exception - the exception throws when not found a stereotype for stereotypeName
    • removeStereotype

      public static Object removeStereotype(com.nomagic.magicdraw.automaton.AutomatonOpaqueObject marcoElement, com.nomagic.magicdraw.automaton.AutomatonOpaqueObject marcoStereotype) throws Exception
      Removes the stereotype. (User script API)
      Parameters:
      marcoElement - the o element
      marcoStereotype - the o stereotype
      Returns:
      the object
      Throws:
      Exception - the exception throws when marcoStereotype is not a stereotype or element doesn't contain the stereotype
    • removeStereotypeByStereotypeName

      public static Object removeStereotypeByStereotypeName(com.nomagic.magicdraw.automaton.AutomatonOpaqueObject marcoElement, String stereotypeName) throws Exception
      Removes the stereotype by stereotype name. (User script API)
      Parameters:
      marcoElement - the marco element
      stereotypeName - the stereotype name
      Returns:
      the object
      Throws:
      Exception - the exception throws when marcoStereotype is not a stereotype or element doesn't contain the stereotypeName
    • getSelectedElementFromContainmentTree

      public static Object getSelectedElementFromContainmentTree() throws Exception
      Gets the selection model. (User script API)
      Returns:
      the selection model
      Throws:
      Exception - the exception
    • getModelData

      public static Object getModelData() throws Exception
      Gets the model data. (User script API)
      Returns:
      the model data
      Throws:
      Exception - the exception
    • printElementDetail

      public static void printElementDetail(Object eObj) throws jakarta.activation.UnsupportedDataTypeException
      Prints the element detail. (User script API)
      Parameters:
      eObj - the element
      Throws:
      jakarta.activation.UnsupportedDataTypeException - the unsupported data type exception
    • convertSettingValue

      protected static Object convertSettingValue(Object value)
      Convert opaque to element value.
      Parameters:
      value - the value
      Returns:
      the object
    • convertGettingValue

      protected static Object convertGettingValue(Object result, com.nomagic.magicdraw.automaton.AutomatonOpaqueObject macroObj, String name, String qualifierPath, boolean needCommitted)
      Convert element to opaque.
      Parameters:
      result - the result
      Returns:
      the object