Labels
- AD
- Aggregation
- Audit Management
- AWS
- Certification
- Compass_Useful_Links
- Courses
- Custom Reports
- Custom Tasks
- Database (OIM)
- Database (Sailpoint)
- E-Fix
- Excel
- Forgerock
- Forms
- Group Management
- IIQ Console Commands
- IQ Service
- Java
- Kanada
- LCM
- Linux
- Loggers
- MS Office
- MySQL
- Notifications
- OIM
- Password Management
- Policy Violation
- Provisioning
- ProvisioningPlan
- Quicklink
- RBAC
- References
- Repo Update
- Role Management
- Rules_Scripts_APIs
- Sailpoint
- Sailpoint API's
- SailPoint Best Practices
- SailPoint IIQ
- Scripts
- Softwares
- SSB
- UAT
- UI
- Upgradation
- VM Ware
- Web Service
- Workflow
- Workgroup
Sunday, January 31, 2021
Kanada Vocabulary
Monday, January 25, 2021
How to fetch file from SFTP (Server)?
File inputFileorDirectory = new File(inputMap.get("Input File Path").toString());
LOGGER.debug("Input file or Directory is : " + inputFileorDirectory.getName());
System.out.println("Input file or Directory is : " + inputFileorDirectory.getName());
if (inputFileorDirectory.isDirectory()) {
LOGGER.debug("Input is a Directory : " + inputFileorDirectory.getName());
System.out.println("Input is a Directory : " + inputFileorDirectory.getName());
FilenameFilter fileNameFilter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
if (name.endsWith("csv")) {
return true;
} else {
return false;
}
}
};
String[] inputFileNames = inputFileorDirectory.list(fileNameFilter);
if (inputFileNames == null || inputFileNames.length == 0) {
LOGGER.error("No Files present inside the directory");
System.out.println("No Files present inside the directory");
throw new Exception("No Files present inside the directory");
}
for (String inputFileName : inputFileNames) {
// Process Records
String data = readData(inputFileorDirectory.getAbsolutePath() + File.separator + inputFileName);
System.out.println("Data : " + data);
LOGGER.debug("Data : " + data);
}
}
Sunday, January 10, 2021
Fetch the RJ_KEY for the Scheduler Job (Trusted / Target Recon Job) and Fetch the count for the Job?
select MAX(RJ_KEY) from recon_jobs where RJ_NAME='Job Name';
NOTE :
Job Name = Active Directory User Target Recon
select count(distinct re.re_key) as COUNT from RECON_JOBS rj, RECON_EVENTS re, RECON_HISTORY rh, USR usr where rj.RJ_NAME='Clarizen Certification Job' and rj.rj_key=re.rj_key and rh.re_key=re.re_key and rh.rh_status in ('Creation Succeeded','Update Succeeded') and re.usr_key=usr.usr_key and to_char(rj.rj_start_time,'DD/MM/YY') = to_char(SYSDATE,'DD/MM/YY') and rj.rj_key='RJ_KEY' order by rj.rj_start_time desc;
NOTE :
RJ_KEY = 1234
How to fetch certification details by using database query in OIM?
SELECT distinct certd_app_inst.cert_id AS certification_id,cert_certs.cert_name AS certificationname, cert_certs.createdate AS certification_creation_date,
decode(cert_certs.state,1,'YET_TO_START',2,'WIP',3,'COMPLETED',4,'EXPIRED',cert_certs.state) certification_state, A.attribute_value as entitlement,A.description as entitlement_description,
A.account_name,A.first_name,A.last_name,decode(A.decision,0,'REVOKE',1,'CERTIFY',3,'CERTIFY CONDITIONALLY FOR REASSIGN',A.decision) decision, A.certified_by,A.certification_date,A.comments,A.endpoint_name,
(case when lower(A.account_name) = lower(A.certified_by) then 'Y' when lower(A.account_name) != lower(A.certified_by) then 'N' else null end) is_self_attested FROM
certs_app_inst,certd_app_inst,cert_certs, (SELECT certs_acct_ent_asgn.attribute_value AS attribute_value,certs_acct_ent_asgn.short_description AS description, certd_acct_ent_asgn.account_id
AS account_id,certs_account.account_name AS account_name, certs_user.firstname AS first_name,certs_user.lastname AS last_name, certd_acct_ent_asgn.cert_id AS cert_id,certd_acct_ent_asgn.certified AS decision,
certd_acct_ent_asgn.certified_by AS certified_by,certd_acct_ent_asgn.certification_date AS certification_date, certd_acct_ent_asgn.comments AS comments,certs_account.endpoint_name AS endpoint_name,
certs_account.endpoint_id AS endpoint_id FROM certs_acct_ent_asgn, certd_acct_ent_asgn,certs_user,certs_account WHERE certs_acct_ent_asgn.id = certd_acct_ent_asgn.account_attribute_id AND
certs_acct_ent_asgn.parent_id = 0 AND certd_acct_ent_asgn.user_id = certs_user.id AND certs_acct_ent_asgn.account_id = certs_account.id AND certs_acct_ent_asgn.account_id IN
(SELECT certs_account.id FROM certs_account, certd_user_acct WHERE certs_account.id = certd_user_acct.account_id)) A WHERE cert_certs.id = certd_app_inst.cert_id
AND certs_app_inst.id = certd_app_inst.endpoint_id AND A.cert_id = certd_app_inst.cert_id AND A.endpoint_id = certs_app_inst.iam_endpoint_id
AND A.decision=0 AND trunc(cert_certs.createdate) = upper('dd-MM-yy') AND cert_certs.cert_name like '%Certificate Definition Name%' ORDER BY certd_app_inst.cert_id desc, A.account_name;
Note :
Ex :
Certificate Definition Name = Oracle CRM
Date (dd-MM-yy) = 11-JAN-2021
Friday, January 8, 2021
How to fetch session of JSON Object?
public static String getSessionIdJSONObject(String userName, String password, HashMap<String, String> lookupData) {
String methodName = "getSessionIdJSONObject";
LOGGER.debug(CLASS_NAME + "/" + methodName + "; userName = " + userName + "; password = " + password);
System.out.println(CLASS_NAME + "/" + methodName + "; userName = " + userName + "; password = " + password);
String WS_URL = null;
URL url = null;
String retVal = "SUCCESS";
StringBuffer response = null;
OutputStream os = null;
BufferedReader in = null;
try {
String webServiceParams = "{\"UserName\":\"" + userName + "\"" + " , \"Password\":\"" + password + "\"}";
System.out.println("webServiceParams : " + webServiceParams);
WS_URL = lookupData.get("SessionIdURL");
System.out.println("WebService URL :" + WS_URL);
url = new URL(WS_URL);
//url = new URL(null, WS_URL, new sun.net.www.protocol.https.Handler());
HttpsURLConnection postConnection = (HttpsURLConnection) url.openConnection();
postConnection.setRequestMethod("POST");
postConnection.setRequestProperty("Content-Type", "application/json");
postConnection.setDoOutput(true);
os = postConnection.getOutputStream();
os.write(webServiceParams.getBytes());
int responseCode = postConnection.getResponseCode();
System.out.println("POST Response Code : " + responseCode);
System.out.println("POST Response Message : " + postConnection.getResponseMessage());
if (responseCode == 200) { // success
in = new BufferedReader(new InputStreamReader(postConnection.getInputStream()));
String inputLine;
response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
// print result
System.out.println("JSON object is : " + response.toString());
LOGGER.debug("JSON object is : " + response.toString());
} else {
retVal = "FAIL";
System.out.println("Return value is : " + retVal);
System.out.println("POST NOT WORKED");
LOGGER.debug("Return value is : " + retVal);
LOGGER.debug("POST NOT WORKED");
}
}
catch (Exception e) {
System.out.println("Exception is : " + e.getMessage());
LOGGER.error("Exception is : " + e.getMessage());
e.printStackTrace();
} // End of Catch block
finally {
closeIOFile(os, in);
}
System.out.println("Return value is : " + retVal);
LOGGER.debug("Return value is : " + retVal);
System.out.println("Exiting from the method : " + methodName);
LOGGER.debug("Exiting from the method : " + methodName);
return response.toString();
}
NOTE :
Ex: SessionIdURL = "https://oimsailpointpedia.blogspot.com/search/label/Java";
How to fetch user status of JOSN Object?
public static String extractUserState(String jsonObject)
throws ParseException, JsonParseException, JsonMappingException, IOException {
String methodName = "extractUserState";
LOGGER.debug(CLASS_NAME + "/" + methodName + "; jsonObject = " + jsonObject);
System.out.println(CLASS_NAME + "/" + methodName + "; jsonObject = " + jsonObject);
String userStatus = null;
String id = null;
State state = new State();
ObjectMapper objectMapper = new ObjectMapper();
Entities entities = objectMapper.readValue(jsonObject, Entities.class);
System.out.println("Entities lenght : " + entities.getEntities().length);
if (entities.getEntities().length != 0) {
for (User user : entities.getEntities()) {
state = user.getState();
id = state.getId();
userStatus = id.substring(7);
System.out.println(id.substring(7));
}
}
System.out.println("Exiting from the method : " + methodName);
LOGGER.debug("Exiting from the method : " + methodName);
return userStatus;
}
How to fetch User Id / External Id of JSON Object?
// fetch external user Id
public static String extractUserId(String jsonObject)
throws ParseException, JsonParseException, JsonMappingException, IOException {
String methodName = "extractUserId";
LOGGER.debug(CLASS_NAME + "/" + methodName);
System.out.println(CLASS_NAME + "/" + methodName);
String externalUserIDValue = null;
ObjectMapper objectMapper = new ObjectMapper();
Entities entities = objectMapper.readValue(jsonObject, Entities.class);
System.out.println("Entities lenght : " + entities.getEntities().length);
if (entities.getEntities().length != 0) {
for (User user : entities.getEntities()) {
externalUserIDValue = user.getExternalId();
}
}
System.out.println("Exiting from the method : " + methodName);
LOGGER.debug("Exiting from the method : " + methodName);
return externalUserIDValue;
}
How to fetch Session Id of JSONObject?
public static String extractSessionIDFromGetSessionId(String jsonObject) throws ParseException {
String methodName = "extractSessionIDFromGetSessionId";
LOGGER.debug(CLASS_NAME + "/" + methodName + "; jsonObject = " + jsonObject);
System.out.println(CLASS_NAME + "/" + methodName + "; jsonObject = " + jsonObject);
JSONParser parser = new JSONParser();
String sessionId = "";
System.out.println("JSON object is :" + jsonObject);
LOGGER.debug("JSON object is :" + jsonObject);
Object obj = parser.parse(jsonObject);
JSONObject jo = (JSONObject) obj;
sessionId = jo.get("sessionId").toString();
System.out.println("SessionId is : " + sessionId);
System.out.println("Exiting from the method : " + methodName);
LOGGER.debug("Exiting from the method : " + methodName);
return sessionId;
}
NOTE: JSON Jar is required
How to fetch ITReosurce Key based on applicationInstance?
private String getITResourceKey(String applicationInstanceName) {
System.out.println(CLASS_NAME + " Start of getITResourceKey()");
Connection connection = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String itResourceKey = null;
try {
String query = "select itresource_key from app_instance where app_instance_display_name=?";
pstmt = connection.prepareStatement(query);
pstmt.setString(1, applicationInstanceName);
rs = pstmt.executeQuery();
if (rs.next()) {
itResourceKey = rs.getString("itresource_key");
}
} catch (Exception e) {
e.printStackTrace();
}finallly{
connection.close();
pstmt.close();
rs.close();
}
return itResourceKey;
}
How to send email with attachment ?
public static boolean sendMail(String[] emailto, String sFrom, InternetAddress[] iCC, InternetAddress[] iBCC,
String sSubject, String sMessage, String sAttachment, String host, String port) throws AddressException {
String methodName = "sendMail";
System.out.println(CLASS_NAME + methodName + "Inside : FileName : " + sAttachment);
LOGGER.debug(CLASS_NAME + methodName + "Inside : FileName : " + sAttachment);
// InternetAddress[] to = iAddr;
InternetAddress[] address = new InternetAddress[emailto.length];
int i;
for (i = 0; i < emailto.length; i++) {
address[i] = new InternetAddress(emailto[i]);
System.out.println("To " + address[i]);
}
// String subject = sSubject + "-" + falloutUserVOs.size();
String subject = sSubject;
String from = sFrom;
Properties properties = System.getProperties();
properties.setProperty("mail.smtp.host", host);
properties.setProperty("mail.smtp.port", port);
Session session = Session.getDefaultInstance(properties);
System.out.println(CLASS_NAME + methodName + "Property Added Successfully");
LOGGER.debug(CLASS_NAME + methodName + "Property Added Successfully");
try {
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.setRecipients(Message.RecipientType.TO, (Address[]) address);
if (iCC != null) {
message.addRecipients(Message.RecipientType.CC, iCC);
}
if (iBCC != null) {
message.addRecipients(Message.RecipientType.BCC, iBCC);
}
message.setSubject(subject);
if (sAttachment == null || sAttachment.length() == 0) {
message.setContent(sMessage, "text/html");
} else {
System.out.println(CLASS_NAME + methodName + "Recipents Added Successfully");
LOGGER.debug(CLASS_NAME + methodName + "Recipents Added Successfully");
MimeBodyPart mimeBodyPart = new MimeBodyPart();
mimeBodyPart.setContent(sMessage, "text/html");
MimeMultipart mimeMultipart = new MimeMultipart();
mimeMultipart.addBodyPart(mimeBodyPart);
mimeBodyPart = new MimeBodyPart();
String filename = sAttachment;
DataSource source = new FileDataSource(filename);
mimeBodyPart.setDataHandler(new DataHandler(source));
String strPath = filename.substring(filename.lastIndexOf("/") + 1, filename.length());
mimeBodyPart.setFileName(strPath);
mimeMultipart.addBodyPart(mimeBodyPart);
// Send the complete message parts
message.setContent(mimeMultipart);
}
// Send message
Transport.send(message);
System.out.println(CLASS_NAME + methodName + "Sent message successfully....");
LOGGER.debug(CLASS_NAME + methodName + "Sent message successfully....");
} catch (MessagingException mex) {
System.out.println(CLASS_NAME + methodName + " ERROR : " + mex.getMessage());
LOGGER.error(CLASS_NAME + methodName + " ERROR : " + mex.getMessage());
return false;
}
System.out.println("Exiting from the method : " + methodName);
LOGGER.debug("Exiting from the method : " + methodName);
return true;
}
-----------------------------------------------------------------------------------------------------------------------------
tcLookupOperationsIntf lookupOps = Platform.getService(tcLookupOperationsIntf.class);
String toEmails = lookupOps.getDecodedValueForEncodedValue("Lookup.Clarizen.WebService", "TO_EMAIL");
String[] to = toEmails.split(",");
boolean emailStatus1 = sendMail(to, lookupData.get("SENDER_EMAIL"), null, null,
lookupData.get("EMAIL_SUBJECT"), lookupData.get("MESSAGE"), fallout_userFilePath, lookupData.get("SMTP_PRIMARY_HOST"),
lookupData.get("SMTP_PORT"));
How to fetch childData in OIM?
public static HashMap<String, String> getChildData(String requestID) {
String methodName = "getChildData";
System.out.println(CLASS_NAME + "/" + methodName + "; Request ID = " + requestID);
HashMap functionRoleApplicationMap = new HashMap();
try {
Request request = getRequestObject(requestID);
List beneficiaryList = request.getBeneficiaries();
List reqBeneficiaryEntityList = ((Beneficiary) beneficiaryList.get(0)).getTargetEntities();
List<RequestBeneficiaryEntityAttribute> reqBeneficiaryEntityAttributeList = ((RequestBeneficiaryEntity) reqBeneficiaryEntityList
.get(0)).getEntityData();
for (RequestBeneficiaryEntityAttribute reqBeneficiaryEntityAttribute : reqBeneficiaryEntityAttributeList) {
if (reqBeneficiaryEntityAttribute.getName().equalsIgnoreCase("TABLE_NAME")) {
List<RequestBeneficiaryEntityAttribute> childAttributeList = reqBeneficiaryEntityAttribute
.getChildAttributes();
String fieldName = "";
String fieldValue = "";
for (RequestBeneficiaryEntityAttribute childAttribute : childAttributeList) {
if (childAttribute.getName().equalsIgnoreCase("Field Name")) {
fieldName = childAttribute.getValueHolder().toString();
}
if (childAttribute.getName().equalsIgnoreCase("Field Value")
&& null != childAttribute.getValueHolder()) {
fieldValue = childAttribute.getValueHolder().toString();
}
}
// System.out.println(fieldName + "==" + fieldValue);
functionRoleApplicationMap.put(fieldName, fieldValue);
}
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Exiting from the method : " + methodName);
return functionRoleApplicationMap;
}
How to fetch parent form Data in OIM?
public static Map<String, String> getParentFormData(long processKey)
throws tcAPIException, tcInvalidLookupException, tcColumnNotFoundException, tcFormNotFoundException,
tcProcessNotFoundException, tcVersionNotFoundException, tcNotAtomicProcessException, LoginException {
String methodName = "getParentFormData";
System.out.println(CLASS_NAME + "/" + methodName + "; processKey = " + processKey);
tcFormInstanceOperationsIntf formInstOps = Platform.getService(tcFormInstanceOperationsIntf.class);
tcFormDefinitionOperationsIntf formDefOps = Platform.getService(tcFormDefinitionOperationsIntf.class);
tcResultSet tcresultset = formInstOps.getProcessFormData(processKey);
long l1 = formInstOps.getProcessFormDefinitionKey(processKey);
tcResultSet formFieldresultset = formDefOps.getFormFields(l1, formInstOps.getProcessFormVersion(processKey));
int formfieldCount = formFieldresultset.getRowCount();
Map<String, String> result = new HashMap<String, String>();
for (int j1 = 0; j1 < formfieldCount; j1++) {
formFieldresultset.goToRow(j1);
String s4 = formFieldresultset.getStringValue(Structure Utility.Additional Columns.Field Label);
String val = tcresultset
.getStringValue(formFieldresultset.getStringValue(Structure Utility.Additional Columns.Name));
result.put(s4, val);
}
System.out.println("Exiting from the method : " + methodName);
return result;
}
How to fetch Old Manager Login and New Manager Login in Post Process EventHandler
public class UserManagerEventHandler implements PostProcessHandler {
private static final Logger LOGGER = Logger.getLogger(UserManagerEventHandler.class.getName());
private static final String CLASS_NAME = UserManagerEventHandler.class.getName();
@Override
public boolean cancel(long arg0, long arg1, AbstractGenericOrchestration arg2) {
return false;
}
@Override
public void compensate(long arg0, long arg1, AbstractGenericOrchestration arg2) {
}
@Override
public BulkEventResult execute(long arg0, long arg1, BulkOrchestration arg2) {
return null;
}
/**
* @param processId
* OIM.ORCHEVENTS.ProcessId
* @param eventId
* OIM.ORCHEVENTS.ID
* @param orchestration
* Holds useful data
*/
@Override
public EventResult execute(long processId, long eventId, Orchestration orchestration) {
String methodName = "execute";
System.out.println(CLASS_NAME + "/" + methodName + "; processId = " + processId + "; eventId = " + eventId
+ "; orchestration = " + orchestration);
LOGGER.debug(CLASS_NAME + "/" + methodName + "; processId = " + processId + "; eventId = " + eventId
+ "; orchestration = " + orchestration);
try {
// contains only the new values
HashMap<String, Serializable> newParameters = orchestration.getParameters();
// contains old and new
HashMap<String, Serializable> interParameters = orchestration.getInterEventData();
// values of user
System.out.println(String.format("Inter Parameters: %s ", interParameters));
System.out.println(String.format("New Parameters: %s ", newParameters));
User currentUserState = (User) interParameters.get("CURRENT_USER");
Long oldManagerKey = currentUserState.getAttribute("usr_manager_key") instanceof ContextAware
? (Long) ((ContextAware) currentUserState.getAttribute("usr_manager_key")).getObjectValue()
: (Long) currentUserState.getAttribute("usr_manager_key");
Long newManagerKey = getParamaterStringValue(newParameters, "usr_manager_key");
Long newMangerID = newParameters.get(AttributeName.MANAGER_KEY.getId()) instanceof ContextAware
? (Long) ((ContextAware) newParameters.get(AttributeName.MANAGER_KEY.getId())).getObjectValue()
: (Long) newParameters.get(AttributeName.MANAGER_KEY.getId());
Long oldManagerID = null;
oldManagerID = (Long) currentUserState.getAttribute(AttributeName.MANAGER_KEY.getId());
LOGGER.debug(CLASS_NAME + "newMangerID:\t" + newMangerID);
LOGGER.debug(CLASS_NAME + "newManagerKey:\t" + newManagerKey);
LOGGER.debug(CLASS_NAME + "oldManagerID" + oldManagerID);
LOGGER.debug(CLASS_NAME + "oldManagerKey" + oldManagerKey);
LOGGER.debug(CLASS_NAME + "User Login:\t" + currentUserState.getLogin());
String userLogin = currentUserState.getLogin().toUpperCase();
System.out.println("userLogin : " + userLogin);
LOGGER.debug("userLogin : " + userLogin);
String newMGRKey = String.valueOf(newManagerKey);
System.out.println("newMGRKey : " + newMGRKey);
LOGGER.debug("newMGRKey : " + newMGRKey);
String newManagerUserLogin = "";
String oldManagerUserLogin = "";
UserManager usrMgr = Platform.getService(UserManager.class);
// Check existence of manager key
if (newMGRKey != null) {
User newmanagerUser = usrMgr.getDetails(newMGRKey, new HashSet<String>(), false);
newManagerUserLogin = newmanagerUser.getLogin().toUpperCase();
LOGGER.debug("New Manager Login : " + newManagerUserLogin);
System.out.println("New Manager Login : " + newManagerUserLogin);
}
String oldMGRKey = String.valueOf(oldManagerKey);
System.out.println("oldMGRKey : " + oldMGRKey);
LOGGER.debug("oldMGRKey : " + oldMGRKey);
// Check existence of manager key
if (oldMGRKey != null) {
User oldManagerUser = usrMgr.getDetails(oldMGRKey, new HashSet<String>(), false);
oldManagerUserLogin = oldManagerUser.getLogin().toUpperCase();
LOGGER.debug("Old Manager Login : " + oldManagerUserLogin);
System.out.println("Old Manager Login : " + oldManagerUserLogin);
}
if (oldManagerID != null && newMangerID != null && newMangerID != oldManagerID) {
System.out.println("Manager update is invoking :");
LOGGER.debug("Manager update is invoking :");
String managerUpdateStatus = ManagerChange.managerChange(userLogin, oldManagerUserLogin, newManagerUserLogin);
}
}
catch (Exception ex) {
LOGGER.error(CLASS_NAME + "Error occured in Process Evenet Handler");
System.out.println(CLASS_NAME + "/" + " Exception : " + ex.getMessage());
ex.printStackTrace();
}
return new EventResult();
}
/**
* ContextAware object is obtained when the actor is a regular user. If the
* actor is an administrator, the exact value of the attribute is obtained.
*
* @param parameters
* parameters from the orchestration object
* @param key
* name of User Attribute in OIM Profile or column in USR table
* @return value of the corresponding key in parameters
*/
private Long getParamaterStringValue(HashMap<String, Serializable> parameters, String key) {
Long value = parameters.get(key) instanceof ContextAware
? (Long) ((ContextAware) parameters.get(key)).getObjectValue() : (Long) parameters.get(key);
return value;
}
@Override
public void initialize(HashMap<String, String> arg0) {
}
}
Fetch Members from Workgroup
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import sailpoint.api.ObjectUtil; import sailpoint.ob...
-
1. Configure the Manager Quicklink population to allow account only requests. a. Navigate to ===> Global Settings ===> Quicklink Pop...
-
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import sailpoint.object.Bundle;...