Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 2606:619f6dfec901
#460 Fixed duplicated Outputs in DESCRIBE documents.
flys-artifacts/trunk@4186 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 30 Mar 2012 09:38:29 +0000 |
parents | a22e0cb6eace |
children | c553d4fa3957 |
comparison
equal
deleted
inserted
replaced
2605:15a3684c6bce | 2606:619f6dfec901 |
---|---|
262 name = flys.name; | 262 name = flys.name; |
263 data = flys.cloneData(); | 263 data = flys.cloneData(); |
264 facets = flys.cloneFacets(); | 264 facets = flys.cloneFacets(); |
265 // Do not clone filter facets! | 265 // Do not clone filter facets! |
266 | 266 |
267 List<String> stateIds = getPreviousStateIds(); | 267 ArrayList<String> stateIds = (ArrayList<String>) getPreviousStateIds(); |
268 stateIds.add(getCurrentStateId()); | 268 ArrayList<String> toInitialize = (ArrayList<String>) stateIds.clone(); |
269 | 269 |
270 for (String stateId: stateIds) { | 270 toInitialize.add(getCurrentStateId()); |
271 | |
272 for (String stateId: toInitialize) { | |
271 State state = getState(context, stateId); | 273 State state = getState(context, stateId); |
272 | 274 |
273 if (state != null) { | 275 if (state != null) { |
274 state.initialize(artifact, this, context, callMeta); | 276 state.initialize(artifact, this, context, callMeta); |
275 } | 277 } |
391 ArtifactNamespaceContext.NAMESPACE_URI, | 393 ArtifactNamespaceContext.NAMESPACE_URI, |
392 ArtifactNamespaceContext.NAMESPACE_PREFIX); | 394 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
393 | 395 |
394 Element result = ec.create("result"); | 396 Element result = ec.create("result"); |
395 | 397 |
396 String targetState = XMLUtils.xpathString( | 398 String currentStateId = getCurrentStateId(); |
399 String targetState = XMLUtils.xpathString( | |
397 target, XPATH_ADVANCE_TARGET, ArtifactNamespaceContext.INSTANCE); | 400 target, XPATH_ADVANCE_TARGET, ArtifactNamespaceContext.INSTANCE); |
398 | 401 |
399 logger.info("FLYSArtifact.advance() to '" + targetState + "'"); | 402 logger.info("FLYSArtifact.advance() to '" + targetState + "'"); |
400 | 403 |
401 if (isStateReachable(targetState, context)) { | 404 if (!currentStateId.equals(targetState) |
405 && isStateReachable(targetState, context)) | |
406 { | |
402 logger.info("Advance: Step forward"); | 407 logger.info("Advance: Step forward"); |
403 | 408 |
404 List<String> prev = getPreviousStateIds(); | 409 List<String> prev = getPreviousStateIds(); |
405 prev.add(getCurrentStateId()); | 410 prev.add(currentStateId); |
406 | 411 |
407 setCurrentStateId(targetState); | 412 setCurrentStateId(targetState); |
408 | 413 |
409 logger.debug("Compute data for state: " + targetState); | 414 logger.debug("Compute data for state: " + targetState); |
410 compute(context, ComputeType.ADVANCE, true); | 415 compute(context, ComputeType.ADVANCE, true); |
526 /** | 531 /** |
527 * Get all previous and the current state id. | 532 * Get all previous and the current state id. |
528 * @return #getPreviousStateIds() + #getCurrentStateId() | 533 * @return #getPreviousStateIds() + #getCurrentStateId() |
529 */ | 534 */ |
530 public List<String> getStateHistoryIds() { | 535 public List<String> getStateHistoryIds() { |
531 List<String> allIds = getPreviousStateIds(); | 536 ArrayList<String> prevIds = (ArrayList) getPreviousStateIds(); |
537 ArrayList<String> allIds = (ArrayList) prevIds.clone(); | |
538 | |
532 allIds.add(getCurrentStateId()); | 539 allIds.add(getCurrentStateId()); |
533 return allIds; | 540 return allIds; |
534 } | 541 } |
535 | 542 |
536 | 543 |
1236 */ | 1243 */ |
1237 @Override | 1244 @Override |
1238 public void endOfLife(Object context) { | 1245 public void endOfLife(Object context) { |
1239 logger.info("FLYSArtifact.endOfLife: " + identifier()); | 1246 logger.info("FLYSArtifact.endOfLife: " + identifier()); |
1240 | 1247 |
1241 List<String> ids = getPreviousStateIds(); | 1248 ArrayList<String> ids = (ArrayList<String>) getPreviousStateIds(); |
1242 ids.add(getCurrentStateId()); | 1249 ArrayList<String> toDestroy = (ArrayList<String>) ids.clone(); |
1243 | 1250 |
1244 destroyStates(ids, context); | 1251 toDestroy.add(getCurrentStateId()); |
1245 } | 1252 |
1246 | 1253 destroyStates(toDestroy, context); |
1247 | 1254 } |
1255 | |
1256 | |
1248 /** | 1257 /** |
1249 * Determines Facets initial disposition regarding activity (think of | 1258 * Determines Facets initial disposition regarding activity (think of |
1250 * selection in Client ThemeList GUI). This will be checked one time | 1259 * selection in Client ThemeList GUI). This will be checked one time |
1251 * when the facet enters a collections describe document. | 1260 * when the facet enters a collections describe document. |
1252 * | 1261 * |