Results 1 to 5 of 5

Thread: Scheduled task program in java

  1. #1
    Join Date
    Dec 2009
    Posts
    213

    Scheduled task program in java

    Hello,
    I try to schedule a task to a resource, I get the time and I would like to test this to confirm the date if it is not planning a weekend or holiday. And if it is holiday or weekend I plan the task automatically the next juridical day and not weekends. But this is not working for me, if you have any idea then please help me with this. Thanks in advance.

  2. #2
    Join Date
    Nov 2009
    Posts
    335

    Re: Scheduled task program in java

    Hello,
    For the weekend it is not hard look at the side of the Calendar class. From a date you can know the day of the week match. Regarding the holidays, java does not know as I know they are unique to each country => you'll need to create your list of holidays for yourself. The planning software "GanttProject" (programmed in Java and OpenSource) is exactly what you want (including also the report of the task following day worked) will then see how they coded their method of detecting the days of holidays. This is just an example software, you can try to do by your own.

  3. #3
    Join Date
    Nov 2009
    Posts
    583

    Re: Scheduled task program in java

    Hello,
    For me the easiest would be to make a method that would check the date well belong to one of the holidays.
    To this must distinguish two types of holidays:

    - The dates fixed as January 1, May 1, May 8, ... with which you can content yourself a test "hard".
    - The dates vary, as on Monday, Ascension and Whit Monday (if you consider holiday). These dates are all related to the dates, so it must calculated.

  4. #4
    Join Date
    Dec 2009
    Posts
    211

    Re: Scheduled task program in java

    Hello,
    Even I am trying to get a similar kind of a program. I'm stuck on this, and I can not find a soltuion for this now. Calculation of Easter Monday, Ascension Thursday and Pentecost Monday, it's easy to spot me and thank you in advance. For fixed public holidays, you think I created a new class, my table contains these days. I guess the code will go correct and I will be successful in the coding part. Still then if you have any suggestions then please do post back. Thank you.

  5. #5
    Join Date
    Nov 2009
    Posts
    333

    Re: Scheduled task program in java

    Hello,
    I have code with me, think this will help you. Just have a look at the following code
    Code:
     private static boolean isJourTravaille(Calendar p_date)
        {
            / / There is a list of holidays
            Final List <Calendar> cal = new ArrayList <Calendar> ();
            / / Fetch the holidays of the year of the date parameter
            Final Calendar calnd = (Calendar) p_date.clone();
            calnd.set(calnd.get(Calendar.YEAR), Calendar.JANUARY, 1);
            cal.add((Calendar) calnd.clone());
            calnd.set(calnd.get(Calendar.YEAR), Calendar.MAY, 1);
            cal.add((Calendar) calnd.clone());
            calnd.set(calnd.get(Calendar.YEAR), Calendar.MAY, 8);
            cal.add((Calendar) calnd.clone());
            calnd.set(calnd.get(Calendar.YEAR), Calendar.JULY, 14);
            cal.add((Calendar) calnd.clone());
            calnd.set(calnd.get(Calendar.YEAR), Calendar.AUGUST, 15);
            cal.add((Calendar) calnd.clone());
            calnd.set(calnd.get(Calendar.YEAR), Calendar.NOVEMBER, 1);
            cal.add((Calendar) calnd.clone());
            calnd.set(calnd.get(Calendar.YEAR), Calendar.NOVEMBER, 11);
            cal.add((Calendar) calnd.clone());
            calnd.set(calnd.get(Calendar.YEAR), Calendar.DECEMBER, 25);
            cal.add((Calendar) calnd.clone());
     
           }

Similar Threads

  1. Replies: 3
    Last Post: 17-01-2014, 10:37 AM
  2. Scheduled Task does not run
    By coreymac1222 in forum Windows XP Support
    Replies: 3
    Last Post: 06-03-2009, 02:06 AM
  3. Can't run scheduled task
    By alicorn2 in forum Windows Server Help
    Replies: 8
    Last Post: 22-04-2008, 05:07 AM
  4. How to run a scheduled task via a batch job
    By akkha1234@gmail.com in forum Windows Server Help
    Replies: 3
    Last Post: 18-05-2007, 06:35 PM
  5. Scheduled Task error code:The task completed with an exit code of
    By Teo Chee Yang in forum Windows Server Help
    Replies: 7
    Last Post: 26-02-2007, 06:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,563,077.81718 seconds with 16 queries