Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/BlackboardDataFacet.java @ 2081:aa9cc91c8193
#444 Take care on NullPointerExceptions in getWQMode. Take 'false' as default value if no 'wq_free' item is existing.
flys-artifacts/trunk@3597 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 05 Jan 2012 14:15:07 +0000 |
parents | 2bb160b2768e |
children | bb0dede9294f |
rev | line source |
---|---|
2024
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.Artifact; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.artifacts.CallContext; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifactdatabase.state.DefaultFacet; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 /** |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 * Facet that writes artifact-uui and facet index on the blackboard, |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 * delivers data if asked so. |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 */ |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 public class BlackboardDataFacet extends DefaultFacet { |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 public BlackboardDataFacet() {} |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 /** Do not instantiate a BlackboardDataFacet, subclass it instead. */ |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 public BlackboardDataFacet(int idx, String name, String description) { |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 super(idx, name, description); |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 } |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 /** Hey, We can ArtifactUUID+FacetIndex (i.e. getData)! */ |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 public List getDataProviderKeys(Artifact art) { |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 List list = new ArrayList(); |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 list.add(art.identifier() + getIndex()); |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 return list; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 } |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 /** |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 * Can provide whatever getData returns. |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 * @param key will respond on uuid+index |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 * @param param ignored |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 * @param context ignored |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 * @return whatever getData delivers. |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 */ |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 public Object provideBlackboardData(Artifact artifact, |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 Object key, |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 Object param, |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 CallContext context |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 ) { |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 if (key.equals(artifact.identifier() + getIndex())) { |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 return getData(artifact, context); |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 } |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 else { |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 return null; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 } |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 } |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 } |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |