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