Class YamlInitialValueServiceImpl
java.lang.Object
ch.tocco.nice2.dbrefactoring.impl.data.YamlInitialValueServiceImpl
- All Implemented Interfaces:
- YamlInitialValueService
@Component
public class YamlInitialValueServiceImpl
extends Object
implements YamlInitialValueService
- 
Constructor SummaryConstructorsConstructorDescriptionYamlInitialValueServiceImpl(ContextManager contextManager, DataModel dataModel, DataSource dataSource, TextResources textResources, ModuleManager moduleManager, L10N l10N, org.slf4j.Logger log) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidhandleInitialValue(YamlInitialValues.YamlInitialValue initialValue, Optional<Long> key, boolean resetVersion) simplified "handleInitialValue" that may be used outside dbrefactoring module - empty InstallParameters are used - shouldNewContentBeInactive is false - exceptions are wrapped in a RuntimeExceptionvoidhandleInitialValue(YamlInitialValues.YamlInitialValue value, Optional<Long> key, InstallParameters parameters, boolean shouldNewContentBeInactive, boolean resetVersion) write an initialvalue to the database.loadData(@Nullable Set<String> modules, Predicate<ModelResource> fileNamePredicate) load all .yaml files from the db/initialvalues folders of the passed modules and parse them intoYamlInitialValues.YamlInitialValuefor use as initial values after db refactoring was runvoidsetDocumentHandlers(List<YamlDocumentHandler> documentHandlers) 
- 
Constructor Details- 
YamlInitialValueServiceImplpublic YamlInitialValueServiceImpl(ContextManager contextManager, DataModel dataModel, DataSource dataSource, TextResources textResources, ModuleManager moduleManager, L10N l10N, org.slf4j.Logger log) 
 
- 
- 
Method Details- 
setDocumentHandlers
- 
loadDatapublic Stream<YamlInitialValues.YamlInitialValue> loadData(@Nullable @Nullable Set<String> modules, Predicate<ModelResource> fileNamePredicate) Description copied from interface:YamlInitialValueServiceload all .yaml files from the db/initialvalues folders of the passed modules and parse them intoYamlInitialValues.YamlInitialValuefor use as initial values after db refactoring was run- Specified by:
- loadDatain interface- YamlInitialValueService
- Parameters:
- modules- the modules to load the initial values for
- Returns:
- a stream of all initial values
 
- 
handleInitialValuepublic void handleInitialValue(YamlInitialValues.YamlInitialValue initialValue, Optional<Long> key, boolean resetVersion) Description copied from interface:YamlInitialValueServicesimplified "handleInitialValue" that may be used outside dbrefactoring module - empty InstallParameters are used - shouldNewContentBeInactive is false - exceptions are wrapped in a RuntimeException- Specified by:
- handleInitialValuein interface- YamlInitialValueService
 
- 
handleInitialValuepublic void handleInitialValue(YamlInitialValues.YamlInitialValue value, Optional<Long> key, InstallParameters parameters, boolean shouldNewContentBeInactive, boolean resetVersion) throws SQLException, ExecutionException Description copied from interface:YamlInitialValueServicewrite an initialvalue to the database. creates or updates the corresponding entity- Specified by:
- handleInitialValuein interface- YamlInitialValueService
- Parameters:
- value- the initialvalue (probably loaded by loadData)
- key- (optional) the key of the entity to be updated. If none is given, it is loaded or created as needed.
- parameters- fragment install parameters
- shouldNewContentBeInactive- parameter to determine whether new values should be inserted as inactive
- resetVersion- if reset version is selected, the version is reset to 1 when updating an initialvalue
- Throws:
- SQLException
- ExecutionException
 
 
-