Mercurial > dive4elements > river
view 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 |
line wrap: on
line source
package de.intevation.flys.artifacts.datacage; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactCollection; import de.intevation.artifacts.GlobalContext; import de.intevation.artifacts.User; import de.intevation.artifactdatabase.BackendListener; import de.intevation.artifactdatabase.Backend; import org.apache.log4j.Logger; import org.w3c.dom.Document; public class DatacageBackendListener implements BackendListener { private static Logger log = Logger.getLogger(DatacageBackendListener.class); protected GlobalContext context; public DatacageBackendListener() { } protected BackendListener getListener() { Object listener = context.get(Datacage.DATACAGE_KEY); return listener instanceof BackendListener ? (BackendListener)listener : null; } @Override public void setup(GlobalContext context) { this.context = context; BackendListener l = getListener(); if (l != null) { l.setup(context); } } @Override public void createdArtifact(Artifact artifact, Backend backend) { log.debug("createdArtifact"); BackendListener l = getListener(); if (l != null) { l.createdArtifact(artifact, backend); } } @Override public void storedArtifact(Artifact artifact, Backend backend) { log.debug("storedArtifact"); BackendListener l = getListener(); if (l != null) { l.storedArtifact(artifact, backend); } } @Override public void createdUser(User user, Backend backend) { log.debug("createdUser"); BackendListener l = getListener(); if (l != null) { l.createdUser(user, backend); } } @Override public void deletedUser(String identifier, Backend backend) { log.debug("deletedUser"); BackendListener l = getListener(); if (l != null) { l.deletedUser(identifier, backend); } } @Override public void createdCollection( ArtifactCollection collection, Backend backend ) { log.debug("createdCollection"); BackendListener l = getListener(); if (l != null) { l.createdCollection(collection, backend); } } @Override public void deletedCollection(String identifier, Backend backend) { log.debug("deletedCollection"); BackendListener l = getListener(); if (l != null) { l.deletedCollection(identifier, backend); } } @Override public void changedCollectionAttribute( String identifier, Document document, Backend backend ) { log.debug("changedCollectionAttribute"); BackendListener l = getListener(); if (l != null) { changedCollectionAttribute(identifier, document, backend); } } @Override public void changedCollectionItemAttribute( String collectionId, String artifactId, Document document, Backend backend ) { log.debug("changedCollectionItemAttribute"); BackendListener l = getListener(); if (l != null) { l.changedCollectionItemAttribute( collectionId, artifactId, document, backend); } } @Override public void addedArtifactToCollection( String artifactId, String collectionId, Backend backend ) { log.debug("addedArtifactToCollection"); BackendListener l = getListener(); if (l != null) { l.addedArtifactToCollection( artifactId, collectionId, backend); } } @Override public void removedArtifactFromCollection( String artifactId, String collectionId, Backend backend ) { log.debug("removedArtifactFromCollection"); BackendListener l = getListener(); if (l != null) { l.removedArtifactFromCollection( artifactId, collectionId, backend); } } @Override public void setCollectionName( String collectionId, String name ) { log.debug("setCollectionName"); BackendListener l = getListener(); if (l != null) { l.setCollectionName(collectionId, name); } } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :