if (removed)
{
throw new IllegalStateException("Preferences node removed");
}
// get persistent node and properties
Node node = getNode();
Collection properties = node.getNodeProperties();
// if the property exists, update its value.
boolean propFound = false;
for (Iterator i = properties.iterator(); i.hasNext();)
{
Property curProp = (Property) i.next();
if ((null != curProp) && (null != curProp.getPropertyName()) && curProp.getPropertyName().equals(key))
{
propFound = true;
curProp.setPropertyValue(value);
curProp.setModifiedDate(new Timestamp(System.currentTimeMillis()));
break;
}
}
// add new property value
if (!propFound)
{
properties.add(new PropertyImpl(node.getNodeId(), key, value));
}
// update node
ppw.provider().storeNode(node);
}