public synchronized String getNotificationEvents(long timeout) throws ChannelException {

    try {
      if (!_complete) {
        this.wait(timeout);
      }
    } catch (InterruptedException ie) {
    }

    try {
      Thread.sleep(PropsValues.POLLER_NOTIFICATIONS_TIMEOUT);
    } catch (InterruptedException ie) {
    }

    List<NotificationEvent> notificationEvents =
        ChannelHubManagerUtil.getNotificationEvents(_companyId, _userId, true);

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    jsonArray.put(_pollerResponseHeaderJSONObject);

    for (NotificationEvent notificationEvent : notificationEvents) {
      jsonArray.put(notificationEvent.toJSONObject());
    }

    return jsonArray.toString();
  }
  public JSONArray getJSONActivityDefinitions(long groupId, String className)
      throws PortalException, SystemException {

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    List<SocialActivityDefinition> activityDefinitions =
        socialActivitySettingLocalService.getActivityDefinitions(groupId, className);

    for (SocialActivityDefinition activityDefinition : activityDefinitions) {

      JSONObject activityDefinitionJSONObject =
          JSONFactoryUtil.createJSONObject(JSONFactoryUtil.looseSerialize(activityDefinition));

      JSONArray activityCounterDefinitionsJSONArray = JSONFactoryUtil.createJSONArray();

      for (SocialActivityCounterDefinition activityCounterDefinition :
          activityDefinition.getActivityCounterDefinitions()) {

        JSONObject activityCounterDefinitionJSONObject =
            JSONFactoryUtil.createJSONObject(
                JSONFactoryUtil.looseSerialize(activityCounterDefinition));

        activityCounterDefinitionsJSONArray.put(activityCounterDefinitionJSONObject);
      }

      activityDefinitionJSONObject.put("counters", activityCounterDefinitionsJSONArray);

      jsonArray.put(activityDefinitionJSONObject);
    }

    return jsonArray;
  }
Exemple #3
0
  /** TODO: Remove. This should extend from EditFileEntryAction once it is modularized. */
  protected void addMultipleFileEntries(
      PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    List<KeyValuePair> validFileNameKVPs = new ArrayList<>();
    List<KeyValuePair> invalidFileNameKVPs = new ArrayList<>();

    String[] selectedFileNames =
        ParamUtil.getParameterValues(actionRequest, "selectedFileName", new String[0], false);

    for (String selectedFileName : selectedFileNames) {
      addMultipleFileEntries(
          portletConfig,
          actionRequest,
          actionResponse,
          selectedFileName,
          validFileNameKVPs,
          invalidFileNameKVPs);
    }

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (KeyValuePair validFileNameKVP : validFileNameKVPs) {
      String fileName = validFileNameKVP.getKey();
      String originalFileName = validFileNameKVP.getValue();

      JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

      jsonObject.put("added", Boolean.TRUE);
      jsonObject.put("fileName", fileName);
      jsonObject.put("originalFileName", originalFileName);

      jsonArray.put(jsonObject);
    }

    for (KeyValuePair invalidFileNameKVP : invalidFileNameKVPs) {
      String fileName = invalidFileNameKVP.getKey();
      String errorMessage = invalidFileNameKVP.getValue();

      JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

      jsonObject.put("added", Boolean.FALSE);
      jsonObject.put("errorMessage", errorMessage);
      jsonObject.put("fileName", fileName);
      jsonObject.put("originalFileName", fileName);

      jsonArray.put(jsonObject);
    }

    JSONPortletResponseUtil.writeJSON(actionRequest, actionResponse, jsonArray);
  }
  public void getActionMethodNames(
      ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException {

    PrintWriter printWriter = resourceResponse.getWriter();

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    String contextName = ParamUtil.getString(resourceRequest, "contextName");

    Map<String, Set<JSONWebServiceActionMapping>> jsonWebServiceActionMappingsMap =
        getServiceJSONWebServiceActionMappingsMap(contextName);

    String serviceClassName = ParamUtil.getString(resourceRequest, "serviceClassName");

    Set<JSONWebServiceActionMapping> jsonWebServiceActionMappingsSet =
        jsonWebServiceActionMappingsMap.get(serviceClassName);

    for (JSONWebServiceActionMapping jsonWebServiceActionMapping :
        jsonWebServiceActionMappingsSet) {

      JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

      Method method = jsonWebServiceActionMapping.getActionMethod();

      String actionMethodName = method.getName();

      jsonObject.put("actionMethodName", actionMethodName);

      jsonArray.put(jsonObject);
    }

    printWriter.write(jsonArray.toString());
  }
  protected JSONArray getServiceClassNamesToContextNamesJSONArray() {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    Set<String> contextNames = _jsonWebServiceActionsManager.getContextNames();

    for (String contextName : contextNames) {
      Map<String, Set<JSONWebServiceActionMapping>> jsonWebServiceActionMappingsMap =
          getServiceJSONWebServiceActionMappingsMap(contextName);

      for (Map.Entry<String, Set<JSONWebServiceActionMapping>> entry :
          jsonWebServiceActionMappingsMap.entrySet()) {

        JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

        jsonObject.put("serviceClassName", entry.getKey());

        Set<JSONWebServiceActionMapping> jsonWebServiceActionMappingsSet = entry.getValue();

        Iterator<JSONWebServiceActionMapping> iterator = jsonWebServiceActionMappingsSet.iterator();

        JSONWebServiceActionMapping firstJSONWebServiceActionMapping = iterator.next();

        jsonObject.put("contextName", firstJSONWebServiceActionMapping.getContextName());

        jsonArray.put(jsonObject);
      }
    }

    return jsonArray;
  }
 @Override
 public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
     throws IOException, PortletException {
   String id = resourceRequest.getResourceID();
   if (id.equalsIgnoreCase("getBrokerTopics")) {
     JSONArray topics = JSONFactoryUtil.createJSONArray();
     long brokerId = ParamUtil.getLong(resourceRequest, "brokerId");
     long brokerMessageListenerId = ParamUtil.getLong(resourceRequest, "brokerMessageListenerId");
     try {
       Broker b = BrokerLocalServiceUtil.fetchBroker(brokerId);
       BrokerMessageListener bml =
           (brokerMessageListenerId > 0)
               ? BrokerMessageListenerLocalServiceUtil.fetchBrokerMessageListener(
                   brokerMessageListenerId)
               : null;
       String[] topicsArr = b.getTopics().split(";");
       for (int i = 0; i < topicsArr.length; i++) {
         JSONObject obj = JSONFactoryUtil.createJSONObject();
         obj.put("topic", topicsArr[i]);
         boolean checked = false;
         if (bml != null) {
           String[] messageListenerTopcs = bml.getTopics().split(";");
           for (int j = 0; j < messageListenerTopcs.length && !checked; j++) {
             if (messageListenerTopcs[j].equalsIgnoreCase(topicsArr[i])) checked = true;
           }
         }
         obj.put("checked", checked);
         topics.put(obj);
       }
     } catch (Exception e) {
       logger.error(e);
     }
     resourceResponse.getWriter().println(topics.toString());
   }
 }
  protected JSONArray getPortletURLsJSONArray(Map<String, PortletURL> portletURLs) {

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    if (MapUtil.isEmpty(portletURLs)) {
      return jsonArray;
    }

    for (Map.Entry<String, PortletURL> entry : portletURLs.entrySet()) {
      JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

      jsonObject.put("name", entry.getKey());

      PortletURL portletURL = entry.getValue();

      portletURL.setParameter("selPlid", "{selPlid}");

      jsonObject.put(
          "value",
          StringUtil.replace(portletURL.toString(), HttpUtil.encodePath("{selPlid}"), "{selPlid}"));

      jsonArray.put(jsonObject);
    }

    return jsonArray;
  }
Exemple #8
0
  protected void addDDMFormFieldOptions(
      JSONObject jsonObject,
      DDMFormField ddmFormField,
      Set<Locale> availableLocales,
      Locale defaultLocale) {

    String type = ddmFormField.getType();

    if (!(type.equals(DDMImpl.TYPE_RADIO) || type.equals(DDMImpl.TYPE_SELECT))) {

      return;
    }

    String fieldName = ddmFormField.getName();

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    DDMFormFieldOptions ddmFormFieldOptions = ddmFormField.getDDMFormFieldOptions();

    for (String optionValue : ddmFormFieldOptions.getOptionsValues()) {
      JSONObject optionJSONObject = JSONFactoryUtil.createJSONObject();

      String name = fieldName.concat(StringUtil.randomString());

      optionJSONObject.put("id", name);
      optionJSONObject.put("name", name);
      optionJSONObject.put("type", "option");
      optionJSONObject.put("value", optionValue);

      addDDMFormFieldLocalizedProperty(
          optionJSONObject,
          "label",
          ddmFormFieldOptions.getOptionLabels(optionValue),
          defaultLocale,
          defaultLocale,
          "option");

      JSONObject localizationMapJSONObject = JSONFactoryUtil.createJSONObject();

      for (Locale availableLocale : availableLocales) {
        JSONObject localeMap = JSONFactoryUtil.createJSONObject();

        addDDMFormFieldLocalizedProperty(
            localeMap,
            "label",
            ddmFormFieldOptions.getOptionLabels(optionValue),
            availableLocale,
            defaultLocale,
            "option");

        localizationMapJSONObject.put(LocaleUtil.toLanguageId(availableLocale), localeMap);
      }

      optionJSONObject.put("localizationMap", localizationMapJSONObject);

      jsonArray.put(optionJSONObject);
    }

    jsonObject.put("options", jsonArray);
  }
  protected void updateBasicConfiguration(
      PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    boolean displayScopeFacet =
        GetterUtil.getBoolean(getParameter(actionRequest, "displayScopeFacet"));
    boolean displayAssetCategoriesFacet =
        GetterUtil.getBoolean(getParameter(actionRequest, "displayAssetCategoriesFacet"));
    boolean displayAssetTagsFacet =
        GetterUtil.getBoolean(getParameter(actionRequest, "displayAssetTagsFacet"));
    boolean displayAssetTypeFacet =
        GetterUtil.getBoolean(getParameter(actionRequest, "displayAssetTypeFacet"));
    boolean displayFolderFacet =
        GetterUtil.getBoolean(getParameter(actionRequest, "displayFolderFacet"));
    boolean displayUserFacet =
        GetterUtil.getBoolean(getParameter(actionRequest, "displayUserFacet"));
    boolean displayModifiedRangeFacet =
        GetterUtil.getBoolean(getParameter(actionRequest, "displayModifiedRangeFacet"));

    String searchConfiguration = ContentUtil.get(SearchWebConfigurationValues.FACET_CONFIGURATION);

    JSONObject configurationJSONObject = JSONFactoryUtil.createJSONObject(searchConfiguration);

    JSONArray oldFacetsJSONArray = configurationJSONObject.getJSONArray("facets");

    if (oldFacetsJSONArray == null) {
      if (_log.isWarnEnabled()) {
        _log.warn(
            "The resource "
                + SearchWebConfigurationValues.FACET_CONFIGURATION
                + " is missing a valid facets JSON array");
      }
    }

    JSONArray newFacetsJSONArray = JSONFactoryUtil.createJSONArray();

    for (int i = 0; i < oldFacetsJSONArray.length(); i++) {
      JSONObject oldFacetJSONObject = oldFacetsJSONArray.getJSONObject(i);

      String fieldName = oldFacetJSONObject.getString("fieldName");

      if ((displayScopeFacet && fieldName.equals("groupId"))
          || (displayAssetCategoriesFacet && fieldName.equals("assetCategoryIds"))
          || (displayAssetTagsFacet && fieldName.equals("assetTagNames"))
          || (displayAssetTypeFacet && fieldName.equals("entryClassName"))
          || (displayFolderFacet && fieldName.equals("folderId"))
          || (displayUserFacet && fieldName.equals("userId"))
          || (displayModifiedRangeFacet && fieldName.equals("modified"))) {

        newFacetsJSONArray.put(oldFacetJSONObject);
      }
    }

    configurationJSONObject.put("facets", newFacetsJSONArray);

    searchConfiguration = configurationJSONObject.toString();

    setPreference(actionRequest, "searchConfiguration", searchConfiguration);
  }
  @Override
  public void populateConfigJSONObject(
      JSONObject jsonObject,
      Map<String, Object> inputEditorTaglibAttributes,
      ThemeDisplay themeDisplay,
      RequestBackedPortletURLFactory requestBackedPortletURLFactory) {

    JSONObject autoCompleteConfigJSONObject = JSONFactoryUtil.createJSONObject();

    autoCompleteConfigJSONObject.put("requestTemplate", "query={query}");

    JSONArray triggerJSONArray = JSONFactoryUtil.createJSONArray();

    JSONObject triggerJSONObject = JSONFactoryUtil.createJSONObject();

    triggerJSONObject.put("resultFilters", "function(query, results) {return results;}");
    triggerJSONObject.put("resultTextLocator", "title");

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    ResourceURL autoCompletePageTitleURL =
        (ResourceURL) requestBackedPortletURLFactory.createResourceURL(portletDisplay.getId());

    Map<String, String> fileBrowserParams =
        (Map<String, String>)
            inputEditorTaglibAttributes.get("liferay-ui:input-editor:fileBrowserParams");

    autoCompletePageTitleURL.setParameter("nodeId", fileBrowserParams.get("nodeId"));

    autoCompletePageTitleURL.setResourceID("/wiki/autocomplete_page_title");

    String source =
        autoCompletePageTitleURL.toString()
            + "&"
            + _portal.getPortletNamespace(portletDisplay.getId());

    triggerJSONObject.put("source", source);

    triggerJSONObject.put("term", "[");
    triggerJSONObject.put("tplReplace", "<a href=\"{title}\">{title}</a>");
    triggerJSONObject.put("tplResults", "<span class=\"h5 truncate-text\">{title}</span>");

    triggerJSONArray.put(triggerJSONObject);

    autoCompleteConfigJSONObject.put("trigger", triggerJSONArray);

    jsonObject.put("autocomplete", autoCompleteConfigJSONObject);

    String extraPlugins = jsonObject.getString("extraPlugins");

    if (Validator.isNotNull(extraPlugins)) {
      extraPlugins += ",autocomplete";
    } else {
      extraPlugins = "autocomplete,ae_placeholder,ae_selectionregion,ae_uicore";
    }

    jsonObject.put("extraPlugins", extraPlugins);
  }
  public static JSONArray toJSONArray(List<com.ext.portlet.reports.model.ReportsEntry> models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (ReportsEntry model : models) {
      jsonArray.put(toJSONObject(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(List<com.nss.portlet.qa_chu_de.model.QAChuDeCauHoi> models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (QAChuDeCauHoi model : models) {
      jsonArray.put(toJSONObject(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(com.ext.portlet.debaterevision.model.DebateItem[][] models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (DebateItem[] model : models) {
      jsonArray.put(toJSONArray(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(List<com.liferay.portlet.asset.model.AssetTag> models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (AssetTag model : models) {
      jsonArray.put(toJSONObject(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(com.liferay.portal.model.Phone[][] models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (Phone[] model : models) {
      jsonArray.put(toJSONArray(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(List<com.nss.portlet.journal.model.JournalTemplate> models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (JournalTemplate model : models) {
      jsonArray.put(toJSONObject(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(List<com.liferay.portal.model.Group> models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (Group model : models) {
      jsonArray.put(toJSONObject(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(List<net.sareweb.wildtaxi.model.Request> models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (Request model : models) {
      jsonArray.put(toJSONObject(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(
      List<com.sgs.portlet.pml_ho_so_cong_viec.model.PmlHoSoCongViec> models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (PmlHoSoCongViec model : models) {
      jsonArray.put(toJSONObject(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(
      List<com.ext.conditionaltext.model.ConditionalTextSetting> models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (ConditionalTextSetting model : models) {
      jsonArray.put(toJSONObject(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(
      com.liferay.portlet.asset.model.AssetCategoryProperty[][] models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (AssetCategoryProperty[] model : models) {
      jsonArray.put(toJSONArray(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(
      List<com.sgs.portlet.receivergroup.model.ReceiverGroup> models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (ReceiverGroup model : models) {
      jsonArray.put(toJSONObject(model));
    }

    return jsonArray;
  }
  public static JSONArray toJSONArray(
      List<com.sgs.portlet.loaivanbannoibo.model.SoLoaiVanBanNoiBo> models) {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    for (SoLoaiVanBanNoiBo model : models) {
      jsonArray.put(toJSONObject(model));
    }

    return jsonArray;
  }
  protected void testSelectDDMFormFieldValueValues(DDMFormFieldValue ddmFormFieldValue)
      throws Exception {

    Assert.assertEquals("yhar", ddmFormFieldValue.getInstanceId());

    Value value = ddmFormFieldValue.getValue();

    JSONArray expectedJSONArray = JSONFactoryUtil.createJSONArray();

    expectedJSONArray.put("Value 1");
    expectedJSONArray.put("Value 3");

    JSONAssert.assertEquals(expectedJSONArray.toString(), value.getString(LocaleUtil.US), false);

    expectedJSONArray = JSONFactoryUtil.createJSONArray();

    expectedJSONArray.put("Value 2");
    expectedJSONArray.put("Value 3");

    JSONAssert.assertEquals(
        expectedJSONArray.toString(), value.getString(LocaleUtil.BRAZIL), false);
  }
  public static JSONArray toJSONTitles(JSONArray columns) {
    if (columns == null) {
      return (null);
    }

    JSONArray titles = JSONFactoryUtil.createJSONArray();
    int columnsLength = columns.length();
    for (int column = 0; column < columnsLength; column++) {
      JSONObject jsonObject = columns.getJSONObject(column);
      if (jsonObject != null) {
        titles.put(
            jsonObject.getString("title", jsonObject.getString("data", String.valueOf(column))));
      }
    }
    return (titles);
  }
Exemple #26
0
  protected JSONArray getDDMFormFieldsJSONArray(
      List<DDMFormField> ddmFormFields, Set<Locale> availableLocales, Locale defaultLocale) {

    JSONArray ddmFormFieldsJSONArray = JSONFactoryUtil.createJSONArray();

    for (DDMFormField ddmFormField : ddmFormFields) {
      JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

      jsonObject.put("dataType", ddmFormField.getDataType());
      jsonObject.put("id", ddmFormField.getName());
      jsonObject.put("indexType", ddmFormField.getIndexType());
      jsonObject.put("localizable", ddmFormField.isLocalizable());
      jsonObject.put("multiple", ddmFormField.isMultiple());
      jsonObject.put("name", ddmFormField.getName());
      jsonObject.put("repeatable", ddmFormField.isRepeatable());
      jsonObject.put("required", ddmFormField.isRequired());
      jsonObject.put("showLabel", ddmFormField.isShowLabel());
      jsonObject.put("type", ddmFormField.getType());

      addDDMFormFieldLocalizedProperties(jsonObject, ddmFormField, defaultLocale, defaultLocale);

      addDDMFormFieldOptions(jsonObject, ddmFormField, availableLocales, defaultLocale);

      JSONObject localizationMapJSONObject = JSONFactoryUtil.createJSONObject();

      for (Locale availableLocale : availableLocales) {
        JSONObject localeMap = JSONFactoryUtil.createJSONObject();

        addDDMFormFieldLocalizedProperties(localeMap, ddmFormField, availableLocale, defaultLocale);

        localizationMapJSONObject.put(LocaleUtil.toLanguageId(availableLocale), localeMap);
      }

      jsonObject.put("localizationMap", localizationMapJSONObject);

      jsonObject.put(
          "fields",
          getDDMFormFieldsJSONArray(
              ddmFormField.getNestedDDMFormFields(), availableLocales, defaultLocale));

      ddmFormFieldsJSONArray.put(jsonObject);
    }

    return ddmFormFieldsJSONArray;
  }
  protected JSONArray getMediaItems(List<MediaItem> mediaItems) {
    if (mediaItems == null) {
      return null;
    }

    JSONArray mediaItemsJSONArray = JSONFactoryUtil.createJSONArray();

    for (MediaItem mediaItem : mediaItems) {
      JSONObject mediaItemsJsonObject = JSONFactoryUtil.createJSONObject();

      mediaItemsJsonObject.put("mimeType", mediaItem.getMimeType());
      mediaItemsJsonObject.put("type", String.valueOf(mediaItem.getType()));
      mediaItemsJsonObject.put("url", mediaItem.getUrl());

      mediaItemsJSONArray.put(mediaItemsJsonObject);
    }

    return mediaItemsJSONArray;
  }
  @Override
  public void executeRead(
      HttpServletRequest request, JSONObject responseJSONObject, Queue<String> arguments) {

    JSONObject pluginPackageJSONObject = JSONFactoryUtil.createJSONObject();

    String context = arguments.poll();

    PluginPackage pluginPackage = DeployManagerUtil.getInstalledPluginPackage(context);

    boolean installed = true;

    if (pluginPackage == null) {
      installed = false;
    }

    pluginPackageJSONObject.put("installed", installed);

    boolean started = true;

    if (pluginPackage == null) {
      started = false;
    }

    pluginPackageJSONObject.put("started", started);

    List<String> types = new ArrayList<>();

    if (pluginPackage != null) {
      types = pluginPackage.getTypes();
    }

    JSONArray typesJSONArray = JSONFactoryUtil.createJSONArray();

    for (String type : types) {
      typesJSONArray.put(type);
    }

    pluginPackageJSONObject.put("types", typesJSONArray);

    responseJSONObject.put(JSONKeys.OUTPUT, pluginPackageJSONObject);
  }
  protected JSONArray getTemplateParams(Map<String, String> map) {
    if (map == null) {
      return null;
    }

    JSONArray templateParamsJSONArray = JSONFactoryUtil.createJSONArray();

    for (Entry<String, String> entry : map.entrySet()) {
      JSONObject templateParamJSONObject = JSONFactoryUtil.createJSONObject();

      String name = entry.getKey();
      String value = entry.getValue();

      templateParamJSONObject.put(name, value);

      templateParamsJSONArray.put(templateParamJSONObject);
    }

    return templateParamsJSONArray;
  }
  @Override
  public JSONArray getWARPortlets() {
    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    List<Portlet> portlets = portletLocalService.getPortlets();

    for (Portlet portlet : portlets) {
      PortletApp portletApp = portlet.getPortletApp();

      if (portletApp.isWARFile()) {
        JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

        jsonObject.put("portlet_name", portlet.getPortletName());
        jsonObject.put("servlet_context_name", portletApp.getServletContextName());

        jsonArray.put(jsonObject);
      }
    }

    return jsonArray;
  }