示例#1
0
  public String save() {
    Country country = this.locationMBean.getCountry();
    if (country != null) {
      this.city.setCountry(country);
    }

    Province province = this.locationMBean.getProvince();
    if (province != null) {
      this.city.setProvince(province);
    }

    cityBean.save(this.city);

    return "cities?faces-redirect=true";
  }
示例#2
0
  @PostConstruct
  public void load() {
    if (this.id != null && !this.id.isEmpty()) {
      this.city = cityBean.find(id);

      locationMBean.initialize();

      if (this.city.getCountry() != null) {
        locationMBean.setSelectedCountry(this.city.getCountry().getAcronym());
      }

      if (this.city.getProvince() != null) {
        locationMBean.setSelectedProvince(this.city.getProvince().getId());
      }
    }
  }
示例#3
0
 public List<City> getCities() {
   if (this.cities == null) {
     this.cities = cityBean.findAll();
   }
   return this.cities;
 }
示例#4
0
 public String remove() {
   cityBean.remove(city.getId());
   return "cities?faces-redirect=true";
 }