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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | package com.massiveGaze.orchestration; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.Serializable; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; import java.util.Set; import oracle.iam.platform.context.ContextAwareNumber; import oracle.iam.platform.context.ContextAwareString; import oracle.iam.platform.kernel.vo.EntityOrchestration; import oracle.iam.platform.kernel.vo.Orchestration; import oracle.iam.platform.kernel.vo.PostProcessOnlyBulkOrchestration; import com.massiveGaze.connection.DataSource; public class DeserializeOrchestration { public static void main(String[] args) throws Exception { String statement1 = "select * from orchprocess where id=?"; // String statement = // "select id, orchestration from orchprocess where entitytype='User' and operation='CREATE' order by id"; // String statement = // "select orchestration from orchprocess where id in (select processid from orchevents where name='UserModifyLDAPPreProcessHandler' and status='FAILED') order by id desc"; Connection conn = DataSource.getConnection(); System.out.println("Something"); // Read object from oracle PreparedStatement pstmt = conn.prepareStatement(statement1); pstmt.setLong(1, 138); ResultSet rs = pstmt.executeQuery(); dumpRS(rs); rs.close(); pstmt.close(); conn.close(); System.exit(0); } public static void dumpRS(ResultSet rs) throws Exception { InputStream is = null; ObjectInputStream oip = null; rs.next(); ResultSetMetaData rsmd = rs.getMetaData(); for (int i = 0; i < rsmd.getColumnCount(); i++) { String colName = rsmd.getColumnName(i + 1); if (colName.equalsIgnoreCase("orchestration")) { // is = rs.getBlob(1).getBinaryStream(); is = rs.getBinaryStream(colName); oip = new ObjectInputStream(is); Object o = oip.readObject(); if (o instanceof PostProcessOnlyBulkOrchestration) { PostProcessOnlyBulkOrchestration object = (PostProcessOnlyBulkOrchestration) o; System.out.println("Operation = " + object.getOperation()); System.out.println("Target = " + object.getTarget()); System.out.println("Action Result = " + object.getActionResult()); System.out.println("Context value = " + object.getContextVal()); printMap("Bulk Parameters: ", object.getBulkParameters()); printMap("Parameters: ", object.getParameters()); printMap("Inter event data: ", object.getInterEventData()); } else if (o instanceof EntityOrchestration) { EntityOrchestration object = (EntityOrchestration) o; System.out.println("EntityID = " + object.getEntityId()); System.out .println("EntityType = " + object.getEntityType()); System.out.println("Type = " + object.getType()); System.out.print("All Entity IDs: "); for (int j = 0; j < object.getAllEntityId().length; j++) { System.out.print(object.getAllEntityId()[j]); } System.out.println(); } else if (o instanceof Orchestration) { Orchestration object = (Orchestration) o; System.out.println("Operation = " + object.getOperation()); System.out.println("Target = " + object.getTarget()); // System.out.println("Action Result = " + // object.getActionResult()); System.out.println("Context value = " + object.getContextVal()); // printMap("Bulk Parameters: ", // object.getBulkParameters()); printMap("Parameters: ", object.getParameters()); printMap("Inter event data: ", object.getInterEventData()); } else { System.out.println("UNKNOWN ORCHESTRATION BLOB"); } } else { System.out.println(colName + " ===> " + rs.getString(colName)); } } oip.close(); is.close(); } public static void printMap(String name, HashMap<String, Serializable>[] marr) { System.out.println("Dumping maps name = " + name); for (int i = 0; i < marr.length; i++) { System.out.println("Map element # " + i); HashMap<String, Serializable> m = marr[i]; if (m == null) { System.out.println("Null Map found"); continue; } Set<Entry<String, Serializable>> set = m.entrySet(); Iterator<Entry<String, Serializable>> it = set.iterator(); while (it.hasNext()) { Entry<String, Serializable> e = it.next(); Object val = (Object) e.getValue(); String v = ""; if (val instanceof ContextAwareString) { ContextAwareString cas = (ContextAwareString) val; v = (String) cas.getObjectValue(); } else if (val instanceof ContextAwareNumber) { ContextAwareNumber can = (ContextAwareNumber) val; v = String.valueOf(((Long) can.getObjectValue())); } else { v = val.toString(); } System.out.println("\t" + e.getKey() + " ---> " + v); } } } public static void printMap(String name, HashMap<String, Serializable> m) { System.out.println("Dumping maps name = " + name); if (m == null) { System.out.println("Null Map found"); return; } Set<Entry<String, Serializable>> set = m.entrySet(); Iterator<Entry<String, Serializable>> it = set.iterator(); while (it.hasNext()) { Entry<String, Serializable> e = it.next(); Object val = (Object) e.getValue(); String v = ""; if (val instanceof ContextAwareString) { ContextAwareString cas = (ContextAwareString) val; v = (String) cas.getObjectValue(); } else if (val instanceof ContextAwareNumber) { ContextAwareNumber can = (ContextAwareNumber) val; v = String.valueOf(((Long) can.getObjectValue())); } else { v = val.toString(); } System.out.println("\t" + e.getKey() + " ---> " + v); } } } |
Oracle Identity Manager (OIM R2PS2/PS3/12C) is a highly flexible and scalable enterprise identity administration system that provides operational and business efficiency by providing centralized administration & complete automation of identity and user provisioning events across enterprise as well as extranet applications.
API to Deserialize ORCHPROCESS table data
Subscribe to:
Posts (Atom)
About OIM
Oracle Identity Management enables organizations to effectively manage the end - to - end life - cycle of user ide...
Popular Posts
-
OIM API's Sample Code : Videos: Massive Gaze Videos Connection Related API's : OIM DB Connection/ Data Source connection ...
-
Videos: Massive Gaze Videos 1. Basic OIM Information 2. MDS Export/Import 3. Steps For R2PS2 / R2PS3 Custom Pre-processor Ev...
-
Videos: Massive Gaze Videos 1. Query to get OIM Provsioned/provisioning Account details 2. Query to get usr keys For Rejected / ...
No comments:
Post a Comment