uk.ac.kcl.cch.jb.pliny.model
Class AttributedResourceHandler

java.lang.Object
  extended byuk.ac.kcl.cch.jb.pliny.model.AttributedResourceHandler

public class AttributedResourceHandler
extends Object

provides a tool to manage the Resource attributes field as a java.util.Properties item. In this way, users of this item can store a range of properties in the single attributes field without needing to modify the DB definition to add more DB fields.

It is important to recognise, of course, that storing data using this tool means that the DB engine itself is not going to be very good at selected items from the DB records that are based on values of these stored values.

Author:
John Bradley

Constructor Summary
AttributedResourceHandler(Resource myResource)
          creates an instance of this item that will manage data for the given Resource record.
 
Method Summary
 float getFloat(String propName)
          looks up value in the properties associated with this Resource's attribute field, and returns it as an float.
 String getIdentifier()
           
 int getInt(String propName)
          looks up value in the properties associated with this Resource's attribute field, and returns it as an Integer.
 org.eclipse.draw2d.geometry.Rectangle getRectangle(String propName)
          looks up value in the properties associated with this Resource's attribute field, and returns it as an draw2d Rectangle.
 String getString(String propName)
          looks up value in the properties associated with this Resource's attribute field, and returns it as a String.
 void updateFloat(String propName, float value)
          takes the given value as a float and stores it as the value associated with the given attribute name propName.
 void updateInt(String propName, int value)
          takes the given value as an int and stores it as the value associated with the given attribute name propName.
 void updateRectangle(String propName, org.eclipse.draw2d.geometry.Rectangle r)
          takes the given value as a draw2d Rectangle and stores it as the value associated with the given attribute name propName.
 void updateString(String propName, String value)
          takes the given value as a String and stores it as the value associated with the given attribute name propName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributedResourceHandler

public AttributedResourceHandler(Resource myResource)
creates an instance of this item that will manage data for the given Resource record.

Parameters:
myResource -
Method Detail

getIdentifier

public String getIdentifier()

getString

public String getString(String propName)
looks up value in the properties associated with this Resource's attribute field, and returns it as a String. null means that the attributes was not found.

Parameters:
propName - name of property.
Returns:
String with value

getInt

public int getInt(String propName)
looks up value in the properties associated with this Resource's attribute field, and returns it as an Integer. null means that the attributes was not found.

Parameters:
propName - name of property.
Returns:
Integer with value

getFloat

public float getFloat(String propName)
looks up value in the properties associated with this Resource's attribute field, and returns it as an float. null means that the attributes was not found.

Parameters:
propName - name of property.
Returns:
Float with value

getRectangle

public org.eclipse.draw2d.geometry.Rectangle getRectangle(String propName)
looks up value in the properties associated with this Resource's attribute field, and returns it as an draw2d Rectangle. null means that the attributes was not found.

Parameters:
propName - name of property.
Returns:
Rectangle with value

updateString

public void updateString(String propName,
                         String value)
takes the given value as a String and stores it as the value associated with the given attribute name propName. The DB field attribute is updated to reflect the new value for this item.

Parameters:
propName - String that names the attribute
value - String value that it is to be assigned.

updateInt

public void updateInt(String propName,
                      int value)
takes the given value as an int and stores it as the value associated with the given attribute name propName. The DB field attribute is updated to reflect the new value for this item.

Parameters:
propName - String that names the attribute
value - int value that it is to be assigned.

updateFloat

public void updateFloat(String propName,
                        float value)
takes the given value as a float and stores it as the value associated with the given attribute name propName. The DB field attribute is updated to reflect the new value for this item.

Parameters:
propName - String that names the attribute
value - float value that it is to be assigned.

updateRectangle

public void updateRectangle(String propName,
                            org.eclipse.draw2d.geometry.Rectangle r)
takes the given value as a draw2d Rectangle and stores it as the value associated with the given attribute name propName. The DB field attribute is updated to reflect the new value for this item.

Parameters:
propName - String that names the attribute
r - draw2d Rectangle value that it is to be assigned.