Source:
public boolean startAddUserFlow(String userStoreDomain, String userName, Object credential, String[] roleList, Map<String, String> claims, String profile) throws WorkflowException { WorkflowService workflowService = IdentityWorkflowDataHolder.getInstance().getWorkflowService(); Map<String, Object> wfParams = new HashMap<>(); Map<String, Object> nonWfParams = new HashMap<>(); if (roleList == null) { roleList = new String[0]; } if (claims == null) { claims = new HashMap<>(); } String tenant = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); String nameWithTenant = UserCoreUtil.addTenantDomainToEntry(userName, tenant); String fullyQualifiedName = UserCoreUtil.addDomainToName(nameWithTenant, userStoreDomain); wfParams.put(USERNAME, userName); wfParams.put(USER_STORE_DOMAIN, userStoreDomain); wfParams.put(ROLE_LIST, Arrays.asList(roleList)); wfParams.put(CLAIM_LIST, claims); wfParams.put(PROFILE, profile); nonWfParams.put(CREDENTIAL, credential.toString()); String uuid = UUID.randomUUID().toString(); boolean state = startWorkFlow(wfParams, nonWfParams, uuid); if (!Boolean.TRUE.equals(getWorkFlowCompleted()) && !state) { try { workflowService.addRequestEntityRelationships(uuid, new Entity[]{new Entity(fullyQualifiedName, "USER")}); } catch (InternalWorkflowException e) { log.info("No workflow associated with the operation."); } } return state; }

Target:
public boolean startAddUserFlow(String userStoreDomain, String userName, Object credential, String[] roleList, Map<String, String> claims, String profile) throws WorkflowException { WorkflowService workflowService = IdentityWorkflowDataHolder.getInstance().getWorkflowService(); Map<String, Object> wfParams = new HashMap<>(); Map<String, Object> nonWfParams = new HashMap<>(); if (roleList == null) { roleList = new String[0]; } if (claims == null) { claims = new HashMap<>(); } String tenant = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); String fullyQualifiedName = UserCoreUtil.addDomainToName(userName, userStoreDomain); wfParams.put(USERNAME, userName); wfParams.put(USER_STORE_DOMAIN, userStoreDomain); wfParams.put(ROLE_LIST, Arrays.asList(roleList)); wfParams.put(CLAIM_LIST, claims); wfParams.put(PROFILE, profile); nonWfParams.put(CREDENTIAL, credential.toString()); String uuid = UUID.randomUUID().toString(); Entity[] entities = new Entity[roleList.length + 1]; entities[0] = new Entity(fullyQualifiedName, UserStoreWFConstants.ENTITY_TYPE_USER, tenant); for (int i = 0; i < roleList.length; i++) { fullyQualifiedName = UserCoreUtil.addDomainToName(roleList[i], userStoreDomain); entities[i + 1] = new Entity(fullyQualifiedName, UserStoreWFConstants.ENTITY_TYPE_ROLE, tenant); } if (workflowService.eventEngagedWithWorkflows(UserStoreWFConstants.ADD_USER_EVENT) && !Boolean.TRUE.equals (getWorkFlowCompleted()) && !isValidOperation(entities)) { throw new WorkflowException("Operation is not valid."); } boolean state = startWorkFlow(wfParams, nonWfParams, uuid); if (!Boolean.TRUE.equals(getWorkFlowCompleted()) && !state) { try { workflowService.addRequestEntityRelationships(uuid, entities); } catch (InternalWorkflowException e) { if (log.isDebugEnabled()) { log.debug("No workflow associated with the operation.", e); } } } return state; }