comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/DatacageBackendListener.java @ 999:b0218f21c664

Wire datacage with backend of artifact database. flys-artifacts/trunk@2438 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 01 Aug 2011 14:58:15 +0000
parents
children 46bfe06e51d9
comparison
equal deleted inserted replaced
998:b81626b10cb7 999:b0218f21c664
1 package de.intevation.flys.artifacts.datacage;
2
3 import de.intevation.artifacts.Artifact;
4 import de.intevation.artifacts.ArtifactCollection;
5 import de.intevation.artifacts.GlobalContext;
6 import de.intevation.artifacts.User;
7
8 import de.intevation.artifactdatabase.BackendListener;
9 import de.intevation.artifactdatabase.Backend;
10
11 import org.apache.log4j.Logger;
12
13 import org.w3c.dom.Document;
14
15 public class DatacageBackendListener
16 implements BackendListener
17 {
18 private static Logger log =
19 Logger.getLogger(DatacageBackendListener.class);
20
21 protected GlobalContext context;
22
23 public DatacageBackendListener() {
24 }
25
26 protected BackendListener getListener() {
27 Object listener = context.get(Datacage.DATACAGE_KEY);
28 return listener instanceof BackendListener
29 ? (BackendListener)listener
30 : null;
31 }
32
33 @Override
34 public void setup(GlobalContext context) {
35 this.context = context;
36 BackendListener l = getListener();
37 if (l != null) {
38 l.setup(context);
39 }
40 }
41
42 @Override
43 public void createdArtifact(Artifact artifact, Backend backend) {
44 log.debug("createdArtifact");
45 BackendListener l = getListener();
46 if (l != null) {
47 l.createdArtifact(artifact, backend);
48 }
49 }
50
51 @Override
52 public void storedArtifact(Artifact artifact, Backend backend) {
53 log.debug("storedArtifact");
54 BackendListener l = getListener();
55 if (l != null) {
56 l.storedArtifact(artifact, backend);
57 }
58 }
59
60 @Override
61 public void createdUser(User user, Backend backend) {
62 log.debug("createdUser");
63 BackendListener l = getListener();
64 if (l != null) {
65 l.createdUser(user, backend);
66 }
67 }
68
69 @Override
70 public void deletedUser(String identifier, Backend backend) {
71 log.debug("deletedUser");
72 BackendListener l = getListener();
73 if (l != null) {
74 l.deletedUser(identifier, backend);
75 }
76 }
77
78 @Override
79 public void createdCollection(
80 ArtifactCollection collection,
81 Backend backend
82 ) {
83 log.debug("createdCollection");
84 BackendListener l = getListener();
85 if (l != null) {
86 l.createdCollection(collection, backend);
87 }
88 }
89
90 @Override
91 public void deletedCollection(String identifier, Backend backend) {
92 log.debug("deletedCollection");
93 BackendListener l = getListener();
94 if (l != null) {
95 l.deletedCollection(identifier, backend);
96 }
97 }
98
99 @Override
100 public void changedCollectionAttribute(
101 String identifier,
102 Document document,
103 Backend backend
104 ) {
105 log.debug("changedCollectionAttribute");
106 BackendListener l = getListener();
107 if (l != null) {
108 changedCollectionAttribute(identifier, document, backend);
109 }
110 }
111
112 @Override
113 public void changedCollectionItemAttribute(
114 String collectionId,
115 String artifactId,
116 Document document,
117 Backend backend
118 ) {
119 log.debug("changedCollectionItemAttribute");
120 BackendListener l = getListener();
121 if (l != null) {
122 l.changedCollectionItemAttribute(
123 collectionId, artifactId, document, backend);
124 }
125 }
126
127 @Override
128 public void addedArtifactToCollection(
129 String artifactId,
130 String collectionId,
131 Backend backend
132 ) {
133 log.debug("addedArtifactToCollection");
134 BackendListener l = getListener();
135 if (l != null) {
136 l.addedArtifactToCollection(
137 artifactId, collectionId, backend);
138 }
139 }
140
141 @Override
142 public void removedArtifactFromCollection(
143 String artifactId,
144 String collectionId,
145 Backend backend
146 ) {
147 log.debug("removedArtifactFromCollection");
148 BackendListener l = getListener();
149 if (l != null) {
150 l.removedArtifactFromCollection(
151 artifactId, collectionId, backend);
152 }
153 }
154
155 @Override
156 public void setCollectionName(
157 String collectionId,
158 String name
159 ) {
160 log.debug("setCollectionName");
161 BackendListener l = getListener();
162 if (l != null) {
163 l.setCollectionName(collectionId, name);
164 }
165 }
166 }
167 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org