Thursday 11 May 2017

Update OIM 11gR2 PS3 Schedule job parameter programatically using API.

We can update OIM schedule job parameter programmatically using available APIs. Here is the code sample.




 public void updateSchedulerParam(String jobName, String paramName, String newValue){
 
  SchedulerService schdulerService = (SchedulerService)oimClientObj.getService(SchedulerService.class);
 
  try {
  
   JobDetails jobDetails = schdulerService.getJobDetail(jobName);
   HashMap<String, JobParameter> schParam = jobDetails.getParams();
  
   for (Entry<String, JobParameter> entry : schParam.entrySet()) {
      
    String key = entry.getKey();
       JobParameter jobParam = entry.getValue();
       Serializable value = jobParam.getValue();
             
       System.out.println("Old key value pair: "+key+" = "+ value);
      
       if (key.equalsIgnoreCase(paramName)){
        value = newValue;
        System.out.println(value.toString());
        jobParam.setValue(value);
      
        System.out.println(jobParam.getValue());
        schParam.put(key, jobParam);
        break;
       }
   }
   jobDetails.setParams(schParam);
   schdulerService.updateJob(jobDetails);
   System.out.println("Updated successfully");
  
 } catch (Exception e) {
    e.printStackTrace();
 }
 }

No comments:

Post a Comment

Followers

OIM API for adding process task and retry failed task

 In this blog you can find how to add new process task and retry any failed/rejected tasks using API. Adding new process task: /************...