Search in sources :

Example 6 with GadgetSpec

use of org.apache.shindig.gadgets.spec.GadgetSpec in project liferay-ide by liferay.

the class ShindigUtil method getGadget.

public static com.liferay.opensocial.model.Gadget getGadget(PortletPreferences portletPreferences) throws Exception {
    String url = portletPreferences.getValue("url", StringPool.BLANK);
    if (Validator.isNull(url)) {
        return null;
    }
    com.liferay.opensocial.model.Gadget gadget = new GadgetImpl();
    GadgetSpec gadgetSpec = null;
    try {
        gadgetSpec = ShindigUtil.getGadgetSpec(url);
    } catch (Exception e) {
        throw new GadgetURLException(e);
    }
    ModulePrefs modulePrefs = gadgetSpec.getModulePrefs();
    gadget.setName(modulePrefs.getTitle());
    gadget.setUrl(url);
    return gadget;
}
Also used : GadgetSpec(org.apache.shindig.gadgets.spec.GadgetSpec) ModulePrefs(org.apache.shindig.gadgets.spec.ModulePrefs) GadgetURLException(com.liferay.opensocial.GadgetURLException) GadgetImpl(com.liferay.opensocial.model.impl.GadgetImpl) ProcessingException(org.apache.shindig.gadgets.process.ProcessingException) PortalException(com.liferay.portal.kernel.exception.PortalException) SystemException(com.liferay.portal.kernel.exception.SystemException) GadgetURLException(com.liferay.opensocial.GadgetURLException)

Aggregations

GadgetSpec (org.apache.shindig.gadgets.spec.GadgetSpec)6 ModulePrefs (org.apache.shindig.gadgets.spec.ModulePrefs)4 Gadget (com.liferay.opensocial.model.Gadget)3 GadgetURLException (com.liferay.opensocial.GadgetURLException)2 PortalException (com.liferay.portal.kernel.exception.PortalException)2 SystemException (com.liferay.portal.kernel.exception.SystemException)2 ThemeDisplay (com.liferay.portal.theme.ThemeDisplay)2 DuplicateGadgetURLException (com.liferay.opensocial.DuplicateGadgetURLException)1 GadgetPortletCategoryNamesException (com.liferay.opensocial.GadgetPortletCategoryNamesException)1 NoSuchGadgetException (com.liferay.opensocial.NoSuchGadgetException)1 GadgetImpl (com.liferay.opensocial.model.impl.GadgetImpl)1 JSONObject (com.liferay.portal.kernel.json.JSONObject)1 Portlet (com.liferay.portal.model.Portlet)1 PortletDisplay (com.liferay.portal.theme.PortletDisplay)1 MVCPortlet (com.liferay.util.bridges.mvc.MVCPortlet)1 Date (java.util.Date)1 ProcessingException (org.apache.shindig.gadgets.process.ProcessingException)1 Feature (org.apache.shindig.gadgets.spec.Feature)1 OAuthSpec (org.apache.shindig.gadgets.spec.OAuthSpec)1