Class DefaultChangeSummaryGroupService<P extends ChangeSummaryGroup>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P>
com.broadleafcommerce.sandbox.service.DefaultChangeSummaryGroupService<P>
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>
,com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService<P>
,ChangeSummaryGroupService<P>
public class DefaultChangeSummaryGroupService<P extends ChangeSummaryGroup>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P>
implements ChangeSummaryGroupService<P>
- Author:
- Jeff Fischer
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultChangeSummaryGroupService
(ChangeSummaryGroupRepository<?> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionvoid
archiveChangeSummaryGroupsForSandbox
(String sandboxId) Archives the group ofChangeSummary
for the specified sandbox id.boolean
batchTransition
(PromoteBatchFlushContext flushContext) Add all the members identified inSummaryBasedFlushContext.getSummaryUpdates()
to theChangeSummaryGroup.getChangeSummaryIds()
collection via theChangeSummaryGroup
identified inPromoteBatchFlushContext.getGroupUpdate()
.boolean
batchTransition
(StateChangeOnlyBatchFlushContext flushContext) UpdateChangeSummaryGroup
instances in bulk (identified byPromoteBatchFlushContext.getGroupUpdate()
) in order to mutate state (such asChangeSummaryGroup.getState()
).protected ChangeSummaryGroupRepository<?>
TakesChangeSummaryGroup.getArchived()
into account when retrieving a group with the given ID.readByIdAndNotArchived
(String id, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) TakesChangeSummaryGroup.getArchived()
into account when retrieving a group with the given ID.readChangeSummaryGroupByIdsCount
(List<String> changeSummaryGroupIds, List<String> states, List<String> status, String sandbox) Given a list ofChangeSummaryGroup
ids, find the count of groups that match the state requirements defined in the params.org.springframework.data.domain.Page<P>
readChangeSummaryGroups
(String state, String sandbox, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable) Find a page ofChangeSummaryGroup
records based on the state and sandbox.org.springframework.data.domain.Page<P>
readChangeSummaryGroups
(String state, String sandbox, 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 ofChangeSummaryGroup
records based on the state and sandbox.readChangeSummaryGroupsByIds
(List<String> changeSummaryGroupIds) Find allChangeSummaryGroup
instances matching primarily a list of ids.readChangeSummaryGroupsByIds
(List<String> changeSummaryGroupIds, List<String> state, List<String> status, String sandbox) Find allChangeSummaryGroup
instances matching primarily a list of ids.readChangeSummaryGroupsByIds
(List<String> changeSummaryGroupIds, List<String> state, List<String> status, String sandbox, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find allChangeSummaryGroup
instances matching primarily a list of ids.readChangeSummaryGroupsBySandbox
(String sandbox, String state, List<String> status) Deprecated.readChangeSummaryGroupsBySandbox
(String sandbox, String state, List<String> status, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find allChangeSummaryGroup
instances matching primarily the sandbox.org.springframework.data.domain.Page<P>
readChangeSummaryGroupsForUser
(String state, String sandbox, String author, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable) Find a page ofChangeSummaryGroup
records based on the state and sandbox.org.springframework.data.domain.Page<P>
readChangeSummaryGroupsForUser
(String state, String sandbox, String author, 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 ofChangeSummaryGroup
records based on the state and sandbox.boolean
removeFromAffectedVendors
(@NonNull String changeSummaryGroupId, @NonNull String vendorRef) Atomically removes the givenvendorRef
fromChangeSummaryGroup.getAffectedVendorRefs()
of the givenchangeSummaryGroupId
if present.boolean
updateVals
(String changeSummaryGroupId, List<String> whereStates, List<String> whereStatus, Map<String, Object> vals, boolean enforceArchive) Update the fields for a record matching the idMethods 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
-
DefaultChangeSummaryGroupService
public DefaultChangeSummaryGroupService(ChangeSummaryGroupRepository<?> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper)
-
-
Method Details
-
readByIdAndNotArchived
Description copied from interface:ChangeSummaryGroupService
TakesChangeSummaryGroup.getArchived()
into account when retrieving a group with the given ID.- Specified by:
readByIdAndNotArchived
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
id
- ID of the group to retrieve- Returns:
- A
ChangeSummaryGroup
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:ChangeSummaryGroupService
TakesChangeSummaryGroup.getArchived()
into account when retrieving a group with the given ID.- Specified by:
readByIdAndNotArchived
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
id
- ID of the group 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
ChangeSummaryGroup
matching the given ID and not archived
-
readChangeSummaryGroupsForUser
public org.springframework.data.domain.Page<P> readChangeSummaryGroupsForUser(@NonNull String state, @NonNull String sandbox, @NonNull String author, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable pageable) Description copied from interface:ChangeSummaryGroupService
Find a page ofChangeSummaryGroup
records based on the state and sandbox. This primarily drives visibility of state related toChangeState.PROMOTED
for a specific author.- Specified by:
readChangeSummaryGroupsForUser
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
state
- TheChangeState
value for whichChangeSummaryGroup.getState()
should matchsandbox
-ChangeSummaryGroup.getSandbox()
author
-ChangeSummaryGroup.getAuthor()
filters
- the RSQLNode
used to restrict resultpageable
- Page setup information- Returns:
- page of matching records
-
readChangeSummaryGroupsForUser
public org.springframework.data.domain.Page<P> readChangeSummaryGroupsForUser(@NonNull String state, @NonNull String sandbox, @NonNull String author, @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:ChangeSummaryGroupService
Find a page ofChangeSummaryGroup
records based on the state and sandbox. This primarily drives visibility of state related toChangeState.PROMOTED
for a specific author.- Specified by:
readChangeSummaryGroupsForUser
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
state
- TheChangeState
value for whichChangeSummaryGroup.getState()
should matchsandbox
-ChangeSummaryGroup.getSandbox()
author
-ChangeSummaryGroup.getAuthor()
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
-
readChangeSummaryGroups
public org.springframework.data.domain.Page<P> readChangeSummaryGroups(@NonNull String state, @NonNull String sandbox, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable pageable) Description copied from interface:ChangeSummaryGroupService
Find a page ofChangeSummaryGroup
records based on the state and sandbox. This primarily drives visibility of state related toChangeState.PROMOTED
andChangeState.APPROVED
. However, other states are possible and can be retrieved here as well.- Specified by:
readChangeSummaryGroups
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
state
-ChangeSummaryGroup.getState()
sandbox
-ChangeSummaryGroup.getSandbox()
filters
- the RSQLNode
used to restrict resultpageable
- Page setup information- Returns:
- page of matching records
-
readChangeSummaryGroups
public org.springframework.data.domain.Page<P> readChangeSummaryGroups(@NonNull String state, @NonNull String sandbox, @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:ChangeSummaryGroupService
Find a page ofChangeSummaryGroup
records based on the state and sandbox. This primarily drives visibility of state related toChangeState.PROMOTED
andChangeState.APPROVED
. However, other states are possible and can be retrieved here as well.- Specified by:
readChangeSummaryGroups
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
state
-ChangeSummaryGroup.getState()
sandbox
-ChangeSummaryGroup.getSandbox()
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
-
readChangeSummaryGroupsBySandbox
@Deprecated public Stream<P> readChangeSummaryGroupsBySandbox(@NonNull String sandbox, @NonNull String state, List<String> status) Deprecated.Description copied from interface:ChangeSummaryGroupService
Find allChangeSummaryGroup
instances matching primarily the sandbox.- Specified by:
readChangeSummaryGroupsBySandbox
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
sandbox
- The sandbox for which theChangeSummaryGroup.getSandbox()
should matchstate
- TheChangeState
value for whichChangeSummaryGroup.getState()
should matchstatus
- The list ofChangeStatusType
values for whichChangeSummaryGroup.getStatus()
should match one or more of. Can be empty- Returns:
- A Stream that can be iterated, possibly containing a large number or records
-
readChangeSummaryGroupsBySandbox
public Stream<P> readChangeSummaryGroupsBySandbox(@NonNull String sandbox, @NonNull String state, List<String> status, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ChangeSummaryGroupService
Find allChangeSummaryGroup
instances matching primarily the sandbox.- Specified by:
readChangeSummaryGroupsBySandbox
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
sandbox
- The sandbox for which theChangeSummaryGroup.getSandbox()
should matchstate
- TheChangeState
value for whichChangeSummaryGroup.getState()
should matchstatus
- The list ofChangeStatusType
values for whichChangeSummaryGroup.getStatus()
should match one or more of. Can be emptyvendorNarrowing
- 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 Stream that can be iterated, possibly containing a large number or records
-
readChangeSummaryGroupsByIds
public Stream<P> readChangeSummaryGroupsByIds(@NonNull List<String> changeSummaryGroupIds, List<String> state, List<String> status, @NonNull String sandbox) Description copied from interface:ChangeSummaryGroupService
Find allChangeSummaryGroup
instances matching primarily a list of ids.- Specified by:
readChangeSummaryGroupsByIds
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
changeSummaryGroupIds
- The list ofChangeSummaryGroup.getId()
values to matchstate
- TheChangeState
values for whichChangeSummaryGroup.getState()
should matchstatus
- The list ofChangeStatusType
values for whichChangeSummaryGroup.getStatus()
should match one of more of. Can be emptysandbox
- The sandbox for which theChangeSummaryGroup.getSandbox()
should match- Returns:
- A Stream that can be iterated, possibly containing a large number or records
-
readChangeSummaryGroupsByIds
public Stream<P> readChangeSummaryGroupsByIds(@NonNull List<String> changeSummaryGroupIds, List<String> state, List<String> status, @NonNull String sandbox, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ChangeSummaryGroupService
Find allChangeSummaryGroup
instances matching primarily a list of ids.- Specified by:
readChangeSummaryGroupsByIds
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
changeSummaryGroupIds
- The list ofChangeSummaryGroup.getId()
values to matchstate
- TheChangeState
values for whichChangeSummaryGroup.getState()
should matchstatus
- The list ofChangeStatusType
values for whichChangeSummaryGroup.getStatus()
should match one of more of. Can be emptysandbox
- The sandbox for which theChangeSummaryGroup.getSandbox()
should matchvendorNarrowing
- 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 Stream that can be iterated, possibly containing a large number or records
-
readChangeSummaryGroupsByIds
Description copied from interface:ChangeSummaryGroupService
Find allChangeSummaryGroup
instances matching primarily a list of ids.- Specified by:
readChangeSummaryGroupsByIds
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
changeSummaryGroupIds
- The list ofChangeSummaryGroup.getId()
values to match- Returns:
- A Stream that can be iterated, possibly containing a large number or records
-
readChangeSummaryGroupByIdsCount
@NonNull public Long readChangeSummaryGroupByIdsCount(@NonNull List<String> changeSummaryGroupIds, List<String> states, List<String> status, @NonNull String sandbox) Description copied from interface:ChangeSummaryGroupService
Given a list ofChangeSummaryGroup
ids, find the count of groups that match the state requirements defined in the params.- Specified by:
readChangeSummaryGroupByIdsCount
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
changeSummaryGroupIds
- The group ids to checkstates
- TheChangeState
value for whichChangeSummaryGroup.getState()
should match. Cannot be emptystatus
- The list ofChangeStatusType
values for whichChangeSummaryGroup.getStatus()
should match one of more of. Can be empty to indicate no filtrationsandbox
- The sandbox for which theChangeSummaryGroup.getSandbox()
should match- Returns:
- The count of entities matching the requested params
-
batchTransition
Description copied from interface:ChangeSummaryGroupService
Add all the members identified inSummaryBasedFlushContext.getSummaryUpdates()
to theChangeSummaryGroup.getChangeSummaryIds()
collection via theChangeSummaryGroup
identified inPromoteBatchFlushContext.getGroupUpdate()
.- Specified by:
batchTransition
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
flushContext
- Context object containing the change summary list to add to the group
-
batchTransition
Description copied from interface:ChangeSummaryGroupService
UpdateChangeSummaryGroup
instances in bulk (identified byPromoteBatchFlushContext.getGroupUpdate()
) in order to mutate state (such asChangeSummaryGroup.getState()
).- Specified by:
batchTransition
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
flushContext
- Context object containing the change summary group transition information to commit
-
updateVals
public boolean updateVals(@NonNull String changeSummaryGroupId, List<String> whereStates, List<String> whereStatus, Map<String, Object> vals, boolean enforceArchive) Description copied from interface:ChangeSummaryGroupService
Update the fields for a record matching the id- Specified by:
updateVals
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
changeSummaryGroupId
- The id requested to mutatewhereStates
- all validChangeState
values for whichChangeSummaryGroup.getState()
should matchwhereStatus
- The list ofChangeStatusType
values for whichChangeSummaryGroup.getStatus()
should match one or more of. Can be emptyvals
- Map of field to value changes to make to the ChangeSummaryGroup instanceenforceArchive
- Whether archive status should be checked before updating- Returns:
- Whether or not an update was performed. If no record found matching the id and state, will return false.
-
archiveChangeSummaryGroupsForSandbox
@Transactional("sandboxTransactionManager") public void archiveChangeSummaryGroupsForSandbox(String sandboxId) Description copied from interface:ChangeSummaryGroupService
Archives the group ofChangeSummary
for the specified sandbox id.- Specified by:
archiveChangeSummaryGroupsForSandbox
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
sandboxId
- the sandbox id associated to the change summary groups
-
removeFromAffectedVendors
public boolean removeFromAffectedVendors(@NonNull @NonNull String changeSummaryGroupId, @NonNull @NonNull String vendorRef) Description copied from interface:ChangeSummaryGroupService
Atomically removes the givenvendorRef
fromChangeSummaryGroup.getAffectedVendorRefs()
of the givenchangeSummaryGroupId
if present.- Specified by:
removeFromAffectedVendors
in interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>
- Parameters:
changeSummaryGroupId
- the ID of the group to updatevendorRef
- the vendor ref to remove fromChangeSummaryGroup.getAffectedVendorRefs()
- Returns:
true
if the removal was successful,false
otherwise
-
getRepository
- Overrides:
getRepository
in classcom.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends ChangeSummaryGroup>
-