Revision 01a30cd0 src/gr/ebs/gss/server/CouponVerifier.java
b/src/gr/ebs/gss/server/CouponVerifier.java | ||
---|---|---|
18 | 18 |
*/ |
19 | 19 |
package gr.ebs.gss.server; |
20 | 20 |
|
21 |
import gr.ebs.gss.client.exceptions.RpcException; |
|
22 |
import gr.ebs.gss.server.domain.User; |
|
21 |
import gr.ebs.gss.server.ejb.TransactionHelper; |
|
23 | 22 |
|
24 | 23 |
import java.io.IOException; |
24 |
import java.util.concurrent.Callable; |
|
25 | 25 |
|
26 | 26 |
import javax.servlet.http.HttpServletRequest; |
27 | 27 |
import javax.servlet.http.HttpServletResponse; |
28 | 28 |
|
29 |
import org.apache.commons.logging.Log; |
|
30 |
import org.apache.commons.logging.LogFactory; |
|
31 |
|
|
32 | 29 |
/** |
33 | 30 |
* The servlet that handles user registration. |
34 | 31 |
* |
... | ... | |
70 | 67 |
*/ |
71 | 68 |
private static final long serialVersionUID = 1L; |
72 | 69 |
|
73 |
/** |
|
74 |
* The logger. |
|
75 |
*/ |
|
76 |
private static Log logger = LogFactory.getLog(CouponVerifier.class); |
|
77 |
|
|
78 | 70 |
@Override |
79 | 71 |
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { |
80 | 72 |
String firstname = request.getParameter(FIRSTNAME_PARAM); |
81 | 73 |
String lastname = request.getParameter(LASTNAME_PARAM); |
82 | 74 |
String email = request.getParameter(EMAIL_PARAM); |
83 |
String username = request.getParameter(USERNAME_PARAM); |
|
84 |
String code = request.getParameter(CODE_PARAM); |
|
75 |
final String username = request.getParameter(USERNAME_PARAM);
|
|
76 |
final String code = request.getParameter(CODE_PARAM);
|
|
85 | 77 |
String verify = request.getParameter(VERIFY_PARAM); |
86 | 78 |
response.setContentType("text/html"); |
87 | 79 |
|
... | ... | |
113 | 105 |
return; |
114 | 106 |
} |
115 | 107 |
|
116 |
User user = null; |
|
117 | 108 |
try { |
118 |
user = getService().findUser(username); |
|
119 |
if (user == null) { |
|
120 |
handleException(response, "Your user account was not found"); |
|
121 |
return; |
|
122 |
} |
|
123 |
// TODO: update userclass |
|
124 |
/* |
|
125 |
final UserDTO userDto = new TransactionHelper<UserDTO>().tryExecute(new Callable<UserDTO>() { |
|
126 |
@Override |
|
127 |
public UserDTO call() throws Exception { |
|
128 |
return getService().createUser(username, firstname + " " + lastname, email, "", "").getDTO(); |
|
129 |
} |
|
130 |
|
|
131 |
}); |
|
132 | 109 |
new TransactionHelper<Void>().tryExecute(new Callable<Void>() { |
133 | 110 |
@Override |
134 | 111 |
public Void call() throws Exception { |
135 |
getService().updateUserPolicyAcceptance(userDto.getId(), true);
|
|
112 |
getService().upgradeUserClass(username, code);
|
|
136 | 113 |
return null; |
137 | 114 |
} |
138 | 115 |
|
139 |
});*/ |
|
140 |
response.sendRedirect("couponSubmitted.jsp"); |
|
141 |
} catch (RpcException e) { |
|
142 |
logger.error(e); |
|
143 |
handleException(response, "An error occurred while communicating with the service"); |
|
116 |
}); |
|
117 |
response.sendRedirect("couponSubmitted.jsp?newQuota=" + getService().getCouponUserClass().getQuotaAsString()); |
|
144 | 118 |
} catch (Exception e) { |
145 |
logger.error(e); |
|
146 | 119 |
handleException(response, e.getMessage()); |
147 | 120 |
} |
148 | 121 |
} |
Also available in: Unified diff