Subversion Repositories SmartDukaan

Rev

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

Rev 22473 Rev 22931
Line 23... Line 23...
23
@Controller
23
@Controller
24
@Transactional(rollbackFor=Throwable.class)
24
@Transactional(rollbackFor=Throwable.class)
25
public class MigrationController {
25
public class MigrationController {
26
	
26
	
27
	@Autowired
27
	@Autowired
28
	MigrationUtil migrationUtil;
28
	private MigrationUtil migrationUtil;
29
 
29
 
30
	@Autowired
30
	@Autowired
31
	ResponseSender<?> responseSender;
31
	private ResponseSender<?> responseSender;
32
	
32
	
33
	private static final Logger LOGGER=LoggerFactory.getLogger(MigrationController.class);
33
	private static final Logger LOGGER=LoggerFactory.getLogger(MigrationController.class);
34
	
34
	
35
	@RequestMapping(value = ProfitMandiConstants.URL_ADMIN_MIGRATE_USER_TO_RETAILER, method = RequestMethod.GET)
35
	@RequestMapping(value = ProfitMandiConstants.URL_ADMIN_MIGRATE_USER_TO_RETAILER, method = RequestMethod.GET)
36
	@ApiImplicitParams({
36
	@ApiImplicitParams({
Line 42... Line 42...
42
	}
42
	}
43
	
43
	
44
	@RequestMapping(value = ProfitMandiConstants.URL_ADMIN_MIGRATE_MONGO_DOC_TO_RETAILER, method = RequestMethod.GET)
44
	@RequestMapping(value = ProfitMandiConstants.URL_ADMIN_MIGRATE_MONGO_DOC_TO_RETAILER, method = RequestMethod.GET)
45
	@ApiImplicitParams({
45
	@ApiImplicitParams({
46
		@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
46
		@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
47
	public ResponseEntity<?> migrateMongoDocToRetailer(HttpServletRequest request) {
47
	public ResponseEntity<?> migrateMongoDocToRetailer(HttpServletRequest request) throws ProfitMandiBusinessException{
-
 
48
		
48
		LOGGER.info("requested url : " + request.getRequestURL().toString());
49
		LOGGER.info("requested url : " + request.getRequestURL().toString());
49
		try{
-
 
50
			migrationUtil.migrateMongoDocToRetailer();
50
		migrationUtil.migrateMongoDocToRetailer();
51
			return responseSender.ok(ResponseCodeHolder.getMessage("OK_1000"));
51
		return responseSender.ok(ResponseCodeHolder.getMessage("OK_1000"));
52
		}catch (ProfitMandiBusinessException profitMandiBusinessException) {
-
 
53
			LOGGER.error("Unable to migrate mongo doc to retailer", profitMandiBusinessException);
-
 
54
			return responseSender.badRequest(profitMandiBusinessException);
-
 
55
		}
52
		
56
	}
53
	}
57
	
54
	
58
}
55
}