OIM Code Update Job Info Using LookupSchedulerTask API


  1. package com.oimacademy.scheduler;
  2. import com.oimacademy.connection.Platform;
  3. import java.util.logging.Level;
  4. import java.util.logging.Logger;
  5. import oracle.iam.scheduler.api.SchedulerService;
  6. import oracle.iam.scheduler.exception.IncorrectScheduleTaskDefinationException;
  7. import oracle.iam.scheduler.exception.LastModifyDateNotSetException;
  8. import oracle.iam.scheduler.exception.ParameterValueTypeNotSupportedException;
  9. import oracle.iam.scheduler.exception.RequiredParameterNotSetException;
  10. import oracle.iam.scheduler.exception.SchedulerAccessDeniedException;
  11. import oracle.iam.scheduler.exception.SchedulerException;
  12. import oracle.iam.scheduler.impl.util.SchedulerUtil;
  13. import oracle.iam.scheduler.vo.JobDetails;
  14. import oracle.iam.scheduler.vo.ScheduledTask;
  15. /** *
  16.  * */
  17. public class LookupSchedulerTask {
  18.     private static SchedulerService schedulerService  = Platform.getService(SchedulerService.class);    
  19.      public void updateJob(JobDetails job)
  20.                   throws SchedulerException, RequiredParameterNotSetException,
  21.                          ParameterValueTypeNotSupportedException,
  22.                          IncorrectScheduleTaskDefinationException,
  23.                          LastModifyDateNotSetException,
  24.                          SchedulerAccessDeniedException {         
  25.          schedulerService.updateJob(job);         
  26.      }
  27.     public static void main(String[] args) throws IncorrectScheduleTaskDefinationException{        
  28.          try {
  29.              JobDetails[] job =schedulerService.getJobsOfSchedulerTask("LDAP Role Membership Reconciliation");
  30.              new LookupSchedulerTask().updateJob(job[0]);             
  31.          } catch (SchedulerException ex) {
  32.              Logger.getLogger(LookupSchedulerTask.class.getName()).log(Level.SEVERE, null, ex);
  33.          } catch (RequiredParameterNotSetException ex) {
  34.              Logger.getLogger(LookupSchedulerTask.class.getName()).log(Level.SEVERE, null, ex);
  35.          } catch (ParameterValueTypeNotSupportedException ex) {
  36.              Logger.getLogger(LookupSchedulerTask.class.getName()).log(Level.SEVERE, null, ex);
  37.          } catch (LastModifyDateNotSetException ex) {
  38.              Logger.getLogger(LookupSchedulerTask.class.getName()).log(Level.SEVERE, null, ex);
  39.          } catch (SchedulerAccessDeniedException ex) {
  40.              Logger.getLogger(LookupSchedulerTask.class.getName()).log(Level.SEVERE, null, ex);
  41.          }
  42.     }
  43. }

No comments:

Post a Comment