Package web.operator

Source Code of web.operator.CompleteController

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package web.operator;

import domain.Client;
import domain.Collaborator;
import domain.Lpu;
import domain.editors.Editor;
import domain.shedule.WorkType;
import java.util.Date;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.validation.BindException;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.servlet.ModelAndView;
import utils.Converter;
import web.generic.GenericCommandController;

/**
* Контроллер выводит информацию, что запись на прием прошла успешно
* @author vip
*/
public class CompleteController extends GenericCommandController {

    protected static final Logger log = Logger.getLogger(CompleteController.class);

    public CompleteController() {
        setCommandClass(CompleteDTO.class);
    }

    @Override
    protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
        binder.registerCustomEditor(Client.class, new Editor(getDao(), Client.class));
        binder.registerCustomEditor(Lpu.class, new Editor(getDao(), Lpu.class));
        binder.registerCustomEditor(Collaborator.class, new Editor(getDao(), Collaborator.class));
        binder.registerCustomEditor(WorkType.class, new Editor(getDao(), WorkType.class));
    }

    @Override
    protected ModelAndView handle(HttpServletRequest request,
            HttpServletResponse response, Object command, BindException errors) throws Exception {
        CompleteDTO complete = (CompleteDTO) command;
        HashMap model = new HashMap();
        model.put("command", complete);
        long time = 0;
        Date stringToDate = Converter.stringToDate(complete.getDate());
        time = stringToDate.getTime();

        return new ModelAndView("operator/complete", model);
    }

}
TOP

Related Classes of web.operator.CompleteController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.