Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/FLYSArtifact.java @ 5865:73da40528cf2
River artifacts: Renamed FLYSUtils to RiverUtils.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 28 Apr 2013 15:09:31 +0200 |
parents | 4897a58c8746 |
children | 9a6741ccf6d4 |
comparison
equal
deleted
inserted
replaced
5864:f2e46a668fe6 | 5865:73da40528cf2 |
---|---|
53 import org.dive4elements.river.artifacts.cache.CacheFactory; | 53 import org.dive4elements.river.artifacts.cache.CacheFactory; |
54 import org.dive4elements.river.artifacts.context.FLYSContext; | 54 import org.dive4elements.river.artifacts.context.FLYSContext; |
55 import org.dive4elements.river.artifacts.model.CalculationMessage; | 55 import org.dive4elements.river.artifacts.model.CalculationMessage; |
56 import org.dive4elements.river.artifacts.states.DefaultState; | 56 import org.dive4elements.river.artifacts.states.DefaultState; |
57 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | 57 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
58 import org.dive4elements.river.utils.FLYSUtils; | 58 import org.dive4elements.river.utils.RiverUtils; |
59 | 59 |
60 /** | 60 /** |
61 * The default FLYS artifact with convenience added. | 61 * The default FLYS artifact with convenience added. |
62 * (Subclass to get fully functional artifacts). | 62 * (Subclass to get fully functional artifacts). |
63 * | 63 * |
137 CallContext context, | 137 CallContext context, |
138 String uuid) | 138 String uuid) |
139 { | 139 { |
140 List<String> stateIds = getPreviousStateIds(); | 140 List<String> stateIds = getPreviousStateIds(); |
141 | 141 |
142 FLYSContext flysContext = FLYSUtils.getFlysContext(context); | 142 FLYSContext flysContext = RiverUtils.getFlysContext(context); |
143 StateEngine engine = (StateEngine) flysContext.get( | 143 StateEngine engine = (StateEngine) flysContext.get( |
144 FLYSContext.STATE_ENGINE_KEY); | 144 FLYSContext.STATE_ENGINE_KEY); |
145 | 145 |
146 boolean debug = log.isDebugEnabled(); | 146 boolean debug = log.isDebugEnabled(); |
147 | 147 |
189 log.debug("Setup this artifact with the uuid: " + identifier); | 189 log.debug("Setup this artifact with the uuid: " + identifier); |
190 } | 190 } |
191 | 191 |
192 super.setup(identifier, factory, context, callMeta, data); | 192 super.setup(identifier, factory, context, callMeta, data); |
193 | 193 |
194 FLYSContext flysContext = FLYSUtils.getFlysContext(context); | 194 FLYSContext flysContext = RiverUtils.getFlysContext(context); |
195 | 195 |
196 List<State> states = getStates(context); | 196 List<State> states = getStates(context); |
197 | 197 |
198 String name = getName(); | 198 String name = getName(); |
199 | 199 |
445 log.debug( | 445 log.debug( |
446 "Describe: the current state is: " + getCurrentStateId()); | 446 "Describe: the current state is: " + getCurrentStateId()); |
447 dumpArtifact(); | 447 dumpArtifact(); |
448 } | 448 } |
449 | 449 |
450 FLYSContext flysContext = FLYSUtils.getFlysContext(context); | 450 FLYSContext flysContext = RiverUtils.getFlysContext(context); |
451 | 451 |
452 StateEngine stateEngine = (StateEngine) flysContext.get( | 452 StateEngine stateEngine = (StateEngine) flysContext.get( |
453 FLYSContext.STATE_ENGINE_KEY); | 453 FLYSContext.STATE_ENGINE_KEY); |
454 | 454 |
455 TransitionEngine transitionEngine = (TransitionEngine) flysContext.get( | 455 TransitionEngine transitionEngine = (TransitionEngine) flysContext.get( |
702 * Get list of existant states for this Artifact. | 702 * Get list of existant states for this Artifact. |
703 * @param context Contex to get StateEngine from. | 703 * @param context Contex to get StateEngine from. |
704 * @return list of states. | 704 * @return list of states. |
705 */ | 705 */ |
706 protected List<State> getStates(Object context) { | 706 protected List<State> getStates(Object context) { |
707 FLYSContext flysContext = FLYSUtils.getFlysContext(context); | 707 FLYSContext flysContext = RiverUtils.getFlysContext(context); |
708 StateEngine engine = (StateEngine) flysContext.get( | 708 StateEngine engine = (StateEngine) flysContext.get( |
709 FLYSContext.STATE_ENGINE_KEY); | 709 FLYSContext.STATE_ENGINE_KEY); |
710 return engine.getStates(getName()); | 710 return engine.getStates(getName()); |
711 } | 711 } |
712 | 712 |
716 * @param context Context to get StateEngine from. | 716 * @param context Context to get StateEngine from. |
717 * @param stateID ID of state to get. | 717 * @param stateID ID of state to get. |
718 * @return state with given ID. | 718 * @return state with given ID. |
719 */ | 719 */ |
720 protected State getState(Object context, String stateID) { | 720 protected State getState(Object context, String stateID) { |
721 FLYSContext flysContext = FLYSUtils.getFlysContext(context); | 721 FLYSContext flysContext = RiverUtils.getFlysContext(context); |
722 StateEngine engine = (StateEngine) flysContext.get( | 722 StateEngine engine = (StateEngine) flysContext.get( |
723 FLYSContext.STATE_ENGINE_KEY); | 723 FLYSContext.STATE_ENGINE_KEY); |
724 return engine.getState(stateID); | 724 return engine.getState(stateID); |
725 } | 725 } |
726 | 726 |
977 | 977 |
978 String uri = ArtifactNamespaceContext.NAMESPACE_URI; | 978 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
979 | 979 |
980 DefaultState current = (DefaultState) getCurrentState(context); | 980 DefaultState current = (DefaultState) getCurrentState(context); |
981 | 981 |
982 FLYSContext flysContext = FLYSUtils.getFlysContext(context); | 982 FLYSContext flysContext = RiverUtils.getFlysContext(context); |
983 StateEngine engine = (StateEngine) flysContext.get( | 983 StateEngine engine = (StateEngine) flysContext.get( |
984 FLYSContext.STATE_ENGINE_KEY); | 984 FLYSContext.STATE_ENGINE_KEY); |
985 | 985 |
986 for (int i = 0; i < count; i++) { | 986 for (int i = 0; i < count; i++) { |
987 Element node = (Element)nodes.item(i); | 987 Element node = (Element)nodes.item(i); |
1029 | 1029 |
1030 if (log.isDebugEnabled()) { | 1030 if (log.isDebugEnabled()) { |
1031 log.debug("Determine if the state '" + stateId + "' is reachable."); | 1031 log.debug("Determine if the state '" + stateId + "' is reachable."); |
1032 } | 1032 } |
1033 | 1033 |
1034 FLYSContext flysContext = FLYSUtils.getFlysContext(context); | 1034 FLYSContext flysContext = RiverUtils.getFlysContext(context); |
1035 | 1035 |
1036 State currentState = getCurrentState(context); | 1036 State currentState = getCurrentState(context); |
1037 StateEngine sEngine = (StateEngine) flysContext.get( | 1037 StateEngine sEngine = (StateEngine) flysContext.get( |
1038 FLYSContext.STATE_ENGINE_KEY); | 1038 FLYSContext.STATE_ENGINE_KEY); |
1039 | 1039 |