Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 1704:e8627d1e2db6
Cosmetics, docs.
flys-artifacts/trunk@2948 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 12 Oct 2011 10:59:12 +0000 |
parents | 94732906b094 |
children | f643ea084213 |
comparison
equal
deleted
inserted
replaced
1703:71d369ab789d | 1704:e8627d1e2db6 |
---|---|
57 * | 57 * |
58 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 58 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
59 */ | 59 */ |
60 public abstract class FLYSArtifact extends DefaultArtifact { | 60 public abstract class FLYSArtifact extends DefaultArtifact { |
61 | 61 |
62 /** The logger that is used in this artifact.*/ | 62 /** The logger that is used in this artifact. */ |
63 private static Logger logger = Logger.getLogger(FLYSArtifact.class); | 63 private static Logger logger = Logger.getLogger(FLYSArtifact.class); |
64 | 64 |
65 | 65 |
66 public static final String COMPUTING_CACHE = "computed.values"; | 66 public static final String COMPUTING_CACHE = "computed.values"; |
67 | 67 |
68 /** 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. */ |
69 public static final String XPATH_FEED_INPUT = | 69 public static final String XPATH_FEED_INPUT = |
70 "/art:action/art:data/art:input"; | 70 "/art:action/art:data/art:input"; |
71 | 71 |
72 /** The XPath that points to the name of the target state of ADVANCE.*/ | 72 /** The XPath that points to the name of the target state of ADVANCE. */ |
73 public static final String XPATH_ADVANCE_TARGET = | 73 public static final String XPATH_ADVANCE_TARGET = |
74 "/art:action/art:target/@art:name"; | 74 "/art:action/art:target/@art:name"; |
75 | 75 |
76 public static final String XPATH_MODEL_ARTIFACT = | 76 public static final String XPATH_MODEL_ARTIFACT = |
77 "/art:action/art:template/@uuid"; | 77 "/art:action/art:template/@uuid"; |
78 | 78 |
79 public static final String XPATH_FILTER = | 79 public static final String XPATH_FILTER = |
80 "/art:action/art:filter/art:out"; | 80 "/art:action/art:filter/art:out"; |
81 | 81 |
82 /** The constant string that shows that an operation was successful.*/ | 82 /** The constant string that shows that an operation was successful. */ |
83 public static final String OPERATION_SUCCESSFUL = "SUCCESS"; | 83 public static final String OPERATION_SUCCESSFUL = "SUCCESS"; |
84 | 84 |
85 /** The constant string that shows that an operation failed.*/ | 85 /** The constant string that shows that an operation failed. */ |
86 public static final String OPERATION_FAILED = "FAILURE"; | 86 public static final String OPERATION_FAILED = "FAILURE"; |
87 | 87 |
88 | 88 |
89 /** The identifier of the current state. */ | 89 /** The identifier of the current state. */ |
90 protected String currentStateId; | 90 protected String currentStateId; |
91 | 91 |
92 /** The identifiers of previous states on a stack.*/ | 92 /** The identifiers of previous states on a stack. */ |
93 protected List<String> previousStateIds; | 93 protected List<String> previousStateIds; |
94 | 94 |
95 /** The name of the artifact.*/ | 95 /** The name of the artifact. */ |
96 protected String name; | 96 protected String name; |
97 | 97 |
98 /** The data that have been inserted into this artifact.*/ | 98 /** The data that have been inserted into this artifact. */ |
99 protected Map<String, StateData> data; | 99 protected Map<String, StateData> data; |
100 | 100 |
101 /** The list of facets supported by this artifact.*/ | 101 /** The list of facets supported by this artifact. */ |
102 protected Map<String, List<Facet>> facets; | 102 protected Map<String, List<Facet>> facets; |
103 | 103 |
104 /** out -> facets */ | 104 /** |
105 * Used to generates "view" on the facets (hides facets not matching the | |
106 * filter in output of collection); out -> facets. | |
107 */ | |
105 protected Map<String, List<Facet>> filterFacets; | 108 protected Map<String, List<Facet>> filterFacets; |
106 | 109 |
107 | 110 |
108 /** | 111 /** |
109 * The default constructor that creates an empty FLYSArtifact. | 112 * The default constructor that creates an empty FLYSArtifact. |
234 data = flys.cloneData(); | 237 data = flys.cloneData(); |
235 facets = flys.cloneFacets(); | 238 facets = flys.cloneFacets(); |
236 // Do not clone filter facets! | 239 // Do not clone filter facets! |
237 } | 240 } |
238 | 241 |
242 | |
243 /** | |
244 * Builds filter facets from document. | |
245 * @see filterFacets | |
246 */ | |
239 protected Map<String, List<Facet>> buildFilterFacets(Document document) { | 247 protected Map<String, List<Facet>> buildFilterFacets(Document document) { |
240 | 248 |
241 NodeList nodes = (NodeList)XMLUtils.xpath( | 249 NodeList nodes = (NodeList)XMLUtils.xpath( |
242 document, | 250 document, |
243 XPATH_FILTER, | 251 XPATH_FILTER, |
661 * Return List. | 669 * Return List. |
662 */ | 670 */ |
663 protected List<Output> filterOutputs(List<Output> outs) { | 671 protected List<Output> filterOutputs(List<Output> outs) { |
664 | 672 |
665 if (filterFacets == null || filterFacets.isEmpty()) { | 673 if (filterFacets == null || filterFacets.isEmpty()) { |
674 logger.debug("No filter for Outputs."); | |
666 return outs; | 675 return outs; |
667 } | 676 } |
668 | 677 |
669 List<Output> filtered = new ArrayList<Output>(); | 678 List<Output> filtered = new ArrayList<Output>(); |
670 | 679 |
823 ) { | 832 ) { |
824 DefaultState current = (DefaultState) getCurrentState(context); | 833 DefaultState current = (DefaultState) getCurrentState(context); |
825 return compute(context, hash, current, type, generateFacets); | 834 return compute(context, hash, current, type, generateFacets); |
826 } | 835 } |
827 | 836 |
837 | |
838 /** | |
839 * Like compute, but identify State by it id (string). | |
840 */ | |
828 public Object compute( | 841 public Object compute( |
829 CallContext context, | 842 CallContext context, |
830 String hash, | 843 String hash, |
831 String stateID, | 844 String stateID, |
832 ComputeType type, | 845 ComputeType type, |