Class InterviewController
java.lang.Object
com.amos2020.javabackend.rest_service.controller.InterviewController
@Service
public class InterviewController
extends java.lang.Object
-
Field Summary
Fields Modifier and Type Field Description (package private) AnswerServiceanswerService(package private) AuditServiceauditService(package private) ContactPersonServicecontactPersonService(package private) FacCritServicefacCritService(package private) InterviewContactPersonServiceinterviewContactPersonService(package private) InterviewServiceinterviewService(package private) QuestionServicequestionService -
Constructor Summary
Constructors Constructor Description InterviewController(InterviewService interviewService, ContactPersonService contactPersonService, AuditService auditService, InterviewContactPersonService interviewContactPersonService, AnswerService answerService, QuestionService questionService, FacCritService facCritService) -
Method Summary
Modifier and Type Method Description BasicInterviewResponseaddContactPersonToInterview(int interviewId, int contactPersonId, java.lang.String role)Add a new ContactPerson to an interview if there does not already exists an InterviewContactPersonprivate voidassertIdIsValid(int id)Asserts that the given id is validBasicInterviewResponsecreateInterview(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)Create a new Interview, the associated InterviewContactPersons and empty Answers for the scope of FacCritsjava.util.List<BasicInterviewResponse>getAllInterviews()Get all existing interviewsjava.util.List<BasicInterviewResponse>getAllInterviewsByAuditId(int auditId)Get all existing interviews by an auditIdprivate java.util.List<ContactPerson>getContactPersonsForInterview(Interview interview)Helper method for receiving the List of ContactPersons associated with the InterviewBasicInterviewResponsegetInterviewById(int interviewId)Get a specific interview by an idBasicInterviewResponseremoveContactPersonFromInterview(int interviewId, int contactPersonId)Remove a ContactPerson from an existing interviewBasicInterviewResponseupdateInterview(int interviewId, java.sql.Date startDate, java.sql.Date endDate, InterviewStatus status, java.lang.String note)Update the startDate, endDate and status of the interview
-
Field Details
-
Constructor Details
-
InterviewController
public InterviewController(InterviewService interviewService, ContactPersonService contactPersonService, AuditService auditService, InterviewContactPersonService interviewContactPersonService, AnswerService answerService, QuestionService questionService, FacCritService facCritService)
-
-
Method Details
-
getInterviewById
Get a specific interview by an id- Parameters:
interviewId- int- Returns:
- Interview or Exception
- Throws:
javassist.NotFoundException- if interview does not exist
-
getAllInterviews
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.NotFoundExceptionGet 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.NotFoundExceptionCreate a new Interview, the associated InterviewContactPersons and empty Answers for the scope of FacCrits- Parameters:
auditId- intstartDate- DateendDate- DateinterviewedPeople- List of ContactPersonId and RoleinterviewScope- 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.NotFoundExceptionUpdate the startDate, endDate and status of the interview- Parameters:
interviewId- intstartDate- DateendDate- Datestatus- 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.NotFoundExceptionAdd a new ContactPerson to an interview if there does not already exists an InterviewContactPerson- Parameters:
interviewId- intcontactPersonId- introle- 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.NotFoundExceptionRemove a ContactPerson from an existing interview- Parameters:
interviewId- intcontactPersonId- 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.NotFoundExceptionHelper 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.IllegalArgumentExceptionAsserts that the given id is valid- Parameters:
id- Integer- Throws:
java.lang.IllegalArgumentException
-