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 TypeMethodDescriptionvoidarchiveChangeSummaryGroupsForSandbox(String sandboxId) Archives the group ofChangeSummaryfor the specified sandbox id.booleanbatchTransition(PromoteBatchFlushContext flushContext) Add all the members identified inSummaryBasedFlushContext.getSummaryUpdates()to theChangeSummaryGroup.getChangeSummaryIds()collection via theChangeSummaryGroupidentified inPromoteBatchFlushContext.getGroupUpdate().booleanbatchTransition(StateChangeOnlyBatchFlushContext flushContext) UpdateChangeSummaryGroupinstances 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 ofChangeSummaryGroupids, 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 ofChangeSummaryGrouprecords 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 ofChangeSummaryGrouprecords based on the state and sandbox.readChangeSummaryGroupsByIds(List<String> changeSummaryGroupIds) Find allChangeSummaryGroupinstances matching primarily a list of ids.readChangeSummaryGroupsByIds(List<String> changeSummaryGroupIds, List<String> state, List<String> status, String sandbox) Find allChangeSummaryGroupinstances 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 allChangeSummaryGroupinstances 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 allChangeSummaryGroupinstances 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 ofChangeSummaryGrouprecords 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 ofChangeSummaryGrouprecords based on the state and sandbox.booleanremoveFromAffectedVendors(@NonNull String changeSummaryGroupId, @NonNull String vendorRef) Atomically removes the givenvendorReffromChangeSummaryGroup.getAffectedVendorRefs()of the givenchangeSummaryGroupIdif present.booleanupdateVals(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, readAllMethods 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, updateAllAllowingPartialSuccessMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccessMethods 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:ChangeSummaryGroupServiceTakesChangeSummaryGroup.getArchived()into account when retrieving a group with the given ID.- Specified by:
readByIdAndNotArchivedin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
id- ID of the group to retrieve- Returns:
- A
ChangeSummaryGroupmatching 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:ChangeSummaryGroupServiceTakesChangeSummaryGroup.getArchived()into account when retrieving a group with the given ID.- Specified by:
readByIdAndNotArchivedin 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
ChangeSummaryGroupmatching 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:ChangeSummaryGroupServiceFind a page ofChangeSummaryGrouprecords based on the state and sandbox. This primarily drives visibility of state related toChangeState.PROMOTEDfor a specific author.- Specified by:
readChangeSummaryGroupsForUserin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
state- TheChangeStatevalue for whichChangeSummaryGroup.getState()should matchsandbox-ChangeSummaryGroup.getSandbox()author-ChangeSummaryGroup.getAuthor()filters- the RSQLNodeused 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:ChangeSummaryGroupServiceFind a page ofChangeSummaryGrouprecords based on the state and sandbox. This primarily drives visibility of state related toChangeState.PROMOTEDfor a specific author.- Specified by:
readChangeSummaryGroupsForUserin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
state- TheChangeStatevalue for whichChangeSummaryGroup.getState()should matchsandbox-ChangeSummaryGroup.getSandbox()author-ChangeSummaryGroup.getAuthor()filters- the RSQLNodeused 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:ChangeSummaryGroupServiceFind a page ofChangeSummaryGrouprecords based on the state and sandbox. This primarily drives visibility of state related toChangeState.PROMOTEDandChangeState.APPROVED. However, other states are possible and can be retrieved here as well.- Specified by:
readChangeSummaryGroupsin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
state-ChangeSummaryGroup.getState()sandbox-ChangeSummaryGroup.getSandbox()filters- the RSQLNodeused 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:ChangeSummaryGroupServiceFind a page ofChangeSummaryGrouprecords based on the state and sandbox. This primarily drives visibility of state related toChangeState.PROMOTEDandChangeState.APPROVED. However, other states are possible and can be retrieved here as well.- Specified by:
readChangeSummaryGroupsin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
state-ChangeSummaryGroup.getState()sandbox-ChangeSummaryGroup.getSandbox()filters- the RSQLNodeused 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:ChangeSummaryGroupServiceFind allChangeSummaryGroupinstances matching primarily the sandbox.- Specified by:
readChangeSummaryGroupsBySandboxin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
sandbox- The sandbox for which theChangeSummaryGroup.getSandbox()should matchstate- TheChangeStatevalue for whichChangeSummaryGroup.getState()should matchstatus- The list ofChangeStatusTypevalues 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:ChangeSummaryGroupServiceFind allChangeSummaryGroupinstances matching primarily the sandbox.- Specified by:
readChangeSummaryGroupsBySandboxin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
sandbox- The sandbox for which theChangeSummaryGroup.getSandbox()should matchstate- TheChangeStatevalue for whichChangeSummaryGroup.getState()should matchstatus- The list ofChangeStatusTypevalues 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:ChangeSummaryGroupServiceFind allChangeSummaryGroupinstances matching primarily a list of ids.- Specified by:
readChangeSummaryGroupsByIdsin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
changeSummaryGroupIds- The list ofChangeSummaryGroup.getId()values to matchstate- TheChangeStatevalues for whichChangeSummaryGroup.getState()should matchstatus- The list ofChangeStatusTypevalues 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:ChangeSummaryGroupServiceFind allChangeSummaryGroupinstances matching primarily a list of ids.- Specified by:
readChangeSummaryGroupsByIdsin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
changeSummaryGroupIds- The list ofChangeSummaryGroup.getId()values to matchstate- TheChangeStatevalues for whichChangeSummaryGroup.getState()should matchstatus- The list ofChangeStatusTypevalues 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:ChangeSummaryGroupServiceFind allChangeSummaryGroupinstances matching primarily a list of ids.- Specified by:
readChangeSummaryGroupsByIdsin 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:ChangeSummaryGroupServiceGiven a list ofChangeSummaryGroupids, find the count of groups that match the state requirements defined in the params.- Specified by:
readChangeSummaryGroupByIdsCountin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
changeSummaryGroupIds- The group ids to checkstates- TheChangeStatevalue for whichChangeSummaryGroup.getState()should match. Cannot be emptystatus- The list ofChangeStatusTypevalues 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:ChangeSummaryGroupServiceAdd all the members identified inSummaryBasedFlushContext.getSummaryUpdates()to theChangeSummaryGroup.getChangeSummaryIds()collection via theChangeSummaryGroupidentified inPromoteBatchFlushContext.getGroupUpdate().- Specified by:
batchTransitionin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
flushContext- Context object containing the change summary list to add to the group
-
batchTransition
Description copied from interface:ChangeSummaryGroupServiceUpdateChangeSummaryGroupinstances in bulk (identified byPromoteBatchFlushContext.getGroupUpdate()) in order to mutate state (such asChangeSummaryGroup.getState()).- Specified by:
batchTransitionin 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:ChangeSummaryGroupServiceUpdate the fields for a record matching the id- Specified by:
updateValsin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
changeSummaryGroupId- The id requested to mutatewhereStates- all validChangeStatevalues for whichChangeSummaryGroup.getState()should matchwhereStatus- The list ofChangeStatusTypevalues 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:ChangeSummaryGroupServiceArchives the group ofChangeSummaryfor the specified sandbox id.- Specified by:
archiveChangeSummaryGroupsForSandboxin 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:ChangeSummaryGroupServiceAtomically removes the givenvendorReffromChangeSummaryGroup.getAffectedVendorRefs()of the givenchangeSummaryGroupIdif present.- Specified by:
removeFromAffectedVendorsin interfaceChangeSummaryGroupService<P extends ChangeSummaryGroup>- Parameters:
changeSummaryGroupId- the ID of the group to updatevendorRef- the vendor ref to remove fromChangeSummaryGroup.getAffectedVendorRefs()- Returns:
trueif the removal was successful,falseotherwise
-
getRepository
- Overrides:
getRepositoryin classcom.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends ChangeSummaryGroup>
-