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