Package com.changestuffs.shared.actions

Examples of com.changestuffs.shared.actions.GetOffersResult$OffersPerProduct


 
  @Logued
  @Override
  public GetOffersResult execute(OfferCreateAction action,
      ExecutionContext context) throws ActionException {
    GetOffersResult result = null;
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    ArticlesOAM oam = provider.get();
    result = oam.createOffer(action.getProductId(), user.getEmail());
    log.info("Created offer: "+result);
View Full Code Here


          KeyFactory.keyToString(offer.getProduct().getKey()),
          offer.getProduct().getName(), convertToMap(offer.getProductOffered()));
      offersPerProduct.put(perProduct.getOfferKey(), perProduct);

    }
    return new GetOffersResult(offersPerProduct);
  }
View Full Code Here

    log.info(userId + " has " + offers.size() + " products");
    return offers;
  }

  public GetOffersResult createOffer(String productId, String userId) {
    GetOffersResult result = null;
    Product product = model.find(Product.class,
        KeyFactory.stringToKey(productId));
    Offer offer = new Offer();
    offer.setAcceptIt(false);
    offer.setProduct(product);
    offer.setProductOffered(new HashSet<ProductOffered>());
    offer.setUserId(userId);
    model.getTransaction().begin();
    model.persist(offer);
    model.getTransaction().commit();
    OffersPerProduct offerPerProduct = new OffersPerProduct(KeyFactory.keyToString(offer.getKey()), productId, product.getName(), new HashMap<String, String>());
    Map<String, OffersPerProduct> offers = new HashMap<String, OffersPerProduct>();
    offers.put(offerPerProduct.getOfferKey(), offerPerProduct);
    result = new GetOffersResult(offers);
    log.info("Offer created");
    return result;
  }
View Full Code Here

TOP

Related Classes of com.changestuffs.shared.actions.GetOffersResult$OffersPerProduct

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.