Hi, I have a problem using DataboundConstructor. 
I am currently writing a jenkins plugin and I have a class called 
RemoteDeploymentBuilder  whose constructor is defined like this: 

@DataBoundConstructor
    public RemoteDeploymentBuilder(Profil profil, String environment, 
String component, String version)
    {
        this.profil = profil;
        this.environment = environment;
        this.component = component;
        this.version = version;
    }

Actually, I have a problem saving the profil parameter. The Profil class 
and subclass are defined like this (this plugin is very similar to Dropdown 
list in UI Sample plugin) :

public static abstract class Profil implements Describable < Profil >
    {

        protected String name;

        protected Profil(String name)
        {
            this.name = name;
        }

        public Descriptor < Profil > getDescriptor()
        {
            return Jenkins.getInstance().getDescriptor(getClass());
        }
    }

    public static class ProfilDescriptor extends Descriptor < Profil >
    {

        public ProfilDescriptor(Class < ? extends Profil > clazz)
        {
            super(clazz);
        }

        @Override
        public String getDisplayName()
        {
        LOGGER.info(">> Name = " + clazz.getSimpleName());
            return clazz.getSimpleName();
        }
    }

    public static class Jahia extends Profil
    {
        private String tomcatService, jahiaWebApp;

        @DataBoundConstructor
        public Jahia(String tomcatService, String jahiaWebApp)
        {
            super("deploy-jahia-module");
            this.tomcatService = tomcatService;
            this.jahiaWebApp = jahiaWebApp;
        }

        public String getTomcatService()
        {
            return tomcatService;
        }

        public String getJahiaWebApp()
        {
            return jahiaWebApp;
        }

        @Extension
        public static final ProfilDescriptor descriptor = new 
ProfilDescriptor(Jahia.class);

    }

    public static class Scala extends Profil
    {
        private String scalaRootDir;

        @DataBoundConstructor
        public Scala(String scalaRootDir)
        {
            super("deploy-play-module");
            this.scalaRootDir = scalaRootDir;
        }

        public String getScalaRootDir()
        {
            return scalaRootDir;
        }

        @Extension
        public static final ProfilDescriptor descriptor = new 
ProfilDescriptor(Scala.class);
    }


Jahia class and Scala class have their own config.jelly. 
I would like to save the properties  tomcatService, jahiaWebApp,  
scalaRootDir. 
How can I do that? 

I tried using the @DataboundConstructor but it does not work. 



Reply via email to