Class AuditController

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

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

  • Constructor Details

  • Method Details

    • createAudit

      public BasicAuditResponse createAudit​(java.lang.String auditName, java.sql.Date startDate, java.sql.Date endDate, java.util.List<java.lang.Integer> scope, java.util.List<java.lang.Integer> contactPersons) throws javassist.NotFoundException
      Create a new Audit
      Parameters:
      auditName - String
      startDate - Date
      endDate - Date
      scope - List
      contactPersons - List
      Returns:
      Created Audit
      Throws:
      javassist.NotFoundException - If a facCrit id or a contactPerson id is invalid and can not be found
    • updateAudit

      public BasicAuditResponse updateAudit​(int auditId, java.lang.String auditName, java.sql.Date startDate, java.sql.Date endDate, AuditStatus status) throws javassist.NotFoundException
      Update an existing audit
      Parameters:
      auditId - int
      auditName - String
      startDate - Date
      endDate - Date
      status - AuditStatus
      Returns:
      Updated Audit
      Throws:
      javassist.NotFoundException - If the audit id is invalid and can not be found
    • addContactPersonToAudit

      public BasicAuditResponse addContactPersonToAudit​(int auditId, int contactPersonId) throws javassist.NotFoundException
      Add a contactPerson to an existing audit
      Parameters:
      auditId - int
      contactPersonId - int
      Returns:
      Updated audit
      Throws:
      javassist.NotFoundException - If the audit id or the contactPerson id are invalid and can not be found
    • removeContactPersonFromAudit

      public BasicAuditResponse removeContactPersonFromAudit​(int auditId, int contactPersonId) throws javassist.NotFoundException
      Remove a contactPerson from an audit
      Parameters:
      auditId - int
      contactPersonId - int
      Returns:
      Updated Audit
      Throws:
      javassist.NotFoundException - If the audit id or the contactPerson id are invalid and can not be found
    • updateAuditScope

      public BasicAuditResponse updateAuditScope​(int auditId, int facCritId, java.lang.String changeNote, boolean removed, java.lang.String note) throws javassist.NotFoundException, java.lang.IllegalAccessException
      Update the scope of an existing audit
      Parameters:
      auditId - int
      facCritId - int
      changeNote - String
      removed - bool
      note - String
      Returns:
      Updated Audit
      Throws:
      javassist.NotFoundException - If audit id or faccrit id are invalid and can not be found
      java.lang.IllegalAccessException - If the Audit has already been soft deleted
    • softDeleteAudit

      public BasicAuditResponse softDeleteAudit​(int auditId, java.sql.Date cancellationDate, java.lang.String reason, int contactPersonId) throws javassist.NotFoundException
      Soft deleting an existing audit
      Parameters:
      auditId - int
      cancellationDate - Date
      reason - String
      contactPersonId - int
      Returns:
      Deleted Audit
      Throws:
      javassist.NotFoundException - If the audit id is invalid and can not be found
    • getAuditById

      public BasicAuditResponse getAuditById​(int auditId) throws javassist.NotFoundException
      Get an audit by audit id
      Parameters:
      auditId - int
      Returns:
      Audit
      Throws:
      javassist.NotFoundException - If the audit id is invalid and can not be found
    • getAllAudits

      public java.util.List<BasicAuditResponse> getAllAudits() throws javassist.NotFoundException
      Get all exiting auditd
      Returns:
      List of all audits
      Throws:
      javassist.NotFoundException
    • buildBasicResponse

      private BasicAuditResponse buildBasicResponse​(Audit audit) throws javassist.NotFoundException
      Helper method for creating a BasicAuditResponse by a given audit
      Parameters:
      audit - Audit
      Returns:
      BasicAuditResponse
      Throws:
      javassist.NotFoundException - If a id is invalid and can not be found