Java Code Examples for org.apache.struts.action.ActionForward

The following examples show how to use org.apache.struts.action.ActionForward. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/** why does this just send false to rules.....
 * @see org.kuali.rice.kns.web.struts.action.KualiDocumentActionBase#approve(org.apache.struts.action.ActionMapping,
 *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public ActionForward approve(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    BarcodeInventoryErrorForm bcieForm = (BarcodeInventoryErrorForm) form;
    BarcodeInventoryErrorDocument document = bcieForm.getBarcodeInventoryErrorDocument();
    //prevent approval before save if barcode inventory item list not validated
    if(!document.isDocumentCorrected()){
        GlobalVariables.getMessageMap().putError(CamsPropertyConstants.BarcodeInventory.DOCUMENT_NUMBER, CamsKeyConstants.BarcodeInventory.ERROR_VALIDATE_ITEMS_BEFORE_APPROVE, document.getDocumentNumber());
        return mapping.findForward(KFSConstants.MAPPING_BASIC);
    }
    
    getBusinessObjectService().save(document.getBarcodeInventoryErrorDetail());

    if (this.getAssetBarcodeInventoryLoadService().isCurrentUserInitiator(document)) {
        this.invokeRules(document, false);
    }

    return super.approve(mapping, form, request, response);
}
 
Example 2
public ActionForward executeInsertMobilityQuota(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws FenixServiceException {
    MobilityApplicationProcess process = getProcess(request);
    ErasmusVacancyBean bean = getErasmusVacancyBean();

    for (Degree degree : bean.getDegrees()) {
        if (process.getCandidacyPeriod().existsFor(bean.getMobilityAgreement(), degree)) {
            addActionMessage(request, "error.erasmus.insert.vacancy.already.exists");
            return mapping.findForward("insert-university-agreement");
        }
    }

    executeActivity(getProcess(request), "InsertMobilityQuota", bean);

    return prepareExecuteViewMobilityQuota(mapping, form, request, response, bean.getMobilityProgram());
}
 
Example 3
public ActionForward prepareGradesToSubmitSendMail(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws IOException {
    MarkSheetSendMailBean bean = (MarkSheetSendMailBean) RenderUtils.getViewState("sendMailBean").getMetaObject().getObject();

    Sender sender = bean.getDegree().getAdministrativeOffice().getUnit().getSender();

    Group teachersGroup = TeachersWithGradesToSubmitGroup.get(bean.getExecutionPeriod(), bean.getDegreeCurricularPlan());
    String message = getResources(request, "ACADEMIC_OFFICE_RESOURCES").getMessage("label.grades.to.submit.send.mail");
    NamedGroup namedGroup = new NamedGroup(new LocalizedString(I18N.getLocale(), message), teachersGroup);

    MessageBean messageBean = new MessageBean();
    messageBean.setLockedSender(sender);
    messageBean.addAdHocRecipient(namedGroup);
    messageBean.selectRecipient(namedGroup);

    return MessagingUtils.redirectToNewMessage(request, response, messageBean);
}
 
Example 4
Source Project: rice   Source File: KualiInquiryAction.java    License: Educational Community License v2.0 6 votes vote down vote up
/**
   * Gets an inquirable impl from the impl service name parameter. Then calls lookup service to retrieve the record from the
   * key/value parameters. Finally gets a list of Rows from the inquirable
   */
  public ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
      InquiryForm inquiryForm = (InquiryForm) form;
      if (inquiryForm.getBusinessObjectClassName() == null) {
          LOG.error("Business object name not given.");
          throw new RuntimeException("Business object name not given.");
      }
      
      Class boClass = Class.forName(inquiryForm.getBusinessObjectClassName());
      ModuleService responsibleModuleService = KRADServiceLocatorWeb.getKualiModuleService().getResponsibleModuleService(boClass);
if(responsibleModuleService!=null && responsibleModuleService.isExternalizable(boClass)){
	String redirectUrl = responsibleModuleService.getExternalizableBusinessObjectInquiryUrl(boClass, (Map<String, String[]>) request.getParameterMap());
	ActionForward redirectingActionForward = new RedirectingActionForward(redirectUrl);
	redirectingActionForward.setModule("/");
	return redirectingActionForward;
}

return continueWithInquiry(mapping, form, request, response);
  }
 
Example 5
/**
 * Delete an item from the document.
 *
 * @param mapping An ActionMapping
 * @param form An ActionForm
 * @param request The HttpServletRequest
 * @param response The HttpServletResponse
 * @throws Exception
 * @return An ActionForward
 */
public ActionForward deleteItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;

    PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();

    if (!purDocument.getPurchasingCapitalAssetItems().isEmpty()) {
        purDocument.setPurchasingCapitalAssetItems(new PurApArrayList(purDocument.getPurchasingCapitalAssetItemClass()));
        SpringContext.getBean(PurapService.class).saveDocumentNoValidation(purDocument);
    }
    // End


    purDocument.deleteItem(getSelectedLine(request));

    if (StringUtils.isNotBlank(purDocument.getCapitalAssetSystemTypeCode())) {
        boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedUpdateCamsViewPurapEvent(purDocument));
        if (rulePassed) {
            SpringContext.getBean(PurchasingService.class).setupCapitalAssetItems(purDocument);
        }
    }
    // End

    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
 
Example 6
Source Project: kfs   Source File: TravelActionBase.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * This method will be called when user clicks on Destination not found button on UI under Traveler information section, and
 * enables state code and county fields by setting primary destination indicator to true.
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return ActionForward
 * @throws Exception
 */
public ActionForward enablePrimaryDestinationFields(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    TravelFormBase baseForm = (TravelFormBase) form;
    TravelDocumentBase document = (TravelDocumentBase) baseForm.getDocument();

    document.setPrimaryDestinationIndicator(true);
    document.setPrimaryDestinationId(TemConstants.CUSTOM_PRIMARY_DESTINATION_ID);
    // initialize as new primary dest object.
    if (document.getPrimaryDestination() != null) {
        document.getPrimaryDestination().setId(TemConstants.CUSTOM_PRIMARY_DESTINATION_ID);
        document.getPrimaryDestination().setVersionNumber(null);
        document.getPrimaryDestination().setObjectId(null);
    }
    else {
        document.setPrimaryDestination(new PrimaryDestination());
        document.getPrimaryDestination().setId(TemConstants.CUSTOM_PRIMARY_DESTINATION_ID);
        document.getPrimaryDestination().setPrimaryDestinationName(document.getPrimaryDestinationName());
        document.getPrimaryDestination().getRegion().setRegionName(document.getPrimaryDestinationCountryState());
        document.getPrimaryDestination().setCounty(document.getPrimaryDestinationCounty());
        document.getPrimaryDestination().getRegion().setTripTypeCode(document.getTripTypeCode());
        document.getPrimaryDestination().getRegion().setTripType(document.getTripType());
    }

    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
 
Example 7
public ActionForward viewAttends(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) {
    RenderUtils.invalidateViewState();

    final Registration registration = getAndSetRegistration(request);
    request.setAttribute("registration", registration);

    if (registration != null) {
        final SortedMap<ExecutionSemester, SortedSet<Attends>> attendsMap =
                new TreeMap<ExecutionSemester, SortedSet<Attends>>();
        for (final Attends attends : registration.getAssociatedAttendsSet()) {
            final ExecutionSemester executionSemester = attends.getExecutionPeriod();
            SortedSet<Attends> attendsSet = attendsMap.get(executionSemester);
            if (attendsSet == null) {
                attendsSet = new TreeSet<Attends>(Attends.ATTENDS_COMPARATOR);
                attendsMap.put(executionSemester, attendsSet);
            }
            attendsSet.add(attends);
        }
        request.setAttribute("attendsMap", attendsMap);
    }

    return mapping.findForward("viewAttends");
}
 
Example 8
Source Project: jpetstore-kubernetes   Source File: SecureBaseAction.java    License: Apache License 2.0 6 votes vote down vote up
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
  AccountActionForm acctForm = (AccountActionForm) request.getSession().getAttribute("accountForm");
  if (acctForm == null || acctForm.getAccount() == null) {
    String url = request.getServletPath();
    String query = request.getQueryString();
    if (query != null) {
      request.setAttribute("signonForwardAction", url+"?"+query);
    }
	else {
      request.setAttribute("signonForwardAction", url);
    }
    return mapping.findForward("global-signon");
  }
else {
    return doExecute(mapping, form, request, response);
  }
}
 
Example 9
Source Project: spacewalk   Source File: NotifySetupAction.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public ActionForward execute(ActionMapping mapping,
                             ActionForm formIn,
                             HttpServletRequest request,
                             HttpServletResponse response) {

    /*
     * Notifications can only be sent for a published errata.
     */
    Errata errata = new RequestContext(request).lookupErratum();
    if (!errata.isPublished()) {
        throw new BadParameterException("Unpublished errata.");
    }

    //return the default for errata
    return super.execute(mapping, formIn, request, response);
}
 
Example 10
Source Project: uyuni   Source File: AddGroupsAction.java    License: GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
public ActionForward handleDispatch(ListSessionSetHelper helper,
                                ActionMapping mapping,
        ActionForm formIn, HttpServletRequest request,
        HttpServletResponse response) {
    RequestContext context = new RequestContext(request);
    ActivationKey key = context.lookupAndBindActivationKey();
    User user = context.getCurrentUser();
    ServerGroupManager sgm = ServerGroupManager.getInstance();
    for (String id : helper.getSet()) {
        Long sgid = Long.valueOf(id);
        key.addServerGroup(sgm.lookup(sgid, user));
    }
    getStrutsDelegate().saveMessage(
                "activation-key.groups.jsp.added",
                    new String [] {String.valueOf(helper.getSet().size())}, request);

    Map<String, Object> params = new HashMap<String, Object>();
    params.put(RequestContext.TOKEN_ID, key.getToken().getId().toString());
    StrutsDelegate strutsDelegate = getStrutsDelegate();
    return strutsDelegate.forwardParams
                    (mapping.findForward("success"), params);
}
 
Example 11
public ActionForward changeParticipationInfo(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    String target = request.getParameter("target");

    if (target == null) {
        return editProposal(mapping, actionForm, request, response);
    }

    Thesis thesis = getThesis(request);
    ThesisEvaluationParticipant participant = FenixFramework.getDomainObject(target);

    PersonTarget targetType = getPersonTarget(participant.getType());

    request.setAttribute("targetType", targetType);
    request.setAttribute("participant", participant);
    return mapping.findForward("editParticipant");
}
 
Example 12
Source Project: jpetstore-kubernetes   Source File: EditAccountAction.java    License: Apache License 2.0 6 votes vote down vote up
protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
  AccountActionForm acctForm = (AccountActionForm) form;
if (AccountActionForm.VALIDATE_EDIT_ACCOUNT.equals(acctForm.getValidate())) {
	acctForm.getAccount().setListOption(request.getParameter("account.listOption") != null);
	acctForm.getAccount().setBannerOption(request.getParameter("account.bannerOption") != null);
	Account account = acctForm.getAccount();
	getPetStore().updateAccount(account);
	acctForm.setAccount(getPetStore().getAccount(account.getUsername()));
	PagedListHolder myList = new PagedListHolder(getPetStore().getProductListByCategory(account.getFavouriteCategoryId()));
	myList.setPageSize(4);
	acctForm.setMyList(myList);
	request.getSession().setAttribute("accountForm", acctForm);
	request.getSession().removeAttribute("workingAccountForm");
	return mapping.findForward("success");
}
else {
	request.setAttribute("message", "Your account was not updated because the submitted information was not validated.");
	return mapping.findForward("failure");
}
}
 
Example 13
public ActionForward superUserDisapprove(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
	KualiDocumentFormBase documentForm = (KualiDocumentFormBase)form;
	if(StringUtils.isBlank(documentForm.getSuperUserAnnotation())) {
		GlobalVariables.getMessageMap().putErrorForSectionId("superuser.errors", "superuser.disapprove.annotation.missing", "");
		return mapping.findForward(RiceConstants.MAPPING_BASIC);
	} else if (!documentForm.getSelectedActionRequests().isEmpty()) {
        GlobalVariables.getMessageMap().putErrorForSectionId("superuser.errors", "superuser.disapprove.when.actions.checked", "");
        return mapping.findForward(RiceConstants.MAPPING_BASIC);
    } else if (!documentForm.isStateAllowsApproveOrDisapprove()) {
        GlobalVariables.getMessageMap().putErrorForSectionId("superuser.errors", "superuser.disapprove.not.allowed", "");
        return mapping.findForward(RiceConstants.MAPPING_BASIC);
    }

    WorkflowDocumentActionsService documentActions = getWorkflowDocumentActionsService(documentForm.getWorkflowDocument().getDocumentTypeId());
    DocumentActionParameters parameters = DocumentActionParameters.create(documentForm.getDocId(), GlobalVariables.getUserSession().getPrincipalId(), documentForm.getSuperUserAnnotation());
    documentActions.superUserDisapprove(parameters, true);
    GlobalVariables.getMessageMap().putInfo("document", "general.routing.superuser.disapproved", documentForm.getDocId());
    documentForm.setSuperUserAnnotation("");
    return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
 
Example 14
Source Project: uyuni   Source File: BaseListAction.java    License: GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public ActionForward execute(ActionMapping mapping,
                             ActionForm formIn,
                             HttpServletRequest request,
                             HttpServletResponse response) {
    setup(request);
    ListSessionSetHelper helper = new ListSessionSetHelper(this,
                                    request, getParamsMap(request));
    processHelper(helper);
    helper.execute();
    if (helper.isDispatched()) {
        ActionForward forward =
            handleDispatch(helper, mapping, formIn, request, response);
        processPostSubmit(helper);
        return forward;
    }
    return mapping.findForward(RhnHelper.DEFAULT_FORWARD);
}
 
Example 15
public ActionForward deleteExternalUnit(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws FenixServiceException {

    final Unit unit = getUnit(request);
    final Unit parent = getAnyParentUnit(unit);

    try {
        DeleteExternalUnit.run(unit);
    } catch (final DomainException e) {
        addActionMessage("error", request, e.getMessage());
        request.setAttribute("unit", unit);
        return mapping.findForward("prepareDeleteUnit");
    }

    return viewUnit(mapping, request, parent);
}
 
Example 16
public ActionForward chooseDegreeCurricularPlans(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws FenixServiceException {

    try {

        DynaActionForm actionForm = (DynaActionForm) form;
        String degreeType = (String) actionForm.get("degreeType");

        if (StringUtils.isEmpty(degreeType)) {
            degreeType = request.getParameter("degreeType");
        }

        if (StringUtils.isEmpty(degreeType)) {
            throw new DomainException("error.selection.noDegreeType");
        }

        Collection<InfoDegreeCurricularPlan> degreeCurricularPlans =
                ReadActiveDegreeCurricularPlansByDegreeType.runForAcademicAdmin(Predicate.isEqual(FenixFramework
                        .getDomainObject(degreeType)));
        List<InfoExecutionPeriod> executionPeriods = ReadNotClosedExecutionPeriods.run();

        request.setAttribute("degreeCurricularPlans", degreeCurricularPlans);
        request.setAttribute("executionPeriods", executionPeriods);
        request.setAttribute("degreeType", degreeType);
    } catch (DomainException e) {
        addActionMessage("error", request, e.getMessage());
        return chooseDegreeType(mapping, form, request, response);
    }

    return mapping.findForward("chooseDegreeCurricularPlans");

}
 
Example 17
Source Project: iaf   Source File: ShowSecurityItems.java    License: Apache License 2.0 5 votes vote down vote up
public ActionForward executeSub(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

		// Initialize action
		initAction(request);
		if(ibisManager==null)return (mapping.findForward("noIbisContext"));

		XmlBuilder securityItems = new XmlBuilder("securityItems");
		addRegisteredAdapters(securityItems);
		addApplicationDeploymentDescriptor(securityItems);
		addSecurityRoleBindings(securityItems);

		String confResString;
		try {
			confResString = Misc.getConfigurationResources();
			if (confResString!=null) {
				confResString = XmlUtils.removeNamespaces(confResString);
			}
		} catch (IOException e) {
			log.warn("error getting configuration resources", e);
			confResString = null;
		}

		addJmsRealms(securityItems);
		addProvidedJmsDestinations(securityItems, confResString);
		addSapSystems(securityItems);
		addAuthEntries(securityItems, request);
		addConfServerProps(securityItems);

		request.setAttribute("secItems", securityItems.toXML());

		// Forward control to the specified success URI
		log.debug("forward to success");
		return (mapping.findForward("success"));
	}
 
Example 18
Source Project: uyuni   Source File: CobblerAction.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc}
 * @param mapping the ActionMapping
 * @param formIn the ActionForm
 * @param request the HttpServletRequest
 * @param response the HttpServletResponse
 * @return the ActionForward
 */
@Override
public ActionForward execute(ActionMapping mapping,
                             ActionForm formIn,
                             HttpServletRequest request,
                             HttpServletResponse response) {
    RequestContext ctx = new RequestContext(request);
    ActionErrors errors = new ActionErrors();

    if (ctx.isSubmitted()) {
        ValidatorError ve;
        try {
            ve = new CobblerSyncCommand(ctx.getCurrentUser()).store();
        }
        catch (Exception ex) {
            this.getStrutsDelegate().addError(errors,
                                              "cobbler.jsp.xmlrpc.fail",
                                              ex.getLocalizedMessage());
            this.getStrutsDelegate().saveMessages(request, errors);
            return mapping.findForward(RhnHelper.DEFAULT_FORWARD);
        }

        if (ve == null) {
            addMessage(request, "cobbler.jsp.synced");
        }
        else {
            getStrutsDelegate().addError(errors, ve.getKey(), ve.getValues());
            getStrutsDelegate().saveMessages(request, errors);
        }
    }

    return mapping.findForward(RhnHelper.DEFAULT_FORWARD);
}
 
Example 19
public ActionForward prepareValidateJury(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) {

    final PhdThesisProcessBean bean = new PhdThesisProcessBean();
    bean.setWhenJuryValidated(new LocalDate());

    request.setAttribute("thesisBean", bean);
    return mapping.findForward("validateJury");
}
 
Example 20
private ActionForward returnToCreateComplexSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        SummariesManagementBean summaryBean, Exception e) {

    if (e != null) {
        addActionMessage(request, e.getMessage());
    }
    setTeacherDataToFormBean((DynaActionForm) form, summaryBean);
    request.setAttribute("summariesManagementBean", summaryBean);
    return mapping.findForward("prepareInsertComplexSummary");
}
 
Example 21
/**
 * This method confirms and cancels a payment.
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
public ActionForward confirmAndCancel(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

    PdpPaymentDetailQuestionCallback callback = new PdpPaymentDetailQuestionCallback() {
        public boolean doPostQuestion(int paymentDetailId, String changeText, Person user) {
            return performCancel(paymentDetailId, changeText, user);
        }
    };

    return askQuestionWithInput(mapping, form, request, response, PdpKeyConstants.PaymentDetail.Confirmation.CANCEL_PAYMENT_QUESTION, PdpKeyConstants.PaymentDetail.Confirmation.CANCEL_PAYMENT_MESSAGE, PdpKeyConstants.PaymentDetail.Messages.PAYMENT_SUCCESSFULLY_CANCELED, "confirmAndCancel", callback);
}
 
Example 22
@Atomic
public ActionForward remove(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
    Party party = FenixFramework.getDomainObject(request.getParameter("provider"));
    Collection<Party> externalScholarshipProvider = Bennu.getInstance().getExternalScholarshipProviderSet();
    externalScholarshipProvider.remove(party);
    return redirect("/externalScholarshipProvider.do?method=list", request);
}
 
Example 23
public ActionForward prepareEditProcessAttributes(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) {
    PublicPresentationSeminarProcessBean bean =
            new PublicPresentationSeminarProcessBean(getProcess(request).getIndividualProgramProcess());
    request.setAttribute("processBean", bean);

    return mapping.findForward("editProcessAttributes");
}
 
Example 24
/**
 * This method sets up to forward to the BC Organization Selection screen using a specific operating mode. The various operating
 * modes include PULLUP, PUSHDOWN, REPORTS, SALSET, ACCOUNT.
 *
 * @param opMode
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
public ActionForward performOrgSelectionTree(OrgSelOpMode opMode, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;

    this.flagBCInProgress();

    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, BCConstants.ORG_SEL_TREE_METHOD);
    parameters.put("operatingMode", opMode.toString());
    parameters.put("universityFiscalYear", budgetConstructionSelectionForm.getUniversityFiscalYear().toString());

    String lookupUrl = BudgetUrlUtil.buildBudgetUrl(mapping, budgetConstructionSelectionForm, BCConstants.ORG_SEL_TREE_ACTION, parameters);

    return new ActionForward(lookupUrl, true);
}
 
Example 25
public ActionForward viewApplication(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) {

    final Registration registration = getAndSetRegistration(request);
    request.setAttribute("registration", registration);

    return mapping.findForward("view-application");
}
 
Example 26
/**
 * Schedules an Action Chain.
 * @param mapping current mapping object
 * @param request current request object
 * @param form current form object
 * @param actionChain current Action Chain
 * @return
 */
private ActionForward schedule(ActionMapping mapping, HttpServletRequest request,
    DynaActionForm form, ActionChain actionChain) {
    Date date = getStrutsDelegate().readDatePicker(form, DATE_ATTRIBUTE,
        DatePicker.YEAR_RANGE_POSITIVE);
    ActionChainFactory.schedule(actionChain, date);
    ActionMessages messages = new ActionMessages();
    messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
        "actionchain.jsp.scheduled", actionChain.getLabel()));
    getStrutsDelegate().saveMessages(request, messages);
    return mapping.findForward(TO_LIST_FORWARD);
}
 
Example 27
public ActionForward requestScheduleFirstThesisMeeting(ActionMapping mapping, ActionForm actionForm,
        HttpServletRequest request, HttpServletResponse response) {

    final PhdThesisProcessBean bean = getRenderedObject("thesisProcessBean");
    try {
        ExecuteProcessActivity.run(getProcess(request).getMeetingProcess(), ScheduleFirstThesisMeetingRequest.class, bean);

    } catch (final DomainException e) {
        addErrorMessage(request, e.getMessage(), e.getArgs());
        request.setAttribute("thesisProcessBean", bean);
        return mapping.findForward("requestScheduleThesisMeeting");
    }

    return viewMeetingSchedulingProcess(request, getProcess(request));
}
 
Example 28
public ActionForward editDepartment(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    AssociatedObjectsBean bean = getRenderedObject();

    atomic(() -> {
        Department d = bean.getDepartment();
        d.setCode(bean.getCode());
        d.setName(bean.getName());
        d.setRealName(bean.getRealName());
        d.setRealNameEn(bean.getRealNameEn());
        d.setCompetenceCourseMembersGroup(Group.parse(bean.getMembersGroupExpression()));
    });

    return list(mapping, form, request, response);
}
 
Example 29
Source Project: Films   Source File: FilmCenterAction.java    License: Apache License 2.0 5 votes vote down vote up
public ActionForward postMovie(ActionMapping mapping, ActionForm form,
		HttpServletRequest request, HttpServletResponse response) throws IOException {
	// TODO Auto-generated method stub
	request.setCharacterEncoding("utf-8");
	response.setContentType("text/html;charset=utf-8");
	PrintWriter out = response.getWriter();
	Film film = new Film();
	MovieForm movieForm = (MovieForm) form;
	FormFile photo = movieForm.getFilmPhoto();
	film.setFfilmName(movieForm.getFFilmName());
	film.setFdiretor(movieForm.getFDirector());
	film.setFplay(movieForm.getFPlay());
	film.setFlanguage(movieForm.getFLanguage());
	film.setFlong(Integer.parseInt(movieForm.getFLong()));
	film.setFdate(movieForm.getFDate());
	film.setFtype(movieForm.getFType());
	film.setFintro(movieForm.getFIntro());

	//get sort
	Sort sort = (Sort) sortService.findById(Sort.class, Integer.valueOf(movieForm.getSortID()));
	
	//get area
	Area area = (Area) areaService.findById(Area.class, Integer.valueOf(movieForm.getFAid()));

	film.setArea(area);
	film.setSort(sort);
	filmService.save(film);
	
	String fphoto = MyTools.uploadFilmPhoto(request, photo, film.getFid()+"");
	film.setFphoto(fphoto);
	filmService.save(film);
	
	out.print("<script language='javascript'>alert('post success!');window.history.back(-1);</script>");
	return null;
}
 
Example 30
Source Project: Films   Source File: NewPasswordAction.java    License: Apache License 2.0 5 votes vote down vote up
public ActionForward setPassword(ActionMapping mapping, ActionForm form,
		HttpServletRequest request, HttpServletResponse response) throws IOException {
	// TODO Auto-generated method stub
	request.setCharacterEncoding("utf-8");
	response.setContentType("text/html;charset=utf-8");
	PrintWriter out = response.getWriter();
	NewPasswordForm newPasswordForm = (NewPasswordForm) form;
	String newPwd = newPasswordForm.getNewPassWord();
	user.setUpassword(MyTools.MD5(newPwd));
	userService.update(user);
	request.getSession().invalidate();
	//window.history.back(-1);
	out.print("<script language='javascript'>alert('Change password success!Please relogin!');window.history.back(-1);</script>");
	return null;
}