package ibase.dashboard.mfg.bean;

import java.rmi.RemoteException;
import ibase.dashboard.mfg.ejb.MachineUtlDetailsRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import javax.naming.InitialContext;

public class MachineUtlDetailsBean
{
	MachineUtlDetailsRemote machineUtlDetailsRemote=null;
	public MachineUtlDetailsBean()
	{
		AppConnectParm appConnectParm=new AppConnectParm();
		try
        {
	        InitialContext context=new InitialContext(appConnectParm.getProperty());
	        machineUtlDetailsRemote=(MachineUtlDetailsRemote)context.lookup("ibase/MachineUtlDetails/remote");
        }
		catch (Exception e)
        {
			System.out.println(" ibase.dashboard.mfg.bean :MachineUtlDetailsBean "+e);
	        e.printStackTrace();
        }
	}
	
	

	public String getSiteCodeList() throws RemoteException,ITMException
	{
		String siteCodeList="";
		try
		{
			siteCodeList=machineUtlDetailsRemote.getSiteCodeList();
		}
		catch (Exception e)
		{
			System.out.println("ibase.dashboard.mfg.bean :MachineUtlDetailsBean "+e);
	        e.printStackTrace();
		}
		return siteCodeList;
	}
	
	
	public String getMachineUtlDetailsBySiteCode(String siteCode,String month,String year) throws RemoteException,ITMException
	{
		String xmlData="";
		try
		{
			xmlData=machineUtlDetailsRemote.getMachineUtlDetailsBySiteCode(siteCode,month,year);
		}
		catch (Exception e)
		{
			System.out.println("ibase.dashboard.mfg.bean :MachineUtlDetailsBean "+e);
	        e.printStackTrace();
		}
		return xmlData;
	}
	

}
