Accessing CORBATypedef bounded string length by API

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Accessing CORBATypedef bounded string length by API

Postby chris.garrison@gtri.gatech.edu » Mon Dec 19, 2022 12:09 pm

I am having difficulty accessing (via API) the bounded length of a string in a CORBA IDL project. It is a string that can only be x characters long. ex:
Code: Select all
  typedef string<10> stringThatCanOnlyBeTenCharsLong;


I reverse engineered an IDL to model the bounded string. MD appears to have modeled the data correctly because when I attempt a round trip and generate a new IDL from the imported model, it works. The bounded string shows up correctly. MD modeled the bounded length as a Template Binding...??? No clue.

See below for screenshot of a string in the model
[img]https://drive.google.com/file/d/1BDnUwILAttIbAZxTChI9fMnxHWud1LLo/view?usp=sharing
[/img]

When I make api calls via java plugin for MD, I can only seem to get strings describing the Template Binding, Template Parameter Solutions fields, etc. ...not the actual values. I just need to get the "10" from the example above.

Code: Select all
Iterator<Relationship> relIter = ele.get_relationshipOfRelatedElement().iterator();
                  while (relIter.hasNext()) {
                     Relationship rel = relIter.next();
                     if (rel.getClassType().getName().endsWith("TemplateBinding")) {
                        // NOTE: I AM ABLE TO GET TO THE TEMPLATE BINDING OBJECT - but I can't get the the actual length - just descriptions like Template Parameter Substitution, Template Binding, Literal String, etc.
                        TemplateBinding binding = (TemplateBinding) rel;
                        Collection al =  binding.getParameterSubstitution();
                        Iterator <TemplateParameterSubstitution> substitutionIter = al.iterator();
                        while (substitutionIter.hasNext()) {
                           TemplateParameterSubstitution paramSub = (TemplateParameterSubstitution) substitutionIter.next();
                           logger.debug(" ------->>paramSub.getHumanName());  "+ paramSub.getHumanName());
                           logger.debug(" ------->>paramSub.getHumanType());  "+ paramSub.getHumanType());
                           logger.debug(" ------->>paramSub.getFormal());  "+ paramSub.getFormal());
                           logger.debug(" ------->>paramSub.getFormal().getHumanName());  "+ paramSub.getFormal().getHumanName());
                           logger.debug(" ------->>paramSub.getOwnedActual());  "+ paramSub.getOwnedActual());
                           logger.debug(" ------->>paramSub.getOwnedActual().getHumanName());  "+ paramSub.getOwnedActual().getHumanName());
                           logger.debug(" ------->>paramSub.getActual());  "+ paramSub.getActual());
                           logger.debug(" ------->>paramSub.getActual()_elementValueOfElement...);  "+ paramSub.getActual().get_elementValueOfElement());
                           logger.debug(" ------->>paramSub.getActual().getHumanName());  "+ paramSub.getActual().getHumanName());
                           logger.debug(" ------->>paramSub.getTemplateBinding());  "+ paramSub.getTemplateBinding());
                           logger.debug(" ------->>paramSub.getTemplateBinding().getHumanName());  "+ paramSub.getTemplateBinding().getHumanName());
                           logger.debug(" ------->>paramSub.get_elementValueOfElement();  "+ paramSub.get_elementValueOfElement());

                           }
                        }


Any help on how to get the actual value? I've tried several other 'sys.out.print' types of debugging, but it all results in the same.
chris.garrison@gtri.gatech.edu
Forum Newbie
Forum Newbie
 
Posts: 2
Posts Rating:0
Joined: Tue Dec 06, 2022 12:40 pm

Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 1 guest

cron