import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import openconnector.JsonUtil;
import sailpoint.api.SailPointContext;
import sailpoint.connectorDependencies.EndPoint;
import sailpoint.object.Attributes;
import sailpoint.object.Identity;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.tools.Util;
public class RoleCreation {
static SailPointContext context = null;
static Logger logger = null;
static ProvisioningPlan provisioningPlan = null;
static EndPoint requestEndPoint = null;
public static void main(String[] args) {
String appName = null;
String roleId = "";
List<String> securityGroup = new ArrayList<String>();
String secretAccountIndicator = "";
String phone = null;
String ecomSecGroupReqType = "";
List<String> ecomSecurityGroup = new ArrayList<String>();
List<String> ipccRoleId = new ArrayList<String>();
String ipccPhone = "";
String roleChangeReqType = "";
List<String> roleChangeRoleID = new ArrayList<String>();
String primasRole = "";
String primasPhone = "";
String ecomAccSecretAccountIndicator = "";
AttributeRequest attributeRequest = null;
Map<String, Object> formMap = new HashMap<String, Object>();
List<AccountRequest> accountRequests = null;
accountRequests = provisioningPlan.getAccountRequests();
for (AccountRequest accountRequest : accountRequests) {
if (Util.isNotNullOrEmpty(accountRequest.getApplicationName())
&& accountRequest.getApplicationName().toString().trim().equalsIgnoreCase("ECOM")) {
appName = accountRequest.getApplicationName().toString().trim();
formMap = provisioningPlan.getArguments().getMap();
if (accountRequest.getOperation().equals(AccountRequest.Operation.Create)) {
if (accountRequest.getAttributeRequest("rolesIds") != null) {
attributeRequest = accountRequest.getAttributeRequest("rolesIds");
if (attributeRequest.getName().equalsIgnoreCase("ECOM")) {
if (formMap.get("Role ID") != null) {
String roleID = formMap.get("Role ID").toString();
}
if (formMap.get("Security Group") != null) {
securityGroup = (List) formMap.get("Security Group");
}
if (formMap.get("Secret Account Indicator") != null) {
secretAccountIndicator = formMap.get("Secret Account Indicator").toString().trim();
}
if (formMap.get("Phone") != null) {
phone = formMap.get("Phone").toString().trim();
}
}
if (attributeRequest.getName().equalsIgnoreCase("ECOM Security Group")) {
if (formMap.get("Request Type") != null) {
String roleID = formMap.get("Request Type").toString();
}
if (formMap.get("Security Group") != null) {
ecomSecurityGroup = (List<String>) formMap.get("Security Group");
}
}
if (attributeRequest.getName().equalsIgnoreCase("IPCC")) {
if (formMap.get("Role ID") != null) {
ipccRoleId = (List<String>) formMap.get("Role ID");
}
if (formMap.get("Phone") != null) {
phone = formMap.get("Phone").toString().trim();
}
}
if (attributeRequest.getName().equalsIgnoreCase("IPCCRoleChange")) {
if (formMap.get("Request Type") != null) {
roleChangeReqType = formMap.get("Request Type").toString().trim();
}
if (formMap.get("Role ID") != null) {
roleChangeRoleID = (List<String>) formMap.get("Role ID");
}
}
if (attributeRequest.getName().equalsIgnoreCase("PRIMAS")) {
if (formMap.get("Role ID") != null) {
primasRole = formMap.get("Role ID").toString();
}
if (formMap.get("Phone") != null) {
primasPhone = formMap.get("Phone").toString().trim();
}
}
if (attributeRequest.getName().equalsIgnoreCase("ECOM Account Indicator")) {
if (formMap.get("Secret Account Indicator") != null) {
secretAccountIndicator = formMap.get("Secret Account Indicator").toString().trim();
}
}
}
if (formMap.size() > 0) {
if (formMap.get("Role ID") != null) {
}
Map body = requestEndPoint.getBody();
String jsonBody = (String) body.get("jsonBody");
logger.info("Rule - Modify Body: running");
}
}
}
}
}
}
No comments:
Post a Comment