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