Connected application components
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package de.rwu.easydrop.service.mapping;
|
||||
|
||||
import de.rwu.easydrop.api.dto.OfferDTO;
|
||||
|
||||
import de.rwu.easydrop.model.Offer;
|
||||
|
||||
/**
|
||||
@@ -31,6 +30,10 @@ public final class OfferMapper {
|
||||
*/
|
||||
public static Offer mapOfferFromDTO(final OfferDTO dto) {
|
||||
Offer offer = new Offer();
|
||||
offer.setOfferId(dto.getOfferId());
|
||||
offer.setSourceProduct(ProductMapper.mapProductFromDTO(dto.getSourceProduct()));
|
||||
offer.setTargetProduct(ProductMapper.mapProductFromDTO(dto.getTargetProduct()));
|
||||
offer.setLastUpdate(dto.getLastUpdate());
|
||||
|
||||
return offer;
|
||||
}
|
||||
@@ -42,7 +45,11 @@ public final class OfferMapper {
|
||||
* @return OfferDTO
|
||||
*/
|
||||
public static OfferDTO mapOfferToDTO(final Offer offer) {
|
||||
OfferDTO dto = new OfferDTO(offer.getOfferId());
|
||||
OfferDTO dto = new OfferDTO();
|
||||
dto.setOfferId(offer.getOfferId());
|
||||
dto.setSourceProduct(ProductMapper.mapProductToDTO(offer.getSourceProduct()));
|
||||
dto.setTargetProduct(ProductMapper.mapProductToDTO(offer.getTargetProduct()));
|
||||
dto.setLastUpdate(offer.getLastUpdate());
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public final class ProductMapper {
|
||||
product.setDeliveryPrice(dto.getDeliveryPrice());
|
||||
product.setMerchant(dto.getMerchant());
|
||||
product.setProductId(dto.getProductId());
|
||||
product.setLastUpdate(dto.getLastUpdate());
|
||||
|
||||
return product;
|
||||
}
|
||||
@@ -56,6 +57,7 @@ public final class ProductMapper {
|
||||
dto.setCurrentPrice(product.getCurrentPrice());
|
||||
dto.setDeliveryPrice(product.getDeliveryPrice());
|
||||
dto.setMerchant(product.getMerchant());
|
||||
dto.setLastUpdate(product.getLastUpdate());
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user