Ejemplo n.º 1
0
  public void doJob() {
    try {

      // cache the actual connected account
      User actual = User.findByName(userName);
      User clone = (User) actual.clone();

      // reset database
      Fixtures.deleteDatabase();
      Fixtures.loadModels("initial-data.yml");

      // persist the cached account
      clone.save();

      // update channel lists
      List<Channel> channels = Channel.findAll();
      for (Channel channel : channels) {

        // remove the actual and next game
        channel.game = null;
        channel.next = null;
        channel.save();

        // create an event stream
        if (ChannelList.instance.getStream(channel.number) == null) {
          ChannelList.instance.addStream(channel);
        }
      }
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }