* Create a clone of the instance
* @param request
* @throws InvalidParametersException
*/
public static void cloneSharedData(HttpServletRequest request) throws InvalidParametersException{
IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
if (instance == null){
throw new InvalidParametersException();
}
String sharedDataKey = request.getParameter("shareddatakey"); //$NON-NLS-1$;
String cloneSharedDataKey = request.getParameter("cloneshareddatakey");
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 : new SharedContext(instance).getSharedData())
{
ISharedData clone = persistenceManager.newInstance(ISharedData.class);
clone.setDkey(sharedData.getDkey());