Source:
public Boolean call() throws IdentityProvisioningException { boolean success = false; String tenantDomainName = this.tenantDomainName; try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomainName); ProvisionedIdentifier provisionedIdentifier = null; provisionedIdentifier = connector.provision(provisioningEntity); if (provisioningEntity.getOperation() == ProvisioningOperation.DELETE) { deleteProvisionedEntityIdentifier(idPName, connectorType, provisioningEntity, tenantDomainName); } else if (provisioningEntity.getOperation() == ProvisioningOperation.POST) { if (provisionedIdentifier == null || provisionedIdentifier.getIdentifier() == null) { provisionedIdentifier = new ProvisionedIdentifier(); provisionedIdentifier.setIdentifier(UUID.randomUUID().toString()); } provisioningEntity.setIdentifier(provisionedIdentifier); storeProvisionedEntityIdentifier(idPName, connectorType, provisioningEntity, tenantDomainName); } else if (provisioningEntity.getEntityType() == ProvisioningEntityType.GROUP && provisioningEntity.getOperation() == ProvisioningOperation.PUT && getNewGroupName(provisioningEntity) != null) { deleteProvisionedEntityIdentifier(idPName, connectorType, provisioningEntity, tenantDomainName); ProvisioningEntity newProvisioningEntity = new ProvisioningEntity( ProvisioningEntityType.GROUP, getNewGroupName(provisioningEntity), ProvisioningOperation.PUT, provisioningEntity.getAttributes()); newProvisioningEntity.setIdentifier(provisioningEntity.getIdentifier()); storeProvisionedEntityIdentifier(idPName, connectorType, newProvisioningEntity, tenantDomainName); } success = true; } catch (IdentityApplicationManagementException e) { String errMsg = " Provisioning for Entity " + provisioningEntity.getEntityName() + " For operation = " + provisioningEntity.getOperation(); throw new IdentityProvisioningException(errMsg, e); } finally { PrivilegedCarbonContext.endTenantFlow(); if (tenantDomainName != null) { PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( tenantDomainName); } } return success; }

Target:
public Boolean call() throws IdentityProvisioningException { boolean success = false; String tenantDomainName = this.tenantDomainName; try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomainName); ProvisionedIdentifier provisionedIdentifier = null; provisionedIdentifier = connector.provision(provisioningEntity); if (provisioningEntity.getOperation() == ProvisioningOperation.DELETE) { deleteProvisionedEntityIdentifier(idPName, connectorType, provisioningEntity, tenantDomainName); } else if (provisioningEntity.getOperation() == ProvisioningOperation.POST) { if (provisionedIdentifier == null || provisionedIdentifier.getIdentifier() == null) { provisionedIdentifier = new ProvisionedIdentifier(); provisionedIdentifier.setIdentifier(UUID.randomUUID().toString()); } provisioningEntity.setIdentifier(provisionedIdentifier); storeProvisionedEntityIdentifier(idPName, connectorType, provisioningEntity, tenantDomainName); } else if (provisioningEntity.getEntityType() == ProvisioningEntityType.GROUP && provisioningEntity.getOperation() == ProvisioningOperation.PUT) { String newGroupName = ProvisioningUtil.getAttributeValue(provisioningEntity, IdentityProvisioningConstants.NEW_GROUP_NAME_CLAIM_URI); if(newGroupName != null){ dao.updateProvisionedEntityName(provisioningEntity); } } success = true; } catch (IdentityApplicationManagementException e) { String errMsg = " Provisioning for Entity " + provisioningEntity.getEntityName() + " For operation = " + provisioningEntity.getOperation(); throw new IdentityProvisioningException(errMsg, e); } finally { PrivilegedCarbonContext.endTenantFlow(); if (tenantDomainName != null) { PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( tenantDomainName); } } return success; }