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 CronTrigger extends BaseTrigger {
025    
026            public CronTrigger(
027                    String jobName, String groupName, Date startDate, Date endDate,
028                    String cronText) {
029    
030                    super(jobName, groupName, TriggerType.CRON, startDate, endDate);
031    
032                    _cronText = cronText;
033            }
034    
035            public CronTrigger(
036                    String jobName, String groupName, Date startDate, String cronText) {
037    
038                    this(jobName, groupName, startDate, null, cronText);
039            }
040    
041            public CronTrigger(String jobName, String groupName, String cronText) {
042                    this(jobName, groupName, null, null, cronText);
043            }
044    
045            @Override
046            public String getTriggerContent() {
047                    return _cronText;
048            }
049    
050            @Override
051            public String toString() {
052                    StringBundler sb = new StringBundler(5);
053    
054                    sb.append("{cronText=");
055                    sb.append(_cronText);
056                    sb.append(", ");
057                    sb.append(super.toString());
058                    sb.append("}");
059    
060                    return sb.toString();
061            }
062    
063            private String _cronText;
064    
065    }