shopizer-uncached

Fixed product attributes

1/4/2017 4:31:32 PM

Changes

pom.xml 10(+0 -10)

Details

pom.xml 10(+0 -10)

diff --git a/pom.xml b/pom.xml
index 386f51c..eac8a05 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,16 +86,6 @@
 				    <groupId>com.fasterxml.jackson.core</groupId>
 				    <artifactId>jackson-databind</artifactId>
 				    <version>${jackson-version}</version>
-<!-- 				    <exclusions>
-				        <exclusion>
-				            <groupId>com.fasterxml.jackson.core</groupId>
-				            <artifactId>jackson-core</artifactId>
-				        </exclusion>
-				        <exclusion>
-				            <groupId>com.fasterxml.jackson.core</groupId>
-				            <artifactId>jackson-annotations</artifactId>
-				        </exclusion>
-				    </exclusions> -->
 				</dependency>
 				
 				<dependency>
diff --git a/shopizer-canadapost/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-canadapost-module/pom.properties b/shopizer-canadapost/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-canadapost-module/pom.properties
index 78c925c..88f24d5 100644
--- a/shopizer-canadapost/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-canadapost-module/pom.properties
+++ b/shopizer-canadapost/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-canadapost-module/pom.properties
@@ -1,5 +1,5 @@
 #Generated by Maven Integration for Eclipse
-#Wed Jan 04 10:51:03 EST 2017
+#Wed Jan 04 13:27:18 EST 2017
 version=2.0.5-SNAPSHOT
 groupId=com.shopizer
 m2e.projectName=shopizer-canadapost
diff --git a/shopizer-shipping-distance-module/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-distance-processor/pom.properties b/shopizer-shipping-distance-module/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-distance-processor/pom.properties
index bb91ea5..fcf9321 100644
--- a/shopizer-shipping-distance-module/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-distance-processor/pom.properties
+++ b/shopizer-shipping-distance-module/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-distance-processor/pom.properties
@@ -1,5 +1,5 @@
 #Generated by Maven Integration for Eclipse
-#Wed Jan 04 10:51:03 EST 2017
+#Wed Jan 04 13:27:19 EST 2017
 version=2.0.5-SNAPSHOT
 groupId=com.shopizer
 m2e.projectName=shopizer-shipping-distance-processor
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductAttributeRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductAttributeRepository.java
index 77f287e..e8e8e4a 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductAttributeRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductAttributeRepository.java
@@ -18,8 +18,8 @@ public interface ProductAttributeRepository extends JpaRepository<ProductAttribu
 	@Query("select 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 po.id = ?2")
 	List<ProductAttribute> findByOptionValueId(Integer storeId, Long id);
 	
-	@Query("select 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 pov.merchantStore povm where povm.id = ?1 and pov.id = ?2")
-	List<ProductAttribute> findByAttributeIds(Integer storeId, List<Long> ids);
+	@Query("select 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 pov.merchantStore povm where povm.id = ?1 and pr.id = ?2 and pov.id = ?3")
+	List<ProductAttribute> findByAttributeIds(Integer storeId, Long productId, List<Long> ids);
 	
 	@Query("select 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);
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductOptionValueRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductOptionValueRepository.java
index e34f83d..986d75a 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductOptionValueRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/attribute/ProductOptionValueRepository.java
@@ -25,7 +25,7 @@ public interface ProductOptionValueRepository extends JpaRepository<ProductOptio
 	public List<ProductOptionValue> findByName(Integer storeId, String name, Integer languageId);
 	
 	
-	@Query("select distinct p from ProductOptionValue p join fetch p.merchantStore pm left join fetch p.descriptions pd where pm.id = ?1 and p.code = ?2 and p.productOptionDisplayOnly = ?3")
+	@Query("select distinct p from ProductOptionValue p join fetch p.merchantStore pm left join fetch p.descriptions pd where pm.id = ?1 and pd.language.id = ?2 and p.productOptionDisplayOnly = ?3")
 	public List<ProductOptionValue> findByReadOnly(Integer storeId, Integer languageId, boolean readOnly);
 	
 
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeService.java b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeService.java
index c7b8f13..0c3031b 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeService.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeService.java
@@ -24,6 +24,6 @@ public interface ProductAttributeService extends
 	List<ProductAttribute> getByProductId(MerchantStore store, Product product, Language language)
 			throws ServiceException;
 
-	List<ProductAttribute> getByAttributeIds(MerchantStore store, List<Long> ids)
+	List<ProductAttribute> getByAttributeValueIds(MerchantStore store, Product product, List<Long> ids)
 			throws ServiceException;
 }
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeServiceImpl.java
index 48e646f..4e01917 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeServiceImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeServiceImpl.java
@@ -43,10 +43,10 @@ public class ProductAttributeServiceImpl extends
 	}
 	
 	@Override
-	public List<ProductAttribute> getByAttributeIds(MerchantStore store,
-			List<Long> ids) throws ServiceException {
+	public List<ProductAttribute> getByAttributeValueIds(MerchantStore store,
+			Product product, List<Long> ids) throws ServiceException {
 		
-		return productAttributeRepository.findByAttributeIds(store.getId(), ids);
+		return productAttributeRepository.findByAttributeIds(store.getId(), product.getId(), ids);
 		
 	}
 	
diff --git a/sm-core-model/pom.xml b/sm-core-model/pom.xml
index 10a4bb7..86d5214 100644
--- a/sm-core-model/pom.xml
+++ b/sm-core-model/pom.xml
@@ -35,6 +35,12 @@
             <artifactId>spring-boot-starter-data-jpa</artifactId>
         </dependency>
         
+        <!-- For transient Multipart File only -->
+        <dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-webmvc</artifactId>
+		</dependency>
+        
         <!-- http://mvnrepository.com/artifact/org.hibernate/hibernate-validator -->
 		<dependency>
 		    <groupId>org.hibernate</groupId>
diff --git a/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/attribute/ProductOptionValue.java b/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/attribute/ProductOptionValue.java
index 9b6914e..c89b086 100644
--- a/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/attribute/ProductOptionValue.java
+++ b/sm-core-model/src/main/java/com/salesmanager/core/model/catalog/product/attribute/ProductOptionValue.java
@@ -21,6 +21,7 @@ import javax.persistence.TableGenerator;
 import javax.persistence.Transient;
 import javax.persistence.UniqueConstraint;
 import javax.validation.constraints.Pattern;
+import org.springframework.web.multipart.MultipartFile;
 
 import org.hibernate.validator.constraints.NotEmpty;
 
@@ -58,9 +59,17 @@ public class ProductOptionValue extends SalesManagerEntity<Long, ProductOptionVa
 	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "productOptionValue")
 	private Set<ProductOptionValueDescription> descriptions = new HashSet<ProductOptionValueDescription>();
 	
-	//@Transient
-	//private MultipartFile image = null;
+	@Transient
+	private MultipartFile image = null;
 	
+	public MultipartFile getImage() {
+		return image;
+	}
+
+	public void setImage(MultipartFile image) {
+		this.image = image;
+	}
+
 	@Transient
 	private List<ProductOptionValueDescription> descriptionsList = new ArrayList<ProductOptionValueDescription>();
 
diff --git a/sm-core-model/src/main/java/com/salesmanager/core/model/customer/attribute/CustomerOptionValue.java b/sm-core-model/src/main/java/com/salesmanager/core/model/customer/attribute/CustomerOptionValue.java
index 3bb9437..63ee3f2 100644
--- a/sm-core-model/src/main/java/com/salesmanager/core/model/customer/attribute/CustomerOptionValue.java
+++ b/sm-core-model/src/main/java/com/salesmanager/core/model/customer/attribute/CustomerOptionValue.java
@@ -51,7 +51,6 @@ public class CustomerOptionValue extends SalesManagerEntity<Long, CustomerOption
 	@NotEmpty
 	@Pattern(regexp="^[a-zA-Z0-9_]*$")
 	@Column(name="CUSTOMER_OPT_VAL_CODE")
-	//@Index(name="CUST_OPT_VAL_CODE_IDX")
 	private String code;
 	
 	
diff --git a/sm-search/target/classes/META-INF/maven/com.shopizer/sm-search/pom.properties b/sm-search/target/classes/META-INF/maven/com.shopizer/sm-search/pom.properties
index 6b5e6f2..ed795e6 100644
--- a/sm-search/target/classes/META-INF/maven/com.shopizer/sm-search/pom.properties
+++ b/sm-search/target/classes/META-INF/maven/com.shopizer/sm-search/pom.properties
@@ -1,5 +1,5 @@
 #Generated by Maven Integration for Eclipse
-#Wed Jan 04 10:51:09 EST 2017
+#Wed Jan 04 13:27:24 EST 2017
 version=2.0.5-SNAPSHOT
 groupId=com.shopizer
 m2e.projectName=sm-search
diff --git a/sm-shop/files/store/StoreRepository.dat b/sm-shop/files/store/StoreRepository.dat
index c088a11..e50d6da 100644
Binary files a/sm-shop/files/store/StoreRepository.dat and b/sm-shop/files/store/StoreRepository.dat differ
diff --git a/sm-shop/SALESMANAGER.h2.db b/sm-shop/SALESMANAGER.h2.db
index 25d3b50..6886ff9 100644
Binary files a/sm-shop/SALESMANAGER.h2.db and b/sm-shop/SALESMANAGER.h2.db differ
diff --git a/sm-shop/SALESMANAGER.lock.db b/sm-shop/SALESMANAGER.lock.db
index a1569e3..b494d60 100644
--- a/sm-shop/SALESMANAGER.lock.db
+++ b/sm-shop/SALESMANAGER.lock.db
@@ -1,4 +1,4 @@
 #FileLock
-#Wed Jan 04 10:52:06 EST 2017
-id=1596a2e1ced7a811918ad04fbb6642dc6e72d83c747
+#Wed Jan 04 13:12:44 EST 2017
+id=1596aaee0b207496c2962cbf263fe557a65387af123
 method=file
diff --git a/sm-shop/SALESMANAGER.trace.db b/sm-shop/SALESMANAGER.trace.db
index b2053f3..a5739d9 100644
--- a/sm-shop/SALESMANAGER.trace.db
+++ b/sm-shop/SALESMANAGER.trace.db
@@ -4,3 +4,6 @@ org.h2.jdbc.JdbcSQLException: The object is already closed [90007-176]
 org.h2.jdbc.JdbcSQLException: The object is already closed [90007-176]
 12-06 15:27:42 jdbc[3]: exception
 org.h2.jdbc.JdbcSQLException: The object is already closed [90007-176]
+2017-01-04 12:53:59 jdbc[6]: exception
+org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "PRODUCT_DIGITAL"; SQL statement:
+select digitalpro0_.PRODUCT_DIGITAL_ID as PRODUCT_1_44_0_, product1_.PRODUCT_ID as PRODUCT_1_39_1_, merchantst2_.MERCHANT_ID as MERCHANT1_25_2_, digitalpro0_.PRODUCT_ID as PRODUCT_3_44_0_, digitalpro0_.FILE_NAME as FILE_NAM2_44_0_, product1_.DATE_CREATED as DATE_CRE2_39_1_, product1_.DATE_MODIFIED as DATE_MOD3_39_1_, product1_.UPDT_ID as UPDT_ID4_39_1_, product1_.AVAILABLE as AVAILABL5_39_1_, product1_.DATE_AVAILABLE as DATE_AVA6_39_1_, product1_.MANUFACTURER_ID as MANUFAC21_39_1_, product1_.MERCHANT_ID as MERCHAN22_39_1_, product1_.PREORDER as PREORDER7_39_1_, product1_.PRODUCT_HEIGHT as PRODUCT_8_39_1_, product1_.PRODUCT_FREE as PRODUCT_9_39_1_, product1_.PRODUCT_LENGTH as PRODUCT10_39_1_, product1_.QUANTITY_ORDERED as QUANTIT11_39_1_, product1_.REVIEW_AVG as REVIEW_12_39_1_, product1_.REVIEW_COUNT as REVIEW_13_39_1_, product1_.PRODUCT_SHIP as PRODUCT14_39_1_, product1_.PRODUCT_VIRTUAL as PRODUCT15_39_1_, product1_.PRODUCT_WEIGHT as PRODUCT16_39_1_, product1_.PRODUCT_WIDTH as PRODUCT17_39_1_, product1_.REF_SKU as REF_SKU18_39_1_, product1_.SKU as SKU19_39_1_, product1_.SORT_ORDER as SORT_OR20_39_1_, product1_.TAX_CLASS_ID as TAX_CLA23_39_1_, product1_.PRODUCT_TYPE_ID as PRODUCT24_39_1_, merchantst2_.STORE_CODE as STORE_CO2_25_2_, merchantst2_.CONTINUESHOPPINGURL as CONTINUE3_25_2_, merchantst2_.COUNTRY_ID as COUNTRY20_25_2_, merchantst2_.CURRENCY_ID as CURRENC21_25_2_, merchantst2_.CURRENCY_FORMAT_NATIONAL as CURRENCY4_25_2_, merchantst2_.LANGUAGE_ID as LANGUAG22_25_2_, merchantst2_.DOMAIN_NAME as DOMAIN_N5_25_2_, merchantst2_.IN_BUSINESS_SINCE as IN_BUSIN6_25_2_, merchantst2_.INVOICE_TEMPLATE as INVOICE_7_25_2_, merchantst2_.SEIZEUNITCODE as SEIZEUNI8_25_2_, merchantst2_.STORE_EMAIL as STORE_EM9_25_2_, merchantst2_.STORE_LOGO as STORE_L10_25_2_, merchantst2_.STORE_TEMPLATE as STORE_T11_25_2_, merchantst2_.STORE_ADDRESS as STORE_A12_25_2_, merchantst2_.STORE_CITY as STORE_C13_25_2_, merchantst2_.STORE_NAME as STORE_N14_25_2_, merchantst2_.STORE_PHONE as STORE_P15_25_2_, merchantst2_.STORE_POSTAL_CODE as STORE_P16_25_2_, merchantst2_.STORE_STATE_PROV as STORE_S17_25_2_, merchantst2_.USE_CACHE as USE_CAC18_25_2_, merchantst2_.WEIGHTUNITCODE as WEIGHTU19_25_2_, merchantst2_.ZONE_ID as ZONE_ID23_25_2_ from SALESMANAGER.PRODUCT_DIGITAL digitalpro0_ inner join SALESMANAGER.PRODUCT product1_ on digitalpro0_.PRODUCT_ID=product1_.PRODUCT_ID inner join SALESMANAGER.MERCHANT_STORE merchantst2_ on product1_.MERCHANT_ID=merchantst2_.MERCHANT_ID where digitalpro0_.PRODUCT_DIGITAL_ID=? [50200-191]
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/products/OptionsValueController.java b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/products/OptionsValueController.java
index eed7b78..6b4a73f 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/products/OptionsValueController.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/products/OptionsValueController.java
@@ -7,6 +7,7 @@ import com.salesmanager.core.business.utils.ajax.AjaxResponse;
 import com.salesmanager.core.model.catalog.product.attribute.ProductOptionValue;
 import com.salesmanager.core.model.catalog.product.attribute.ProductOptionValueDescription;
 import com.salesmanager.core.model.content.FileContentType;
+import com.salesmanager.core.model.content.InputContentFile;
 import com.salesmanager.core.model.merchant.MerchantStore;
 import com.salesmanager.core.model.reference.language.Language;
 import com.salesmanager.shop.admin.model.web.Menu;
@@ -32,6 +33,8 @@ import javax.inject.Inject;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+
+import java.io.InputStream;
 import java.util.*;
 
 @Controller
@@ -101,9 +104,7 @@ public class OptionsValueController {
 			
 			
 			option = productOptionValueService.getById(store, optionId);
-			//option = productOptionValueService.getByCode(store, optionId.toString());
-			
-			
+
 			if(option==null) {
 				return "redirect:/admin/options/optionvalues.html";
 			}
@@ -241,7 +242,7 @@ public class OptionsValueController {
 		}
 		
 
-/*		if(optionValue.getImage()!=null && !optionValue.getImage().isEmpty()) {
+	    if(optionValue.getImage()!=null && !optionValue.getImage().isEmpty()) {
 
 			String imageName = optionValue.getImage().getOriginalFilename();
             InputStream inputStream = optionValue.getImage().getInputStream();
@@ -253,7 +254,7 @@ public class OptionsValueController {
             
             optionValue.setProductOptionValueImage(imageName);
 
-		}*/
+		}
 		
 		productOptionValueService.saveOrUpdate(optionValue);
 
@@ -387,10 +388,8 @@ public class OptionsValueController {
 			
 			Long id = Long.parseLong(optionValueId);
 			
-			//ProductOptionValue optionValue = productOptionValueService.getById(store, id);
+			ProductOptionValue optionValue = productOptionValueService.getById(store, id);
 
-            ProductOptionValue optionValue = productOptionValueService.getByCode(store, id.toString());
-			
 			contentService.removeFile(store.getCode(), FileContentType.PROPERTY, optionValue.getProductOptionValueImage());
 			
 			store.setStoreLogo(null);
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/product/ShopProductController.java b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/product/ShopProductController.java
index cef0963..2eb4fa3 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/product/ShopProductController.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/product/ShopProductController.java
@@ -310,7 +310,7 @@ public class ShopProductController {
 		return template.toString();
 	}
 	
-    @RequestMapping(value={"/{productId}/calculatePrice.html"}, method=RequestMethod.POST)
+    @RequestMapping(value={"/{productId}/calculatePrice.json"}, method=RequestMethod.POST)
 	public @ResponseBody
 	ReadableProductPrice calculatePrice(@RequestParam(value="attributeIds[]") Long[] attributeIds, @PathVariable final Long productId, final HttpServletRequest request, final HttpServletResponse response, final Locale locale) throws Exception {
 
@@ -323,7 +323,7 @@ public class ShopProductController {
 		
 		@SuppressWarnings("unchecked")
 		List<Long> ids = new ArrayList<Long>(Arrays.asList(attributeIds));
-		List<ProductAttribute> attributes = productAttributeService.getByAttributeIds(store, ids);      
+		List<ProductAttribute> attributes = productAttributeService.getByAttributeValueIds(store, product, ids);      
 		
 		for(ProductAttribute attribute : attributes) {
 			if(attribute.getProduct().getId().longValue()!=productId.longValue()) {
diff --git a/sm-shop/src/main/webapp/resources/js/product.js b/sm-shop/src/main/webapp/resources/js/product.js
index 1123f45..1c89330 100644
--- a/sm-shop/src/main/webapp/resources/js/product.js
+++ b/sm-shop/src/main/webapp/resources/js/product.js
@@ -60,7 +60,7 @@
 		
 	$.ajax({  
 		 type: 'POST',  
-		 url: getContextPath() + '/shop/product/' + productId + '/calculatePrice.html',  
+		 url: getContextPath() + '/shop/product/' + productId + '/calculatePrice.json',  
 		 dataType: 'json', 
 		 data:{"attributeIds":values},
 		 cache:false,
diff --git a/sm-shop/target/m2e-wtp/web-resources/META-INF/maven/com.shopizer/sm-shop/pom.properties b/sm-shop/target/m2e-wtp/web-resources/META-INF/maven/com.shopizer/sm-shop/pom.properties
index 3b67b69..6a7bf08 100644
--- a/sm-shop/target/m2e-wtp/web-resources/META-INF/maven/com.shopizer/sm-shop/pom.properties
+++ b/sm-shop/target/m2e-wtp/web-resources/META-INF/maven/com.shopizer/sm-shop/pom.properties
@@ -1,5 +1,5 @@
 #Generated by Maven Integration for Eclipse
-#Wed Jan 04 10:51:11 EST 2017
+#Wed Jan 04 13:27:28 EST 2017
 version=2.0.5-SNAPSHOT
 groupId=com.shopizer
 m2e.projectName=sm-shop