* (non-Javadoc)
* @see org.apache.rave.portal.service.WidgetResolverService#addWidget(org.apache.rave.model.Widget)
*/
@Override
public Widget addWidget(Widget widget) throws Exception{
PortalPreference status = portalPreferenceService.getPreference(PortalPreferenceKeys.INITIAL_WIDGET_STATUS);
User user = userService.getAuthenticatedUser();
widget.setOwnerId(user.getId());
if (status != null && status.getValue().equals("PUBLISHED")){
widget.setWidgetStatus(WidgetStatus.PUBLISHED);
} else {
widget.setWidgetStatus(WidgetStatus.PREVIEW);
}
return widgetService.registerNewWidget(widget);