Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/ImportWst.java @ 7193:7fabae60428b double-precision
Merged changes from default into double-precision branch.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 27 Sep 2013 17:36:50 +0200 |
parents | 3d83a4cf33ba 0fe00824bd96 |
children | 5358a5497b2b |
comparison
equal
deleted
inserted
replaced
7016:28748bb1b676 | 7193:7fabae60428b |
---|---|
44 | 44 |
45 protected ImportUnit unit; | 45 protected ImportUnit unit; |
46 | 46 |
47 protected ImportWstColumnFactory columnFactory; | 47 protected ImportWstColumnFactory columnFactory; |
48 | 48 |
49 protected boolean kmUp; | |
50 | |
49 /** Wst as in db. */ | 51 /** Wst as in db. */ |
50 protected Wst peer; | 52 protected Wst peer; |
51 | 53 |
52 public ImportWst() { | 54 public ImportWst() { |
53 this(COLUMN_FACTORY); | 55 this(COLUMN_FACTORY); |
78 | 80 |
79 public void setKind(Integer kind) { | 81 public void setKind(Integer kind) { |
80 this.kind = kind; | 82 this.kind = kind; |
81 } | 83 } |
82 | 84 |
85 public boolean getKmUp() { | |
86 return kmUp; | |
87 } | |
88 | |
89 public void setKmUp(boolean kmUp) { | |
90 this.kmUp = kmUp; | |
91 } | |
83 | 92 |
84 public void setDescription(String description) { | 93 public void setDescription(String description) { |
85 this.description = description; | 94 this.description = description; |
86 } | 95 } |
87 | 96 |
118 } | 127 } |
119 | 128 |
120 public void storeDependencies(River river) { | 129 public void storeDependencies(River river) { |
121 | 130 |
122 log.info("store '" + description + "'"); | 131 log.info("store '" + description + "'"); |
123 Wst wst = getPeer(river); | 132 getPeer(river); |
124 | 133 |
125 for (ImportWstColumn column: columns) { | 134 for (ImportWstColumn column: columns) { |
126 column.storeDependencies(river); | 135 column.storeDependencies(river); |
127 } | 136 } |
128 | 137 |
129 Session session = ImporterSession.getInstance().getDatabaseSession(); | 138 Session session = ImporterSession.getInstance().getDatabaseSession(); |
130 session.flush(); | 139 session.flush(); |
131 } | 140 } |
132 | 141 |
142 public boolean guessWaterLevelIncreasing() { | |
143 int up = 0; | |
144 for (ImportWstColumn column: columns) { | |
145 if (column.guessWaterLevelIncreasing()) ++up; | |
146 } | |
147 return up > columns.size() - up; | |
148 } | |
149 | |
150 public void fixRangesOrder() { | |
151 for (ImportWstColumn column: columns) { | |
152 column.fixRangesOrder(); | |
153 } | |
154 } | |
133 | 155 |
134 /** Get corresponding mapped wst (from database). */ | 156 /** Get corresponding mapped wst (from database). */ |
135 public Wst getPeer(River river) { | 157 public Wst getPeer(River river) { |
136 if (peer == null) { | 158 if (peer == null) { |
137 Session session = ImporterSession.getInstance().getDatabaseSession(); | 159 Session session = ImporterSession.getInstance().getDatabaseSession(); |