Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentDensityArtifact.java @ 7204:292330854722
issue1435: Store id of sediment yield only.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 30 Sep 2013 17:30:31 +0200 |
parents | 99c5e4148859 |
children | 7a6cb5b34bfc |
comparison
equal
deleted
inserted
replaced
7203:99c5e4148859 | 7204:292330854722 |
---|---|
55 | 55 |
56 /** One and only state to be in. */ | 56 /** One and only state to be in. */ |
57 protected transient State state = null; | 57 protected transient State state = null; |
58 | 58 |
59 protected String DATA_ID = "ID"; | 59 protected String DATA_ID = "ID"; |
60 protected String DATA_YEAR = "YEAR"; | |
61 | 60 |
62 /** | 61 /** |
63 * Trivial Constructor. | 62 * Trivial Constructor. |
64 */ | 63 */ |
65 public SedimentDensityArtifact() { | 64 public SedimentDensityArtifact() { |
75 | 74 |
76 | 75 |
77 private Object getSedimentDensity() { | 76 private Object getSedimentDensity() { |
78 logger.debug("SedimentDensityArtifact.getSedimentDensity"); | 77 logger.debug("SedimentDensityArtifact.getSedimentDensity"); |
79 Integer id = getDataAsInteger(DATA_ID); | 78 Integer id = getDataAsInteger(DATA_ID); |
80 Integer year = getDataAsInteger(DATA_YEAR); | |
81 | 79 |
82 // TODO use cache if possible | 80 // TODO use cache if possible |
83 return SedimentDensityFactory.getSedimentDensityUncached(id, year); | 81 return SedimentDensityFactory.getSedimentDensityUncached(id); |
84 } | 82 } |
85 | 83 |
86 | 84 |
87 private State newDensityState() { | 85 private State newDensityState() { |
88 return new StaticState(STATIC_STATE_NAME) { | 86 return new StaticState(STATIC_STATE_NAME) { |
121 CallMeta callMeta, | 119 CallMeta callMeta, |
122 Document data) | 120 Document data) |
123 { | 121 { |
124 logger.debug("SedimentDensityArtifact.setup"); | 122 logger.debug("SedimentDensityArtifact.setup"); |
125 | 123 |
126 // Store id, yield yields. | |
127 state = newDensityState(); | 124 state = newDensityState(); |
128 if (logger.isDebugEnabled()) { | 125 if (logger.isDebugEnabled()) { |
129 logger.debug(XMLUtils.toString(data)); | 126 logger.debug(XMLUtils.toString(data)); |
130 } | 127 } |
131 | 128 |
133 | 130 |
134 String code = getDatacageIDValue(data); | 131 String code = getDatacageIDValue(data); |
135 | 132 |
136 if (code != null) { | 133 if (code != null) { |
137 //String name = SedimentDensityFactory.getSedimentDensityDescription(Integer.valueOf(code)); | 134 //String name = SedimentDensityFactory.getSedimentDensityDescription(Integer.valueOf(code)); |
138 //id: and year? | |
139 | 135 |
140 String name = "facet"; | 136 String name = "facet"; |
141 | 137 |
142 Facet facet = new SedimentDensityFacet( | 138 Facet facet = new SedimentDensityFacet( |
143 0, | 139 0, |
144 SEDIMENT_LOAD_COARSE, | 140 SEDIMENT_DENSITY, |
145 name, | 141 name, |
146 //???? | 142 //???? |
147 ComputeType.ADVANCE, state.getID(), "hash" | 143 ComputeType.ADVANCE, state.getID(), "hash" |
148 ); | 144 ); |
149 fs.add(facet); | 145 fs.add(facet); |
150 addFacets(state.getID(), fs); | 146 addFacets(state.getID(), fs); |
151 addStringData(DATA_ID, code); | 147 addStringData(DATA_ID, code); |
152 addStringData(DATA_YEAR, code); | 148 } |
149 else { | |
150 logger.error("No id given."); | |
153 } | 151 } |
154 | 152 |
155 spawnState(); | 153 spawnState(); |
156 super.setup(identifier, factory, context, callMeta, data); | 154 super.setup(identifier, factory, context, callMeta, data); |
157 } | 155 } |