001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.scheduler;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    
019    import java.util.Date;
020    
021    /**
022     * @author Shuyang Zhou
023     */
024    public class IntervalTrigger extends BaseTrigger {
025    
026            public IntervalTrigger(
027                    String jobName, String groupName, Date startDate, Date endDate,
028                    long interval) {
029    
030                    super(jobName, groupName, TriggerType.SIMPLE, startDate, endDate);
031    
032                    _interval = interval;
033            }
034    
035            public IntervalTrigger(
036                    String jobName, String groupName, Date startDate, long interval) {
037    
038                    this(jobName, groupName, startDate, null, interval);
039            }
040    
041            public IntervalTrigger(String jobName, String groupName, long interval) {
042                    this(jobName, groupName, new Date(), null, interval);
043            }
044    
045            public Long getTriggerContent() {
046                    return _interval;
047            }
048    
049            public String toString() {
050                    StringBundler sb = new StringBundler(5);
051    
052                    sb.append("{interval=");
053                    sb.append(_interval);
054                    sb.append(", ");
055                    sb.append(super.toString());
056                    sb.append("}");
057    
058                    return sb.toString();
059            }
060    
061            private Long _interval;
062    
063    }