Package org.primefaces.context

Examples of org.primefaces.context.RequestContext


     *
     * @param actEvent   contains information about the event that triggers the execution of this operation
     */
    public void UpdateProfile(ActionEvent actEvent) {

        RequestContext ctx = RequestContext.getCurrentInstance();
        FacesMessage msg = null;

        try {

            AddressDTO shipAdr = _customerWebService.getCustomerServiceImplPort().maintainAddress(
View Full Code Here


     *
     * @param actEvent  contains information about the event that triggers the execution of this operation
     */
    public void ChangePin(ActionEvent actEvent) {

        RequestContext ctx = RequestContext.getCurrentInstance();
        FacesMessage msg = null;
        boolean bChangedPin = false;

        try {

            if (!getLoggedOnUser().getChangePin().getNewPin().equals(getLoggedOnUser().getChangePin().getRetryPin())) {
                bChangedPin = false;
                msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Password mismatch",
                        "Please make sure that your re-type your pin correctly!");
            } else {
                BaseDTO result = _customerWebService.getCustomerServiceImplPort().changeCustomer(
                        getLoggedOnUser().getProfileData().getUserName(),
                        getLoggedOnUser().getChangePin().getCurrentPin(),
                        getLoggedOnUser().getChangePin().getNewPin());

                if (result.getReturncode() == 0) {

                    bChangedPin = true;
                    msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Pin changed", "Your pin has been changed successfully!");
                } else {

                    bChangedPin = false;
                    msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Pin not changed", result.getMessage());
                }
            }
        } catch (Exception ex) {

            bChangedPin = false;
            msg = new FacesMessage(FacesMessage.SEVERITY_FATAL, "Error communicating with customer web service!",
                    String.format("Unable to access customer web service at %s: %s",
                            _customerWebService.getWSDLDocumentLocation(),
                            ex.getMessage()));
        }

        if (msg != null)
            FacesContext.getCurrentInstance().addMessage(null, msg);

        ctx.addCallbackParam("changedPin", bChangedPin);
    }
View Full Code Here

    /**
     *   calls the event web service for persisting the current rating
     */
    public void RateEvent() {

        RequestContext ctx = RequestContext.getCurrentInstance();
        FacesMessage msg = null;
        boolean bRatingSuccess = false;

        try {

            BaseDTO result = _eventWebService.getEventServiceImplPort().rateEvent(
                    _ratingDetail.getEvent().getEventData(), _ratingDetail.getUser().getProfileData(),
                    _ratingDetail.getRating(), _ratingDetail.getComment());

            if (result.getReturncode() == 0) {

                bRatingSuccess = true;
                _ratingDetail = null;
                msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Rating submitted", "Thank you for your rating");

            } else {

                bRatingSuccess = false;
                msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Rating not submitted", result.getMessage());
            }

        } catch (Exception ex) {

            bRatingSuccess = false;
            msg = new FacesMessage(FacesMessage.SEVERITY_FATAL, "Error communicating with event web service!",
                    String.format("Unable to access customer web service at %s: %s",
                            _eventWebService.getWSDLDocumentLocation(),
                            ex.getMessage()));
        }

        if (msg != null)
            FacesContext.getCurrentInstance().addMessage(null, msg);

        ctx.addCallbackParam("ratingFinished", bRatingSuccess);
    }
View Full Code Here

TOP

Related Classes of org.primefaces.context.RequestContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.