1 16 package org.apache.cocoon.portal.util; 17 18 import org.apache.cocoon.portal.coplet.CopletData; 19 import org.apache.cocoon.portal.coplet.CopletInstanceData; 20 21 28 public class CopletDataReferenceFieldHandler extends ReferenceFieldHandler { 29 30 public Object getValue(Object object) { 31 CopletData copletData = ((CopletInstanceData) object).getCopletData(); 32 if (copletData != null) { 33 return copletData.getId(); 34 } 35 return null; 36 } 37 38 public Object newInstance(Object parent) { 39 return new CopletData(); 40 } 41 42 public void resetValue(Object object) { 43 ((CopletInstanceData) object).setCopletData(null); 44 } 45 46 public void setValue(Object object, Object value) { 47 CopletData copletData = (CopletData) getObjectMap().get(value); 48 if (copletData == null) { 49 throw new ProfileException( 50 "Referenced Coplet Data " + value + " does not exist."); 51 } 52 ((CopletInstanceData) object).setCopletData(copletData); 53 } 54 } 55 | Popular Tags |