// WidgetService
if (initializing && (persistenceManager.findAll(IWidgetService.class).length == 0))
{
// optional: create only if initializing
IWidgetService chatWidgetService = persistenceManager.newInstance(IWidgetService.class);
chatWidgetService.setServiceName("chat");
persistenceManager.save(chatWidgetService);
IWidgetService gamesWidgetService = persistenceManager.newInstance(IWidgetService.class);
gamesWidgetService.setServiceName("games");
persistenceManager.save(gamesWidgetService);
IWidgetService votingWidgetService = persistenceManager.newInstance(IWidgetService.class);
votingWidgetService.setServiceName("voting");
persistenceManager.save(votingWidgetService);
IWidgetService weatherWidgetService = persistenceManager.newInstance(IWidgetService.class);
weatherWidgetService.setServiceName("weather");
persistenceManager.save(weatherWidgetService);
}
else
{
initializing = false;
}
if (persistenceManager.findByValue(IWidgetService.class, "serviceName", "unsupported").length == 0)
{
// required: always create if not found
IWidgetService unsupportedWidgetService = persistenceManager.newInstance(IWidgetService.class);
unsupportedWidgetService.setServiceName("unsupported");
persistenceManager.save(unsupportedWidgetService);
}
else
{
initializing = false;