1
14
15 package com.liferay.portlet.webform.action;
16
17 import com.liferay.portal.kernel.util.StringPool;
18 import com.liferay.portal.kernel.util.Validator;
19 import com.liferay.portal.struts.PortletAction;
20 import com.liferay.portlet.PortletPreferencesFactoryUtil;
21 import com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil;
22 import com.liferay.portlet.webform.util.WebFormUtil;
23
24 import javax.portlet.ActionRequest;
25 import javax.portlet.ActionResponse;
26 import javax.portlet.PortletConfig;
27 import javax.portlet.PortletPreferences;
28
29 import org.apache.struts.action.ActionForm;
30 import org.apache.struts.action.ActionMapping;
31
32
37 public class DeleteDataAction extends PortletAction {
38
39 public void processAction(
40 ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
41 ActionRequest actionRequest, ActionResponse actionResponse)
42 throws Exception {
43
44 PortletPreferences preferences =
45 PortletPreferencesFactoryUtil.getPortletSetup(actionRequest);
46
47 String databaseTableName = preferences.getValue(
48 "databaseTableName", StringPool.BLANK);
49
50 if (Validator.isNotNull(databaseTableName)) {
51 ExpandoTableLocalServiceUtil.deleteTable(
52 WebFormUtil.class.getName(), databaseTableName);
53 }
54
55 sendRedirect(actionRequest, actionResponse);
56 }
57
58 }