Friday, May 3, 2024

Database Connection

 public static Connection getConnection(){

    String url = "DBURL";

    String user = "spadmin";

String pwd = "p1213#%$#^$%#&^";    

Connection connection;

 log.error("Intializing connection");

 Properties connectionProperties = new Properties();

         connectionProperties.put("user", user);

        connectionProperties.put("password", context.decrypt(pwd));

        connection = DriverManager.getConnection(url, connectionProperties);        

        return connection;

}


WorkflowLaunch

HashMap<String,Object> map = new HashMap<String,Object>();

        map.put("allowRequestsWithViolations","true");

        map.put("approvalMode","serial");

        map.put("approvalScheme","none"); // For auto approval 

        map.put("AppName",applicationName); //Target applcation name

        map.put("doRefresh","true");

        map.put("enableRetryRequest","false");

        map.put("fallbackApprover","spadmin");

        map.put("flow",requestType);

        map.put("foregroundProvisioning","true");

        map.put("identityDisplayName",identityName);

        map.put("identityName",identityName);

        map.put("identity",identity);

        map.put("notificationScheme","user,requester");

        map.put("optimisticProvisioning","true");

        map.put("plan",plan);

        map.put("policiesToCheck","");

        map.put("policyScheme","continue");

        map.put("policyViolations","");

        map.put("project","");

        map.put("requireViolationReviewComments","true");

        map.put("securityOfficerName","");

        map.put("sessionOwner","spadmin");

        map.put("source","LCM");

        map.put("trace","true");

        map.put("violationReviewDecision","");

        map.put("workItemComments","");


//Create WorkflowLaunch and set values

Workflow wf = (Workflow) context.getObjectByName(Workflow.class,"Mighty - LCM Provisioning");

WorkflowLaunch wflaunch = new WorkflowLaunch(); 

wflaunch.setWorkflowName(wf.getName());

 wflaunch.setWorkflowRef(wf.getName());

 wflaunch.setCaseName("customProvToDB");

 //Launch workflow for application provisioning

 wflaunch.setVariables(map);

 wflaunch.setWorkflow(wf);  

       

 //Create Workflower and launch workflow from WorkflowLaunch

 Workflower workflower = new Workflower(context);

 WorkflowLaunch launch = workflower.launch(wflaunch);

 String workFlowId = launch.getWorkflowCase().getId();

log.error("workFlowId: "+workFlowId); 

API's Syntax

SailPointContext context = SailPointFactory.getCurrentContext();

Identity identity = new  Identity();

Identity identity = context.getObjectByName(Identity.class, "Magnus"));

Bundle bundle = new Bundle();

WorkflowLaunch wflaunch = new WorkflowLaunch();

Workflower workflower = new Workflower(context);

Trim the String

public static String getNotNullString(String value){

String returnValue = "";

if (value != null) {

 str = value.trim();

 }

 return returnValue ;

}

Fetch Members from Workgroup

  import java.util.ArrayList;   import java.util.Iterator;   import java.util.List;   import sailpoint.api.ObjectUtil;   import sailpoint.ob...