Refine search
ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage("error.invalidCredentials")); request.setAttribute(Globals.ERROR_KEY, errors); return mapping.findForward("failure");
ActionErrors errors = new ActionErrors(); if (badInput) { errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.bad.input", badString); // key in messages resource file // badString will replace {0} in message }
request.setAttribute("manageLessonForm", manageLessonForm); if (actionErrors.isEmpty()) { InfoShift infoShift = (InfoShift) (request.getAttribute(PresentationConstants.SHIFT)); String action = request.getParameter("action"); if (action != null && action.equals("edit")) { actionErrors.add(domainException.getMessage(), new ActionError(domainException.getMessage(), domainException.getArgs())); saveErrors(request, actionErrors); actionErrors.add(domainException.getMessage(), new ActionError(domainException.getMessage(), domainException.getArgs())); saveErrors(request, actionErrors); return prepareChangeRoom(mapping, manageLessonForm, request, response); return mapping.findForward("EditShift"); return mapping.getInputForward();
public ActionForward removeShifts(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaActionForm removeShiftsForm = (DynaActionForm) form; String[] selectedShifts = (String[]) removeShiftsForm.get("selectedItems"); if (selectedShifts.length == 0) { ActionErrors actionErrors = new ActionErrors(); actionErrors.add("errors.shifts.notSelected", new ActionError("errors.shifts.notSelected")); saveErrors(request, actionErrors); return mapping.getInputForward(); } List<String> shiftOIDs = new ArrayList<String>(); for (String selectedShift : selectedShifts) { shiftOIDs.add(selectedShift); } InfoClass infoClass = (InfoClass) request.getAttribute(PresentationConstants.CLASS_VIEW); RemoveShifts.run(infoClass, shiftOIDs); return mapping.findForward("EditClass"); }
String actionTarget = null; HttpSession session = request.getSession(); actionTarget = "invalidId"; ActionRedirect redirect = new ActionRedirect(mapping.findForward(actionTarget)); return redirect; int id = Integer.parseInt(request.getParameter("id")); if(!actionErrors.isEmpty()){ actionTarget = "editErrors"; session.setAttribute("form", uf); ActionRedirect redirect = new ActionRedirect(mapping.findForward(actionTarget)); redirect.addParameter("id", Integer.toString(id)); return redirect; return mapping.findForward(actionTarget);
/** * @param request * @return org.apache.struts.action.ActionErrors * @roseuid 4398DA2A03E4 */ public static ActionMessages getErrors(HttpServletRequest request) { ActionErrors errors = null; HttpSession session = request.getSession(false); if (request.getAttribute(Globals.ERROR_KEY) != null) { errors = (ActionErrors) request.getAttribute(Globals.ERROR_KEY); } else if (session != null && session.getAttribute(Globals.ERROR_KEY) != null) { errors = (ActionErrors) session.getAttribute(Globals.ERROR_KEY); } else { errors = new ActionErrors(); saveErrors(request, errors); } return errors; }
public ActionForward associateTeacher(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixActionException { if (isCancelled(request)) { RenderUtils.invalidateViewState(); return prepareAssociateTeacher(mapping, form, request, response); } Person person = Person.readPersonByUsername(request.getParameter("teacherId")); final ExecutionCourse executionCourse = getExecutionCourse(request); if (person != null) { if (person.getTeacher() != null && person.getTeacher().hasTeacherAuthorization(executionCourse.getAcademicInterval())) { Professorship professorship = Professorship.create(false, executionCourse, person); request.setAttribute("teacherOID", professorship.getExternalId()); } else { final ActionMessages actionErrors = new ActionErrors(); actionErrors.add("error", new ActionMessage("label.invalid.teacher.without.auth")); saveErrors(request, actionErrors); return prepareAssociateTeacher(mapping, form, request, response); } } else { final ActionMessages actionErrors = new ActionErrors(); actionErrors.add("error", new ActionMessage("label.invalid.teacher.number")); saveErrors(request, actionErrors); return prepareAssociateTeacher(mapping, form, request, response); } return viewProfessorshipProperties(mapping, form, request, response); }
public ActionForward deleteLesson(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { List<String> lessons = new ArrayList<String>(); lessons.add(request.getParameter(PresentationConstants.LESSON_OID)); try { DeleteLessons.run(lessons); } catch (FenixServiceMultipleException e) { final ActionErrors actionErrors = new ActionErrors(); for (final DomainException domainException : e.getExceptionList()) { actionErrors.add(domainException.getMessage(), new ActionError(domainException.getMessage(), domainException.getArgs())); } saveErrors(request, actionErrors); return mapping.findForward("LessonDeleted"); } request.removeAttribute(PresentationConstants.LESSON_OID); return mapping.findForward("LessonDeleted"); }
InfoShift infoShiftOld = (InfoShift) request.getAttribute(PresentationConstants.SHIFT); ActionErrors actionErrors = new ActionErrors(); actionErrors.add("errors.shift.types.notSelected", new ActionError("errors.shift.types.notSelected")); saveErrors(request, actionErrors); return mapping.getInputForward(); ActionErrors actionErrors = new ActionErrors(); actionErrors.add("error", new ActionError(ex.getMessage())); saveErrors(request, actionErrors); return mapping.getInputForward(); request.setAttribute(PresentationConstants.EXECUTION_COURSE, infoExecutionCourseNew); ContextUtils.setShiftContext(request);
public ActionForward deleteLessonInstance(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { NextPossibleSummaryLessonsAndDatesBean bean = NextPossibleSummaryLessonsAndDatesBean.getNewInstance(request.getParameter("lessonDate")); try { DeleteLessonInstance.run(bean.getLesson(), bean.getDate()); ActionErrors actionErrors = new ActionErrors(); actionErrors.add(null, new ActionError("message.deleteLesson", bean.getDate())); saveErrors(request, actionErrors); } catch (UnsupportedOperationException unsupportedOperationException) { ActionErrors actionErrors = new ActionErrors(); actionErrors.add(unsupportedOperationException.getMessage(), new ActionError("error.Lesson.not.instanced", bean.getDate())); saveErrors(request, actionErrors); } catch (DomainException domainException) { ActionErrors actionErrors = new ActionErrors(); actionErrors.add(domainException.getMessage(), new ActionError(domainException.getMessage())); saveErrors(request, actionErrors); } return viewAllLessonDates(mapping, form, request, response); }
ExecutionCourse executionCourse = FenixFramework.getDomainObject(request.getParameter("executionCourseID")); final ActionErrors actionErrors = new ActionErrors(); if (person != null) { try { ShiftEnrollmentErrorReport errorReport = new EnrollStudentInShifts().run(executionCourse.getRegistration(person), request.getParameter("shiftID")); if (errorReport.getUnAvailableShifts().size() > 0) { actionErrors.add("error", new ActionMessage("error.exception.shift.full")); actionErrors.add("error", new ActionMessage(e.getMessage())); } else { actionErrors.add("error", new ActionMessage("label.invalid.student.number")); actionErrors.add("error", new ActionMessage("label.invalid.student.number"));
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { (MgmtSessionData) request.getSession().getAttribute(MgmtBaseAction.MGMT_SESSION_DATA_KEY); ActionErrors errors = new ActionErrors(); errors.add("enforcementPointId", new ActionMessage("mgmt.error.edit.enforcementPointId.missing")); } else { errors.add("enforcementPointId", new ActionMessage("mgmt.error.edit.enforcementPointId.inuse")); errors.add("enforcementPointId", new ActionMessage("mgmt.error.edit.enforcementPointId.format")); errors.add("endpointType", new ActionMessage("mgmt.error.edit.endpointType.missing")); errors.add("endpointUrl", new ActionMessage("mgmt.error.edit.endpointUrl.invalid")); } else { try { new URL(m_endpointUrl); } catch (MalformedURLException e) { errors.add("endpointUrl", new ActionMessage("mgmt.error.edit.endpointUrl.invalid"));
public ActionForward deleteShifts(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaActionForm deleteShiftsForm = (DynaActionForm) form; String[] selectedShifts = (String[]) deleteShiftsForm.get("selectedItems"); if (selectedShifts.length == 0) { ActionErrors actionErrors = new ActionErrors(); actionErrors.add("errors.shifts.notSelected", new ActionError("errors.shifts.notSelected")); saveErrors(request, actionErrors); return mapping.getInputForward(); } final List<String> shiftOIDs = new ArrayList<String>(); for (String selectedShift : selectedShifts) { shiftOIDs.add(selectedShift); } try { DeleteShifts.run(shiftOIDs); } catch (FenixServiceMultipleException e) { final ActionMessages actionMessages = new ActionMessages(); for (final DomainException domainException : e.getExceptionList()) { actionMessages.add(Integer.toString(domainException.hashCode()), new ActionMessage(domainException.getLocalizedMessage(), false)); } saveErrors(request, actionMessages); return mapping.getInputForward(); } return redirectToShiftsList(request); } }
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { try { MessageResources resources = getResources(request); ActionErrors errors = super.validate(mapping, request); if (getEmpname() == null || getEmpname().length() < 1) { errors.add("name", new ActionMessage("error.name.required")); throw new Exception(getResources(request).getMessage("error.name.required")); } return errors; } catch (Exception ex) { request.setAttribute(Globals.EXCEPTION_KEY, ex); return null; } }
public ActionForward changeRoom(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { final InfoLesson infoLesson = (InfoLesson) request.getAttribute(PresentationConstants.LESSON); final Space space = getDomainObject(request, "spaceOID"); try { EditLesson.run(infoLesson.getLesson(), space); } catch (final DomainException domainException) { final ActionErrors actionErrors = new ActionErrors(); actionErrors.add(domainException.getMessage(), new ActionError(domainException.getMessage(), domainException.getArgs())); saveErrors(request, actionErrors); } return viewAllLessonDates(mapping, form, request, response); }
public ActionForward deleteLessonInstances(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { final SortedSet<NextPossibleSummaryLessonsAndDatesBean> set = new TreeSet<NextPossibleSummaryLessonsAndDatesBean>(); for (final String lessonDate : request.getParameterValues("lessonDatesToDelete")) { set.add(NextPossibleSummaryLessonsAndDatesBean.getNewInstance(lessonDate)); } try { DeleteLessonInstance.run(set); ActionErrors actionErrors = new ActionErrors(); for (final NextPossibleSummaryLessonsAndDatesBean n : set) { actionErrors.add(null, new ActionError("message.deleteLesson", n.getDate())); } saveErrors(request, actionErrors); } catch (UnsupportedOperationException unsupportedOperationException) { ActionErrors actionErrors = new ActionErrors(); for (final NextPossibleSummaryLessonsAndDatesBean n : set) { actionErrors.add(unsupportedOperationException.getMessage(), new ActionError("error.Lesson.not.instanced", n.getDate())); } saveErrors(request, actionErrors); } catch (DomainException domainException) { ActionErrors actionErrors = new ActionErrors(); actionErrors.add(domainException.getMessage(), new ActionError(domainException.getMessage())); saveErrors(request, actionErrors); } return viewAllLessonDates(mapping, form, request, response); }
private void addMissingValueError(ActionErrors errors, String field) { ActionMessage error = new ActionMessage("field.value.missing", field); errors.add(ActionMessages.GLOBAL_MESSAGE, error); } }
throws JspException { ActionErrors errors = new ActionErrors(); errors.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage((String) value)); errors.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage(keys[i]));
public ActionForward deleteClasses(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaActionForm deleteClassesForm = (DynaActionForm) form; String[] selectedClasses = (String[]) deleteClassesForm.get("selectedItems"); if (selectedClasses.length == 0) { ActionErrors actionErrors = new ActionErrors(); actionErrors.add("errors.classes.notSelected", new ActionError("errors.classes.notSelected")); saveErrors(request, actionErrors); return mapping.getInputForward(); } List<String> classOIDs = new ArrayList<String>(); for (String selectedClasse : selectedClasses) { classOIDs.add(selectedClasse); } DeleteClasses.run(classOIDs); return listClasses(mapping, form, request, response); }
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (null == username || 0 == username.length()) { addMissingValueError(errors, "username"); } if (null == password || 0 == password.length()) { addMissingValueError(errors, "password"); } return errors; }