Connected application components

This commit is contained in:
Marvin Scham
2023-06-27 05:23:43 +02:00
parent b78fb49eb1
commit d01c4d0b1d
31 changed files with 402 additions and 561 deletions

View File

@@ -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;
}

View File

@@ -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;
}