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