Announcement Announcement Module
Collapse
No announcement yet.
How to update fields/relationships/entities afterwards Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to update fields/relationships/entities afterwards

    Hi,

    I am discovering Roo at the moment and everything seem great!

    I have a question though: how can we update actions done earlier through Roo? More specifically, how to update aspects with Roo?

    For example I do that first:

    Code:
    field --fieldName lastname --class Employee
    But then I want to change lastname to lastName and cascading this change to every aspects generated by Roo, how can we do that?

  • #2
    If the Roo Shell is open for your project, just change the field name directly in the java source code.

    Roo will detect that the file has changed, and will cascade the changes.

    Comment


    • #3
      Ok damnly simple... But then in the same vein if I deleted something by error (some jsp files for example) how can I regenerate them?

      Comment


      • #4
        Indeed, the regeneration of some Web artifacts needs some better handling. At the moment you could simply delete the controller as well and then just issue the 'controller scaffold' command again for the entity you want to provide scaffolding for.

        Cheers,
        Stefan

        Comment


        • #5
          Originally posted by Stefan Schmidt View Post
          Indeed, the regeneration of some Web artifacts needs some better handling. At the moment you could simply delete the controller as well and then just issue the 'controller scaffold' command again for the entity you want to provide scaffolding for.

          Cheers,
          Stefan
          I did just that:
          -1. deleted my scaffolded controller, roo shell noticed
          -2. deleted my views for it
          -3. added two fields
          -4. reissued controller scaffold for the entity

          However the new fields are not showing up in the edit form. They are however displayed in show.jsp

          Any guesses?
          Last edited by mirror303; Dec 20th, 2009, 05:00 AM. Reason: added note about show.jsp

          Comment


          • #6
            Which version of Roo are you using? Please try out Roo RC4 and take a look at the upgrade section in the included documentation where we describe which artifacts to delete and which commands to issue. If you still have issues, I would be very interested in some more details so we can replicate your problem and fix it .

            Cheers,
            Stefan

            Comment


            • #7
              Hi Stefan,

              My app (just a prototype for now) was created with RC4. I got started with RC3, carefully recorded my commands so i was able to just replay the script. I hadn't really done any programming yet myself so upgrading was really easy, i just discarded my old project

              I went through the information in the upgrade section of the manual as you said and could not find anything that applies to my situation.

              So I suppose you want to get more info from me? Basically my case was like this:

              The domain class is called Customer, the two fields I added are called shippingAddress and billingAddress are simple strings, with notNull, sizeMin and sizeMax defined. I manually modified the class to implement Serializable.

              This is all I can think of right now...

              Comment


              • #8
                Can you please share the exact steps you did so I can replicate your issue. A step by step guide would help here. It would be good if you can also share your script.

                Cheers,
                Stefan

                Comment


                • #9
                  If I read between the lines, I think there is a feature request in here --

                  Roo command history per project, that can be dumped and sent back for bug reports

                  Comment


                  • #10
                    Originally posted by Jabberz View Post
                    If I read between the lines, I think there is a feature request in here --

                    Roo command history per project, that can be dumped and sent back for bug reports
                    In fact that (much requested) feature already exists . Sorry I have not made this clear. When issuing commands in Roo RC4 it will create a log.roo file in the root of your project and that contains all commands you have issued. So if you start the Roo shell and then type 'backup' a zip archive will be created which contains that script. So all you have to do is to send me the zip file.

                    However, I would also need to know what steps you have taken outside the roo shell (changed java files (Serializable, etc)) and in which exact sequence you have taken these steps (ie. first I ran the attached script, then I added two fields in the Entities Java source, which should have updated the view artifacts). Also, it would be good to know if the Roo shell indicated any problems (ie errors, rollbacks etc). You can also run Roo shell in 'development mode' which will actually give you stack traces, etc.

                    Cheers,
                    Stefan

                    Comment


                    • #11
                      Originally posted by Jabberz View Post
                      If I read between the lines, I think there is a feature request in here --

                      Roo command history per project, that can be dumped and sent back for bug reports
                      RC4 already creates a log.roo...

                      The weird thing is that it does not seem to be working when the roo shell is used from within STS.

                      Comment


                      • #12
                        Originally posted by Stefan Schmidt View Post

                        However, I would also need to know what steps you have taken outside the roo shell (changed java files (Serializable, etc)) and in which exact sequence you have taken these steps (ie. first I ran the attached script, then I added two fields in the Entities Java source, which should have updated the view artifacts). Also, it would be good to know if the Roo shell indicated any problems (ie errors, rollbacks etc). You can also run Roo shell in 'development mode' which will actually give you stack traces, etc.

                        Cheers,
                        Stefan
                        Hi,

                        This might take a while

                        I have been issueing quite a few commands in the roo shell from within STS, and like i said, they did not get appended to log.roo.

                        I also messed around with the project in other ways quite a bit (modified pom.xml, added webflow.version and spring security.version properties), so there can be many things causing this. I will try to get it replayable, but there's a few things i need to secure before that

                        Thanks a bunch for your help so far.

                        Comment


                        • #13
                          found workaround

                          I completely deleted both the scaffolded controller, its views and the domain class, then regenerated both with roo.

                          Comment


                          • #14
                            STS 2.3.0 offers Roo command history recording. It is implemented by STS code as opposed to the normal Roo shell code. If it's not working with STS 2.3.0 would you please log a bug report and steps to reproduce at https://issuetracker.springsource.com/browse/STS. Thanks!

                            Comment


                            • #15
                              issue created

                              https://issuetracker.springsource.com/browse/STS-724

                              Comment

                              Working...
                              X