comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/ManualPointsSingleState.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 5e38e2924c07
children
comparison
equal deleted inserted replaced
9424:da19f1f58d72 9425:3f49835a00c3
56 * @param meta CallMeta to be used for internationalization. 56 * @param meta CallMeta to be used for internationalization.
57 * @param facets List to add ManualPointsFacet to. 57 * @param facets List to add ManualPointsFacet to.
58 * 58 *
59 * @return null. 59 * @return null.
60 */ 60 */
61 public Object compute( 61 private Object compute(
62 D4EArtifact artifact, 62 D4EArtifact artifact,
63 ComputeType type,
63 String hash, 64 String hash,
64 CallMeta meta, 65 CallMeta meta,
65 List<Facet> facets 66 List<Facet> facets
66 ) { 67 ) {
67 log.debug("ManualPointsSingleState.compute()"); 68 log.debug("ManualPointsSingleState.compute()");
99 double y = array.getDouble(0); 100 double y = array.getDouble(0);
100 String name = array.getString(1); 101 String name = array.getString(1);
101 String fName = ct + "." + MANUALLINE; 102 String fName = ct + "." + MANUALLINE;
102 log.debug("have facet: " + y + " / " 103 log.debug("have facet: " + y + " / "
103 + name + " -> " + fName); 104 + name + " -> " + fName);
104 CrossSectionWaterLineFacet facet =
105 new CrossSectionWaterLineFacet(
106 i,
107 fName,
108 name);
109 105
106 final CrossSectionWaterLineFacet facet = new CrossSectionWaterLineFacet( i, fName, name, type, hash, getID(), Integer.valueOf(i));
110 facets.add(facet); 107 facets.add(facet);
111 } 108 }
112 } 109 }
113 catch(JSONException e){ 110 catch(JSONException e){
114 log.error("Could not decode json."); 111 log.error("Could not decode json.", e);
115 } 112 }
116 113
117 } 114 }
118 else { 115 else {
119 //log.debug("No points for " + ct); 116 //log.debug("No points for " + ct);
131 String hash, 128 String hash,
132 Object context, 129 Object context,
133 CallMeta meta, 130 CallMeta meta,
134 List<Facet> facets 131 List<Facet> facets
135 ) { 132 ) {
136 return compute(artifact, hash, meta, facets); 133 return compute(artifact, ComputeType.INIT, hash, meta, facets);
137 } 134 }
138 135
139 136
140 /** Call compute. */ 137 /** Call compute. */
141 @Override 138 @Override
144 String hash, 141 String hash,
145 CallContext context, 142 CallContext context,
146 List<Facet> facets, 143 List<Facet> facets,
147 Object old 144 Object old
148 ) { 145 ) {
149 return compute(artifact, hash, context.getMeta(), facets); 146 return compute(artifact, ComputeType.FEED, hash, context.getMeta(), facets);
150 } 147 }
151 } 148 }
152 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : 149 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org