예제 #1
0
  private void copyPatientConsents(
      ClientRegistration oldRegistration, ClientRegistration newRegistration)
      throws CloneNotSupportedException {
    PatientConsent newConsent;
    for (PatientConsent consent : oldRegistration.getPatientConsents()) {
      newConsent = consent.clone();
      newConsent.setConsentId(null);
      newConsent.setClientRegistration(newRegistration);

      entityManager.persist(newConsent);
      entityManager.flush();
    }
  }
예제 #2
0
  private void copyRegistrationQuestionAnswers(
      ClientRegistration oldRegistration, ClientRegistration newRegistration)
      throws CloneNotSupportedException {
    RegistrationQuestionAnswers newRegistrationQuestionAnswers;

    for (RegistrationQuestionAnswers answers : oldRegistration.getRegistrationQuestionAnswerses()) {
      newRegistrationQuestionAnswers = answers.clone();
      newRegistrationQuestionAnswers.setId(null);
      newRegistrationQuestionAnswers.setClientRegistration(newRegistration);

      entityManager.persist(newRegistrationQuestionAnswers);
      entityManager.flush();
    }
  }
예제 #3
0
  private void copyScopesQuestions(
      ClientRegistration oldRegistration, ClientRegistration newRegistration)
      throws CloneNotSupportedException {
    ScopesQuestions newQuestions;

    for (ScopesQuestions questions : oldRegistration.getScopesQuestions()) {
      newQuestions = questions.clone();
      newQuestions.setScopes_question_id(null);
      newQuestions.setClientRegistration(newRegistration);

      entityManager.persist(newQuestions);
      entityManager.flush();
    }
  }
예제 #4
0
  private void copyClientRegistrations(Appointment oldAppointment, Appointment newAppointment)
      throws CloneNotSupportedException {
    ClientRegistration newRegistration;
    for (ClientRegistration registration : oldAppointment.getClientRegistration()) {
      newRegistration = registration.clone();
      newRegistration.setRegistrationId(null);
      newRegistration.setPatientConsents(null);
      newRegistration.setRegistrationQuestionAnswerses(null);
      newRegistration.setScopesQuestions(null);
      newRegistration.setAppointment(newAppointment);

      entityManager.persist(newRegistration);
      entityManager.flush();
      copyPatientConsents(registration, newRegistration);
      copyRegistrationQuestionAnswers(registration, newRegistration);
    }
  }