Package com.jalios.jcms
Class PublicationListener
- java.lang.Object
-
- com.jalios.jcms.BasicStoreListener
-
- com.jalios.jcms.PublicationListener
-
- All Implemented Interfaces:
PluginComponent
,StoreListener
public class PublicationListener extends BasicStoreListener
This class listens to mutations ofPublication
objects.- Version:
- $Revision: 109428 $
- Author:
- Olivier Dedieu
- See Also:
Publication
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
REVISION
protected java.util.HashMap<java.lang.String,java.util.HashSet<Publication>>
titleToPubSetMap
-
Constructor Summary
Constructors Constructor Description PublicationListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.HashSet<Publication>
getPublicationSetFromTitle(java.lang.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
updateAuthGroupSet(Publication pub, boolean add)
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
-
-
-
-
Field Detail
-
REVISION
public static final java.lang.String REVISION
- See Also:
- Constant Field Values
-
titleToPubSetMap
protected java.util.HashMap<java.lang.String,java.util.HashSet<Publication>> titleToPubSetMap
-
-
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 interfaceStoreListener
- Overrides:
handleCreate
in classBasicStoreListener
- Parameters:
storable
- the storablefirstTime
- 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 interfaceStoreListener
- Overrides:
handleCommitUpdate
in classBasicStoreListener
- 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 interfaceStoreListener
- Overrides:
handleDelete
in classBasicStoreListener
- Parameters:
storable
- the storablefirstTime
- 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)
-
updateAuthGroupSet
protected void updateAuthGroupSet(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 forindexedPub
- the publication to add or to remove to the indexadd
- 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 java.util.HashSet<Publication> getPublicationSetFromTitle(java.lang.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
-
-