コード例 #1
0
 /**
  * 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());
   }
 }
コード例 #2
0
 /**
  * Obtains the first template associated with an analysis.
  *
  * @param daoFactory used to obtain data access objects.
  * @param analysis the analysis.
  * @return the template.
  * @throws templateNotFoundException if the template can't be found.
  */
 private Template getFirstTemplate(DaoFactory daoFactory, TransformationActivity analysis) {
   String templateId = analysis.step(0).getTemplateId();
   Template template = daoFactory.getTemplateDao().findById(templateId);
   if (template == null) {
     throw new TemplateNotFoundException(templateId);
   }
   return template;
 }
コード例 #3
0
 /**
  * Verifies that Tito is capable of editing the analysis based on the number of steps.
  *
  * @param analysis the analysis to validate.
  */
 private void verifyNumberOfSteps(TransformationActivity analysis) {
   if (analysis.getStepCount() != 1) {
     throw new AnalysisStepCountException(analysis.getId(), analysis.getStepCount());
   }
 }