@Test public void createDefaultConfig() { configurationRepository.deleteAll(); boolean ok = configurationService.isDefaultConfigurationCreated(); assertTrue("Create default config failed", ok); String msg = "Default configuration was not created"; BConfiguration c = configurationRepository.findFirstByKey(keyMultiEntityApp); assertNotNull(msg, c); c = configurationRepository.findFirstByKey(keyUserRegistrationAllowed); assertNotNull(msg, c); }
public boolean isDefaultConfigurationCreated() { BConfiguration isMultiEntity = new BConfiguration( ConfigKey.IS_MULTI_ENTITY_APP_IN_SERVER.toString(), String.valueOf(dc.getIsMultiEntity()) ); BConfiguration isUserRegistrationAllowed = new BConfiguration( String.valueOf(ConfigKey.IS_USER_REGISTRATION_ALLOWED_IN_SERVER), String.valueOf(dc.getIsUserRegistrationAllowed()) ); configurationRepository.save(isMultiEntity); configurationRepository.save(isUserRegistrationAllowed); multiEntity = Boolean.parseBoolean(isMultiEntity.getValue()); userRegistrationAllowed = Boolean.parseBoolean(isUserRegistrationAllowed.getValue()); return true; }
ConfigurationService { public boolean isDefaultConfigurationCreated() { BConfiguration isMultiEntity = new BConfiguration( ConfigKey.IS_MULTI_ENTITY_APP_IN_SERVER.toString(), String.valueOf(dc.getIsMultiEntity()) ); BConfiguration isUserRegistrationAllowed = new BConfiguration( String.valueOf(ConfigKey.IS_USER_REGISTRATION_ALLOWED_IN_SERVER), String.valueOf(dc.getIsUserRegistrationAllowed()) ); configurationRepository.save(isMultiEntity); configurationRepository.save(isUserRegistrationAllowed); multiEntity = Boolean.parseBoolean(isMultiEntity.getValue()); userRegistrationAllowed = Boolean.parseBoolean(isUserRegistrationAllowed.getValue()); return true; } }
ConfigurationService { public boolean isDefaultConfigurationCreated() { BConfiguration isMultiEntity = new BConfiguration( ConfigKey.IS_MULTI_ENTITY_APP_IN_SERVER.toString(), String.valueOf(dc.getIsMultiEntity()) ); BConfiguration isUserRegistrationAllowed = new BConfiguration( String.valueOf(ConfigKey.IS_USER_REGISTRATION_ALLOWED_IN_SERVER), String.valueOf(dc.getIsUserRegistrationAllowed()) ); configurationRepository.save(isMultiEntity); configurationRepository.save(isUserRegistrationAllowed); multiEntity = Boolean.parseBoolean(isMultiEntity.getValue()); userRegistrationAllowed = Boolean.parseBoolean(isUserRegistrationAllowed.getValue()); return true; } @Autowired  ConfigurationService(final BConfigurationRepository configurationRepository,
                                final EUserRepository userRepository, final EOwnedEntityRepository entityRepository,
                                final BRoleRepository roleRepository, final BAuthorizationRepository authRepository,
                                final DefaultConst defaultConst); }
ConfigurationService { public boolean isDefaultConfigurationCreated() { BConfiguration isMultiEntity = new BConfiguration( ConfigKey.IS_MULTI_ENTITY_APP_IN_SERVER.toString(), String.valueOf(dc.getIsMultiEntity()) ); BConfiguration isUserRegistrationAllowed = new BConfiguration( String.valueOf(ConfigKey.IS_USER_REGISTRATION_ALLOWED_IN_SERVER), String.valueOf(dc.getIsUserRegistrationAllowed()) ); configurationRepository.save(isMultiEntity); configurationRepository.save(isUserRegistrationAllowed); multiEntity = Boolean.parseBoolean(isMultiEntity.getValue()); userRegistrationAllowed = Boolean.parseBoolean(isUserRegistrationAllowed.getValue()); return true; } @Autowired  ConfigurationService(final BConfigurationRepository configurationRepository,
                                final EUserRepository userRepository, final EOwnedEntityRepository entityRepository,
                                final BRoleRepository roleRepository, final BAuthorizationRepository authRepository,
                                final DefaultConst defaultConst); boolean isApplicationConfigured(); boolean isDefaultConfigurationCreated(); boolean isDefaultUserAssignedToEntityWithRole(); Map<String, String> getConfig(); Object getConfig(final String key); String getConfig(final String key, final long userId); Map<String, Object> getConfigByUser(final long userId); void saveConfig(final Map<String, Object> configs); void saveConfig(final Map<String, Object> configs, final long userId); void setUserRegistrationAllowed(final boolean userRegistrationAllowed); void setIsMultiEntity(final boolean isMultiEntity); Long getLastAccessedEntityIdByUser(final long userId); void setLastAccessedEntityIdByUser(final long userId, final long entityId); }
ConfigurationService { public boolean isDefaultConfigurationCreated() { BConfiguration isMultiEntity = new BConfiguration( ConfigKey.IS_MULTI_ENTITY_APP_IN_SERVER.toString(), String.valueOf(dc.getIsMultiEntity()) ); BConfiguration isUserRegistrationAllowed = new BConfiguration( String.valueOf(ConfigKey.IS_USER_REGISTRATION_ALLOWED_IN_SERVER), String.valueOf(dc.getIsUserRegistrationAllowed()) ); configurationRepository.save(isMultiEntity); configurationRepository.save(isUserRegistrationAllowed); multiEntity = Boolean.parseBoolean(isMultiEntity.getValue()); userRegistrationAllowed = Boolean.parseBoolean(isUserRegistrationAllowed.getValue()); return true; } @Autowired  ConfigurationService(final BConfigurationRepository configurationRepository,
                                final EUserRepository userRepository, final EOwnedEntityRepository entityRepository,
                                final BRoleRepository roleRepository, final BAuthorizationRepository authRepository,
                                final DefaultConst defaultConst); boolean isApplicationConfigured(); boolean isDefaultConfigurationCreated(); boolean isDefaultUserAssignedToEntityWithRole(); Map<String, String> getConfig(); Object getConfig(final String key); String getConfig(final String key, final long userId); Map<String, Object> getConfigByUser(final long userId); void saveConfig(final Map<String, Object> configs); void saveConfig(final Map<String, Object> configs, final long userId); void setUserRegistrationAllowed(final boolean userRegistrationAllowed); void setIsMultiEntity(final boolean isMultiEntity); Long getLastAccessedEntityIdByUser(final long userId); void setLastAccessedEntityIdByUser(final long userId, final long entityId); static final String IN_SERVER; static final String CONFIG_NOT_FOUND; }