Пример #1
0
  protected void updateLocationProperties(Location location, PropertyMap changes) {

    boolean isAdminBound = location.getLocationType().getBoundAdminLevel() != null;

    for (Map.Entry<String, Object> change : changes.entrySet()) {

      String property = change.getKey();
      Object value = change.getValue();

      if (!isAdminBound && "locationName".equals(property)) {
        location.setName((String) value);

      } else if ("locationAxe".equals(property)) {
        location.setAxe((String) value);

      } else if ("x".equals(property)) {
        location.setX((Double) value);

      } else if ("y".equals(property)) {
        location.setY((Double) changes.get("y"));

      } else if (isAdminBound
          && AdminLevelDTO.getPropertyName(location.getLocationType().getBoundAdminLevel().getId())
              .equals(property)) {

        location.setName(adminDAO.findById(((AdminEntityDTO) value).getId()).getName());
      }
    }
  }