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