/**
  * 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;
 }
 /**
  * Finds an analysis in the database.
  *
  * @param daoFactory used to obtain data access objects.
  * @param analysisId the analysis identifier.
  * @return the analysis;
  * @throws AnalysisNotFoundException if an analysis with the given ID can't be found.
  */
 private TransformationActivity getAnalysis(DaoFactory daoFactory, String analysisId) {
   TransformationActivity analysis =
       daoFactory.getTransformationActivityDao().findById(analysisId);
   if (analysis == null) {
     throw new AnalysisNotFoundException(analysisId);
   }
   return analysis;
 }