当前位置: 首页>>代码示例>>Java>>正文


Java HandlesEvent类代码示例

本文整理汇总了Java中net.sourceforge.stripes.action.HandlesEvent的典型用法代码示例。如果您正苦于以下问题:Java HandlesEvent类的具体用法?Java HandlesEvent怎么用?Java HandlesEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HandlesEvent类属于net.sourceforge.stripes.action包,在下文中一共展示了HandlesEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveChanges

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("Save")
public Resolution saveChanges() {
    PersonManager pm = new PersonManager();

    // Save any changes to existing people (and create new ones)
    for (Person person : people) {
        pm.saveOrUpdate(person);
    }

    // Then, if the user checked anyone off to be deleted, delete them
    if (deleteIds != null) {
        for (int id : deleteIds) {
            pm.deletePerson(id);
        }
    }

    return new RedirectResolution(getClass());
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:19,代码来源:AdministerPeopleActionBean.java

示例2: initDefaultValueWithDefaultHandlerIfNeeded

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
/**
 * Ensure the default event name is set if the binding uses the $event parameter.
 * Can only be done safely after the event mappings have been processed.
 * see http://www.stripesframework.org/jira/browse/STS-803
 */
void initDefaultValueWithDefaultHandlerIfNeeded(ActionResolver actionResolver) {
    if (PARAMETER_NAME_EVENT.equals(name)) {
        Method defaultHandler;
        try {
            defaultHandler = actionResolver.getDefaultHandler(beanClass);
        } catch (StripesServletException e) {
            throw new StripesRuntimeException("Caught an exception trying to get default handler for ActionBean '" + beanClass.getName() +
                    "'. Make sure this ActionBean has a default handler.", e);
        }
        HandlesEvent annotation = defaultHandler.getAnnotation(HandlesEvent.class);
        if (annotation != null) {
            this.defaultValue = annotation.value();
        } else {
            this.defaultValue = defaultHandler.getName();
        }
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:23,代码来源:UrlBindingParameter.java

示例3: view

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("view")
public Resolution view() {

    List<ProductPromotion> productPromotions = productPromotionService.getProductPromotionByKey(promotionKey);
    if (productPromotions != null && productPromotions.size() != 0) {
        productPromotion = productPromotions.get(0);
        products = productPromotionService.getProducts(productPromotion);

        if (products != null && products.size() > 0) {
            Random randomizer = new Random();
            product = products.get(randomizer.nextInt(products.size()));
        }
    }

    return view("product_promotion/view");
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:17,代码来源:ProductPromotionAction.java

示例4: uploadFile

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@POST
@HandlesEvent("upload")
public Resolution uploadFile() {

    String errorMsg = null;

    if (upload != null) {

        try {
            mediaAsset = mediaAssetService.create(upload.getInputStream(), upload.getFileName());
            mediaAsset.setGroup(GROUP_CMS);
            mediaAssetService.update(mediaAsset);
            filename = mediaAsset.getName().getStr();
        } catch (IOException e) {
            errorMsg = e.getMessage();
            return new StreamingResolution("text/xml", errorMsg);
        }
        return view("ckeditor/file_select");
    }
    return new StreamingResolution("text/xml", "An unknown error has occurred!");
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:22,代码来源:FileManagerCKEditorAction.java

示例5: edit

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("edit")
public Resolution edit() {
    if (customerForm == null) {
        this.customerForm = new RegistrationForm();

        if (isCustomerLoggedIn()) {
            Customer customer = getLoggedInCustomer();

            this.customerForm.setEmail(customer.getEmail());
            this.customerForm.setPhone(customer.getPhone());

            this.customerForm.setForename(customer.getForename());
            this.customerForm.setSurname(customer.getSurname());
        }
    }

    return view("customer/registration/edit_form");
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:19,代码来源:RegistrationAction.java

示例6: subscribe

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@DefaultHandler
@HandlesEvent("subscribe")
public Resolution subscribe() {
    if (!antiSpamHelper.checkRequestCounter("contact")) {
        return json("{}");
    }

    System.out.println("[Newsletter subscription] = " + email);
    if (email != null) {
        newsSubscriberService.subscribe(email, "NEWS_SUBSCR", null);
    }

    app.publish("newsletter:subscription",
        Context.create("email", email, "action", "subscribe").setResponseListener(new ResponseListener() {
            @Override
            public void onResponse(Object response) {
            }
        }));

    return json("{}");
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:22,代码来源:NewsSubscriptionAction.java

示例7: listSaleData

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("list-sale-data")
public Resolution listSaleData()
{
	Map<String, Object> salesData = new HashMap<>();

	if (productIds != null && productIds.length > 0)
	{
		for (Id productId : productIds)
		{
			Map<String, Object> saleData = getProductSaleData(productId);

			if (saleData == null)
				return jsonError("An internal error occured. Please try again later.");

			salesData.put(productId.str(), saleData);
		}
	}
	return json(salesData);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:20,代码来源:CouponPromotionAction.java

示例8: newReview

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("new")
public Resolution newReview() {
    if (getId() == null)
        return new ErrorResolution(404);
    Product product = productService.getProduct(getId());
    if (product == null)
        return new ErrorResolution(404);

    if (isCustomerLoggedIn()) {
        if (customerReviewService.hasReview(getId(), ((Customer) getLoggedInCustomer()).getId())) {
            return redirect("/review/customer/" + ((Customer) getLoggedInCustomer()).getId());
        }
    }

    formAction = "/review/add/" + getId();
    redirectUrl = "/review/new/" + getId();
    return view("review/review_form");
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:19,代码来源:CustomerReviewAction.java

示例9: deleteReview

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("delete")
public Resolution deleteReview() {
    if (!isCustomerLoggedIn()) {
        return redirect("/customer/account/login");
    }

    if (getId() == null) {
        if (isCustomerLoggedIn()) {
            return redirect("/review/customer/" + ((Customer) getLoggedInCustomer()).getId());
        } else {
            return new ErrorResolution(404);
        }
    }

    CustomerReview review = customerReviewService.getCustomerReview(getId());
    if (review == null || !review.getCustomerId().equals(((Customer) getLoggedInCustomer()).getId()))
        return new ErrorResolution(404);

    customerReviewService.deleteReview(review);

    return redirect("/review/customer/" + ((Customer) getLoggedInCustomer()).getId());
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:23,代码来源:CustomerReviewAction.java

示例10: viewCustomerReviews

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("customer")
public Resolution viewCustomerReviews() {
    if (getId() == null)
        return new ErrorResolution(404);
    Customer customer = customerService.getCustomer(getId());
    if (customer == null)
        return new ErrorResolution(404);

    Boolean published = true;
    if (isCustomerLoggedIn()) {
        if (getId().equals(((Customer) getLoggedInCustomer()).getId()))
            published = null;
    }

    reviews = getCustomerReviews(published);
    pagingUri = "/review/customer/" + getId();
    return view("review/customer");
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:19,代码来源:CustomerReviewAction.java

示例11: markHelpful

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("helpful")
public Resolution markHelpful() {
    HashMap<String, String> result = new HashMap<>();
    if (!isCustomerLoggedIn()) {
        result.put("error", "not logged in");
        return json(Json.toJson(result));
    }
    Id customerId = ((Customer) getLoggedInCustomer()).getId();
    CustomerReview customerReview = customerReviewService.getCustomerReview(getId());
    if (customerReview != null) {
        if (!customerReview.getRatedByCustomer(customerId)) {
            customerReview.getThinkHelpful().add(((Customer) getLoggedInCustomer()).getId());
            customerReviewService.updateReview(customerReview);
        }
    }

    return json(Json.toJson(result));
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:19,代码来源:CustomerReviewAction.java

示例12: markUnhelpful

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("unhelpful")
public Resolution markUnhelpful() {
    HashMap<String, String> result = new HashMap<>();
    if (!isCustomerLoggedIn()) {
        result.put("error", "not logged in");
        return json(Json.toJson(result));
    }
    Id customerId = ((Customer) getLoggedInCustomer()).getId();
    CustomerReview customerReview = customerReviewService.getCustomerReview(getId());
    if (customerReview != null) {
        if (!customerReview.getRatedByCustomer(customerId)) {
            customerReview.getThinkUnhelpful().add(customerId);
            customerReviewService.updateReview(customerReview);
        }
    }
    return json(Json.toJson(result));
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:18,代码来源:CustomerReviewAction.java

示例13: processEditReview

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("process-edit")
public Resolution processEditReview() {
    if (!isCustomerLoggedIn())
        return redirect("/customer/account/login");

    if (getId() == null)
        return new ErrorResolution(404);

    CustomerReview customerReview = customerReviewService.getCustomerReview(getId());

    if (customerReview == null)
        return new ErrorResolution(404);

    customerReview.setRating(getRating());
    customerReview.setHeadline(getHeadline());
    customerReview.setReview(getReview());
    customerReview.setPublished(getAutoPublished());

    customerReviewService.updateReview(customerReview);

    return redirect("/review/customer/" + ((Customer) getLoggedInCustomer()).getId());
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:23,代码来源:CustomerReviewAction.java

示例14: reportAbuse

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("abuse")
public Resolution reportAbuse() {
    if (getId() == null)
        return new ErrorResolution(404);

    if (!isCustomerLoggedIn()) {
        redirectUrl = "/review/abuse/" + getId();
        return redirect("/customer/account/login");
    }

    CustomerReview review = customerReviewService.getCustomerReview(getId());
    if (review == null)
        return new ErrorResolution(404);
    product = productService.getProduct(review.getProductId());
    return view("review/abuse_form");
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:17,代码来源:CustomerReviewAction.java

示例15: processReportAbuse

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("process-abuse")
public Resolution processReportAbuse() {
    if (getId() == null)
        return new ErrorResolution(404);

    if (!isCustomerLoggedIn()) {
        return redirect("/customer/account/login");
    }

    CustomerReview review = customerReviewService.getCustomerReview(getId());
    if (review == null)
        return new ErrorResolution(404);
    product = productService.getProduct(review.getProductId());

    Abuse abuse = app.model(Abuse.class);
    abuse.setId(app.nextId());
    abuse.setHeadline(abuseHeadline);
    abuse.setText(abuseText);
    abuse.setCustomerId(((Customer) getLoggedInCustomer()).getId());
    abuse.setReviewId(review.getId());

    review.addAbuse(abuse);
    customerReviewService.updateReview(review);

    return redirect("/review/view/" + product.getId());
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:27,代码来源:CustomerReviewAction.java


注:本文中的net.sourceforge.stripes.action.HandlesEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。