Source:
<code>protected UserResourceProfileEntity saveUserResourceProfile(UserResourceProfile userResourceProfile) throws AppCatalogException { String userId = userResourceProfile.getUserId(); String gatewayId = userResourceProfile.getGatewayID(); Mapper mapper = ObjectMapperSingleton.getInstance(); UserResourceProfileEntity userResourceProfileEntity = mapper.map(userResourceProfile, UserResourceProfileEntity.class); if (userResourceProfileEntity.getUserComputeResourcePreferences() != null) { logger.debug("Populating the Primary Key UserComputeResourcePreferences objects for the User Resource Profile"); <START> userResourceProfileEntity.getUserComputeResourcePreferences().forEach(userComputeResourcePreferenceEntity -> userComputeResourcePreferenceEntity.setUserId(userId)); <END> userResourceProfileEntity.getUserComputeResourcePreferences().forEach(userComputeResourcePreferenceEntity -> userComputeResourcePreferenceEntity.setGatewayId(gatewayId)); } if (userResourceProfileEntity.getUserStoragePreferences() != null) { logger.debug("Populating the Primary Key UserStoragePreferences objects for the User Resource Profile"); userResourceProfileEntity.getUserStoragePreferences().forEach(userStoragePreferenceEntity -> userStoragePreferenceEntity.setUserId(userId)); userResourceProfileEntity.getUserStoragePreferences().forEach(userStoragePreferenceEntity -> userStoragePreferenceEntity.setGatewayId(gatewayId)); } if (!isUserResourceProfileExists(userId, gatewayId)) { logger.debug("Checking if the User Resource Profile already exists"); userResourceProfileEntity.setCreationTime(new Timestamp(System.currentTimeMillis())); } userResourceProfileEntity.setUpdateTime(new Timestamp(System.currentTimeMillis())); return execute(entityManager -> entityManager.merge(userResourceProfileEntity)); }</code><technical_language>need forEach twice, set properties. line 68</technical_language>

Target:
protected UserResourceProfileEntity saveUserResourceProfile(UserResourceProfile userResourceProfile) throws AppCatalogException { String userId = userResourceProfile.getUserId(); String gatewayId = userResourceProfile.getGatewayID(); Mapper mapper = ObjectMapperSingleton.getInstance(); UserResourceProfileEntity userResourceProfileEntity = mapper.map(userResourceProfile, UserResourceProfileEntity.class); if (userResourceProfileEntity.getUserComputeResourcePreferences() != null) { logger.debug("Populating the Primary Key UserComputeResourcePreferences objects for the User Resource Profile"); userResourceProfileEntity.getUserComputeResourcePreferences().forEach(userComputeResourcePreferenceEntity -> { userComputeResourcePreferenceEntity.setUserId(userId); userComputeResourcePreferenceEntity.setGatewayId(gatewayId); }); } if (userResourceProfileEntity.getUserStoragePreferences() != null) { logger.debug("Populating the Primary Key UserStoragePreferences objects for the User Resource Profile"); userResourceProfileEntity.getUserStoragePreferences().forEach(userStoragePreferenceEntity -> { userStoragePreferenceEntity.setUserId(userId); userStoragePreferenceEntity.setGatewayId(gatewayId); }); } if (!isUserResourceProfileExists(userId, gatewayId)) { logger.debug("Checking if the User Resource Profile already exists"); userResourceProfileEntity.setCreationTime(new Timestamp(System.currentTimeMillis())); } userResourceProfileEntity.setUpdateTime(new Timestamp(System.currentTimeMillis())); return execute(entityManager -> entityManager.merge(userResourceProfileEntity)); }