001    /**
002     * Copyright (c) 2000-2013 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, null, null, interval);
043            }
044    
045            @Override
046            public Long getTriggerContent() {
047                    return _interval;
048            }
049    
050            @Override
051            public String toString() {
052                    StringBundler sb = new StringBundler(5);
053    
054                    sb.append("{interval=");
055                    sb.append(_interval);
056                    sb.append(", ");
057                    sb.append(super.toString());
058                    sb.append("}");
059    
060                    return sb.toString();
061            }
062    
063            private Long _interval;
064    
065    }