@Test public void getAllPrintJobs(){ PrintJob printJob = new PrintJob(); printJob.setColorType(new ColorType(1, "Red")); printJob.setComments("comments"); printJob.setCreatedAt(LocalDateTime.now()); printJob.setQueueId(new Queue(printJob, new Long(1))); printJob.setStatus(Status.ARCHIVED); printJob.setEmployee(new Employee()); printJob.setId(1); List<PrintJob> printJobs = new ArrayList<PrintJob>(); printJobs.add(printJob); when(printJobRepo.findActive()).thenReturn(printJobs); DataResponse<BasicPrintJob> result = operations.getAllPrintJobs(null); Assert.assertEquals(result.getData().get(0).getId(), printJob.getId()); }
public DataResponse<BasicPrintJob> getAllPrintJobs(String status) { DataResponse<BasicPrintJob> response = new DataResponse<BasicPrintJob>("Could not get all print jobs"); List<PrintJob> printJobs = status == null? printJobRepo.findActive() : printJobRepo.findPrintJobByStatus(Status.fromValue(status)); if (printJobs == null || printJobs.isEmpty()){ ErrorType.PRINT_JOBS_NOT_EXIST.throwException(); } List<BasicPrintJob> basicPrintJobs = new BasicPrintJob().ConvertPrintJobs(printJobs); response.setSuccess(true); response.setMessage(status == null? "Successfully returned all print jobs" : "Successfully returned print jobs by " + status + " status"); response.setData(basicPrintJobs); response.setHttpStatus(HttpStatus.ACCEPTED); return response; }
PrintJobOperations { public DataResponse<BasicPrintJob> getAllPrintJobs(String status) { DataResponse<BasicPrintJob> response = new DataResponse<BasicPrintJob>("Could not get all print jobs"); List<PrintJob> printJobs = status == null? printJobRepo.findActive() : printJobRepo.findPrintJobByStatus(Status.fromValue(status)); if (printJobs == null || printJobs.isEmpty()){ ErrorType.PRINT_JOBS_NOT_EXIST.throwException(); } List<BasicPrintJob> basicPrintJobs = new BasicPrintJob().ConvertPrintJobs(printJobs); response.setSuccess(true); response.setMessage(status == null? "Successfully returned all print jobs" : "Successfully returned print jobs by " + status + " status"); response.setData(basicPrintJobs); response.setHttpStatus(HttpStatus.ACCEPTED); return response; } }
PrintJobOperations { public DataResponse<BasicPrintJob> getAllPrintJobs(String status) { DataResponse<BasicPrintJob> response = new DataResponse<BasicPrintJob>("Could not get all print jobs"); List<PrintJob> printJobs = status == null? printJobRepo.findActive() : printJobRepo.findPrintJobByStatus(Status.fromValue(status)); if (printJobs == null || printJobs.isEmpty()){ ErrorType.PRINT_JOBS_NOT_EXIST.throwException(); } List<BasicPrintJob> basicPrintJobs = new BasicPrintJob().ConvertPrintJobs(printJobs); response.setSuccess(true); response.setMessage(status == null? "Successfully returned all print jobs" : "Successfully returned print jobs by " + status + " status"); response.setData(basicPrintJobs); response.setHttpStatus(HttpStatus.ACCEPTED); return response; } PrintJobOperations(FileService fileService, PrintJobRepo printJobRepo,
                              ColorTypeRepo colorTypeRepo, CustomerInfoRepo customerInfoRepo,
                              EmployeeRepo employeeRepo, EmailHashUtil emailHashUtil, QueueRepo queueRepo); }
PrintJobOperations { public DataResponse<BasicPrintJob> getAllPrintJobs(String status) { DataResponse<BasicPrintJob> response = new DataResponse<BasicPrintJob>("Could not get all print jobs"); List<PrintJob> printJobs = status == null? printJobRepo.findActive() : printJobRepo.findPrintJobByStatus(Status.fromValue(status)); if (printJobs == null || printJobs.isEmpty()){ ErrorType.PRINT_JOBS_NOT_EXIST.throwException(); } List<BasicPrintJob> basicPrintJobs = new BasicPrintJob().ConvertPrintJobs(printJobs); response.setSuccess(true); response.setMessage(status == null? "Successfully returned all print jobs" : "Successfully returned print jobs by " + status + " status"); response.setData(basicPrintJobs); response.setHttpStatus(HttpStatus.ACCEPTED); return response; } PrintJobOperations(FileService fileService, PrintJobRepo printJobRepo,
                              ColorTypeRepo colorTypeRepo, CustomerInfoRepo customerInfoRepo,
                              EmployeeRepo employeeRepo, EmailHashUtil emailHashUtil, QueueRepo queueRepo); DataResponse<BasicPrintJob> newPrintJob(PrintJobNewRequest printJobNewRequest, Principal principal); DataResponse<BasicPrintJob> updateModel(Integer printId, PrintModelUpdateRequest model); GenericResponse deleteModel(Integer printId); GenericResponse updatePrintJobStatus(Integer printId, PrintJobUpdateRequest dto); GenericResponse deletePrintJob(PrintJobDeleteRequest dto); DataResponse<BasicPrintJob> getAllPrintJobs(String status); DataResponse<BasicPrintJob> getDeletablePrintJobs(); DataResponse<BasicPrintJob> updatePrintJobProps(Integer printJobId, UpdatePrintJobPropertiesRequest request); DataResponse<BasicPrintJob> getPrintJobById(Integer printJobId); }
PrintJobOperations { public DataResponse<BasicPrintJob> getAllPrintJobs(String status) { DataResponse<BasicPrintJob> response = new DataResponse<BasicPrintJob>("Could not get all print jobs"); List<PrintJob> printJobs = status == null? printJobRepo.findActive() : printJobRepo.findPrintJobByStatus(Status.fromValue(status)); if (printJobs == null || printJobs.isEmpty()){ ErrorType.PRINT_JOBS_NOT_EXIST.throwException(); } List<BasicPrintJob> basicPrintJobs = new BasicPrintJob().ConvertPrintJobs(printJobs); response.setSuccess(true); response.setMessage(status == null? "Successfully returned all print jobs" : "Successfully returned print jobs by " + status + " status"); response.setData(basicPrintJobs); response.setHttpStatus(HttpStatus.ACCEPTED); return response; } PrintJobOperations(FileService fileService, PrintJobRepo printJobRepo,
                              ColorTypeRepo colorTypeRepo, CustomerInfoRepo customerInfoRepo,
                              EmployeeRepo employeeRepo, EmailHashUtil emailHashUtil, QueueRepo queueRepo); DataResponse<BasicPrintJob> newPrintJob(PrintJobNewRequest printJobNewRequest, Principal principal); DataResponse<BasicPrintJob> updateModel(Integer printId, PrintModelUpdateRequest model); GenericResponse deleteModel(Integer printId); GenericResponse updatePrintJobStatus(Integer printId, PrintJobUpdateRequest dto); GenericResponse deletePrintJob(PrintJobDeleteRequest dto); DataResponse<BasicPrintJob> getAllPrintJobs(String status); DataResponse<BasicPrintJob> getDeletablePrintJobs(); DataResponse<BasicPrintJob> updatePrintJobProps(Integer printJobId, UpdatePrintJobPropertiesRequest request); DataResponse<BasicPrintJob> getPrintJobById(Integer printJobId);  }