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