Bulk Provisioning Entitlements Via Reconciliation process for DBUM Connector.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.massiveGaze.reconciliation;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import oracle.iam.reconciliation.api.ChangeType;
import oracle.iam.reconciliation.api.EventAttributes;
import oracle.iam.reconciliation.api.ReconOperationsService;
import com.massiveGaze.connection.DataSource;
import com.massiveGaze.connection.Platform;
public class BulkProvisioningEntitlementsViaReconciliation {
     
    public static void main(String[] args) {
           try {
               List list =getLookupCodes("1629");
                ReconOperationsService recService = Platform.getService(ReconOperationsService.class);
                //Add Object Reconciliation Fields for resource Object. No Childern fields.
                    Map<String, Object> mapKeyValue = new HashMap<String,Object>();    
                    //For Dummy Connector
    /*                mapKeyValue.put("USR_LOGIN","USER"+i);
                    mapKeyValue.put("ACCOUNT_NAME","USER Account");
                    mapKeyValue.put("IT Resource","dummyITResName");     */     
                   
                    //For DBUM Connector  // You can get below details from Design Console -> Connector Resource Object.
                    // Need to add all mandatory attributes as defined in Connector Resource Object
                    mapKeyValue.put("IT Resource Name","Oracle DB"); // IT Resource Name
                    mapKeyValue.put("User Name","TUSER"); // To Which user need to provision entitlements         
                    mapKeyValue.put("Password","Welcome1");
                    mapKeyValue.put("Authentication Type","PASSWORD");
                    mapKeyValue.put("Account Status","OPEN");
                    mapKeyValue.put("Reference ID","TUSER");
                   
                    //Create Even Attribute and call createReconciliationEvent
                    EventAttributes eventAttr = new EventAttributes();
                    eventAttr.setEventFinished(false); 
                    eventAttr.setChangeType(ChangeType.CHANGELOG);
                    //long reconEventKey = recService.createReconciliationEvent("dummy", mapKeyValue,eventAttr);
                   long reconEventKey = recService.createReconciliationEvent("Oracle DB User", mapKeyValue,eventAttr);
                    System.out.println("Recon Event ID -> "+reconEventKey);
                    /*********Creating Data set Up for Child Forms *******************************/
                  
                
           //Create multi valued AttributeData for Child Forms
                    Map<String,Object> mapChldKeyValue = null; 
                   
            //DBUM Connector                    
                  recService.providingAllMultiAttributeData(reconEventKey, "Privilege List",true);
                   //Add Child Form multi valued data                  
                   for(int j=0; j<list.size();j++){                   
                    mapChldKeyValue = new HashMap<String,Object>();
                    mapChldKeyValue.put("Privilege Name",list.get(j));
            // mapChldKeyValue.put("Privilege Name","4~CREATE PROFILE");
                    mapChldKeyValue.put("Privilege Admin Option",""); 
                    recService.addMultiAttributeData(reconEventKey,"Privilege List", mapChldKeyValue);
                    System.out.println(" Added into Recon Service with loop value -> "+j);
                   }                   
                    recService.finishReconciliationEvent(reconEventKey);
                    recService.processReconciliationEvent(reconEventKey);                   
                  
                    //processing event
                    System.out.println("Completed Recon Event Operation -> "+reconEventKey);
                   
                  }catch(Exception e){
                      e.printStackTrace();             
                  }
         
       }
    // Method to get Entitlements From LKV table. Need to pass LKU_KEY
    public static List getLookupCodes(String lkuKey){
        List list = new ArrayList();
        Connection con = DataSource.getConnection();
        try {
            Statement stmt = con.createStatement();
            String query ="select * from LKV where lku_key="+lkuKey;
            ResultSet rs = stmt.executeQuery(query);
            while (rs.next()) {
                list.add(rs.getString("lkv_encoded"));
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        System.out.println("Size"+ list.size());
        return list;
    }
    }

No comments:

Post a Comment

About OIM

Oracle Identity Management enables organizations to effectively manage the end - to - end life - cycle of user ide...

Popular Posts