how to add TaskScheduler to a user to be run in future.

notice the Once value in the TSC.schedule function which state the job to run once. the default is Monthly.






              {

                        

                         Date now = new  Date();

                           Calendar cal = Calendar.getInstance();

                           cal.setTime(now);

                           cal.add(Calendar.HOUR,1);               

                           Date executionDate = cal.getTime();                         

                     try

                     {

                           if(goodDay)

                           {

                                  //indicator file still not created 

                                  //run this task in 1 hour                      

                         TaskScheduler TSC = new TaskScheduler(context);

                         TSC.schedule(td,"Schedule for - " + td.getName() +" - "+ executionDate.toString(),"Try to find indicator","spadmin","Once",executionDate,false);                          

                           }                            

                     }

                     catch(Exception e)

                     {

                             log.error("CHECK INDICATOR - Failed with " + e.getMessage());                                     

                     }

                     throw new Exception("Indicator File not found - Forcing stop - check again in " + executionDate);

              }