@Override protected void processElement(final XMLStreamReader reader, final Pou item) throws XMLStreamException { switch (reader.getNamespaceURI()) { case NAMESPACE: switch (reader.getLocalName()) { case "Geometrie": Utils.processGeometrie(reader, getConnection(), item, NAMESPACE); break; case "GlobalniIdNavrhuZmeny": item.setNzIdGlobalni(Long.parseLong(reader.getElementText())); break; case "IdTransakce": item.setIdTransRuian(Long.parseLong(reader.getElementText())); break; case "Kod": item.setKod(Integer.parseInt(reader.getElementText())); break; case "Nazev": item.setNazev(reader.getElementText()); break; case "Nespravny": item.setNespravny(Boolean.valueOf(reader.getElementText())); break; case "Orp": item.setOrpKod(Utils.getOrpKod(reader, NAMESPACE)); break; case "PlatiOd": item.setPlatiOd(Utils.parseTimestamp(reader.getElementText())); break; case "SpravniObecKod": item.setSpravniObecKod(Integer.parseInt(reader.getElementText())); break; default: XMLUtils.processUnsupported(reader); } break; default: XMLUtils.processUnsupported(reader); } }
@Override @SuppressWarnings("ValueOfIncrementOrDecrementUsed") protected void fill(final PreparedStatement pstm, final Pou item, final boolean update) throws SQLException { final PreparedStatementEx pstmEx = new PreparedStatementEx(pstm); int index = 1; pstm.setString(index++, item.getNazev()); pstmEx.setBoolean(index++, item.getNespravny()); pstm.setInt(index++, item.getOrpKod()); pstm.setInt(index++, item.getSpravniObecKod()); pstm.setLong(index++, item.getIdTransRuian()); pstmEx.setDate(index++, item.getPlatiOd()); pstm.setLong(index++, item.getNzIdGlobalni()); pstmEx.setBoolean(index++, item.getZmenaGrafiky()); if (!Config.isNoGis()) { pstm.setString(index++, item.getDefinicniBod()); pstm.setString(index++, item.getHranice()); } pstm.setInt(index++, item.getKod()); if (update) { pstmEx.setLong(index++, item.getIdTransRuian()); } }
@Override protected void fillExists(final PreparedStatement pstm, final Pou item) throws SQLException { pstm.setInt(1, item.getKod()); }