if (sharedDataKey == null || sharedDataKey.trim().equals("") || cloneSharedDataKey == null || cloneSharedDataKey.trim().equals("")){//$NON-NLS-1$ //$NON-NLS-2$
throw new InvalidParametersException();
}
String cloneKey = SharedDataHelper.getInternalSharedDataKey(instance, cloneSharedDataKey);
IWidget widget = instance.getWidget();
IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
for (ISharedData sharedData : SharedDataHelper.findSharedData(instance))
{
ISharedData clone = persistenceManager.newInstance(ISharedData.class);
clone.setDkey(sharedData.getDkey());
clone.setDvalue(sharedData.getDvalue());
clone.setSharedDataKey(cloneKey);
persistenceManager.save(clone);
}
boolean ok = persistenceManager.save(widget);
if (!ok) throw new InvalidParametersException();
}