#53 Implemented SQLite product data persistence + tests
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
package de.rwu.easydrop.service.mapping;
|
||||
|
||||
import de.rwu.easydrop.api.dto.ProductDTO;
|
||||
|
||||
import de.rwu.easydrop.model.Product;
|
||||
|
||||
/**
|
||||
* Maps between Product, ProductDAO and ProductDTO.
|
||||
* Maps between Product, ProductDTO and ProductDTO.
|
||||
*
|
||||
* @since 0.2.0
|
||||
*
|
||||
* @see Product
|
||||
* @see ProductDTO
|
||||
* @see ProductDAO
|
||||
* @see ProductDTO
|
||||
*/
|
||||
public final class ProductMapper {
|
||||
|
||||
@@ -41,4 +42,21 @@ public final class ProductMapper {
|
||||
|
||||
return product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a ProductDTO object from a corresponding Product.
|
||||
*
|
||||
* @param product Product
|
||||
* @return ProductDTO
|
||||
*/
|
||||
public static ProductDTO mapProductToDTO(final Product product) {
|
||||
ProductDTO dto = new ProductDTO(product.getProductId(), product.getDataOrigin());
|
||||
|
||||
dto.setAvailable(product.isAvailable());
|
||||
dto.setCurrentPrice(product.getCurrentPrice());
|
||||
dto.setDeliveryPrice(product.getDeliveryPrice());
|
||||
dto.setMerchant(product.getMerchant());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user