Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 1763:0e748e8972b5
Cosmetics, docs.
flys-artifacts/trunk@3079 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 26 Oct 2011 08:15:24 +0000 |
parents | 0349dd524f9c |
children | 5d8b3880a553 |
comparison
equal
deleted
inserted
replaced
1762:c85a84d60f68 | 1763:0e748e8972b5 |
---|---|
60 */ | 60 */ |
61 public abstract class FLYSArtifact extends DefaultArtifact { | 61 public abstract class FLYSArtifact extends DefaultArtifact { |
62 | 62 |
63 /** The logger that is used in this artifact. */ | 63 /** The logger that is used in this artifact. */ |
64 private static Logger logger = Logger.getLogger(FLYSArtifact.class); | 64 private static Logger logger = Logger.getLogger(FLYSArtifact.class); |
65 | |
66 | 65 |
67 public static final String COMPUTING_CACHE = "computed.values"; | 66 public static final String COMPUTING_CACHE = "computed.values"; |
68 | 67 |
69 /** The XPath that points to the input data elements of the FEED document. */ | 68 /** The XPath that points to the input data elements of the FEED document. */ |
70 public static final String XPATH_FEED_INPUT = | 69 public static final String XPATH_FEED_INPUT = |
190 } | 189 } |
191 | 190 |
192 filterFacets = buildFilterFacets(data); | 191 filterFacets = buildFilterFacets(data); |
193 } | 192 } |
194 | 193 |
194 | |
195 protected List<String> clonePreviousStateIds() { | 195 protected List<String> clonePreviousStateIds() { |
196 return new ArrayList<String>(previousStateIds); | 196 return new ArrayList<String>(previousStateIds); |
197 } | 197 } |
198 | 198 |
199 | |
199 protected Map<String, StateData> cloneData() { | 200 protected Map<String, StateData> cloneData() { |
200 Map<String, StateData> copy = new TreeMap<String, StateData>(); | 201 Map<String, StateData> copy = new TreeMap<String, StateData>(); |
201 | 202 |
202 for (Map.Entry<String, StateData> entry: data.entrySet()) { | 203 for (Map.Entry<String, StateData> entry: data.entrySet()) { |
203 copy.put(entry.getKey(), entry.getValue().deepCopy()); | 204 copy.put(entry.getKey(), entry.getValue().deepCopy()); |
204 } | 205 } |
205 | 206 |
206 return copy; | 207 return copy; |
207 } | 208 } |
208 | 209 |
210 /** | |
211 * Return a copy of the facet mapping. | |
212 * @return Mapping of outputnames to facets. | |
213 */ | |
209 protected Map<String, List<Facet>> cloneFacets() { | 214 protected Map<String, List<Facet>> cloneFacets() { |
210 Map copy = new HashMap<String, List<Facet>>(); | 215 Map copy = new HashMap<String, List<Facet>>(); |
211 | 216 |
212 for (Map.Entry<String, List<Facet>> entry: facets.entrySet()) { | 217 for (Map.Entry<String, List<Facet>> entry: facets.entrySet()) { |
213 List<Facet> facets = entry.getValue(); | 218 List<Facet> facets = entry.getValue(); |
218 copy.put(entry.getKey(), facetCopies); | 223 copy.put(entry.getKey(), facetCopies); |
219 } | 224 } |
220 | 225 |
221 return copy; | 226 return copy; |
222 } | 227 } |
228 | |
223 | 229 |
224 protected void initialize( | 230 protected void initialize( |
225 Artifact artifact, | 231 Artifact artifact, |
226 Object context, | 232 Object context, |
227 CallMeta callMeta) | 233 CallMeta callMeta) |
519 public String getDataAsString(String name) { | 525 public String getDataAsString(String name) { |
520 StateData data = getData(name); | 526 StateData data = getData(name); |
521 return data != null ? (String) data.getValue() : null; | 527 return data != null ? (String) data.getValue() : null; |
522 } | 528 } |
523 | 529 |
530 | |
531 /** | |
532 * Add StateData containing a given string. | |
533 * @param name Name of the data object. | |
534 * @param value String to store. | |
535 */ | |
524 public void addStringData(String name, String value) { | 536 public void addStringData(String name, String value) { |
525 addData(name, new DefaultStateData(name, null, null, value)); | 537 addData(name, new DefaultStateData(name, null, null, value)); |
526 } | 538 } |
539 | |
527 | 540 |
528 public Collection<StateData> getAllData() { | 541 public Collection<StateData> getAllData() { |
529 return data.values(); | 542 return data.values(); |
530 } | 543 } |
531 | 544 |
669 return getCurrentStateId() + hash; | 682 return getCurrentStateId() + hash; |
670 } | 683 } |
671 | 684 |
672 | 685 |
673 /** | 686 /** |
674 * Return List. | 687 * Return List of outputs, where combinations of outputname and filtername |
688 * that match content in filterFacets is left out. | |
689 * @return filtered Outputlist. | |
675 */ | 690 */ |
676 protected List<Output> filterOutputs(List<Output> outs) { | 691 protected List<Output> filterOutputs(List<Output> outs) { |
677 | 692 |
678 if (filterFacets == null || filterFacets.isEmpty()) { | 693 if (filterFacets == null || filterFacets.isEmpty()) { |
679 logger.debug("No filter for Outputs."); | 694 logger.debug("No filter for Outputs."); |
758 | 773 |
759 return generateOutputs(list, fs); | 774 return generateOutputs(list, fs); |
760 } | 775 } |
761 | 776 |
762 | 777 |
778 /** | |
779 * Generate a list of outputs with facets from fs if type is found in list | |
780 * of output. | |
781 * | |
782 * @param list List of outputs | |
783 * @param fs List of facets | |
784 */ | |
763 protected List<Output> generateOutputs(List<Output> list, List<Facet> fs) { | 785 protected List<Output> generateOutputs(List<Output> list, List<Facet> fs) { |
764 List<Output> generated = new ArrayList<Output>(); | 786 List<Output> generated = new ArrayList<Output>(); |
765 | 787 |
766 boolean debug = logger.isDebugEnabled(); | 788 boolean debug = logger.isDebugEnabled(); |
767 | 789 |
976 destroyState(ids.get(i), context); | 998 destroyState(ids.get(i), context); |
977 } | 999 } |
978 } | 1000 } |
979 | 1001 |
980 | 1002 |
1003 /** | |
1004 * Destroy the states. | |
1005 */ | |
981 @Override | 1006 @Override |
982 public void endOfLife(Object context) { | 1007 public void endOfLife(Object context) { |
983 logger.info("FLYSArtifact.endOfLife: " + identifier()); | 1008 logger.info("FLYSArtifact.endOfLife: " + identifier()); |
984 | 1009 |
985 List<String> ids = getPreviousStateIds(); | 1010 List<String> ids = getPreviousStateIds(); |