/*
 * 
 * Created on Jun 25, 2005
 * 
 * György Süveges
 * Etixpert Kft.
 * Copyright(c) 2005
 * 
 */
package com.etixpert.evolution.workflow;

import java.sql.Connection;
import java.util.*;

import com.etixpert.evolution.app.order.Bill;
import com.etixpert.evolution.app.utils.*;
import javax.servlet.http.*;


/**
 * @author Suveges Gyorgy
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class Status40To50 extends DefaultWorkflow {

    /**
     * @param statusFrom
     * @param statusTo
     */
    public Status40To50() {
        super(40, 50);
        // TODO Auto-generated constructor stub
    }
    
   /* protected void before(Connection conn, Set orders) throws Exception {
        if (orders.size()==0) return;
        byte[][] bills = new byte[orders.size()][];
        logger.info("Generating linked bill");
        response.setContentType("application/octet-stream");
		response.setHeader("Content-Disposition","attachment; filename=bills.pdf");
		String realPath = request.getSession().getServletContext().getRealPath("/WEB-INF/");
        logger.info("Realpath of web-inf is: "+realPath);
		int i=0;
        for (Iterator it =orders.iterator(); it.hasNext();) {
           
            byte[] data = Bill.generate(it.next(), realPath);
            bills[i++]= data;
        }
        
        
        byte[] result = PDFUtils.concatenate(bills);
        logger.info("linked bill generated");
        response.getOutputStream().write(result);
        sentToResponse=true;
       

     } */
    
     protected void after(Connection conn, Set orders) throws Exception {
         HttpSession session = request.getSession();
         logger.info("Storing order ids in session");
         session.setAttribute("forwardlink","process/linkedpdf?pageAction=linkedbill&saveState=/process/linkedpdf");
         session.setAttribute("orderids", orders);
         
     }

}
