Package com.liferay.portal.kernel.json

Examples of com.liferay.portal.kernel.json.JSONObject


      privateLayout = true;
    }

    Map<Locale, String> nameMap = new HashMap<Locale, String>();

    JSONObject nameMapJSONObject = layoutJSONObject.getJSONObject(
      "nameMap");

    if (nameMapJSONObject != null) {
      nameMap = (Map<Locale, String>)LocalizationUtil.deserialize(
        nameMapJSONObject);

      if (!nameMap.containsKey(LocaleUtil.getDefault())) {
        Collection<String> values = nameMap.values();

        Iterator iterator = values.iterator();

        nameMap.put(LocaleUtil.getDefault(), (String)iterator.next());
      }
    }
    else {
      String name = layoutJSONObject.getString("name");

      nameMap.put(LocaleUtil.getDefault(), name);
    }

    Map<Locale, String> titleMap = new HashMap<Locale, String>();

    JSONObject titleMapJSONObject = layoutJSONObject.getJSONObject(
      "titleMap");

    if (titleMapJSONObject != null) {
      titleMap = (Map<Locale, String>)LocalizationUtil.deserialize(
        titleMapJSONObject);
View Full Code Here


    if (columnJSONArray == null) {
      return;
    }

    for (int i = 0; i < columnJSONArray.length(); i++) {
      JSONObject portletJSONObject = columnJSONArray.getJSONObject(i);

      if (portletJSONObject == null) {
        String journalArticleId = getJournalId(
          columnJSONArray.getString(i));
View Full Code Here

    }

    String portletId = layoutTypePortlet.addPortletId(
      userId, rootPortletId, columnId, -1, false);

    JSONObject portletPreferencesJSONObject =
      portletJSONObject.getJSONObject("portletPreferences");

    if ((portletPreferencesJSONObject == null) ||
      (portletPreferencesJSONObject.length() == 0)) {

      return;
    }

    PortletPreferences portletSetup =
      PortletPreferencesFactoryUtil.getLayoutPortletSetup(
        layout, portletId);

    Iterator<String> iterator = portletPreferencesJSONObject.keys();

    while (iterator.hasNext()) {
      String key = iterator.next();

      String value = portletPreferencesJSONObject.getString(key);

      if (rootPortletId.equals(PortletKeys.JOURNAL_CONTENT) &&
        key.equals("articleId")) {

        value = getJournalId(value);
      }

      portletSetup.setValue(key, value);
    }

    portletSetup.store();

    if (rootPortletId.equals(PortletKeys.NESTED_PORTLETS)) {
      JSONArray columnsJSONArray =
        portletPreferencesJSONObject.getJSONArray("columns");

      StringBundler sb = new StringBundler(4);

      sb.append(StringPool.UNDERLINE);
      sb.append(portletId);
View Full Code Here

    if (layoutsJSONArray == null) {
      return;
    }

    for (int i = 0; i < layoutsJSONArray.length(); i++) {
      JSONObject layoutJSONObject = layoutsJSONArray.getJSONObject(i);

      addLayout(privateLayout, parentLayoutId, layoutJSONObject);
    }
  }
View Full Code Here

    return TemplateConstants.LANG_TYPE_VM;
  }

  protected JSONObject getDefaultPortletJSONObject(String journalArticleId) {
    JSONObject portletJSONObject = JSONFactoryUtil.createJSONObject();

    portletJSONObject.put("portletId", PortletKeys.JOURNAL_CONTENT);

    JSONObject portletPreferencesJSONObject =
      JSONFactoryUtil.createJSONObject();

    portletPreferencesJSONObject.put("articleId", journalArticleId);
    portletPreferencesJSONObject.put("groupId", groupId);
    portletPreferencesJSONObject.put("portletSetupShowBorders", false);

    portletJSONObject.put(
      "portletPreferences", portletPreferencesJSONObject);

    return portletJSONObject;
View Full Code Here

    return content;
  }

  protected void setServiceContext(String name) {
    JSONObject assetJSONObject = _assetJSONObjectMap.get(name);

    String[] assetTagNames = null;

    if (assetJSONObject != null) {
      assetTagNames = getJSONArrayAsStringArray(assetJSONObject, "tags");
View Full Code Here

    if (assetsJSONArray == null) {
      return;
    }

    for (int i = 0; i < assetsJSONArray.length(); i++) {
      JSONObject assetJSONObject = assetsJSONArray.getJSONObject(i);

      String name = assetJSONObject.getString("name");

      _assetJSONObjectMap.put(name, assetJSONObject);
    }
  }
View Full Code Here

    DDMTemplateLocalServiceUtil.deleteTemplates(groupId);

    DDMStructureLocalServiceUtil.deleteStructures(groupId);

    JSONObject jsonObject = getJSONObject(fileName);

    if (jsonObject != null) {
      JSONArray assetsJSONArray = jsonObject.getJSONArray("assets");

      setupAssets(assetsJSONArray);
    }

    addDLFileEntries(_DL_DOCUMENTS_DIR_NAME);
View Full Code Here

  protected void setupSettings(String fileName) throws Exception {
    if (targetClassName.equals(Group.class.getName())) {
      return;
    }

    JSONObject jsonObject = getJSONObject(fileName);

    if (jsonObject == null) {
      return;
    }

    LayoutSetPrototype layoutSetPrototype =
      LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(
        getTargetClassPK());

    String layoutSetPrototypeSettings = jsonObject.getString(
      "layoutSetPrototypeSettings", StringPool.BLANK);

    layoutSetPrototype.setSettings(layoutSetPrototypeSettings);

    LayoutSetPrototypeLocalServiceUtil.updateLayoutSetPrototype(
View Full Code Here

      groupId, true, new ServiceContext());

    LayoutLocalServiceUtil.deleteLayouts(
      groupId, false, new ServiceContext());

    JSONObject jsonObject = getJSONObject(fileName);

    if (jsonObject == null) {
      return;
    }

    _defaultLayoutTemplateId = jsonObject.getString(
      "layoutTemplateId", StringPool.BLANK);

    updateLayoutSetThemeId(jsonObject);

    JSONArray layoutsJSONArray = jsonObject.getJSONArray("layouts");

    if (layoutsJSONArray != null) {
      addLayouts(
        false, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID,
        layoutsJSONArray);
    }
    else {
      JSONArray publicPagesJSONArray = jsonObject.getJSONArray(
        "publicPages");

      if (publicPagesJSONArray != null) {
        addLayouts(
          false, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID,
          publicPagesJSONArray);
      }

      JSONArray privatePagesJSONArray = jsonObject.getJSONArray(
        "privatePages");

      if (privatePagesJSONArray != null) {
        addLayouts(
          true, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID,
View Full Code Here

TOP

Related Classes of com.liferay.portal.kernel.json.JSONObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.