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);
}
}
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;
}
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);
}
}
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);
}
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);
}
Aggregations