This content has been marked as final.
Show 1 reply
-
1. Re: Set property by Value type
sahar Apr 28, 2013 6:49 AM (in response to 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);