cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util CopletDataReferenceFieldHandler.java CopletBaseDataReferenceFieldHandler.java CopletDataFieldHandler.java DeltaApplicable.java ParameterFieldHandler.java CopletInstanceDataFieldHandler.java AspectDataFieldHandler.java DeltaApplicableReferencesAdjustable.java ConfigurationFieldHandler.java CopletBaseDataFieldHandler.java AttributesFieldHandler.java ReferenceFieldHandler.java
Date Fri, 13 Jun 2003 14:20:10 GMT
cziegeler    2003/06/13 07:20:10

  Modified:    src/blocks/portal/java/org/apache/cocoon/portal/util
                        CopletDataReferenceFieldHandler.java
                        CopletBaseDataReferenceFieldHandler.java
                        CopletDataFieldHandler.java DeltaApplicable.java
                        ParameterFieldHandler.java
                        CopletInstanceDataFieldHandler.java
                        AspectDataFieldHandler.java
                        DeltaApplicableReferencesAdjustable.java
                        ConfigurationFieldHandler.java
                        CopletBaseDataFieldHandler.java
                        AttributesFieldHandler.java
                        ReferenceFieldHandler.java
  Log:
  Code formatting
  
  Revision  Changes    Path
  1.2       +25 -30    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletDataReferenceFieldHandler.java
  
  Index: CopletDataReferenceFieldHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletDataReferenceFieldHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CopletDataReferenceFieldHandler.java	26 May 2003 14:29:52 -0000	1.1
  +++ CopletDataReferenceFieldHandler.java	13 Jun 2003 14:20:09 -0000	1.2
  @@ -60,38 +60,33 @@
    * 
    * @version CVS $Id$
    */
  -public class CopletDataReferenceFieldHandler 
  -extends ReferenceFieldHandler {
  +public class CopletDataReferenceFieldHandler extends ReferenceFieldHandler {
   
  -	public void checkValidity(Object object)
  -	{
  -	}
  +    public void checkValidity(Object object) {
  +    }
   
  -	public Object getValue(Object object) 
  -	{
  -		CopletData copletData = ((CopletInstanceData)object).getCopletData();
  -		if (copletData != null) {
  -			return copletData.getId();
  -		} else {
  -			return null;
  -		}
  -	}
  +    public Object getValue(Object object) {
  +        CopletData copletData = ((CopletInstanceData) object).getCopletData();
  +        if (copletData != null) {
  +            return copletData.getId();
  +        } else {
  +            return null;
  +        }
  +    }
   
  -	public Object newInstance(Object parent)
  -	{
  -		return new CopletData();
  -	}
  +    public Object newInstance(Object parent) {
  +        return new CopletData();
  +    }
   
  -	public void resetValue(Object object)
  -	{
  -		((CopletInstanceData)object).setCopletData(null);
  -	}
  +    public void resetValue(Object object) {
  +        ((CopletInstanceData) object).setCopletData(null);
  +    }
   
  -	public void setValue(Object object, Object value)
  -	{
  -		CopletData copletData = (CopletData)getObjectMap().get(value);
  -		if (copletData == null)
  -			throw new IllegalArgumentException("Referenced Coplet Data "+value+" does not exist.");
  -		((CopletInstanceData)object).setCopletData(copletData);
  -	}
  +    public void setValue(Object object, Object value) {
  +        CopletData copletData = (CopletData) getObjectMap().get(value);
  +        if (copletData == null)
  +            throw new IllegalArgumentException(
  +                "Referenced Coplet Data " + value + " does not exist.");
  +        ((CopletInstanceData) object).setCopletData(copletData);
  +    }
   }
  
  
  
  1.2       +31 -34    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletBaseDataReferenceFieldHandler.java
  
  Index: CopletBaseDataReferenceFieldHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletBaseDataReferenceFieldHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CopletBaseDataReferenceFieldHandler.java	26 May 2003 14:29:52 -0000	1.1
  +++ CopletBaseDataReferenceFieldHandler.java	13 Jun 2003 14:20:09 -0000	1.2
  @@ -53,7 +53,6 @@
   import org.apache.cocoon.portal.coplet.CopletBaseData;
   import org.apache.cocoon.portal.coplet.CopletData;
   
  -
   /**
    * Field handler for external CopletBaseData references.
    *
  @@ -61,38 +60,36 @@
    * 
    * @version CVS $Id$
    */
  -public class CopletBaseDataReferenceFieldHandler 
  -extends ReferenceFieldHandler {
  -
  -	public void checkValidity(Object object)
  -	{
  -	}
  -
  -	public Object getValue(Object object) 
  -	{
  -		CopletBaseData copletBaseData = ((CopletData)object).getCopletBaseData();
  -		if (copletBaseData != null) {
  -			return copletBaseData.getId();
  -		} else {
  -			return null;
  -		}
  -	}
  -
  -	public Object newInstance(Object parent)
  -	{
  -		return new CopletBaseData();
  -	}
  +public class CopletBaseDataReferenceFieldHandler
  +    extends ReferenceFieldHandler {
   
  -	public void resetValue(Object object)
  -	{
  -		((CopletData)object).setCopletBaseData(null);
  -	}
  +    public void checkValidity(Object object) {
  +    }
   
  -	public void setValue(Object object, Object value)
  -	{
  -		CopletBaseData copletBaseData = (CopletBaseData)getObjectMap().get(value);
  -		if (copletBaseData == null)
  -			throw new IllegalArgumentException("Referenced Coplet Base Data "+value+" does not exist.");
  -		((CopletData)object).setCopletBaseData(copletBaseData);
  -	}
  +    public Object getValue(Object object) {
  +        CopletBaseData copletBaseData =
  +            ((CopletData) object).getCopletBaseData();
  +        if (copletBaseData != null) {
  +            return copletBaseData.getId();
  +        } else {
  +            return null;
  +        }
  +    }
  +
  +    public Object newInstance(Object parent) {
  +        return new CopletBaseData();
  +    }
  +
  +    public void resetValue(Object object) {
  +        ((CopletData) object).setCopletBaseData(null);
  +    }
  +
  +    public void setValue(Object object, Object value) {
  +        CopletBaseData copletBaseData =
  +            (CopletBaseData) getObjectMap().get(value);
  +        if (copletBaseData == null)
  +            throw new IllegalArgumentException(
  +                "Referenced Coplet Base Data " + value + " does not exist.");
  +        ((CopletData) object).setCopletBaseData(copletBaseData);
  +    }
   }
  
  
  
  1.2       +28 -35    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletDataFieldHandler.java
  
  Index: CopletDataFieldHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletDataFieldHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CopletDataFieldHandler.java	26 May 2003 14:29:52 -0000	1.1
  +++ CopletDataFieldHandler.java	13 Jun 2003 14:20:09 -0000	1.2
  @@ -58,7 +58,6 @@
   import org.apache.cocoon.portal.profile.impl.CopletDataManager;
   import org.exolab.castor.mapping.FieldHandler;
   
  -
   /**
    * Field handler for CopletData instances.
    *
  @@ -66,38 +65,32 @@
    * 
    * @version CVS $Id$
    */
  -public class CopletDataFieldHandler 
  -implements FieldHandler {
  +public class CopletDataFieldHandler implements FieldHandler {
  +
  +    public void checkValidity(Object object) {
  +    }
   
  -	public void checkValidity(Object object)
  -	{
  -	}
  -
  -	public Object getValue(Object object) 
  -	{
  -		Map map = ((CopletDataManager)object).getCopletData();
  -		Vector result = new Vector(map.size());
  -		
  -		Iterator iterator = map.values().iterator();
  -		while (iterator.hasNext())
  -			result.addElement(iterator.next());
  -		
  -		return result;
  -	}
  -
  -	public Object newInstance(Object parent)
  -	{
  -		return new CopletData();
  -	}
  -
  -	public void resetValue(Object object)
  -	{
  -		((CopletDataManager)object).getCopletData().clear();
  -	}
  -
  -	public void setValue(Object object, Object value)
  -	{
  -		CopletData data = (CopletData)value;
  -		((CopletDataManager)object).getCopletData().put(data.getId(), data);
  -	}
  +    public Object getValue(Object object) {
  +        Map map = ((CopletDataManager) object).getCopletData();
  +        Vector result = new Vector(map.size());
  +
  +        Iterator iterator = map.values().iterator();
  +        while (iterator.hasNext())
  +            result.addElement(iterator.next());
  +
  +        return result;
  +    }
  +
  +    public Object newInstance(Object parent) {
  +        return new CopletData();
  +    }
  +
  +    public void resetValue(Object object) {
  +        ((CopletDataManager) object).getCopletData().clear();
  +    }
  +
  +    public void setValue(Object object, Object value) {
  +        CopletData data = (CopletData) value;
  +        ((CopletDataManager) object).getCopletData().put(data.getId(), data);
  +    }
   }
  
  
  
  1.3       +4 -3      cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/DeltaApplicable.java
  
  Index: DeltaApplicable.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/DeltaApplicable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DeltaApplicable.java	22 May 2003 15:19:44 -0000	1.2
  +++ DeltaApplicable.java	13 Jun 2003 14:20:09 -0000	1.3
  @@ -58,6 +58,7 @@
    * @version CVS $Id$
    */
   public interface DeltaApplicable {
  +
   	/**
   	 * Applies the specified delta.
   	 * @return true if the delta could be successfully applied, false otherwise.
  @@ -65,10 +66,10 @@
   	 * by the caller instead of a delta being applied.
   	 * @throws ClassCastException If the object is not of the expected type.
   	 */
  -	public boolean applyDelta(Object object);
  +	boolean applyDelta(Object object);
   	
   	/**
   	 * Checks if a delta has been applied.
   	 */
  -	public boolean deltaApplied();
  +	boolean deltaApplied();
   }
  
  
  
  1.2       +30 -33    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ParameterFieldHandler.java
  
  Index: ParameterFieldHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ParameterFieldHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParameterFieldHandler.java	26 May 2003 14:29:52 -0000	1.1
  +++ ParameterFieldHandler.java	13 Jun 2003 14:20:09 -0000	1.2
  @@ -65,40 +65,37 @@
    * 
    * @version CVS $Id$
    */
  -public class ParameterFieldHandler
  -implements FieldHandler
  -{
  -	public void checkValidity(Object object)
  -	{
  -	}
  +public class ParameterFieldHandler implements FieldHandler {
  +    
  +    public void checkValidity(Object object) {
  +    }
   
  -	public Object getValue(Object object) 
  -	{
  -		HashMap map = new HashMap();
  -		Iterator iterator = ((Parameters)object).getParameters().entrySet().iterator();
  -		Map.Entry entry;
  -		Object key;
  -		while (iterator.hasNext()) {
  -			entry = (Map.Entry)iterator.next();
  -			key = entry.getKey();
  -			map.put(key, new MapItem(key, entry.getValue()));
  -		}
  -		return map;
  -	}
  +    public Object getValue(Object object) {
  +        HashMap map = new HashMap();
  +        Iterator iterator =
  +            ((Parameters) object).getParameters().entrySet().iterator();
  +        Map.Entry entry;
  +        Object key;
  +        while (iterator.hasNext()) {
  +            entry = (Map.Entry) iterator.next();
  +            key = entry.getKey();
  +            map.put(key, new MapItem(key, entry.getValue()));
  +        }
  +        return map;
  +    }
   
  -	public Object newInstance(Object parent)
  -	{
  -		return new MapItem();
  -	}
  +    public Object newInstance(Object parent) {
  +        return new MapItem();
  +    }
   
  -	public void resetValue(Object object)
  -	{
  -		((Parameters)object).getParameters().clear();
  -	}
  +    public void resetValue(Object object) {
  +        ((Parameters) object).getParameters().clear();
  +    }
   
  -	public void setValue(Object object, Object value)
  -	{
  -		MapItem item = (MapItem)value;
  -		((Parameters)object).getParameters().put(item.getKey(), item.getValue());
  -	}
  +    public void setValue(Object object, Object value) {
  +        MapItem item = (MapItem) value;
  +        ((Parameters) object).getParameters().put(
  +            item.getKey(),
  +            item.getValue());
  +    }
   }
  
  
  
  1.2       +30 -35    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletInstanceDataFieldHandler.java
  
  Index: CopletInstanceDataFieldHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletInstanceDataFieldHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CopletInstanceDataFieldHandler.java	26 May 2003 14:29:52 -0000	1.1
  +++ CopletInstanceDataFieldHandler.java	13 Jun 2003 14:20:09 -0000	1.2
  @@ -58,7 +58,6 @@
   import org.apache.cocoon.portal.profile.impl.CopletInstanceDataManager;
   import org.exolab.castor.mapping.FieldHandler;
   
  -
   /**
    * Field handler for CopletInstanceData instances.
    *
  @@ -66,38 +65,34 @@
    * 
    * @version CVS $Id$
    */
  -public class CopletInstanceDataFieldHandler 
  -implements FieldHandler {
  +public class CopletInstanceDataFieldHandler implements FieldHandler {
  +
  +    public void checkValidity(Object object) {
  +    }
   
  -	public void checkValidity(Object object)
  -	{
  -	}
  -
  -	public Object getValue(Object object) 
  -	{
  -		Map map = ((CopletInstanceDataManager)object).getCopletInstanceData();
  -		Vector result = new Vector(map.size());
  -		
  -		Iterator iterator = map.values().iterator();
  -		while (iterator.hasNext())
  -			result.addElement(iterator.next());
  -		
  -		return result;
  -	}
  -
  -	public Object newInstance(Object parent)
  -	{
  -		return new CopletInstanceData();
  -	}
  -
  -	public void resetValue(Object object)
  -	{
  -		((CopletInstanceDataManager)object).getCopletInstanceData().clear();
  -	}
  -
  -	public void setValue(Object object, Object value)
  -	{
  -		CopletInstanceData data = (CopletInstanceData)value;
  -		((CopletInstanceDataManager)object).getCopletInstanceData().put(data.getId(), data);
  -	}
  +    public Object getValue(Object object) {
  +        Map map = ((CopletInstanceDataManager) object).getCopletInstanceData();
  +        Vector result = new Vector(map.size());
  +
  +        Iterator iterator = map.values().iterator();
  +        while (iterator.hasNext())
  +            result.addElement(iterator.next());
  +
  +        return result;
  +    }
  +
  +    public Object newInstance(Object parent) {
  +        return new CopletInstanceData();
  +    }
  +
  +    public void resetValue(Object object) {
  +        ((CopletInstanceDataManager) object).getCopletInstanceData().clear();
  +    }
  +
  +    public void setValue(Object object, Object value) {
  +        CopletInstanceData data = (CopletInstanceData) value;
  +        ((CopletInstanceDataManager) object).getCopletInstanceData().put(
  +            data.getId(),
  +            data);
  +    }
   }
  
  
  
  1.2       +39 -43    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/AspectDataFieldHandler.java
  
  Index: AspectDataFieldHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/AspectDataFieldHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AspectDataFieldHandler.java	26 May 2003 14:29:52 -0000	1.1
  +++ AspectDataFieldHandler.java	13 Jun 2003 14:20:10 -0000	1.2
  @@ -64,46 +64,42 @@
    * 
    * @version CVS $Id$
    */
  -public class AspectDataFieldHandler
  -implements FieldHandler
  -{
  -	public void checkValidity(Object object)
  -	{
  -	}
  -
  -	public Object getValue(Object object) 
  -	{
  -		HashMap map = new HashMap();
  -		Iterator iterator;
  -
  -		Map data = ((Aspectalizable) object).getPersistentAspectData();
  -		if (data == null)
  -			return map;
  -
  -		iterator = data.entrySet().iterator();
  -		Map.Entry entry;
  -		Object key;
  -		while (iterator.hasNext()) {
  -			entry = (Map.Entry)iterator.next();
  -			key = entry.getKey();
  -			map.put(key, new MapItem(key, entry.getValue()));
  -		}
  -		return map;
  -	}
  -
  -	public Object newInstance(Object parent)
  -	{
  -		return new MapItem();
  -	}
  -
  -	public void resetValue(Object object)
  -	{
  -		// impossible
  -	}
  -
  -	public void setValue(Object object, Object value)
  -	{
  -		MapItem item = (MapItem)value;
  -		((Aspectalizable)object).addPersistentAspectData((String)item.getKey(), item.getValue());
  -	}
  +public class AspectDataFieldHandler implements FieldHandler {
  +    
  +    public void checkValidity(Object object) {
  +    }
  +
  +    public Object getValue(Object object) {
  +        HashMap map = new HashMap();
  +        Iterator iterator;
  +
  +        Map data = ((Aspectalizable) object).getPersistentAspectData();
  +        if (data == null)
  +            return map;
  +
  +        iterator = data.entrySet().iterator();
  +        Map.Entry entry;
  +        Object key;
  +        while (iterator.hasNext()) {
  +            entry = (Map.Entry) iterator.next();
  +            key = entry.getKey();
  +            map.put(key, new MapItem(key, entry.getValue()));
  +        }
  +        return map;
  +    }
  +
  +    public Object newInstance(Object parent) {
  +        return new MapItem();
  +    }
  +
  +    public void resetValue(Object object) {
  +        // impossible
  +    }
  +
  +    public void setValue(Object object, Object value) {
  +        MapItem item = (MapItem) value;
  +        ((Aspectalizable) object).addPersistentAspectData(
  +            (String) item.getKey(),
  +            item.getValue());
  +    }
   }
  
  
  
  1.2       +2 -2      cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/DeltaApplicableReferencesAdjustable.java
  
  Index: DeltaApplicableReferencesAdjustable.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/DeltaApplicableReferencesAdjustable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeltaApplicableReferencesAdjustable.java	22 May 2003 15:19:44 -0000	1.1
  +++ DeltaApplicableReferencesAdjustable.java	13 Jun 2003 14:20:10 -0000	1.2
  @@ -66,5 +66,5 @@
        * if no delta has been applied to them.
   	 * @throws ClassCastException If the object is not of the expected type.
   	 */
  -	public void adjustReferences(Object object);
  +	void adjustReferences(Object object);
   }
  
  
  
  1.2       +30 -33    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ConfigurationFieldHandler.java
  
  Index: ConfigurationFieldHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ConfigurationFieldHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConfigurationFieldHandler.java	26 May 2003 14:29:52 -0000	1.1
  +++ ConfigurationFieldHandler.java	13 Jun 2003 14:20:10 -0000	1.2
  @@ -65,40 +65,37 @@
    * 
    * @version CVS $Id$
    */
  -public class ConfigurationFieldHandler
  -implements FieldHandler
  -{
  -	public void checkValidity(Object object)
  -	{
  -	}
  +public class ConfigurationFieldHandler implements FieldHandler {
  +    
  +    public void checkValidity(Object object) {
  +    }
   
  -	public Object getValue(Object object) 
  -	{
  -		HashMap map = new HashMap();
  -		Iterator iterator = ((CopletBaseData)object).getCopletConfig().entrySet().iterator();
  -		Map.Entry entry;
  -		Object key;
  -		while (iterator.hasNext()) {
  -			entry = (Map.Entry)iterator.next();
  -			key = entry.getKey();
  -			map.put(key, new MapItem(key, entry.getValue()));
  -		}
  -		return map;
  -	}
  +    public Object getValue(Object object) {
  +        HashMap map = new HashMap();
  +        Iterator iterator =
  +            ((CopletBaseData) object).getCopletConfig().entrySet().iterator();
  +        Map.Entry entry;
  +        Object key;
  +        while (iterator.hasNext()) {
  +            entry = (Map.Entry) iterator.next();
  +            key = entry.getKey();
  +            map.put(key, new MapItem(key, entry.getValue()));
  +        }
  +        return map;
  +    }
   
  -	public Object newInstance(Object parent)
  -	{
  -		return new MapItem();
  -	}
  +    public Object newInstance(Object parent) {
  +        return new MapItem();
  +    }
   
  -	public void resetValue(Object object)
  -	{
  -		((CopletBaseData)object).getCopletConfig().clear();
  -	}
  +    public void resetValue(Object object) {
  +        ((CopletBaseData) object).getCopletConfig().clear();
  +    }
   
  -	public void setValue(Object object, Object value)
  -	{
  -		MapItem item = (MapItem)value;
  -		((CopletBaseData)object).setCopletConfig((String)item.getKey(), item.getValue());
  -	}
  +    public void setValue(Object object, Object value) {
  +        MapItem item = (MapItem) value;
  +        ((CopletBaseData) object).setCopletConfig(
  +            (String) item.getKey(),
  +            item.getValue());
  +    }
   }
  
  
  
  1.2       +30 -35    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletBaseDataFieldHandler.java
  
  Index: CopletBaseDataFieldHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletBaseDataFieldHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CopletBaseDataFieldHandler.java	26 May 2003 14:29:52 -0000	1.1
  +++ CopletBaseDataFieldHandler.java	13 Jun 2003 14:20:10 -0000	1.2
  @@ -58,7 +58,6 @@
   import org.apache.cocoon.portal.profile.impl.CopletBaseDataManager;
   import org.exolab.castor.mapping.FieldHandler;
   
  -
   /**
    * Field handler for CopletBaseData instances.
    *
  @@ -66,38 +65,34 @@
    * 
    * @version CVS $Id$
    */
  -public class CopletBaseDataFieldHandler 
  -implements FieldHandler {
  +public class CopletBaseDataFieldHandler implements FieldHandler {
  +
  +    public void checkValidity(Object object) {
  +    }
   
  -	public void checkValidity(Object object)
  -	{
  -	}
  -
  -	public Object getValue(Object object) 
  -	{
  -		Map map = ((CopletBaseDataManager)object).getCopletBaseData();
  -		Vector result = new Vector(map.size());
  -		
  -		Iterator iterator = map.values().iterator();
  -		while (iterator.hasNext())
  -			result.addElement(iterator.next());
  -		
  -		return result;
  -	}
  -
  -	public Object newInstance(Object parent)
  -	{
  -		return new CopletBaseData();
  -	}
  -
  -	public void resetValue(Object object)
  -	{
  -		((CopletBaseDataManager)object).getCopletBaseData().clear();
  -	}
  -
  -	public void setValue(Object object, Object value)
  -	{
  -		CopletBaseData data = (CopletBaseData)value;
  -		((CopletBaseDataManager)object).getCopletBaseData().put(data.getId(), data);
  -	}
  +    public Object getValue(Object object) {
  +        Map map = ((CopletBaseDataManager) object).getCopletBaseData();
  +        Vector result = new Vector(map.size());
  +
  +        Iterator iterator = map.values().iterator();
  +        while (iterator.hasNext())
  +            result.addElement(iterator.next());
  +
  +        return result;
  +    }
  +
  +    public Object newInstance(Object parent) {
  +        return new CopletBaseData();
  +    }
  +
  +    public void resetValue(Object object) {
  +        ((CopletBaseDataManager) object).getCopletBaseData().clear();
  +    }
  +
  +    public void setValue(Object object, Object value) {
  +        CopletBaseData data = (CopletBaseData) value;
  +        ((CopletBaseDataManager) object).getCopletBaseData().put(
  +            data.getId(),
  +            data);
  +    }
   }
  
  
  
  1.3       +33 -37    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/AttributesFieldHandler.java
  
  Index: AttributesFieldHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/AttributesFieldHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AttributesFieldHandler.java	13 Jun 2003 14:15:04 -0000	1.2
  +++ AttributesFieldHandler.java	13 Jun 2003 14:20:10 -0000	1.3
  @@ -69,46 +69,42 @@
    * 
    * @version CVS $Id$
    */
  -public class AttributesFieldHandler
  -implements FieldHandler
  -{
  -	public void checkValidity(Object object) {
  -	}
  +public class AttributesFieldHandler implements FieldHandler {
  +
  +    public void checkValidity(Object object) {
  +    }
   
       protected Map getAttributes(Object object) {
           if (object instanceof CopletData) {
  -            return ((CopletData)object).getAttributes();
  +            return ((CopletData) object).getAttributes();
           } else {
  -            return ((CopletInstanceData)object).getAttributes();
  +            return ((CopletInstanceData) object).getAttributes();
  +        }
  +    }
  +
  +    public Object getValue(Object object) {
  +        HashMap map = new HashMap();
  +        Iterator iterator = this.getAttributes(object).entrySet().iterator();
  +        Map.Entry entry;
  +        Object key;
  +        while (iterator.hasNext()) {
  +            entry = (Map.Entry) iterator.next();
  +            key = entry.getKey();
  +            map.put(key, new MapItem(key, entry.getValue()));
           }
  +        return map;
  +    }
  +
  +    public Object newInstance(Object parent) {
  +        return new MapItem();
  +    }
  +
  +    public void resetValue(Object object) {
  +        this.getAttributes(object).clear();
  +    }
  +
  +    public void setValue(Object object, Object value) {
  +        MapItem item = (MapItem) value;
  +        this.getAttributes(object).put((String) item.getKey(), item.getValue());
       }
  -    
  -	public Object getValue(Object object) {
  -		HashMap map = new HashMap();
  -		Iterator iterator = this.getAttributes( object ).entrySet().iterator();
  -		Map.Entry entry;
  -		Object key;
  -		while (iterator.hasNext()) {
  -			entry = (Map.Entry)iterator.next();
  -			key = entry.getKey();
  -			map.put(key, new MapItem(key, entry.getValue()));
  -		}
  -		return map;
  -	}
  -
  -	public Object newInstance(Object parent)
  -	{
  -		return new MapItem();
  -	}
  -
  -	public void resetValue(Object object)
  -	{
  -		this.getAttributes( object ).clear();
  -	}
  -
  -	public void setValue(Object object, Object value)
  -	{
  -		MapItem item = (MapItem)value;
  -        this.getAttributes( object ).put((String)item.getKey(), item.getValue());
  -	}
   }
  
  
  
  1.2       +28 -30    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java
  
  Index: ReferenceFieldHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ReferenceFieldHandler.java	26 May 2003 14:29:52 -0000	1.1
  +++ ReferenceFieldHandler.java	13 Jun 2003 14:20:10 -0000	1.2
  @@ -62,36 +62,34 @@
    * 
    * @version CVS $Id$
    */
  -public abstract class ReferenceFieldHandler
  -implements FieldHandler
  -{
  -	/**
  -	 * Used to pass resolvable objects to the field handler.
  -	 */
  -	private static ThreadLocal threadLocalMap = new InheritableThreadLocal();
  -	
  -	/**
  -	 * Gets the map used to pass resolvable objects to the field handler.
  -	 */
  -	public static Map getObjectMap() {
  -		Map map = (Map)threadLocalMap.get();
  +public abstract class ReferenceFieldHandler implements FieldHandler {
  +    /**
  +     * Used to pass resolvable objects to the field handler.
  +     */
  +    private static ThreadLocal threadLocalMap = new InheritableThreadLocal();
   
  -		if (map == null) {
  -			map = new HashMap();
  -			threadLocalMap.set(map);
  -		}
  +    /**
  +     * Gets the map used to pass resolvable objects to the field handler.
  +     */
  +    public static Map getObjectMap() {
  +        Map map = (Map) threadLocalMap.get();
   
  -		return map;
  -	}
  +        if (map == null) {
  +            map = new HashMap();
  +            threadLocalMap.set(map);
  +        }
   
  -	/**
  -	 * Sets the map used to pass resolvable objects to the field handler.
  -	 */
  -	public static void setObjectMap(Map objectMap) {
  -		if (objectMap == null) {
  -			threadLocalMap.set(new HashMap());
  -		} else {
  -			threadLocalMap.set(objectMap);
  -		}
  -	}
  +        return map;
  +    }
  +
  +    /**
  +     * Sets the map used to pass resolvable objects to the field handler.
  +     */
  +    public static void setObjectMap(Map objectMap) {
  +        if (objectMap == null) {
  +            threadLocalMap.set(new HashMap());
  +        } else {
  +            threadLocalMap.set(objectMap);
  +        }
  +    }
   }
  
  
  

Mime
View raw message