/** * Creates an integration datum for the current user. * * @param userDetails information about the authenticated user. * @return the integration datum. */ private IntegrationDatum createIntegrationDatum(UserDetails userDetails) { IntegrationDatum integrationDatum = new IntegrationDatum(); integrationDatum.setIntegratorEmail(userDetails.getEmail()); integrationDatum.setIntegratorName( userDetails.getFirstName() + " " + userDetails.getLastName()); return integrationDatum; }
/** * Verifies that the user owns the analysis that is being edited. * * @param analysis the analysis. * @param userDetails details about the authenticated user. * @throws AnalysisOwnershipException if the user does not own the analysis. */ private void verifyUserOwnership(TransformationActivity analysis, UserDetails userDetails) { String integratorEmail = analysis.getIntegrationDatum().getIntegratorEmail(); String authenticatedEmail = userDetails.getEmail(); if (!StringUtils.equals(integratorEmail, authenticatedEmail)) { throw new AnalysisOwnershipException(userDetails.getShortUsername(), analysis.getId()); } }