Class ImportSourceConfigurationFacadeImpl
java.lang.Object
com.riadalabs.jira.plugins.insight.channel.external.api.facade.impl.ImportSourceConfigurationFacadeImpl
- All Implemented Interfaces:
ImportSourceConfigurationFacade
public class ImportSourceConfigurationFacadeImpl
extends Object
implements ImportSourceConfigurationFacade
-
Constructor Summary
ConstructorsConstructorDescriptionImportSourceConfigurationFacadeImpl
(com.riadalabs.jira.plugins.insight.services.core.ImportSourceConfigurationService importSourceConfigurationService, com.riadalabs.jira.plugins.insight.services.imports.common.DefaultImportService defaultImportService, com.riadalabs.jira.plugins.insight.services.util.ErrorMessageTranslator errorMessageTranslator) -
Method Summary
Modifier and TypeMethodDescriptioncreatePredefinedConfiguration
(Integer importSourceId, ObjectTypeBean optionalParent) Create the template configuration as specified by the component.void
createPredefinedStructure
(Integer importSourceId, ObjectTypeBean optionalParent) Creates a predefined structure based on the import component used.void
deleteImportSource
(Integer importSourceId) Deletes an Import Sourcevoid
deleteImportSourceOT
(Integer importSourceOT) Deletes an Import Source OTvoid
deleteImportSourceOTAttr
(Integer importSourceOTAttr) Deletes an Import Source OTAfindImportSourcesByModule
(String moduleKey) Finds import sources for a specific import module type (each integration module specifies it's own type with a module key e.g.findImportSourcesByModuleAndSchemaId
(String moduleKey, Integer objectSchemaId) Finds import sources for a specific import module type (each integration module specifies it's own type with a module key e.g.findImportSourcesBySchema
(Integer objectSchemaId) Finds all import source configurations by the given object schema id.findImportSourcesForObjectTypeId
(Integer objectTypeId) Finds all the import sources where the specified object type id is used in any object type mapping configuration.loadImportSource
(Integer importSourceId) Loads the ImportSource from the database and validates it if it is ready to be synchronised.loadImportSourceOT
(Integer importSourceOTId) Load a specific import source OT configuration item.loadImportSourceOTAttr
(Integer importSourceOTAttrId) Load a specific import source OT Attr configuration item.loadImportSourceWithMaskedPasswords
(Integer importSourceId) Loads the ImportSource from the database and validate if it is ready to be synchronised.passwordFieldNamesInModuleConfig
(Integer importSourceId) Retrieves a list of all the keys (the json names) in theImportSource.getJsonConfiguration()
that represents a password field for the given import source.startImportSource
(int importSourceId) Start an import given the id of the configuration.startImportSourceForSpecificOTs
(int importSourceId, List<Integer> importSourceOTIds) Start an import given the id of the configuration but only import a specific number of object types.storeImportSource
(ImportSource importSource) Store the entire import source together with all attached ImportSourceOTs and ImportSourceOTAs.storeImportSourceOT
(ImportSourceOT importSourceOT) Store a single import source OT configuration item together with all ImportSourceOTAs.storeImportSourceOTAttr
(ImportSourceOTAttr importSourceOTAttr) Store a single import source OTAttr configuration item together with all ImportSourceOTAs.
-
Constructor Details
-
ImportSourceConfigurationFacadeImpl
public ImportSourceConfigurationFacadeImpl(com.riadalabs.jira.plugins.insight.services.core.ImportSourceConfigurationService importSourceConfigurationService, com.riadalabs.jira.plugins.insight.services.imports.common.DefaultImportService defaultImportService, com.riadalabs.jira.plugins.insight.services.util.ErrorMessageTranslator errorMessageTranslator)
-
-
Method Details
-
findImportSourcesBySchema
Description copied from interface:ImportSourceConfigurationFacade
Finds all import source configurations by the given object schema id.- Specified by:
findImportSourcesBySchema
in interfaceImportSourceConfigurationFacade
- Returns:
- The import sources in the list will have all passwords masked see
ImportSourceConfigurationFacade.loadImportSource(Integer)
- Throws:
InsightException
-
findImportSourcesForObjectTypeId
public List<ImportSource> findImportSourcesForObjectTypeId(Integer objectTypeId) throws InsightException Description copied from interface:ImportSourceConfigurationFacade
Finds all the import sources where the specified object type id is used in any object type mapping configuration.- Specified by:
findImportSourcesForObjectTypeId
in interfaceImportSourceConfigurationFacade
- Returns:
- A list of import source configurations where each import source contains a
ImportSourceOT
configuration with theObjectTypeBean
specified by the argument. The import sources in the list will have all passwords masked seeImportSourceConfigurationFacade.loadImportSource(Integer)
- Throws:
InsightException
-
findImportSourcesByModule
Description copied from interface:ImportSourceConfigurationFacade
Finds import sources for a specific import module type (each integration module specifies it's own type with a module key e.g. AWS integration specifies insight-aws-import as the module key)- Specified by:
findImportSourcesByModule
in interfaceImportSourceConfigurationFacade
- Returns:
- The import sources in the list will have all passwords masked see
ImportSourceConfigurationFacade.loadImportSource(Integer)
- Throws:
InsightException
-
findImportSourcesByModuleAndSchemaId
public List<ImportSource> findImportSourcesByModuleAndSchemaId(String moduleKey, Integer objectSchemaId) throws InsightException Description copied from interface:ImportSourceConfigurationFacade
Finds import sources for a specific import module type (each integration module specifies it's own type with a module key e.g. AWS integration specifies insight-aws-import as the module key) and a given object schema id- Specified by:
findImportSourcesByModuleAndSchemaId
in interfaceImportSourceConfigurationFacade
- Returns:
- The import sources in the list will have all passwords masked see
ImportSourceConfigurationFacade.loadImportSource(Integer)
- Throws:
InsightException
-
loadImportSource
Description copied from interface:ImportSourceConfigurationFacade
Loads the ImportSource from the database and validates it if it is ready to be synchronised. If the ImportSource is invalid this method will throw aValidationInsightException
rather than returning an Invalid import source. Note that the validation state of the import source will be persisted to the database. I.e. a call to this function will update the stored import source with the current validation status- Specified by:
loadImportSource
in interfaceImportSourceConfigurationFacade
- Returns:
- an import source that can be used to run an import with all validations passed. The resulting import
source will have all password fields in the
ImportSource.getJsonConfiguration()
removed. In other words all password fields (both name and value in the json config) will be missing. To get the password fields (names and masked values) use theImportSourceConfigurationFacade.loadImportSourceWithMaskedPasswords(Integer)
instead. - Throws:
InsightException
- / ValidationInsightException if the ImportSource is not valid.
-
passwordFieldNamesInModuleConfig
public List<String> passwordFieldNamesInModuleConfig(Integer importSourceId) throws InsightException Description copied from interface:ImportSourceConfigurationFacade
Retrieves a list of all the keys (the json names) in theImportSource.getJsonConfiguration()
that represents a password field for the given import source. The password fields are masked in the fetched import source as described inImportSourceConfigurationFacade.loadImportSourceWithMaskedPasswords(Integer)
- Specified by:
passwordFieldNamesInModuleConfig
in interfaceImportSourceConfigurationFacade
- Throws:
InsightException
-
loadImportSourceWithMaskedPasswords
public ImportSource loadImportSourceWithMaskedPasswords(Integer importSourceId) throws InsightException Description copied from interface:ImportSourceConfigurationFacade
Loads the ImportSource from the database and validate if it is ready to be synchronised. If the ImportSource is invalid this method will throw aValidationInsightException
rather than returning an Invalid import source. Note that the validation state of the import source will be persisted to the database. I.e. a call to this function will update the stored import source with the current validation status- Specified by:
loadImportSourceWithMaskedPasswords
in interfaceImportSourceConfigurationFacade
- Returns:
- an import source that can be used to run an import with all validations passed. The resulting import
source will have all password fields in the
ImportSource.getJsonConfiguration()
masked. In other words doing a call like storeImportSource(loadImportSourceWithMaskedPasswords(1)) will overwrite the stored passwords in the database with masked values leading to an invalid configuration - Throws:
InsightException
-
loadImportSourceOT
Description copied from interface:ImportSourceConfigurationFacade
Load a specific import source OT configuration item.- Specified by:
loadImportSourceOT
in interfaceImportSourceConfigurationFacade
- Throws:
InsightException
-
loadImportSourceOTAttr
public ImportSourceOTAttr loadImportSourceOTAttr(Integer importSourceOTAttrId) throws InsightException Description copied from interface:ImportSourceConfigurationFacade
Load a specific import source OT Attr configuration item.- Specified by:
loadImportSourceOTAttr
in interfaceImportSourceConfigurationFacade
- Throws:
InsightException
-
storeImportSource
Description copied from interface:ImportSourceConfigurationFacade
Store the entire import source together with all attached ImportSourceOTs and ImportSourceOTAs. If id is left as null new ones will be created- Specified by:
storeImportSource
in interfaceImportSourceConfigurationFacade
- Parameters:
importSource
- the import source that will be persisted. If theImportSource.getId()
!= null an existing import source will be updated. When an import source is sent to be updated and theImportSource.getJsonConfiguration()
do not have any of the configured password fields present (i.e the json name of the password field is not present at all) the already saved password from the database will be used. In other words in all cases when the passwords are not to be updated the passwords should not be present at all in theImportSource.getJsonConfiguration()
- Returns:
- The import source will have all passwords masked see
ImportSourceConfigurationFacade.loadImportSource(Integer)
- Throws:
InsightException
-
storeImportSourceOT
Description copied from interface:ImportSourceConfigurationFacade
Store a single import source OT configuration item together with all ImportSourceOTAs. If id is left as null a new one will be created- Specified by:
storeImportSourceOT
in interfaceImportSourceConfigurationFacade
- Throws:
InsightException
-
storeImportSourceOTAttr
public ImportSourceOTAttr storeImportSourceOTAttr(ImportSourceOTAttr importSourceOTAttr) throws InsightException Description copied from interface:ImportSourceConfigurationFacade
Store a single import source OTAttr configuration item together with all ImportSourceOTAs. If id is left as null a new one will be created- Specified by:
storeImportSourceOTAttr
in interfaceImportSourceConfigurationFacade
- Throws:
InsightException
-
deleteImportSource
Description copied from interface:ImportSourceConfigurationFacade
Deletes an Import Source- Specified by:
deleteImportSource
in interfaceImportSourceConfigurationFacade
- Throws:
InsightException
-
deleteImportSourceOT
Description copied from interface:ImportSourceConfigurationFacade
Deletes an Import Source OT- Specified by:
deleteImportSourceOT
in interfaceImportSourceConfigurationFacade
- Throws:
InsightException
-
deleteImportSourceOTAttr
Description copied from interface:ImportSourceConfigurationFacade
Deletes an Import Source OTA- Specified by:
deleteImportSourceOTAttr
in interfaceImportSourceConfigurationFacade
- Throws:
InsightException
-
createPredefinedStructure
public void createPredefinedStructure(Integer importSourceId, ObjectTypeBean optionalParent) throws InsightException Description copied from interface:ImportSourceConfigurationFacade
Creates a predefined structure based on the import component used. If the import component does not support a predefined structure an insight exception will be thrown- Specified by:
createPredefinedStructure
in interfaceImportSourceConfigurationFacade
optionalParent
- if this structure should be inserted under a specific parent. If left as null the object type tree will be created on the top level- Throws:
InsightException
-
createPredefinedConfiguration
public ImportSource createPredefinedConfiguration(Integer importSourceId, ObjectTypeBean optionalParent) throws InsightException Description copied from interface:ImportSourceConfigurationFacade
Create the template configuration as specified by the component. If something is invalid in the configuration template or an object type is not mappable that one will be ignored. TODO the result of this operation should respond if a configuration was created- Specified by:
createPredefinedConfiguration
in interfaceImportSourceConfigurationFacade
optionalParent
- if this structure should be inserted under a specific parent. If left as null the object type tree will be created on the top level- Returns:
- The import source will have all passwords masked see
ImportSourceConfigurationFacade.loadImportSource(Integer)
- Throws:
InsightException
-
startImportSource
Description copied from interface:ImportSourceConfigurationFacade
Start an import given the id of the configuration. The returned Progress can be used to determine when the import is done.- Specified by:
startImportSource
in interfaceImportSourceConfigurationFacade
- Throws:
InsightException
-
startImportSourceForSpecificOTs
public Progress startImportSourceForSpecificOTs(int importSourceId, List<Integer> importSourceOTIds) throws InsightException Description copied from interface:ImportSourceConfigurationFacade
Start an import given the id of the configuration but only import a specific number of object types. Note that the import source ot ids are the ids of the configuration item ant not the id of the object type- Specified by:
startImportSourceForSpecificOTs
in interfaceImportSourceConfigurationFacade
- Throws:
InsightException
-