Topic
14 replies Latest Post - ‏2012-12-05T13:36:56Z by SystemAdmin
SystemAdmin
SystemAdmin
1305 Posts
ACCEPTED ANSWER

Pinned topic ReporterPLUS Template

‏2012-11-20T14:59:58Z |
I am trying to build a reporterPLUS template that pulls package level and class level CLASS diagrams. I don't see an option to extract the class diagrams...only object model, sequence, activity, etc. Rhapsody allows you to create class diagrams, but I do not see the option to extract only the class diagrams using reporterPLUS. I'm wondering if there is a secret...

I would like to follow this path:
1) Open the package.
2) Check for Class Diagrams (Package Level)
3) Check for Object Model Diagrams (Package Level)
4) Open the Classes Folder
5) Open the Class
6) Check for Class & Object Model Diagrams. (Class Level)

Can someone help me with this? Have an example template?
Updated on 2012-12-05T13:36:56Z at 2012-12-05T13:36:56Z by SystemAdmin
  • Vipsy
    Vipsy
    37 Posts
    ACCEPTED ANSWER

    Re: ReporterPLUS Template

    ‏2012-11-20T15:19:51Z  in response to SystemAdmin
    Class diagrams don't come into Rep+ by default but you can get them via loading references.
    For this you need to set the below entry in the .ini file :
    ReporterPLUS
    EnableLoadOptions=TRUE
    LoadElementReferences=TRUE

    and then they should appear on Rep+.See screenshot.
    • SystemAdmin
      SystemAdmin
      1305 Posts
      ACCEPTED ANSWER

      Re: ReporterPLUS Template

      ‏2012-11-20T16:05:57Z  in response to Vipsy
      Thanks for your quick response.

      Are you referring to the Rhapsody.ini file?

      I took a look and I did not see anything like this in the file...so I added it.

      Is this correct?
      • SystemAdmin
        SystemAdmin
        1305 Posts
        ACCEPTED ANSWER

        Re: ReporterPLUS Template

        ‏2012-11-20T20:53:14Z  in response to SystemAdmin
        Hello,

        I updated rhapsody.ini file with the settings provided by Vipsy( as you already did) and references were available.
        I attached a sample template that you can use it as a starting point.
        Remark: the diagrams created on level package will appear also for all contained classes.

        Maybe Vipsy will provide a solution to have on class level section only the diagrams for which the owner is the class, not the package.

        Regards,
        Ramona
    • SystemAdmin
      SystemAdmin
      1305 Posts
      ACCEPTED ANSWER

      Re: ReporterPLUS Template

      ‏2012-11-20T20:16:43Z  in response to Vipsy
      Hello Vipsy,

      Good to know these properties.
      I have one remark: the class diagrams from package level will appear twice in the generated document: first in the package level section, second in the contained classes level section.

      Regards,
      Ramona
      • SystemAdmin
        SystemAdmin
        1305 Posts
        ACCEPTED ANSWER

        Re: ReporterPLUS Template

        ‏2012-11-21T20:44:28Z  in response to SystemAdmin
        Thanks so much for both of your replies.

        Ramona: You were heading down the path of my next question.

        When I'm in a class/iteration, I only want to print the class/object model diagrams for that particular class...not every class/object diagram listed in the references list. The references list of diagrams shows diagrams where the class you're currently in isn't the owner...

        What expression should I use to extract this information?

        Thanks Ramona and Vipsy for your help!!
        • Vipsy
          Vipsy
          37 Posts
          ACCEPTED ANSWER

          Re: ReporterPLUS Template

          ‏2012-11-22T09:39:02Z  in response to SystemAdmin
          See attached.I have used an expression in a text element to print the right diagrams.
        • Champagne
          Champagne
          42 Posts
          ACCEPTED ANSWER

          Re: ReporterPLUS Template

          ‏2012-11-22T09:44:15Z  in response to SystemAdmin
          Hi
          Sorry to butt in there are two possible ways to do this, if there is just one diagram you are after the easiest way to do this is to set the MainDiagram on the class to the ObjectModelDiagram you would like, then your iteration could be to the MainDiagram rather than through the references.
          If this will not do because you have more than one diagram then the following Q should do the trick
          <Specific Object>this->references{$metaClass="ObjectModelDiagram" and $fullPathName ~= $fullPathName of this}

          <Specific Object> meand ignore the instructions in the iteration
          the rest of the expression defines the path to the objects you are interested in so this reads from this object to its references with this condition applied (*{*) where the $metaClass is equal to ObjectModelDiagram and where the $fullPathName (of the objects you find in the references) ~= (contains) the $fullPathName of this (the current object we used at the beginning of the expression)

          The path of your class will be * <<Path to the class>>::<<class name>> * and the Path to the ObjectModelDiagrams created beneath the class is <<Path to the class::<<class name>>::<<diagram name>>

          If you have nested classes with diagrams of their own you may have to be a little more specific, along the lines of
          <Specific Object>this->references{$metaClass="ObjectModelDiagram" and $fullPathName = $fullPathName of this+"::"+$name}

          Hope this helps.

          Paul
          • SystemAdmin
            SystemAdmin
            1305 Posts
            ACCEPTED ANSWER

            Re: ReporterPLUS Template

            ‏2012-11-26T14:40:36Z  in response to Champagne
            Paul/Vipsy,

            Thanks again for your help on this.

            Vipsy: I did a print out of $name of this. It prints the name of the class diagram. I'm looking for... 1) Is it a class diagram, then 2) Is the $name of owner match the "name of the current iteration/class I'm in". If so, then 3) Print diagram...

            Paul: Where can I find great documentation on the Q language? The help contents don't help much...I would like to understand the syntax a little more. I kept running into errors trying to implement what you sent. I would like to try it. Do you have an example template that contains this example?

            Thanks again for both of your help on this.
            • SystemAdmin
              SystemAdmin
              1305 Posts
              ACCEPTED ANSWER

              Re: ReporterPLUS Template

              ‏2012-11-26T16:44:22Z  in response to SystemAdmin
              Had a second thought. If I'm in a leaf, how do I pull the name of the branch or tree? I think this is what I'm trying to do overall.

              If I'm iterating references, how do I somehow take a peek at the current class I'm in, pull the name, and match against the owner of the referenced model element?
          • SystemAdmin
            SystemAdmin
            1305 Posts
            ACCEPTED ANSWER

            Re: ReporterPLUS Template

            ‏2012-11-26T20:20:49Z  in response to Champagne
            Vipsy/Paul,

            I've been looking at some of the other posts on this topic but none of them seem to work...I've been trying various things all day today.

            "Using Q language in ReporterPLUS to check an attribute in a parent node." had the following:

            if there_exists x in owner->baseClassifiers->attribute => $name = "patt" and $attDefaultValue = "20" then $name else "" but it does not work for me.

            Then the posts that have <Specific Object> do not work for me either.

            Could you please help me discover what I'm doing wrong?

            Thanks
            • Champagne
              Champagne
              42 Posts
              ACCEPTED ANSWER

              Re: ReporterPLUS Template

              ‏2012-11-27T17:23:00Z  in response to SystemAdmin
              Hi,
              You may be falling in between two views of the model here.
              Though I may have missed the point...

              If you want to report the owner of an element in the model the Q language would be $name of owner this will work in most cases thought I think that in the case of Activity Diagrams nested under classes then the owner it would report would be the package and not the class.

              The code quoted navigates up the inheritance as well so this is looking up to see if the class this class inherits from has an attribute named "patt" with a default value of "20" and if it has it will print the name of the current class

              Breaks down this way

              if ( there_exists x in <<collection>> => <<expression to test for>> ) then $name else ""

              From THIS OBJECT X Find the collection of attributes at the end of [owner]->[baseClassifiers]->[attribute]
              If it is true that there_exists in this collection an element with the name "patt" and a default value of "20"
              Then "print" $name (but this is the name of THIS OBJECT X
              Else
              Don't print anything.
            • Champagne
              Champagne
              42 Posts
              ACCEPTED ANSWER

              Re: ReporterPLUS Template

              ‏2012-11-28T11:26:48Z  in response to SystemAdmin
              Hi
              Sorry I got interrupted part way through.

              Do you have a temple you can post so I can take a guess as to whats wrong?

              Based on your first post I have attached a template adapted from the one posted earlier which should list

              Project
              Package
              Diagrams For package
              Classes
              Diagrams for classes
              Nested Classes (recursive)
              Diagrams for classes
              Nested Packages (recursive)
              Diagrams For package
              Classes
              Diagrams for classes
              Nested Classes (recursive)
              Diagrams for classes

              If this helps (I think it works ... probably)

              Anyway if you post your template I'll have a look at it and see if I can spot any gotchas.

              As for a Q language guide I've not seen a good one.
              • SystemAdmin
                SystemAdmin
                1305 Posts
                ACCEPTED ANSWER

                Re: ReporterPLUS Template

                ‏2012-12-05T13:36:56Z  in response to Champagne
                Champagne,

                Yes, this worked for me. Appreciate your help. I would like to further understand the Q Language that you used here. I'm going to re-read your previous post for understanding.

                I'm trying to do other things now like...I don't want to print certain packages, but I can't get my syntax correct within the Advanced Condition panel. My main issue before was that I was inputting your suggestion in the wrong panel...never noticed the Advanced condition panel until now.

                I would like to say..."only print package names that aren't named 'XXX' and 'YYY'" somehow.

                I will surf around the forum to see if this has been answered.

                Again, thank you and Vipsy very much for your help. I will ping you with more questions later.