Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ public void addProductImage(ProductImage productImage, ImageContentFile contentI
* largeContentImage.setDefaultImage(productImage.isDefaultImage());
* largeContentImage.setImageName(new
* StringBuilder().append("L-").append(productImage.getProductImage()).toString());
*
*
*
*
* uploadImage.uploadProductImage(configuration, productImage, largeContentImage);
*/

Expand All @@ -120,7 +120,7 @@ public void addProductImage(ProductImage productImage, ImageContentFile contentI
* smallContentImage.setDefaultImage(productImage.isDefaultImage());
* smallContentImage.setImageName(new
* StringBuilder().append("S-").append(productImage.getProductImage()).toString());
*
*
* uploadImage.uploadProductImage(configuration, productImage, smallContentImage);
*/

Expand Down Expand Up @@ -179,8 +179,12 @@ public void addProductImage(ProductImage productImage, ImageContentFile contentI

// resize large
// ByteArrayOutputStream output = new ByteArrayOutputStream();
BufferedImage largeResizedImage =
ProductImageSizeUtils.resizeWithRatio(bufferedImage, largeImageWidth, largeImageHeight);
BufferedImage largeResizedImage;
if(bufferedImage.getWidth() > largeImageWidth ||bufferedImage.getHeight() > largeImageHeight) {
largeResizedImage = ProductImageSizeUtils.resizeWithRatio(bufferedImage, largeImageWidth, largeImageHeight);
} else {
largeResizedImage = bufferedImage;
}


File tempLarge =
Expand Down Expand Up @@ -294,12 +298,12 @@ public void removeProductImage(ProductImage productImage) throws ServiceExceptio
/*
* ProductImage large = new ProductImage(); large.setProduct(productImage.getProduct());
* large.setProductImage("L" + productImage.getProductImage());
*
*
* this.removeImage.removeProductImage(large);
*
*
* ProductImage small = new ProductImage(); small.setProduct(productImage.getProduct());
* small.setProductImage("S" + productImage.getProductImage());
*
*
* this.removeImage.removeProductImage(small);
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public interface ProductAttributeRepository extends JpaRepository<ProductAttribu
@Query("select distinct p from ProductAttribute p join fetch p.product pr left join fetch p.productOption po left join fetch p.productOptionValue pov left join fetch po.descriptions pod left join fetch pov.descriptions povd left join fetch po.merchantStore pom where pom.id = ?1 and pr.id = ?2 and povd.language.id = ?3")
List<ProductAttribute> findByProductId(Integer storeId, Long productId, Integer languageId);

@Query("select distinct p from ProductAttribute p join fetch p.product pr left join fetch p.productOption po left join fetch p.productOptionValue pov left join fetch po.descriptions pod left join fetch pov.descriptions povd left join fetch po.merchantStore pom where pom.id = ?1")
List<ProductAttribute> findByProductId(Integer storeId, Long productId);

@Query(value="select distinct p from ProductAttribute p join fetch p.product pr left join fetch pr.categories prc left join fetch p.productOption po left join fetch p.productOptionValue pov left join fetch po.descriptions pod left join fetch pov.descriptions povd left join fetch po.merchantStore pom where pom.id = ?1 and prc.id IN (select c.id from Category c where c.lineage like ?2% and povd.language.id = ?3)")
List<ProductAttribute> findOptionsByCategoryLineage(Integer storeId, String lineage, Integer languageId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ public interface ProductOptionSetRepository extends JpaRepository<ProductOptionS
@Query("select distinct p from ProductOptionSet p join fetch p.store pm left join fetch p.option po left join fetch po.descriptions pod left join fetch p.values pv left join fetch pv.descriptions pvd where pm.id = ?1 and pod.language.id = ?2")
List<ProductOptionSet> findByStore(Integer storeId, Integer language);

@Query("select distinct p from ProductOptionSet p join fetch p.store pm left join fetch p.productTypes pt left join fetch p.option po left join fetch po.descriptions pod left join fetch p.values pv left join fetch pv.descriptions pvd where pt.id= ?1 and pm.id = ?2 and pod.language.id = ?3")
@Query("select distinct p from ProductOptionSet p "
+ "join fetch p.store pm left join fetch p.productTypes pt "
+ "left join fetch p.option po "
+ "left join fetch po.descriptions pod "
+ "left join fetch p.values pv "
+ "left join fetch pv.descriptions pvd where pt.id= ?1 and pm.id = ?2 and pod.language.id = ?3")
List<ProductOptionSet> findByProductType(Long typeId, Integer storeId, Integer language);

@Query("select p from ProductOptionSet p join fetch p.store pm left join fetch p.option po left join fetch po.descriptions pod left join fetch p.values pv left join fetch pv.descriptions pvd where pm.id = ?1 and p.code = ?2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ public List<Product> getProductsByIds(List<Long> productIds) throws ServiceExcep
return productRepository.getProductsListByIds(idSet);
}

public Product getById(Long productId) {
return productRepository.getById(productId);
}

@Override
public Product getProductWithOnlyMerchantStoreById(Long productId) {
return productRepository.getProductWithOnlyMerchantStoreById(productId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ List<ProductAttribute> getByOptionValueId(MerchantStore store,

List<ProductAttribute> getByProductId(MerchantStore store, Product product, Language language)
throws ServiceException;

List<ProductAttribute> getByProductId(MerchantStore store, Product product)
throws ServiceException;

List<ProductAttribute> getByAttributeIds(MerchantStore store, Product product, List<Long> ids)
throws ServiceException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,9 @@ public List<ProductAttribute> getProductAttributesByCategoryLineage(MerchantStor
return productAttributeRepository.findOptionsByCategoryLineage(store.getId(), lineage, language.getId());
}

@Override
public List<ProductAttribute> getByProductId(MerchantStore store, Product product) throws ServiceException {
return productAttributeRepository.findByProductId(store.getId(), product.getId());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,75 +27,72 @@
import com.salesmanager.core.model.merchant.MerchantStore;

@Service("productImage")
public class ProductImageServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductImage>
public class ProductImageServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductImage>
implements ProductImageService {

private ProductImageRepository productImageRepository;

@Inject
public ProductImageServiceImpl(ProductImageRepository productImageRepository) {
super(productImageRepository);
this.productImageRepository = productImageRepository;
}

@Inject
private ProductFileManager productFileManager;







public ProductImage getById(Long id) {

return productImageRepository.findOne(id);
}


@Override
public void addProductImages(Product product, List<ProductImage> productImages) throws ServiceException {

try {
for(ProductImage productImage : productImages) {

Assert.notNull(productImage.getImage());

InputStream inputStream = productImage.getImage();
ImageContentFile cmsContentImage = new ImageContentFile();
cmsContentImage.setFileName( productImage.getProductImage() );
cmsContentImage.setFile( inputStream );
cmsContentImage.setFileContentType(FileContentType.PRODUCT);




addProductImage(product,productImage,cmsContentImage);



addProductImage(product,productImage,cmsContentImage);
}

} catch (Exception e) {
throw new ServiceException(e);
}

}


@Override
public void addProductImage(Product product, ProductImage productImage, ImageContentFile inputImage) throws ServiceException {





productImage.setProduct(product);

try {

Assert.notNull(inputImage.getFile(),"ImageContentFile.file cannot be null");
if (productImage.getImageType() == 0 ) {
Assert.notNull(inputImage.getFile(), "ImageContentFile.file cannot be null");
productFileManager.addProductImage(productImage, inputImage);
}

productFileManager.addProductImage(productImage, inputImage);

//insert ProductImage
this.saveOrUpdate(productImage);





} catch (Exception e) {
throw new ServiceException(e);
} finally {
Expand All @@ -106,71 +103,71 @@ public void addProductImage(Product product, ProductImage productImage, ImageCon
}

} catch(Exception ignore) {

}
}


}

@Override
public void saveOrUpdate(ProductImage productImage) throws ServiceException {


super.save(productImage);

}

public void addProductImageDescription(ProductImage productImage, ProductImageDescription description)
throws ServiceException {


if(productImage.getDescriptions()==null) {
productImage.setDescriptions(new ArrayList<ProductImageDescription>());
}

productImage.getDescriptions().add(description);
description.setProductImage(productImage);
update(productImage);


}

//TODO get default product image


@Override
public OutputContentFile getProductImage(ProductImage productImage, ProductImageSize size) throws ServiceException {


ProductImage pi = new ProductImage();
String imageName = productImage.getProductImage();
if(size == ProductImageSize.LARGE) {
imageName = "L-" + imageName;
}

if(size == ProductImageSize.SMALL) {
imageName = "S-" + imageName;
}

pi.setProductImage(imageName);
pi.setProduct(productImage.getProduct());

return productFileManager.getProductImage(pi);

}

@Override
public OutputContentFile getProductImage(final String storeCode, final String productCode, final String fileName, final ProductImageSize size) throws ServiceException {
return productFileManager.getProductImage(storeCode, productCode, fileName, size);

}

@Override
public List<OutputContentFile> getProductImages(Product product) throws ServiceException {
return productFileManager.getImages(product);
}

@Override
public void removeProductImage(ProductImage productImage) throws ServiceException {

Expand All @@ -179,21 +176,21 @@ public void removeProductImage(ProductImage productImage) throws ServiceExceptio
}
ProductImage p = this.getById(productImage.getId());
this.delete(p);

}


@Override
public Optional<ProductImage> getProductImage(Long imageId, Long productId, MerchantStore store) {


Optional<ProductImage> image = Optional.empty();

ProductImage img = productImageRepository.finById(imageId, productId, store.getCode());
if(img!=null) {
image = Optional.of(img);
}

return image;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public interface SalesManagerEntityService<K extends Serializable & Comparable<K
*/
void save(E entity) throws ServiceException;

/**
* Save all
*/
void saveAll(Iterable<E> entities) throws ServiceException;

/**
* Met à jour l'entité dans la base de données.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public void save(E entity) throws ServiceException {
repository.saveAndFlush(entity);
}

public void saveAll(Iterable<E> entities) throws ServiceException {
repository.saveAll(entities);
}


public void create(E entity) throws ServiceException {
save(entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ public MerchantStoreServiceImpl(MerchantRepository merchantRepository) {
}

@Override
@CacheEvict(value="store", key="#store.code")
//@CacheEvict(value="store", key="#store.code")
public void saveOrUpdate(MerchantStore store) throws ServiceException {
super.save(store);
}

@Override
@Cacheable(value = "store")
/**
* cache moved in facades
*/
//@Cacheable(value = "store")
public MerchantStore getByCode(String code) throws ServiceException {
return merchantRepository.findByCode(code);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,25 @@ public class OrderServiceImpl extends SalesManagerEntityServiceImpl<Long, Order

@Inject
private ShippingService shippingService;

@Inject
private PaymentService paymentService;

@Inject
private ProductService productService;

@Inject
private TaxService taxService;

@Inject
private CustomerService customerService;

@Inject
private ShoppingCartService shoppingCartService;

@Inject
private TransactionService transactionService;

@Inject
private OrderTotalService orderTotalService;

Expand All @@ -112,29 +112,29 @@ public void addOrderStatusHistory(Order order, OrderStatusHistory history) throw
history.setOrder(order);
update(order);
}

@Override
public Order processOrder(Order order, Customer customer, List<ShoppingCartItem> items, OrderTotalSummary summary, Payment payment, MerchantStore store) throws ServiceException {

return process(order, customer, items, summary, payment, null, store);
}

@Override
public Order processOrder(Order order, Customer customer, List<ShoppingCartItem> items, OrderTotalSummary summary, Payment payment, Transaction transaction, MerchantStore store) throws ServiceException {

return process(order, customer, items, summary, payment, transaction, store);
}

private Order process(Order order, Customer customer, List<ShoppingCartItem> items, OrderTotalSummary summary, Payment payment, Transaction transaction, MerchantStore store) throws ServiceException {


Validate.notNull(order, "Order cannot be null");
Validate.notNull(customer, "Customer cannot be null (even if anonymous order)");
Validate.notEmpty(items, "ShoppingCart items cannot be null");
Validate.notNull(payment, "Payment cannot be null");
Validate.notNull(store, "MerchantStore cannot be null");
Validate.notNull(summary, "Order total Summary cannot be null");

UserContext context = UserContext.getCurrentInstance();
if(context != null) {
String ipAddress = context.getIpAddress();
Expand All @@ -143,10 +143,10 @@ private Order process(Order order, Customer customer, List<ShoppingCartItem> ite
}
}


//first process payment
Transaction processTransaction = paymentService.processPayment(customer, store, payment, items, order);

if(order.getOrderHistory()==null || order.getOrderHistory().size()==0 || order.getStatus()==null) {
OrderStatus status = order.getStatus();
if(status==null) {
Expand All @@ -160,13 +160,13 @@ private Order process(Order order, Customer customer, List<ShoppingCartItem> ite
statusHistory.setOrder(order);
statusHistorySet.add(statusHistory);
order.setOrderHistory(statusHistorySet);

}

if(customer.getId()==null || customer.getId()==0) {
customerService.create(customer);
}

order.setCustomerId(customer.getId());
this.create(order);

Expand All @@ -178,7 +178,7 @@ private Order process(Order order, Customer customer, List<ShoppingCartItem> ite
transactionService.update(transaction);
}
}

if(processTransaction!=null) {
processTransaction.setOrder(order);
if(processTransaction.getId()==null || processTransaction.getId()==0) {
Expand All @@ -195,8 +195,8 @@ private Order process(Order order, Customer customer, List<ShoppingCartItem> ite
Set<OrderProduct> products = order.getOrderProducts();
for(OrderProduct orderProduct : products) {
orderProduct.getProductQuantity();
Product p = productService.getByCode(orderProduct.getSku(), store.getDefaultLanguage());
if(p == null)
Product p = productService.getById(orderProduct.getId());
if(p == null)
throw new ServiceException(ServiceException.EXCEPTION_INVENTORY_MISMATCH);
for(ProductAvailability availability : p.getAvailabilities()) {
int qty = availability.getProductQuantity();
Expand All @@ -211,7 +211,7 @@ private Order process(Order order, Customer customer, List<ShoppingCartItem> ite
}



return order;
}

Expand Down Expand Up @@ -273,28 +273,28 @@ private OrderTotalSummary caculateOrder(OrderSummary summary, Customer customer,
}
}
}

//only in order page, otherwise invokes too many processing
if(
OrderSummaryType.ORDERTOTAL.name().equals(summary.getOrderSummaryType().name()) ||
OrderSummaryType.SHOPPINGCART.name().equals(summary.getOrderSummaryType().name())

) {

//Post processing order total variation modules for sub total calculation - drools, custom modules
//may affect the sub total
OrderTotalVariation orderTotalVariation = orderTotalService.findOrderTotalVariation(summary, customer, store, language);

int currentCount = 10;

if(CollectionUtils.isNotEmpty(orderTotalVariation.getVariations())) {
for(OrderTotal variation : orderTotalVariation.getVariations()) {
variation.setSortOrder(currentCount++);
orderTotals.add(variation);
subTotal = subTotal.subtract(variation.getValue());
}
}

}


Expand All @@ -308,7 +308,7 @@ private OrderTotalSummary caculateOrder(OrderSummary summary, Customer customer,
orderTotalSubTotal.setTitle(Constants.OT_SUBTOTAL_MODULE_CODE);
orderTotalSubTotal.setSortOrder(5);
orderTotalSubTotal.setValue(subTotal);

orderTotals.add(orderTotalSubTotal);


Expand All @@ -322,7 +322,7 @@ private OrderTotalSummary caculateOrder(OrderSummary summary, Customer customer,
shippingSubTotal.setOrderTotalCode("order.total.shipping");
shippingSubTotal.setTitle(Constants.OT_SHIPPING_MODULE_CODE);
shippingSubTotal.setSortOrder(100);

orderTotals.add(shippingSubTotal);

if(!summary.getShippingSummary().isFreeShipping()) {
Expand Down Expand Up @@ -433,7 +433,7 @@ private OrderTotalSummary caculateShoppingCart( ShoppingCart shoppingCart, final

OrderSummary orderSummary = new OrderSummary();
orderSummary.setOrderSummaryType(OrderSummaryType.SHOPPINGCART);

if(!StringUtils.isBlank(shoppingCart.getPromoCode())) {
Date promoDateAdded = shoppingCart.getPromoAdded();//promo valid 1 day
if(promoDateAdded == null) {
Expand All @@ -451,14 +451,14 @@ private OrderTotalSummary caculateShoppingCart( ShoppingCart shoppingCart, final
shoppingCart.setPromoCode(null);
shoppingCartService.saveOrUpdate(shoppingCart);
}
}
}

List<ShoppingCartItem> itemList = new ArrayList<ShoppingCartItem>(shoppingCart.getLineItems());
//filter out unavailable
itemList = itemList.stream().filter(p -> p.getProduct().isAvailable()).collect(Collectors.toList());
orderSummary.setProducts(itemList);


return caculateOrder(orderSummary, customer, store, language);

}
Expand All @@ -474,7 +474,7 @@ private OrderTotalSummary caculateShoppingCart( ShoppingCart shoppingCart, final
* @param language
* @return {@link OrderTotalSummary}
* @throws ServiceException
*
*
*/
@Override
public OrderTotalSummary calculateShoppingCartTotal(
Expand Down Expand Up @@ -504,7 +504,7 @@ public OrderTotalSummary calculateShoppingCartTotal(
* @param language
* @return {@link OrderTotalSummary}
* @throws ServiceException
*
*
*/
@Override
public OrderTotalSummary calculateShoppingCartTotal(
Expand Down Expand Up @@ -581,45 +581,45 @@ public void saveOrUpdate(final Order order) throws ServiceException {

@Override
public boolean hasDownloadFiles(Order order) throws ServiceException {

Validate.notNull(order,"Order cannot be null");
Validate.notNull(order.getOrderProducts(),"Order products cannot be null");
Validate.notEmpty(order.getOrderProducts(),"Order products cannot be empty");

boolean hasDownloads = false;
for(OrderProduct orderProduct : order.getOrderProducts()) {

if(CollectionUtils.isNotEmpty(orderProduct.getDownloads())) {
hasDownloads = true;
break;
}
}

return hasDownloads;
}

@Override
public List<Order> getCapturableOrders(MerchantStore store, Date startDate, Date endDate) throws ServiceException {

List<Transaction> transactions = transactionService.listTransactions(startDate, endDate);

List<Order> returnOrders = null;

if(!CollectionUtils.isEmpty(transactions)) {

returnOrders = new ArrayList<Order>();

//order id
Map<Long,Order> preAuthOrders = new HashMap<Long,Order> ();
//order id
Map<Long,List<Transaction>> processingTransactions = new HashMap<Long,List<Transaction>> ();

for(Transaction trx : transactions) {
Order order = trx.getOrder();
if(TransactionType.AUTHORIZE.name().equals(trx.getTransactionType().name())) {
preAuthOrders.put(order.getId(), order);
}

//put transaction
List<Transaction> listTransactions = null;
if(processingTransactions.containsKey(order.getId())) {
Expand All @@ -630,46 +630,46 @@ public List<Order> getCapturableOrders(MerchantStore store, Date startDate, Date
}
listTransactions.add(trx);
}

//should have when captured
/**
* Order id Transaction type
* 1 AUTHORIZE
* 1 CAPTURE
* 1 CAPTURE
*/

//should have when not captured
/**
* Order id Transaction type
* 2 AUTHORIZE
*/

for(Long orderId : processingTransactions.keySet()) {

List<Transaction> trx = processingTransactions.get(orderId);
if(CollectionUtils.isNotEmpty(trx)) {

boolean capturable = true;
for(Transaction t : trx) {

if(TransactionType.CAPTURE.name().equals(t.getTransactionType().name())) {
capturable = false;
} else if(TransactionType.AUTHORIZECAPTURE.name().equals(t.getTransactionType().name())) {
capturable = false;
} else if(TransactionType.REFUND.name().equals(t.getTransactionType().name())) {
capturable = false;
}

}

if(capturable) {
Order o = preAuthOrders.get(orderId);
returnOrders.add(o);
}

}


}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
*
*/
public class ProductImageSizeUtils {


private ProductImageSizeUtils() {

}


/**
* Simple resize, does not maintain aspect ratio
Expand All @@ -26,7 +26,7 @@ private ProductImageSizeUtils() {
* @param height
* @return
*/

public static BufferedImage resize(BufferedImage image, int width, int height) {
int type = image.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : image
.getType();
Expand All @@ -43,9 +43,9 @@ public static BufferedImage resize(BufferedImage image, int width, int height) {
g.dispose();
return resizedImage;
}

/**
*
*
* @param img
* @param targetWidth
* @param targetHeight
Expand Down Expand Up @@ -102,8 +102,8 @@ public static BufferedImage resizeWithHint(BufferedImage img,

return ret;
}


public static BufferedImage resizeWithRatio(BufferedImage image, int destinationWidth, int destinationHeight) {

int type = image.getType() == 0? BufferedImage.TYPE_INT_ARGB : image.getType();
Expand All @@ -121,17 +121,17 @@ public static BufferedImage resizeWithRatio(BufferedImage image, int destination

//Work out the resized width/height
if (image.getHeight() > destinationHeight || image.getWidth() > destinationWidth) {
fHeight = destinationHeight;
int wid = destinationWidth;
float sum = (float)image.getWidth() / (float)image.getHeight();
fWidth = Math.round(fHeight * sum);

if (fWidth > wid) {
//rezise again for the width this time
fHeight = Math.round(wid/sum);
fWidth = wid;
}
}
if (image.getHeight() > image.getWidth()) {
fHeight = destinationHeight;
float sum = (float) image.getWidth() / (float) image.getHeight();
fWidth = Math.round(destinationWidth * sum);
} else if (image.getWidth() > image.getHeight()) {
fWidth = destinationWidth;
float sum = (float) image.getHeight() / (float) image.getWidth();
fHeight = Math.round(destinationHeight * sum);
}
// else sides are equal and is set to destination size at initialization of
}

BufferedImage resizedImage = new BufferedImage(fWidth, fHeight, type);
Graphics2D g = resizedImage.createGraphics();
Expand All @@ -146,6 +146,6 @@ public static BufferedImage resizeWithRatio(BufferedImage image, int destination

return resizedImage;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ public FinalPrice getFinalPrice(Product product) {
finalPrice.setOriginalPrice(op);
}
}

finalPrice.setStringPrice(this.getStringAmount(finalPrice.getFinalPrice()));

return finalPrice;

Expand Down Expand Up @@ -199,6 +201,22 @@ public String getAdminFormatedAmount(MerchantStore store, BigDecimal amount) thr
return nf.format(amount);
}

public String getStringAmount(BigDecimal amount) {

if(amount==null) {
return "";
}

NumberFormat nf = NumberFormat.getInstance(Constants.DEFAULT_LOCALE);

nf.setMaximumFractionDigits(Integer.parseInt(Character
.toString(DECIMALCOUNT)));
nf.setMinimumFractionDigits(Integer.parseInt(Character
.toString(DECIMALCOUNT)));

return nf.format(amount);
}


/**
* This method has to be used to format store front amounts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
public class LightPersistableProduct implements Serializable {

/**
*
*
*/
private static final long serialVersionUID = 1L;
private String price;
private boolean available;
private boolean productShipeable;
private int quantity;
public String getPrice() {
return price;
Expand All @@ -35,5 +36,7 @@ public boolean isAvailable() {
public void setAvailable(boolean available) {
this.available = available;
}
public boolean isProductShipeable() { return productShipeable; }
public void setProductShipeable(Boolean productShipeable) { this.productShipeable = productShipeable; }

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.salesmanager.shop.model.catalog.manufacturer.ReadableManufacturer;
import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductAttribute;
import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductOption;
import com.salesmanager.shop.model.catalog.product.attribute.ReadableProductProperty;
import com.salesmanager.shop.model.catalog.product.type.ReadableProductType;

public class ReadableProduct extends ProductEntity implements Serializable {
Expand All @@ -26,6 +27,7 @@ public class ReadableProduct extends ProductEntity implements Serializable {
private ReadableManufacturer manufacturer;
private List<ReadableProductAttribute> attributes = new ArrayList<ReadableProductAttribute>();
private List<ReadableProductOption> options = new ArrayList<ReadableProductOption>();
private List<ReadableProductProperty> properties = new ArrayList<ReadableProductProperty>();
private List<ReadableCategory> categories = new ArrayList<ReadableCategory>();
private ReadableProductType type;
private boolean canBePurchased = false;
Expand Down Expand Up @@ -145,4 +147,13 @@ public void setProductPrice(ReadableProductPrice productPrice) {
this.productPrice = productPrice;
}

public List<ReadableProductProperty> getProperties() {
return properties;
}

public void setProperties(List<ReadableProductProperty> properties) {
this.properties = properties;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@ public class PersistableProductAttribute extends ProductAttributeEntity
private BigDecimal productAttributePrice;
private Long productId;

private ProductOption option;
private ProductOptionValue optionValue;
public void setOptionValue(ProductOptionValue optionValue) {
this.optionValue = optionValue;
}
public ProductOptionValue getOptionValue() {
return optionValue;
}
public void setOption(ProductOption option) {
private ProductPropertyOption option;
private PersistableProductOptionValue optionValue;


public void setOption(ProductPropertyOption option) {
this.option = option;
}
public ProductOption getOption() {
public ProductPropertyOption getOption() {
return option;
}

Expand All @@ -49,5 +45,11 @@ public Long getProductId() {
public void setProductId(Long productId) {
this.productId = productId;
}
public PersistableProductOptionValue getOptionValue() {
return optionValue;
}
public void setOptionValue(PersistableProductOptionValue optionValue) {
this.optionValue = optionValue;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.io.Serializable;

public class ProductOptionEntity extends ProductOption implements Serializable {
public class ProductOptionEntity extends ProductPropertyOption implements Serializable {

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.salesmanager.shop.model.entity.Entity;


public class ProductOption extends Entity implements Serializable {
public class ProductPropertyOption extends Entity implements Serializable {

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueEntity;

public class ReadableProductOption extends ProductOption {
public class ReadableProductOption extends ProductPropertyOption {

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,9 @@ public class ReadableProductOptionValue extends ProductOptionValue {

private String price;
private String image;
private String name;
private String description;


public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getPrice() {
return price;
}
Expand All @@ -36,4 +28,12 @@ public void setImage(String image) {
this.image = image;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.salesmanager.shop.model.catalog.product.attribute;

public class ReadableProductProperty extends ProductPropertyOption {

/**
*
*/
private static final long serialVersionUID = 1L;

/**
* Property use option objects
*/
private ReadableProductOption property = null;
private ReadableProductPropertyValue propertyValue = null;
public ReadableProductOption getProperty() {
return property;
}
public void setProperty(ReadableProductOption property) {
this.property = property;
}
public ReadableProductPropertyValue getPropertyValue() {
return propertyValue;
}
public void setPropertyValue(ReadableProductPropertyValue propertyValue) {
this.propertyValue = propertyValue;
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.salesmanager.shop.model.catalog.product.attribute;

import java.util.ArrayList;
import java.util.List;

public class ReadableProductPropertyValue extends ProductOptionValue{

/**
*
*/
private static final long serialVersionUID = 1L;

private List<ProductOptionValueDescription> values = new ArrayList<ProductOptionValueDescription>();

public List<ProductOptionValueDescription> getValues() {
return values;
}

public void setValues(List<ProductOptionValueDescription> values) {
this.values = values;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class ReadableProductAttributeEntity extends ProductAttributeEntity {

private String productAttributeWeight;
private String productAttributePrice;
private String productAttributeUnformattedPrice;

private ReadableProductOptionEntity option;
private ReadableProductOptionValueEntity optionValue;
Expand Down Expand Up @@ -36,6 +37,12 @@ public ReadableProductOptionValueEntity getOptionValue() {
public void setOptionValue(ReadableProductOptionValueEntity optionValue) {
this.optionValue = optionValue;
}
public String getProductAttributeUnformattedPrice() {
return productAttributeUnformattedPrice;
}
public void setProductAttributeUnformattedPrice(String productAttributeUnformattedPrice) {
this.productAttributeUnformattedPrice = productAttributeUnformattedPrice;
}


}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.salesmanager.shop.model.catalog.product.product.definition;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -19,6 +20,7 @@ public class PersistableProductDefinition extends ProductDefinition {
private List<Category> categories = new ArrayList<Category>();
private String type;
private String manufacturer;
private BigDecimal price;
public List<ProductDescription> getDescriptions() {
return descriptions;
}
Expand Down Expand Up @@ -49,5 +51,11 @@ public String getManufacturer() {
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.salesmanager.shop.model.catalog.product.product.definition;

import com.salesmanager.shop.model.catalog.product.ProductSpecification;
import com.salesmanager.shop.model.entity.Entity;

/**
Expand All @@ -14,17 +15,24 @@ public class ProductDefinition extends Entity {
*/
private static final long serialVersionUID = 1L;
private boolean visible = true;
private Double rating = 0D;
private int ratingCount;
private boolean shipeable = true;
private boolean virtual = true;
private boolean canBePurchased = true;
//private Double rating = 0D;
//private int ratingCount;
private String dateAvailable;
private String identifier;
private ProductSpecification productSpecifications;
private int sortOrder;
private int quantity;

public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
public Double getRating() {
/* public Double getRating() {
return rating;
}
public void setRating(Double rating) {
Expand All @@ -35,7 +43,7 @@ public int getRatingCount() {
}
public void setRatingCount(int ratingCount) {
this.ratingCount = ratingCount;
}
}*/
public String getDateAvailable() {
return dateAvailable;
}
Expand All @@ -48,5 +56,42 @@ public String getIdentifier() {
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public ProductSpecification getProductSpecifications() {
return productSpecifications;
}
public void setProductSpecifications(ProductSpecification productSpecifications) {
this.productSpecifications = productSpecifications;
}
public int getSortOrder() {
return sortOrder;
}
public void setSortOrder(int sortOrder) {
this.sortOrder = sortOrder;
}
public boolean isShipeable() {
return shipeable;
}
public void setShipeable(boolean shipeable) {
this.shipeable = shipeable;
}
public boolean isVirtual() {
return virtual;
}
public void setVirtual(boolean virtual) {
this.virtual = virtual;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public boolean isCanBePurchased() {
return canBePurchased;
}
public void setCanBePurchased(boolean canBePurchased) {
this.canBePurchased = canBePurchased;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ReadableProductDefinition extends ProductDefinition {
private ProductDescription description = null;
private List<PersistableProductAttribute> properties = new ArrayList<PersistableProductAttribute>();
private List<ReadableImage> images = new ArrayList<ReadableImage>();
private String price;


public ReadableProductType getType() {
Expand Down Expand Up @@ -60,6 +61,12 @@ public List<ReadableImage> getImages() {
public void setImages(List<ReadableImage> images) {
this.images = images;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.salesmanager.shop.model.entity;

public class CodeEntity extends Entity {

/**
*
*/
private static final long serialVersionUID = 1L;
private String code;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}

}
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package com.salesmanager.shop.store.controller.product.facade;

import java.util.List;

import org.springframework.web.multipart.MultipartFile;

import com.salesmanager.core.model.merchant.MerchantStore;
import com.salesmanager.core.model.reference.language.Language;
import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductAttribute;
import com.salesmanager.shop.model.catalog.product.attribute.PersistableProductOptionValue;
import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionEntity;
import com.salesmanager.shop.model.catalog.product.attribute.api.PersistableProductOptionValueEntity;
import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductAttributeEntity;
import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductAttributeList;
import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionEntity;
import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionList;
import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueEntity;
import com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionValueList;
import com.salesmanager.shop.model.entity.CodeEntity;


/*
Expand All @@ -26,8 +29,11 @@ public interface ProductOptionFacade {

ReadableProductOptionEntity saveOption(PersistableProductOptionEntity option, MerchantStore store, Language language);

ReadableProductOptionValueEntity saveOptionValue(PersistableProductOptionValueEntity optionValue, MerchantStore store, Language language);
ReadableProductOptionValueEntity saveOptionValue(PersistableProductOptionValue optionValue, MerchantStore store, Language language);

List<CodeEntity> createAttributes(List<PersistableProductAttribute> attributes, Long productId, MerchantStore store);
void updateAttributes(List<PersistableProductAttribute> attributes, Long productId, MerchantStore store);

void addOptionValueImage(MultipartFile image, Long optionValueId, MerchantStore store, Language language);

void removeOptionValueImage(Long optionValueId, MerchantStore store, Language language);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public interface ProductOptionSetFacade {
ReadableProductOptionSet get(Long id, MerchantStore store, Language language);
boolean exists(String code, MerchantStore store);
List<ReadableProductOptionSet> list(MerchantStore store, Language language);
List<ReadableProductOptionSet> list(MerchantStore store, Language language, String type);
void create(PersistableProductOptionSet optionSet, MerchantStore store, Language language);
void update(Long id, PersistableProductOptionSet optionSet, MerchantStore store, Language language);
void delete(Long id, MerchantStore store);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public interface ProductTypeFacade {

ReadableProductType get(MerchantStore store, Long id, Language language);

ReadableProductType get(MerchantStore store, String code, Language language);

Long save(PersistableProductType type, MerchantStore store, Language language);

void update(PersistableProductType type, Long id, MerchantStore store, Language language);
Expand Down
Binary file modified sm-shop/SALESMANAGER.h2.db
Binary file not shown.
193 changes: 0 additions & 193 deletions sm-shop/SALESMANAGER.trace.db

This file was deleted.

Binary file modified sm-shop/files/store/DownlaodRepository.dat
Binary file not shown.
11 changes: 0 additions & 11 deletions sm-shop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,21 @@

<dependencies>

<!-- sm-core -->
<dependency>
<groupId>com.shopizer</groupId>
<artifactId>sm-core</artifactId>
</dependency>

<!-- sm-core-model -->
<dependency>
<groupId>com.shopizer</groupId>
<artifactId>sm-core-model</artifactId>
</dependency>

<!-- sm-shop-model -->
<dependency>
<groupId>com.shopizer</groupId>
<artifactId>sm-shop-model</artifactId>
</dependency>

<!-- sm-search -->
<dependency>
<groupId>com.shopizer</groupId>
<artifactId>sm-search</artifactId>
Expand Down Expand Up @@ -87,13 +83,6 @@
<scope>provided</scope>
</dependency>

<!--
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
</dependency>
-->

<!-- https://mvnrepository.com/artifact/commons-collections/commons-collections -->
<!-- For Tiles -->
<dependency>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading