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;
}

No comments:

Post a Comment