Package com.changestuffs.server.utils

Examples of com.changestuffs.server.utils.ArticlesOAM


    // TODO add language in product
    log.info("Adding " + arg0);
    ArticlesAddResult result = null;
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    ArticlesOAM oam = provider.get();
    Product product = null;
    if (arg0.getKeyHash() == null) {
      product = oam.insertArticle(arg0, user.getEmail());
    } else {
      product = oam.updateArticle(arg0, user.getEmail());
    }
    result = new ArticlesAddResult(KeyFactory.keyToString(product.getKey()), Tags.valueOf(product.getTag().getTagId()));
    return result;
  }
View Full Code Here


      UserService userService = UserServiceFactory.getUserService();
      User user = userService.getCurrentUser();
      email = user.getEmail();
    }
   
    ArticlesOAM oam = provider.get();
    List<Product> products = oam.getProducts(email);
    for (Product product : products) {
      IArticlesDto dto = oam.getIArticlesDto(product,
          arg0.isFullInfo(), email);
      articles.put(dto.getKeyHash(), dto);
    }
    LookForResult result = new LookForResult(articles);
    return result;
View Full Code Here

  public UpdateOfferResult execute(@Valid UpdateOfferAction action,
      ExecutionContext context) throws ActionException {
    UpdateOfferResult result = null;
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    ArticlesOAM oam = provider.get();
    result = oam.updateOffer(user.getEmail(), action.getOfferId(),
        action.getProductIdNames());
    sendEmail(oam.getOwner(action.getOfferId()));
    return result;
  }
View Full Code Here

  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);
    return result;
  }
View Full Code Here

  public OfferRemoveResult execute(@Valid OfferRemove action, ExecutionContext context)
      throws ActionException {
    OfferRemoveResult result = null;
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    ArticlesOAM oam = provider.get();
    result = oam.removeOffer(user.getEmail(), action.getOfferId());
    return result;
  }
View Full Code Here

  public ArticleRemoveResult execute(ArticleRemoveAction arg0,
      ExecutionContext arg1) throws ActionException {
    ArticleRemoveResult result = new ArticleRemoveResult(arg0.getKeyHash());
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    ArticlesOAM oam = provider.get();
    oam.remove(arg0.getKeyHash(), user.getEmail());
    return result;
  }
View Full Code Here

  public GetOffersResult execute(GetOffersAction action,
      ExecutionContext context) throws ActionException {
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    Map<String, OffersPerProduct> offersPerProduct = new HashMap<String, OffersPerProduct>();
    ArticlesOAM oam = provider.get();
    List<Offer> offers = oam.getOffers(user.getEmail());
    for (Offer offer : offers) {
      OffersPerProduct perProduct = new OffersPerProduct(
          KeyFactory.keyToString(offer.getKey()),
          KeyFactory.keyToString(offer.getProduct().getKey()),
          offer.getProduct().getName(), convertToMap(offer.getProductOffered()));
View Full Code Here

 
  @Override
  public LookForResult execute(LookForAction arg0, ExecutionContext arg1)
      throws ActionException {
    LookForResult result = null;
    ArticlesOAM oam = provider.get();
    result = new LookForResult(oam.getArticles(arg0, null));
    return result;
  }
View Full Code Here

            log.info("Is a file: "+imageItem.getName());
            Blob imageBlob = new Blob(resizeImage(data));
            images.put(imageItem.getName(), imageBlob);
          }
        }
        ArticlesOAM oam = provider.get();
        UserService userService = UserServiceFactory.getUserService();
          User user = userService.getCurrentUser();
        Map<String, String> imageKeys = oam.addImages(user.getEmail(), images);
        writeResponse(resp, imageKeys);
        log.info("Servlet has finalized its work");
    }catch(FileUploadException e){
      log.log(Level.SEVERE, "Error parsing file", e);
    }
View Full Code Here

  private Provider<ArticlesOAM> provider;
 
  @Override
  public void manage(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    resp.setContentType(CONTENT_TYPE);
    ArticlesOAM oam = provider.get();
    StringBuilder builder = new StringBuilder();
    builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    builder.append("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">");
    addUrl(builder, Locales.es);
    addUrl(builder, Locales.en);
View Full Code Here

TOP

Related Classes of com.changestuffs.server.utils.ArticlesOAM

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.