com.jalios.jcms
Class PublicationListener

java.lang.Object
  extended by com.jalios.jcms.BasicStoreListener
      extended by com.jalios.jcms.PublicationListener
All Implemented Interfaces:
PluginComponent, StoreListener

public class PublicationListener
extends BasicStoreListener

This class listens to mutations of Publication objects.

Version:
$Revision: 27753 $
Author:
Olivier Dedieu
See Also:
Publication

Field Summary
static String REVISION
           
protected  HashMap<String,HashSet<Publication>> titleToPubSetMap
           
 
Constructor Summary
PublicationListener()
           
 
Method Summary
 HashSet<Publication> getPublicationSetFromTitle(String title)
          Return a set of Publications matching the given title.
 void handleCommitUpdate(Storable storable, Storable oldStorable, boolean firstTime)
          This method gets called when after a storable has been updated.
 void handleCreate(Storable storable, boolean firstTime)
          This method gets called when a storable is created.
 void handleDelete(Storable storable, boolean firstTime)
          This method gets called when a storable is deleted.
protected  void removeFriendlyURLs(Publication pub)
           
protected  void removeWorkCopySet(Publication pub)
           
protected  void replacePublicationInTitlesIndex(Publication oldPub, Publication newPub)
          Method to update the title to publications index Map.
protected  void updateCategoryIndex(Publication pub, boolean isContent, boolean add)
           
protected  void updateFriendlyURLs(Publication pub)
           
protected  void updateMemberIndex(Publication pub, boolean isContent, boolean add)
           
protected  void updatePublicationTitlesIndex(Publication pub, Publication indexedPub, boolean add)
          Method to update the title to publications index Map.
protected  void updateWorkCopySet(Publication pub)
           
 void updateWorkspaceIndex(Publication pub, boolean add)
           
 
Methods inherited from class com.jalios.jcms.BasicStoreListener
handlePrepareUpdate, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

titleToPubSetMap

protected HashMap<String,HashSet<Publication>> titleToPubSetMap
Constructor Detail

PublicationListener

public PublicationListener()
Method Detail

handleCreate

public void handleCreate(Storable storable,
                         boolean firstTime)
Description copied from interface: StoreListener
This method gets called when a storable is created.

Specified by:
handleCreate in interface StoreListener
Overrides:
handleCreate in class BasicStoreListener
Parameters:
storable - the storable
firstTime - true if it is the first time this operation is processed
See Also:
StoreListener.handleCreate(Storable, boolean)

handleCommitUpdate

public void handleCommitUpdate(Storable storable,
                               Storable oldStorable,
                               boolean firstTime)
Description copied from interface: StoreListener
This method gets called when after a storable has been updated.

Specified by:
handleCommitUpdate in interface StoreListener
Overrides:
handleCommitUpdate in class BasicStoreListener
Parameters:
storable - the storable, this instance is the object that was created at first and that will be stored in jcms until deletion of the storable with this ID. You should always manipulate this object if you maintain any index.
oldStorable - the previous version of the storable, it is a clone, do not use in any index, it should only be used to access old values.
firstTime - true if it is the first time this operation is processed
See Also:
StoreListener.handleCommitUpdate(Storable, Storable, boolean)

handleDelete

public void handleDelete(Storable storable,
                         boolean firstTime)
Description copied from interface: StoreListener
This method gets called when a storable is deleted.

Specified by:
handleDelete in interface StoreListener
Overrides:
handleDelete in class BasicStoreListener
Parameters:
storable - the storable
firstTime - true if it is the first time this operation is processed
See Also:
StoreListener.handleDelete(Storable, boolean)

updateMemberIndex

protected void updateMemberIndex(Publication pub,
                                 boolean isContent,
                                 boolean add)

updateCategoryIndex

protected void updateCategoryIndex(Publication pub,
                                   boolean isContent,
                                   boolean add)

updateWorkspaceIndex

public void updateWorkspaceIndex(Publication pub,
                                 boolean add)

updateFriendlyURLs

protected void updateFriendlyURLs(Publication pub)

removeFriendlyURLs

protected void removeFriendlyURLs(Publication pub)

updateWorkCopySet

protected void updateWorkCopySet(Publication pub)

removeWorkCopySet

protected void removeWorkCopySet(Publication pub)

updatePublicationTitlesIndex

protected void updatePublicationTitlesIndex(Publication pub,
                                            Publication indexedPub,
                                            boolean add)
Method to update the title to publications index Map. To be called on handleCreate and handleDelete.
Important Note: pub and indexedPub are always the same for create and delete operations. But when doing an update operation, first we want to remove the old version (which is a clone) and then we want to add the original but updated one, therefore: first: pub is the oldStorable (in which we look for the information to remove from index), indexedPub is the object to add or remove from the index, which is always the same object during the life of JCMS, that is the first created, storable. second: as for a create operation pub and indexedPub are the same (the storable).

Parameters:
pub - the publication in which to look for
indexedPub - the publication to add or to remove to the index
add - whether to add (create) or to remove (delete) the publication from the index
Since:
jcms-5.5.0

replacePublicationInTitlesIndex

protected void replacePublicationInTitlesIndex(Publication oldPub,
                                               Publication newPub)
Method to update the title to publications index Map. To be called on handleCreate and handleDelete.

Parameters:
oldPub - the publication as it was before the update (its title will be removed)
newPub - the publication as it is now (its title will be added)
Since:
jcms-5.5.0

getPublicationSetFromTitle

public HashSet<Publication> getPublicationSetFromTitle(String title)
Return a set of Publications matching the given title.

Parameters:
title - the title of the publications to find.
Returns:
a new instance of HashSet containing Publication
Since:
jcms-5.5.0


Copyright © 2001-2010 Jalios SA. All Rights Reserved.