@ModelAttribute
  public void frontUrl(ModelMap model, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    // model.addAttribute("frontUrl", request.getContextPath() + "/resources");
    userLoad(model);
    model.addAttribute("frontUrl", request.getContextPath() + "/resources");
    // System.out.println("xDamsController.frontUrl() multiAccount: " + multiAccount);
    // System.out.println("xDamsController.frontUrl() model.get(\"userBean\"): " +
    // model.get("userBean"));
    if (multiAccount && model.get("userBean") != null) {
      model.addAttribute(
          "frontUrl",
          request.getContextPath()
              + "/resources/"
              + ((UserBean) model.get("userBean")).getAccountRef());
    }

    // System.out.println("xDamsController.frontUrl() model.get(\"frontUrl\"): " +
    // model.get("frontUrl"));
    model.addAttribute("contextPath", request.getContextPath());
    String userAgent = ((HttpServletRequest) request).getHeader("User-Agent");
    if (userAgent.toLowerCase().contains("msie")) {
      response.addHeader("X-UA-Compatible", "IE=edge");
    }

    try {
      Locale locale = RequestContextUtils.getLocale(request);
      ((UserBean) model.get("userBean")).setLanguage(locale.getLanguage());
    } catch (Exception e) {
      // TODO: handle exception
    }
    model.put("realPath", WebUtils.getRealPath(servletContext, ""));
  }
Ejemplo n.º 2
0
 @Test
 public void testClientInfo() throws Exception {
   ModelMap model = new ModelMap();
   Long shopId = createShop();
   request.getSession().setAttribute("shopId", shopId);
   CustomerRecordDTO customerRecordDTO = new CustomerRecordDTO();
   CustomerDTO customer = new CustomerDTO();
   CustomerVehicleDTO customerVehicleDTO = new CustomerVehicleDTO();
   VehicleDTO vehicleDTO = new VehicleDTO();
   createCustomerDTO(customer, shopId);
   createCustomerRecordDTO(customerRecordDTO, shopId);
   createVehicleDTO(vehicleDTO, shopId);
   IUserService userService = ServiceManager.getService(IUserService.class);
   userService.createCustomerRecord(customerRecordDTO);
   CustomerDTO customerDTO = userService.createCustomer(customer);
   VehicleDTO vehicleDTO1 = userService.createVehicle(vehicleDTO);
   userService.addVehicleToCustomer(vehicleDTO1.getId(), customerDTO.getId());
   txnController.clientInfo(model, request, "MRS.SHAO", "15151774444", "phone", "2343545", "", "");
   CustomerRecordDTO customerRecordDTO2 = (CustomerRecordDTO) model.get("customerRecordDTO");
   Assert.assertEquals("MRS.SHAO", customerRecordDTO2.getName());
   Assert.assertEquals("", customerRecordDTO2.getContact());
   Assert.assertEquals("15151774444", customerRecordDTO2.getMobile());
   txnController.clientInfo(model, request, "邵磊", "15151774443", "", "", "小邵", "");
   CustomerRecordDTO customerRecordDTO3 = (CustomerRecordDTO) model.get("customerRecordDTO");
   Assert.assertEquals("邵磊", customerRecordDTO3.getName());
   Assert.assertEquals("15151774443", customerRecordDTO3.getMobile());
 }
  /**
   * Test located specimen feature. only returns observations with unique names
   *
   * @throws Exception the exception
   */
  @Test
  public void testLocatedSpecimenFeature_UniqueObservations() throws Exception {

    final String serviceUrl = "http://fake.com/wfs";
    final String featureId = "feature_id";
    final String materialClass = "matclass";
    final YilgarnObservationRecord[] mockObservations =
        new YilgarnObservationRecord[] {
          context.mock(YilgarnObservationRecord.class, "obs0"),
          context.mock(YilgarnObservationRecord.class, "obs1"),
          context.mock(YilgarnObservationRecord.class, "obs2"),
          context.mock(YilgarnObservationRecord.class, "obs3"),
          context.mock(YilgarnObservationRecord.class, "obs4")
        };
    final YilgarnLocatedSpecimenRecord mockLocSpecRecord =
        context.mock(YilgarnLocatedSpecimenRecord.class);

    context.checking(
        new Expectations() {
          {
            oneOf(mockGeochemService).getLocatedSpecimens(serviceUrl, featureId);
            will(returnValue(mockLocSpecRecord));

            allowing(mockLocSpecRecord).getMaterialClass();
            will(returnValue(materialClass));
            allowing(mockLocSpecRecord).getRelatedObservations();
            will(returnValue(mockObservations));

            allowing(mockObservations[0]).getAnalyteName();
            will(returnValue("nacl"));
            allowing(mockObservations[1]).getAnalyteName();
            will(returnValue("au"));
            allowing(mockObservations[2]).getAnalyteName();
            will(returnValue("au"));
            allowing(mockObservations[3]).getAnalyteName();
            will(returnValue("nacl"));
            allowing(mockObservations[4]).getAnalyteName();
            will(returnValue("ag"));
          }
        });

    ModelAndView modelAndView = controller.doLocatedSpecimenFeature(serviceUrl, featureId);
    Assert.assertNotNull(modelAndView);
    Map<String, Object> model = modelAndView.getModel();
    Assert.assertEquals(true, model.get("success"));

    ModelMap data = (ModelMap) model.get("data");
    Assert.assertNotNull(data);
    Assert.assertSame(mockObservations, data.get("records"));
    Assert.assertNotNull(data.get("uniqueSpecName"));
    List<String> uniqueNames = Arrays.asList((String[]) data.get("uniqueSpecName"));

    Assert.assertEquals(3, uniqueNames.size());
    Assert.assertTrue(uniqueNames.contains("nacl"));
    Assert.assertTrue(uniqueNames.contains("au"));
    Assert.assertTrue(uniqueNames.contains("ag"));
  }
Ejemplo n.º 4
0
  @Test
  public void test_list() {
    List<Ranking> rankingList = new ArrayList<Ranking>();
    rankingList.add(TestObjects.createSampleRanking());

    when(rankingController.rankingDao.findAll()).thenReturn(rankingList);

    ModelMap modelMap = rankingController.list();

    verify(rankingController.rankingDao).findAll();

    assertNotNull(modelMap.get("rankings"));

    assertTrue(((List<Ranking>) modelMap.get("rankings")).size() == 1);
  }
 @RequestMapping(value = "/search/{archive}/query-multiarchive", method = RequestMethod.GET)
 public String queryPageMulti(
     @ModelAttribute("userBean") UserBean userBean,
     @ModelAttribute("confBean") ConfBean confBean,
     @PathVariable String archive,
     ModelMap modelMap,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   common(confBean, userBean, archive, modelMap, request, response);
   Map<String, List<Archive>> usersArchives = new LinkedHashMap<String, List<Archive>>();
   serviceUser.loadArchives(userBean, usersArchives);
   modelMap.addAttribute("usersArchives", usersArchives);
   MultiQueryPageCommand queryPageCommand =
       new MultiQueryPageCommand(request.getParameterMap(), modelMap);
   queryPageCommand.execute();
   QueryPageView pageView = new QueryPageView();
   WorkFlowBean workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
   pageView.generateView(workFlowBean, confBean, userBean, modelMap);
   modelMap.put("positionMap", pageView.getPositionMap());
   modelMap.put("positionAdminMap", pageView.getPositionAdminMap());
   modelMap.put("outputHourField", pageView.getOutputHourField());
   modelMap.put("outputDataField", pageView.getOutputDataField());
   modelMap.put("outputSortField", pageView.getOutputSortField());
   return "multiArchive/search/query-multiarchive";
 }
Ejemplo n.º 6
0
 @Test
 public void when_no_name_entered_shows_error_message() throws Exception {
   ModelMap model = new ModelMap();
   String viewName = controller.onLogin(new LoginInfo(), model);
   assertEquals("login", viewName);
   assertEquals("invalid login name", model.get("error"));
 }
 @Test
 public void testListUsers() throws Exception {
   when(userService.findAll()).thenReturn(users);
   Assert.assertEquals(controller.listUsers(model), "allusers");
   Assert.assertEquals(model.get("users"), users);
   verify(userService, atLeastOnce()).findAll();
 }
  private String showCatalog(ModelMap model, HttpServletRequest request, CatalogSort catalogSort) {
    addCategoryToModel(request, model);
    boolean productFound = addProductsToModel(request, model, catalogSort);

    String view = defaultCategoryView;
    if (productFound) {
      // TODO: Nice to have: product logic similar to category below
      view = defaultProductView;
    } else {
      Category currentCategory = (Category) model.get("currentCategory");
      if (currentCategory.getUrl() != null && !"".equals(currentCategory.getUrl())) {
        return "redirect:" + currentCategory.getUrl();
      } else if (currentCategory.getDisplayTemplate() != null
          && !"".equals(currentCategory.getUrl())) {
        view = categoryTemplatePrefix + currentCategory.getDisplayTemplate();
      } else {
        if ("true".equals(request.getParameter("ajax"))) {
          view = "catalog/categoryView/mainContentFragment";
        } else {
          view = defaultCategoryView;
        }
      }
    }

    if (catalogSort == null) {
      model.addAttribute("catalogSort", new CatalogSort());
    }

    List<Order> wishlists =
        cartService.findOrdersForCustomer(customerState.getCustomer(request), OrderStatus.NAMED);
    model.addAttribute("wishlists", wishlists);

    return view;
  }
Ejemplo n.º 9
0
 @RequestMapping(value = "/handle63")
 public String handle63(ModelMap modelMap) {
   User user = (User) modelMap.get("user");
   user.setUserName("tom");
   modelMap.addAttribute("testAttr", "value1");
   return "/user/showUser";
 }
  /**
   * Test located specimen feature can do a basic transform
   *
   * @throws Exception the exception
   */
  @Test
  public void testLocatedSpecimenFeature_SimpleTransform() throws Exception {

    final String serviceUrl = "http://fake.com/wfs";
    final String featureId = "feature_id";
    final String materialClass = "matclass";
    final YilgarnObservationRecord[] mockObservations = new YilgarnObservationRecord[] {};
    final YilgarnLocatedSpecimenRecord mockLocSpecRecord =
        context.mock(YilgarnLocatedSpecimenRecord.class);

    context.checking(
        new Expectations() {
          {
            oneOf(mockGeochemService).getLocatedSpecimens(serviceUrl, featureId);
            will(returnValue(mockLocSpecRecord));

            allowing(mockLocSpecRecord).getMaterialClass();
            will(returnValue(materialClass));
            allowing(mockLocSpecRecord).getRelatedObservations();
            will(returnValue(mockObservations));
          }
        });

    ModelAndView modelAndView = controller.doLocatedSpecimenFeature(serviceUrl, featureId);
    Assert.assertNotNull(modelAndView);
    Map<String, Object> model = modelAndView.getModel();
    Assert.assertEquals(true, model.get("success"));

    ModelMap data = (ModelMap) model.get("data");
    Assert.assertNotNull(data);
    Assert.assertSame(mockObservations, data.get("records"));
  }
  /*
   * This controller method is for demonstration purposes only. It contains a call to
   * catalogService.findActiveProductsByCategory, which may return a large list. A
   * more performant solution would be to utilize data paging techniques.
   */
  protected boolean addProductsToModel(
      HttpServletRequest request, ModelMap model, CatalogSort catalogSort) {
    boolean productFound = false;

    String productId = request.getParameter("productId");
    Product product = null;
    try {
      product = catalogService.findProductById(new Long(productId));
    } catch (Exception e) {
      // If product is not found, return all values in category
    }

    if (product != null && product.isActive()) {
      productFound = validateProductAndAddToModel(product, model);
      addRatingSummaryToModel(productId, model);
    } else {
      Category currentCategory = (Category) model.get("currentCategory");
      List<Product> productList =
          catalogService.findActiveProductsByCategory(currentCategory, SystemTime.asDate());
      SearchFilterUtil.filterProducts(
          productList, request.getParameterMap(), new String[] {"manufacturer", "sku.salePrice"});

      if ((catalogSort != null) && (catalogSort.getSort() != null)) {
        populateProducts(productList, currentCategory);
        model.addAttribute("displayProducts", sortProducts(catalogSort, productList));
      } else {
        catalogSort = new CatalogSort();
        catalogSort.setSort("featured");
        populateProducts(productList, currentCategory);
        model.addAttribute("displayProducts", sortProducts(catalogSort, productList));
      }
    }

    return productFound;
  }
Ejemplo n.º 12
0
  @Override
  public ModelMap handle(ModelMap modelMap, HttpServletRequest request) throws Exception {

    Family family = new Family();
    String type = "new";

    String id = request.getParameter("id");
    if (id != null && !id.equals("")) {
      type = "edit";
      family = (Family) baseManager.getObject(Family.class.getName(), id);
    }

    Do tempDo = (Do) modelMap.get("tempDo");
    family =
        (Family)
            xdoManager.processSaveOrUpdateTempObject(
                tempDo, family, family.getClass(), request, type);

    baseManager.saveOrUpdate(Family.class.getName(), family);
    modelMap.put("object", family);

    BigStudent bigStudent =
        (BigStudent)
            baseManager.getObject(BigStudent.class.getName(), request.getParameter("bigStudentId"));
    bigStudent.setFamily(family);
    baseManager.saveOrUpdate(BigStudent.class.getName(), bigStudent);

    return modelMap;
  }
 @Test
 public void shouldNotAddEmailAddressIfInMap() {
   String expectedAttribute = "My Object";
   modelMap.addAttribute(PlayerProfileController.EMAIL_ADDRESS_OBJECT_KEY, expectedAttribute);
   setUpPlayerProfile();
   underTest.getMainProfilePage(modelMap, request, response, true);
   assertEquals(expectedAttribute, modelMap.get(PlayerProfileController.EMAIL_ADDRESS_OBJECT_KEY));
 }
 @Test
 public void shouldNotAddDisplayNameIfInMap() {
   String expectedAttribute = "My Object";
   modelMap.addAttribute(PlayerProfileController.DISPLAY_NAME_OBJECT_KEY, expectedAttribute);
   setUpPlayerProfile();
   underTest.getMainProfilePage(modelMap, request, response, true);
   assertEquals(expectedAttribute, modelMap.get(PlayerProfileController.DISPLAY_NAME_OBJECT_KEY));
 }
Ejemplo n.º 15
0
 @RequestMapping(value = "/handle72")
 public String handle72(ModelMap modelMap, SessionStatus sessionStatus) {
   User user = (User) modelMap.get("user");
   if (user != null) {
     user.setUserName("Jetty");
     sessionStatus.setComplete();
   }
   return "/user/showUser";
 }
Ejemplo n.º 16
0
 @Test
 public void when_invalid_password_entered_shows_error_message() {
   ModelMap model = new ModelMap();
   LoginInfo loginInfo = new LoginInfo();
   loginInfo.setUserId("junit");
   String viewName = controller.onLogin(loginInfo, model);
   assertEquals("login", viewName);
   assertEquals("invalid password", model.get("error"));
 }
  @Test
  public void shouldReturnDefaultViewOnErrorWhenMaxUploadSizeExceeded() {
    setUpPlayerProfile();
    long maxUploadSize = 1000;

    DisplayName expectedDisplayName = new DisplayName("displayName");
    PlayerProfile expectedUserProfile = getUserProfile();
    ModelAndView modelAndView =
        underTest.resolveException(
            request, response, null, new MaxUploadSizeExceededException(maxUploadSize));
    verify(lobbyExceptionHandler)
        .setCommonPropertiesInModelAndView(request, response, modelAndView);

    final ModelMap modelMap = modelAndView.getModelMap();
    assertEquals(
        expectedDisplayName, modelMap.get(PlayerProfileController.DISPLAY_NAME_OBJECT_KEY));
    assertEquals(expectedUserProfile, modelMap.get(PlayerProfileController.PLAYER_OBJECT_KEY));
    assertMainProfilePageViewName(modelAndView);
  }
Ejemplo n.º 18
0
 /**
  * show manager home page
  *
  * @param first
  * @param second
  * @param user
  * @return
  */
 @RequestMapping(value = "{first}/{second}", method = RequestMethod.GET)
 public String index(@PathVariable String first, @PathVariable String second, ModelMap model) {
   if (null == second || "".equals(second)) sendNotFoundError();
   User user = (User) model.get(TOKEN);
   Menu activeMenu = roleMenuMapper.getMenuByRoleAndUrl(user.getRole_id(), first + "/" + second);
   if (null == activeMenu) sendNotFoundError();
   // 跳转到视图
   String view = "redirect:" + getManageRoot() + activeMenu.getMenuurl() + "/" + DEFAULT_VIEW;
   return view;
 }
Ejemplo n.º 19
0
  @Test
  public void test_edit() {
    Long id = 1l;

    when(rankingController.rankingDao.findById(id)).thenReturn(TestObjects.createSampleRanking());

    ModelMap modelMap = rankingController.edit(id);

    verify(rankingController.rankingDao).findById(id);

    assertNotNull(modelMap.get("ranking"));
  }
Ejemplo n.º 20
0
  /** Test the list Users method */
  public void testListUsers() {
    UsersController controller = new UsersController(userService);
    ModelMap model = null;
    ModelAndView result = controller.listUsers(model);
    assertEquals("admin/users/users", result.getViewName());

    controller = new UsersController(userService);
    model = new ModelMap();
    // Expectations
    context.checking(
        new Expectations() {
          {
            one(userService).getUsers();
            will(returnValue(new ArrayList<User>()));
          }
        });
    // Test
    result = controller.listUsers(model);
    // Verify
    assertNotNull(model.get("user"));
    List<User> users = (List<User>) model.get("users");
    assertTrue(users.isEmpty());
    assertEquals("admin/users/users", result.getViewName());

    model = new ModelMap();
    // Expectations
    context.checking(
        new Expectations() {
          {
            one(userService).getUsers();
            will(returnValue(new ArrayList<User>()));
          }
        });
    model.addAttribute("user", new User(null, null, null, false));
    result = controller.listUsers(model);
    assertNotNull(model.get("user"));
    users = (List<User>) model.get("users");
    assert (users.isEmpty());
    assertEquals("admin/users/users", result.getViewName());
  }
  @Test
  @Ignore
  public void show_setsMeterReadingModel() throws JAXBException {
    MeterReading meterReading = Factory.newMeterReading();
    ModelMap model = new ModelMap();
    RetailCustomer retailCustomer = EspiFactory.newRetailCustomer();
    retailCustomer.setId(99L);
    when(service.findById(1L)).thenReturn(meterReading);

    controller.show(1L, 1L, 1L, model);

    assertEquals(meterReading, model.get("meterReading"));
  }
Ejemplo n.º 22
0
 public void common(
     ConfBean confBean,
     UserBean userBean,
     String archive,
     String archiveLookup,
     ModelMap modelMap,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   WorkFlowBean workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
   workFlowBean.setArchiveLookup(serviceUser.getArchive(userBean, archiveLookup));
   common(confBean, userBean, archive, modelMap, request, response);
 }
Ejemplo n.º 23
0
 /**
  * show manage home page
  *
  * @param menu_L2 二级菜单
  * @param model
  * @return
  */
 @RequestMapping(value = "{menu_L2}", method = RequestMethod.GET)
 public String index(@PathVariable String menu_L2, ModelMap model) {
   User user = (User) model.get(TOKEN);
   // 获取二级目录
   Menu secondMenu = roleMenuMapper.getMenuByRoleAndUrl(user.getRole_id(), menu_L2);
   if (null == secondMenu) sendNotFoundError();
   // 获取三级目录
   Menu activeMenu = roleMenuMapper.getDefaultChild(secondMenu.getMenu_id(), user.getRole_id());
   if (null == activeMenu) sendNotFoundError();
   // 跳转到视图
   String view = "redirect:" + getManageRoot() + activeMenu.getMenuurl() + "/" + DEFAULT_VIEW;
   return view;
 }
  @Test
  public void shouldReturnDefaultFormOnErrorWhenAvatarHasAnInvalidExtension() throws Exception {
    setUpPlayerProfile();
    MultipartFile multipartFile = mock(MultipartFile.class);
    when(multipartFile.getBytes()).thenReturn("file".getBytes());
    when(multipartFile.getOriginalFilename()).thenReturn("aFile.pdf");
    when(avatarRepository.storeAvatar("aFile.pdf", "file".getBytes()))
        .thenThrow(new IllegalArgumentException("Invalid extension"));

    assertMainProfilePageViewName(
        underTest.updateUserAvatar(request, response, false, multipartFile, modelMap));
    assertThat((String) modelMap.get("avatarHasErrors"), is(equalTo("true")));
  }
  /**
   * Handle GET requests for attendance dash board view.
   *
   * @param request - HttpServletRequest
   * @param model - ModelMap
   * @return the name of the view.
   * @throws AkuraAppException - The exception details that occurred when processing.
   */
  @RequestMapping(method = RequestMethod.GET)
  public String showAttendanceDashboard(HttpServletRequest request, final ModelMap model)
      throws AkuraAppException {

    AttendanceDashboardDto attendanceDashboard =
        (AttendanceDashboardDto) model.get(MODEL_ATT_ATTENDANCE_DASHBOARD);
    if (attendanceDashboard == null) {
      attendanceDashboard = new AttendanceDashboardDto();
    }

    // Set 0 for all grade.
    attendanceDashboard.setGradeId(0);

    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date());

    int month = cal.get(Calendar.MONTH);
    int currentYear = cal.get(Calendar.YEAR);

    // Check month and year and set month as December if current month is January.
    if (month == 0 && currentYear == DateUtil.currentYearOnly()) {
      attendanceDashboard.setMonth(MONTH_DECEMBER);
      attendanceDashboard.setYear(currentYear - 1);
    } else {
      // Set the previous month and current year.
      attendanceDashboard.setMonth(month);
      attendanceDashboard.setYear(currentYear);
    }

    // Get the academic days.
    int academicDays = getAcademicDays(attendanceDashboard);

    // Check the academic days.
    if (academicDays >= AkuraConstant.TEN) {
      boolean flag = false;
      attendanceDashboard.setAcademicDays(academicDays);

      // Get best student attendance list with pagination.
      List<BestStudentAttendanceTemplate> bestStudentAttendanceList =
          getBestAttendanceInfoWithPagination(model, request, attendanceDashboard, flag);

      model.addAttribute(BEST_STUDENT_ATTENDANCE_LIST, bestStudentAttendanceList);
    }

    // Set attributes.
    setSelectedValues(attendanceDashboard, model);
    model.addAttribute(CURRENT_YEAR, currentYear);
    model.addAttribute(MODEL_ATT_ATTENDANCE_DASHBOARD, attendanceDashboard);
    return VIEW_ATTENDANCE_DASHBOARD;
  }
Ejemplo n.º 26
0
  @Test
  @TransactionalReadWrite
  public void testInitSettingsPage() {
    User user =
        testUtils.createAuthenticatedTestUser("SettingsControllerTest@testInitSettingsPage");

    ModelMap model = new ModelMap();
    assertEquals("logged/settings", controller.initSettingsPage(model));
    assertTrue(model.containsAttribute("settingsform"));
    SettingsForm settingsForm = (SettingsForm) model.get("settingsform");
    assertEquals(user.getEmail(), settingsForm.getEmail());
    assertEquals(user.getEmail(), settingsForm.getCurrentEmail());
    assertEquals("no", settingsForm.getEditPassword());
    assertEquals(user.getLanguage().getCode(), settingsForm.getLang());
  }
 @Override
 public QuestionBreadCrumb setBreadCrumb(ModelMap modelMap) {
   FormElement qElement = (FormElement) modelMap.get(COMMAND_NAME);
   if (qElement != null) {
     if (qElement.getForm() == null) {
       BaseForm form = getFormContext();
       qElement.setForm(form);
     }
     QuestionBreadCrumb breadCrumb =
         new QuestionBreadCrumb(qElement.getForm(), qElement.isNew() ? Action.ADD : Action.EDIT);
     modelMap.addAttribute(Constants.BREAD_CRUMB, breadCrumb);
     return breadCrumb;
   }
   return null;
 }
Ejemplo n.º 28
0
 @ResponseBody
 @RequestMapping(value = "tuanP.json", method = RequestMethod.POST)
 public JsonVo tuanP(ModelMap modelMap, HttpServletRequest request) {
   JsonVo<String> json = new JsonVo<String>();
   request.setAttribute("toWhat", 1);
   modelMap = indexService.getIndexProduct(modelMap, request);
   List list = ((PageVo) modelMap.get("pageVo")).getList();
   for (int oo = 0; oo < list.size(); oo++) {
     DBObject dbObject = (DBObject) list.get(oo);
     list.set(oo, dbObject.toString());
   }
   json.setObject(list);
   json.setResult(true);
   return json;
 }
Ejemplo n.º 29
0
 public void common(
     ConfBean confBean,
     UserBean userBean,
     String archive,
     ModelMap modelMap,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   WorkFlowBean workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
   // SETTO IL WORKFLOW PER LA NAVIGAZIONE DI xDams
   workFlowBean.setArchive(serviceUser.getArchive(userBean, archive));
   workFlowBean.setRequest(request);
   workFlowBean.setResponse(response);
   workFlowBean.setApplicationContext(applicationContext);
   modelMap.put("workFlowBean", workFlowBean);
 }
Ejemplo n.º 30
0
 private void setInitialSelectedCourse(ModelMap model, final PortletRequest req)
     throws ObjectNotFoundException {
   String formattedCourse = req.getParameter("formattedCourse");
   String sectionCode = req.getParameter("sectionCode");
   String termCode = req.getParameter("termCode");
   Person user = (Person) model.get("user");
   if (user == null) {
     throw new EarlyAlertPortletControllerRuntimeException(
         "Missing or deactivated account for current user.");
   }
   FacultyCourse course =
       getCourse(
           model,
           new SearchFacultyCourseTO(user.getSchoolId(), termCode, sectionCode, formattedCourse));
   if (course != null) model.put("initialSelectedCourse", getCourseSectionKey(course));
 }