Source:
public Study updateStudy(Study study, boolean isAdminUpdate) { checkNotNull(study, Validate.CANNOT_BE_NULL, "study"); Study originalStudy = studyDao.getStudy(study.getIdentifier()); checkViolationConstraints(originalStudy, study); if (!isAdminUpdate) { if (!originalStudy.isActive()) { throw new EntityNotFoundException(Study.class, "Study '"+ study.getIdentifier() +"' not found."); } study.setHealthCodeExportEnabled(originalStudy.isHealthCodeExportEnabled()); study.setEmailVerificationEnabled(originalStudy.isEmailVerificationEnabled()); study.setExternalIdValidationEnabled(originalStudy.isExternalIdValidationEnabled()); study.setExternalIdRequiredOnSignup(originalStudy.isExternalIdRequiredOnSignup()); study.setEmailSignInEnabled(originalStudy.isEmailSignInEnabled()); study.setReauthenticationEnabled(originalStudy.isReauthenticationEnabled()); study.setAccountLimit(originalStudy.getAccountLimit()); study.setStudyIdExcludedInExport(originalStudy.isStudyIdExcludedInExport()); study.setAutoVerificationPhoneSuppressed(originalStudy.isAutoVerificationPhoneSuppressed()); } if (originalStudy.isActive() && !study.isActive()) { throw new BadRequestException("Study cannot be deleted through an update."); } setDefaultsIfAbsent(study); sanitizeHTML(study); Validate.entityThrowingException(validator, study); if (originalStudy.isConsentNotificationEmailVerified() == null) { study.setConsentNotificationEmailVerified(true); } else if (!originalStudy.isConsentNotificationEmailVerified()) { study.setConsentNotificationEmailVerified(false); } if (!isAdminUpdate) { checkUploadMetadataConstraints(originalStudy, study); } Study updatedStudy = updateAndCacheStudy(study); if (!originalStudy.getSupportEmail().equals(study.getSupportEmail())) { emailVerificationService.verifyEmailAddress(study.getSupportEmail()); } if (!originalStudy.getConsentNotificationEmail().equals(study.getConsentNotificationEmail())) { study.setConsentNotificationEmailVerified(false); sendVerifyEmail(study, StudyEmailType.CONSENT_NOTIFICATION); } return updatedStudy; }

Target:
public Study updateStudy(Study study, boolean isAdminUpdate) { checkNotNull(study, Validate.CANNOT_BE_NULL, "study"); Study originalStudy = studyDao.getStudy(study.getIdentifier()); checkViolationConstraints(originalStudy, study); if (!isAdminUpdate) { if (!originalStudy.isActive()) { throw new EntityNotFoundException(Study.class, "Study '"+ study.getIdentifier() +"' not found."); } study.setHealthCodeExportEnabled(originalStudy.isHealthCodeExportEnabled()); study.setEmailVerificationEnabled(originalStudy.isEmailVerificationEnabled()); study.setExternalIdValidationEnabled(originalStudy.isExternalIdValidationEnabled()); study.setExternalIdRequiredOnSignup(originalStudy.isExternalIdRequiredOnSignup()); study.setEmailSignInEnabled(originalStudy.isEmailSignInEnabled()); study.setPhoneSignInEnabled(originalStudy.isPhoneSignInEnabled()); study.setReauthenticationEnabled(originalStudy.isReauthenticationEnabled()); study.setAccountLimit(originalStudy.getAccountLimit()); study.setStudyIdExcludedInExport(originalStudy.isStudyIdExcludedInExport()); } if (originalStudy.isActive() && !study.isActive()) { throw new BadRequestException("Study cannot be deleted through an update."); } setDefaultsIfAbsent(study); sanitizeHTML(study); Validate.entityThrowingException(validator, study); if (originalStudy.isConsentNotificationEmailVerified() == null) { study.setConsentNotificationEmailVerified(true); } else if (!originalStudy.isConsentNotificationEmailVerified()) { study.setConsentNotificationEmailVerified(false); } if (!isAdminUpdate) { checkUploadMetadataConstraints(originalStudy, study); } Study updatedStudy = updateAndCacheStudy(study); if (!originalStudy.getSupportEmail().equals(study.getSupportEmail())) { emailVerificationService.verifyEmailAddress(study.getSupportEmail()); } if (!originalStudy.getConsentNotificationEmail().equals(study.getConsentNotificationEmail())) { study.setConsentNotificationEmailVerified(false); sendVerifyEmail(study, StudyEmailType.CONSENT_NOTIFICATION); } return updatedStudy; }