com.ba.reports.outStanding.BAOutStandingAction.java Source code

Java tutorial

Introduction

Here is the source code for com.ba.reports.outStanding.BAOutStandingAction.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ba.reports.outStanding;

import com.ba.util.BAHandleAllException;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;

import org.apache.struts.actions.DispatchAction;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
import org.json.simple.JSONObject;

/**
 *
 * @author RAPID
 */
public class BAOutStandingAction extends DispatchAction {

    /* forward name="success" path="" */
    private final static String SUCCESS = "success";
    private int objPageCount = 0;
    private static Logger logger = Logger.getLogger(BAOutStandingAction.class);

    public ActionForward loadOutStanding(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        logger.info(" loadCollection method starts here");
        return mapping.findForward(SUCCESS);
    }

    public ActionForward baView(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        System.out.println("view()");
        JSONObject json = new JSONObject();
        BAOutStandingDTO vo = new BAOutStandingDTO();
        try {
            logger.info(" view method starts here");
            String fromDate = request.getParameter("fromDate");
            String toDate = request.getParameter("toDate");

            List hashMpRoomItemDet = BAOutStandingFactory.getInstanceOfBAOutStandingFactory().getRoomDtls(fromDate,
                    toDate);
            json.put("exception", "");
            json.put("hashMpRoomItemDet", hashMpRoomItemDet);
            json.put("hashMpRoomItemDetExit", hashMpRoomItemDet.size());

        } catch (Exception ex) {
            logger.error("The Exception is  :" + ex);
            ex.printStackTrace();
            json.put("exception", BAHandleAllException.exceptionHandler(ex));
        }
        response.getWriter().write(json.toString());
        return null;

    }

}

/**
 * This is the Struts action method called on
 * http://.../actionPath?method=myAction1, where "method" is the value
 * specified in <action> element : ( <action parameter="method" .../> )
 */