public class ConfigurationServiceImpl extends java.lang.Object implements ConfigurationService
Modifier and Type | Field and Description |
---|---|
private SageoneConfig |
config |
private LedgerAccountService |
ledgerAccountService |
private ShopConfigRepository |
shopConfigurationRepository |
Constructor and Description |
---|
ConfigurationServiceImpl(javax.inject.Provider<ShopConfigRepository> configProvider,
SageoneConfig config,
LedgerAccountService ledgerAccountService) |
Modifier and Type | Method and Description |
---|---|
private ConfigurationError |
createLedgerAccountInvoiceError(java.lang.String nominalCode,
java.lang.String message) |
private ConfigurationError |
createLedgerAccountInvoiceErrorNotFound(int nominalCode) |
private ConfigurationError |
createLedgerAccountInvoiceErrorNotNumber(java.lang.String nominalCode) |
private java.lang.Boolean |
existsShopConfig(java.lang.String shopId) |
private LedgerAccount |
getLedgerAccountInvoice(java.util.List<LedgerAccount> ledgerAccounts,
com.google.common.base.Optional<java.lang.Integer> nominalCode) |
private ShopConfigEntity |
getShopConfigEntity(java.lang.String shopId) |
ShopConfig |
getShopConfiguration(java.lang.String shopId)
get the configuration for this shop.
|
void |
initializeShopConfiguration(java.lang.String shopId)
Create a new configuration for this shop.
|
private void |
initNewShopConfigEntity(ShopConfigEntity shopConfigEntity,
java.lang.String shopId) |
private void |
saveShopConfigEntity(ShopConfigEntity shopConfigEntity) |
void |
updateShopConfiguration(ShopConfig shopConfig)
update a configuration for this shop.
|
private ShopConfigRepository shopConfigurationRepository
private SageoneConfig config
private LedgerAccountService ledgerAccountService
@Inject public ConfigurationServiceImpl(javax.inject.Provider<ShopConfigRepository> configProvider, SageoneConfig config, LedgerAccountService ledgerAccountService)
public void initializeShopConfiguration(java.lang.String shopId) throws javax.persistence.PersistenceException, ConfigurationException
ConfigurationService
initializeShopConfiguration
in interface ConfigurationService
shopId
- unique shop idjavax.persistence.PersistenceException
- if something went wrong when persisting.
Also if there is no entry in the SAGEONE_SHOPS table (foreign key)ConfigurationException
- if a field in the shopConfig could not be initializedpublic ShopConfig getShopConfiguration(java.lang.String shopId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
ConfigurationService
getShopConfiguration
in interface ConfigurationService
shopId
- unique shop idjavax.persistence.EntityNotFoundException
- if there was no config for this shop in
the databasejavax.persistence.PersistenceException
- if something went wrong when persisting.public void updateShopConfiguration(ShopConfig shopConfig) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException, ConfigurationException
ConfigurationService
updateShopConfiguration
in interface ConfigurationService
javax.persistence.EntityNotFoundException
- if there was no config for this shop in
the databasejavax.persistence.PersistenceException
- if something went wrong when persisting.ConfigurationException
- if a field in the shopConfig could not be validatedprivate ConfigurationError createLedgerAccountInvoiceErrorNotFound(int nominalCode)
private ConfigurationError createLedgerAccountInvoiceErrorNotNumber(java.lang.String nominalCode)
private ConfigurationError createLedgerAccountInvoiceError(java.lang.String nominalCode, java.lang.String message)
private void initNewShopConfigEntity(ShopConfigEntity shopConfigEntity, java.lang.String shopId) throws LedgerAccountNotFoundException
LedgerAccountNotFoundException
private LedgerAccount getLedgerAccountInvoice(java.util.List<LedgerAccount> ledgerAccounts, com.google.common.base.Optional<java.lang.Integer> nominalCode) throws LedgerAccountNotFoundException
LedgerAccountNotFoundException
private ShopConfigEntity getShopConfigEntity(java.lang.String shopId) throws javax.persistence.PersistenceException, javax.persistence.EntityNotFoundException
javax.persistence.PersistenceException
javax.persistence.EntityNotFoundException
private java.lang.Boolean existsShopConfig(java.lang.String shopId) throws javax.persistence.PersistenceException, javax.persistence.EntityNotFoundException
javax.persistence.PersistenceException
javax.persistence.EntityNotFoundException
private void saveShopConfigEntity(ShopConfigEntity shopConfigEntity) throws javax.persistence.PersistenceException
javax.persistence.PersistenceException