Esempio n. 1
0
  public String adminAddSuccessAction() {
    if (areaSelectName == null) {
      FacesContext context = FacesContext.getCurrentInstance();
      String bundleName = context.getApplication().getMessageBundle();
      ResourceBundle messageBundle =
          ResourceBundle.getBundle(
              bundleName,
              context.getViewRoot().getLocale(),
              Thread.currentThread().getContextClassLoader());
      String prompt = messageBundle.getString("selectArea");

      FacesUtils.addErrorMessage(prompt);
      return null;
    } else {
      Administrator admin = new Administrator();
      String condition = " name ='" + this.areaSelectName + "'";
      area_admin = this.serviceLocator.getAreaService().queryAreaByCondition(condition).get(0);
      admin.setAdr(adr_admin);
      admin.setArea(area_admin);
      admin.setEmail(email_admin);
      admin.setName(name_admin);
      admin.setTel(tel_admin);
      this.serviceLocator.getAdminService().saveAdministrator(admin);
      return NavigationResults.ADMINADDSUCCESSACTION;
    }
  }
Esempio n. 2
0
  public String areaAddSuccessAction() {
    Area area = new Area();
    if ((areaSelectName == null) || (areaSelectName.equals(""))) {
      // superiorArea = 0;
      FacesContext context = FacesContext.getCurrentInstance();
      String bundleName = context.getApplication().getMessageBundle();
      ResourceBundle messageBundle =
          ResourceBundle.getBundle(
              bundleName,
              context.getViewRoot().getLocale(),
              Thread.currentThread().getContextClassLoader());
      String prompt = messageBundle.getString("selectSuperArea");

      FacesUtils.addErrorMessage(prompt);
      return null;
    } else {
      String condition = "name ='" + this.areaSelectName + "'";
      superiorArea =
          this.serviceLocator.getAreaService().queryAreaByCondition(condition).get(0).getAreaId();

      area.setSuperiorArea(superiorArea);
      area.setName(name);
      area.setIntro(intro);
      area.setPrincipal(principal);
      area.setTel(tel);
      area.setCoordinateX(coordinateX);
      area.setCoordinateY(coordinateY);
      this.serviceLocator.getAreaService().saveArea(area);
      return NavigationResults.AREAADDSUCCESSACTION;
    }
  }