Search in sources :

Example 1 with AuditJobStatusesModel

use of com.synopsys.integration.alert.common.rest.model.AuditJobStatusesModel in project hub-alert by blackducksoftware.

the class AuditEntryActions method queryForAuditInfoInJobs.

public ActionResponse<AuditJobStatusesModel> queryForAuditInfoInJobs(JobIdsRequestModel queryRequestModel) {
    if (!authorizationManager.hasReadPermission(ConfigContextEnum.GLOBAL, descriptorKey)) {
        return new ActionResponse<>(HttpStatus.FORBIDDEN, ActionResponse.FORBIDDEN_MESSAGE);
    }
    List<UUID> jobIds = queryRequestModel.getJobIds();
    for (UUID jobId : jobIds) {
        if (null == jobId) {
            return new ActionResponse<>(HttpStatus.BAD_REQUEST, "The field 'jobIds' cannot contain null values");
        }
    }
    List<AuditJobStatusModel> auditJobStatusModels = auditAccessor.findByJobIds(jobIds);
    return new ActionResponse<>(HttpStatus.OK, new AuditJobStatusesModel(auditJobStatusModels));
}
Also used : AuditJobStatusModel(com.synopsys.integration.alert.common.persistence.model.AuditJobStatusModel) UUID(java.util.UUID) ActionResponse(com.synopsys.integration.alert.common.action.ActionResponse) AuditJobStatusesModel(com.synopsys.integration.alert.common.rest.model.AuditJobStatusesModel)

Aggregations

ActionResponse (com.synopsys.integration.alert.common.action.ActionResponse)1 AuditJobStatusModel (com.synopsys.integration.alert.common.persistence.model.AuditJobStatusModel)1 AuditJobStatusesModel (com.synopsys.integration.alert.common.rest.model.AuditJobStatusesModel)1 UUID (java.util.UUID)1