Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/BlackboardDataFacet.java @ 3814:8083f6384023
merged flys-artifacts/pre2.6-2012-01-04
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:56 +0200 |
parents | 2bb160b2768e |
children | bb0dede9294f |
comparison
equal
deleted
inserted
replaced
1491:2a00f4849738 | 3814:8083f6384023 |
---|---|
1 package de.intevation.flys.artifacts.model; | |
2 | |
3 import java.util.ArrayList; | |
4 import java.util.List; | |
5 | |
6 import de.intevation.artifacts.Artifact; | |
7 import de.intevation.artifacts.CallContext; | |
8 | |
9 import de.intevation.artifactdatabase.state.DefaultFacet; | |
10 | |
11 | |
12 /** | |
13 * Facet that writes artifact-uui and facet index on the blackboard, | |
14 * delivers data if asked so. | |
15 */ | |
16 public class BlackboardDataFacet extends DefaultFacet { | |
17 | |
18 public BlackboardDataFacet() {} | |
19 | |
20 /** Do not instantiate a BlackboardDataFacet, subclass it instead. */ | |
21 public BlackboardDataFacet(int idx, String name, String description) { | |
22 super(idx, name, description); | |
23 } | |
24 | |
25 | |
26 /** Hey, We can ArtifactUUID+FacetIndex (i.e. getData)! */ | |
27 public List getDataProviderKeys(Artifact art) { | |
28 List list = new ArrayList(); | |
29 list.add(art.identifier() + getIndex()); | |
30 return list; | |
31 } | |
32 | |
33 | |
34 /** | |
35 * Can provide whatever getData returns. | |
36 * @param key will respond on uuid+index | |
37 * @param param ignored | |
38 * @param context ignored | |
39 * @return whatever getData delivers. | |
40 */ | |
41 public Object provideBlackboardData(Artifact artifact, | |
42 Object key, | |
43 Object param, | |
44 CallContext context | |
45 ) { | |
46 if (key.equals(artifact.identifier() + getIndex())) { | |
47 return getData(artifact, context); | |
48 } | |
49 else { | |
50 return null; | |
51 } | |
52 } | |
53 | |
54 } | |
55 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |