Esempio n. 1
0
  private CrossSection commitCrossSection(
      final Session session, final String dbType, final GafProfile profile) throws Exception {
    final CrossSection crossSection = new CrossSection();

    final String protoName = String.format("%s", profile.getStation()); // $NON-NLS-1$

    final String name = m_sectionNameGenerator.createUniqueName(protoName);
    crossSection.setName(name);

    crossSection.setState(m_state);
    crossSection.setWaterBody(m_waterBody);

    crossSection.setDescription(StringUtils.EMPTY);

    crossSection.setStation(profile.getStation());

    /* Copy initial dates from state */
    crossSection.setCreationDate(m_state.getCreationDate());
    crossSection.setEditingDate(m_state.getEditingDate());
    crossSection.setEditingUser(m_state.getEditingUser());
    crossSection.setMeasurementDate(m_state.getMeasurementDate());

    final Geometry line = profile.createLine(dbType);
    crossSection.setLine(line);

    session.save(crossSection);

    return crossSection;
  }
Esempio n. 2
0
  private void commitWaterLevel(final Session session) {
    if (m_waterlevelEvent != null) {
      m_waterlevelEvent.setCreationDate(m_state.getCreationDate());
      m_waterlevelEvent.setEditingDate(m_state.getEditingDate());
      m_waterlevelEvent.setEditingUser(m_state.getEditingUser());
      m_waterlevelEvent.setMeasurementDate(m_state.getMeasurementDate());

      m_waterlevelEvent.setWaterBody(m_waterBody);
      m_waterlevelEvent.setState(m_state);

      session.save(m_waterlevelEvent);
    }
  }