Package com.changestuffs.shared.dto

Examples of com.changestuffs.shared.dto.ArticlesDtoOut


    }
    return articles;
  }

  public IArticlesDto getIArticlesDto(Product product, boolean completeInfo, String email) {
    ArticlesDtoOut dto = new ArticlesDtoOut();
    dto.setName(product.getName());
    dto.setDate(product.getDate());
    dto.setTag(Tags.valueOf(product.getTag().getTagId()));
    dto.setKeyHash(KeyFactory.keyToString(product.getKey()));
    dto.setLocale(Locales.getLocale(product.getLocale()));
    if (completeInfo) {
      dto.setDescription(product.getDescription().getValue());
      dto.setInterestedIn(product.getInterestedIn().getValue());
      List<Offers> allOffers = new ArrayList<Offers>();
      if (product.getOffer() != null) {
        for (Offer offer : product.getOffer()) {
          Map<String, String> offerPerUser = new HashMap<String, String>();
          for (ProductOffered productOffered : offer.getProductOffered()) {
            String productId = productOffered.getProductId();
            Product offered = model.find(Product.class,
                KeyFactory.stringToKey(productId));
            // Maybe it was removed
            if(offered != null)
              offerPerUser.put(productId, offered.getName());
          }
          if(offerPerUser.size()>0){
            Offers offers = new Offers();
            offers.setIdNameProducts(offerPerUser);
            offers.setUserId(offer.getUserId());
            if(email != null){
              User user = model.find(User.class, email);
              offers.setFriend(user.getFriends().contains(offer.getUserId()));
            }
            allOffers.add(offers);
          }
        }
      }
      dto.setOffers(allOffers);
    }
    return dto;
  }
View Full Code Here


            GWT.log("Error", caught);
          }

          @Override
          public void onSuccess(ArticlesAddResult result) {
            ArticlesDtoOut article = new ArticlesDtoOut();
            article.setDate(date);
            article.setName(name);
            article.setTag(tag);
            article.setKeyHash(result.getIdHash());
            AddArticleEvent.fire(AddArticlesPresenter.this, article);
            Builder request = new PlaceRequest.Builder().nameToken(
                NameTokens.getLookfor()).with(
                LookforPresenter.Parameters.id.name(),
                result.getIdHash());
View Full Code Here

      public void onFailure(Throwable caught) {
        GWT.log("Some error", caught);
      }
      @Override
      public void onSuccess(ArticlesAddResult result) {
        ArticlesDtoOut articlesDto = new ArticlesDtoOut();
        articlesDto.setDate(action.getDate());
        articlesDto.setKeyHash(action.getKeyHash());
        articlesDto.setName(action.getName());
        articlesDto.setTag(result.getTagOut());
        uiHandlers.updateSuccessProduct(articlesDto);
        Builder request = new PlaceRequest.Builder().nameToken(
            NameTokens.getLookfor()).with(
            LookforPresenter.Parameters.id.name(),
            result.getIdHash());
View Full Code Here

TOP

Related Classes of com.changestuffs.shared.dto.ArticlesDtoOut

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.