Subversion Repositories SmartDukaan

Rev

Rev 21428 | Rev 21440 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21428 Rev 21432
Line 134... Line 134...
134
		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());
135
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
135
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
136
	}
136
	}
137
	
137
	
138
	@RequestMapping(value = ProfitMandiConstants.URL_USER_ID,method=RequestMethod.GET)
138
	@RequestMapping(value = ProfitMandiConstants.URL_USER_ID,method=RequestMethod.GET)
139
	public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") long id){
139
	public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
140
		LOGGER.info("requested url : "+request.getRequestURL().toString());
140
		LOGGER.info("requested url : "+request.getRequestURL().toString());
141
		try {
141
		try {
142
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectById(id));
142
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectById(id));
143
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
143
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
144
		}catch (ProfitMandiBusinessException pmbe) {
144
		}catch (ProfitMandiBusinessException pmbe) {
Line 218... Line 218...
218
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.BAD_REQUEST);
218
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.BAD_REQUEST);
219
		}
219
		}
220
	}
220
	}
221
	
221
	
222
	@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_REMOVE,method=RequestMethod.DELETE)
222
	@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_REMOVE,method=RequestMethod.DELETE)
223
	public ResponseEntity<?> removeRole(HttpServletRequest request, @RequestParam(name = "roleId") long roleId, @RequestParam(name = "userId") long userId){
223
	public ResponseEntity<?> removeRole(HttpServletRequest request, @RequestParam(name = "roleId") int roleId, @RequestParam(name = "userId") int userId){
224
		LOGGER.info("requested url : "+request.getRequestURL().toString());
224
		LOGGER.info("requested url : "+request.getRequestURL().toString());
225
		try {
225
		try {
226
			roleRepository.selectById(roleId);
226
			roleRepository.selectById(roleId);
227
			userRepository.selectById(userId);
227
			userRepository.selectById(userId);
228
			userRoleRepository.deleteByUserAndRoleId(userId, roleId);
228
			userRoleRepository.deleteByUserAndRoleId(userId, roleId);
Line 237... Line 237...
237
		}
237
		}
238
	}
238
	}
239
	
239
	
240
	
240
	
241
	@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_ALL,method=RequestMethod.GET)
241
	@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_ALL,method=RequestMethod.GET)
242
	public ResponseEntity<?> getAllRoles(HttpServletRequest request, @RequestParam(name = "id") long id){
242
	public ResponseEntity<?> getAllRoles(HttpServletRequest request, @RequestParam(name = "id") int id){
243
		LOGGER.info("requested url : "+request.getRequestURL().toString());
243
		LOGGER.info("requested url : "+request.getRequestURL().toString());
244
		final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRoleRepository.selectRolesByUserId(id));
244
		final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRoleRepository.selectRolesByUserId(id));
245
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
245
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
246
	}
246
	}
247
 
247