comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 944:c256061287d7

Simplified the code to read all provided Outputs of an Artifact. flys-artifacts/trunk@2357 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 18 Jul 2011 17:09:00 +0000
parents 796c54058dc4
children 7399401f728c
comparison
equal deleted inserted replaced
943:5de90b0cff8e 944:c256061287d7
1106 | ((long)value.hashCode() << (shift + 3)); 1106 | ((long)value.hashCode() << (shift + 3));
1107 shift += 2; 1107 shift += 2;
1108 } 1108 }
1109 1109
1110 return getCurrentStateId() + hash; 1110 return getCurrentStateId() + hash;
1111 }
1112
1113
1114 public List<Output> getOutputs(CallContext context) {
1115 List<String> stateIds = getPreviousStateIds();
1116
1117 DefaultState cur = (DefaultState) getCurrentState(context);
1118 try {
1119 if (cur.validate(this, context)) {
1120 stateIds.add(cur.getID());
1121 }
1122 }
1123 catch (IllegalArgumentException iae) { }
1124
1125 List<Output> generated = new ArrayList<Output>();
1126
1127 FLYSContext flysContext = getFlysContext(context);
1128 StateEngine engine = (StateEngine) flysContext.get(
1129 FLYSContext.STATE_ENGINE_KEY);
1130
1131 for (String stateId: stateIds) {
1132 DefaultState state = (DefaultState) engine.getState(stateId);
1133
1134 List<Output> list = state.getOutputs();
1135 if (list == null || list.size() == 0) {
1136 logger.debug("-> No output modes for this state.");
1137 continue;
1138 }
1139
1140 List<Facet> fs = facets.get(stateId);
1141 if (fs == null || fs.size() == 0) {
1142 logger.debug("No facets found.");
1143 continue;
1144 }
1145
1146 List<Output> o = generateOutputs(list, fs);
1147
1148 generated.addAll(o);
1149 }
1150
1151
1152 return generated;
1111 } 1153 }
1112 1154
1113 1155
1114 protected List<Output> generateOutputs(List<Output> list, List<Facet> fs) { 1156 protected List<Output> generateOutputs(List<Output> list, List<Facet> fs) {
1115 List<Output> generated = new ArrayList<Output>(); 1157 List<Output> generated = new ArrayList<Output>();

http://dive4elements.wald.intevation.org