Creating Deadlines and Durations

Use

Whenever you need to specify a processing time for a notification instance, you create a deadline. It can be:

  • An exact date set in time (
    DEADLINE_ABSOLUTE_POINT
    )
  • Duration related to some starting point:
    • DEADLINE_FROM_ACTION_START
      - a duration related to action start
    • DEADLINE_FROM_PROCESS_START
      - a duration related to process start

Prerequisites

Procedure

Creating an Absolute Deadline

For this type of deadline, you need to specify an exact deadline date. You should not provide duration:

importcom.sap.caf.eu.gp.process.rt.notification.api.GPNotificationFactory;
importcom.sap.caf.eu.gp.process.api.IGPDeadline;
 
//Create a deadline in one hour
IGPDeadlinedeadline = GPNotificationFactory.createDeadline(
                                      IGPDeadline.DEADLINE_ABSOLUTE_POINT,
                                      null,
                                      0,
                                      System.currentTimeMillis()
                                             + 10*1000*60*60
                                    );

Creating a Deadline with Duration

  1. For this type of deadline, you have to create duration first. You specify the duration type and time period:

importcom.sap.caf.eu.gp.process.rt.notification.api.GPNotificationFactory;
importcom.sap.caf.eu.gp.process.api.IGPDuration;
 
// create a duration of one hour
IGPDurationduration = GPNotificationFactory.createDuration(
                                          1,
                                          IGPDuration.DURATION_HOUR
                                        );

You can choose from the following duration types:

  • DURATION_MINUTE
  • DURATION_HOUR
  • DURATION_DAY
  • DURATION_WEEK
  • DURATION_MONTH
  • DURATION_YEAR
  1. Use the duration created above to create a deadline.

    This time, specify duration and a start date from which the deadline can be calculated:

importcom.sap.caf.eu.gp.process.api.IGPDeadline;
 
// create a deadline with duration one hour (start date is current system time)
IGPDeadlinedeadline2 = GPNotificationFactory.createDeadline(
                                      IGPDeadline.DEADLINE_FROM_PROCESS_START,
                                      duration,
                                      System.currentTimeMillis(),
                                      0
                                    );

Result

You may use the deadlines you have created to update the processing time information of notification instances. For more information, see Updating Notification Processing Time and Status .