Class AddReccurrentProperty
- java.lang.Object
-
- org.xwiki.contrib.moccacalendar.migrations.AddReccurrentProperty
-
- All Implemented Interfaces:
org.xwiki.observation.EventListener
@Named("org.xwiki.contrib.moccacalendar.migrations.AddReccurrentProperty") @Singleton @Component(roles={AddReccurrentProperty.class,org.xwiki.observation.EventListener.class}) public class AddReccurrentProperty extends Object implements org.xwiki.observation.EventListenerMigration helper which adds a value of zero to the recurrent property of events.- Since:
- 2.7
- Version:
- $Id: $
-
-
Constructor Summary
Constructors Constructor Description AddReccurrentProperty()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddRecurrentPropertyToEvents(int offset, int limit)Migrate a number of events as given by the parameters.longcountAllEvents()helper to find out if events are unmigrated.longcountMigratedEvents()helper to find out if events are unmigrated.List<org.xwiki.observation.event.Event>getEvents()StringgetName()voidonEvent(org.xwiki.observation.event.Event event, Object source, Object data)
-
-
-
Method Detail
-
getEvents
public List<org.xwiki.observation.event.Event> getEvents()
- Specified by:
getEventsin interfaceorg.xwiki.observation.EventListener
-
getName
public String getName()
- Specified by:
getNamein interfaceorg.xwiki.observation.EventListener
-
onEvent
public void onEvent(org.xwiki.observation.event.Event event, Object source, Object data)- Specified by:
onEventin interfaceorg.xwiki.observation.EventListener
-
countAllEvents
public long countAllEvents() throws org.xwiki.query.QueryExceptionhelper to find out if events are unmigrated.- Returns:
- the number of all events
- Throws:
org.xwiki.query.QueryException- if the query fails
-
countMigratedEvents
public long countMigratedEvents() throws org.xwiki.query.QueryExceptionhelper to find out if events are unmigrated.- Returns:
- the number of all migrated events
- Throws:
org.xwiki.query.QueryException- if the query fails
-
addRecurrentPropertyToEvents
public int addRecurrentPropertyToEvents(int offset, int limit) throws org.xwiki.query.QueryException, com.xpn.xwiki.XWikiExceptionMigrate a number of events as given by the parameters. Actually first loads each event and checks if it already has a "recurrent" property; if not, then adds it with a value of 0.- Parameters:
offset- where it start the migrationlimit- the maximal number of events- Returns:
- the number of events checked
- Throws:
org.xwiki.query.QueryException- if fetching the events failedcom.xpn.xwiki.XWikiException- if migration on of the events failed
-
-