Class 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: $
    • Constructor Detail

      • AddReccurrentProperty

        public AddReccurrentProperty()
    • Method Detail

      • getEvents

        public List<org.xwiki.observation.event.Event> getEvents()
        Specified by:
        getEvents in interface org.xwiki.observation.EventListener
      • getName

        public String getName()
        Specified by:
        getName in interface org.xwiki.observation.EventListener
      • onEvent

        public void onEvent​(org.xwiki.observation.event.Event event,
                            Object source,
                            Object data)
        Specified by:
        onEvent in interface org.xwiki.observation.EventListener
      • countAllEvents

        public long countAllEvents()
                            throws org.xwiki.query.QueryException
        helper 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.QueryException
        helper 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 migration
        limit - the maximal number of events
        Returns:
        the number of events checked
        Throws:
        org.xwiki.query.QueryException - if fetching the events failed
        com.xpn.xwiki.XWikiException - if migration on of the events failed