comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 1050:eccf966fb677

State engine: Removed CallContext from state validation. flys-artifacts/trunk@2512 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 19 Aug 2011 14:10:18 +0000
parents 799c7108ea6d
children 61c051e53f9b
comparison
equal deleted inserted replaced
1049:433559e25b50 1050:eccf966fb677
469 addData(name, new DefaultStateData(name, null, null, value)); 469 addData(name, new DefaultStateData(name, null, null, value));
470 } 470 }
471 } 471 }
472 472
473 DefaultState current = (DefaultState) getCurrentState(context); 473 DefaultState current = (DefaultState) getCurrentState(context);
474 current.validate(this, context); 474 current.validate(this);
475 } 475 }
476 476
477 477
478 /** 478 /**
479 * Determines if the state with the identifier <i>stateId</i> is reachable 479 * Determines if the state with the identifier <i>stateId</i> is reachable
1119 1119
1120 return getCurrentStateId() + hash; 1120 return getCurrentStateId() + hash;
1121 } 1121 }
1122 1122
1123 1123
1124 public List<Output> getOutputs(CallContext context) { 1124 public List<Output> getOutputs(Object context) {
1125 List<String> stateIds = getPreviousStateIds(); 1125 List<String> stateIds = getPreviousStateIds();
1126 List<Output> generated = new ArrayList<Output>(); 1126 List<Output> generated = new ArrayList<Output>();
1127 1127
1128 FLYSContext flysContext = getFlysContext(context); 1128 FLYSContext flysContext = getFlysContext(context);
1129 StateEngine engine = (StateEngine) flysContext.get( 1129 StateEngine engine = (StateEngine) flysContext.get(
1138 1138
1139 return generated; 1139 return generated;
1140 } 1140 }
1141 1141
1142 1142
1143 public List<Output> getCurrentOutputs(CallContext context) { 1143 public List<Output> getCurrentOutputs(Object context) {
1144 DefaultState cur = (DefaultState) getCurrentState(context); 1144 DefaultState cur = (DefaultState) getCurrentState(context);
1145 1145
1146 try { 1146 try {
1147 if (cur.validate(this, context)) { 1147 if (cur.validate(this)) {
1148 return getOutputForState(cur); 1148 return getOutputForState(cur);
1149 } 1149 }
1150 } 1150 }
1151 catch (IllegalArgumentException iae) { } 1151 catch (IllegalArgumentException iae) { }
1152 1152
1153 return new ArrayList<Output>(); 1153 return new ArrayList<Output>();
1154 }
1155
1156 public List<Output> getCurrentOutputs(Object context) {
1157 return getOutputForState((DefaultState)getCurrentState(context));
1158 } 1154 }
1159 1155
1160 protected List<Output> getOutputForState(DefaultState state) { 1156 protected List<Output> getOutputForState(DefaultState state) {
1161 List<Output> list = state.getOutputs(); 1157 List<Output> list = state.getOutputs();
1162 if (list == null || list.size() == 0) { 1158 if (list == null || list.size() == 0) {

http://dive4elements.wald.intevation.org