package com.customization.customWf.impl;

import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;

import com.engine.workflow.cmd.requestForm.UpdateReqInfoCmd;
import lombok.extern.slf4j.Slf4j;
import weaver.hrm.User;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;


@CommandDynamicProxy(target = UpdateReqInfoCmd.class,desc="")
@Slf4j
public class UpdateReqInfoCmdProxy extends AbstractCommandProxy<Map<String, Object>> {

    @Override
    public Map<String, Object> execute(Command<Map<String, Object>> targetCommand) {
        UpdateReqInfoCmd cmd = (UpdateReqInfoCmd) targetCommand;
        User user = cmd.getUser();
        Map<String, Object> params = cmd.getParams();
        nextExecute(cmd);
        // Map<String, Object> result = nextExecute(targetCommand);
        return null;
    }

    private String getCookie(HttpServletRequest request,String name){
        Cookie[] cookies = request.getCookies();
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                if(name.equals(cookie.getName())){

                    return cookie.getValue();
                }
            }
        }
        return "";
    }
}
