*/
public synchronized static boolean updateSharedDataEntry(IWidgetInstance widgetInstance, String name, String value, boolean append){
IWidget widget = widgetInstance.getWidget();
IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
boolean found=false;
ISharedData sharedData = SharedDataHelper.findSharedData(widgetInstance, name);
if (sharedData != null)
{
if(value==null || value.equalsIgnoreCase("null")){
persistenceManager.delete(sharedData);
}
else{
if(append){
sharedData.setDvalue(sharedData.getDvalue() + value);
}
else{
sharedData.setDvalue(value);
}
}
found=true;
}
if(!found){
if(value!=null){
String sharedDataKey = SharedDataHelper.getInternalSharedDataKey(widgetInstance);
sharedData = persistenceManager.newInstance(ISharedData.class);
sharedData.setSharedDataKey(sharedDataKey);
sharedData.setDkey(name);
sharedData.setDvalue(value);
persistenceManager.save(sharedData);
}
}
persistenceManager.save(widget);
return found;