1 16 package org.apache.cocoon.portal.util; 17 18 import java.util.Iterator ; 19 import java.util.Map ; 20 import java.util.Vector ; 21 22 import org.apache.cocoon.portal.coplet.CopletData; 23 import org.apache.cocoon.portal.profile.impl.CopletDataManager; 24 25 32 public class CopletDataFieldHandler extends AbstractFieldHandler { 33 34 public Object getValue(Object object) { 35 Map map = ((CopletDataManager) object).getCopletData(); 36 Vector result = new Vector (map.size()); 37 38 Iterator iterator = map.values().iterator(); 39 while (iterator.hasNext()) 40 result.addElement(iterator.next()); 41 42 return result; 43 } 44 45 public Object newInstance(Object parent) { 46 return new CopletData(); 47 } 48 49 public void resetValue(Object object) { 50 ((CopletDataManager) object).getCopletData().clear(); 51 } 52 53 public void setValue(Object object, Object value) { 54 CopletData data = (CopletData) value; 55 ((CopletDataManager) object).getCopletData().put(data.getId(), data); 56 } 57 } 58 | Popular Tags |