Source:
<code>private void cleanupInvalidRegistrationIDsForVariant(String variantID, MulticastResult multicastResult, List<String> registrationIDs) { final List<Result> results = multicastResult.getResults(); final Set<String> inactiveTokens = new HashSet<String>(); for (int i = 0; i < results.size(); i++) { final Result result = results.get(i); final String errorCodeName = result.getErrorCodeName(); if (errorCodeName != null) { logger.info(String.format("Processing [%s] error code from GCM response, for registration ID: [%s]", errorCodeName, registrationIDs.get(i))); } String canonicalRegId = result.getCanonicalRegistrationId(); if (canonicalRegId != null) { <START> Installation installation = clientInstallationService.findInstallationForVariantByDeviceToken(variantID,registrationIDs.get(i)); <END> installation.setDeviceToken(canonicalRegId); logger.info(String.format("Based on returned canonical id from GCM, updating Android installations with registration id [%s] with new token [%s] ", registrationIDs.get(i), canonicalRegId)); clientInstallationService.updateInstallation(installation); } else { if (GCM_ERROR_CODES.contains(errorCodeName)) { inactiveTokens.add(registrationIDs.get(i)); } } } logger.info(String.format("Based on GCM error response codes, deleting %d invalid Android installations", inactiveTokens.size())); clientInstallationService.removeInstallationsForVariantByDeviceTokens(variantID, inactiveTokens); }</code><technical_language>I need add import for Installation model</technical_language>

Target:
private void cleanupInvalidRegistrationIDsForVariant(String variantID, MulticastResult multicastResult, List<String> registrationIDs) { final List<Result> results = multicastResult.getResults(); final Set<String> inactiveTokens = new HashSet<String>(); for (int i = 0; i < results.size(); i++) { final Result result = results.get(i); final String errorCodeName = result.getErrorCodeName(); if (errorCodeName != null) { logger.info(String.format("Processing [%s] error code from GCM response, for registration ID: [%s]", errorCodeName, registrationIDs.get(i))); } String canonicalRegId = result.getCanonicalRegistrationId(); if (canonicalRegId != null) { Installation installation = clientInstallationService.findInstallationForVariantByDeviceToken(variantID, canonicalRegId); if (installation != null) { inactiveTokens.add(registrationIDs.get(i)); } else { installation = clientInstallationService.findInstallationForVariantByDeviceToken(variantID,registrationIDs.get(i)); installation.setDeviceToken(canonicalRegId); logger.info(String.format("Based on returned canonical id from GCM, updating Android installations with registration id [%s] with new token [%s] ", registrationIDs.get(i), canonicalRegId)); clientInstallationService.updateInstallation(installation); } } else { if (GCM_ERROR_CODES.contains(errorCodeName)) { inactiveTokens.add(registrationIDs.get(i)); } } } if (! inactiveTokens.isEmpty()) { logger.info(String.format("Based on GCM response data and error codes, deleting %d invalid or duplicated Android installations", inactiveTokens.size())); clientInstallationService.removeInstallationsForVariantByDeviceTokens(variantID, inactiveTokens); } }