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.CopletBaseData; 23 import org.apache.cocoon.portal.profile.impl.CopletBaseDataManager; 24 25 32 public class CopletBaseDataFieldHandler extends AbstractFieldHandler { 33 34 public Object getValue(Object object) { 35 Map map = ((CopletBaseDataManager) object).getCopletBaseData(); 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 CopletBaseData(); 47 } 48 49 public void resetValue(Object object) { 50 ((CopletBaseDataManager) object).getCopletBaseData().clear(); 51 } 52 53 public void setValue(Object object, Object value) { 54 CopletBaseData data = (CopletBaseData) value; 55 ((CopletBaseDataManager) object).getCopletBaseData().put( 56 data.getId(), 57 data); 58 } 59 } 60 | Popular Tags |