Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/state/FacetActivity.java @ 436:15179c77aa1d flys-2.9.3
Documentation, so that readers know a tiny bit more what is going on.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 16 Oct 2012 15:08:43 +0200 |
parents | e1738650bfca |
children | f3bf22423c95 |
comparison
equal
deleted
inserted
replaced
435:e39e23320a23 | 436:15179c77aa1d |
---|---|
5 import java.util.ArrayList; | 5 import java.util.ArrayList; |
6 import java.util.HashMap; | 6 import java.util.HashMap; |
7 import java.util.List; | 7 import java.util.List; |
8 import java.util.Map; | 8 import java.util.Map; |
9 | 9 |
10 | |
11 /** Magical system. */ | |
10 public interface FacetActivity | 12 public interface FacetActivity |
11 { | 13 { |
14 /** Static 'activity' that lets all facets be active. */ | |
12 public static final FacetActivity ACTIVE = new FacetActivity() { | 15 public static final FacetActivity ACTIVE = new FacetActivity() { |
13 @Override | 16 @Override |
14 public Boolean isInitialActive( | 17 public Boolean isInitialActive( |
15 Artifact artifact, | 18 Artifact artifact, |
16 Facet facet, | 19 Facet facet, |
18 ) { | 21 ) { |
19 return Boolean.TRUE; | 22 return Boolean.TRUE; |
20 } | 23 } |
21 }; | 24 }; |
22 | 25 |
26 /** Static 'activity' that lets all facets be inactive. */ | |
23 public static final FacetActivity INACTIVE = new FacetActivity() { | 27 public static final FacetActivity INACTIVE = new FacetActivity() { |
24 @Override | 28 @Override |
25 public Boolean isInitialActive( | 29 public Boolean isInitialActive( |
26 Artifact artifact, | 30 Artifact artifact, |
27 Facet facet, | 31 Facet facet, |
31 } | 35 } |
32 }; | 36 }; |
33 | 37 |
34 Boolean isInitialActive(Artifact artifact, Facet facet, String output); | 38 Boolean isInitialActive(Artifact artifact, Facet facet, String output); |
35 | 39 |
40 /** Singleton registry, that maps artifact names to the activities, which | |
41 * decide whether or not a facet should be (initially) active. */ | |
36 public static final class Registry { | 42 public static final class Registry { |
37 | 43 |
44 /** Singleton instance. */ | |
38 private static final Registry INSTANCE = new Registry(); | 45 private static final Registry INSTANCE = new Registry(); |
39 | 46 |
40 private Map<String, List<FacetActivity>> activities; | 47 private Map<String, List<FacetActivity>> activities; |
41 | 48 |
49 /** Private singleton constructor for the Facet-Activity-Registry. */ | |
42 private Registry() { | 50 private Registry() { |
43 activities = new HashMap<String, List<FacetActivity>>(); | 51 activities = new HashMap<String, List<FacetActivity>>(); |
44 } | 52 } |
45 | 53 |
54 /** Access Singleton instance. */ | |
46 public static Registry getInstance() { | 55 public static Registry getInstance() { |
47 return INSTANCE; | 56 return INSTANCE; |
48 } | 57 } |
49 | 58 |
59 /** Queries whether a given facet should be active or not. */ | |
50 public synchronized boolean isInitialActive( | 60 public synchronized boolean isInitialActive( |
51 String key, | 61 String key, |
52 Artifact artifact, | 62 Artifact artifact, |
53 Facet facet, | 63 Facet facet, |
54 String output | 64 String output |