Source:
public User patchUser(User newUser, User oldUser, String[] attributesToDelete) throws CharonException { SCIMProvisioningConfigManager provisioningConfigManager = SCIMProvisioningConfigManager.getInstance(); if (provisioningConfigManager.isDumbMode()) { if (log.isDebugEnabled()) { log.debug("This instance is operating in dumb mode. " + "Hence, operation is not persisted, it will only be provisioned."); } this.provision(ProvisioningOperation.PATCH, newUser); return newUser; } else { if (log.isDebugEnabled()) { log.debug("Updating user: " + newUser.getUserName()); } try { SCIMCommonUtils.setThreadLocalIsManagedThroughSCIMEP(true); Map<String, String> claims = AttributeMapper.getClaimsMap(newUser); if (!carbonUM.isExistingUser(newUser.getUserName())) { throw new CharonException("User name is immutable in carbon user store."); } if (claims.containsKey(SCIMConstants.GROUPS_URI)) { claims.remove(SCIMConstants.GROUPS_URI); } if (claims.containsKey(SCIMConstants.USER_NAME_URI)) { claims.remove(SCIMConstants.USER_NAME_URI); } for (int i = 0; i < attributesToDelete.length; i++) { attributesToDelete[i] = SCIMConstants.CORE_SCHEMA_URI + ":" + attributesToDelete[i]; } carbonUM.deleteUserClaimValues(oldUser.getUserName(), attributesToDelete, null); carbonUM.setUserClaimValues(oldUser.getUserName(), claims, null); if (newUser.getPassword() != null) { carbonUM.updateCredentialByAdmin(newUser.getUserName(), newUser.getPassword()); } log.info("User: " + newUser.getUserName() + " updated updated through SCIM."); } catch (org.wso2.carbon.user.core.UserStoreException e) { throw new CharonException("Error while updating attributes of user: " + newUser.getUserName(), e); } return newUser; } }

Target:
public User patchUser(User newUser, User oldUser, String[] attributesToDelete) throws CharonException { SCIMProvisioningConfigManager provisioningConfigManager = SCIMProvisioningConfigManager.getInstance(); if (provisioningConfigManager.isDumbMode()) { if (log.isDebugEnabled()) { log.debug("This instance is operating in dumb mode. " + "Hence, operation is not persisted, it will only be provisioned."); } this.provision(ProvisioningOperation.PATCH, newUser); return newUser; } else { if (log.isDebugEnabled()) { log.debug("Updating user: " + newUser.getUserName()); } try { SCIMCommonUtils.setThreadLocalIsManagedThroughSCIMEP(true); Map<String, String> claims = AttributeMapper.getClaimsMap(newUser); if (!carbonUM.isExistingUser(newUser.getUserName())) { throw new CharonException("User name is immutable in carbon user store."); } if (claims.containsKey(SCIMConstants.GROUPS_URI)) { claims.remove(SCIMConstants.GROUPS_URI); } if (claims.containsKey(SCIMConstants.USER_NAME_URI)) { claims.remove(SCIMConstants.USER_NAME_URI); } for (int i = 0; i < attributesToDelete.length; i++) { attributesToDelete[i] = SCIMConstants.CORE_SCHEMA_URI + ":" + attributesToDelete[i]; } carbonUM.deleteUserClaimValues(oldUser.getUserName(), attributesToDelete, null); carbonUM.setUserClaimValues(oldUser.getUserName(), claims, null); if (StringUtils.isNotEmpty(newUser.getPassword())) { carbonUM.updateCredentialByAdmin(newUser.getUserName(), newUser.getPassword()); } log.info("User: " + newUser.getUserName() + " updated updated through SCIM."); } catch (org.wso2.carbon.user.core.UserStoreException e) { throw new CharonException("Error while updating attributes of user: " + newUser.getUserName(), e); } return newUser; } }