001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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    }