Ejemplo n.º 1
0
  /** Contains Display Logic */
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    HttpSession session = request.getSession(true);
    UserModel sessionModel = (UserModel) session.getAttribute("user");

    Long id = sessionModel.getCollegeId();
    Long roleId = sessionModel.getRoleId();

    if (id == 0) {
      id = DataUtility.getLong(request.getParameter("id"));
    }

    CollegeModel model = new CollegeModel();
    System.out.println("org12" + UserFilterManager.getOrganizationId(request));
    model.setOrganizationId(UserFilterManager.getOrganizationId(request));

    if (id > 0) {
      try {
        model = model.findByPK(id);
        ServletUtility.setModel(model, request);
      } catch (ApplicationException e) {
        ServletUtility.handleException(e, request, response);
        return;
      }
    }
    ServletUtility.setModel(model, request);
    ServletUtility.forwardView(ORSView.COLLEGE_VIEW, request, response);
  }
Ejemplo n.º 2
0
  /** Loads pre-loaded data like Dropdown List. */
  @Override
  protected void preload(HttpServletRequest request) {
    HttpSession session = request.getSession(true);
    UserModel sessionModel = (UserModel) session.getAttribute("user");
    Long id = sessionModel.getCollegeId();
    if (id == 0) {
      id = DataUtility.getLong(request.getParameter("id"));
    }
    IndustryModel model = new IndustryModel();
    CountryModel countryModel = new CountryModel();
    StateModel statemodel = new StateModel();
    PrincipalEmployerModel principalModel = new PrincipalEmployerModel();
    try {
      List list = model.search();
      request.setAttribute("industryList", list);
      List countryList = countryModel.search();
      request.setAttribute("countryList", countryList);
      List esicStateList = statemodel.search();
      request.setAttribute("esicStateList", esicStateList);
      List epfStateList = statemodel.search();
      request.setAttribute("epfStateList", epfStateList);
      List profStateList = statemodel.search();
      request.setAttribute("profStateList", profStateList);
      List serStateList = statemodel.search();
      request.setAttribute("serStateList", serStateList);

      principalModel.setId(UserFilterManager.getOrganizationId(request));
      System.out.println("model" + UserFilterManager.getOrganizationId(request));
      List organizationList = principalModel.search();
      request.setAttribute("organizationList", organizationList);

      if (id > 0) {
        CollegeModel collegemodel = new CollegeModel();
        StateModel stateModel = new StateModel();
        DistrictModel districtModel = new DistrictModel();
        AreaModel areaModel = new AreaModel();
        CityModel cityModel = new CityModel();
        PostOfficeModel postOfficeModel = new PostOfficeModel();

        collegemodel.setOrganizationId(UserFilterManager.getOrganizationId(request));
        collegemodel = collegemodel.findByPK(id);
        if (collegemodel.getStateId() > 0) {
          stateModel.setId(collegemodel.getStateId());
          List stateList = stateModel.search();
          request.setAttribute("stateList", stateList);
        }

        if (collegemodel.getDistrictId() > 0) {
          districtModel.setId(collegemodel.getDistrictId());
          List districtList = districtModel.search();
          request.setAttribute("districtList", districtList);
        }

        if (collegemodel.getCityId() > 0) {
          cityModel.setId(collegemodel.getCityId());
          List cityList = cityModel.search();
          request.setAttribute("cityList", cityList);
        }

        if (collegemodel.getAreaId() > 0) {
          areaModel.setId(collegemodel.getAreaId());
          List areaList = areaModel.search();
          request.setAttribute("areaList", areaList);
        }

        if (collegemodel.getPostOfficeId() > 0) {
          postOfficeModel.setId(collegemodel.getPostOfficeId());
          List postOfficeList = postOfficeModel.search();
          request.setAttribute("postOfficeList", postOfficeList);
        }
        if (collegemodel.getEsicDistrictId() > 0) {
          districtModel.setId(collegemodel.getEsicDistrictId());
          List esicDistrictList = districtModel.search();
          request.setAttribute("esicDistrictList", esicDistrictList);
        }
        if (collegemodel.getEpfDistrictId() > 0) {
          districtModel.setId(collegemodel.getEpfDistrictId());
          List epfDistrictList = districtModel.search();
          request.setAttribute("epfDistrictList", epfDistrictList);
        }
        if (collegemodel.getProfDistrictId() > 0) {
          districtModel.setId(collegemodel.getProfDistrictId());
          List profDistrictList = districtModel.search();
          request.setAttribute("profDistrictList", profDistrictList);
        }
        if (collegemodel.getSerDistrictId() > 0) {
          districtModel.setId(collegemodel.getSerDistrictId());
          List serDistrictList = districtModel.search();
          request.setAttribute("serDistrictList", serDistrictList);
        }
        if (collegemodel.getStateOneId() > 0) {
          stateModel.setId(collegemodel.getStateOneId());
          List stateOneList = stateModel.search();
          request.setAttribute("stateOneList", stateOneList);
        }
        if (collegemodel.getStateTwoId() > 0) {
          stateModel.setId(collegemodel.getStateTwoId());
          List stateTwoList = stateModel.search();
          request.setAttribute("stateTwoList", stateTwoList);
        }
        if (collegemodel.getStateThreeId() > 0) {
          stateModel.setId(collegemodel.getStateThreeId());
          List stateThreeList = stateModel.search();
          request.setAttribute("stateThreeList", stateThreeList);
        }
        if (collegemodel.getState4Id() > 0) {
          stateModel.setId(collegemodel.getState4Id());
          List state4List = stateModel.search();
          request.setAttribute("state4List", state4List);
        }
        if (collegemodel.getDistrict1Id() > 0) {
          districtModel.setId(collegemodel.getDistrict1Id());
          List district1List = districtModel.search();
          request.setAttribute("district1List", district1List);
        }
        if (collegemodel.getDistrict2Id() > 0) {
          districtModel.setId(collegemodel.getDistrict2Id());
          List district2List = districtModel.search();
          request.setAttribute("district2List", district2List);
        }
        if (collegemodel.getDistrict3Id() > 0) {
          districtModel.setId(collegemodel.getDistrict3Id());
          List district3List = districtModel.search();
          request.setAttribute("district3List", district3List);
        }
        if (collegemodel.getDistrict4Id() > 0) {
          districtModel.setId(collegemodel.getDistrict4Id());
          List district4List = districtModel.search();
          request.setAttribute("district4List", district4List);
        }
        if (collegemodel.getOwnerStateId() > 0) {
          stateModel.setId(collegemodel.getOwnerStateId());
          List ownerStateList = stateModel.search();
          request.setAttribute("ownerStateList", ownerStateList);
        }
        if (collegemodel.getOwnerDistrictId() > 0) {
          districtModel.setId(collegemodel.getOwnerDistrictId());
          List ownerDistrictList = districtModel.search();
          request.setAttribute("ownerDistrictList", ownerDistrictList);
        }
        if (collegemodel.getOwnerCityId() > 0) {
          cityModel.setId(collegemodel.getOwnerCityId());
          List ownerCityList = cityModel.search();
          request.setAttribute("ownerCityList", ownerCityList);
        }
        if (collegemodel.getOwnerAreaId() > 0) {
          areaModel.setId(collegemodel.getOwnerAreaId());
          List ownerAreaList = areaModel.search();
          request.setAttribute("ownerAreaList", ownerAreaList);
        }

        if (collegemodel.getOwnerPostOfficeId() > 0) {
          postOfficeModel.setId(collegemodel.getOwnerPostOfficeId());
          List ownerPostOfficeList = postOfficeModel.search();
          request.setAttribute("ownerPostOfficeList", ownerPostOfficeList);
        }
      }
    } catch (ApplicationException e) {
      log.error(e);
    }
  }