| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import java.time.LocalDateTime;
|
3 |
import java.time.LocalDateTime;
|
| - |
|
4 |
import java.util.HashMap;
|
| 4 |
import java.util.Map;
|
5 |
import java.util.Map;
|
| - |
|
6 |
import java.util.Set;
|
| 5 |
|
7 |
|
| 6 |
import javax.servlet.http.HttpServletRequest;
|
8 |
import javax.servlet.http.HttpServletRequest;
|
| 7 |
|
9 |
|
| 8 |
import org.slf4j.Logger;
|
10 |
import org.slf4j.Logger;
|
| 9 |
import org.slf4j.LoggerFactory;
|
11 |
import org.slf4j.LoggerFactory;
|
| 10 |
import org.springframework.beans.factory.annotation.Autowired;
|
12 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
13 |
import org.springframework.beans.factory.annotation.Value;
|
| 11 |
import org.springframework.http.HttpStatus;
|
14 |
import org.springframework.http.HttpStatus;
|
| 12 |
import org.springframework.http.ResponseEntity;
|
15 |
import org.springframework.http.ResponseEntity;
|
| 13 |
import org.springframework.stereotype.Controller;
|
16 |
import org.springframework.stereotype.Controller;
|
| 14 |
import org.springframework.web.bind.annotation.RequestBody;
|
17 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 15 |
import org.springframework.web.bind.annotation.RequestMapping;
|
18 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| Line 18... |
Line 21... |
| 18 |
|
21 |
|
| 19 |
import com.spice.profitmandi.common.ResponseCodeHolder;
|
22 |
import com.spice.profitmandi.common.ResponseCodeHolder;
|
| 20 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
23 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 21 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
24 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 22 |
import com.spice.profitmandi.common.util.JWTUtil;
|
25 |
import com.spice.profitmandi.common.util.JWTUtil;
|
| - |
|
26 |
import com.spice.profitmandi.dao.entity.Role;
|
| 23 |
import com.spice.profitmandi.dao.entity.User;
|
27 |
import com.spice.profitmandi.dao.entity.User;
|
| 24 |
import com.spice.profitmandi.dao.repository.UserRepository;
|
28 |
import com.spice.profitmandi.dao.repository.UserRepository;
|
| 25 |
import com.spice.profitmandi.web.model.ProfitMandiResponse;
|
29 |
import com.spice.profitmandi.web.model.ProfitMandiResponse;
|
| 26 |
import com.spice.profitmandi.web.model.Response;
|
30 |
import com.spice.profitmandi.web.model.Response;
|
| 27 |
import com.spice.profitmandi.web.model.ResponseStatus;
|
31 |
import com.spice.profitmandi.web.model.ResponseStatus;
|
| Line 32... |
Line 36... |
| 32 |
* @author ashikali
|
36 |
* @author ashikali
|
| 33 |
*
|
37 |
*
|
| 34 |
*/
|
38 |
*/
|
| 35 |
@Controller
|
39 |
@Controller
|
| 36 |
public class UserController {
|
40 |
public class UserController {
|
| 37 |
|
41 |
|
| 38 |
private static final Logger LOGGER=LoggerFactory.getLogger(UserController.class);
|
42 |
private static final Logger LOGGER=LoggerFactory.getLogger(UserController.class);
|
| 39 |
|
43 |
|
| - |
|
44 |
@Value("${admin.token}")
|
| - |
|
45 |
private String validAdminToken;
|
| - |
|
46 |
|
| 40 |
@Autowired
|
47 |
@Autowired
|
| 41 |
UserRepository userRepository;
|
48 |
UserRepository userRepository;
|
| 42 |
|
49 |
|
| 43 |
@Autowired
|
50 |
@Autowired
|
| 44 |
GoogleLoginProcessor googleLoginProcessor;
|
51 |
GoogleLoginProcessor googleLoginProcessor;
|
| 45 |
|
52 |
|
| 46 |
@SuppressWarnings("unchecked")
|
53 |
@SuppressWarnings("unchecked")
|
| 47 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_GOOGLE_LOGIN,method=RequestMethod.POST)
|
54 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_GOOGLE_LOGIN,method=RequestMethod.POST)
|
| 48 |
public ResponseEntity<?> googleLogin(HttpServletRequest request){
|
55 |
public ResponseEntity<?> googleLogin(HttpServletRequest request){
|
| 49 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
56 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 50 |
final Map<String, Object> googleLoginMap = (Map<String, Object>)request.getAttribute(ProfitMandiConstants.GOOGLE_LOGIN_MAP);
|
57 |
final Map<String, Object> googleLoginMap = (Map<String, Object>)request.getAttribute(ProfitMandiConstants.GOOGLE_LOGIN_MAP);
|
| Line 62... |
Line 69... |
| 62 |
final Response response=new Response("","","", e.getMessage());
|
69 |
final Response response=new Response("","","", e.getMessage());
|
| 63 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
70 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 64 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
71 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 65 |
}
|
72 |
}
|
| 66 |
}
|
73 |
}
|
| 67 |
|
74 |
|
| 68 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_TOKEN_IS_EXPIRED, method=RequestMethod.GET)
|
75 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_TOKEN_IS_EXPIRED, method=RequestMethod.GET)
|
| 69 |
public ResponseEntity<?> tokenIsExpired(HttpServletRequest request, @RequestParam(name = "token") String token){
|
76 |
public ResponseEntity<?> tokenIsExpired(HttpServletRequest request, @RequestParam(name = "token") String token){
|
| 70 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
77 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 71 |
try {
|
78 |
try {
|
| 72 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, JWTUtil.isExpired(token));
|
79 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, JWTUtil.isExpired(token));
|
| Line 81... |
Line 88... |
| 81 |
final Response response=new Response("","","", e.getMessage());
|
88 |
final Response response=new Response("","","", e.getMessage());
|
| 82 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
89 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 83 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
90 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 84 |
}
|
91 |
}
|
| 85 |
}
|
92 |
}
|
| 86 |
|
93 |
|
| 87 |
@RequestMapping(value = ProfitMandiConstants.URL_USER, method=RequestMethod.POST)
|
94 |
@RequestMapping(value = ProfitMandiConstants.URL_USER, method=RequestMethod.POST)
|
| 88 |
public ResponseEntity<?> createUser(HttpServletRequest request, @RequestBody UserRequest userRequest){
|
95 |
public ResponseEntity<?> createUser(HttpServletRequest request, @RequestBody UserRequest userRequest){
|
| 89 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
96 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 90 |
User user = new User();
|
97 |
User user = new User();
|
| 91 |
user.setFirstName(userRequest.getFirstName());
|
98 |
user.setFirstName(userRequest.getFirstName());
|
| Line 98... |
Line 105... |
| 98 |
user.setMobile_verified(false);
|
105 |
user.setMobile_verified(false);
|
| 99 |
user.setReferral_url("");
|
106 |
user.setReferral_url("");
|
| 100 |
user.setGroup_id(1);
|
107 |
user.setGroup_id(1);
|
| 101 |
user.setStatus(0);
|
108 |
user.setStatus(0);
|
| 102 |
user.setActivated(false);
|
109 |
user.setActivated(false);
|
| 103 |
|
110 |
|
| 104 |
try {
|
111 |
try {
|
| 105 |
user.setCreateTimestamp(LocalDateTime.now());
|
112 |
user.setCreateTimestamp(LocalDateTime.now());
|
| 106 |
user.setUpdateTimestamp(LocalDateTime.now());
|
113 |
user.setUpdateTimestamp(LocalDateTime.now());
|
| 107 |
userRepository.persist(user);
|
114 |
userRepository.persist(user);
|
| 108 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("USR_OK_1000"));
|
115 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("USR_OK_1000"));
|
| Line 117... |
Line 124... |
| 117 |
final Response response=new Response("","","", e.getMessage());
|
124 |
final Response response=new Response("","","", e.getMessage());
|
| 118 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
125 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 119 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
126 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 120 |
}
|
127 |
}
|
| 121 |
}
|
128 |
}
|
| 122 |
|
129 |
|
| 123 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ALL,method=RequestMethod.GET)
|
130 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ALL,method=RequestMethod.GET)
|
| 124 |
public ResponseEntity<?> getAll(HttpServletRequest request){
|
131 |
public ResponseEntity<?> getAll(HttpServletRequest request){
|
| 125 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
132 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 126 |
try {
|
133 |
try {
|
| 127 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectAll());
|
134 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectAll());
|
| Line 131... |
Line 138... |
| 131 |
final Response response=new Response("","","", e.getMessage());
|
138 |
final Response response=new Response("","","", e.getMessage());
|
| 132 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
139 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 133 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
140 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 134 |
}
|
141 |
}
|
| 135 |
}
|
142 |
}
|
| 136 |
|
143 |
|
| 137 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ID,method=RequestMethod.GET)
|
144 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ID,method=RequestMethod.GET)
|
| 138 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
145 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
| 139 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
146 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 140 |
try {
|
147 |
try {
|
| 141 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectById(id));
|
148 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectById(id));
|
| Line 150... |
Line 157... |
| 150 |
final Response response=new Response("","","", e.getMessage());
|
157 |
final Response response=new Response("","","", e.getMessage());
|
| 151 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
158 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 152 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
159 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 153 |
}
|
160 |
}
|
| 154 |
}
|
161 |
}
|
| 155 |
|
162 |
|
| 156 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_MOBILE_NUMBER,method=RequestMethod.GET)
|
163 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_MOBILE_NUMBER,method=RequestMethod.GET)
|
| 157 |
public ResponseEntity<?> getByMobileNumber(HttpServletRequest request, @RequestParam(name = "mobileNumber") String mobileNumber){
|
164 |
public ResponseEntity<?> getByMobileNumber(HttpServletRequest request, @RequestParam(name = "mobileNumber") String mobileNumber){
|
| 158 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
165 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 159 |
try {
|
166 |
try {
|
| 160 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectByMobileNumber(mobileNumber));
|
167 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectByMobileNumber(mobileNumber));
|
| Line 169... |
Line 176... |
| 169 |
final Response response=new Response("","","", e.getMessage());
|
176 |
final Response response=new Response("","","", e.getMessage());
|
| 170 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
177 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 171 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.INTERNAL_SERVER_ERROR);
|
178 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.INTERNAL_SERVER_ERROR);
|
| 172 |
}
|
179 |
}
|
| 173 |
}
|
180 |
}
|
| 174 |
|
181 |
|
| 175 |
|
182 |
|
| 176 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_EMAIL_ID,method=RequestMethod.GET)
|
183 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_EMAIL_ID,method=RequestMethod.GET)
|
| 177 |
public ResponseEntity<?> getByEmailId(HttpServletRequest request, @RequestParam(name = "emailId") String emailId){
|
184 |
public ResponseEntity<?> getByEmailId(HttpServletRequest request, @RequestParam(name = "emailId") String emailId){
|
| 178 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
185 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 179 |
try {
|
186 |
try {
|
| 180 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectByEmailId(emailId));
|
187 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectByEmailId(emailId));
|
| Line 189... |
Line 196... |
| 189 |
final Response response=new Response("","","", e.getMessage());
|
196 |
final Response response=new Response("","","", e.getMessage());
|
| 190 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
197 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 191 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.INTERNAL_SERVER_ERROR);
|
198 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.INTERNAL_SERVER_ERROR);
|
| 192 |
}
|
199 |
}
|
| 193 |
}
|
200 |
}
|
| 194 |
|
201 |
|
| 195 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_ID, method = RequestMethod.PUT)
|
202 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_ID, method = RequestMethod.PUT)
|
| 196 |
public ResponseEntity<?> addRoleByIdWithId(HttpServletRequest request, @RequestParam(name = "roleId") int roleId, @RequestParam(name = "userId") int userId){
|
203 |
public ResponseEntity<?> addRoleByIdWithId(HttpServletRequest request, @RequestParam(name = "roleId") int roleId, @RequestParam(name = "userId") int userId){
|
| 197 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
204 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 198 |
try {
|
205 |
try {
|
| 199 |
userRepository.addRoleByIdWithId(roleId, userId);
|
206 |
userRepository.addRoleByIdWithId(roleId, userId);
|
| Line 209... |
Line 216... |
| 209 |
final Response response=new Response("","","", e.getMessage());
|
216 |
final Response response=new Response("","","", e.getMessage());
|
| 210 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
217 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 211 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
218 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 212 |
}
|
219 |
}
|
| 213 |
}
|
220 |
}
|
| 214 |
|
221 |
|
| 215 |
|
222 |
|
| 216 |
|
223 |
|
| 217 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_MOBILE_NUMBER, method = RequestMethod.PUT)
|
224 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_MOBILE_NUMBER, method = RequestMethod.PUT)
|
| 218 |
public ResponseEntity<?> addRoleByIdWithMobileNumber(HttpServletRequest request, @RequestParam(name = "roleId") int id, @RequestParam(name = "mobileNumber") String mobileNumber){
|
225 |
public ResponseEntity<?> addRoleByIdWithMobileNumber(HttpServletRequest request, @RequestParam(name = "roleId") int id, @RequestParam(name = "mobileNumber") String mobileNumber){
|
| 219 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
226 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 220 |
try {
|
227 |
try {
|
| 221 |
userRepository.addRoleByIdWithMobileNumber(id, mobileNumber);
|
228 |
userRepository.addRoleByIdWithMobileNumber(id, mobileNumber);
|
| Line 231... |
Line 238... |
| 231 |
final Response response=new Response("","","", e.getMessage());
|
238 |
final Response response=new Response("","","", e.getMessage());
|
| 232 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
239 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 233 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
240 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 234 |
}
|
241 |
}
|
| 235 |
}
|
242 |
}
|
| 236 |
|
243 |
|
| 237 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_EMAIL_ID, method = RequestMethod.PUT)
|
244 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_EMAIL_ID, method = RequestMethod.PUT)
|
| 238 |
public ResponseEntity<?> addRoleByIdWithEmailId(HttpServletRequest request, @RequestParam(name = "roleId") int id, @RequestParam(name = "emailId") String emailId){
|
245 |
public ResponseEntity<?> addRoleByIdWithEmailId(HttpServletRequest request, @RequestParam(name = "roleId") int id, @RequestParam(name = "emailId") String emailId){
|
| 239 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
246 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 240 |
try {
|
247 |
try {
|
| 241 |
userRepository.addRoleByIdWithEmailId(id, emailId);
|
248 |
userRepository.addRoleByIdWithEmailId(id, emailId);
|
| Line 251... |
Line 258... |
| 251 |
final Response response=new Response("","","", e.getMessage());
|
258 |
final Response response=new Response("","","", e.getMessage());
|
| 252 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
259 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 253 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
260 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 254 |
}
|
261 |
}
|
| 255 |
}
|
262 |
}
|
| 256 |
|
263 |
|
| 257 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_ID, method = RequestMethod.PUT)
|
264 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_ID, method = RequestMethod.PUT)
|
| 258 |
public ResponseEntity<?> addRoleByNameWithId(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "userId") int id){
|
265 |
public ResponseEntity<?> addRoleByNameWithId(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "userId") int id){
|
| 259 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
266 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 260 |
try {
|
267 |
try {
|
| 261 |
userRepository.addRoleByNameWithId(roleName, id);
|
268 |
userRepository.addRoleByNameWithId(roleName, id);
|
| Line 271... |
Line 278... |
| 271 |
final Response response=new Response("","","", e.getMessage());
|
278 |
final Response response=new Response("","","", e.getMessage());
|
| 272 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
279 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 273 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
280 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 274 |
}
|
281 |
}
|
| 275 |
}
|
282 |
}
|
| 276 |
|
283 |
|
| 277 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_MOBILE_NUMBER, method = RequestMethod.PUT)
|
284 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_MOBILE_NUMBER, method = RequestMethod.PUT)
|
| 278 |
public ResponseEntity<?> addRoleByNameWithMobileNumber(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "mobileNumber") String mobileNumber){
|
285 |
public ResponseEntity<?> addRoleByNameWithMobileNumber(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "mobileNumber") String mobileNumber){
|
| 279 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
286 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 280 |
try {
|
287 |
try {
|
| 281 |
userRepository.addRoleByNameWithMobileNumber(roleName, mobileNumber);
|
288 |
userRepository.addRoleByNameWithMobileNumber(roleName, mobileNumber);
|
| Line 291... |
Line 298... |
| 291 |
final Response response=new Response("","","", e.getMessage());
|
298 |
final Response response=new Response("","","", e.getMessage());
|
| 292 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
299 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 293 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
300 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 294 |
}
|
301 |
}
|
| 295 |
}
|
302 |
}
|
| 296 |
|
303 |
|
| 297 |
|
304 |
|
| 298 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_EMAIL_ID, method = RequestMethod.PUT)
|
305 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_EMAIL_ID, method = RequestMethod.PUT)
|
| 299 |
public ResponseEntity<?> addRoleByNameWithEmailId(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "emailId") String emailId){
|
306 |
public ResponseEntity<?> addRoleByNameWithEmailId(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "emailId") String emailId){
|
| 300 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
307 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 301 |
try {
|
308 |
try {
|
| 302 |
userRepository.addRoleByNameWithEmailId(roleName, emailId);
|
309 |
userRepository.addRoleByNameWithEmailId(roleName, emailId);
|
| Line 312... |
Line 319... |
| 312 |
final Response response=new Response("","","", e.getMessage());
|
319 |
final Response response=new Response("","","", e.getMessage());
|
| 313 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
320 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 314 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
321 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 315 |
}
|
322 |
}
|
| 316 |
}
|
323 |
}
|
| 317 |
|
324 |
|
| 318 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_ID, method = RequestMethod.DELETE)
|
325 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_ID, method = RequestMethod.DELETE)
|
| 319 |
public ResponseEntity<?> removeRoleByIdWithId(HttpServletRequest request, @RequestParam(name = "roleId") int roleId, @RequestParam(name = "userId") int userId){
|
326 |
public ResponseEntity<?> removeRoleByIdWithId(HttpServletRequest request, @RequestParam(name = "roleId") int roleId, @RequestParam(name = "userId") int userId){
|
| 320 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
327 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 321 |
try {
|
328 |
try {
|
| 322 |
userRepository.deleteRoleByIdWithId(roleId, userId);
|
329 |
userRepository.deleteRoleByIdWithId(roleId, userId);
|
| Line 332... |
Line 339... |
| 332 |
final Response response=new Response("","","", e.getMessage());
|
339 |
final Response response=new Response("","","", e.getMessage());
|
| 333 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
340 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 334 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
341 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 335 |
}
|
342 |
}
|
| 336 |
}
|
343 |
}
|
| 337 |
|
344 |
|
| 338 |
|
345 |
|
| 339 |
|
346 |
|
| 340 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_MOBILE_NUMBER, method = RequestMethod.DELETE)
|
347 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_MOBILE_NUMBER, method = RequestMethod.DELETE)
|
| 341 |
public ResponseEntity<?> removeRoleByIdWithMobileNumber(HttpServletRequest request, @RequestParam(name = "roleId") int id, @RequestParam(name = "mobileNumber") String mobileNumber){
|
348 |
public ResponseEntity<?> removeRoleByIdWithMobileNumber(HttpServletRequest request, @RequestParam(name = "roleId") int id, @RequestParam(name = "mobileNumber") String mobileNumber){
|
| 342 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
349 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 343 |
try {
|
350 |
try {
|
| 344 |
userRepository.deleteRoleByIdWithMobileNumber(id, mobileNumber);
|
351 |
userRepository.deleteRoleByIdWithMobileNumber(id, mobileNumber);
|
| Line 354... |
Line 361... |
| 354 |
final Response response=new Response("","","", e.getMessage());
|
361 |
final Response response=new Response("","","", e.getMessage());
|
| 355 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
362 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 356 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
363 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 357 |
}
|
364 |
}
|
| 358 |
}
|
365 |
}
|
| 359 |
|
366 |
|
| 360 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_EMAIL_ID, method = RequestMethod.DELETE)
|
367 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_ID_WITH_EMAIL_ID, method = RequestMethod.DELETE)
|
| 361 |
public ResponseEntity<?> removeRoleByIdWithEmailId(HttpServletRequest request, @RequestParam(name = "roleId") int id, @RequestParam(name = "emailId") String emailId){
|
368 |
public ResponseEntity<?> removeRoleByIdWithEmailId(HttpServletRequest request, @RequestParam(name = "roleId") int id, @RequestParam(name = "emailId") String emailId){
|
| 362 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
369 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 363 |
try {
|
370 |
try {
|
| 364 |
userRepository.deleteRoleByIdWithEmailId(id, emailId);
|
371 |
userRepository.deleteRoleByIdWithEmailId(id, emailId);
|
| Line 374... |
Line 381... |
| 374 |
final Response response=new Response("","","", e.getMessage());
|
381 |
final Response response=new Response("","","", e.getMessage());
|
| 375 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
382 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 376 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
383 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 377 |
}
|
384 |
}
|
| 378 |
}
|
385 |
}
|
| 379 |
|
386 |
|
| 380 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_ID, method = RequestMethod.DELETE)
|
387 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_ID, method = RequestMethod.DELETE)
|
| 381 |
public ResponseEntity<?> removeRoleByNameWithId(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "userId") int id){
|
388 |
public ResponseEntity<?> removeRoleByNameWithId(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "userId") int id){
|
| 382 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
389 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 383 |
try {
|
390 |
try {
|
| 384 |
userRepository.deleteRoleByNameWithId(roleName, id);
|
391 |
userRepository.deleteRoleByNameWithId(roleName, id);
|
| Line 394... |
Line 401... |
| 394 |
final Response response=new Response("","","", e.getMessage());
|
401 |
final Response response=new Response("","","", e.getMessage());
|
| 395 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
402 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 396 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
403 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 397 |
}
|
404 |
}
|
| 398 |
}
|
405 |
}
|
| 399 |
|
406 |
|
| 400 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_MOBILE_NUMBER, method = RequestMethod.DELETE)
|
407 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_MOBILE_NUMBER, method = RequestMethod.DELETE)
|
| 401 |
public ResponseEntity<?> removeRoleByNameWithMobileNumber(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "mobileNumber") String mobileNumber){
|
408 |
public ResponseEntity<?> removeRoleByNameWithMobileNumber(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "mobileNumber") String mobileNumber){
|
| 402 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
409 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 403 |
try {
|
410 |
try {
|
| 404 |
userRepository.deleteRoleByNameWithMobileNumber(roleName, mobileNumber);
|
411 |
userRepository.deleteRoleByNameWithMobileNumber(roleName, mobileNumber);
|
| Line 414... |
Line 421... |
| 414 |
final Response response=new Response("","","", e.getMessage());
|
421 |
final Response response=new Response("","","", e.getMessage());
|
| 415 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
422 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 416 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
423 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 417 |
}
|
424 |
}
|
| 418 |
}
|
425 |
}
|
| 419 |
|
426 |
|
| 420 |
|
427 |
|
| 421 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_EMAIL_ID, method = RequestMethod.DELETE)
|
428 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_BY_NAME_WITH_EMAIL_ID, method = RequestMethod.DELETE)
|
| 422 |
public ResponseEntity<?> removeRoleByNameWithEmailId(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "emailId") String emailId){
|
429 |
public ResponseEntity<?> removeRoleByNameWithEmailId(HttpServletRequest request, @RequestParam(name = "roleName") String roleName, @RequestParam(name = "emailId") String emailId){
|
| 423 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
430 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 424 |
try {
|
431 |
try {
|
| 425 |
userRepository.deleteRoleByNameWithEmailId(roleName, emailId);
|
432 |
userRepository.deleteRoleByNameWithEmailId(roleName, emailId);
|
| Line 435... |
Line 442... |
| 435 |
final Response response=new Response("","","", e.getMessage());
|
442 |
final Response response=new Response("","","", e.getMessage());
|
| 436 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
443 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
|
| 437 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
444 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| 438 |
}
|
445 |
}
|
| 439 |
}
|
446 |
}
|
| - |
|
447 |
|
| - |
|
448 |
@RequestMapping(value = ProfitMandiConstants.URL_ADMIN_TOKEN, method = RequestMethod.POST)
|
| - |
|
449 |
public ResponseEntity<?> getAdminToken(HttpServletRequest request, @RequestParam(name = "adminToken") String adminToken, @RequestParam(name = "emailId") String emailId){
|
| - |
|
450 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| - |
|
451 |
if (!adminToken.equals(validAdminToken)){
|
| - |
|
452 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.FORBIDDEN.toString(), HttpStatus.FORBIDDEN, ResponseStatus.FAILURE, null);
|
| - |
|
453 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.FORBIDDEN);
|
| - |
|
454 |
}
|
| - |
|
455 |
|
| - |
|
456 |
|
| - |
|
457 |
Map<String, Object> responseMap = new HashMap<>(2);
|
| - |
|
458 |
try{
|
| - |
|
459 |
User user = userRepository.selectByEmailId(emailId);
|
| - |
|
460 |
Set<Role> roles = user.getRoles();
|
| - |
|
461 |
String[] roleTypes = new String[roles.size()];
|
| - |
|
462 |
int index = 0;
|
| - |
|
463 |
for(Role role : roles){
|
| - |
|
464 |
roleTypes[index++] = role.getType().toString();
|
| - |
|
465 |
}
|
| - |
|
466 |
responseMap.put(ProfitMandiConstants.TOKEN, JWTUtil.create(user.getId(), roleTypes));
|
| - |
|
467 |
responseMap.put(ProfitMandiConstants.REGISTERED, true);
|
| - |
|
468 |
}catch (ProfitMandiBusinessException pmbe) {
|
| - |
|
469 |
responseMap.put(ProfitMandiConstants.TOKEN, JWTUtil.create());
|
| - |
|
470 |
responseMap.put(ProfitMandiConstants.REGISTERED, false);
|
| - |
|
471 |
}
|
| - |
|
472 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, responseMap);
|
| - |
|
473 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
|
| - |
|
474 |
}
|
| 440 |
}
|
475 |
}
|