1 Reply Latest reply on Apr 28, 2013 6:49 AM by sahar

    Set property by Value type

    sahar

      Hi,I'm newbie in modeshape.

       

      I have an email node with CC property ( Value[] type) that get multi  userNode's path (as String)

      in my Bean class i have a cc variable with Value[] type

      for set this variable I use this :


      EmailBean emailBean=new EmailBean();

      emailBean.setCc(emailNode.getProperty("CC").getValues());

       

      how can I set  value for the emailBean.CC Variable with VALUE type ?

      I will be appreciate if any body help me.

      Thank you

        • 1. Re: Set property by Value type
          sahar

          I could find the answer in http://forums.adobe.com/message/4885946http://

           

          Node pageNode=currentPage.getContentResource().adaptTo(Node.class);

          Value vs[]=new Value[0];

          List<Value> employeeIdList=new ArrayList<Value>();

          for(Value v : pageNode.getProperty("mytest").getValues()) {

             if(v!=null){

                  employeeIdList.add(v);

             }

          }

          ValueFactory vFactory=pageNode.getSession().getValueFactory();

          Value newValue=vFactory.createValue("nextvalue");

          employeeIdList.add(newValue);

          Value[] finalValues=(Value[])employeeIdList.toArray(vs);

          pageNode.setProperty("mytest",finalValues);