shopizer-uncached
Changes
shopizer-canadapost/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-canadapost-module/pom.properties 2(+1 -1)
shopizer-shipping-distance-module/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-distance-processor/pom.properties 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/category/CategoryRepository.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/repositories/content/ContentRepository.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerAttributeRepository.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionRepository.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionSetRepository.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionValueRepository.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/CustomerRepository.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/repositories/order/orderproduct/OrderProductDownloadRepository.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/repositories/shoppingcart/ShoppingCartRepository.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/repositories/user/PermissionRepository.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/services/catalog/category/CategoryServiceImpl.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/services/content/ContentServiceImpl.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/services/customer/attribute/CustomerOptionSetServiceImpl.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/services/customer/CustomerServiceImpl.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/services/shoppingcart/ShoppingCartServiceImpl.java 2(+1 -1)
sm-core/src/main/java/com/salesmanager/core/business/services/user/PermissionServiceImpl.java 2(+1 -1)
sm-shop/SALESMANAGER.h2.db 0(+0 -0)
sm-shop/SALESMANAGER.lock.db 4(+2 -2)
sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerController.java 43(+29 -14)
sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsController.java 22(+14 -8)
sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsSetController.java 31(+19 -12)
sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsValueController.java 22(+14 -8)
Details
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 136681d..e4b301b 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 Dec 07 12:22:33 EST 2016
+#Tue Dec 13 12:59:24 EST 2016
version=2.5.0-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 29893e7..3fc7c35 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 Dec 07 12:22:33 EST 2016
+#Tue Dec 13 12:23:26 EST 2016
version=2.5.0-SNAPSHOT
groupId=com.shopizer
m2e.projectName=shopizer-shipping-distance-processor
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/category/CategoryRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/category/CategoryRepository.java
index 59d3ae0..d4b5152 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/category/CategoryRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/category/CategoryRepository.java
@@ -39,7 +39,7 @@ public interface CategoryRepository extends JpaRepository<Category, Long>, Categ
public Category findByCode(String merchantStoreCode, String code);
@Query("select c from Category c left join fetch c.descriptions cd join fetch cd.language cdl join fetch c.merchantStore cm where c.id=?1")
- public Category findById(Long categoryId);
+ public Category findOne(Long categoryId);
@Query("select distinct c from Category c left join fetch c.descriptions cd join fetch cd.language cdl join fetch c.merchantStore cm where cm.id=?1 and c.lineage like %?2% order by c.lineage, c.sortOrder asc")
public List<Category> findByLineage(Integer merchantId, String linenage);
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/content/ContentRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/content/ContentRepository.java
index 5e691c4..cfbbc73 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/content/ContentRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/content/ContentRepository.java
@@ -33,7 +33,7 @@ public interface ContentRepository extends JpaRepository<Content, Long>, Conten
Content findByIdAndLanguage(Long contentId, Integer languageId);
@Query("select c from Content c left join fetch c.descriptions cd join fetch c.merchantStore cm where c.id = ?1")
- Content findById(Long contentId);
+ Content findOne(Long contentId);
}
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerAttributeRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerAttributeRepository.java
index d3f3e72..c3a5289 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerAttributeRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerAttributeRepository.java
@@ -11,7 +11,7 @@ public interface CustomerAttributeRepository extends JpaRepository<CustomerAttri
@Query("select a from CustomerAttribute a left join fetch a.customerOption aco left join fetch a.customerOptionValue acov left join fetch aco.descriptions acod left join fetch acov.descriptions acovd where a.id = ?1")
- CustomerAttribute findById(Long id);
+ CustomerAttribute findOne(Long id);
@Query("select a from CustomerAttribute a join fetch a.customer ac left join fetch a.customerOption aco join fetch aco.merchantStore acom left join fetch a.customerOptionValue acov left join fetch aco.descriptions acod left join fetch acov.descriptions acovd where acom.id = ?1 and ac.id = ?2 and aco.id = ?3")
CustomerAttribute findByOptionId(Integer merchantId,Long customerId,Long id);
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionRepository.java
index 85ce303..2985ade 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionRepository.java
@@ -11,7 +11,7 @@ public interface CustomerOptionRepository extends JpaRepository<CustomerOption,
@Query("select o from CustomerOption o join fetch o.merchantStore om left join fetch o.descriptions od where o.id = ?1")
- CustomerOption findById(Long id);
+ CustomerOption findOne(Long id);
@Query("select o from CustomerOption o join fetch o.merchantStore om left join fetch o.descriptions od where om.id = ?1 and o.code = ?2")
CustomerOption findByCode(Integer merchantId, String code);
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionSetRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionSetRepository.java
index 07801ab..adfd702 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionSetRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionSetRepository.java
@@ -11,7 +11,7 @@ public interface CustomerOptionSetRepository extends JpaRepository<CustomerOptio
@Query("select c from CustomerOptionSet c join fetch c.customerOption co join fetch c.customerOptionValue cov join fetch co.merchantStore com left join fetch co.descriptions cod left join fetch cov.descriptions covd where c.id = ?1")
- CustomerOptionSet findById(Long id);
+ CustomerOptionSet findOne(Long id);
@Query("select c from CustomerOptionSet c join fetch c.customerOption co join fetch c.customerOptionValue cov join fetch co.merchantStore com left join fetch co.descriptions cod left join fetch cov.descriptions covd where com.id = ?1 and co.id = ?2")
List<CustomerOptionSet> findByOptionId(Integer merchantStoreId, Long id);
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionValueRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionValueRepository.java
index f09174b..ed56222 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionValueRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/attribute/CustomerOptionValueRepository.java
@@ -12,7 +12,7 @@ public interface CustomerOptionValueRepository extends JpaRepository<CustomerOpt
@Query("select o from CustomerOptionValue o join fetch o.merchantStore om left join fetch o.descriptions od where o.id = ?1")
- CustomerOptionValue findById(Long id);
+ CustomerOptionValue findOne(Long id);
@Query("select o from CustomerOptionValue o join fetch o.merchantStore om left join fetch o.descriptions od where om.id = ?1 and o.code = ?2")
CustomerOptionValue findByCode(Integer merchantId, String code);
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/CustomerRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/CustomerRepository.java
index 3c40ad6..6af00ab 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/CustomerRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/CustomerRepository.java
@@ -11,7 +11,7 @@ public interface CustomerRepository extends JpaRepository<Customer, Long>, Custo
@Query("select c from Customer c join fetch c.merchantStore cm left join fetch c.defaultLanguage cl left join fetch c.attributes ca left join fetch ca.customerOption cao left join fetch ca.customerOptionValue cav left join fetch cao.descriptions caod left join fetch cav.descriptions where c.id = ?1")
- Customer findById(Long id);
+ Customer findOne(Long id);
@Query("select c from Customer c join fetch c.merchantStore cm left join fetch c.defaultLanguage cl left join fetch c.attributes ca left join fetch ca.customerOption cao left join fetch ca.customerOptionValue cav left join fetch cao.descriptions caod left join fetch cav.descriptions where c.billing.firstName = ?1")
List<Customer> findByName(String name);
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/order/orderproduct/OrderProductDownloadRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/order/orderproduct/OrderProductDownloadRepository.java
index f782b7a..d0e0d45 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/order/orderproduct/OrderProductDownloadRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/order/orderproduct/OrderProductDownloadRepository.java
@@ -10,7 +10,7 @@ import com.salesmanager.core.model.order.orderproduct.OrderProductDownload;
public interface OrderProductDownloadRepository extends JpaRepository<OrderProductDownload, Long> {
@Query("select o from OrderProductDownload o left join fetch o.orderProduct op join fetch op.order opo join fetch opo.merchant opon where o.id = ?1")
- OrderProductDownload findById(Long id);
+ OrderProductDownload findOne(Long id);
@Query("select o from OrderProductDownload o left join fetch o.orderProduct op join fetch op.order opo join fetch opo.merchant opon where opo.id = ?1")
List<OrderProductDownload> findByOrderId(Long id);
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/shoppingcart/ShoppingCartRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/shoppingcart/ShoppingCartRepository.java
index ae5d347..a89f158 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/shoppingcart/ShoppingCartRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/shoppingcart/ShoppingCartRepository.java
@@ -7,7 +7,7 @@ import com.salesmanager.core.model.shoppingcart.ShoppingCart;
public interface ShoppingCartRepository extends JpaRepository<ShoppingCart, Long> {
@Query("select c from ShoppingCart c left join fetch c.lineItems cl left join fetch cl.attributes cla join fetch c.merchantStore cm where c.id = ?1")
- ShoppingCart findById(Long id);
+ ShoppingCart findOne(Long id);
@Query("select c from ShoppingCart c left join fetch c.lineItems cl left join fetch cl.attributes cla join fetch c.merchantStore cm where c.shoppingCartCode = ?1")
ShoppingCart findByCode(String code);
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/user/PermissionRepository.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/user/PermissionRepository.java
index c929868..4cc66ae 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/user/PermissionRepository.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/user/PermissionRepository.java
@@ -12,7 +12,7 @@ public interface PermissionRepository extends JpaRepository<Permission, Integer>
@Query("select p from Permission as p where p.id = ?1")
- Permission findById(Integer id);
+ Permission findOne(Integer id);
@Query("select p from Permission as p order by p.id")
List<Permission> findAll();
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/category/CategoryServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/category/CategoryServiceImpl.java
index 87c99e6..7dd7467 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/category/CategoryServiceImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/category/CategoryServiceImpl.java
@@ -169,7 +169,7 @@ public class CategoryServiceImpl extends SalesManagerEntityServiceImpl<Long, Cat
@Override
public Category getById(Long id) {
- return categoryRepository.findById(id);
+ return categoryRepository.findOne(id);
}
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/content/ContentServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/content/ContentServiceImpl.java
index b00dd4f..25f85e5 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/content/ContentServiceImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/content/ContentServiceImpl.java
@@ -119,7 +119,7 @@ public class ContentServiceImpl
@Override
public Content getById( Long id ) {
- return contentRepository.findById(id);
+ return contentRepository.findOne(id);
}
@Override
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/customer/attribute/CustomerOptionSetServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/customer/attribute/CustomerOptionSetServiceImpl.java
index a7c6522..06725ab 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/customer/attribute/CustomerOptionSetServiceImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/customer/attribute/CustomerOptionSetServiceImpl.java
@@ -45,7 +45,7 @@ public class CustomerOptionSetServiceImpl extends
@Override
public void delete(CustomerOptionSet customerOptionSet) throws ServiceException {
- customerOptionSet = customerOptionSetRepository.findById(customerOptionSet.getId());
+ customerOptionSet = customerOptionSetRepository.findOne(customerOptionSet.getId());
super.delete(customerOptionSet);
}
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/customer/CustomerServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/customer/CustomerServiceImpl.java
index e7aff15..ee6eb94 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/customer/CustomerServiceImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/customer/CustomerServiceImpl.java
@@ -49,7 +49,7 @@ public class CustomerServiceImpl extends SalesManagerEntityServiceImpl<Long, Cus
@Override
public Customer getById(Long id) {
- return customerRepository.findById(id);
+ return customerRepository.findOne(id);
}
@Override
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/shoppingcart/ShoppingCartServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/shoppingcart/ShoppingCartServiceImpl.java
index 7456073..130e10f 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/shoppingcart/ShoppingCartServiceImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/shoppingcart/ShoppingCartServiceImpl.java
@@ -138,7 +138,7 @@ public class ShoppingCartServiceImpl extends SalesManagerEntityServiceImpl<Long,
public ShoppingCart getById(final Long id) {
try {
- ShoppingCart shoppingCart = shoppingCartRepository.findById(id);
+ ShoppingCart shoppingCart = shoppingCartRepository.findOne(id);
if (shoppingCart == null) {
return null;
}
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/user/PermissionServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/user/PermissionServiceImpl.java
index f5a095f..bd39a67 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/user/PermissionServiceImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/user/PermissionServiceImpl.java
@@ -42,7 +42,7 @@ public class PermissionServiceImpl extends
@Override
public Permission getById(Integer permissionId) {
- return permissionRepository.findById(permissionId);
+ return permissionRepository.findOne(permissionId);
}
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 66fdff2..a207961 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 Dec 07 12:22:34 EST 2016
+#Tue Dec 13 12:59:24 EST 2016
version=2.5.0-SNAPSHOT
groupId=com.shopizer
m2e.projectName=sm-search
sm-shop/SALESMANAGER.h2.db 0(+0 -0)
diff --git a/sm-shop/SALESMANAGER.h2.db b/sm-shop/SALESMANAGER.h2.db
index dacc6eb..42d5f93 100644
Binary files a/sm-shop/SALESMANAGER.h2.db and b/sm-shop/SALESMANAGER.h2.db differ
sm-shop/SALESMANAGER.lock.db 4(+2 -2)
diff --git a/sm-shop/SALESMANAGER.lock.db b/sm-shop/SALESMANAGER.lock.db
index 2f68b46..48fb796 100644
--- a/sm-shop/SALESMANAGER.lock.db
+++ b/sm-shop/SALESMANAGER.lock.db
@@ -1,4 +1,4 @@
#FileLock
-#Thu Dec 08 12:38:28 EST 2016
-id=158df83ca80aeb17cb3ffcbaef6ad0a3e5e72f8c1a2
+#Tue Dec 13 13:02:26 EST 2016
+id=158f95987f02ea226ffd7ef82cc4c1e7d545fa5b89e
method=file
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerController.java b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerController.java
index 6fcc315..77ad97d 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerController.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerController.java
@@ -37,6 +37,10 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Controller;
@@ -376,11 +380,13 @@ public class CustomerController {
* @throws Exception
*/
@PreAuthorize("hasRole('CUSTOMER')")
- @RequestMapping(value={"/admin/customers/attributes/save.html"}, method=RequestMethod.POST, produces="application/json;text/plain;charset=UTF-8")
- public @ResponseBody String saveCustomerAttributes(HttpServletRequest request, Locale locale) throws Exception {
+ @RequestMapping(value={"/admin/customers/attributes/save.html"}, method=RequestMethod.POST)
+ public @ResponseBody ResponseEntity<String> saveCustomerAttributes(HttpServletRequest request, Locale locale) throws Exception {
AjaxResponse resp = new AjaxResponse();
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
MerchantStore store = (MerchantStore)request.getAttribute(Constants.ADMIN_STORE);
@@ -404,13 +410,15 @@ public class CustomerController {
if(customer==null) {
LOGGER.error("Customer id [customer] is not defined in the parameters");
resp.setStatus(AjaxResponse.RESPONSE_STATUS_FAIURE);
- return resp.toJSONString();
+ String returnString = resp.toJSONString();
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
if(customer.getMerchantStore().getId().intValue()!=store.getId().intValue()) {
LOGGER.error("Customer id does not belong to current store");
resp.setStatus(AjaxResponse.RESPONSE_STATUS_FAIURE);
- return resp.toJSONString();
+ String returnString = resp.toJSONString();
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
List<CustomerAttribute> customerAttributes = customerAttributeService.getByCustomer(store, customer);
@@ -500,7 +508,8 @@ public class CustomerController {
}
resp.setStatus(AjaxResponse.RESPONSE_STATUS_SUCCESS);
- return resp.toJSONString();
+ String returnString = resp.toJSONString();
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
@@ -528,9 +537,9 @@ public class CustomerController {
@SuppressWarnings("unchecked")
- @RequestMapping(value="/admin/customers/page.html", method=RequestMethod.POST, produces="application/json;charset=UTF-8")
+ @RequestMapping(value="/admin/customers/page.html", method=RequestMethod.POST)
public @ResponseBody
- String pageCustomers(HttpServletRequest request,HttpServletResponse response) {
+ ResponseEntity<String> pageCustomers(HttpServletRequest request,HttpServletResponse response) {
AjaxPageableResponse resp = new AjaxPageableResponse();
@@ -604,22 +613,25 @@ public class CustomerController {
}
String returnString = resp.toJSONString();
-
- return returnString;
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
@PreAuthorize("hasRole('CUSTOMER')")
- @RequestMapping(value="/admin/customers/resetPassword.html", method=RequestMethod.POST, produces="application/json")
+ @RequestMapping(value="/admin/customers/resetPassword.html", method=RequestMethod.POST)
public @ResponseBody
- String resetPassword(HttpServletRequest request,HttpServletResponse response) {
+ ResponseEntity<String> resetPassword(HttpServletRequest request,HttpServletResponse response) {
String customerId = request.getParameter("customerId");
MerchantStore store = (MerchantStore)request.getAttribute(Constants.ADMIN_STORE);
AjaxResponse resp = new AjaxResponse();
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
@@ -632,13 +644,15 @@ public class CustomerController {
if(customer==null) {
resp.setErrorString("Customer does not exist");
resp.setStatus(AjaxResponse.RESPONSE_STATUS_FAIURE);
- return resp.toJSONString();
+ String returnString = resp.toJSONString();
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
if(customer.getMerchantStore().getId().intValue()!=store.getId().intValue()) {
resp.setErrorString("Invalid customer id");
resp.setStatus(AjaxResponse.RESPONSE_STATUS_FAIURE);
- return resp.toJSONString();
+ String returnString = resp.toJSONString();
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
Language userLanguage = customer.getDefaultLanguage();
@@ -697,7 +711,8 @@ public class CustomerController {
}
- return resp.toJSONString();
+ String returnString = resp.toJSONString();
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsController.java b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsController.java
index 73352e4..65ddcc4 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsController.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsController.java
@@ -14,6 +14,10 @@ import com.salesmanager.shop.utils.LabelUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -212,8 +216,8 @@ public class CustomerOptionsController {
@SuppressWarnings("unchecked")
@PreAuthorize("hasRole('CUSTOMER')")
- @RequestMapping(value="/admin/customers/options/paging.html", method=RequestMethod.POST, produces="application/json;text/plain;charset=UTF-8")
- public @ResponseBody String pageOptions(HttpServletRequest request, HttpServletResponse response) {
+ @RequestMapping(value="/admin/customers/options/paging.html", method=RequestMethod.POST)
+ public @ResponseBody ResponseEntity<String> pageOptions(HttpServletRequest request, HttpServletResponse response) {
AjaxResponse resp = new AjaxResponse();
@@ -262,8 +266,9 @@ public class CustomerOptionsController {
}
String returnString = resp.toJSONString();
-
- return returnString;
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
@@ -289,8 +294,8 @@ public class CustomerOptionsController {
}
@PreAuthorize("hasRole('CUSTOMER')")
- @RequestMapping(value="/admin/customers/options/remove.html", method=RequestMethod.POST, produces="application/json")
- public @ResponseBody String deleteOption(HttpServletRequest request, HttpServletResponse response, Locale locale) {
+ @RequestMapping(value="/admin/customers/options/remove.html", method=RequestMethod.POST)
+ public @ResponseBody ResponseEntity<String> deleteOption(HttpServletRequest request, HttpServletResponse response, Locale locale) {
String sid = request.getParameter("id");
MerchantStore store = (MerchantStore)request.getAttribute(Constants.ADMIN_STORE);
@@ -324,8 +329,9 @@ public class CustomerOptionsController {
}
String returnString = resp.toJSONString();
-
- return returnString;
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
}
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsSetController.java b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsSetController.java
index 2f7543d..2f968ac 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsSetController.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsSetController.java
@@ -15,6 +15,10 @@ import com.salesmanager.shop.utils.LabelUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -182,8 +186,8 @@ public class CustomerOptionsSetController {
@SuppressWarnings("unchecked")
@PreAuthorize("hasRole('CUSTOMER')")
- @RequestMapping(value="/admin/customers/optionsset/paging.html", method=RequestMethod.POST, produces="application/json;text/plain;charset=UTF-8")
- public @ResponseBody String pageOptionsSet(HttpServletRequest request, HttpServletResponse response) {
+ @RequestMapping(value="/admin/customers/optionsset/paging.html", method=RequestMethod.POST)
+ public @ResponseBody ResponseEntity<String> pageOptionsSet(HttpServletRequest request, HttpServletResponse response) {
AjaxResponse resp = new AjaxResponse();
@@ -243,8 +247,9 @@ public class CustomerOptionsSetController {
}
String returnString = resp.toJSONString();
-
- return returnString;
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
@@ -270,8 +275,8 @@ public class CustomerOptionsSetController {
}
@PreAuthorize("hasRole('CUSTOMER')")
- @RequestMapping(value="/admin/customers/optionsset/remove.html", method=RequestMethod.POST, produces="application/json")
- public @ResponseBody String deleteOptionSet(HttpServletRequest request, HttpServletResponse response, Locale locale) {
+ @RequestMapping(value="/admin/customers/optionsset/remove.html", method=RequestMethod.POST)
+ public @ResponseBody ResponseEntity<String> deleteOptionSet(HttpServletRequest request, HttpServletResponse response, Locale locale) {
String sid = request.getParameter("id");
MerchantStore store = (MerchantStore)request.getAttribute(Constants.ADMIN_STORE);
@@ -307,15 +312,16 @@ public class CustomerOptionsSetController {
}
String returnString = resp.toJSONString();
-
- return returnString;
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
@PreAuthorize("hasRole('CUSTOMER')")
- @RequestMapping(value="/admin/customers/optionsset/update.html", method=RequestMethod.POST, produces="application/json;text/plain;charset=UTF-8")
- public @ResponseBody String updateOrder(HttpServletRequest request, HttpServletResponse response) {
+ @RequestMapping(value="/admin/customers/optionsset/update.html", method=RequestMethod.POST)
+ public @ResponseBody ResponseEntity<String> updateOrder(HttpServletRequest request, HttpServletResponse response) {
String values = request.getParameter("_oldValues");
String order = request.getParameter("order");
@@ -352,8 +358,9 @@ public class CustomerOptionsSetController {
}
String returnString = resp.toJSONString();
-
- return returnString;
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsValueController.java b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsValueController.java
index 84be611..0490b94 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsValueController.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/customers/CustomerOptionsValueController.java
@@ -14,6 +14,10 @@ import com.salesmanager.shop.utils.LabelUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -232,8 +236,8 @@ public class CustomerOptionsValueController {
@SuppressWarnings("unchecked")
@PreAuthorize("hasRole('CUSTOMER')")
- @RequestMapping(value="/admin/customers/options/values/paging.html", method=RequestMethod.POST, produces="application/json")
- public @ResponseBody String pageOptions(HttpServletRequest request, HttpServletResponse response) {
+ @RequestMapping(value="/admin/customers/options/values/paging.html", method=RequestMethod.POST)
+ public @ResponseBody ResponseEntity<String> pageOptions(HttpServletRequest request, HttpServletResponse response) {
AjaxResponse resp = new AjaxResponse();
@@ -274,15 +278,16 @@ public class CustomerOptionsValueController {
}
String returnString = resp.toJSONString();
-
- return returnString;
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
@PreAuthorize("hasRole('CUSTOMER')")
- @RequestMapping(value="/admin/customers/options/values/remove.html", method=RequestMethod.POST, produces="application/json")
- public @ResponseBody String deleteOptionValue(HttpServletRequest request, HttpServletResponse response, Locale locale) {
+ @RequestMapping(value="/admin/customers/options/values/remove.html", method=RequestMethod.POST)
+ public @ResponseBody ResponseEntity<String> deleteOptionValue(HttpServletRequest request, HttpServletResponse response, Locale locale) {
String sid = request.getParameter("id");
MerchantStore store = (MerchantStore)request.getAttribute(Constants.ADMIN_STORE);
@@ -313,8 +318,9 @@ public class CustomerOptionsValueController {
}
String returnString = resp.toJSONString();
-
- return returnString;
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/search/SearchController.java b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/search/SearchController.java
index 73175a5..a13235e 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/search/SearchController.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/search/SearchController.java
@@ -84,11 +84,10 @@ public class SearchController {
* @return
* @throws Exception
*/
- @RequestMapping(value="/services/public/search/{store}/{language}/autocomplete", produces="application/json;charset=UTF-8")
- //@RequestMapping(value="/services/public/search/{store}/{language}/autocomplete")
+ @RequestMapping(value="/services/public/search/{store}/{language}/autocomplete.json", produces="application/json;charset=UTF-8")
@ResponseBody
public ResponseEntity<String> autocomplete(@RequestParam("q") String query, @PathVariable String store, @PathVariable final String language, Model model, HttpServletRequest request, HttpServletResponse response) {
-
+ //public String autocomplete(@RequestParam("q") String query, @PathVariable String store, @PathVariable final String language, Model model, HttpServletRequest request, HttpServletResponse response) {
final HttpHeaders httpHeaders= new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
MerchantStore merchantStore = (MerchantStore)request.getAttribute(Constants.MERCHANT_STORE);
@@ -101,24 +100,23 @@ public class SearchController {
try {
- if(merchantStore== null) {
+ if(merchantStore== null) {
+ merchantStore = merchantStoreService.getByCode(store);
+ }
+
+ if(merchantStore==null) {
+ LOGGER.error("Merchant store is null for code " + store);
+ response.sendError(503, "Merchant store is null for code " + store);//TODO localized message
+ return null;
+ }
+
+ AutoCompleteRequest req = new AutoCompleteRequest(store,language);
+ /** formatted toJSONString because of te specific field names required in the UI **/
+ SearchKeywords keywords = searchService.searchForKeywords(req.getCollectionName(), req.toJSONString(query), AUTOCOMPLETE_ENTRIES_COUNT);
+ //return keywords.toJSONString();
+ return new ResponseEntity<String>(keywords.toJSONString(),httpHeaders,HttpStatus.OK);
+ //return new ResponseEntity<String>(keywords.toJSONString(),HttpStatus.OK);
- merchantStore = merchantStoreService.getByCode(store);
-
- }
-
- if(merchantStore==null) {
- LOGGER.error("Merchant store is null for code " + store);
- response.sendError(503, "Merchant store is null for code " + store);//TODO localized message
- return null;
- }
-
- AutoCompleteRequest req = new AutoCompleteRequest(store,language);
- /** formatted toJSONString because of te specific field names required in the UI **/
- SearchKeywords keywords = searchService.searchForKeywords(req.getCollectionName(), req.toJSONString(query), AUTOCOMPLETE_ENTRIES_COUNT);
- //return keywords.toJSONString();
- return new ResponseEntity<String>(keywords.toJSONString(),httpHeaders,HttpStatus.OK);
-
} catch (Exception e) {
LOGGER.error("Exception while autocomplete " + e);
}
diff --git a/sm-shop/src/main/webapp/pages/shop/templates/bootstrap/sections/navbar.jsp b/sm-shop/src/main/webapp/pages/shop/templates/bootstrap/sections/navbar.jsp
index 0ceee19..4a293ea 100644
--- a/sm-shop/src/main/webapp/pages/shop/templates/bootstrap/sections/navbar.jsp
+++ b/sm-shop/src/main/webapp/pages/shop/templates/bootstrap/sections/navbar.jsp
@@ -30,7 +30,7 @@ $(document).ready(function() {
remote: {
- url: '<c:url value="/services/public/search/${requestScope.MERCHANT_STORE.code}/${requestScope.LANGUAGE.code}/autocomplete"/>?q=%QUERY',
+ url: '<c:url value="/services/public/search/${requestScope.MERCHANT_STORE.code}/${requestScope.LANGUAGE.code}/autocomplete.json"/>?q=%QUERY',
filter: function (parsedResponse) {
// parsedResponse is the array returned from your backend
console.log(parsedResponse);
@@ -41,7 +41,7 @@ $(document).ready(function() {
},
template: [
'<p class="name">{{name}}</p>',
- '<p class="description">{{description}}</p>'
+ '<p class="description">{{value}}</p>'
].join(''),
engine: Hogan
});
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 04a5e5e..fd116bb 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
-#Thu Dec 08 12:00:20 EST 2016
+#Tue Dec 13 12:59:27 EST 2016
version=2.5.0-SNAPSHOT
groupId=com.shopizer
m2e.projectName=sm-shop