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