Exemple #1
0
  @Override
  public Stock adaptUpdate(StockUpdateRequest request, Stock toUpdate) {

    if (isSet(request.getName())) {
      toUpdate.setName(request.getName());
    }

    if (isSet(request.getMarket())) {
      toUpdate.setMarket(stockMarketService.readAsEntity(request.getMarket()));
    }

    return toUpdate;
  }
Exemple #2
0
 @Override
 public Stock adaptCreate(StockCreateRequest request) {
   StockMarket stockMarket = stockMarketService.readAsEntity(request.getMarketId());
   return new Stock(request.getSymbol(), request.getName(), stockMarket);
 }