Class AuditController
java.lang.Object
com.amos2020.javabackend.rest_service.controller.AuditController
@Service
public class AuditController
extends java.lang.Object
-
Field Summary
Fields Modifier and Type Field Description (package private) AuditContactPersonServiceauditContactPersonService(package private) AuditServiceauditService(package private) ContactPersonServicecontactPersonService(package private) FacCritServicefacCritService(package private) ScopeServicescopeService -
Constructor Summary
Constructors Constructor Description AuditController(AuditService auditService, ScopeService scopeService, AuditContactPersonService auditContactPersonService, FacCritService facCritService, ContactPersonService contactPersonService) -
Method Summary
Modifier and Type Method Description BasicAuditResponseaddContactPersonToAudit(int auditId, int contactPersonId)Add a contactPerson to an existing auditprivate BasicAuditResponsebuildBasicResponse(Audit audit)Helper method for creating a BasicAuditResponse by a given auditBasicAuditResponsecreateAudit(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)Create a new Auditjava.util.List<BasicAuditResponse>getAllAudits()Get all exiting auditdBasicAuditResponsegetAuditById(int auditId)Get an audit by audit idBasicAuditResponseremoveContactPersonFromAudit(int auditId, int contactPersonId)Remove a contactPerson from an auditBasicAuditResponsesoftDeleteAudit(int auditId, java.sql.Date cancellationDate, java.lang.String reason, int contactPersonId)Soft deleting an existing auditBasicAuditResponseupdateAudit(int auditId, java.lang.String auditName, java.sql.Date startDate, java.sql.Date endDate, AuditStatus status)Update an existing auditBasicAuditResponseupdateAuditScope(int auditId, int facCritId, java.lang.String changeNote, boolean removed, java.lang.String note)Update the scope of an existing audit
-
Field Details
-
Constructor Details
-
AuditController
public AuditController(AuditService auditService, ScopeService scopeService, AuditContactPersonService auditContactPersonService, FacCritService facCritService, ContactPersonService contactPersonService)
-
-
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.NotFoundExceptionCreate a new Audit- Parameters:
auditName- StringstartDate- DateendDate- Datescope- ListcontactPersons- 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.NotFoundExceptionUpdate an existing audit- Parameters:
auditId- intauditName- StringstartDate- DateendDate- Datestatus- 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.NotFoundExceptionAdd a contactPerson to an existing audit- Parameters:
auditId- intcontactPersonId- 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.NotFoundExceptionRemove a contactPerson from an audit- Parameters:
auditId- intcontactPersonId- 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.IllegalAccessExceptionUpdate the scope of an existing audit- Parameters:
auditId- intfacCritId- intchangeNote- Stringremoved- boolnote- String- Returns:
- Updated Audit
- Throws:
javassist.NotFoundException- If audit id or faccrit id are invalid and can not be foundjava.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.NotFoundExceptionSoft deleting an existing audit- Parameters:
auditId- intcancellationDate- Datereason- StringcontactPersonId- int- Returns:
- Deleted Audit
- Throws:
javassist.NotFoundException- If the audit id is invalid and can not be found
-
getAuditById
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
Get all exiting auditd- Returns:
- List of all audits
- Throws:
javassist.NotFoundException
-
buildBasicResponse
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
-