Subversion Repositories SmartDukaan

Rev

Rev 22473 | Rev 23568 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.web.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.spice.profitmandi.common.ResponseCodeHolder;
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
import com.spice.profitmandi.common.model.ProfitMandiConstants;
import com.spice.profitmandi.common.web.util.ResponseSender;
import com.spice.profitmandi.dao.util.MigrationUtil;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

@Controller
@Transactional(rollbackFor=Throwable.class)
public class MigrationController {
        
        @Autowired
        private MigrationUtil migrationUtil;

        @Autowired
        private ResponseSender<?> responseSender;
        
        private static final Logger LOGGER=LoggerFactory.getLogger(MigrationController.class);
        
        @RequestMapping(value = ProfitMandiConstants.URL_ADMIN_MIGRATE_USER_TO_RETAILER, method = RequestMethod.GET)
        @ApiImplicitParams({
                @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
        public ResponseEntity<?> migrateUserToRetailer(HttpServletRequest request) {
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                migrationUtil.migrateUserToRetailer();
                return responseSender.ok(ResponseCodeHolder.getMessage("OK_1000"));
        }
        
        @RequestMapping(value = ProfitMandiConstants.URL_ADMIN_MIGRATE_MONGO_DOC_TO_RETAILER, method = RequestMethod.GET)
        @ApiImplicitParams({
                @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
        public ResponseEntity<?> migrateMongoDocToRetailer(HttpServletRequest request) throws ProfitMandiBusinessException{
                
                LOGGER.info("requested url : " + request.getRequestURL().toString());
                migrationUtil.migrateMongoDocToRetailer();
                return responseSender.ok(ResponseCodeHolder.getMessage("OK_1000"));
                
        }
        
}