Class DefaultChangeDeployService<P extends ChangeDeploy>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P>
com.broadleafcommerce.sandbox.service.DefaultChangeDeployService<P>
- Type Parameters:
P
- The type of the business instance
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>
,com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService<P>
,ChangeDeployService<P>
public class DefaultChangeDeployService<P extends ChangeDeploy>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P>
implements ChangeDeployService<P>
- Author:
- Nathan Moore (nathandmoore)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultChangeDeployService
(ChangeDeployRepository<?> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionprotected ChangeDeployRepository<?>
TakesChangeDeploy.getArchived()
into account when retrieving a deployment with the given ID.readByIdAndNotArchived
(String id, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) TakesChangeDeploy.getArchived()
into account when retrieving a deployment with the given ID.org.springframework.data.domain.Page<P>
readChangeDeploys
(String applicationId, String state, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable) Deprecated.org.springframework.data.domain.Page<P>
readChangeDeploys
(String sandbox, String state, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find a page ofChangeDeploy
records based on the sandbox and state.boolean
removeFromAffectedVendors
(@NonNull String deployId, @NonNull String vendorRef) Atomically removes the givenvendorRef
fromChangeDeploy.getAffectedVendorRefs()
of the givendeployId
if present.setAffectedVendors
(@NonNull String deployId, boolean affectsNonVendorData, @NonNull Set<String> affectedVendorRefs) Atomically finds theChangeDeploy
with the givendeployId
and sets itsChangeDeploy.isAffectsNonVendorData()
andChangeDeploy.getAffectedVendorRefs()
to the provided values.boolean
updateVals
(String changeDeployId, List<String> whereStates, List<String> whereStatus, String noticationStateName, Map<String, Object> vals) Update the fields for a record matching the id.boolean
updateVals
(String changeDeployId, List<String> whereStates, List<String> whereStatus, String noticationStateName, Map<String, Object> vals, boolean vendorNarrowing, boolean insertNotificationStateIfMissing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update the fields for a record matching the id.boolean
updateVals
(String changeDeployId, List<String> whereStates, List<String> whereStatus, String noticationStateName, Map<String, Object> vals, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update the fields for a record matching the id.updateValsAndReturn
(String changeDeployId, List<String> whereStates, List<String> whereStatus, String notificationStateName, Map<String, Object> vals) Update the fields for a record matching the id, and return anOptional
containing the value if it was successfully updated,Optional.empty()
otherwise.Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAll
Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService
convertFromPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService
readAll, readAll, readAll, readAll
-
Constructor Details
-
DefaultChangeDeployService
public DefaultChangeDeployService(ChangeDeployRepository<?> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper)
-
-
Method Details
-
readByIdAndNotArchived
Description copied from interface:ChangeDeployService
TakesChangeDeploy.getArchived()
into account when retrieving a deployment with the given ID.- Specified by:
readByIdAndNotArchived
in interfaceChangeDeployService<P extends ChangeDeploy>
- Parameters:
id
- ID of the deployment to retrieve- Returns:
- A
ChangeDeploy
matching the given ID and not archived
-
readByIdAndNotArchived
public P readByIdAndNotArchived(@NonNull String id, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ChangeDeployService
TakesChangeDeploy.getArchived()
into account when retrieving a deployment with the given ID.- Specified by:
readByIdAndNotArchived
in interfaceChangeDeployService<P extends ChangeDeploy>
- Parameters:
id
- ID of the deployment to retrievevendorNarrowing
- whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabledcontextInfo
- context information about sandboxing and multitenant state- Returns:
- A
ChangeDeploy
matching the given ID and not archived
-
updateVals
public boolean updateVals(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String noticationStateName, @NonNull Map<String, Object> vals) Description copied from interface:ChangeDeployService
Update the fields for a record matching the id.- Specified by:
updateVals
in interfaceChangeDeployService<P extends ChangeDeploy>
- Parameters:
changeDeployId
- the ID of the deployment which should be updatedwhereStates
- theChangeState
values whichChangeDeploy.getState()
should match one or more of to qualify for this updatewhereStatus
- the list ofChangeStatusType
values whichChangeDeploy.getStatus()
should match one or more of to qualify for this update. Can be empty.noticationStateName
- (optional) the name of the notification state that should be used to filter in the notification states array. This is relevant for update operations that want to modify a specific notification state with update values specified inupdateVals
vals
- Map of field to value changes to make to the ChangeDeploy instance- Returns:
- Whether or not an update was performed. If no record found matching the id and state, will return false.
-
updateVals
public boolean updateVals(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String noticationStateName, @NonNull Map<String, Object> vals, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ChangeDeployService
Update the fields for a record matching the id.
Calling this method is the same as calling
ChangeDeployService.updateVals(String, List, List, String, Map, boolean, boolean, ContextInfo)
, but with theinsertNotificationStateIfMissing
parameter set tofalse
.- Specified by:
updateVals
in interfaceChangeDeployService<P extends ChangeDeploy>
- Parameters:
changeDeployId
- the ID of the deployment which should be updatedwhereStates
- theChangeState
values whichChangeDeploy.getState()
should match one or more of to qualify for this updatewhereStatus
- the list ofChangeStatusType
values whichChangeDeploy.getStatus()
should match one or more of to qualify for this update. Can be empty.noticationStateName
- (optional) the name of the notification state that should be used to filter in the notification states array. This is relevant for update operations that want to modify a specific notification state with update values specified inupdateVals
vals
- Map of field to value changes to make to the ChangeDeploy instancevendorNarrowing
- whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabledcontextInfo
- context information about sandboxing and multitenant state- Returns:
- Whether or not an update was performed. If no record found matching the id and state, will return false.
-
updateVals
public boolean updateVals(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String noticationStateName, @NonNull Map<String, Object> vals, boolean vendorNarrowing, boolean insertNotificationStateIfMissing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ChangeDeployService
Update the fields for a record matching the id.- Specified by:
updateVals
in interfaceChangeDeployService<P extends ChangeDeploy>
- Parameters:
changeDeployId
- the ID of the deployment which should be updatedwhereStates
- theChangeState
values whichChangeDeploy.getState()
should match one or more of to qualify for this updatewhereStatus
- the list ofChangeStatusType
values whichChangeDeploy.getStatus()
should match one or more of to qualify for this update. Can be empty.noticationStateName
- (optional) the name of the notification state that should be used to filter in the notification states array. This is relevant for update operations that want to modify a specific notification state with update values specified inupdateVals
vals
- Map of field to value changes to make to the ChangeDeploy instancevendorNarrowing
- whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabledinsertNotificationStateIfMissing
- ifvals
target a notification state andnotificationStateName
is provided, this flag determines whether the flow will newly insert the notification state if it does not already exist in the datastore. In other words, when this flag is false, the flow will only try to update an existing notification state with the provided details invals
. When this flag istrue
, if the update attempt is unsuccessful because the notification state is missing, the flow will attempt to newly insert that state into the datastore.contextInfo
- context information about sandboxing and multitenant state- Returns:
- Whether or not an update was performed. If no record found matching the id and state, will return false.
- See Also:
-
updateValsAndReturn
public Optional<P> updateValsAndReturn(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String notificationStateName, @NonNull Map<String, Object> vals) Description copied from interface:ChangeDeployService
Update the fields for a record matching the id, and return anOptional
containing the value if it was successfully updated,Optional.empty()
otherwise.- Specified by:
updateValsAndReturn
in interfaceChangeDeployService<P extends ChangeDeploy>
- Parameters:
changeDeployId
- the ID of the deployment which should be updatedwhereStates
- theChangeState
values whichChangeDeploy.getState()
should match one or more of to qualify for this updatewhereStatus
- the list ofChangeStatusType
values whichChangeDeploy.getStatus()
should match one or more of to qualify for this update. Can be empty.notificationStateName
- (optional) the name of the notification state that should be used to filter in the notification states array. This is relevant for update operations that want to modify a specific notification state with update values specified inupdateVals
vals
- Map of field to value changes to make to the ChangeDeploy instance- Returns:
Optional.empty()
if no record found matching the id and state, or if found and updated, anOptional
containing the updated deployment
-
readChangeDeploys
@NonNull @Deprecated public org.springframework.data.domain.Page<P> readChangeDeploys(@Nullable String applicationId, @NonNull String state, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable pageable) Deprecated.Description copied from interface:ChangeDeployService
Find a page ofChangeDeploy
records based on the application and state. This drives visibility of state related toChangeState.SCHEDULED
andChangeState.DEPLOYED
.- Specified by:
readChangeDeploys
in interfaceChangeDeployService<P extends ChangeDeploy>
- Parameters:
applicationId
- The application to filter deploysstate
-ChangeDeploy.getState()
filters
- the RSQLNode
used to restrict resultpageable
- Page setup information- Returns:
- page of matching records
-
readChangeDeploys
@NonNull public org.springframework.data.domain.Page<P> readChangeDeploys(@NonNull String sandbox, @NonNull String state, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable pageable, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ChangeDeployService
Find a page ofChangeDeploy
records based on the sandbox and state. This drives visibility of state related toChangeState.SCHEDULED
andChangeState.DEPLOYED
.- Specified by:
readChangeDeploys
in interfaceChangeDeployService<P extends ChangeDeploy>
- Parameters:
sandbox
-ChangeDeploy.getSandbox()
state
-ChangeDeploy.getState()
filters
- the RSQLNode
used to restrict resultpageable
- Page setup informationvendorNarrowing
- whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabledcontextInfo
- context information about sandboxing and multitenant state- Returns:
- page of matching records
-
setAffectedVendors
@Nullable public P setAffectedVendors(@NonNull @NonNull String deployId, boolean affectsNonVendorData, @NonNull @NonNull Set<String> affectedVendorRefs) Description copied from interface:ChangeDeployService
Atomically finds theChangeDeploy
with the givendeployId
and sets itsChangeDeploy.isAffectsNonVendorData()
andChangeDeploy.getAffectedVendorRefs()
to the provided values.Internally, this method should rely on data-store locking mechanisms to protect against concurrent mutations.
- Specified by:
setAffectedVendors
in interfaceChangeDeployService<P extends ChangeDeploy>
- Parameters:
deployId
- the ID of the deploy to updateaffectsNonVendorData
- the new value to set forChangeDeploy.isAffectsNonVendorData()
affectedVendorRefs
- the new value to set forChangeDeploy.getAffectedVendorRefs()
. Cannot be null, but can be empty.- Returns:
- the updated deployment if the update was successful,
null
otherwise
-
removeFromAffectedVendors
public boolean removeFromAffectedVendors(@NonNull @NonNull String deployId, @NonNull @NonNull String vendorRef) Description copied from interface:ChangeDeployService
Atomically removes the givenvendorRef
fromChangeDeploy.getAffectedVendorRefs()
of the givendeployId
if present.- Specified by:
removeFromAffectedVendors
in interfaceChangeDeployService<P extends ChangeDeploy>
- Parameters:
deployId
- the ID of the deploy to updatevendorRef
- the vendor ref to remove fromChangeDeploy.getAffectedVendorRefs()
- Returns:
true
if the removal was successful,false
otherwise
-
getRepository
- Overrides:
getRepository
in classcom.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends ChangeDeploy>
-