ID

Hi Community!

I'm trying to get the tagged values of a stereotype and I cannot.

I am using this code for getting the stereotype but afterwards cannot find a method for its values:

var estereotipos = atributo.omfGetApplicableStereotypes().toArray()

I am sending a pic of what Im looking for.

Thank you!

File attachments
by Thomas Andres
Posted on Tue, 05/21/2019 - 16:07

Hi,

in order to get the tagged values of a UML element you have to analyse its stereotype applications. The following code snippet shows how to do this:

// Get all stereotype applications of the UML element

var stereotypeApplications = umlElement.omfGetStereotypeApplications();

// Iterate over the stereotype applications of the UML element

for (var itStereotypeApplications = stereotypeApplications.iterator(); itStereotypeApplications.hasNext();) {

    var stereotypeApplication = itStereotypeApplications.next();

    

    if (!stereotypeApplication.omfIsValid()) {

        // skip this stereotype application if it is not valid

        continue;

    }

    

    // Get the applied stereotype

    var stereotype = stereotypeApplication.omfGetAppliedStereotype();

    

    // Get all attributes of the stereotype

    var stereotypeAttributes = stereotype.getAllAttributes();

    

    // Iterate over all stereotype attributes

    for (var itStereotypeAttributes = stereotypeAttributes.iterator(); itStereotypeAttributes.hasNext();) {

        var stereotypeAttribute = itStereotypeAttributes.next();

        

        // Get the corresponding tagged value

        var taggedValue = stereotypeApplication.omfGet(stereotypeAttribute, null);

    }

}

There is an example report "Create and assign profile" in the report category "UML sample scripts". Although it's more about creating profiles and stereotypes, applying them to UML elements and specifying tagged values, it should give some more information how to deal with stereotypes in a report script, e.g. how to access profiles, stereotypes and stereotype attributes by their name.

Regards,

Thomas Andres

0
by Ignacio De Diego Author
Posted on Wed, 05/22/2019 - 16:06

Thanks a lot it worked for me !!

 

Ignacio

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks
  • Profile picture for user frankweise
  • Profile picture for user Henrik Buckler
  • Profile picture for user UffeK
  • SS
  • MZ
  • PacMan

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock