Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportWstColumn.java @ 478:db430bd9e0e0
Implemented a WstColumnValue cache to speed up inserting WST files into database.
flys-backend/trunk@1734 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 20 Apr 2011 07:21:03 +0000 |
parents | 3570e4af8cb2 |
children | 67fd63e4ef66 |
comparison
equal
deleted
inserted
replaced
477:0addc2663a4d | 478:db430bd9e0e0 |
---|---|
1 package de.intevation.flys.importer; | 1 package de.intevation.flys.importer; |
2 | 2 |
3 import de.intevation.flys.model.Wst; | 3 import de.intevation.flys.model.Wst; |
4 import de.intevation.flys.model.WstColumn; | 4 import de.intevation.flys.model.WstColumn; |
5 import de.intevation.flys.model.WstColumnValue; | |
5 import de.intevation.flys.model.River; | 6 import de.intevation.flys.model.River; |
6 | 7 |
7 import org.hibernate.Session; | 8 import org.hibernate.Session; |
8 import org.hibernate.Query; | 9 import org.hibernate.Query; |
9 | 10 |
10 import java.util.List; | 11 import java.util.List; |
11 import java.util.ArrayList; | 12 import java.util.ArrayList; |
13 import java.util.Map; | |
12 | 14 |
13 import java.math.BigDecimal; | 15 import java.math.BigDecimal; |
14 | 16 |
15 public class ImportWstColumn | 17 public class ImportWstColumn |
16 { | 18 { |
20 protected Integer position; | 22 protected Integer position; |
21 | 23 |
22 protected List<ImportWstColumnQRange> columnQRanges; | 24 protected List<ImportWstColumnQRange> columnQRanges; |
23 protected List<ImportWstColumnValue> columnValues; | 25 protected List<ImportWstColumnValue> columnValues; |
24 | 26 |
27 protected Map<WstColumnValueKey, WstColumnValue> wstCache; | |
28 | |
25 protected WstColumn peer; | 29 protected WstColumn peer; |
26 | 30 |
27 public ImportWstColumn() { | 31 public ImportWstColumn() { |
28 columnQRanges = new ArrayList<ImportWstColumnQRange>(); | 32 columnQRanges = new ArrayList<ImportWstColumnQRange>(); |
29 columnValues = new ArrayList<ImportWstColumnValue>(); | 33 columnValues = new ArrayList<ImportWstColumnValue>(); |
31 | 35 |
32 public ImportWstColumn( | 36 public ImportWstColumn( |
33 ImportWst wst, | 37 ImportWst wst, |
34 String name, | 38 String name, |
35 String description, | 39 String description, |
36 Integer position | 40 Integer position, |
41 Map<WstColumnValueKey, WstColumnValue> wstCache | |
37 ) { | 42 ) { |
38 this(); | 43 this(); |
39 this.wst = wst; | 44 this.wst = wst; |
40 this.name = name; | 45 this.name = name; |
41 this.description = description; | 46 this.description = description; |
42 this.position = position; | 47 this.position = position; |
48 this.wstCache = wstCache; | |
43 } | 49 } |
44 | 50 |
45 public ImportWst getWst() { | 51 public ImportWst getWst() { |
46 return wst; | 52 return wst; |
47 } | 53 } |
74 this.position = position; | 80 this.position = position; |
75 } | 81 } |
76 | 82 |
77 public void addColumnValue(BigDecimal position, BigDecimal w) { | 83 public void addColumnValue(BigDecimal position, BigDecimal w) { |
78 columnValues.add( | 84 columnValues.add( |
79 new ImportWstColumnValue(this, position, w)); | 85 new ImportWstColumnValue(this, position, w, wstCache)); |
80 } | 86 } |
81 | 87 |
82 public void addColumnQRange(ImportWstQRange columnQRange) { | 88 public void addColumnQRange(ImportWstQRange columnQRange) { |
83 columnQRanges.add( | 89 columnQRanges.add( |
84 new ImportWstColumnQRange(this, columnQRange)); | 90 new ImportWstColumnQRange(this, columnQRange)); |