use of com.salesmanager.shop.model.store.MerchantConfigEntity in project shopizer by shopizer-ecommerce.
the class StoreFacadeImpl method getBrand.
@Override
public ReadableBrand getBrand(String code) {
MerchantStore mStore = getMerchantStoreByCode(code);
ReadableBrand readableBrand = new ReadableBrand();
if (!StringUtils.isEmpty(mStore.getStoreLogo())) {
String imagePath = imageUtils.buildStoreLogoFilePath(mStore);
ReadableImage image = createReadableImage(mStore.getStoreLogo(), imagePath);
readableBrand.setLogo(image);
}
List<MerchantConfigEntity> merchantConfigTOs = getMerchantConfigEntities(mStore);
readableBrand.getSocialNetworks().addAll(merchantConfigTOs);
return readableBrand;
}
use of com.salesmanager.shop.model.store.MerchantConfigEntity in project shopizer by shopizer-ecommerce.
the class StoreFacadeImpl method convertToMerchantConfigEntity.
private MerchantConfigEntity convertToMerchantConfigEntity(MerchantConfiguration config) {
MerchantConfigEntity configTO = new MerchantConfigEntity();
configTO.setId(config.getId());
configTO.setKey(config.getKey());
configTO.setType(config.getMerchantConfigurationType());
configTO.setValue(config.getValue());
configTO.setActive(config.getActive() != null ? config.getActive().booleanValue() : false);
return configTO;
}
use of com.salesmanager.shop.model.store.MerchantConfigEntity in project shopizer by shopizer-ecommerce.
the class StoreFacadeImpl method createBrand.
@Override
public void createBrand(String merchantStoreCode, PersistableBrand brand) {
MerchantStore mStore = getMerchantStoreByCode(merchantStoreCode);
List<MerchantConfigEntity> createdConfigs = brand.getSocialNetworks();
List<MerchantConfiguration> configurations = createdConfigs.stream().map(config -> convertToMerchantConfiguration(config, MerchantConfigurationType.SOCIAL)).collect(Collectors.toList());
try {
for (MerchantConfiguration mConfigs : configurations) {
mConfigs.setMerchantStore(mStore);
if (!StringUtils.isEmpty(mConfigs.getValue())) {
mConfigs.setMerchantConfigurationType(MerchantConfigurationType.SOCIAL);
merchantConfigurationService.saveOrUpdate(mConfigs);
} else {
// remove if submited blank and exists
MerchantConfiguration config = merchantConfigurationService.getMerchantConfiguration(mConfigs.getKey(), mStore);
if (config != null) {
merchantConfigurationService.delete(config);
}
}
}
} catch (ServiceException se) {
throw new ServiceRuntimeException(se);
}
}
Aggregations