2 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
\r
4 * This library is free software; you can redistribute it and/or modify it under
\r
5 * the terms of the GNU Lesser General Public License as published by the Free
\r
6 * Software Foundation; either version 2.1 of the License, or (at your option)
\r
9 * This library is distributed in the hope that it will be useful, but WITHOUT
\r
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
\r
15 package com.liferay.portal.action;
\r
17 import java.util.Date;
\r
19 import com.liferay.portal.service.UserServiceUtil;
\r
20 import com.liferay.portal.struts.ActionConstants;
\r
21 import com.liferay.portal.util.PortalUtil;
\r
22 import com.pentila.entSavoie.userProperties.model.UserProperties;
\r
23 import com.pentila.entSavoie.userProperties.service.UserPropertiesLocalServiceUtil;
\r
25 import javax.servlet.http.HttpServletRequest;
\r
26 import javax.servlet.http.HttpServletResponse;
\r
28 import org.apache.struts.action.Action;
\r
29 import org.apache.struts.action.ActionForm;
\r
30 import org.apache.struts.action.ActionForward;
\r
31 import org.apache.struts.action.ActionMapping;
\r
34 * @author Brian Wing Shun Chan
\r
36 public class UpdateTermsOfUseAction extends Action {
\r
39 public ActionForward execute(
\r
40 ActionMapping mapping, ActionForm form, HttpServletRequest request,
\r
41 HttpServletResponse response)
\r
44 long userId = PortalUtil.getUserId(request);
\r
46 UserServiceUtil.updateAgreedToTermsOfUse(userId, true);
\r
48 UserProperties userProperties = UserPropertiesLocalServiceUtil.getUserPropertiesByUserId(userId);
\r
49 userProperties.setTermsOfUseAgreedDate(new Date());
\r
50 UserPropertiesLocalServiceUtil.updateUserProperties(userProperties);
\r
52 return mapping.findForward(ActionConstants.COMMON_REFERER_JSP);
\r