Class DataFeedPublicationConfigurationService
java.lang.Object
com.broadleafcommerce.datafeed.service.publisher.configuration.DataFeedPublicationConfigurationService
This is a centralized service component that provides access to
DataFeedPublicationConfiguration
instances.-
Constructor Summary
ConstructorDescriptionDataFeedPublicationConfigurationService
(List<DataFeedPublicationConfigurationContributor> configurationContributors) -
Method Summary
Modifier and TypeMethodDescriptiongetAllByFeedProcessTypeWithContextFiltration
(@NonNull String feedProcessType, @NonNull String tenantId, @NonNull String applicationId) Fetches theDataFeedPublicationConfiguration
matching the givenDataFeedPublicationConfiguration.getFeedProcessType()
and filters out the result if it does not exactly match the provided context.Fetches theDataFeedPublicationConfiguration
matching the givenDataFeedPublicationConfiguration.getId()
.getByIdWithContextFiltration
(@NonNull String dataFeedPublicationConfigurationId, @NonNull String tenantId) Similar togetById(String)
, but filters out the result if it does not exactly match the provided context.getByIdWithContextFiltration
(String dataFeedPublicationConfigurationId, @NonNull String tenantId, @NonNull String applicationId) Similar togetById(String)
, but filters out the result if it does not exactly match the provided context.protected Map<String,
DataFeedPublicationConfiguration> An immutable map ofDataFeedPublicationConfiguration
byDataFeedPublicationConfiguration.getId()
.protected void
processConfigurationFromContributor
(DataFeedPublicationConfiguration configurationFromContributor, Map<String, DataFeedPublicationConfiguration> targetMap) Validates the givenDataFeedPublicationConfiguration
and adds it to thetargetMap
if valid.protected Map<String,
DataFeedPublicationConfiguration> processContributors
(List<DataFeedPublicationConfigurationContributor> configurationContributors) Invokes any givenDataFeedPublicationConfigurationContributor
components and validates + loads their contributedDataFeedPublicationConfiguration
instances into a map by their IDs.validateContributedConfiguration
(DataFeedPublicationConfiguration configuration) Validates the givenDataFeedPublicationConfiguration
and returns error(s) if any were encountered.
-
Constructor Details
-
DataFeedPublicationConfigurationService
public DataFeedPublicationConfigurationService(@Nullable List<DataFeedPublicationConfigurationContributor> configurationContributors)
-
-
Method Details
-
processContributors
protected Map<String,DataFeedPublicationConfiguration> processContributors(@Nullable List<DataFeedPublicationConfigurationContributor> configurationContributors) Invokes any givenDataFeedPublicationConfigurationContributor
components and validates + loads their contributedDataFeedPublicationConfiguration
instances into a map by their IDs.- Parameters:
configurationContributors
- contributors from which to getDataFeedPublicationConfiguration
instances- Returns:
- a map of
DataFeedPublicationConfiguration
instances by ID
-
processConfigurationFromContributor
protected void processConfigurationFromContributor(DataFeedPublicationConfiguration configurationFromContributor, Map<String, DataFeedPublicationConfiguration> targetMap) Validates the givenDataFeedPublicationConfiguration
and adds it to thetargetMap
if valid.- Parameters:
configurationFromContributor
- the configuration to processtargetMap
- the map to add the configuration to (by id) if validations pass
-
validateContributedConfiguration
protected List<String> validateContributedConfiguration(DataFeedPublicationConfiguration configuration) Validates the givenDataFeedPublicationConfiguration
and returns error(s) if any were encountered.- Parameters:
configuration
- the configuration to validate- Returns:
- empty list if no errors were found, else a list containing validation errors
-
getById
public Optional<DataFeedPublicationConfiguration> getById(String dataFeedPublicationConfigurationId) Fetches theDataFeedPublicationConfiguration
matching the givenDataFeedPublicationConfiguration.getId()
.This method does not perform any context-based filtration on fields such as
DataFeedPublicationConfiguration.getApplicationIdHint()
orDataFeedPublicationConfiguration.getTenantIdHint()
.- Parameters:
dataFeedPublicationConfigurationId
- the ID of the configuration to fetch- Returns:
- an
Optional
containing the configuration matching the given ID if found,Optional.empty()
otherwise - See Also:
-
getByIdWithContextFiltration
public Optional<DataFeedPublicationConfiguration> getByIdWithContextFiltration(String dataFeedPublicationConfigurationId, @NonNull @NonNull String tenantId, @NonNull @NonNull String applicationId) Similar togetById(String)
, but filters out the result if it does not exactly match the provided context.- Parameters:
dataFeedPublicationConfigurationId
- the ID of the configuration to fetchtenantId
- the tenant ID to match againstDataFeedPublicationConfiguration.getTenantIdHint()
applicationId
- the application ID to match againstDataFeedPublicationConfiguration.getApplicationIdHint()
- Returns:
- an
Optional
containing the configuration matching the given ID if found,Optional.empty()
otherwise - See Also:
-
getAllByFeedProcessTypeWithContextFiltration
public List<DataFeedPublicationConfiguration> getAllByFeedProcessTypeWithContextFiltration(@NonNull @NonNull String feedProcessType, @NonNull @NonNull String tenantId, @NonNull @NonNull String applicationId) Fetches theDataFeedPublicationConfiguration
matching the givenDataFeedPublicationConfiguration.getFeedProcessType()
and filters out the result if it does not exactly match the provided context.- Parameters:
feedProcessType
- the process typetenantId
- the tenant ID to match againstDataFeedPublicationConfiguration.getTenantIdHint()
applicationId
- the application ID to match againstDataFeedPublicationConfiguration.getApplicationIdHint()
- Returns:
- an
Optional
containing the configuration matching the given process type if found,Optional.empty()
otherwise
-
getByIdWithContextFiltration
public Optional<DataFeedPublicationConfiguration> getByIdWithContextFiltration(@NonNull @NonNull String dataFeedPublicationConfigurationId, @NonNull @NonNull String tenantId) Similar togetById(String)
, but filters out the result if it does not exactly match the provided context.- Parameters:
dataFeedPublicationConfigurationId
- the ID of the configuration to fetchtenantId
- the tenant ID to match againstDataFeedPublicationConfiguration.getTenantIdHint()
- Returns:
- an
Optional
containing the configuration matching the given ID if found,Optional.empty()
otherwise
-
getPublicationConfigurationsById
An immutable map ofDataFeedPublicationConfiguration
byDataFeedPublicationConfiguration.getId()
.
-