Commit e620585c authored by sdhaul's avatar sdhaul

Added CustomerInfoService & CustomerInfoDao

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@188617 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a0d0600e
package ibase.dashboard.common.webService;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import org.json.JSONArray;
import org.json.JSONObject;
import ibase.dashboard.common.hibernate.dao.CustomerInfoDao;
import ibase.hibernate.bean.UserDocContent;
import ibase.utility.BaseException;
import ibase.utility.UserInfoBean;
@Path("/customerInfo")
public class CustomerInfoService {
@Context
HttpServletRequest request; // The proxy of Request will be injected into this singleton
@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public String getCustomerInfo(@QueryParam("strgCode") String strgCode) throws Exception
{
System.out.println("In getCustomerInfo:: strgCode["+strgCode+"]");
JSONObject customerInfoObj = new JSONObject();
UserInfoBean userInfo = getUserInfo();
try
{
if( userInfo != null )
{
CustomerInfoDao customerInfoDao = new CustomerInfoDao();
customerInfoDao.setUserInfo(userInfo);
customerInfoObj = customerInfoDao.getCustInfoData(strgCode);
JSONArray custHistArr = customerInfoDao.getCustomerCallHistory(strgCode);
custHistArr = customerInfoDao.getCustomerDetails(custHistArr);
customerInfoObj.put("CALL_HISTORY", custHistArr);
}
}
catch (Exception e)
{
e.printStackTrace();
customerInfoObj.put("status", "Failure" );
}
return customerInfoObj.toString();
}
private UserInfoBean getUserInfo()
{
UserInfoBean userInfo = null;
HttpSession session = request.getSession();
Object userObj = session.getAttribute( "USER_INFO" );
System.out.println(" CustomerInfoService getUserInfo userObj >>[" + userObj + "]" );
if(userObj != null)
{
try
{
userInfo = new UserInfoBean( userObj.toString() );
}
catch (BaseException e)
{
e.printStackTrace();
}
}
return userInfo;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment