com.ibm.workplace.wcm.api.extensions.syndication
Class ChangeMapper<T>

java.lang.Object
  extended by com.ibm.workplace.wcm.api.extensions.syndication.ChangeMapper<T>
Type Parameters:
T - type you want to map changes to, if you do not want to map to anything you can use any type (such as Object and return null

public abstract class ChangeMapper<T>
extends java.lang.Object

ChangeMapper is provided in the API to be used in conjunction with SyndicationSummary.getChanges() from the SyndicatorCompleting and SubscriberCompleting extension points. It provides a convenient way to handle the different change types.


Here is a simple example that attempts to process all changes and handle just the changes related to moved items:

  
  for(Change change : syndicationSummary.getChanges())
      {
         change.map(new ChangeMapper()
         {
            public Object map(Added added)
            {
               //ignore
               return null;
            }

            public Object map(Updated updated)
            {
               //ignore
               return null;
            }

            public Object map(Moved moved)
            {
               String oldPath = moved.getPreviousNamePath();
               String newPath = moved.getNamePath();
               notifyServiceItemMoved(oldPath, newPath, moved.getId());
               return null;
            }

            public Object map(Removed removed)
            {
               //ignore
               return null;
            }

            public Object map(ProjectAdded added)
            {
               //ignore
               return null;
            }

            public Object map(ProjectUpdated updated)
            {
               //ignore
               return null;
            }

            public Object map(ProjectRemoved removed)
            {
               //ignore
               return null;
            }

            public Object map(LibraryAdded added)
            {
               //ignore
               return null;
            }

            public Object map(LibraryUpdated updated)
            {
               //ignore
               return null;
            }

            public Object map(LibraryRenamed renamed)
            {
               //ignore
               return null;
            }
         });
      }
  
  

Since:
8.0.0.1 CF14

Constructor Summary
ChangeMapper()
           
 
Method Summary
abstract  T map(Added added)
          Handle an Added item change
abstract  T map(LibraryAdded added)
          Handle Library added change
abstract  T map(LibraryRenamed renamed)
          Handle Library renamed change
abstract  T map(LibraryUpdated updated)
          Handle Library updated change
abstract  T map(Moved moved)
          Handle a Moved item change
abstract  T map(ProjectAdded added)
          Handle a Project added change
abstract  T map(ProjectRemoved removed)
          Handle a Project removed change
abstract  T map(ProjectUpdated updated)
          Handle a Project updated change
abstract  T map(Removed removed)
          Handle a Removed item change
abstract  T map(Updated updated)
          Handle an Updated item change
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChangeMapper

public ChangeMapper()
Method Detail

map

public abstract T map(Added added)
Handle an Added item change

Parameters:
the - added change info
Returns:
map to the change into an item type T or return null

map

public abstract T map(Updated updated)
Handle an Updated item change

Parameters:
the - updated change info
Returns:
map to the change into an item type T or return null

map

public abstract T map(Moved moved)
Handle a Moved item change

Parameters:
the - moved change info
Returns:
map to the change into an item type T or return null

map

public abstract T map(Removed removed)
Handle a Removed item change

Parameters:
the - removed change info
Returns:
map to the change into an item type T or return null

map

public abstract T map(ProjectAdded added)
Handle a Project added change

Parameters:
the - project added change info
Returns:
map to the change into an item type T or return null

map

public abstract T map(ProjectUpdated updated)
Handle a Project updated change

Parameters:
the - project updated info
Returns:
map to the change into an item type T or return null

map

public abstract T map(ProjectRemoved removed)
Handle a Project removed change

Parameters:
the - removed change info
Returns:
map to the change into an item type T or return null

map

public abstract T map(LibraryAdded added)
Handle Library added change

Parameters:
the - library added change info
Returns:
map to the change into an item type T or return null

map

public abstract T map(LibraryUpdated updated)
Handle Library updated change

Parameters:
the - library updated change info
Returns:
map to the change into an item type T or return null

map

public abstract T map(LibraryRenamed renamed)
Handle Library renamed change

Parameters:
the - library renamed change info
Returns:
map to the change into an item type T or return null