1
22
23 package com.liferay.portlet.tagsadmin.action;
24
25 import com.liferay.portal.kernel.log.Log;
26 import com.liferay.portal.kernel.log.LogFactoryUtil;
27 import com.liferay.portal.kernel.util.Constants;
28 import com.liferay.portal.kernel.util.ParamUtil;
29 import com.liferay.portal.struts.JSONAction;
30 import com.liferay.portlet.tags.service.TagsPropertyServiceUtil;
31
32 import javax.servlet.http.HttpServletRequest;
33 import javax.servlet.http.HttpServletResponse;
34
35 import org.apache.struts.action.ActionForm;
36 import org.apache.struts.action.ActionMapping;
37
38
43 public class EditPropertyAction extends JSONAction {
44
45 public String getJSON(
46 ActionMapping mapping, ActionForm form, HttpServletRequest request,
47 HttpServletResponse response)
48 throws Exception {
49
50 String cmd = ParamUtil.getString(request, Constants.CMD);
51
52 try {
53 if (cmd.equals("addProperty")) {
54 addProperty(request);
55 }
56 }
57 catch (Exception e) {
58 _log.error(e, e);
59 }
60
61 return null;
62 }
63
64 protected void addProperty(HttpServletRequest request) throws Exception {
65 long entryId = ParamUtil.getLong(request, "entryId");
66 String key = ParamUtil.getString(request, "key");
67 String value = ParamUtil.getString(request, "value");
68
69 TagsPropertyServiceUtil.addProperty(entryId, key, value);
70 }
71
72 private static Log _log = LogFactoryUtil.getLog(EditPropertyAction.class);
73
74 }