org.apache.struts.action.ActionForward Java Examples

The following examples show how to use org.apache.struts.action.ActionForward. 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
Source File: AddGroupsAction.java    From uyuni with 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 #2
Source File: ErasmusCandidacyProcessDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
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
Source File: BarcodeInventoryErrorAction.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
/** 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 #4
Source File: EditAccountAction.java    From jpetstore-kubernetes with 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 #5
Source File: KualiDocumentActionBase.java    From rice with Educational Community License v2.0 6 votes vote down vote up
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 #6
Source File: BaseListAction.java    From uyuni with 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 #7
Source File: SendMailMarkSheetDispatchAction.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 #8
Source File: KualiInquiryAction.java    From rice with 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 #9
Source File: PurchasingActionBase.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 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 #10
Source File: TravelActionBase.java    From kfs with 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 #11
Source File: ScientificCouncilManageThesisDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 File: RegistrationDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 #13
Source File: SecureBaseAction.java    From jpetstore-kubernetes with 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 #14
Source File: NotifySetupAction.java    From spacewalk with 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 #15
Source File: BatchAction.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * This method confirms and performs batch cancel.
 * 
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
public ActionForward confirmAndCancel(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

    PdpBatchQuestionCallback callback = new PdpBatchQuestionCallback() {
        public boolean doPostQuestion(String batchIdString, String cancelNote, Person user) {
            return performCancel(batchIdString, cancelNote, user);
        }
    };
    return askQuestionWithInput(mapping, form, request, response, PdpKeyConstants.BatchConstants.Confirmation.CANCEL_BATCH_QUESTION, PdpKeyConstants.BatchConstants.Confirmation.CANCEL_BATCH_MESSAGE, PdpKeyConstants.BatchConstants.Messages.BATCH_SUCCESSFULLY_CANCELED, "confirmAndCancel", callback);

}
 
Example #16
Source File: ComUserFormExecuteAction.java    From openemm with GNU Affero General Public License v3.0 5 votes vote down vote up
protected ActionForward handleFormNotFound(ActionMapping mapping, HttpServletRequest request, HttpServletResponse res, Map<String, Object> param) throws IOException {
	final ComSupportForm supportForm = new ComSupportForm();

	final Enumeration<String> parameterEnumeration = request.getParameterNames();
	while (parameterEnumeration.hasMoreElements()) {
		final String paramName =parameterEnumeration.nextElement();
		final String[] paramValues = request.getParameterValues(paramName);

		for (String paramValue : paramValues) {
			supportForm.addParameter(paramName, paramValue);
		}
	}
	supportForm.setUrl(request.getRequestURL() + "?" + request.getQueryString());

	request.setAttribute("supportForm", supportForm);

	// Check, that "agnFN" and "agnCI" parameters are both present
	if (request.getParameter("agnFN") != null && !request.getParameter("agnFN").equals("") && request.getParameter("agnCI") != null
			&& !request.getParameter("agnCI").equals("")) {
		try {
			final int companyID = Integer.parseInt(request.getParameter("agnCI"));
			final ComCompany company = this.comCompanyDao.getCompany(companyID);
			
			request.setAttribute("SHOW_SUPPORT_BUTTON", company != null && company.getStatus().equals("active"));
			
			return mapping.findForward("form_not_found");
		} catch(final Exception e) {
			logger.warn("Error viewing form-not-found message", e);
			
			return null;
		}
	} else {
		return null;
	}
}
 
Example #17
Source File: CommonPhdIndividualProgramProcessDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward viewProcessAlertMessages(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) {

    TreeSet<PhdAlertMessage> orderedMessages =
            new TreeSet<PhdAlertMessage>(Collections.reverseOrder(PhdAlertMessage.COMPARATOR_BY_WHEN_CREATED_AND_ID));
    orderedMessages.addAll(getProcess(request).getAlertMessagesForLoggedPerson());
    ArrayList<PhdAlertMessage> lastMessages = new ArrayList<PhdAlertMessage>();
    lastMessages.addAll(orderedMessages);

    request.setAttribute("unread", "false");
    request.setAttribute("alertMessages", lastMessages.subList(0, Math.min(lastMessages.size(), NUMBER_OF_LAST_MESSAGES)));
    request.setAttribute("tooManyMessages", (lastMessages.size() > NUMBER_OF_LAST_MESSAGES) ? "true" : "false");
    return mapping.findForward("viewProcessAlertMessages");
}
 
Example #18
Source File: PhdIndividualProgramProcessDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward prepareSendPhdEmail(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) {
    final PhdIndividualProgramProcess process = getProcess(request);
    final PhdIndividualProgramProcessEmailBean emailBean = new PhdIndividualProgramProcessEmailBean();

    emailBean.setProcess(process);

    request.setAttribute("emailBean", emailBean);

    return mapping.findForward("sendPhdIndividualProcessEmail");
}
 
Example #19
Source File: StudentPricesAction.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public ActionForward execute(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) {

    request.setAttribute("postingRulesByAdminOfficeType", getPostingRulesByAdminOfficeType());
    request.setAttribute("insurancePostingRule", getInsurancePR());

    return mapping.findForward("viewPrices");
}
 
Example #20
Source File: ErasmusIndividualCandidacyProcessDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward fillDegreeInformation(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) {

    MobilityIndividualApplicationProcessBean bean = getIndividualCandidacyProcessBean();
    request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);

    request.setAttribute("degreeCourseInformationBean", new DegreeCourseInformationBean(
            (ExecutionYear) getIndividualCandidacyProcessBean().getCandidacyProcess().getCandidacyExecutionInterval(),
            (MobilityApplicationProcess) getIndividualCandidacyProcessBean().getCandidacyProcess()));
    request.setAttribute("mobilityIndividualApplicationProcessBean", bean);
    return mapping.findForward("fill-degree-information");
}
 
Example #21
Source File: ExternalSupervisorViewDegreeDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward degreePostback(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) {
    ExternalSupervisorViewsBean bean = getRenderedObject("sessionBean");

    if (bean.getMegavisor()) {
        boolean selectProtocol = true;
        request.setAttribute("selectProtocol", selectProtocol);
    }

    RenderUtils.invalidateViewState();
    request.setAttribute("sessionBean", bean);

    return mapping.findForward("selectDegree");
}
 
Example #22
Source File: RankChannelsAction.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Updates the set and then applies changes to the server
 * @param mapping struts ActionMapping
 * @param formIn struts ActionForm
 * @param request HttpServletRequest
 * @param response HttpServletResponse
 * @return An action forward to the success page
 */
public ActionForward update(ActionMapping mapping,
        ActionForm formIn, HttpServletRequest request,
        HttpServletResponse response) {
    RequestContext context = new RequestContext(request);
    // if its not javascript enabled, can't do much report error
    if (!context.isJavaScriptEnabled()) {
        return handleNoScript(mapping, formIn, request, response);
    }

    User user = context.getCurrentUser();
    DynaActionForm form = (DynaActionForm) formIn;
    Server server = context.lookupAndBindServer();

    ConfigurationManager cfgMgr = ConfigurationManager.getInstance();
    List<ConfigChannel> configChannelList = getChannelIds(form).stream()
            .map(chid -> cfgMgr.lookupConfigChannel(user, chid))
            .collect(Collectors.toList());
    server.subscribeConfigChannels(configChannelList, user);

    RhnSet set = getRhnSet(user);
    set.clear();
    RhnSetManager.store(set);

    // bz 444517 - Create a snapshot to capture this change
    String message =
        LocalizationService.getInstance().getMessage("snapshots.configchannel");
    SystemManager.snapshotServer(server, message);

    String[] params = {StringUtil.htmlifyText(server.getName())};
    getStrutsDelegate().saveMessage("sdc.config.rank.jsp.success",
                                                params, request);
    return getStrutsDelegate().forwardParam(mapping.findForward("success"),
            RequestContext.SID, server.getId().toString());
}
 
Example #23
Source File: NewPasswordAction.java    From Films with 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;
}
 
Example #24
Source File: GetTopTitleInfoAction.java    From ezScrum with GNU General Public License v2.0 5 votes vote down vote up
public ActionForward execute(ActionMapping mapping, ActionForm form,
		HttpServletRequest request, HttpServletResponse response) {
	
	ProjectObject project = SessionManager.getProjectObject(request);
	IUserSession session = (IUserSession) request.getSession().getAttribute("UserSession");
	AccountObject account = session.getAccount();
	
	String userName = account.getUsername();
	String nickName = account.getNickName();
	String userInfo = userName + "(" + nickName + ")";
	String projectName = "";
	
	if (project != null) {
		projectName = project.getName();
	}
	
	TopTitleInfoUI ttiui = new TopTitleInfoUI(userInfo, projectName);
	Gson gson = new Gson();
	
	response.setContentType("text/html; charset=utf-8");
	try {
		response.getWriter().write(gson.toJson(ttiui));
		response.getWriter().close();
	} catch (IOException e) {
		e.printStackTrace();
	}
	
	return null;
}
 
Example #25
Source File: CashManagementAction.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return ActionForward
 * @throws Exception
 */
public ActionForward addInterimDeposit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    CashManagementForm cmForm = (CashManagementForm) form;
    CashManagementDocument cmDoc = cmForm.getCashManagementDocument();

    checkDepositAuthorization(cmForm, cmDoc);

    String wizardUrl = buildDepositWizardUrl(cmDoc, DepositConstants.DEPOSIT_TYPE_INTERIM);
    return new ActionForward(wizardUrl, true);
}
 
Example #26
Source File: FilmCenterAction.java    From Films with 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 #27
Source File: ManageAssociatedObjects.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 #28
Source File: ExternalUnitsDispatchAction.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 #29
Source File: PhdMeetingSchedulingProcessDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 #30
Source File: PublicEPFLPhdProgramsCandidacyProcessDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
private ActionForward viewCandidacy(ActionMapping mapping, HttpServletRequest request,
        final PhdProgramPublicCandidacyHashCode hashCode) {

    if (hashCode == null || !hashCode.hasCandidacyProcess()) {
        return mapping.findForward("createCandidacyStepOne");
    }

    PhdIndividualProgramProcess phdProcess = hashCode.getIndividualProgramProcess();

    final PhdProgramCandidacyProcessBean bean = new PhdProgramCandidacyProcessBean();
    bean.setCandidacyHashCode(hashCode);

    request.setAttribute("candidacyBean", bean);
    request.setAttribute("individualProgramProcess", phdProcess);
    canEditCandidacy(request, bean.getCandidacyHashCode());
    canEditPersonalInformation(request, hashCode.getPerson());

    PersonBean personBean = new PersonBean(phdProcess.getPerson());
    initPersonBean(personBean, phdProcess.getPerson());
    request.setAttribute("personBean", personBean);

    request.setAttribute("candidacyPeriod", getPhdCandidacyPeriod(hashCode));
    validateProcess(request, hashCode.getIndividualProgramProcess());

    request.setAttribute("pendingPartyContactBean", new PendingPartyContactBean(hashCode.getIndividualProgramProcess()
            .getPerson()));

    return mapping.findForward("viewCandidacy");
}