• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HandlesEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: addProduct

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("add-product")
public Resolution addProduct() {
    if (isCustomerLoggedIn()) {
        WishList wishList = getWishList(true);
        if (wishList != null) {
            Product p = productService.getProduct(productId);
            wishList.addProduct(p);
            wishListService.updateWishList(wishList);
            String url = "/wishlist/view/";
            if (getId() != null)
                url += getId();

            return redirect(url);
        } else {
            // error
            return view("error");
        }
    } else {
        // redirect to login page;
        return redirect("/customer/account/login");
    }
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:23,代码来源:WishListAction.java


示例17: addIdea

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("add-idea")
public Resolution addIdea() {
    HashMap<String, String> result = new HashMap<>();

    if (isCustomerLoggedIn()) {
        WishList wishList = getWishList(true);
        if (wishList != null) {
            wishList.addIdea(getIdea());
            wishListService.updateWishList(wishList);
            result.put("status", "ok");
            return json(Json.toJson(result));
        } else {
            // error
            result.put("status", "error");
            result.put("status", "Wishlist not found");
            return json(Json.toJson(result));
        }
    } else {
        // redirect to login page;
        result.put("status", "error");
        result.put("status", "User not logged in");
        return json(Json.toJson(result));
    }

}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:26,代码来源:WishListAction.java


示例18: deleteWishListItem

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("delete-wishlist-item")
public Resolution deleteWishListItem() {
    HashMap<String, String> result = new HashMap<>();

    if (getWishListId() != null && getWishListItemId() != null) {
        WishList wishList = wishListService.getWishList(getWishListId());
        wishList.removeWishListItem(getWishListItemId());

        wishListService.updateWishList(wishList);

        result.put("status", "ok");

        return json(Json.toJson(result));
    }

    result.put("status", "error");
    result.put("error", "Item not found");

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


示例19: wishListsAsJson

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("wishlists-json")
public Resolution wishListsAsJson() {
    List<WishList> wishLists = getWishLists();
    if (wishLists != null) {
        List<WishListJson> wishListsJson = new ArrayList<>();
        for (WishList wishList : wishLists) {
            WishListJson wishListJson = new WishListJson();
            wishListJson.setId(wishList.getId());
            wishListJson.setDefault(wishList.getDefault());
            wishListJson.setName(wishList.getName());
            wishListJson.setDelete(false);
            wishListJson.setAccess(wishList.getAccessType().toString());
            wishListsJson.add(wishListJson);
        }
        return json(Json.toJson(wishListsJson));
    }

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


示例20: getOnkiHttp

import net.sourceforge.stripes.action.HandlesEvent; //导入依赖的package包/类
@HandlesEvent("getOnkiHttp")
public Resolution getOnkiHttp() throws HttpException, IOException {
    String json = "";
    String language = getUserLocale().toLanguageTag().split("-")[0];
    HttpClient httpClient = new HttpClient();
    httpClient.getParams().setParameter("http.protocol.version", HttpVersion.HTTP_1_1);
    httpClient.getParams().setParameter("http.protocol.content-charset", "UTF-8");
    
    GetMethod get = new GetMethod("http://onki.fi/key-"+this.getOnkiAccessKey()+"/api/v2/http/onto/" + ontologyId + "/search?q=" + term + "&l=" + language);
    httpClient.executeMethod(get);
    if (get.getStatusCode() == 200) {
        json = get.getResponseBodyAsString();
    }
    //logger.info("getOnkiHttp(): "+json);
    return new StreamingResolution(MIME_JS, json);
}
 
开发者ID:mikkeliamk,项目名称:osa,代码行数:17,代码来源:IngestAction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HSuperColumn类代码示例发布时间:2022-05-22
下一篇:
Java CoreConstants类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap