Class InterviewController

java.lang.Object
com.amos2020.javabackend.rest_service.controller.InterviewController

@Service
public class InterviewController
extends java.lang.Object
  • Field Details

  • Constructor Details

  • Method Details

    • getInterviewById

      public BasicInterviewResponse getInterviewById​(int interviewId) throws javassist.NotFoundException
      Get a specific interview by an id
      Parameters:
      interviewId - int
      Returns:
      Interview or Exception
      Throws:
      javassist.NotFoundException - if interview does not exist
    • getAllInterviews

      public java.util.List<BasicInterviewResponse> getAllInterviews() throws javassist.NotFoundException
      Get all existing interviews
      Returns:
      all interviews
      Throws:
      javassist.NotFoundException - if contactPersonIds are not valid and therefore can not be found
    • getAllInterviewsByAuditId

      public java.util.List<BasicInterviewResponse> getAllInterviewsByAuditId​(int auditId) throws javassist.NotFoundException
      Get all existing interviews by an auditId
      Parameters:
      auditId - int
      Returns:
      all interviews
      Throws:
      javassist.NotFoundException - if contactPersonIds are not valid and therefore can not be found
    • createInterview

      public BasicInterviewResponse createInterview​(int auditId, java.sql.Date startDate, java.sql.Date endDate, java.lang.String goal, java.util.List<InterviewPerson> interviewedPeople, java.util.List<java.lang.Integer> interviewScope) throws javassist.NotFoundException
      Create a new Interview, the associated InterviewContactPersons and empty Answers for the scope of FacCrits
      Parameters:
      auditId - int
      startDate - Date
      endDate - Date
      interviewedPeople - List of ContactPersonId and Role
      interviewScope - List of FacCritIds
      Returns:
      New interview
      Throws:
      javassist.NotFoundException - If the auditId, an contactPersonId or an facCritId is invalid
    • updateInterview

      public BasicInterviewResponse updateInterview​(int interviewId, java.sql.Date startDate, java.sql.Date endDate, InterviewStatus status, java.lang.String note) throws javassist.NotFoundException
      Update the startDate, endDate and status of the interview
      Parameters:
      interviewId - int
      startDate - Date
      endDate - Date
      status - InterviewStatus
      Returns:
      Updated Interview
      Throws:
      javassist.NotFoundException - If stored contactPersonIds are not valid and therefore can not be found
    • addContactPersonToInterview

      public BasicInterviewResponse addContactPersonToInterview​(int interviewId, int contactPersonId, java.lang.String role) throws javassist.NotFoundException
      Add a new ContactPerson to an interview if there does not already exists an InterviewContactPerson
      Parameters:
      interviewId - int
      contactPersonId - int
      role - String
      Returns:
      Updated Interview with the new ContactPerson
      Throws:
      javassist.NotFoundException - If interview or contactPerson does not exist
    • removeContactPersonFromInterview

      public BasicInterviewResponse removeContactPersonFromInterview​(int interviewId, int contactPersonId) throws javassist.NotFoundException
      Remove a ContactPerson from an existing interview
      Parameters:
      interviewId - int
      contactPersonId - int
      Returns:
      Updated Interview
      Throws:
      javassist.NotFoundException - If the if for the interview, contactPerson or the interviewContactPerson is not valid
    • getContactPersonsForInterview

      private java.util.List<ContactPerson> getContactPersonsForInterview​(Interview interview) throws javassist.NotFoundException
      Helper method for receiving the List of ContactPersons associated with the Interview
      Parameters:
      interview - Interview
      Returns:
      List of ContactPersons
      Throws:
      javassist.NotFoundException - If stored contactPersonIds are not valid and therefore can not be found
    • assertIdIsValid

      private void assertIdIsValid​(int id) throws java.lang.IllegalArgumentException
      Asserts that the given id is valid
      Parameters:
      id - Integer
      Throws:
      java.lang.IllegalArgumentException