예제 #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";
 }