MagicDraw 18.5 Documentation

Skip to end of metadata
Go to start of metadata

Operation
name

DescriptionExample
Timestamp

The operation returns current system time in milliseconds as a string type value. It takes no parameters.

Result = “1392798008000”
FormatDate

The operation converts a date and time given in milliseconds to a human readable format.

The operation takes two parameters:

  • Date – a date and time in milliseconds that should be converted to a human readable format. It must be a string type value and can be the result of a Timestamp operation.
  • Format – a date and time format for the conversion. It must be a string type value. For the date and time formats, refer to the SimpleDateFormat page.

The result of this operation is a string type value.

Date = “1392798008000”

Format = “yyyy.MM.dd G 'at'
HH:mm:ss z”

Result = “2014.02.19 AD at
10:20:08 EET”

ParseDate

The operation converts a date and time in a human readable format to milliseconds. In other words, the operation reverses the result of the FormatDate operation (it returns the value that can be the Date parameter for a FormatDate operation).

The operation takes two parameters:

  • Format – a current format of the date and time that should be converted to milliseconds. It must be a string type value.
  • Formatted Date – a date and time that should be converted to milliseconds. It must be a string type value.

The result of this operation is a string type value.

Format = “yyyy.MM.dd G 'at'
HH:mm:ss z”

Formatted Date =
“2014.02.19 AD at 10:20:08
EET”

Result = “1392798008000”

TypeTest

The operation tests, whether the type of an element matches a given type or stereotype. If the types matches, it returns true, and if they not – false.

You can also use this operation to check, if an element is an instance of a given classifier.

The operation takes three parameters:

  • Element – a model element, whose type you need to test.
  • Type – a type, stereotype, or classifier for testing the element.
  • Include Subtypestrue, if the inherited types, stereotypes, or classifiers of the selected Type parameter value should be included in the test; false, if not.

The TypeTest operation can be used in the Filter operation as the condition. For this, click the Use as Condition of a new Filter operation button on the Type Test operation specification panel.


Element = class Profile
Type = Class
Include Subtypes = false

Result = true

The element type matches the given type.

Element = class Profile
Type = Classifier
Include Subtypes = true

Result = true

Though the element type does not match the given type, it is its subtype, and in this case subtypes are included in the test.

Element = class Profile
Type = Classifier
Include Subtypes = false

Result = false

Thought the element type is a subtype of the given type, in this case subtypes are not included in the test.

Filter

The operation analyses given collection of elements (one by one) and returns only those elements that meet the specified filter criteria.

The operation takes two parameters:

  • Input Collection – an arbitrary collection of elements of arbitrary types.
  • Condition – an operation determining filter criteria. Keep in mind that this operation must have exactly one input parameter and return a result of boolean type! Otherwise, the Filter operation fails and returns no value. Hence, if you need to use the script operation with many parameters as the filter criteria, you must wrap it inside the nested operation (the TypeTest operation or any other built-in operation is wrapped automatically).

The result of this operation is collection of elements as well.

Input Collection =

use case Log in
use case Log out
actor User
use case Change password

Condition = TypeTest:

Element = Input Collection
Type = UseCase
Include Subtypes = false

Result Collection =

use case Log in
use case Log out
use case Change password

InstanceNavigation

The operation finds the needed slot of the given instance and returns one or more values of that slot.

The operation takes two parameters:

  • Instance – an instance specification (instance), whose slot value you need to access.
  • Navigate Property – a property, whose slot you need to find.

The result type of this operation matches the type of the property specified as the Navigate Property parameter.

Instance = WN345AB
Navigate Property = Year

Result = “1999”

 

  • No labels