Search in sources :

Example 1 with Feature

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

the class EditorPortlet method serveGetRenderParameters.

protected void serveGetRenderParameters(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
    JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
    String fileEntryURL = ParamUtil.getString(resourceRequest, "fileEntryURL");
    GadgetSpec gadgetSpec = ShindigUtil.getGadgetSpec(fileEntryURL, true, true);
    ModulePrefs modulePrefs = gadgetSpec.getModulePrefs();
    jsonObject.put("height", modulePrefs.getHeight());
    long moduleId = ShindigUtil.getModuleId(resourceResponse.getNamespace());
    jsonObject.put("moduleId", moduleId);
    Map<String, Feature> features = modulePrefs.getFeatures();
    boolean requiresPubsub = features.containsKey("pubsub-2");
    jsonObject.put("requiresPubsub", requiresPubsub);
    boolean scrolling = modulePrefs.getScrolling();
    jsonObject.put("scrolling", scrolling);
    String ownerId = ShindigUtil.getOwnerId(themeDisplay.getLayout());
    String portalURL = PortalUtil.getPortalURL(themeDisplay);
    String currentURL = PortalUtil.getCurrentURL(resourceRequest);
    String secureToken = ShindigUtil.createSecurityToken(ownerId, themeDisplay.getUserId(), fileEntryURL, portalURL, fileEntryURL, moduleId, currentURL);
    jsonObject.put("secureToken", secureToken);
    jsonObject.put("specUrl", fileEntryURL);
    writeJSON(resourceRequest, resourceResponse, jsonObject);
}
Also used : GadgetSpec(org.apache.shindig.gadgets.spec.GadgetSpec) JSONObject(com.liferay.portal.kernel.json.JSONObject) ModulePrefs(org.apache.shindig.gadgets.spec.ModulePrefs) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay) Feature(org.apache.shindig.gadgets.spec.Feature)

Aggregations

JSONObject (com.liferay.portal.kernel.json.JSONObject)1 ThemeDisplay (com.liferay.portal.theme.ThemeDisplay)1 Feature (org.apache.shindig.gadgets.spec.Feature)1 GadgetSpec (org.apache.shindig.gadgets.spec.GadgetSpec)1 ModulePrefs (org.apache.shindig.gadgets.spec.ModulePrefs)1