Source:
<code>private SyncStatusDetail internalSynchronizeStack(Stack stack, UmsUsersState umsUsersState, boolean fullSync) { MDCBuilder.buildMdcContext(stack); String environmentCrn = stack.getEnvironmentCrn(); Multimap<String, String> warnings = ArrayListMultimap.create(); try { FreeIpaClient freeIpaClient = freeIpaClientFactory.getFreeIpaClientForStack(stack); UsersState ipaUsersState = getIpaUserState(freeIpaClient, umsUsersState, fullSync); LOGGER.debug("IPA UsersState, found users and groups", ipaUsersState.getUsers().size(), ipaUsersState.getGroups().size()); applyStateDifferenceToIpa(stack.getEnvironmentCrn(), freeIpaClient, UsersStateDifference.fromUmsAndIpaUsersStates(umsUsersState, ipaUsersState), warnings::put); if (!FreeIpaCapabilities.hasSetPasswordHashSupport(freeIpaClient.getConfig())) { LOGGER.debug("IPA doesn't have password hash support, no credentials sync required for env:{}", environmentCrn); } else { workloadCredentialService.setWorkloadCredentials(freeIpaClient, umsUsersState.getUsersWorkloadCredentialMap(), warnings::put); } boolean hasCloudIdentityEntitlement = entitlementService.cloudIdentityMappingEnabled(INTERNAL_ACTOR_CRN, stack.getAccountId()); <START> if (hasCloudIdentityEntitlement && fullSync) { <END> cloudIdentitySyncService.syncCloudIdentites(stack, umsUsersState, warnings::put); } if (warnings.isEmpty()) { return SyncStatusDetail.succeed(environmentCrn); } else { return SyncStatusDetail.fail(environmentCrn, "Synchronization completed with warnings.", warnings); } } catch (Exception e) { LOGGER.warn("Failed to synchronize environment {}", environmentCrn, e); return SyncStatusDetail.fail(environmentCrn, e.getLocalizedMessage(), warnings); } }</code><technical_language>nit: if reverse order of conditions inline entitlement check here, skip entitlement check if a full sync</technical_language>

Target:
private SyncStatusDetail internalSynchronizeStack(Stack stack, UmsUsersState umsUsersState, boolean fullSync) { MDCBuilder.buildMdcContext(stack); String environmentCrn = stack.getEnvironmentCrn(); Multimap<String, String> warnings = ArrayListMultimap.create(); try { FreeIpaClient freeIpaClient = freeIpaClientFactory.getFreeIpaClientForStack(stack); UsersState ipaUsersState = getIpaUserState(freeIpaClient, umsUsersState, fullSync); LOGGER.debug("IPA UsersState, found users and groups", ipaUsersState.getUsers().size(), ipaUsersState.getGroups().size()); applyStateDifferenceToIpa(stack.getEnvironmentCrn(), freeIpaClient, UsersStateDifference.fromUmsAndIpaUsersStates(umsUsersState, ipaUsersState), warnings::put); if (!FreeIpaCapabilities.hasSetPasswordHashSupport(freeIpaClient.getConfig())) { LOGGER.debug("IPA doesn't have password hash support, no credentials sync required for env:{}", environmentCrn); } else { workloadCredentialService.setWorkloadCredentials(freeIpaClient, umsUsersState.getUsersWorkloadCredentialMap(), warnings::put); } if (fullSync && entitlementService.cloudIdentityMappingEnabled(INTERNAL_ACTOR_CRN, stack.getAccountId())) { cloudIdentitySyncService.syncCloudIdentites(stack, umsUsersState, warnings::put); } if (warnings.isEmpty()) { return SyncStatusDetail.succeed(environmentCrn); } else { return SyncStatusDetail.fail(environmentCrn, "Synchronization completed with warnings.", warnings); } } catch (Exception e) { LOGGER.warn("Failed to synchronize environment {}", environmentCrn, e); return SyncStatusDetail.fail(environmentCrn, e.getLocalizedMessage(), warnings); } }