3 Replies Latest reply on May 17, 2013 11:28 AM by lincolnthree

    Transfer info from a plugin to a facet

      Hello,

       

      Is there a good way to transfer some data from a plugin to a facet.

      I have an option in the plugin that I would like to transfer to the facet.

       

      // Mikael

        • 1. Re: Transfer info from a plugin to a facet
          lincolnthree

          I would just add a method on the facet and pass in what you need Is that helpful at all? If not, then I'm not really sure I understand what you are asking.

          • 2. Re: Transfer info from a plugin to a facet

            Today I create the facet like this:

             

            event.fire(new InstallFacets(CamelRoutePrjFacet.class));

             

            But there isn't any way to pass along any initial data here.

             

            but I now see that the is a project.installFacet as well, maybe this should be used instead.

            Or is best practice to create it with an event and then use the project.getFacet?

             

            I now see that there are a lot of Facet functions in the project class, so I'll try this instead

            project.getFacet(CamelRoutePrjFacet.class).setPrjDescription(prjDescription);

             

            Thanks

            // Mikael

            • 3. Re: Transfer info from a plugin to a facet
              lincolnthree

              You could also try using a @ProjectScoped context object to hold any transfer data that you need. But there may be a bug that prevents doing that in Facets, if I recall correctly. I would use the project.installFacet() methods, as you discovered. That's probably a safe route!