Saturday, 31 March 2018

OIM API - Code Snippet to get Scheduled Job Parameter Value for the given Parameter Name.

public String getScheduledJobParameter(String jobName, String paramName){
    final String logp = CN + " :: getScheduleJobParameter - ";
    LOGGER.debug(logp + "START");
   
    SchedulerService schedulerService = null;
    String value = "";

    try{
        //get scheduler service
        schedulerService = Platform.getService(SchedulerService.class);
       
        JobDetails jbDetails = schedulerService.getJobDetail(jobName);

        value = (String)jbDetails.getParams().get(paramName).getValue();
       
        LOGGER.info(logp + "Successfully obtained parameter value <" + value + ">" + "for job parameter <" + paramName + ">");
       
    } catch(Exception e){
        LOGGER.error(logp + "Exceptioin occurred while reading job parameter - " + paramName + " for job - " + jobName);
    }

    LOGGER.debug(logp + "END");
    return value;
}


Happy Learning!!!

1 comment:

  1. I have to get the parameter value for the past run. Say 7 days back when the scheduler was executed, what was the value of a particular parameter.

    ReplyDelete