Example usage for com.liferay.portal.kernel.portlet LiferayPortletURL getParameter

List of usage examples for com.liferay.portal.kernel.portlet LiferayPortletURL getParameter

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.portlet LiferayPortletURL getParameter.

Prototype

@Deprecated
public String getParameter(String name);

Source Link

Usage

From source file:com.liferay.util.bridges.wai.WAIFriendlyURLMapper.java

License:Open Source License

public String buildPath(LiferayPortletURL liferayPortletURL) {
    String portletId = liferayPortletURL.getPortletId();

    String prefix = portletId;/*from  w w  w .j  a  v  a2  s.  c  o  m*/

    int pos = portletId.indexOf(PortletConstants.WAR_SEPARATOR);

    if (pos != -1) {
        prefix = portletId.substring(0, pos);
    }

    String appUrl = GetterUtil.getString(liferayPortletURL.getParameter("appURL"));

    liferayPortletURL.addParameterIncludedInPath("p_p_id");

    return StringPool.SLASH + _MAPPING + StringPool.SLASH + prefix + StringPool.SLASH + appUrl;
}

From source file:com.liferay.wol.meetups.portlet.MeetupsFriendlyURLMapper.java

License:Open Source License

public String buildPath(LiferayPortletURL portletURL) {
    String jspPage = GetterUtil.getString(portletURL.getParameter("jspPage"));
    long meetupsEntryId = GetterUtil.getLong(portletURL.getParameter("meetupsEntryId"));

    if ((jspPage.equals("/meetups/view_entry.jsp")) && (meetupsEntryId > 0)) {

        portletURL.addParameterIncludedInPath("p_p_id");

        portletURL.addParameterIncludedInPath("jspPage");
        portletURL.addParameterIncludedInPath("meetupsEntryId");

        StringBuilder sb = new StringBuilder();

        sb.append(StringPool.SLASH);//from   ww  w. j  a v  a 2  s .c  o m
        sb.append(_MAPPING);
        sb.append("/entry/");
        sb.append(meetupsEntryId);

        return sb.toString();
    }

    return null;
}

From source file:com.vportal.portlet.vcms.util.VCMSFriendlyURLMapper.java

License:Open Source License

public String buildPath(LiferayPortletURL portletURL) {
    // TODO Auto-generated method stub

    String friendlyURLPath = null;

    String portletId = portletURL.getPortletId();

    VcmsArticle article = null;/* ww w.  j a  v  a2  s  . c o  m*/
    VcmsCategory category = null;
    try {

        String articleId = GetterUtil.getString(portletURL.getParameter("articleId"), "0");
        String categoryId = GetterUtil.getString(portletURL.getParameter("categoryId"), "0");

        if (!Validator.equals(articleId, "0") || !Validator.equals(categoryId, "0")) {

            if (portletId.equals(_PORTLET_DEFAULT_INSTANCE)) {
                portletId = _PORTLET_ID;
            }

            String[] arrInstance = StringUtil.split(portletId, "_");

            // friendlyURLPath = "/vcmsviewcontent/" + arrInstance[2];

            friendlyURLPath = StringPool.FORWARD_SLASH + getMapping() + StringPool.FORWARD_SLASH
                    + arrInstance[4];

            portletURL.addParameterIncludedInPath("p_p_id");
            portletURL.addParameterIncludedInPath("p_p_lifecycle");
            // portletURL.addParameterIncludedInPath("p_p_state");// k co
            // portletURL.addParameterIncludedInPath("p_p_mode");// k co
            portletURL.addParameterIncludedInPath("p_p_col_id");
            portletURL.addParameterIncludedInPath("p_p_col_count");
            portletURL.addParameterIncludedInPath("p_p_col_pos");
            portletURL.addParameterIncludedInPath("jspPage");

            if (!categoryId.equalsIgnoreCase("0")) {
                friendlyURLPath += StringPool.FORWARD_SLASH + categoryId;
                portletURL.addParameterIncludedInPath("categoryId");
            }

            if (!articleId.equalsIgnoreCase("0")) {
                friendlyURLPath += StringPool.FORWARD_SLASH + articleId;
                portletURL.addParameterIncludedInPath("articleId");
            }

            if (!articleId.equalsIgnoreCase("0")) {
                article = VcmsArticleServiceUtil.getArticle(articleId);
                friendlyURLPath += StringPool.FORWARD_SLASH
                        + Normalizer.normalize(article.getTitle(), Normalizer.Form.NFD)
                                .replaceAll("[^\\p{ASCII}]", "")
                                // .replaceAll("-", "")                           
                                //                           .replaceAll(" ", "-")                           
                                .replaceAll("[^a-zA-Z0-9-]", "-").replaceAll("-{2,}", "-").toLowerCase()
                        + ".html";
            }

            if (!categoryId.equalsIgnoreCase("0") && articleId.equalsIgnoreCase("0")) {
                category = VcmsCategoryServiceUtil.getCategory(categoryId);
                friendlyURLPath += StringPool.FORWARD_SLASH
                        + Normalizer.normalize(category.getName(), Normalizer.Form.NFD)
                                .replaceAll("[^\\p{ASCII}]", "")
                                // .replaceAll("-", "")
                                //                           .replaceAll("\\b\\s{1,}\\b", "-")
                                .replaceAll("[^a-zA-Z0-9-]", "-").replaceAll("-{2,}", "-").toLowerCase()
                        + ".html";
            }
        }

    } catch (PortalException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (SystemException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return friendlyURLPath;
}

From source file:de.uhh.l2g.util.GuestLectureseriesFriendlyURLMapper.java

License:Open Source License

/**
 * Builds the path./*from w  ww . j  a va 2  s . co  m*/
 *
 * @param portletURL the portlet url
 * @return the string
 */
public String buildPath(LiferayPortletURL portletURL) {
    String friendlyURLPath = null;
    String videoId = portletURL.getParameter("videoId");

    // videoId
    if (videoId != null && !videoId.equals("")) {
        friendlyURLPath = "/v/" + videoId;
    }

    if (Validator.isNotNull(friendlyURLPath)) {
        portletURL.addParameterIncludedInPath("p_p_id");
        portletURL.addParameterIncludedInPath("p_p_lifecycle");
        portletURL.addParameterIncludedInPath("p_p_state");
        portletURL.addParameterIncludedInPath("p_p_mode");
        portletURL.addParameterIncludedInPath("p_p_col_id");
        portletURL.addParameterIncludedInPath("p_p_col_count");
        portletURL.addParameterIncludedInPath("videoId");
        portletURL.addParameterIncludedInPath("method");
        portletURL.addParameterIncludedInPath("clipStartTime");
        portletURL.addParameterIncludedInPath("clipEndTime");

        portletURL.addParameterIncludedInPath("facultyId");
        portletURL.addParameterIncludedInPath("subFacility1Id");
        portletURL.addParameterIncludedInPath("subFacility2Id");
        portletURL.addParameterIncludedInPath("lectureseriesId");
    }

    return friendlyURLPath;
}

From source file:de.uhh.l2g.util.GuestSearchFriendlyURLMapper.java

License:Open Source License

/**
 * Builds the path.// www.j a v  a2  s . co  m
 *
 * @param portletURL the portlet url
 * @return the string
 */
public String buildPath(LiferayPortletURL portletURL) {
    String friendlyURLPath = null;
    String videoId = portletURL.getParameter("videoId");

    // videoId
    if (videoId != null && !videoId.equals("")) {
        friendlyURLPath = "/s/" + videoId;
    }

    if (Validator.isNotNull(friendlyURLPath)) {
        portletURL.addParameterIncludedInPath("p_p_id");
        portletURL.addParameterIncludedInPath("p_p_lifecycle");
        portletURL.addParameterIncludedInPath("p_p_state");
        portletURL.addParameterIncludedInPath("p_p_mode");
        portletURL.addParameterIncludedInPath("p_p_col_id");
        portletURL.addParameterIncludedInPath("p_p_col_count");
        portletURL.addParameterIncludedInPath("videoId");
        portletURL.addParameterIncludedInPath("method");

        portletURL.addParameterIncludedInPath("facultyId");
        portletURL.addParameterIncludedInPath("subFacility1Id");
        portletURL.addParameterIncludedInPath("subFacility2Id");
        portletURL.addParameterIncludedInPath("lectureseriesId");
    }

    return friendlyURLPath;
}

From source file:de.uhh.l2g.util.StudentFriendlyURLMapper.java

License:Open Source License

/**
 * Builds the path./*from w  w  w.ja  v a 2  s  . co m*/
 *
 * @param portletURL the portlet url
 * @return the string
 */
public String buildPath(LiferayPortletURL portletURL) {
    String friendlyURLPath = null;
    String videoId = portletURL.getParameter("videoId");

    // videoId
    if (videoId != null && !videoId.equals("")) {
        friendlyURLPath = "/sv/" + videoId.split("\\.")[0];
    }

    if (Validator.isNotNull(friendlyURLPath)) {
        portletURL.addParameterIncludedInPath("p_p_id");
        portletURL.addParameterIncludedInPath("p_p_lifecycle");
        portletURL.addParameterIncludedInPath("p_p_state");
        portletURL.addParameterIncludedInPath("p_p_mode");
        portletURL.addParameterIncludedInPath("p_p_col_id");
        portletURL.addParameterIncludedInPath("p_p_col_count");
        portletURL.addParameterIncludedInPath("videoId");
        portletURL.addParameterIncludedInPath("method");

        portletURL.addParameterIncludedInPath("facultyId");
        portletURL.addParameterIncludedInPath("subFacility1Id");
        portletURL.addParameterIncludedInPath("subFacility2Id");
        portletURL.addParameterIncludedInPath("lectureseriesId");
    }

    return friendlyURLPath;
}