Package com.liferay.portal.kernel.json

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


    String journalArticleId = getJournalId(fileName);

    String title = FileUtil.stripExtension(fileName);

    JSONObject assetJSONObject = _assetJSONObjectMap.get(fileName);

    Map<Locale, String> descriptionMap = null;

    if (assetJSONObject != null) {
      String abstractSummary = assetJSONObject.getString(
        "abstractSummary");

      descriptionMap = getMap(abstractSummary);
    }

    String content = StringUtil.read(inputStream);

    content = processJournalArticleContent(content);

    Locale articleDefaultLocale = LocaleUtil.fromLanguageId(
      LocalizationUtil.getDefaultLocale(content));

    Map<Locale, String> titleMap = getMap(articleDefaultLocale, title);

    boolean smallImage = false;
    String smallImageURL = StringPool.BLANK;

    if (assetJSONObject != null) {
      String smallImageFileName = assetJSONObject.getString("smallImage");

      if (Validator.isNotNull(smallImageFileName)) {
        smallImage = true;

        FileEntry fileEntry = _fileEntries.get(smallImageFileName);
View Full Code Here


      InputStream inputStream)
    throws Exception {

    String title = FileUtil.stripExtension(fileName);

    JSONObject assetJSONObject = _assetJSONObjectMap.get(fileName);

    Map<Locale, String> descriptionMap = null;

    if (assetJSONObject != null) {
      String abstractSummary = assetJSONObject.getString(
        "abstractSummary");

      descriptionMap = getMap(abstractSummary);
    }

    String content = StringUtil.read(inputStream);

    content = processJournalArticleContent(content);

    Locale articleDefaultLocale = LocaleUtil.fromLanguageId(
      LocalizationUtil.getDefaultLanguageId(content));

    boolean smallImage = false;
    String smallImageURL = StringPool.BLANK;

    if (assetJSONObject != null) {
      String smallImageFileName = assetJSONObject.getString("smallImage");

      if (Validator.isNotNull(smallImageFileName)) {
        smallImage = true;

        FileEntry fileEntry = _fileEntries.get(smallImageFileName);
View Full Code Here

      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

    if (Validator.isNull(content)) {
      return;
    }

    JSONObject jsonObject = JSONFactoryUtil.createJSONObject(content);

    JSONObject layoutTemplateJSONObject = jsonObject.getJSONObject(
      "layoutTemplate");

    String name = getName(layoutTemplateJSONObject.getString("name"));

    LayoutPrototype layoutPrototype = getLayoutPrototype(companyId, name);

    if (layoutPrototype != null) {
      if (!developerModeEnabled) {
        if (_log.isInfoEnabled()) {
          _log.info(
            "Layout prototype with name " + name +
              " already exists for company " + companyId);
        }

        return;
      }

      LayoutPrototypeLocalServiceUtil.deleteLayoutPrototype(
        layoutPrototype);
    }

    layoutPrototype =
      LayoutPrototypeLocalServiceUtil.addLayoutPrototype(
        userId, companyId, getMap(name), name, true, serviceContext);

    JSONArray columnsJSONArray = layoutTemplateJSONObject.getJSONArray(
      "columns");

    Layout layout = layoutPrototype.getLayout();

    addLayoutColumns(
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

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.