proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/modules/integration/shipping/impl/ShippingDistancePreProcessorImpl.java
ShippingDistancePreProcessorImpl
prePostProcessShippingQuotes
class ShippingDistancePreProcessorImpl implements ShippingQuotePrePostProcessModule { private static final Logger LOGGER = LoggerFactory.getLogger(ShippingDistancePreProcessorImpl.class); private final static String BLANK = " "; private final static String MODULE_CODE = "shippingDistanceModule"; @Value("${co...
/** which destinations are supported by this module **/ if(delivery.getZone()==null) { return; } boolean zoneAllowed = false; if(allowedZonesCodes!=null) { for(String zoneCode : allowedZonesCodes) { if(zoneCode.equals(delivery.getZone().getCode())) { zoneAllowed = true; break;...
382
1,059
1,441
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/modules/integration/shipping/impl/ShippingInputParameters.java
ShippingInputParameters
toString
class ShippingInputParameters { private String moduleName; private long weight; private long volume; private String country; private String province; private long distance; private long size; private int price;//integer should be rounded from BigBecimal private String priceQuote; public String getModuleNa...
StringBuilder sb = new StringBuilder(); sb.append(" weight : ").append(this.getWeight()); sb.append(" volume : ").append(this.getVolume()) .append(" size : ").append(this.getSize()) .append(" distance : ").append(this.getDistance()) .append(" province : ").append(this.getProvince()) .append(" price : ")....
422
138
560
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/modules/integration/shipping/impl/StorePickupShippingQuote.java
StorePickupShippingQuote
prePostProcessShippingQuotes
class StorePickupShippingQuote implements ShippingQuoteModule, ShippingQuotePrePostProcessModule { public final static String MODULE_CODE = "storePickUp"; @Inject private MerchantConfigurationService merchantConfigurationService; @Inject private ProductPriceUtils productPriceUtils; @Override public void...
Validate.notNull(globalShippingConfiguration, "IntegrationConfiguration must not be null for StorePickUp"); try { if(!globalShippingConfiguration.isActive()) return; String region = null; String price = globalShippingConfiguration.getIntegrationKeys().get("price"); if(delivery...
740
427
1,167
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/modules/order/total/ManufacturerShippingCodeOrderTotalModuleImpl.java
ManufacturerShippingCodeOrderTotalModuleImpl
caculateProductPiceVariation
class ManufacturerShippingCodeOrderTotalModuleImpl implements OrderTotalPostProcessorModule { private static final Logger LOGGER = LoggerFactory.getLogger(ManufacturerShippingCodeOrderTotalModuleImpl.class); private String name; private String code; //private StatelessKnowledgeSession orderTotalMethodDecision...
Validate.notNull(product,"product must not be null"); Validate.notNull(product.getManufacturer(),"product manufacturer must not be null"); //requires shipping summary, otherwise return null if(summary.getShippingSummary()==null) { return null; } OrderTotalInputParameters inputParameters = new...
460
502
962
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/modules/order/total/PromoCodeCalculatorModule.java
PromoCodeCalculatorModule
caculateProductPiceVariation
class PromoCodeCalculatorModule implements OrderTotalPostProcessorModule { @Autowired private DroolsBeanFactory droolsBeanFactory; @Autowired private PricingService pricingService; private String name; private String code; @Override public String getName() { // TODO Auto-generated method stub return...
Validate.notNull(summary, "OrderTotalSummary must not be null"); Validate.notNull(store, "MerchantStore must not be null"); if(StringUtils.isBlank(summary.getPromoCode())) { return null; } KieSession kieSession=droolsBeanFactory.getKieSession(ResourceFactory.newClassPathResource("com/salesmanager...
227
518
745
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/modules/utils/EncryptionImpl.java
EncryptionImpl
decrypt
class EncryptionImpl implements Encryption { private final static String IV_P = "fedcba9876543210"; private final static String KEY_SPEC = "AES"; private final static String CYPHER_SPEC = "AES/CBC/PKCS5Padding"; private String secretKey; @Override public String encrypt(String value) throws Exception ...
if (StringUtils.isBlank(value)) throw new Exception("Nothing to encrypt"); // NEED TO UNDERSTAND WHY PKCS5Padding DOES NOT WORK // Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); Cipher cipher = Cipher.getInstance(CYPHER_SPEC); SecretKeySpec keySpec = new SecretKeySpec(secretKey.getBytes(), ...
692
213
905
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/modules/utils/GeoLocationImpl.java
GeoLocationImpl
getAddress
class GeoLocationImpl implements GeoLocation { private DatabaseReader reader = null; private static final Logger LOGGER = LoggerFactory.getLogger( GeoLocationImpl.class ); @Override public Address getAddress(String ipAddress) throws Exception {<FILL_FUNCTION_BODY>} }
if(reader==null) { try { java.io.InputStream inputFile = GeoLocationImpl.class.getClassLoader().getResourceAsStream("reference/GeoLite2-City.mmdb"); reader = new DatabaseReader.Builder(inputFile).build(); } catch(Exception e) { LOGGER.error("Cannot instantiate IP database",e); } ...
75
299
374
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/category/CategoryRepositoryImpl.java
CategoryRepositoryImpl
countProductsByCategories
class CategoryRepositoryImpl implements CategoryRepositoryCustom { @PersistenceContext private EntityManager em; @Override public List<Object[]> countProductsByCategories(MerchantStore store, List<Long> categoryIds) {<FILL_FUNCTION_BODY>} @SuppressWarnings("unchecked") @Override public List<Category> li...
StringBuilder qs = new StringBuilder(); qs.append("select category.id, count(product.id) from Product product "); qs.append("inner join product.categories category "); qs.append("where category.id in (:cid) "); qs.append("and product.available=true and product.dateAvailable<=:dt "); qs.append("group by...
822
214
1,036
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/category/PageableCategoryRepositoryImpl.java
PageableCategoryRepositoryImpl
listByStore
class PageableCategoryRepositoryImpl implements PageableCategoryRepositoryCustom { @PersistenceContext private EntityManager em; @SuppressWarnings("unchecked") @Override public Page<Category> listByStore(Integer storeId, Integer languageId, String name, Pageable pageable) {<FILL_FUNCTION_BODY>} }
Query query = em.createNamedQuery("CATEGORY.listByStore"); Query countQueryResult = em.createNamedQuery("CATEGORY.listByStore.count"); query.setParameter(1, storeId); query.setParameter(2, languageId); query.setParameter(3, name == null ? "" : name); query.setMaxResults(pageable.getPageSize()); qu...
83
162
245
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/repositories/content/ContentRepositoryImpl.java
ContentRepositoryImpl
getBySeUrl
class ContentRepositoryImpl implements ContentRepositoryCustom { @PersistenceContext private EntityManager em; @Override public List<ContentDescription> listNameByType(List<ContentType> contentType, MerchantStore store, Language language) { StringBuilder qs = new StringBuilder(); qs.append...
StringBuilder qs = new StringBuilder(); qs.append("select c from Content c "); qs.append("left join fetch c.descriptions cd join fetch c.merchantStore cm "); qs.append("where cm.id =:cm "); qs.append("and c.visible =true "); qs.append("and cd.seUrl =:se "); String hql = qs.toString(); Query...
472
315
787
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/repositories/customer/CustomerRepositoryImpl.java
CustomerRepositoryImpl
listByStore
class CustomerRepositoryImpl implements CustomerRepositoryCustom { @PersistenceContext private EntityManager em; @SuppressWarnings("unchecked") @Override public CustomerList listByStore(MerchantStore store, CustomerCriteria criteria) {<FILL_FUNCTION_BODY>} }
CustomerList customerList = new CustomerList(); StringBuilder countBuilderSelect = new StringBuilder(); StringBuilder objectBuilderSelect = new StringBuilder(); String baseCountQuery = "select count(c) from Customer as c"; String baseQuery = "select c from Customer as c left join fetch c.delivery.cou...
80
1,279
1,359
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/repositories/merchant/MerchantRepositoryImpl.java
MerchantRepositoryImpl
listByCriteria
class MerchantRepositoryImpl implements MerchantRepositoryCustom { @PersistenceContext private EntityManager em; private static final Logger LOGGER = LoggerFactory.getLogger(MerchantRepositoryImpl.class); @SuppressWarnings({"rawtypes", "unchecked"}) @Override public GenericEntityList listByCriteria(Me...
try { StringBuilder req = new StringBuilder(); req.append( "select distinct m from MerchantStore m left join fetch m.country mc left join fetch m.parent cp left join fetch m.currency mc left join fetch m.zone mz left join fetch m.defaultLanguage md left join fetch m.languages mls"); Str...
115
690
805
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/repositories/user/PermissionRepositoryImpl.java
PermissionRepositoryImpl
listByCriteria
class PermissionRepositoryImpl implements PermissionRepositoryCustom { @PersistenceContext private EntityManager em; @Override public PermissionList listByCriteria(PermissionCriteria criteria) {<FILL_FUNCTION_BODY>} }
PermissionList permissionList = new PermissionList(); StringBuilder countBuilderSelect = new StringBuilder(); countBuilderSelect.append("select count(p) from Permission as p"); StringBuilder countBuilderWhere = new StringBuilder(); if(criteria.getGroupIds()!=null && criteria.getGroupIds()....
66
661
727
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/repositories/user/UserRepositoryImpl.java
UserRepositoryImpl
listByCriteria
class UserRepositoryImpl implements UserRepositoryCustom { @PersistenceContext private EntityManager em; private static final Logger LOGGER = LoggerFactory.getLogger(UserRepositoryImpl.class); @SuppressWarnings("unchecked") @Override public GenericEntityList<User> listByCriteria(Criteria criteria) thr...
/** * Name like * email like */ try { StringBuilder req = new StringBuilder(); req.append( "select distinct u from User as u left join fetch u.groups ug left join fetch u.defaultLanguage ud join fetch u.merchantStore um"); StringBuilder countBuilder = new StringBuild...
106
682
788
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/catalog/CatalogEntryServiceImpl.java
CatalogEntryServiceImpl
list
class CatalogEntryServiceImpl extends SalesManagerEntityServiceImpl<Long, CatalogCategoryEntry> implements CatalogEntryService { @Autowired private PageableCatalogEntryRepository pageableCatalogEntryRepository; private CatalogEntryRepository catalogEntryRepository; @Inject public CatalogEntryServiceImpl(Cata...
Pageable pageRequest = PageRequest.of(page, count); return pageableCatalogEntryRepository.listByCatalog(catalog.getId(), store.getId(), language.getId(), name, pageRequest);
241
54
295
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.catalog.CatalogCategoryEntry,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.catalog.CatalogCategoryEntry) throws com.salesmanager.core.business.exception.ServiceException,public void de...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/inventory/ProductInventoryServiceImpl.java
ProductInventoryServiceImpl
defaultAvailability
class ProductInventoryServiceImpl implements ProductInventoryService { @Autowired private PricingService pricingService; @Override public ProductInventory inventory(Product product) throws ServiceException { Validate.notNull(product.getAvailabilities()); ProductAvailability availability = defaultAvailab...
ProductAvailability defaultAvailability = availabilities.iterator().next(); for (ProductAvailability availability : availabilities) { if (!StringUtils.isEmpty(availability.getRegion()) && availability.getRegion().equals(Constants.ALL_REGIONS)) {// TODO REL 2.1 accept a region defaultAvailability ...
472
107
579
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/pricing/PricingServiceImpl.java
PricingServiceImpl
getAmount
class PricingServiceImpl implements PricingService { private static final Logger LOGGER = LoggerFactory.getLogger(PricingServiceImpl.class); @Inject private ProductPriceUtils priceUtil; @Override public FinalPrice calculateProductPrice(Product product) throws ServiceException { return priceUtil.getFinalPr...
try { return priceUtil.getAmount(amount); } catch (Exception e) { LOGGER.error("An error occured when trying to format an amount " + amount); throw new ServiceException(e); }
715
65
780
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductAttributeServiceImpl.java
ProductAttributeServiceImpl
delete
class ProductAttributeServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductAttribute> implements ProductAttributeService { private ProductAttributeRepository productAttributeRepository; @Autowired private PageableProductAttributeRepository pageableProductAttributeRepository; @Inject public ProductAtt...
// override method, this allows the error that we try to remove a detached // variant attribute = this.getById(attribute.getId()); super.delete(attribute);
623
50
673
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.attribute.ProductAttribute,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.attribute.ProductAttribute) throws com.salesmanager.core.business.exception.ServiceException,pu...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductOptionServiceImpl.java
ProductOptionServiceImpl
getByName
class ProductOptionServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductOption> implements ProductOptionService { private ProductOptionRepository productOptionRepository; @Autowired private PageableProductOptionRepository pageableProductOptionRepository; @Inject private ProductAttributeService p...
try { return productOptionRepository.findByName(store.getId(), name, language.getId()); } catch (Exception e) { throw new ServiceException(e); }
680
57
737
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.attribute.ProductOption,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.attribute.ProductOption) throws com.salesmanager.core.business.exception.ServiceException,public v...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/attribute/ProductOptionValueServiceImpl.java
ProductOptionValueServiceImpl
delete
class ProductOptionValueServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductOptionValue> implements ProductOptionValueService { @Inject private ProductAttributeService productAttributeService; @Autowired private PageableProductOptionValueRepository pageableProductOptionValueRepository; private ...
//remove all attributes having this option List<ProductAttribute> attributes = productAttributeService.getByOptionValueId(entity.getMerchantStore(), entity.getId()); for(ProductAttribute attribute : attributes) { productAttributeService.delete(attribute); } ProductOptionValue option = getById(ent...
654
107
761
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.attribute.ProductOptionValue,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.attribute.ProductOptionValue) throws com.salesmanager.core.business.exception.ServiceExceptio...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/availability/ProductAvailabilityServiceImpl.java
ProductAvailabilityServiceImpl
listByProduct
class ProductAvailabilityServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductAvailability> implements ProductAvailabilityService { private ProductAvailabilityRepository productAvailabilityRepository; @Inject private PageableProductAvailabilityRepository pageableProductAvailabilityRepository; @Inject...
Validate.notNull(productId, "Product cannot be null"); Validate.notNull(store, "MercantStore cannot be null"); Pageable pageRequest = PageRequest.of(page, count); return pageableProductAvailabilityRepository.getByProductId(productId, store.getCode(), pageRequest);
563
84
647
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.availability.ProductAvailability,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.availability.ProductAvailability) throws com.salesmanager.core.business.exception.Service...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/file/DigitalProductServiceImpl.java
DigitalProductServiceImpl
addProductFile
class DigitalProductServiceImpl extends SalesManagerEntityServiceImpl<Long, DigitalProduct> implements DigitalProductService { private DigitalProductRepository digitalProductRepository; @Inject StaticContentFileManager productDownloadsFileManager; @Inject ProductService productService; @I...
Assert.notNull(digitalProduct,"DigitalProduct cannot be null"); Assert.notNull(product,"Product cannot be null"); digitalProduct.setProduct(product); try { Assert.notNull(inputFile.getFile(),"InputContentFile.file cannot be null"); Assert.notNull(product.getMerchantStore(),"Product.merchantSto...
567
269
836
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.file.DigitalProduct,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.file.DigitalProduct) throws com.salesmanager.core.business.exception.ServiceException,public void dele...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/image/ProductImageServiceImpl.java
ProductImageServiceImpl
addProductImageDescription
class ProductImageServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductImage> implements ProductImageService { private ProductImageRepository productImageRepository; @Inject public ProductImageServiceImpl(ProductImageRepository productImageRepository) { super(productImageRepository); this.productIm...
if (productImage.getDescriptions() == null) { productImage.setDescriptions(new ArrayList<ProductImageDescription>()); } productImage.getDescriptions().add(description); description.setProductImage(productImage); update(productImage);
1,242
79
1,321
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.image.ProductImage,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.image.ProductImage) throws com.salesmanager.core.business.exception.ServiceException,public void delete...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/manufacturer/ManufacturerServiceImpl.java
ManufacturerServiceImpl
listByStore
class ManufacturerServiceImpl extends SalesManagerEntityServiceImpl<Long, Manufacturer> implements ManufacturerService { private static final Logger LOGGER = LoggerFactory.getLogger(ManufacturerServiceImpl.class); @Inject private PageableManufacturerRepository pageableManufacturerRepository; private Ma...
Pageable pageRequest = PageRequest.of(page, count); return pageableManufacturerRepository.findByStore(store.getId(), language.getId(), null, pageRequest);
1,086
47
1,133
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.manufacturer.Manufacturer,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.manufacturer.Manufacturer) throws com.salesmanager.core.business.exception.ServiceException,publ...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/price/ProductPriceServiceImpl.java
ProductPriceServiceImpl
delete
class ProductPriceServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductPrice> implements ProductPriceService { private ProductPriceRepository productPriceRepository; @Inject public ProductPriceServiceImpl(ProductPriceRepository productPriceRepository) { super(productPriceRepository); this.productP...
//override method, this allows the error that we try to remove a detached variant price = this.getById(price.getId()); super.delete(price);
382
50
432
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.price.ProductPrice,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.price.ProductPrice) throws com.salesmanager.core.business.exception.ServiceException,public void delete...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/relationship/ProductRelationshipServiceImpl.java
ProductRelationshipServiceImpl
deleteRelationship
class ProductRelationshipServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductRelationship> implements ProductRelationshipService { private ProductRelationshipRepository productRelationshipRepository; @Inject public ProductRelationshipServiceImpl( ProductRelationshipRepository productRelationsh...
//throws detached exception so need to query first relationship = this.getById(relationship.getId()); if(relationship != null) { delete(relationship); }
1,111
61
1,172
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.relationship.ProductRelationship,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.relationship.ProductRelationship) throws com.salesmanager.core.business.exception.Service...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/review/ProductReviewServiceImpl.java
ProductReviewServiceImpl
saveOrUpdate
class ProductReviewServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductReview> implements ProductReviewService { private ProductReviewRepository productReviewRepository; @Inject private ProductService productService; @Inject public ProductReviewServiceImpl( ProductReviewRepository productRe...
Validate.notNull(review,"ProductReview cannot be null"); Validate.notNull(review.getProduct(),"ProductReview.product cannot be null"); Validate.notNull(review.getCustomer(),"ProductReview.customer cannot be null"); //refresh product Product product = productService.getById(review.getProduct().getId...
454
355
809
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.review.ProductReview,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.review.ProductReview) throws com.salesmanager.core.business.exception.ServiceException,public void de...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/type/ProductTypeServiceImpl.java
ProductTypeServiceImpl
saveOrUpdate
class ProductTypeServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductType> implements ProductTypeService { private ProductTypeRepository productTypeRepository; @Autowired private PageableProductTypeRepository pageableProductTypeRepository; @Inject public ProductTypeServiceImpl(ProductTypeRepositor...
if(productType.getId()!=null && productType.getId() > 0) { this.update(productType); } else { productType = super.saveAndFlush(productType); } return productType;
480
66
546
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.type.ProductType,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.type.ProductType) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/variant/ProductVariantGroupServiceImpl.java
ProductVariantGroupServiceImpl
getByProductId
class ProductVariantGroupServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductVariantGroup> implements ProductVariantGroupService { @Autowired private PageableProductVariantGroupRepository pageableProductVariantGroupRepository; private ProductVariantGroupRepository productVariantGroupRepository; pu...
Pageable pageRequest = PageRequest.of(page, count); return pageableProductVariantGroupRepository.findByProductId(store.getId(), productId, pageRequest);
326
48
374
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.variant.ProductVariantGroup,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.variant.ProductVariantGroup) throws com.salesmanager.core.business.exception.ServiceException,...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/product/variation/ProductVariationServiceImpl.java
ProductVariationServiceImpl
saveOrUpdate
class ProductVariationServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductVariation> implements ProductVariationService { @Inject private ProductVariationRepository productVariationRepository; @Inject public ProductVariationServiceImpl( ProductVariationRepository productVariationSetRepository) ...
//save or update (persist and attach entities if(entity.getId()!=null && entity.getId()>0) { super.update(entity); } else { super.save(entity); }
434
71
505
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.variation.ProductVariation,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.variation.ProductVariation) throws com.salesmanager.core.business.exception.ServiceException,pu...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/customer/CustomerServiceImpl.java
CustomerServiceImpl
delete
class CustomerServiceImpl extends SalesManagerEntityServiceImpl<Long, Customer> implements CustomerService { private static final Logger LOGGER = LoggerFactory.getLogger(CustomerServiceImpl.class); private CustomerRepository customerRepository; @Inject private CustomerAttributeService customerAttributeService;...
customer = getById(customer.getId()); //delete attributes List<CustomerAttribute> attributes =customerAttributeService.getByCustomer(customer.getMerchantStore(), customer); if(attributes!=null) { for(CustomerAttribute attribute : attributes) { customerAttributeService.delete(attribute); } } cu...
602
98
700
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.customer.Customer,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.customer.Customer) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.core.model.custo...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/customer/attribute/CustomerAttributeServiceImpl.java
CustomerAttributeServiceImpl
delete
class CustomerAttributeServiceImpl extends SalesManagerEntityServiceImpl<Long, CustomerAttribute> implements CustomerAttributeService { private CustomerAttributeRepository customerAttributeRepository; @Inject public CustomerAttributeServiceImpl(CustomerAttributeRepository customerAttributeRepository) { super(...
//override method, this allows the error that we try to remove a detached instance attribute = this.getById(attribute.getId()); super.delete(attribute);
362
50
412
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.customer.attribute.CustomerAttribute,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.customer.attribute.CustomerAttribute) throws com.salesmanager.core.business.exception.ServiceException,public void de...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/customer/attribute/CustomerOptionServiceImpl.java
CustomerOptionServiceImpl
delete
class CustomerOptionServiceImpl extends SalesManagerEntityServiceImpl<Long, CustomerOption> implements CustomerOptionService { private CustomerOptionRepository customerOptionRepository; @Inject private CustomerAttributeService customerAttributeService; @Inject private CustomerOptionSetService customerOpti...
//remove all attributes having this option List<CustomerAttribute> attributes = customerAttributeService.getByOptionId(customerOption.getMerchantStore(), customerOption.getId()); for(CustomerAttribute attribute : attributes) { customerAttributeService.delete(attribute); } CustomerOption option = ...
342
178
520
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.customer.attribute.CustomerOption,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.customer.attribute.CustomerOption) throws com.salesmanager.core.business.exception.ServiceException,public void delete(c...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/customer/attribute/CustomerOptionSetServiceImpl.java
CustomerOptionSetServiceImpl
listByOption
class CustomerOptionSetServiceImpl extends SalesManagerEntityServiceImpl<Long, CustomerOptionSet> implements CustomerOptionSetService { @Inject private CustomerOptionSetRepository customerOptionSetRepository; @Inject public CustomerOptionSetServiceImpl( CustomerOptionSetRepository customerOptionSetReposit...
Validate.notNull(store,"merchant store cannot be null"); Validate.notNull(option,"option cannot be null"); return customerOptionSetRepository.findByOptionId(store.getId(), option.getId());
427
60
487
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.customer.attribute.CustomerOptionSet,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.customer.attribute.CustomerOptionSet) throws com.salesmanager.core.business.exception.ServiceException,public void de...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/customer/attribute/CustomerOptionValueServiceImpl.java
CustomerOptionValueServiceImpl
delete
class CustomerOptionValueServiceImpl extends SalesManagerEntityServiceImpl<Long, CustomerOptionValue> implements CustomerOptionValueService { @Inject private CustomerAttributeService customerAttributeService; private CustomerOptionValueRepository customerOptionValueRepository; @Inject private CustomerOpti...
//remove all attributes having this option List<CustomerAttribute> attributes = customerAttributeService.getByCustomerOptionValueId(customerOptionValue.getMerchantStore(), customerOptionValue.getId()); for(CustomerAttribute attribute : attributes) { customerAttributeService.delete(attribute); } L...
367
187
554
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.customer.attribute.CustomerOptionValue,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.customer.attribute.CustomerOptionValue) throws com.salesmanager.core.business.exception.ServiceException,public voi...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/customer/review/CustomerReviewServiceImpl.java
CustomerReviewServiceImpl
saveOrUpdate
class CustomerReviewServiceImpl extends SalesManagerEntityServiceImpl<Long, CustomerReview> implements CustomerReviewService { private CustomerReviewRepository customerReviewRepository; @Inject private CustomerService customerService; @Inject public CustomerReviewServiceImpl( CustomerReviewRepository cus...
Validate.notNull(review,"CustomerReview cannot be null"); Validate.notNull(review.getCustomer(),"CustomerReview.customer cannot be null"); Validate.notNull(review.getReviewedCustomer(),"CustomerReview.reviewedCustomer cannot be null"); //refresh customer Customer customer = customerService.getById(...
383
364
747
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.customer.review.CustomerReview,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.customer.review.CustomerReview) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.sal...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/merchant/MerchantStoreServiceImpl.java
MerchantStoreServiceImpl
listAll
class MerchantStoreServiceImpl extends SalesManagerEntityServiceImpl<Integer, MerchantStore> implements MerchantStoreService { @Inject protected ProductTypeService productTypeService; @Autowired private PageableMerchantRepository pageableMerchantRepository; private MerchantRepository merchantRepository; @In...
String store = null; if (storeName != null && storeName.isPresent()) { store = storeName.get(); } Pageable pageRequest = PageRequest.of(page, count); return pageableMerchantRepository.listAll(store, pageRequest);
1,155
75
1,230
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.merchant.MerchantStore,java.lang.Integer>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.merchant.MerchantStore) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.cor...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/order/ordertotal/OrderTotalServiceImpl.java
OrderTotalServiceImpl
findOrderTotalVariation
class OrderTotalServiceImpl implements OrderTotalService { @Autowired @Resource(name="orderTotalsPostProcessors") List<OrderTotalPostProcessorModule> orderTotalPostProcessors; @Inject private ProductService productService; @Override public OrderTotalVariation findOrderTotalVariation(OrderSummary summary, C...
RebatesOrderTotalVariation variation = new RebatesOrderTotalVariation(); List<OrderTotal> totals = null; if(orderTotalPostProcessors != null) { for(OrderTotalPostProcessorModule module : orderTotalPostProcessors) { //TODO check if the module is enabled from the Admin List<ShoppingCartItem...
114
355
469
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/payments/TransactionServiceImpl.java
TransactionServiceImpl
listTransactions
class TransactionServiceImpl extends SalesManagerEntityServiceImpl<Long, Transaction> implements TransactionService { private TransactionRepository transactionRepository; @Inject public TransactionServiceImpl(TransactionRepository transactionRepository) { super(transactionRepository); this.transactionRepos...
List<Transaction> transactions = transactionRepository.findByOrder(order.getId()); ObjectMapper mapper = new ObjectMapper(); for(Transaction transaction : transactions) { if(!StringUtils.isBlank(transaction.getDetails())) { try { @SuppressWarnings("unchecked") Map<String,String> objects =...
1,469
153
1,622
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.payments.Transaction,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.payments.Transaction) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.core.model...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/reference/country/CountryServiceImpl.java
CountryServiceImpl
getCountries
class CountryServiceImpl extends SalesManagerEntityServiceImpl<Integer, Country> implements CountryService { private static final Logger LOGGER = LoggerFactory.getLogger(CountryServiceImpl.class); private CountryRepository countryRepository; @Inject private CacheUtils cache; @Inject public CountryServi...
List<Country> countries = null; try { countries = (List<Country>) cache.getFromCache("COUNTRIES_" + language.getCode()); if(countries==null) { countries = countryRepository.listByLanguage(language.getId()); //set names for(Country country : countries) { CountryDescription d...
596
202
798
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.reference.country.Country,java.lang.Integer>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.reference.country.Country) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanag...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/reference/language/LanguageServiceImpl.java
LanguageServiceImpl
getLanguages
class LanguageServiceImpl extends SalesManagerEntityServiceImpl<Integer, Language> implements LanguageService { private static final Logger LOGGER = LoggerFactory.getLogger(LanguageServiceImpl.class); @Inject private CacheUtils cache; private LanguageRepository languageRepository; @Inject public Language...
List<Language> langs = null; try { langs = (List<Language>) cache.getFromCache("LANGUAGES"); if(langs==null) { langs = this.list(); cache.putInCache(langs, "LANGUAGES"); } } catch (Exception e) { LOGGER.error("getCountries()", e); throw new ServiceException(e); } return ...
538
141
679
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.reference.language.Language,java.lang.Integer>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.reference.language.Language) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesm...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/reference/loader/ConfigurationModulesLoader.java
ConfigurationModulesLoader
loadIntegrationConfigurations
class ConfigurationModulesLoader { @SuppressWarnings("unused") private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationModulesLoader.class); public static String toJSONString(Map<String,IntegrationConfiguration> configurations) throws Exception { StringBuilder jsonModules = new StringBu...
Map<String,IntegrationConfiguration> modules = new HashMap<String,IntegrationConfiguration>(); ObjectMapper mapper = new ObjectMapper(); try { Map[] objects = mapper.readValue(value, Map[].class); for (Map object : objects) { IntegrationConfiguration configuration = new Int...
288
417
705
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/reference/loader/IntegrationModulesLoader.java
IntegrationModulesLoader
loadModule
class IntegrationModulesLoader { private static final Logger LOGGER = LoggerFactory.getLogger(IntegrationModulesLoader.class); public List<IntegrationModule> loadIntegrationModules(String jsonFilePath) throws Exception { List<IntegrationModule> modules = new ArrayList<IntegrationModule>(); ObjectMa...
ObjectMapper mapper = new ObjectMapper(); IntegrationModule module = new IntegrationModule(); module.setModule((String)object.get("module")); module.setCode((String)object.get("code")); module.setImage((String)object.get("image")); if(object.get("type")!=null) { module...
295
1,374
1,669
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/reference/loader/ZonesLoader.java
ZonesLoader
loadIndividualZones
class ZonesLoader { private static final Logger LOGGER = LoggerFactory.getLogger(ZonesLoader.class); @Inject private LanguageService languageService; @Inject private CountryService countryService; @Autowired private ResourcePatternResolver resourceResolver; private static final String PATH = "classpath:/r...
List<Map<String, Zone>> loadedZones = new ArrayList<Map<String, Zone>>(); try { List<Resource> files = geZoneFiles(PATH); List<Language> languages = languageService.list(); ObjectMapper mapper = new ObjectMapper(); List<Country> countries = countryService.list(); Map<String, Country> countriesMa...
1,285
727
2,012
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/reference/zone/ZoneServiceImpl.java
ZoneServiceImpl
getZones
class ZoneServiceImpl extends SalesManagerEntityServiceImpl<Long, Zone> implements ZoneService { private final static String ZONE_CACHE_PREFIX = "ZONES_"; private ZoneRepository zoneRepository; @Inject private CacheUtils cache; private static final Logger LOGGER = LoggerFactory.getLogger(ZoneServiceImpl.c...
Map<String, Zone> zones = null; try { String cacheKey = ZONE_CACHE_PREFIX + language.getCode(); zones = (Map<String, Zone>) cache.getFromCache(cacheKey); if(zones==null) { zones = new HashMap<String, Zone>(); List<Zone> zns = zoneRepository.listByLanguage(language.getId()); ...
983
244
1,227
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.reference.zone.Zone,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.reference.zone.Zone) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.core.model.r...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/shipping/ShippingQuoteServiceImpl.java
ShippingQuoteServiceImpl
getShippingSummary
class ShippingQuoteServiceImpl extends SalesManagerEntityServiceImpl<Long, Quote> implements ShippingQuoteService { private static final Logger LOGGER = LoggerFactory.getLogger(ShippingQuoteServiceImpl.class); private ShippingQuoteRepository shippingQuoteRepository; @Inject private ShippingService shippingSe...
Validate.notNull(quoteId,"quoteId must not be null"); Quote q = shippingQuoteRepository.getOne(quoteId); ShippingSummary quote = null; if(q != null) { quote = new ShippingSummary(); quote.setDeliveryAddress(q.getDelivery()); quote.setShipping(q.getPrice()); quote.setShippingModule(...
235
235
470
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.shipping.Quote,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.shipping.Quote) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.core.model.shipping.Qu...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/shoppingcart/ShoppingCartCalculationServiceImpl.java
ShoppingCartCalculationServiceImpl
calculate
class ShoppingCartCalculationServiceImpl implements ShoppingCartCalculationService { protected final Logger LOG = LoggerFactory.getLogger(getClass()); @Inject private ShoppingCartService shoppingCartService; @Inject private OrderService orderService; /** * <p> * Method used to recalculate state of shoppin...
Validate.notNull(cartModel, "cart cannot be null"); Validate.notNull(cartModel.getLineItems(), "Cart should have line items."); Validate.notNull(store, "MerchantStore cannot be null"); Validate.notNull(customer, "Customer cannot be null"); OrderTotalSummary orderTotalSummary = orderService.calculateShopping...
663
131
794
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/system/EmailServiceImpl.java
EmailServiceImpl
getEmailConfiguration
class EmailServiceImpl implements EmailService { @Inject private MerchantConfigurationService merchantConfigurationService; @Inject private HtmlEmailSender sender; @Override public void sendHtmlEmail(MerchantStore store, Email email) throws ServiceException, Exception { EmailConfig emailConfig = getEmailC...
MerchantConfiguration configuration = merchantConfigurationService.getMerchantConfiguration(Constants.EMAIL_CONFIG, store); EmailConfig emailConfig = null; if(configuration!=null) { String value = configuration.getValue(); ObjectMapper mapper = new ObjectMapper(); try { emailConfig = mapper.r...
286
136
422
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/system/MerchantConfigurationServiceImpl.java
MerchantConfigurationServiceImpl
getMerchantConfig
class MerchantConfigurationServiceImpl extends SalesManagerEntityServiceImpl<Long, MerchantConfiguration> implements MerchantConfigurationService { private MerchantConfigurationRepository merchantConfigurationRepository; @Inject public MerchantConfigurationServiceImpl( MerchantConfigurationRepository merch...
MerchantConfiguration configuration = merchantConfigurationRepository.findByMerchantStoreAndKey(store.getId(), MerchantConfigurationType.CONFIG.name()); MerchantConfig config = null; if(configuration!=null) { String value = configuration.getValue(); ObjectMapper mapper = new ObjectMapper(); try ...
636
144
780
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.system.MerchantConfiguration,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.system.MerchantConfiguration) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesma...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/system/ModuleConfigurationServiceImpl.java
ModuleConfigurationServiceImpl
getIntegrationModules
class ModuleConfigurationServiceImpl extends SalesManagerEntityServiceImpl<Long, IntegrationModule> implements ModuleConfigurationService { private static final Logger LOGGER = LoggerFactory.getLogger(ModuleConfigurationServiceImpl.class); @Inject private IntegrationModulesLoader integrationModulesLoader; priv...
List<IntegrationModule> modules = null; try { /** * Modules are loaded using */ modules = (List<IntegrationModule>) cache.getFromCache("INTEGRATION_M" + module); // PAYMENT_MODULES // SHIPPING_MODULES if (modules == null) { modules = moduleConfigurationRepository.find...
426
915
1,341
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.system.IntegrationModule,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.system.IntegrationModule) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.co...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/tax/TaxClassServiceImpl.java
TaxClassServiceImpl
saveOrUpdate
class TaxClassServiceImpl extends SalesManagerEntityServiceImpl<Long, TaxClass> implements TaxClassService { private TaxClassRepository taxClassRepository; @Inject public TaxClassServiceImpl(TaxClassRepository taxClassRepository) { super(taxClassRepository); this.taxClassRepository = taxClassRepository; ...
if(taxClass.getId()!=null && taxClass.getId() > 0) { this.update(taxClass); } else { taxClass = super.saveAndFlush(taxClass); } return taxClass;
413
64
477
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.tax.taxclass.TaxClass,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.tax.taxclass.TaxClass) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.core.mod...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/tax/TaxRateServiceImpl.java
TaxRateServiceImpl
saveOrUpdate
class TaxRateServiceImpl extends SalesManagerEntityServiceImpl<Long, TaxRate> implements TaxRateService { private TaxRateRepository taxRateRepository; @Inject public TaxRateServiceImpl(TaxRateRepository taxRateRepository) { super(taxRateRepository); this.taxRateRepository = taxRateRepository; } @Override...
if(taxRate.getId()!=null && taxRate.getId() > 0) { this.update(taxRate); } else { taxRate = super.saveAndFlush(taxRate); } return taxRate;
515
64
579
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.tax.taxrate.TaxRate,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.tax.taxrate.TaxRate) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.core.model.t...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/user/GroupServiceImpl.java
GroupServiceImpl
listGroup
class GroupServiceImpl extends SalesManagerEntityServiceImpl<Integer, Group> implements GroupService { GroupRepository groupRepository; @Inject public GroupServiceImpl(GroupRepository groupRepository) { super(groupRepository); this.groupRepository = groupRepository; } @Override public List...
try { return groupRepository.findByType(groupType); } catch (Exception e) { throw new ServiceException(e); }
272
41
313
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.user.Group,java.lang.Integer>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.user.Group) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.core.model.user.Group) thro...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/user/PermissionServiceImpl.java
PermissionServiceImpl
getPermissions
class PermissionServiceImpl extends SalesManagerEntityServiceImpl<Integer, Permission> implements PermissionService { private PermissionRepository permissionRepository; @Inject public PermissionServiceImpl(PermissionRepository permissionRepository) { super(permissionRepository); this.permissionRepository ...
@SuppressWarnings({ "unchecked", "rawtypes" }) Set ids = new HashSet(groupIds); return permissionRepository.findByGroups(ids);
390
47
437
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.user.Permission,java.lang.Integer>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.user.Permission) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.core.model.user.P...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/services/user/UserServiceImpl.java
UserServiceImpl
findByResetPasswordToken
class UserServiceImpl extends SalesManagerEntityServiceImpl<Long, User> implements UserService { private UserRepository userRepository; @Autowired private MerchantStoreService merchantStoreService; @Autowired private PageableUserRepository pageableUserRepository; @Inject public UserServiceImpl(UserRepository...
Validate.notNull(userName, "User name cannot be null"); Validate.notNull(token, "Token cannot be null"); Validate.notNull(store, "MerchantStore cannot be null"); return null;
893
63
956
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.user.User,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.user.User) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.core.model.user.User) throws com...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/CacheUtils.java
CacheUtils
removeAllFromCache
class CacheUtils { @Inject @Qualifier("serviceCache") private Cache cache; public final static String REFERENCE_CACHE = "REF"; private static final Logger LOGGER = LoggerFactory.getLogger(CacheUtils.class); private final static String KEY_DELIMITER = "_"; public void putInCache(Object obj...
net.sf.ehcache.Cache cacheImpl = (net.sf.ehcache.Cache) cache.getNativeCache(); for (Object key: cacheImpl.getKeys()) { try { String sKey = (String)key; // a key should be <storeId>_<rest of the key> int delimiterPosition = sKey.indexOf(KEY_DELIMITER); if(delimiterPosition>0...
534
191
725
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/CatalogServiceHelper.java
CatalogServiceHelper
setToAvailability
class CatalogServiceHelper { /** * Filters descriptions and set the appropriate language * * @param p * @param language */ public static void setToLanguage(Product p, int language) { Set<ProductAttribute> attributes = p.getAttributes(); if (attributes != null) { for (ProductAttribute attribute : ...
Set<ProductAvailability> availabilities = product.getAvailabilities(); Set<ProductAvailability> productAvailabilities = new HashSet<ProductAvailability>(); Optional<ProductAvailability> defaultAvailability = availabilities.stream().filter(productAvailability -> productAvailability.getRegion().equals(Constants....
370
228
598
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/CoreConfiguration.java
CoreConfiguration
getProperty
class CoreConfiguration { public Properties properties = new Properties(); private static final Logger LOGGER = LoggerFactory.getLogger(CoreConfiguration.class); public Properties getProperties() { return properties; } public void setProperties(Properties properties) { this.properties = properties; } ...
String prop = defaultValue; try { prop = properties.getProperty(propertyKey); } catch(Exception e) { LOGGER.warn("Cannot find property " + propertyKey); } return prop;
145
68
213
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/CreditCardUtils.java
CreditCardUtils
maskCardNumber
class CreditCardUtils { public static final int MASTERCARD = 0, VISA = 1; public static final int AMEX = 2, DISCOVER = 3, DINERS = 4; public static String maskCardNumber(String clearcardnumber) throws Exception {<FILL_FUNCTION_BODY>} }
if (clearcardnumber.length() < 10) { throw new Exception("Invalid number of digits"); } int length = clearcardnumber.length(); String prefix = clearcardnumber.substring(0, 4); String suffix = clearcardnumber.substring(length - 4); return new StringBuilder() .append(prefix) .append("XXXXXXXXX...
85
123
208
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/DataUtils.java
DataUtils
getMeasure
class DataUtils { /** * Removes dashes * @param postalCode * @return */ public static String trimPostalCode(String postalCode) { return postalCode.replaceAll("[^a-zA-Z0-9]", ""); } /** * Get the measure according to the appropriate measure base. If the measure * configured in store is LB and it ...
if (base.equals(MeasureUnit.IN.name())) { if (store.getSeizeunitcode().equals(MeasureUnit.IN.name())) { return new BigDecimal(String.valueOf(measure)).setScale(2, RoundingMode.HALF_UP).doubleValue(); } else {// centimeter (inch to centimeter) double measureConstant = 2.54; double answer = mea...
560
307
867
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/ProductImageCropUtils.java
ProductImageCropUtils
getCroppedImage
class ProductImageCropUtils { private static final Logger LOGGER = LoggerFactory.getLogger(ProductImageCropUtils.class); private boolean cropeable = true; private int cropeBaseline = 0;// o is width, 1 is height private int getCropeBaseline() { return cropeBaseline; } private double cropAreaWidth = 0; ...
if(!this.cropeable) { return originalFile; } FileNameMap fileNameMap = URLConnection.getFileNameMap(); String contentType = fileNameMap.getContentTypeFor(originalFile.getName()); String extension = contentType.substring(contentType.indexOf("/"),contentType.length()); BufferedImage image = Imag...
1,429
180
1,609
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/ProductImageSizeUtils.java
ProductImageSizeUtils
resizeWithRatio
class ProductImageSizeUtils { private ProductImageSizeUtils() { } /** * Simple resize, does not maintain aspect ratio * @param image * @param width * @param height * @return */ public static BufferedImage resize(BufferedImage image, int width, int height) { int type = image.getType() == 0 ? Buff...
int type = image.getType() == 0? BufferedImage.TYPE_INT_ARGB : image.getType(); //*Special* if the width or height is 0 use image src dimensions if (destinationWidth == 0) { destinationWidth = image.getWidth(); } if (destinationHeight == 0) { ...
942
515
1,457
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/ProductUtils.java
ProductUtils
buildOrderProductDisplayName
class ProductUtils { public static String buildOrderProductDisplayName(OrderProduct orderProduct) {<FILL_FUNCTION_BODY>} }
String pName = orderProduct.getProductName(); Set<OrderProductAttribute> oAttributes = orderProduct.getOrderAttributes(); StringBuilder attributeName = null; for(OrderProductAttribute oProductAttribute : oAttributes) { if(attributeName == null) { attributeName = new StringBuilder(); attributeName...
38
236
274
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/RepositoryHelper.java
RepositoryHelper
paginateQuery
class RepositoryHelper { @SuppressWarnings("rawtypes") public static Query paginateQuery(Query q, Number count, GenericEntityList entityList, Criteria criteria) {<FILL_FUNCTION_BODY>} }
if (entityList == null) { entityList = new GenericEntityList(); } if (criteria.isLegacyPagination()) { if (criteria.getMaxCount() > 0) { q.setFirstResult(criteria.getStartIndex()); q.setMaxResults(Math.min(criteria.getMaxCount(), count.intValue())); } } else { //int firstResult = ((criter...
59
278
337
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/SecurityGroupsBuilder.java
SecurityGroupsBuilder
addPermission
class SecurityGroupsBuilder { private List<Group> groups = new ArrayList<Group>(); private Group lastGroup = null; public SecurityGroupsBuilder addGroup(String name, GroupType type) { Group g = new Group(); g.setGroupName(name); g.setGroupType(type); groups.add(g); this.lastGroup = g; return ...
if(this.lastGroup == null) { Group g = this.groups.get(0); if(g == null) { g = new Group(); g.setGroupName("UNDEFINED"); g.setGroupType(GroupType.ADMIN); groups.add(g); this.lastGroup = g; } } Permission permission = new Permission(); permission.setPermissionName(name); lastGr...
293
142
435
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/ajax/AjaxPageableResponse.java
AjaxPageableResponse
toJSONString
class AjaxPageableResponse extends AjaxResponse { private int startRow; public int getStartRow() { return startRow; } public void setStartRow(int startRow) { this.startRow = startRow; } private int endRow; private int totalRow; protected String getPageInfo() { StringBuilder returnString = n...
StringBuilder returnString = new StringBuilder(); returnString.append(getJsonInfo()).append(","); returnString.append(getPageInfo()); if(this.getData().size()>0) { StringBuilder dataEntries = null; int count = 0; for(Map keyValue : this.getData()) { if(dataEntries == null) { dataEntrie...
338
322
660
<methods>public non-sealed void <init>() ,public void addDataEntry(Map<java.lang.String,java.lang.String>) ,public void addEntry(java.lang.String, java.lang.String) ,public void addValidationMessage(java.lang.String, java.lang.String) ,public Map<java.lang.String,java.lang.String> getDataMap() ,public int getStatus() ,...
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/ajax/AjaxResponse.java
AjaxResponse
getJsonInfo
class AjaxResponse implements JSONAware { public final static int RESPONSE_STATUS_SUCCESS=0; public final static int RESPONSE_STATUS_FAIURE=-1; public final static int RESPONSE_STATUS_VALIDATION_FAILED=-2; public final static int RESPONSE_OPERATION_COMPLETED=9999; public final static int CODE_ALREADY_EXIST=9998;...
StringBuilder returnString = new StringBuilder(); returnString.append("{"); returnString.append("\"response\"").append(":"); returnString.append("{"); returnString.append("\"status\"").append(":").append(this.getStatus()); if(this.getStatusMessage()!=null && this.getStatus()!=0) { returnString.append...
1,377
150
1,527
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-core/src/main/java/com/salesmanager/core/business/utils/query/ProductQueryBuilder.java
ProductQueryBuilder
buildProductQuery
class ProductQueryBuilder { public static String buildProductQuery() {<FILL_FUNCTION_BODY>} }
StringBuilder qs = new StringBuilder(); //option 1 qs.append("select distinct p from Product as p "); qs.append("join fetch p.availabilities pa "); qs.append("join fetch p.descriptions pd "); qs.append("join fetch p.merchantStore pm "); qs.append("left join fetch pa.prices pap "); qs.append("left...
32
712
744
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop-model/src/main/java/com/salesmanager/shop/model/catalog/product/attribute/ReadableProductVariantValue.java
ReadableProductVariantValue
equals
class ReadableProductVariantValue implements Serializable { /** * */ private static final long serialVersionUID = 1L; private String name; private String code; private int order; private String description; private Long option;// option id private Long value;// option value id public Long getValue() { ...
if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReadableProductVariantValue other = (ReadableProductVariantValue) obj; if (code == null) { if (other.code != null) return false; } else if (!code.equals(other.code)) return false;...
419
206
625
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop-model/src/main/java/com/salesmanager/shop/model/shoppingcart/ShoppingCartItem.java
ShoppingCartItem
getQuantity
class ShoppingCartItem extends ShopEntity implements Serializable { public String getSku() { return sku; } public void setSku(String sku) { this.sku = sku; } /** * */ private static final long serialVersionUID = 1L; private String name; private String price; private String image; private BigDecimal...
if(quantity <= 0) { quantity = 1; } return quantity;
523
29
552
<methods>public non-sealed void <init>() ,public java.lang.String getLanguage() ,public void setLanguage(java.lang.String) <variables>private java.lang.String language,private static final long serialVersionUID
shopizer-ecommerce_shopizer
shopizer/sm-shop-model/src/main/java/com/salesmanager/shop/util/ReadableEntityUtil.java
ReadableEntityUtil
createReadableList
class ReadableEntityUtil { private ReadableEntityUtil() {} public static <T,R> ReadableEntityList<R> createReadableList(Page<T> entityList, List<R> items) {<FILL_FUNCTION_BODY>} }
ReadableEntityList<R> readableList = new ReadableEntityList<>(); readableList.setItems(items); readableList.setTotalPages(entityList.getTotalPages()); readableList.setRecordsTotal(entityList.getTotalElements()); readableList.setNumber(items.size()); return readableList; ...
67
89
156
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop-model/src/main/java/com/salesmanager/shop/validation/BeanUtils.java
BeanUtils
getPropertyValue
class BeanUtils { private BeanUtils(){ } public static BeanUtils newInstance(){ return new BeanUtils(); } @SuppressWarnings( "nls" ) public Object getPropertyValue( Object bean, String property ) throws IntrospectionException, IllegalArgumentException, IllegalAcce...
if (bean == null) { throw new IllegalArgumentException("No bean specified"); } if(property == null){ throw new IllegalArgumentException("No name specified for bean class '" + bean.getClass() + "'"); } Class<?> beanClass = bean.getCla...
270
200
470
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop-model/src/main/java/com/salesmanager/shop/validation/EnumValidator.java
EnumValidator
isValid
class EnumValidator implements ConstraintValidator<Enum, String> { private Enum annotation; public void initialize(Enum annotation) { this.annotation = annotation; } public boolean isValid(String valueForValidation, ConstraintValidatorContext constraintValidatorContext) {<FILL_FUNC...
boolean result = false; Object[] enumValues = this.annotation.enumClass().getEnumConstants(); if(enumValues != null) { for(Object enumValue:enumValues) { if(valueForValidation.equals(enumValue.toString()) ||...
89
131
220
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop-model/src/main/java/com/salesmanager/shop/validation/FieldMatchValidator.java
FieldMatchValidator
isValid
class FieldMatchValidator implements ConstraintValidator<FieldMatch, Object> { private static final Logger LOG=LoggerFactory.getLogger(FieldMatchValidator.class); private String firstFieldName; private String secondFieldName; private BeanUtils beanUtils; public void initialize(final FieldMatch...
try { final Object firstObj = this.beanUtils.getPropertyValue(value, this.firstFieldName); final Object secondObj = this.beanUtils.getPropertyValue(value, this.secondFieldName); return firstObj == null && secondObj == null || firstObj != null && firstObj.equals(secon...
174
126
300
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/admin/security/AbstractAuthenticatinSuccessHandler.java
AbstractAuthenticatinSuccessHandler
onAuthenticationSuccess
class AbstractAuthenticatinSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler { abstract protected void redirectAfterSuccess(HttpServletRequest request, HttpServletResponse response) throws Exception; private static final Logger LOGGER = LoggerFactory.getLogger(AbstractAuthenticatinSuccessHandle...
// last access timestamp String userName = authentication.getName(); /** * Spring Security 4 does not seem to add security context in the session * creating the authentication to be lost during the login */ SecurityContext securityContext = SecurityContextHolder.getContext(); Ht...
129
268
397
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/admin/security/UserServicesImpl.java
UserServicesImpl
loadUserByUsername
class UserServicesImpl implements WebUserServices{ private static final Logger LOGGER = LoggerFactory.getLogger(UserServicesImpl.class); private static final String DEFAULT_INITIAL_PASSWORD = "password"; @Inject private UserService userService; @Inject private MerchantStoreService merchantStoreService; ...
com.salesmanager.core.model.user.User user = null; Collection<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(); try { user = userService.getByUserName(userName); if(user==null) { return null; } GrantedAuthority role = new SimpleGrantedAuthority(ROLE_PREFIX + Constants.PERM...
488
387
875
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/application/config/DocumentationConfiguration.java
DocumentationConfiguration
api
class DocumentationConfiguration { public static final Contact DEFAULT_CONTACT = new Contact("Shopizer", "https://www.shopizer.com", ""); private static final String HOST = "localhost:8080"; /** * http://localhost:8080/swagger-ui.html#/ http://localhost:8080/v2/api-docs */ @Bean public Docket api() {<FILL...
final List<ResponseMessage> getMessages = new ArrayList<ResponseMessage>(); getMessages.add(new ResponseMessageBuilder().code(500).message("500 message") .responseModel(new ModelRef("Error")).build()); getMessages.add(new ResponseMessageBuilder().code(403).message("Forbidden").build()); getMessages.add(ne...
459
382
841
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/application/config/LocationImageConfig.java
LocationImageConfig
img
class LocationImageConfig { @Value("${config.cms.contentUrl}") private String contentUrl; @Value("${config.cms.method}") private String method; @Value("${config.cms.static.path}") private String staticPath; @Bean public ImageFilePath img() {<FILL_FUNCTION_BODY>} }
if(!StringUtils.isEmpty(method) && !method.equals("default")) { CloudFilePathUtils cloudFilePathUtils = new CloudFilePathUtils(); cloudFilePathUtils.setBasePath(contentUrl); cloudFilePathUtils.setContentUrlPath(contentUrl); return cloudFilePathUtils; } else { LocalImageFi...
129
171
300
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/application/config/MerchantStoreArgumentResolver.java
MerchantStoreArgumentResolver
resolveArgument
class MerchantStoreArgumentResolver implements HandlerMethodArgumentResolver { private static final Logger LOGGER = LoggerFactory.getLogger(MerchantStoreArgumentResolver.class); public static final String REQUEST_PARAMATER_STORE = "store"; @Autowired private StoreFacade storeFacade; @Autowired private...
String storeValue = Optional.ofNullable(webRequest.getParameter(REQUEST_PARAMATER_STORE)) .filter(StringUtils::isNotBlank).orElse(DEFAULT_STORE); // todo get from cache MerchantStore storeModel = storeFacade.get(storeValue); HttpServletRequest httpServletRequest = webRequest.getNativeRequest(HttpSer...
198
237
435
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/application/config/MultipleEntryPointsSecurityConfig.java
CustomerConfigurationAdapter
configure
class CustomerConfigurationAdapter extends WebSecurityConfigurerAdapter { @Bean("customerAuthenticationManager") @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @Autowired private UserDetailsService customerDetai...
http .antMatcher("/shop/**") .csrf().disable() .authorizeRequests() .antMatchers("/shop/").permitAll() .antMatchers("/shop/**").permitAll() .antMatchers("/shop/customer/logon*").permitAll() .antMatchers("/shop/customer/registration*").permitAll() .antMatchers("/shop/cus...
350
332
682
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/application/config/ShopApplicationConfiguration.java
ShopApplicationConfiguration
addInterceptors
class ShopApplicationConfiguration implements WebMvcConfigurer { protected final Log logger = LogFactory.getLog(getClass()); @EventListener(ApplicationReadyEvent.class) public void applicationReadyCode() { String workingDir = System.getProperty("user.dir"); logger.info("Current working directory : " + w...
// Changes the locale when a 'locale' request parameter is sent; e.g. /?locale=de registry.addInterceptor(localeChangeInterceptor()); /** registry .addInterceptor(storeFilter()) // store web front filter .addPathPatterns("/shop/**") // customer section filter .a...
730
154
884
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/application/config/ShopServletContextListener.java
ShopServletContextListener
contextInitialized
class ShopServletContextListener implements ServletContextListener { private static final Logger logger = LoggerFactory.getLogger(ShopServletContextListener.class); @Override public void contextInitialized(ServletContextEvent servletContextEvent) {<FILL_FUNCTION_BODY>} @Override public void contextDestroyed(Servl...
logger.info("===context init==="); System.getenv().forEach((k, v) -> { logger.debug(k + ":" + v); }); Properties props = System.getProperties(); props.forEach((k, v) -> { logger.debug(k + ":" + v); });
130
91
221
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/application/config/ShopizerPropertiesConfig.java
ShopizerPropertiesConfig
mapper
class ShopizerPropertiesConfig { @Bean(name = "shopizer-properties") public PropertiesFactoryBean mapper() {<FILL_FUNCTION_BODY>} }
PropertiesFactoryBean bean = new PropertiesFactoryBean(); bean.setLocation(new ClassPathResource("shopizer-properties.properties")); return bean;
49
43
92
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/controller/FilesController.java
FilesController
downloadProduct
class FilesController extends AbstractController { private static final Logger LOGGER = LoggerFactory.getLogger(FilesController.class); @Inject private ContentService contentService; /** * Serves static files (css, js ...) the repository is a single node by merchant * @param storeCode * @param exten...
FileContentType fileType = FileContentType.PRODUCT_DIGITAL; String fileNameAndExtension = new StringBuilder().append(fileName).append(".").append(extension).toString(); // needs to query the new API OutputContentFile file = contentService.getContentFile(storeCode, fileType, fileNameAndExtension); ...
509
204
713
<methods>public non-sealed void <init>() <variables>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/controller/ImagesController.java
ImagesController
printImage
class ImagesController { private static final Logger LOGGER = LoggerFactory.getLogger(ImagesController.class); @Inject private ContentService contentService; @Inject private ProductImageService productImageService; private byte[] tempImage = null; @PostConstruct public void init() { try { File...
// product image small // example small product image -> /static/products/DEFAULT/TB12345/SMALL/product1.jpg // example large product image -> /static/products/DEFAULT/TB12345/LARGE/product1.jpg /** * List of possible imageType * */ ProductImageSize size = ProductImageSize.SMALL; i...
1,687
289
1,976
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/filter/CorsFilter.java
CorsFilter
preHandle
class CorsFilter extends HandlerInterceptorAdapter { public CorsFilter() { } /** * Allows public web services to work from remote hosts */ public boolean preHandle( HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {<F...
HttpServletResponse httpResponse = (HttpServletResponse) response; String origin = "*"; if(!StringUtils.isBlank(request.getHeader("origin"))) { origin = request.getHeader("origin"); } httpResponse.setHeader("Access-Control-Allow-Methods", "POST, ...
94
176
270
<methods>public void <init>() <variables>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/filter/XssFilter.java
XssFilter
doFilter
class XssFilter implements Filter { /** * Description: Log */ private static final Logger LOGGER = LoggerFactory.getLogger(XssFilter.class); @Override public void init(FilterConfig filterConfig) throws ServletException { LOGGER.debug("(XssFilter) initialize"); } @Override public void doFilt...
HttpServletRequest request = (HttpServletRequest) srequest; filterChain.doFilter(new XssHttpServletRequestWrapper(request) {}, response);
164
45
209
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/filter/XssHttpServletRequestWrapper.java
XssHttpServletRequestWrapper
getParameter
class XssHttpServletRequestWrapper extends HttpServletRequestWrapper { public XssHttpServletRequestWrapper(HttpServletRequest request) { super(request); } @Override public String getHeader(String name) { String value = super.getHeader(name); if (value == null) return...
String value = super.getParameter(parameter); if (value == null) { return null; } return cleanXSS(value);
296
43
339
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/init/data/InitializationLoader.java
InitializationLoader
init
class InitializationLoader { private static final Logger LOGGER = LoggerFactory.getLogger(InitializationLoader.class); @Value("${db.init.data:true}") private boolean initDefaultData; @Inject private MerchantConfigurationService merchantConfigurationService; @Inject private InitializationDatabase initi...
try { //Check flag to populate or not the database if(!this.initDefaultData) { return; } if (initializationDatabase.isEmpty()) { //All default data to be created LOGGER.info(String.format("%s : Shopizer database is empty, populate it....", "sm-shop")); initializa...
219
248
467
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableCatalogCategoryEntryMapper.java
PersistableCatalogCategoryEntryMapper
convert
class PersistableCatalogCategoryEntryMapper implements Mapper<PersistableCatalogCategoryEntry, CatalogCategoryEntry> { @Autowired private CategoryFacade categoryFacade; @Autowired private CatalogFacade catalogFacade; @Override public CatalogCategoryEntry convert(PersistableCatalogCategoryEntry source, Me...
CatalogCategoryEntry destination = new CatalogCategoryEntry(); return this.merge(source, destination, store, language);
631
33
664
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableCatalogMapper.java
PersistableCatalogMapper
convert
class PersistableCatalogMapper implements Mapper<PersistableCatalog, Catalog> { @Override public Catalog convert(PersistableCatalog source, MerchantStore store, Language language) {<FILL_FUNCTION_BODY>} @Override public Catalog merge(PersistableCatalog source, Catalog destination, MerchantStore store, Language la...
Catalog c = new Catalog(); return this.merge(source, c, store, language);
178
29
207
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductAttributeMapper.java
PersistableProductAttributeMapper
merge
class PersistableProductAttributeMapper implements Mapper<PersistableProductAttribute, ProductAttribute> { @Inject private ProductOptionService productOptionService; @Inject private ProductOptionValueService productOptionValueService; @Inject private ProductService productService; @Inject private PersistablePr...
ProductOption productOption = null; if(!StringUtils.isBlank(source.getOption().getCode())) { productOption = productOptionService.getByCode(store, source.getOption().getCode()); } else { Validate.notNull(source.getOption().getId(),"Product option id is null"); productOption = productOptionService...
183
935
1,118
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductOptionMapper.java
PersistableProductOptionMapper
description
class PersistableProductOptionMapper implements Mapper<PersistableProductOptionEntity, ProductOption> { @Autowired private LanguageService languageService; ProductOptionDescription description(com.salesmanager.shop.model.catalog.product.attribute.ProductOptionDescription description) throws Exception {<FILL_F...
Validate.notNull(description.getLanguage(),"description.language should not be null"); ProductOptionDescription desc = new ProductOptionDescription(); desc.setId(null); desc.setDescription(description.getDescription()); desc.setName(description.getName()); if(description.getId() != null && desc...
558
137
695
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductOptionSetMapper.java
PersistableProductOptionSetMapper
merge
class PersistableProductOptionSetMapper implements Mapper<PersistableProductOptionSet, ProductOptionSet> { @Autowired private ProductOptionService productOptionService; @Autowired private ProductOptionValueService productOptionValueService; @Autowired private ProductTypeService productTypeService; @Overrid...
Validate.notNull(destination, "ProductOptionSet must not be null"); destination.setId(source.getId()); destination.setCode(source.getCode()); destination.setOptionDisplayOnly(source.isReadOnly()); ProductOption option = productOptionService.getById(store, source.getOption()); destination.setOption(op...
229
302
531
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductOptionValueMapper.java
PersistableProductOptionValueMapper
merge
class PersistableProductOptionValueMapper implements Mapper<PersistableProductOptionValue, ProductOptionValue> { @Autowired private LanguageService languageService; ProductOptionValueDescription description( com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValueDescription description) th...
if (destination == null) { destination = new ProductOptionValue(); } try { if(StringUtils.isBlank(source.getCode())) { if(!StringUtils.isBlank(destination.getCode())) { source.setCode(destination.getCode()); } } if (!CollectionUtils.isEmpty(source.getDescriptions())) { for (com...
372
515
887
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductTypeMapper.java
PersistableProductTypeMapper
type
class PersistableProductTypeMapper implements Mapper<PersistableProductType, ProductType> { @Autowired private LanguageService languageService; @Override public ProductType convert(PersistableProductType source, MerchantStore store, Language language) { ProductType type = new ProductType(); return this.merge...
if(destination == null) { destination = new ProductType(); } destination.setCode(type.getCode()); destination.setId(type.getId()); destination.setAllowAddToCart(type.isAllowAddToCart()); destination.setVisible(type.isVisible()); //destination.set List<com.salesmanager.core.model.catalog.product.typ...
577
294
871
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/PersistableProductVariationMapper.java
PersistableProductVariationMapper
merge
class PersistableProductVariationMapper implements Mapper<PersistableProductVariation, ProductVariation> { @Autowired private ProductOptionService productOptionService; @Autowired private ProductOptionValueService productOptionValueService; @Override public ProductVariation convert(PersistableProductVariatio...
Validate.notNull(destination, "ProductVariation cannot be null"); destination.setId(source.getId()); destination.setCode(source.getCode()); destination.setMerchantStore(store); ProductOption option = productOptionService.getById(store, source.getOption()); if(option == null) { throw new Conversion...
171
233
404
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableCatalogCategoryEntryMapper.java
ReadableCatalogCategoryEntryMapper
convert
class ReadableCatalogCategoryEntryMapper implements Mapper<CatalogCategoryEntry, ReadableCatalogCategoryEntry> { @Autowired private ReadableCategoryMapper readableCategoryMapper; @Autowired @Qualifier("img") private ImageFilePath imageUtils; @Override public ReadableCatalogCategoryEntry convert(CatalogCat...
ReadableCatalogCategoryEntry destination = new ReadableCatalogCategoryEntry(); return merge(source, destination, store, language);
432
35
467
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableCatalogMapper.java
ReadableCatalogMapper
convert
class ReadableCatalogMapper implements Mapper<Catalog, ReadableCatalog> { @Autowired private StoreFacade storeFacade; @Autowired private ReadableCategoryMapper readableCategoryMapper; @Override public ReadableCatalog convert(Catalog source, MerchantStore store, Language language) {<FILL_FUNCTION_BODY>} @O...
ReadableCatalog destination = new ReadableCatalog(); return merge(source, destination, store, language);
976
31
1,007
<no_super_class>
shopizer-ecommerce_shopizer
shopizer/sm-shop/src/main/java/com/salesmanager/shop/mapper/catalog/ReadableCategoryMapper.java
ReadableCategoryMapper
convertDescription
class ReadableCategoryMapper implements Mapper<Category, ReadableCategory> { private static final Logger LOGGER = LoggerFactory.getLogger(ReadableCategoryMapper.class); @Override public ReadableCategory convert(Category source, MerchantStore store, Language language) { if (Objects.isNull(language)) { ...
final com.salesmanager.shop.model.catalog.category.CategoryDescription desc = new com.salesmanager.shop.model.catalog.category.CategoryDescription(); desc.setFriendlyUrl(description.getSeUrl()); desc.setName(description.getName()); desc.setId(description.getId()); desc.setDescription(description.getDe...
1,138
201
1,339
<no_super_class>