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.EventListener
Migration helper which adds a value of zero to the recurrent property of events.
- Since:
- 2.7
- Version:
- $Id: $
-
Field Summary
Fields inherited from interface org.xwiki.observation.EventListener
CACHE_INVALIDATION_DEFAULT_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintaddRecurrentPropertyToEvents(int offset, int limit) Migrate a number of events as given by the parameters.longhelper to find out if events are unmigrated.longhelper to find out if events are unmigrated.List<org.xwiki.observation.event.Event>getName()void
-
Constructor Details
-
AddReccurrentProperty
public AddReccurrentProperty()
-
-
Method Details
-
getEvents
- Specified by:
getEventsin interfaceorg.xwiki.observation.EventListener
-
getName
- Specified by:
getNamein interfaceorg.xwiki.observation.EventListener
-
onEvent
- 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.XWikiException Migrate 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
-