c2g.CronSpecglobal class CronSpec this class is used to represent a cron expression. Read http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm and http://en.wikipedia.org/wiki/Cron. New crons can be generated from scratch, or can be generated from a given cron string. Each cron will be of a given type, known as a frequency type, e.g Hourly, daily, weekly. Methods
createHourlyCronglobal static c2g.CronSpec createHourlyCron(String interval, String offset) Create a c2g.CronSpec with an hourly schedule. Input Parameters
Return ValueThis method returns a CronSpec object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. c2g.CronSpec theCronSpec = c2g.CronSpec.createHourlyCron('2', '15'); createDailyCronglobal static c2g.CronSpec createDailyCron(String hour) Create a c2g.CronSpec with a daily schedule. Input Parameters
Return ValueThis method returns a CronSpec object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. c2g.CronSpec theCronSpec = c2g.CronSpec.createDailyCron('0'); createWeeklyCronglobal static c2g.CronSpec createWeeklyCron(String hour, String[] weekDays) Create a c2g.CronSpec with a weekly schedule. Input Parameters
Return ValueThis method returns a CronSpec object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. c2g.CronSpec theCronSpec = c2g.CronSpec.createWeeklyCron('0', new String[]{'1','3','5','7'}); createMonthlyByDayOfTheMonthCronglobal static c2g.CronSpec createMonthlyByDayOfTheMonthCron(String hour, String monthDay) Create a c2g.CronSpec with a monthly schedule via a specific day of the month. Input Parameters
Return ValueThis method returns a CronSpec object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. c2g.CronSpec theCronSpec = c2g.CronSpec.createMonthlyByDayOfTheMonthCron('0', '1'); createMonthlyByDayOfTheWeekCronglobal static c2g.CronSpec createMonthlyByDayOfTheWeekCron(String hour, String dayOccurrence, String weekday) Create a c2g.CronSpec with a monthly schedule via a specific week day. Input Parameters
Return ValueThis method returns a CronSpec object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. CronSpec theCronSpec = CronSpec.createMonthlyByDayOfTheWeekCron('0', '1', '1'); createByDateglobal static c2g.CronSpec createByDate(String seconds, String minutes, String hour, String monthDay, String month, String year) Create a c2g.CronSpec to schedule on a specific date. Input Parameters
Return ValueThis method returns a CronSpec object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. c2g.CronSpec theCronSpec = c2g.CronSpec.createByDate('0', '59', '7', '31', '12', '2014'); createByDateglobal static c2g.CronSpec createByDate(String seconds, String minutes, String hour, Date theDate) Create a c2g.CronSpec to schedule on a specific date. Input Parameters
Return ValueThis method returns a CronSpec object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. c2g.CronSpec theCronSpec = c2g.CronSpec.createByDate('0', '59', '4', Date.newInstance(2014, 12, 31)); createByDateglobal static c2g.CronSpec createByDate(Datetime theDate) Create a c2g.CronSpec to schedule on a specific date. Input Parameters
Return ValueThis method returns a CronSpec object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. c2g.CronSpec theCronSpec = c2g.CronSpec.createByDate(Datetime.newInstance(2014, 12, 31, 4, 59, 0)); parseglobal static c2g.CronSpec parse(String cronString) Parse the given cron string into a c2g.CronSpec Input Parameters
Return ValueThis method returns a CronSpec object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. c2g.CronSpec theCronSpec = c2g.CronSpec.parse('0 15 */2 * * ?'); |