6 Replies Latest reply on May 21, 2018 8:15 AM by smacdonald2008

    How to Override @Propertyoption value from run mode specific configuration ?

    prakashr29290235

      Dear All,

       

      I have created a OSGI component to read some user related setting from the /system/console/configMgr. The code for OSGI component is some thing like this.

       

      @Component(name = "Profile Configuration", immediate = true, metatype = true)
      public class ProfileConfiguration {
      
      
      @Property(name = "User Name", value = "", description = "Profile username", label = "Enter User Name")
      private static final String USER_NAME = "user.name";
      private String username;
      
      
      @Property(name = "Password", description = "Profile username", label = "Enter User Name", passwordValue = "")
      private static final String PASSWORD = "user.password";
      private String password;
      
      
      @Property(name = "Gender", description = "Gender", label = "Gender", options = {
      @PropertyOption(name = "Male", value = "male"),
      @PropertyOption(name = "Female", value = "female") }, value = "female")
      private static final String GENDER = "user.gender";
      private String gender;
      
      protected void activate(Map<String, Object> props){
      this.username = (String) props.get(USER_NAME);
      this.password  = (String) props.get(PASSWORD);
      this.gender = (String) props.get(GENDER);
      }
      
      
      }
      

       

       

      I want to overide the value of gender from runmode specific configuration from CRXDELITE .  I have created a sling:OsgiConfig node config folder in config folder in project structure whose name is com.practice.core.felix.osgi.samplecomponent.ProfileConfiguration. And when i supplied user.gender -> male (String). I am able to see the overridden value in the felix console. However, Gender field is showing as TextField instead of dropdown.

       

      Could you please help?

       

       

       

      Thanks,

      Prakash