return new OfferInfo(user, offer.getProduct().getName(), KeyFactory.keyToString(offer.getProduct().getKey()));
}
@Transactional
public OfferRemoveResult removeOffer(String userId, String offerId){
OfferRemoveResult result = null;
Offer offer = model.find(Offer.class, offerId);
if(!userId.equals(offer.getUserId())){
log.log(Level.WARNING, "User "+userId+" is trying to remove an offer of "+offer.getUserId());
return null;
}
model.remove(offer);
result = new OfferRemoveResult();
return result;
}