1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.scheduler;
16  
17  import com.liferay.portal.kernel.util.StringBundler;
18  
19  import java.util.Date;
20  
21  /**
22   * <a href="IntervalTrigger.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Shuyang Zhou
25   */
26  public class IntervalTrigger extends BaseTrigger {
27  
28      public IntervalTrigger(
29          String jobName, String groupName, Date startDate, Date endDate,
30          long interval) {
31  
32          super(jobName, groupName, TriggerType.SIMPLE, startDate, endDate);
33  
34          _interval = interval;
35      }
36  
37      public IntervalTrigger(
38          String jobName, String groupName, Date startDate, long interval) {
39  
40          this(jobName, groupName, startDate, null, interval);
41      }
42  
43      public IntervalTrigger(String jobName, String groupName, long interval) {
44          this(jobName, groupName, new Date(), null, interval);
45      }
46  
47      public Long getTriggerContent() {
48          return _interval;
49      }
50  
51      public String toString() {
52          StringBundler sb = new StringBundler(5);
53  
54          sb.append("{interval=");
55          sb.append(_interval);
56          sb.append(", ");
57          sb.append(super.toString());
58          sb.append("}");
59  
60          return sb.toString();
61      }
62  
63      private Long _interval;
64  
65  }