comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/StaticWQKmsState.java @ 9425:3f49835a00c3

Extended CrossSectionFacet so it may fetch different data from within the artifact result. Also allows to have acces to the potentially already computed artifact result via its normal computation cache.
author gernotbelger
date Fri, 17 Aug 2018 15:31:02 +0200
parents e4606eae8ea5
children
comparison
equal deleted inserted replaced
9424:da19f1f58d72 9425:3f49835a00c3
50 50
51 51
52 /** 52 /**
53 * Compute, create Facets, do the same stuff as all the other states do. 53 * Compute, create Facets, do the same stuff as all the other states do.
54 */ 54 */
55 protected Object compute( 55 private Object compute(
56 StaticWQKmsArtifact artifact, 56 StaticWQKmsArtifact artifact,
57 CallMeta metaLocale, 57 CallMeta metaLocale,
58 ComputeType type,
58 String hash, 59 String hash,
59 List<Facet> facets, 60 List<Facet> facets,
60 Object old 61 Object old
61 ) { 62 ) {
62 String id = getID(); 63 String stateId = getID();
63 String code = artifact.getDataAsString("ids"); 64 String code = artifact.getDataAsString("ids");
64 String [] parts = code.split("-"); 65 String [] parts = code.split("-");
65 66
66 // Return from cache, if present. 67 // Return from cache, if present.
67 WQKms res = old instanceof WQKms 68 WQKms res = old instanceof WQKms
123 } 124 }
124 125
125 Facet rpFacet = new RelativePointFacet(wkmsName); 126 Facet rpFacet = new RelativePointFacet(wkmsName);
126 facets.add(rpFacet); 127 facets.add(rpFacet);
127 128
128 Facet csFacet = new CrossSectionWaterLineFacet(0, 129 Facet csFacet = new CrossSectionWaterLineFacet(0,wkmsName, type, hash, stateId, null);
129 wkmsName);
130 facets.add(csFacet); 130 facets.add(csFacet);
131 131
132 if (!qEmpty) { 132 if (!qEmpty) {
133 wkmsName = "W (" + wkmsName + ")"; 133 wkmsName = "W (" + wkmsName + ")";
134 } 134 }
145 facets.add(wfacet); 145 facets.add(wfacet);
146 146
147 Facet wstfacet = new DataFacet( 147 Facet wstfacet = new DataFacet(
148 WST, 148 WST,
149 wkmsName, 149 wkmsName,
150 ComputeType.ADVANCE, hash, id); 150 ComputeType.ADVANCE, hash, stateId);
151 facets.add(wstfacet); 151 facets.add(wstfacet);
152 152
153 return res; 153 return res;
154 } 154 }
155 155
159 String hash, 159 String hash,
160 CallContext context, 160 CallContext context,
161 List<Facet> facets, 161 List<Facet> facets,
162 Object old 162 Object old
163 ) { 163 ) {
164 return compute((StaticWQKmsArtifact) artifact, context.getMeta(), 164 return compute((StaticWQKmsArtifact) artifact, context.getMeta(), ComputeType.ADVANCE, hash, facets, old);
165 hash, facets, old);
166 } 165 }
167 166
168 /** 167 /**
169 * Get data, create the facets. 168 * Get data, create the facets.
170 * 169 *
176 String hash, 175 String hash,
177 CallContext context, 176 CallContext context,
178 List<Facet> facets, 177 List<Facet> facets,
179 Object old 178 Object old
180 ) { 179 ) {
181 return compute((StaticWQKmsArtifact) artifact, context.getMeta(), 180 return compute((StaticWQKmsArtifact) artifact, context.getMeta(), ComputeType.FEED, hash, facets, old);
182 hash, facets, old);
183 } 181 }
184 182
185 183
186 /** 184 /**
187 * Create the facets. 185 * Create the facets.
193 String hash, 191 String hash,
194 Object context, 192 Object context,
195 CallMeta meta, 193 CallMeta meta,
196 List<Facet> facets 194 List<Facet> facets
197 ) { 195 ) {
198 return compute((StaticWQKmsArtifact) artifact, meta, 196 return compute((StaticWQKmsArtifact) artifact, meta, ComputeType.INIT, hash, facets, null);
199 hash, facets, null);
200 } 197 }
201 } 198 }
202 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : 199 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org