use of com.salesmanager.core.model.merchant.MerchantStore in project shopizer by shopizer-ecommerce.
the class ShoppingCartFacadeImpl method getShoppingCartData.
// @Override
public ShoppingCartData getShoppingCartData(ShoppingCart shoppingCartModel, Language language) throws Exception {
Validate.notNull(shoppingCartModel, "Shopping Cart cannot be null");
ShoppingCartDataPopulator shoppingCartDataPopulator = new ShoppingCartDataPopulator();
shoppingCartDataPopulator.setShoppingCartCalculationService(shoppingCartCalculationService);
shoppingCartDataPopulator.setPricingService(pricingService);
shoppingCartDataPopulator.setimageUtils(imageUtils);
// Language language = (Language) getKeyValue( Constants.LANGUAGE );
MerchantStore merchantStore = (MerchantStore) getKeyValue(Constants.MERCHANT_STORE);
return shoppingCartDataPopulator.populate(shoppingCartModel, merchantStore, language);
}
use of com.salesmanager.core.model.merchant.MerchantStore in project shopizer by shopizer-ecommerce.
the class StoreFacadeImpl method findAll.
@Override
public ReadableMerchantStoreList findAll(MerchantStoreCriteria criteria, Language language, int page, int count) {
try {
Page<MerchantStore> stores = null;
List<ReadableMerchantStore> readableStores = new ArrayList<ReadableMerchantStore>();
ReadableMerchantStoreList readableList = new ReadableMerchantStoreList();
Optional<String> code = Optional.ofNullable(criteria.getStoreCode());
Optional<String> name = Optional.ofNullable(criteria.getName());
if (code.isPresent()) {
stores = merchantStoreService.listByGroup(name, code.get(), page, count);
} else {
if (criteria.isRetailers()) {
stores = merchantStoreService.listAllRetailers(name, page, count);
} else {
stores = merchantStoreService.listAll(name, page, count);
}
}
if (!CollectionUtils.isEmpty(stores.getContent())) {
for (MerchantStore store : stores) readableStores.add(convertMerchantStoreToReadableMerchantStore(language, store));
}
readableList.setData(readableStores);
readableList.setRecordsTotal(stores.getTotalElements());
readableList.setTotalPages(stores.getTotalPages());
readableList.setNumber(stores.getSize());
readableList.setRecordsFiltered(stores.getSize());
return readableList;
} catch (ServiceException e) {
throw new ServiceRuntimeException("Error while finding all merchant", e);
}
}
use of com.salesmanager.core.model.merchant.MerchantStore in project shopizer by shopizer-ecommerce.
the class StoreFacadeImpl method update.
@Override
public void update(PersistableMerchantStore store) {
Validate.notNull(store);
MerchantStore mStore = mergePersistableMerchantStoreToMerchantStore(store, store.getCode(), languageService.defaultLanguage());
updateMerchantStore(mStore);
}
use of com.salesmanager.core.model.merchant.MerchantStore in project shopizer by shopizer-ecommerce.
the class StoreFacadeImpl method convertPersistableMerchantStoreToMerchantStore.
private MerchantStore convertPersistableMerchantStoreToMerchantStore(PersistableMerchantStore store, Language language) {
MerchantStore mStore = new MerchantStore();
// set default values
mStore.setWeightunitcode(MeasureUnit.KG.name());
mStore.setSeizeunitcode(MeasureUnit.IN.name());
try {
mStore = persistableMerchantStorePopulator.populate(store, mStore, language);
} catch (ConversionException e) {
throw new ConversionRuntimeException(e);
}
return mStore;
}
use of com.salesmanager.core.model.merchant.MerchantStore in project shopizer by shopizer-ecommerce.
the class StoreFacadeImpl method addStoreLogo.
@Override
public void addStoreLogo(String code, InputContentFile cmsContentImage) {
MerchantStore store = getByCode(code);
store.setStoreLogo(cmsContentImage.getFileName());
saveMerchantStore(store);
addLogoToStore(code, cmsContentImage);
}
Aggregations