Mercurial > dive4elements > river
view flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightEpochValue.java @ 3947:371e38af6f79
Remove fetchInfoURL methods from River and gauge
The info url link will be generated in the client.
flys-backend/trunk@5579 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 24 Sep 2012 07:58:34 +0000 |
parents | 8926571e47fb |
children |
line wrap: on
line source
package de.intevation.flys.importer; import java.util.List; import java.math.BigDecimal; import org.apache.log4j.Logger; import org.hibernate.Session; import org.hibernate.Query; import de.intevation.flys.model.BedHeightEpoch; import de.intevation.flys.model.BedHeightEpochValue; public class ImportBedHeightEpochValue implements ImportBedHeightValue { private static final Logger log = Logger.getLogger(ImportBedHeightEpochValue.class); private BigDecimal station; private BigDecimal height; private BedHeightEpochValue peer; public ImportBedHeightEpochValue() { } public ImportBedHeightEpochValue(BigDecimal station, BigDecimal height) { this.station = station; this.height = height; } public void storeDependencies(BedHeightEpoch bedHeight) { getPeer(bedHeight); } public BedHeightEpochValue getPeer(BedHeightEpoch bedHeight) { if (peer == null) { Session session = ImporterSession.getInstance().getDatabaseSession(); Query query = session.createQuery( "from BedHeightEpochValue where " + " bedHeight=:bedHeight and " + " station=:station and " + " height=:height"); query.setParameter("bedHeight", bedHeight); query.setParameter("station", station); query.setParameter("height", height); List<BedHeightEpochValue> values = query.list(); if (values.isEmpty()) { peer = new BedHeightEpochValue( bedHeight, station, height ); session.save(peer); } else { peer = values.get(0); } } return peer; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :