* @param model the updated widget model
* @param widget the existing widget
* @param grantAccessRequests set to true to grant any access requests defined by the model
*/
public static void update( W3CWidget model, IWidget widget, boolean grantAccessRequests, File zipFile){
IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
widget.setDir(model.getDir());
widget.setLang(model.getLang());
widget.setDefaultLocale(model.getDefaultLocale());
widget.setGuid(model.getIdentifier());
widget.setHeight(model.getHeight());
widget.setWidth(model.getWidth());
widget.setVersion(model.getVersion());
widget.setUpdateLocation(model.getUpdate());
// Clear old values
widget.setStartFiles(null);
widget.setNames(null);
widget.setDescriptions(null);
widget.setLicenses(null);
widget.setFeatures(null);
widget.setWidgetIcons(null);
widget.setPreferenceDefaults(null);
// We set this here to ensure widgets already imported in to
// a 0.9.0 version of wookie get this value set. See WOOKIE-256
if(zipFile != null){
widget.setPackagePath(zipFile.getPath());
}
// Set with updated values
createAuthor(persistenceManager, model,widget);
createStartFiles(persistenceManager, model,widget);
createNames(persistenceManager, model,widget);
createDescriptions(persistenceManager, model,widget);
createIcons(persistenceManager, model, widget);
createLicenses(persistenceManager, model,widget);
createPreferences(persistenceManager, model,widget);
createFeatures(persistenceManager, model,widget);
persistenceManager.save(widget);
createAccessRequests(persistenceManager, model, widget, grantAccessRequests);
}