public void setUp() { easy = ServicesMapper.getEasyShareServicesProxyInstance(); sp = ServicesMapper.getSeparationOfUserConcernsProxyInstance(); sd = new ServiceDef(); sd.setServiceName("createSession"); Set<String> elig = new HashSet<String>(); elig.add("ADMIN"); sd.setEligUserTypes(elig); sd.setSessionRelationExists(Boolean.FALSE); }
/** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { MyHttpServletRequest myRequest = new MyHttpServletRequest(request); ServiceResponse sr = new ServiceResponse(); sr.initServiceResponse(myRequest, "AddAttendee"); Integer sessionId = Integer.valueOf(myRequest.getParameter(REQUEST_PARAMETERS.SESSION_ID)); String email = myRequest.getParameter(REQUEST_PARAMETERS.EMAIL); EasyShareServices easyshare = ServicesMapper.getEasyShareServicesProxyInstance(); Boolean isAssigned = null; try { isAssigned = easyshare.addAttendee(sessionId, email); sr.setCode("SUCCESS"); sr.setMessage("SUCCESS"); sr.setData(isAssigned); } catch (SessionNotFoundException e) { sr.setCode("FAILURE"); sr.setMessage(e.getMessage()); } catch (PresentAsOtherUserTypeException e) { sr.setCode("FAILURE"); sr.setMessage(e.getMessage()); } catch (UserNotFoundException e) { sr.setCode("FAILURE"); sr.setMessage(e.getMessage()); } catch (PresentAsSameUserTypeException e) { sr.setCode("FAILURE"); sr.setMessage(e.getMessage()); } RenderResponse r = new RenderResponse(); r.render(response, sr); }
/** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { MyHttpServletRequest myRequest = new MyHttpServletRequest(request); ServiceResponse sr = new ServiceResponse(); sr.initServiceResponse(myRequest, "GetResources"); EasyShareServices easyshare = ServicesMapper.getEasyShareServicesProxyInstance(); Integer sessionId = Integer.valueOf(myRequest.getParameter(REQUEST_PARAMETERS.SESSION_ID)); Set<Resource> resources = null; try { resources = easyshare.getResources(sessionId); sr.setCode("SUCCESS"); sr.setMessage("SUCCESS"); sr.setData(resources); } catch (SessionNotFoundException e) { sr.setCode("FAILURE"); sr.setMessage(e.getMessage()); } RenderResponse r = new RenderResponse(); r.render(response, sr); }