private void prepareNewJobResponse(HttpServletRequest request, GepReportFile job) { ReportBean reportBean = getRenderedObject(); if (reportBean == null) { reportBean = new ReportBean(); reportBean.setDegreeType(job.getDegreeType()); reportBean.setExecutionYear(job.getExecutionYear()); } RenderUtils.invalidateViewState(); request.setAttribute("job", job); request.setAttribute("reportBean", reportBean); request.setAttribute("queueJobList", getLatestJobs()); }
@Override public boolean evaluate(Object object) { QueueJob queueJob = (QueueJob) object; try { GepReportFile gepReportFile = (GepReportFile) queueJob; if (gepReportFile.getClass() == this.reportClass) { if (this.executionYear == gepReportFile.getExecutionYear() && this.degreeType == gepReportFile.getDegreeType() && elements < MAX_AUTHORIZED_REPORT_FILES) { elements++; return true; } else { return false; } } else { return false; } } catch (ClassCastException E) { return false; } }
private boolean isRepeatedJob(Person person, HttpServletRequest request, Class aClass) { final DegreeType degreeType = getDegreeType(request); request.setAttribute("degreeType", degreeType); final ExecutionYear executionYear = getExecutionYear(request); request.setAttribute( "executionYearID", (executionYear == null) ? null : executionYear.getIdInternal()); final String fileType = getFileType(request); for (QueueJob queueJob : QueueJob.getAllJobsForClassOrSubClass(GepReportFile.class, 5)) { GepReportFile gepReportFile = (GepReportFile) queueJob; if ((gepReportFile.getPerson() == person) && (gepReportFile.getClass() == aClass) && (!gepReportFile.getDone()) && (gepReportFile.getExecutionYear() == executionYear) && (gepReportFile.getDegreeType() == degreeType) && (fileType.equals(gepReportFile.getType()))) { return true; } } return false; }