Search in sources :

Example 1 with Portlet

use of com.liferay.portal.model.Portlet in project liferay-ide by liferay.

the class GadgetLocalServiceImpl method destroyGadget.

@Clusterable
public void destroyGadget(String uuid, long companyId) throws SystemException {
    try {
        Portlet portlet = _portletsPool.remove(uuid);
        if (portlet == null) {
            portlet = PortletLocalServiceUtil.getPortletById(companyId, getPortletId(uuid));
        }
        PortletInstanceFactoryUtil.destroy(portlet);
    } catch (SystemException se) {
        throw se;
    } catch (Exception e) {
        throw new SystemException(e);
    }
}
Also used : GadgetPortlet(com.liferay.opensocial.gadget.portlet.GadgetPortlet) InvokerPortlet(com.liferay.portlet.InvokerPortlet) Portlet(com.liferay.portal.model.Portlet) SystemException(com.liferay.portal.kernel.exception.SystemException) DuplicateGadgetURLException(com.liferay.opensocial.DuplicateGadgetURLException) PortalException(com.liferay.portal.kernel.exception.PortalException) SystemException(com.liferay.portal.kernel.exception.SystemException) GadgetPortletCategoryNamesException(com.liferay.opensocial.GadgetPortletCategoryNamesException) NoSuchGadgetException(com.liferay.opensocial.NoSuchGadgetException) GadgetURLException(com.liferay.opensocial.GadgetURLException) Clusterable(com.liferay.portal.kernel.cluster.Clusterable)

Example 2 with Portlet

use of com.liferay.portal.model.Portlet in project liferay-ide by liferay.

the class GadgetLocalServiceImpl method getPortlet.

protected Portlet getPortlet(String uuid, long companyId, String name) throws Exception {
    Portlet portlet = _portletsPool.get(uuid);
    if (portlet != null) {
        return portlet;
    }
    String portletId = getPortletId(uuid);
    portlet = PortletLocalServiceUtil.clonePortlet(_GADGET_PORTLET_ID);
    portlet.setCompanyId(companyId);
    portlet.setPortletId(portletId);
    portlet.setTimestamp(System.currentTimeMillis());
    PortletApp portletApp = PortletLocalServiceUtil.getPortletApp(ClpSerializer.getServletContextName());
    portlet.setPortletApp(portletApp);
    portlet.setPortletName(portletId);
    portlet.setDisplayName(portletId);
    portlet.setPortletClass(GadgetPortlet.class.getName());
    Map<String, String> initParams = portlet.getInitParams();
    initParams.put(InvokerPortlet.INIT_INVOKER_PORTLET_NAME, _GADGET_PORTLET_NAME);
    addPortletExtraInfo(portlet, portletApp, name);
    _portletsPool.put(uuid, portlet);
    PortletBag portletBag = PortletBagPool.get(_GADGET_PORTLET_ID);
    portletBag = (PortletBag) portletBag.clone();
    portletBag.setPortletName(portletId);
    portletBag.setPortletInstance(new GadgetPortlet());
    PortletBagPool.put(portletId, portletBag);
    return portlet;
}
Also used : GadgetPortlet(com.liferay.opensocial.gadget.portlet.GadgetPortlet) InvokerPortlet(com.liferay.portlet.InvokerPortlet) Portlet(com.liferay.portal.model.Portlet) GadgetPortlet(com.liferay.opensocial.gadget.portlet.GadgetPortlet) PortletBag(com.liferay.portal.kernel.portlet.PortletBag) PortletApp(com.liferay.portal.model.PortletApp)

Example 3 with Portlet

use of com.liferay.portal.model.Portlet in project liferay-ide by liferay.

the class GadgetLocalServiceImpl method initGadget.

@Clusterable
public void initGadget(String uuid, long companyId, long gadgetId, String name, String portletCategoryNames) throws PortalException, SystemException {
    try {
        Portlet portlet = getPortlet(uuid, companyId, name);
        String[] portletCategoryNamesArray = StringUtil.split(portletCategoryNames);
        PortletLocalServiceUtil.deployRemotePortlet(portlet, portletCategoryNamesArray);
    } catch (PortalException pe) {
        throw pe;
    } catch (SystemException se) {
        throw se;
    } catch (Exception e) {
        throw new SystemException(e);
    }
}
Also used : GadgetPortlet(com.liferay.opensocial.gadget.portlet.GadgetPortlet) InvokerPortlet(com.liferay.portlet.InvokerPortlet) Portlet(com.liferay.portal.model.Portlet) SystemException(com.liferay.portal.kernel.exception.SystemException) PortalException(com.liferay.portal.kernel.exception.PortalException) DuplicateGadgetURLException(com.liferay.opensocial.DuplicateGadgetURLException) PortalException(com.liferay.portal.kernel.exception.PortalException) SystemException(com.liferay.portal.kernel.exception.SystemException) GadgetPortletCategoryNamesException(com.liferay.opensocial.GadgetPortletCategoryNamesException) NoSuchGadgetException(com.liferay.opensocial.NoSuchGadgetException) GadgetURLException(com.liferay.opensocial.GadgetURLException) Clusterable(com.liferay.portal.kernel.cluster.Clusterable)

Example 4 with Portlet

use of com.liferay.portal.model.Portlet in project liferay-ide by liferay.

the class BaseGadgetPortlet method doRender.

protected void doRender(RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {
    checkExpando(renderRequest, renderResponse);
    ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
    Portlet portlet = PortletLocalServiceUtil.getPortletById(themeDisplay.getCompanyId(), portletDisplay.getId());
    Gadget gadget = getGadget(renderRequest);
    if (gadget == null) {
        return;
    }
    GadgetSpec gadgetSpec = ShindigUtil.getGadgetSpec(gadget.getUrl());
    overrideConfiguration(gadgetSpec, portlet, portletDisplay);
    renderRequest.setAttribute(WebKeys.GADGET, gadget);
    String view = getView(renderRequest, gadgetSpec);
    renderRequest.setAttribute(WebKeys.VIEW, view);
}
Also used : GadgetSpec(org.apache.shindig.gadgets.spec.GadgetSpec) Gadget(com.liferay.opensocial.model.Gadget) Portlet(com.liferay.portal.model.Portlet) MVCPortlet(com.liferay.util.bridges.mvc.MVCPortlet) PortletDisplay(com.liferay.portal.theme.PortletDisplay) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Example 5 with Portlet

use of com.liferay.portal.model.Portlet in project liferay-ide by liferay.

the class AdhocGadgetPortlet method getGadget.

@Override
protected Gadget getGadget(RenderRequest renderRequest) throws Exception {
    Portlet portlet = (Portlet) renderRequest.getAttribute(WebKeys.RENDER_PORTLET);
    PortletPreferences portletPreferences = PortletPreferencesFactoryUtil.getPortletSetup(renderRequest, portlet.getPortletId());
    return ShindigUtil.getGadget(portletPreferences);
}
Also used : Portlet(com.liferay.portal.model.Portlet) BaseGadgetPortlet(com.liferay.opensocial.gadget.portlet.BaseGadgetPortlet) PortletPreferences(javax.portlet.PortletPreferences)

Aggregations

Portlet (com.liferay.portal.model.Portlet)9 GadgetPortlet (com.liferay.opensocial.gadget.portlet.GadgetPortlet)3 ResourceServingConfigurationAction (com.liferay.portal.kernel.portlet.ResourceServingConfigurationAction)3 PrincipalException (com.liferay.portal.security.auth.PrincipalException)3 InvokerPortlet (com.liferay.portlet.InvokerPortlet)3 DuplicateGadgetURLException (com.liferay.opensocial.DuplicateGadgetURLException)2 GadgetPortletCategoryNamesException (com.liferay.opensocial.GadgetPortletCategoryNamesException)2 GadgetURLException (com.liferay.opensocial.GadgetURLException)2 NoSuchGadgetException (com.liferay.opensocial.NoSuchGadgetException)2 Clusterable (com.liferay.portal.kernel.cluster.Clusterable)2 PortalException (com.liferay.portal.kernel.exception.PortalException)2 SystemException (com.liferay.portal.kernel.exception.SystemException)2 ConfigurationAction (com.liferay.portal.kernel.portlet.ConfigurationAction)2 PortletPreferences (javax.portlet.PortletPreferences)2 KBArticle (com.liferay.knowledgebase.model.KBArticle)1 BaseGadgetPortlet (com.liferay.opensocial.gadget.portlet.BaseGadgetPortlet)1 Gadget (com.liferay.opensocial.model.Gadget)1 PortletBag (com.liferay.portal.kernel.portlet.PortletBag)1 Layout (com.liferay.portal.model.Layout)1 LayoutTypePortlet (com.liferay.portal.model.LayoutTypePortlet)1