1
14
15 package com.liferay.portlet.tagscompiler;
16
17 import com.liferay.portal.kernel.portlet.BaseFriendlyURLMapper;
18 import com.liferay.portal.kernel.portlet.LiferayPortletURL;
19 import com.liferay.portal.kernel.util.StringBundler;
20 import com.liferay.portal.kernel.util.StringPool;
21 import com.liferay.portal.kernel.util.StringUtil;
22 import com.liferay.portal.util.PortletKeys;
23
24 import java.util.Map;
25
26 import javax.portlet.PortletMode;
27 import javax.portlet.WindowState;
28
29
35 public class TagsCompilerFriendlyURLMapper extends BaseFriendlyURLMapper {
36
37 public String buildPath(LiferayPortletURL portletURL) {
38 return null;
39 }
40
41 public String getMapping() {
42 return _MAPPING;
43 }
44
45 public String getPortletId() {
46 return _PORTLET_ID;
47 }
48
49 public boolean isCheckMappingWithPrefix() {
50 return _CHECK_MAPPING_WITH_PREFIX;
51 }
52
53 public void populateParams(
54 String friendlyURLPath, Map<String, String[]> params) {
55
56 addParam(params, "p_p_id", _PORTLET_ID);
57 addParam(params, "p_p_lifecycle", "0");
58 addParam(params, "p_p_state", WindowState.NORMAL);
59 addParam(params, "p_p_mode", PortletMode.VIEW);
60
61 int x = friendlyURLPath.indexOf(StringPool.SLASH, 1);
62 int y = friendlyURLPath.length();
63
64 String[] entries = StringUtil.split(
65 friendlyURLPath.substring(x + 1, y), StringPool.SLASH);
66
67 if (entries.length > 0) {
68 StringBundler sb = new StringBundler(entries.length * 2 - 1);
69
70 for (int i = 0; i < entries.length; i++) {
71 String entry = StringUtil.replace(
72 entries[i], StringPool.PLUS, StringPool.SPACE);
73
74 if (i != 0) {
75 sb.append(StringPool.COMMA);
76 }
77
78 sb.append(entry);
79 }
80
81 addParam(params, "entries", sb.toString());
82 }
83 }
84
85 private static final boolean _CHECK_MAPPING_WITH_PREFIX = false;
86
87 private static final String _MAPPING = "tags";
88
89 private static final String _PORTLET_ID = PortletKeys.TAGS_COMPILER;
90
91 }