Example #1
0
  private CrossSectionPart commitPart(
      final Session session,
      final String dbType,
      final CrossSection crossSection,
      final GafPart part,
      final PDBNameGenerator nameGenerator)
      throws Exception {
    final CrossSectionPart csPart = new CrossSectionPart();

    final GafKind partKind = part.getKind();

    final String name = nameGenerator.createUniqueName(partKind.toString());

    csPart.setName(name);

    if (part.getKind() == GafKind.W) {
      final String gafFileName = m_profiles.getGafFilename();
      csPart.setDescription(
          String.format(Messages.getString("Gaf2Db.5"), gafFileName)); // $NON-NLS-1$
    } else csPart.setDescription(StringUtils.EMPTY);

    final CrossSectionPartType partType = findPartType(partKind);
    csPart.setCrossSectionPartType(partType);

    final Geometry line = part.getLine(dbType);
    csPart.setLine(line);

    csPart.setCrossSection(crossSection);
    session.save(csPart);
    return csPart;
  }
Example #2
0
  @Override
  public void execute(final Session session) throws PdbConnectException {
    try {
      final GafProfile[] profiles = m_profiles.getProfiles();
      m_monitor.beginTask(Messages.getString("Gaf2Db.1"), profiles.length); // $NON-NLS-1$

      if (m_waterlevelEvent != null) m_state.getEvents().add(m_waterlevelEvent);

      addState(session, m_state);
      commitWaterLevel(session);

      for (final GafProfile profile : profiles) {
        m_monitor.subTask(
            String.format(Messages.getString("Gaf2Db.2"), profile.getStation())); // $NON-NLS-1$
        commitProfile(session, m_dbType, profile);
        m_monitor.worked(1);
      }

      m_monitor.subTask(Messages.getString("Gaf2Db.3")); // $NON-NLS-1$
    } catch (final Exception e) {
      e.printStackTrace();
      throw new PdbConnectException(Messages.getString("Gaf2Db.4"), e); // $NON-NLS-1$
    }
  }
Example #3
0
 @Override
 public String getLabel() {
   return Messages.getString("Gaf2Db.0"); // $NON-NLS-1$
 }