public ActionForward createParticipator( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixServiceException { ResearchResult result = getResultFromRequest(request); ResultParticipationCreationBean bean = (ResultParticipationCreationBean) RenderUtils.getViewState("beanForExternalPerson").getMetaObject().getObject(); if (bean.getOrganization() != null) { ExternalContract contract = InsertExternalPerson.run( new InsertExternalPerson.ServiceArguments( bean.getParticipatorName(), bean.getOrganization())); bean.setParticipator(contract.getPerson().getPersonName()); createParticipation(bean); } else { request.setAttribute("createUnit", true); request.setAttribute("duringCreation", true); request.setAttribute("bean", bean); setResParticipationRequestAttributes(request, result, bean); RenderUtils.invalidateViewState(); return mapping.findForward("editParticipation"); } return prepareEdit(mapping, form, request, response); }
public ActionForward uploadFile( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { IViewState viewState = RenderUtils.getViewState("upload"); if (viewState == null) { return prepareFileUpload(mapping, form, request, response); } UnitFileUploadBean bean = (UnitFileUploadBean) viewState.getMetaObject().getObject(); RenderUtils.invalidateViewState(); if (!bean.getUnit().getAllowedPeopleToUploadFilesSet().contains(AccessControl.getPerson())) { return manageFiles(mapping, form, request, response); } try (InputStream stream = bean.getUploadFile()) { CreateUnitFile.run( ByteStreams.toByteArray(stream), bean.getFileName(), bean.getName(), bean.getDescription(), bean.getTags(), bean.getGroup(), getUnit(request), getLoggedPerson(request)); } catch (DomainException | IOException e) { addActionMessage(request, e.getMessage()); } return manageFiles(mapping, form, request, response); }
@Override protected String getResourceMessage(String message) { if (this.arguments == null || this.arguments.length == 0) { return RenderUtils.getResourceString(getBundle(), message); } else { return RenderUtils.getFormatedResourceString(getBundle(), message, this.arguments); } }
@Override protected Object getFromRequest(HttpServletRequest request, String id) { if (RenderUtils.getViewState(id) != null) { return RenderUtils.getViewState(id).getMetaObject().getObject(); } else if (request.getParameter(id) != null) { return request.getParameter(id); } else { return request.getAttribute(id); } }
protected void createCommentLink( CurricularCourseResumeResult courseResumeResult, HtmlInlineContainer container, ResultClassification forAudit) { container.addChild(new HtmlText(" | ", false)); String commentLinkText = RenderUtils.getResourceString("INQUIRIES_RESOURCES", "link.inquiry.comment"); if (courseResumeResult.isShowAllComments() || !courseResumeResult.isAllowComment()) { commentLinkText = RenderUtils.getResourceString("INQUIRIES_RESOURCES", "link.inquiry.viewResults"); } else if (hasQucGlobalCommentsMadeBy( courseResumeResult.getExecutionCourse(), courseResumeResult.getPerson(), courseResumeResult.getExecutionDegree(), courseResumeResult.getPersonCategory())) { commentLinkText = RenderUtils.getResourceString("INQUIRIES_RESOURCES", "link.inquiry.viewComment"); } String fillInParameters = buildFillInParameters(courseResumeResult); HtmlLink commentLink = new HtmlLink(); commentLink.setUrl(getAction() + "?method=" + getMethod() + fillInParameters); commentLink.setText(commentLinkText); container.addChild(commentLink); if (courseResumeResult.getExecutionCourse().getExecutionCourseAudit() != null && courseResumeResult.getExecutionCourse().getExecutionCourseAudit().isProcessAvailable()) { container.addChild(new HtmlText(" | ", false)); HtmlLink auditLink = new HtmlLink(); auditLink.setUrl( "/auditResult.do?method=viewProcessDetails&" + buildParametersForAudit(courseResumeResult)); auditLink.setText("Ver processo auditoria"); container.addChild(auditLink); } else { if (forAudit != null) { if (forAudit.equals(ResultClassification.RED)) { container.addChild( new HtmlText( " (" + RenderUtils.getResourceString("INQUIRIES_RESOURCES", "label.inquiry.audit") + ")")); } else if (forAudit.equals(ResultClassification.YELLOW)) { container.addChild( new HtmlText( " (" + RenderUtils.getResourceString( "INQUIRIES_RESOURCES", "label.inquiry.inObservation") + ")")); } } } }
public ActionForward prepareStudentEnrolmentPostback( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { ActionForward forward = prepareStudentEnrolment(mapping, actionForm, request, response); RenderUtils.invalidateViewState("student.enrolment.bean"); RenderUtils.invalidateViewState("student.enrolment.bean.execution.semester"); return forward; }
private void fillRequest(HttpServletRequest request, Candidacy candidacy) { if (RenderUtils.getViewState("candidacyDocuments") != null) { RenderUtils.invalidateViewState("candidacyDocuments"); } List<CandidacyDocumentUploadBean> candidacyDocuments = new ArrayList<CandidacyDocumentUploadBean>(); for (CandidacyDocument candidacyDocument : candidacy.getCandidacyDocuments()) { candidacyDocuments.add(new CandidacyDocumentUploadBean(candidacyDocument)); } request.setAttribute("candidacyDocuments", candidacyDocuments); request.setAttribute("candidacy", candidacy); }
public ActionForward createNewExportationCandidaciesForPasswordGenerationProcess( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { DgesBaseProcessBean bean = getRenderedBean(); RenderUtils.invalidateViewState("importation.bean"); RenderUtils.invalidateViewState("importation.bean.edit"); DgesBaseProcessLauncher.launchExportationCandidaciesForPasswordGeneration( bean.getExecutionYear(), bean.getPhase()); return list(mapping, form, request, response); }
public ActionForward setEvaluations( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { List<List<MarkSheetEnrolmentEvaluationBean>> evaluationsList = getCurriculumEntries(); StudentCurricularPlan studentCurricularPlan = readStudentCurricularPlan(request); ExecutionSemester selectedSemester = readExecutionSemester(request); try { studentCurricularPlan.setEvaluationsForCurriculumValidation(evaluationsList); for (int i = 0; i < evaluationsList.size(); i++) { RenderUtils.invalidateViewState("set.evaluations.form." + i); } } catch (DomainException e) { if ("error.grade.invalid.grade".equals(e.getMessage())) { addActionMessage("grade-messages", request, "error.invalid.grade"); } else { throw e; } } return prepareSetEvaluations(mapping, actionForm, request, response); }
@Override protected HtmlComponent getComponent(int rowIndex, int columnIndex) { Object object = this.objects.get(rowIndex); Schema schema = RenderKit.getInstance().findSchema(getEachSchema()); String layout = getEachLayout(); MetaObject metaObject = MetaObjectFactory.createObject(object, schema); if (columnIndex == 0) { this.hiddenValues.addValue(metaObject.getKey().toString()); PresentationContext newContext = getContext().createSubContext(metaObject); newContext.setLayout(layout); newContext.setRenderMode(RenderMode.getMode("output")); RenderKit kit = RenderKit.getInstance(); return kit.render(newContext, object); } else { HtmlActionLink link = new HtmlActionLink(); String prefix = getInputContext().getMetaObject().getKey().toString(); link.setName(prefix + "/delete/" + rowIndex); link.setText(RenderUtils.getResourceString("renderers.list.management.delete")); HtmlTableRow row = getTable().getRows().get(rowIndex); link.setController(new RemoveLineController(getTable(), this.hiddenValues, row, prefix)); return link; } }
public ActionForward fillPrecedentInformationPostback( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { // assuming that when using this method each individual candidacy bean // extends IndividualCandidacyProcessWithPrecedentDegreeInformationBean final IndividualCandidacyProcessWithPrecedentDegreeInformationBean bean = (IndividualCandidacyProcessWithPrecedentDegreeInformationBean) getIndividualCandidacyProcessBean(); request.setAttribute(getIndividualCandidacyProcessBeanName(), bean); RenderUtils.invalidateViewState(); if (bean.hasPrecedentDegreeType()) { if (bean.isExternalPrecedentDegreeType()) { bean.setPrecedentDegreeInformation(new PrecedentDegreeInformationBean()); } else if (bean.hasPrecedentStudentCurricularPlan()) { createCandidacyPrecedentDegreeInformation(bean, bean.getPrecedentStudentCurricularPlan()); } else { final List<StudentCurricularPlan> scps = bean.getPrecedentStudentCurricularPlans(); if (scps.size() == 1) { createCandidacyPrecedentDegreeInformation(bean, scps.get(0)); bean.setPrecedentStudentCurricularPlan(scps.get(0)); } } } return mapping.findForward("fill-candidacy-information"); }
private HtmlMenuOption createOtherOption(HtmlMenu menu) { String title = RenderUtils.getResourceString("renderers.menu.other.title"); HtmlMenuOption otherOption = menu.createOption(title); otherOption.setValue(OPTION_KEY); return otherOption; }
@SuppressWarnings("unused") public ActionForward selectDegreeType( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { ReportBean reportBean = getRenderedObject(); DegreeType degreeType; ExecutionYear executionYear; if (reportBean == null) { degreeType = getDegreeType(request); executionYear = getExecutionYear(request); reportBean = new ReportBean(); reportBean.setDegreeType(degreeType); reportBean.setExecutionYear(executionYear); } else { degreeType = reportBean.getDegreeType(); executionYear = reportBean.getExecutionYear(); } RenderUtils.invalidateViewState(); request.setAttribute("reportBean", reportBean); request.setAttribute("queueJobList", getLatestJobs()); countReports(request, degreeType, executionYear); return mapping.findForward("selectDegreeType"); }
public ActionForward uploadDocuments( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixServiceException { List<CandidacyDocumentUploadBean> beans = (List<CandidacyDocumentUploadBean>) RenderUtils.getViewState("candidacyDocuments").getMetaObject().getObject(); for (CandidacyDocumentUploadBean bean : beans) { bean.createTemporaryFile(); } SaveCandidacyDocumentFiles.run(beans); for (CandidacyDocumentUploadBean bean : beans) { bean.deleteTemporaryFile(); } fillRequest(request, getCandidacy(beans)); return mapping.findForward("uploadDocuments"); }
@Override protected void createFinalCells(HtmlTableRow tableRow, BlockResumeResult blockResumeResult) { CurricularCourseResumeResult courseResumeResult = (CurricularCourseResumeResult) blockResumeResult; HtmlInlineContainer container = new HtmlInlineContainer(); HtmlTableCell linksCell = tableRow.createCell(); HtmlMenu menu = new HtmlMenu(); menu.setOnChange( "var value=this.options[this.selectedIndex].value; this.selectedIndex=0; if(value!= ''){ window.open(value,'_blank'); }"); menu.setStyle("width: 150px"); HtmlMenuOption optionEmpty = menu.createOption( RenderUtils.getResourceString("INQUIRIES_RESOURCES", "label.inquiry.emptyOption")); createResultsGroup(courseResumeResult, menu); createReportsGroup(courseResumeResult, menu); container.addChild(menu); ResultClassification forAudit = ResultClassification.getForAudit( courseResumeResult.getExecutionCourse(), courseResumeResult.getExecutionDegree()); createCommentLink(courseResumeResult, container, forAudit); linksCell.setBody(container); linksCell.setClasses("col-actions"); }
public ActionForward prepareCreateNewImportationProcess( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { DgesBaseProcessBean bean = getRenderedBean(); if (bean == null) { bean = new DgesBaseProcessBean(ExecutionYear.readCurrentExecutionYear()); } RenderUtils.invalidateViewState("importation.bean"); RenderUtils.invalidateViewState("importation.bean.edit"); request.setAttribute("importationBean", bean); return mapping.findForward("prepare-create-new-process"); }
public ActionForward prepareCreateNewExportationCandidaciesForPasswordGenerationJob( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { DgesBaseProcessBean bean = getRenderedBean(); if (bean == null) { bean = new DgesBaseProcessBean(ExecutionYear.readCurrentExecutionYear()); } RenderUtils.invalidateViewState("importation.bean"); RenderUtils.invalidateViewState("importation.bean.edit"); request.setAttribute("importationBean", bean); return mapping.findForward( "prepare-create-new-exportation-candidacies-for-password-generation-job"); }
public ActionForward chooseServiceRequestTypePostBack( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { request.setAttribute( "academicServiceRequestCreateBean", getRenderedObject("academicServiceRequestCreateBean")); RenderUtils.invalidateViewState(); return mapping.findForward("prepareCreateServiceRequest"); }
public ActionForward postback( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { FindPersonBean bean = getRenderedObject(); RenderUtils.invalidateViewState(); request.setAttribute("bean", bean); return mapping.findForward("findPerson"); }
public ActionForward preparePaymentInvalid( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { request.setAttribute( "paymentsManagementDTO", RenderUtils.getViewState("paymentsManagementDTO-edit").getMetaObject().getObject()); return mapping.findForward("preparePayment"); }
public ActionForward searchAgainPersonForCandidacy( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { final IndividualCandidacyProcessBean bean = getIndividualCandidacyProcessBean(); request.setAttribute(getIndividualCandidacyProcessBeanName(), bean); bean.getChoosePersonBean().setFirstTimeSearch(true); bean.getChoosePersonBean().setPerson(null); RenderUtils.invalidateViewState(); return mapping.findForward("prepare-create-new-process"); }
public ActionForward prepareSetEvaluations( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { StudentCurricularPlan studentCurricularPlan = readStudentCurricularPlan(request); ExecutionSemester executionSemester = readExecutionSemester(request); RenderUtils.invalidateViewState("student.enrolment.bean"); RenderUtils.invalidateViewState("student.enrolment.bean.execution.semester"); request.setAttribute( "bolonhaStudentEnrollmentBean", readBolonhaStudentEnrollmentBean( request, studentCurricularPlan, executionSemester, null, CurricularRuleLevel.ENROLMENT_NO_RULES, true)); java.util.List<java.util.List<MarkSheetEnrolmentEvaluationBean>> enrolmentEvaluationBeanList = new java.util.ArrayList<java.util.List<MarkSheetEnrolmentEvaluationBean>>(); java.util.List<java.util.List<MarkSheetEnrolmentEvaluationBean>> finalEnrolmentEvaluationBeanList = new java.util.ArrayList<java.util.List<MarkSheetEnrolmentEvaluationBean>>(); createTreeCurriculumModules( studentCurricularPlan, executionSemester, enrolmentEvaluationBeanList, finalEnrolmentEvaluationBeanList, null, false); request.setAttribute("finalEntriesList", finalEnrolmentEvaluationBeanList); request.setAttribute("entriesList", enrolmentEvaluationBeanList); return mapping.findForward("show-set-evaluations-form"); }
public ActionForward deleteInquiryAnswer( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { final CerimonyInquiryAnswer cerimonyInquiryAnswer = getDomainObject(request, "cerimonyInquiryAnswerId"); final CerimonyInquiry cerimonyInquiry = cerimonyInquiryAnswer.getCerimonyInquiry(); cerimonyInquiryAnswer.delete(); RenderUtils.invalidateViewState(); return forwardToInquiry(mapping, request, "viewAlumniCerimonyInquiry", cerimonyInquiry); }
public ActionForward prepareRegistrationConclusionProcess( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { RenderUtils.invalidateViewState(); final Registration registration = readRegistration(request); request.setAttribute( "registrationConclusionBean", buildRegistrationConclusionBean(registration)); return mapping.findForward("registrationConclusion"); }
private void createResultsGroup(CurricularCourseResumeResult courseResumeResult, HtmlMenu menu) { HtmlMenuGroup resultsGroup = menu.createGroup( RenderUtils.getResourceString("INQUIRIES_RESOURCES", "label.inquiry.results")); HtmlMenuOption optionUC = resultsGroup.createOption(); optionUC.setText( RenderUtils.getResourceString("INQUIRIES_RESOURCES", "label.inquiry.ucResults")); String resultsParameters = buildParametersForResults(courseResumeResult); HtmlLink link = new HtmlLink(); link.setModule("/publico"); link.setUrl("/viewCourseResults.do?" + resultsParameters); link.setEscapeAmpersand(false); String calculatedUrl = link.calculateUrl(); optionUC.setValue( calculatedUrl + "&_request_checksum_=" + GenericChecksumRewriter.calculateChecksum(calculatedUrl, getSession())); for (TeacherShiftTypeResultsBean teacherShiftTypeResultsBean : courseResumeResult.getTeachersResults()) { String teacherResultsParameters = buildParametersForTeacherResults(teacherShiftTypeResultsBean); HtmlLink teacherLink = new HtmlLink(); teacherLink.setEscapeAmpersand(false); teacherLink.setModule("/publico"); teacherLink.setUrl("/viewTeacherResults.do?" + teacherResultsParameters); calculatedUrl = teacherLink.calculateUrl(); HtmlMenuOption optionTeacher = resultsGroup.createOption(); optionTeacher.setText( teacherShiftTypeResultsBean.getShiftType().getFullNameTipoAula() + " - " + teacherShiftTypeResultsBean.getProfessorship().getPerson().getName()); optionTeacher.setValue( calculatedUrl + "&_request_checksum_=" + GenericChecksumRewriter.calculateChecksum(calculatedUrl, getSession())); } }
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()); }
protected void invalidateDocumentFileRelatedViewStates() { List<IViewState> viewStates = new ArrayList<IViewState>( (List<IViewState>) RenderersRequestProcessorImpl.getCurrentRequest() .getAttribute(LifeCycleConstants.VIEWSTATE_PARAM_NAME)); if (viewStates != null) { for (IViewState state : viewStates) { if (state.getId().indexOf("individualCandidacyProcessBean.document.file") > -1) { RenderUtils.invalidateViewState(state.getId()); } } } }
public ActionForward doPayment( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { final PaymentsManagementDTO paymentsManagementDTO = (PaymentsManagementDTO) RenderUtils.getViewState("paymentsManagementDTO-edit").getMetaObject().getObject(); if (paymentsManagementDTO.getSelectedEntries().isEmpty()) { addActionMessage("context", request, "error.payments.payment.entries.selection.is.required"); request.setAttribute("paymentsManagementDTO", paymentsManagementDTO); return mapping.findForward("preparePayment"); } // This is here to force the load of the relation to debug a possible bug in FenixFramework paymentsManagementDTO.getPerson().getReceiptsSet().size(); try { final Receipt receipt = CreatePaymentsForEvents.run( getUserView(request).getPerson().getUser(), paymentsManagementDTO.getSelectedEntries(), PaymentMode.CASH, paymentsManagementDTO.isDifferedPayment(), paymentsManagementDTO.getPaymentDate(), paymentsManagementDTO.getPerson(), paymentsManagementDTO.getContributorName(), paymentsManagementDTO.getContributorNumber(), paymentsManagementDTO.getContributorAddress()); request.setAttribute("personId", paymentsManagementDTO.getPerson().getExternalId()); request.setAttribute("receiptID", receipt.getExternalId()); return mapping.findForward("showReceipt"); } catch (DomainExceptionWithLabelFormatter ex) { addActionMessage( request, ex.getKey(), solveLabelFormatterArgs(request, ex.getLabelFormatterArgs())); request.setAttribute("paymentsManagementDTO", paymentsManagementDTO); return mapping.findForward("preparePayment"); } catch (DomainException ex) { addActionMessage(request, ex.getKey(), ex.getArgs()); request.setAttribute("paymentsManagementDTO", paymentsManagementDTO); return mapping.findForward("preparePayment"); } }
public ActionForward prepareExecuteEditDocuments( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { final IndividualCandidacyProcess process = getProcess(request); request.setAttribute(getIndividualCandidacyProcessBeanName(), process); CandidacyProcessDocumentUploadBean uploadBean = new CandidacyProcessDocumentUploadBean(); uploadBean.setIndividualCandidacyProcess(process); request.setAttribute("candidacyDocumentUploadBean", uploadBean); RenderUtils.invalidateViewState("individualCandidacyProcessBean.document"); return mapping.findForward("prepare-edit-candidacy-documents"); }
public ActionForward createNewImportationProcess( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DgesBaseProcessBean bean = getRenderedBean(); RenderUtils.invalidateViewState("importation.bean"); RenderUtils.invalidateViewState("importation.bean.edit"); byte[] contents = bean.consumeStream(); DgesStudentImportationFile file = DgesStudentImportationFile.create( contents, bean.getFilename(), bean.getExecutionYear(), bean.getCampus(), bean.getPhase()); DgesBaseProcessLauncher.launchImportation( bean.getExecutionYear(), bean.getCampus(), bean.getPhase(), file); return list(mapping, form, request, response); }