Esempio n. 1
0
  public ActionForward showTeacherCredits(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws NumberFormatException, FenixServiceException, ParseException {

    DynaActionForm teacherCreditsForm = (DynaActionForm) form;
    ExecutionSemester executionSemester =
        FenixFramework.getDomainObject((String) teacherCreditsForm.get("executionPeriodId"));

    Teacher requestedTeacher =
        FenixFramework.getDomainObject((String) teacherCreditsForm.get("teacherId"));

    User userView = Authenticate.getUser();
    Teacher loggedTeacher = userView.getPerson().getTeacher();

    if (requestedTeacher == null || loggedTeacher != requestedTeacher) {
      ActionMessages actionMessages = new ActionMessages();
      actionMessages.add("", new ActionMessage("message.invalid.teacher"));
      saveMessages(request, actionMessages);
      return mapping.findForward("teacher-not-found");
    }

    showLinks(request, executionSemester, RoleType.DEPARTMENT_MEMBER);
    getAllTeacherCredits(request, executionSemester, requestedTeacher);
    return mapping.findForward("show-teacher-credits");
  }
  public List<InfoExecutionCourse> run(
      InfoExecutionPeriod infoExecutionPeriod,
      InfoExecutionDegree infoExecutionDegree,
      InfoCurricularYear infoCurricularYear,
      String executionCourseName) {

    List<InfoExecutionCourse> result = null;

    final ExecutionSemester executionSemester =
        FenixFramework.getDomainObject(infoExecutionPeriod.getExternalId());

    ExecutionDegree executionDegree = null;
    if (infoExecutionDegree != null) {
      executionDegree = FenixFramework.getDomainObject(infoExecutionDegree.getExternalId());
    }

    CurricularYear curricularYear = null;
    if (infoCurricularYear != null) {
      curricularYear = FenixFramework.getDomainObject(infoCurricularYear.getExternalId());
    }

    List<ExecutionCourse> executionCourses = new ArrayList<ExecutionCourse>();
    if (executionSemester != null) {
      executionCourses =
          executionSemester
              .getExecutionCoursesByDegreeCurricularPlanAndSemesterAndCurricularYearAndName(
                  executionDegree.getDegreeCurricularPlan(), curricularYear, executionCourseName);
    }

    return fillInfoExecutionCourses(executionSemester.getAcademicInterval(), executionCourses);
  }
 public boolean deleteResults() {
   Professorship professorship = null;
   try {
     professorship = FenixFramework.getDomainObject(getProfessorshipOID().toString());
   } catch (ClassCastException cce) {
     throw new DomainException("error.professorship.dontExist", cce.getCause());
   } catch (MissingObjectException moe) {
     throw new DomainException("error.professorship.dontExist", moe.getCause());
   }
   setExecutionCourseOID(null);
   if (getShiftType() != null) {
     InquiryQuestion inquiryQuestion = null;
     if (getInquiryQuestionOID() != null) {
       try {
         inquiryQuestion = FenixFramework.getDomainObject(getInquiryQuestionOID().toString());
       } catch (ClassCastException cce) {
         throw new DomainException("error.inquiryQuestion.dontExist", cce.getCause());
       } catch (MissingObjectException moe) {
         throw new DomainException("error.inquiryQuestion.dontExist", moe.getCause());
       }
     }
     return professorship.deleteInquiryResults(getShiftType(), inquiryQuestion);
   } else {
     setInquiryQuestionOID(null);
     return professorship.deleteInquiryResults();
   }
 }
 public Lesson getLesson() {
   if (!Strings.isNullOrEmpty(getExternalId())) {
     Lesson lesson = FenixFramework.getDomainObject(getExternalId());
     if (FenixFramework.isDomainObjectValid(lesson)) {
       return lesson;
     }
   }
   return null;
 }
  protected Boolean run(
      final String executionCourseCode, final String groupPropertiesCode, final String[] selected)
      throws FenixServiceException {

    if (selected == null) {
      return Boolean.TRUE;
    }

    final Grouping groupProperties = FenixFramework.getDomainObject(groupPropertiesCode);
    if (groupProperties == null) {
      throw new ExistingServiceException();
    }

    final List<ExecutionCourse> executionCourses = groupProperties.getExecutionCourses();
    StringBuilder sbStudentNumbers = new StringBuilder("");
    sbStudentNumbers.setLength(0);
    // studentCodes list has +1 entry if "select all" was selected
    int totalStudentsProcessed = 0;

    for (final String number : selected) {
      if (number.equals("Todos os Alunos")) {
      } else {
        Registration registration = FenixFramework.getDomainObject(number);
        if (!studentHasSomeAttendsInGrouping(registration, groupProperties)) {
          final Attends attends = findAttends(registration, executionCourses);
          if (attends != null) {
            if (sbStudentNumbers.length() != 0) {
              sbStudentNumbers.append(", " + registration.getNumber().toString());
            } else {
              sbStudentNumbers.append(registration.getNumber().toString());
            }
            totalStudentsProcessed++;
            groupProperties.addAttends(attends);
          }
        }
      }
    }

    if (totalStudentsProcessed > 0) {
      List<ExecutionCourse> ecs = groupProperties.getExecutionCourses();
      for (ExecutionCourse ec : ecs) {
        GroupsAndShiftsManagementLog.createLog(
            ec,
            Bundle.MESSAGING,
            "log.executionCourse.groupAndShifts.grouping.attends.added",
            Integer.toString(totalStudentsProcessed),
            sbStudentNumbers.toString(),
            groupProperties.getName(),
            ec.getNome(),
            ec.getDegreePresentationString());
      }
    }

    return Boolean.TRUE;
  }
Esempio n. 6
0
  @Atomic
  public static void writeByAttend(
      final String executioCourseOID, final String evaluationOID, final List<AttendsMark> marks)
      throws FenixServiceException {
    check(RolePredicates.TEACHER_PREDICATE);

    final Evaluation evaluation = FenixFramework.getDomainObject(evaluationOID);
    final ExecutionCourse executionCourse = FenixFramework.getDomainObject(executioCourseOID);

    writeMarks(marks, executionCourse, evaluation);
  }
Esempio n. 7
0
 @Atomic
 public static void run(final String degreeModuleID, final String contextID)
     throws FenixServiceException {
   final DegreeModule degreeModule = FenixFramework.getDomainObject(degreeModuleID);
   if (degreeModule == null) {
     throw new FenixServiceException("error.noDegreeModule");
   }
   final Context context = FenixFramework.getDomainObject(contextID);
   if (context == null) {
     throw new FenixServiceException("error.noCourseGroup");
   }
   degreeModule.deleteContext(context);
 }
  protected void run(String tsdId, final String courseId) throws FenixServiceException {

    TeacherServiceDistribution rootTSD =
        FenixFramework.<TeacherServiceDistribution>getDomainObject(tsdId).getRootTSD();
    CompetenceCourse course = FenixFramework.getDomainObject(courseId);

    if (!rootTSD.getCompetenceCourses().contains(course)) {
      for (ExecutionSemester period :
          rootTSD.getTSDProcessPhase().getTSDProcess().getExecutionPeriods()) {
        if (course.getCurricularCoursesWithActiveScopesInExecutionPeriod(period).size() > 0) {
          new TSDCompetenceCourse(rootTSD, course, period);
        }
      }
    }
  }
Esempio n. 9
0
  protected Boolean run(
      ExecutionCourse executionCourseId,
      String metadataId,
      String author,
      String description,
      String difficulty,
      Calendar learningTime,
      String level,
      String mainSubject,
      String secondarySubject)
      throws FenixServiceException {
    Metadata metadata = FenixFramework.getDomainObject(metadataId);
    if (metadata == null) {
      throw new InvalidArgumentsServiceException();
    }

    if (author != null) {
      metadata.setAuthor(author);
    }
    if (!difficulty.equals("-1")) {
      metadata.setDifficulty(difficulty);
    }
    metadata.setDescription(description);
    metadata.setLearningTime(learningTime);
    metadata.setLevel(level);
    metadata.setMainSubject(mainSubject);
    metadata.setSecondarySubject(secondarySubject);

    return true;
  }
 private Student getAndSetStudent(final HttpServletRequest request) {
   final String studentID = getFromRequest(request, "studentID").toString();
   final Student student = FenixFramework.getDomainObject(studentID);
   request.setAttribute("student", student);
   request.setAttribute("choosePhdOrRegistration", new ChooseRegistrationOrPhd(student));
   return student;
 }
Esempio n. 11
0
 /**
  * @param Integer executionCourseID used in filtering
  *     (ExecutionCourseLecturingTeacherAuthorizationFilter)
  */
 protected void run(String executionCourseID, String evaluationID) throws FenixServiceException {
   final Evaluation evaluation = FenixFramework.getDomainObject(evaluationID);
   if (evaluation == null) {
     throw new FenixServiceException("error.noEvaluation");
   }
   evaluation.delete();
 }
  public ActionForward inputValidationCode(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response) {
    final String code = (String) getFromRequest(request, "validationCode");
    final String extId = (String) getFromRequest(request, "partyContactValidation");

    if (StringUtils.isEmpty(code) || StringUtils.isEmpty(extId)) {
      addActionMessage("contacts", request, "error.contacts.validation.token.empty");
      return mapping.findForward("inputValidationCode");
    }
    PartyContactValidation partyContactValidation;

    final PhysicalAddressValidationBean validationBean =
        getRenderedObject("physicalAddressValidationBean");
    if (validationBean != null) {
      partyContactValidation = validationBean.getValidation();
    } else {
      partyContactValidation = FenixFramework.getDomainObject(extId);
      partyContactValidation.processValidation(code);
    }
    return forwardToInputValidationCode(
        mapping, actionForm, request, response, partyContactValidation.getPartyContact());
  }
  public ActionForward showVotingResults(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    final String forwardTo = (String) getFromRequest(request, "forwardTo");

    final ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();

    final YearDelegateElection yearDelegateElection =
        (YearDelegateElection)
            FenixFramework.getDomainObject(
                (String) getFromRequest(request, "selectedVotingPeriod"));

    final ExecutionYear executionYear = yearDelegateElection.getExecutionYear();

    List<DelegateElectionResultsByStudentDTO> electionResultsByStudentDTOList =
        yearDelegateElection.getLastVotingPeriod().getDelegateElectionResults();

    ElectionPeriodBean bean = new ElectionPeriodBean();
    bean.setCurricularYear(yearDelegateElection.getCurricularYear());
    bean.setDegree(yearDelegateElection.getDegree());
    bean.setDegreeType(yearDelegateElection.getDegree().getDegreeType());
    bean.setElection(yearDelegateElection);
    bean.setExecutionYear(executionYear);

    request.setAttribute("currentExecutionYear", currentExecutionYear);
    request.setAttribute("electionPeriodBean", bean);
    request.setAttribute("votingResultsByStudent", electionResultsByStudentDTOList);
    return mapping.findForward(forwardTo);
  }
  public ActionForward showCandidates(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    final ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();

    final YearDelegateElection yearDelegateElection =
        (YearDelegateElection)
            FenixFramework.getDomainObject(request.getParameter("selectedCandidacyPeriod"));
    Collection<Student> candidates = yearDelegateElection.getCandidatesSet();

    final ExecutionYear executionYear = yearDelegateElection.getExecutionYear();

    ElectionPeriodBean bean = new ElectionPeriodBean();
    bean.setCurricularYear(yearDelegateElection.getCurricularYear());
    bean.setDegree(yearDelegateElection.getDegree());
    bean.setDegreeType(yearDelegateElection.getDegree().getDegreeType());
    bean.setElection(yearDelegateElection);
    bean.setExecutionYear(executionYear);

    if (request.getParameter("showPhotos") != null) {
      request.setAttribute("candidatesWithPhotos", candidates);
    } else {
      request.setAttribute("candidatesWithoutPhotos", candidates);
    }

    request.setAttribute("currentExecutionYear", currentExecutionYear);
    request.setAttribute("electionPeriodBean", bean);
    return mapping.findForward("showCandidates");
  }
  @Atomic
  public static ActionError run(String selectedGroupProposalOID) throws FenixServiceException {
    final GroupProposal groupProposal = FenixFramework.getDomainObject(selectedGroupProposalOID);
    if (groupProposal != null) {
      final Proposal proposal = groupProposal.getFinalDegreeWorkProposal();
      final FinalDegreeWorkGroup group = groupProposal.getFinalDegreeDegreeWorkGroup();

      if (proposal != null && group != null) {
        final Proposal proposalAttributedToGroup = group.getProposalAttributedByTeacher();
        if (proposalAttributedToGroup != null && proposalAttributedToGroup != proposal) {

          return new ActionError(
              "error.message.GroupAlreadyAttributed",
              proposalAttributedToGroup.getProposalNumber());
        }

        if (proposal.getGroupAttributedByTeacher() == null
            || proposal.getGroupAttributedByTeacher() != group) {
          proposal.setGroupAttributedByTeacher(group);
          for (GroupProposal otherGroupProposal : group.getGroupProposalsSet()) {
            Proposal otherProposal = otherGroupProposal.getFinalDegreeWorkProposal();
            if (otherProposal != proposal && group == otherProposal.getGroupAttributedByTeacher()) {
              otherProposal.setGroupAttributedByTeacher(null);
            }
          }
        } else {
          proposal.setGroupAttributedByTeacher(null);
        }
      }
    }
    return null;
  }
  @Atomic
  public static List run(
      String executionDegreeId, String executionPeriodId, Integer curricularYearInt)
      throws FenixServiceException {

    if (executionPeriodId == null) {
      throw new FenixServiceException("nullExecutionPeriodId");
    }

    final ExecutionSemester executionSemester = FenixFramework.getDomainObject(executionPeriodId);

    final List<ExecutionCourse> executionCourseList;
    if (executionDegreeId == null && curricularYearInt == null) {
      executionCourseList = executionSemester.getExecutionCoursesWithNoCurricularCourses();
    } else {
      final ExecutionDegree executionDegree =
          findExecutionDegreeByID(executionSemester, executionDegreeId);
      final DegreeCurricularPlan degreeCurricularPlan = executionDegree.getDegreeCurricularPlan();
      final CurricularYear curricularYear = CurricularYear.readByYear(curricularYearInt);
      executionCourseList =
          executionSemester
              .getExecutionCoursesByDegreeCurricularPlanAndSemesterAndCurricularYearAndName(
                  degreeCurricularPlan, curricularYear, "%");
    }

    final List infoExecutionCourseList = new ArrayList(executionCourseList.size());
    for (final ExecutionCourse executionCourse : executionCourseList) {
      infoExecutionCourseList.add(InfoExecutionCourse.newInfoFromDomain(executionCourse));
    }

    return infoExecutionCourseList;
  }
Esempio n. 17
0
public class LockManager {

  private static final String ALIAS = FenixFramework.<JvstmOJBConfig>getConfig().getDbAlias();

  @SuppressWarnings("resource")
  public static boolean acquireDistributedLock(String lockName) {
    try {
      Connection connection = ConnectionManager.getCurrentSQLConnection();
      Statement statement = connection.createStatement();
      ResultSet resultSet =
          statement.executeQuery("SELECT GET_LOCK('" + lockName + ALIAS + "', 10)");

      boolean result = resultSet.next() && (resultSet.getInt(1) == 1);
      resultSet.close();
      statement.close();

      return result;
    } catch (SQLException e) {
      throw new Error(e);
    }
  }

  @SuppressWarnings("resource")
  public static void releaseDistributedLock(String lockName) {
    try {
      Connection connection = ConnectionManager.getCurrentSQLConnection();
      Statement statement = connection.createStatement();
      statement.executeUpdate("DO RELEASE_LOCK('" + lockName + ALIAS + "')");

      statement.close();
    } catch (SQLException e) {
      throw new Error(e);
    }
  }
}
Esempio n. 18
0
  @Atomic
  public static InfoSiteStudentsAndGroups run(String groupingId) throws FenixServiceException {
    InfoSiteStudentsAndGroups infoSiteStudentsAndGroups = new InfoSiteStudentsAndGroups();

    Grouping grouping = FenixFramework.getDomainObject(groupingId);

    if (grouping == null) {
      throw new ExistingServiceException();
    }

    List infoSiteStudentsAndGroupsList = new ArrayList();
    List studentGroups = getAllStudentGroups(grouping);
    Iterator iterStudentGroups = studentGroups.iterator();
    while (iterStudentGroups.hasNext()) {

      Collection studentGroupAttendList;
      StudentGroup studentGroup = (StudentGroup) iterStudentGroups.next();

      studentGroupAttendList = studentGroup.getAttends();

      Iterator iterStudentGroupAttendList = studentGroupAttendList.iterator();
      InfoSiteStudentInformation infoSiteStudentInformation = null;
      InfoSiteStudentAndGroup infoSiteStudentAndGroup = null;
      Attends attend = null;

      while (iterStudentGroupAttendList.hasNext()) {
        infoSiteStudentInformation = new InfoSiteStudentInformation();
        infoSiteStudentAndGroup = new InfoSiteStudentAndGroup();

        attend = (Attends) iterStudentGroupAttendList.next();

        infoSiteStudentAndGroup.setInfoStudentGroup(
            InfoStudentGroup.newInfoFromDomain(studentGroup));

        infoSiteStudentInformation.setNumber(attend.getRegistration().getNumber());

        infoSiteStudentInformation.setName(attend.getRegistration().getPerson().getName());

        infoSiteStudentInformation.setUsername(
            (attend.getRegistration().getPerson().getUsername()));

        infoSiteStudentInformation.setEmail(attend.getRegistration().getPerson().getEmail());

        infoSiteStudentInformation.setPersonID(
            attend.getRegistration().getPerson().getExternalId());

        infoSiteStudentAndGroup.setInfoSiteStudentInformation(infoSiteStudentInformation);

        infoSiteStudentsAndGroupsList.add(infoSiteStudentAndGroup);
      }
    }

    Collections.sort(
        infoSiteStudentsAndGroupsList, new BeanComparator("infoStudentGroup.groupNumber"));

    infoSiteStudentsAndGroups.setInfoSiteStudentsAndGroupsList(infoSiteStudentsAndGroupsList);
    infoSiteStudentsAndGroups.setInfoGrouping(InfoGrouping.newInfoFromDomain(grouping));

    return infoSiteStudentsAndGroups;
  }
Esempio n. 19
0
  protected InfoCandidacy run(String id) {
    InfoCandidacy infoCandidacy = null;

    SeminaryCandidacy candidacy = FenixFramework.getDomainObject(id);
    infoCandidacy = InfoCandidacyWithCaseStudyChoices.newInfoFromDomain(candidacy);

    return infoCandidacy;
  }
 public CompetenceCourse getCompetenceCourse() {
   if (competenceCourse == null
       && getCompetenceCourseID() != null
       && !getCompetenceCourseID().equals(NO_SELECTION_STRING)) {
     competenceCourse = FenixFramework.getDomainObject(getCompetenceCourseID());
   }
   return competenceCourse;
 }
Esempio n. 21
0
  @Override
  void execution() throws LdoDException {
    this.fragInter = (FragInter) FenixFramework.getDomainObject(this.fragInterExternalID);

    PlainHtmlWriter4OneInter writer = new PlainHtmlWriter4OneInter(this.fragInter);

    this.fragInter.getFragment().getTextPortion().accept(writer);
    transcription = writer.getTranscription();
  }
 private Project getProjectFromID(String projectID) {
   Unit project = FenixFramework.getDomainObject(projectID);
   if (project instanceof Project) {
     return (Project) project;
   } else if (project instanceof SubProject) {
     return (Project) ((SubProject) project).getParentUnit();
   }
   return null;
 }
 protected Registration getAndSetRegistration(final HttpServletRequest request) {
   final String registrationID =
       getFromRequest(request, "registrationID") != null
           ? getFromRequest(request, "registrationID").toString()
           : getFromRequest(request, "registrationId").toString();
   final Registration registration = FenixFramework.getDomainObject(registrationID);
   request.setAttribute("registration", registration);
   return registration;
 }
Esempio n. 24
0
  /**
   * Executes the service. Returns the current InfoCurricularCourse.
   *
   * @throws ExcepcaoPersistencia
   */
  protected InfoCurricularCourse run(String externalId) throws FenixServiceException {
    CurricularCourse curricularCourse;
    curricularCourse = (CurricularCourse) FenixFramework.getDomainObject(externalId);

    if (curricularCourse == null) {
      throw new NonExistingServiceException();
    }

    return InfoCurricularCourse.newInfoFromDomain(curricularCourse);
  }
Esempio n. 25
0
  @Atomic
  public static void run(InfoShift infoShift, List<String> schoolClassOIDs)
      throws FenixServiceException {
    check(RolePredicates.RESOURCE_ALLOCATION_MANAGER_PREDICATE);

    final Shift shift = FenixFramework.getDomainObject(infoShift.getExternalId());
    if (shift == null) {
      throw new InvalidArgumentsServiceException();
    }

    for (final String schoolClassOID : schoolClassOIDs) {
      final SchoolClass schoolClass = FenixFramework.getDomainObject(schoolClassOID);
      if (schoolClass == null) {
        throw new InvalidArgumentsServiceException();
      }

      shift.associateSchoolClass(schoolClass);
    }
  }
 public Evaluation getEvaluation() {
   try {
     if (this.evaluation == null && this.getEvaluationID() != null) {
       this.evaluation = FenixFramework.getDomainObject(this.getEvaluationID());
     }
     return this.evaluation;
   } catch (Exception e) {
     return null;
   }
 }
 @Atomic
 public static void run(
     final String attendsID,
     final Integer contact,
     final Integer autonomousStudy,
     final Integer other) {
   check(RolePredicates.STUDENT_PREDICATE);
   final Attends attends = FenixFramework.getDomainObject(attendsID);
   attends.createWeeklyWorkLoad(contact, autonomousStudy, other);
 }
Esempio n. 28
0
  protected Boolean run(
      String executionCourseID,
      String studentGroupID,
      String groupPropertiesID,
      List studentUsernames)
      throws FenixServiceException {

    final StudentGroup studentGroup = FenixFramework.getDomainObject(studentGroupID);
    if (studentGroup == null) {
      throw new InvalidArgumentsServiceException();
    }

    final Grouping grouping = studentGroup.getGrouping();
    final IGroupEnrolmentStrategyFactory enrolmentGroupPolicyStrategyFactory =
        GroupEnrolmentStrategyFactory.getInstance();
    final IGroupEnrolmentStrategy strategy =
        enrolmentGroupPolicyStrategyFactory.getGroupEnrolmentStrategyInstance(grouping);

    if (!strategy.checkStudentsUserNamesInGrouping(studentUsernames, grouping)) {
      throw new InvalidArgumentsServiceException();
    }

    StringBuilder sbStudentNumbers = new StringBuilder("");
    sbStudentNumbers.setLength(0);
    for (final String studentUsername : (List<String>) studentUsernames) {
      Attends attend = grouping.getStudentAttend(studentUsername);
      if (attend != null) {
        if (sbStudentNumbers.length() != 0) {
          sbStudentNumbers.append(", " + attend.getRegistration().getNumber().toString());
        } else {
          sbStudentNumbers.append(attend.getRegistration().getNumber().toString());
        }
        attend.removeStudentGroups(studentGroup);
      }
    }

    // no students means no log entry -- list may contain invalid values, so
    // its size cannot be used to test
    if (sbStudentNumbers.length() != 0) {
      List<ExecutionCourse> ecs = grouping.getExecutionCourses();
      for (ExecutionCourse ec : ecs) {
        GroupsAndShiftsManagementLog.createLog(
            ec,
            "resources.MessagingResources",
            "log.executionCourse.groupAndShifts.grouping.group.element.removed",
            Integer.toString(studentUsernames.size()),
            sbStudentNumbers.toString(),
            studentGroup.getGroupNumber().toString(),
            grouping.getName(),
            ec.getNome(),
            ec.getDegreePresentationString());
      }
    }
    return true;
  }
 public DepartmentUnit getDepartmentAndSelectSite() {
   DepartmentUnit department = getDepartmentUnit();
   if (department == null) {
     department =
         FenixFramework.getDomainObject(getAndHoldStringParameter("selectedDepartmentUnitID"));
   }
   if (department != null) {
     OldCmsSemanticURLHandler.selectSite(getRequest(), department.getSite());
   }
   return department;
 }
  @After
  public void tearDown() throws Exception {
    Double duration = ((System.currentTimeMillis() - time) / 1000.0);
    System.out.println("Time: " + duration + "s");

    try {
      FenixFramework.getTransactionManager().rollback();
    } catch (IllegalStateException | SecurityException | SystemException e) {
      e.printStackTrace();
    }
  }