Class DefaultTrackableBehaviorUtil
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.DefaultTrackableBehaviorUtil
-
- All Implemented Interfaces:
TrackableBehaviorUtil
public class DefaultTrackableBehaviorUtil extends Object implements TrackableBehaviorUtil
- Author:
- Jeff Fischer
-
-
Constructor Summary
Constructors Constructor Description DefaultTrackableBehaviorUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancurrentRouteSupportsCatalog()Reports whether the currently active data route supports commonCatalogfunctionality.booleancurrentRouteSupportsMarketplace()Reports whether the currently active data route supports common marketplace (ex:MarketplaceApplicationCatalog) functionality.protected TrackableBehaviorPackagedetermineTrackableBehaviorPackage(@NonNull Class<?> domainClass)Determines theTrackableBehaviorsif no extensions are found for the domain class.protected Optional<TrackableBehaviorPackage>getBehaviorFromExtension(@NonNull Class<?> domainClass)Looks for an extension with which to determine theTrackableBehaviorsfor a domain class.protected org.springframework.core.env.EnvironmentgetEnvironment()TrackableBehaviorPackagegetInheritedBehavior(@NonNull TrackableBehaviorInheritable domainInstance)Retrieve a pojo that describes the inheritedTrackableBehaviorattributes of a domain objectprotected List<TrackableBehaviorOverride>getOverrides()protected com.broadleafcommerce.common.extension.data.DataRouteReferencegetReference()TrackableBehaviorPackagegetTrackableBehavior(@NonNull Class<?> domainClass)Retrieve a pojo that describes theTrackableBehaviorattributes of a domain classTrackableBehaviorPackagegetTrackableBehavior(@NonNull Object domainInstance)Retrieve a pojo that describes theTrackableBehaviorattributes of a domain objectbooleanisSandboxPropagationEnabled()Whether or not sandbox propagation is enabled in the system.booleanisSandboxRecord(@NonNull Trackable domainInstance)Determines whether the givenTrackableis a record in a sandbox.voidsetDataRouteReference(com.broadleafcommerce.common.extension.data.DataRouteReference reference)voidsetEnvironment(org.springframework.core.env.Environment environment)voidsetOverrides(List<TrackableBehaviorOverride> overrides)voidsetSandboxPropagationProperties(SandboxPropagationProperties properties)
-
-
-
Method Detail
-
setOverrides
@Autowired public void setOverrides(@Nullable List<TrackableBehaviorOverride> overrides)
-
setSandboxPropagationProperties
@Autowired public void setSandboxPropagationProperties(@Nullable SandboxPropagationProperties properties)
-
setDataRouteReference
@Autowired public void setDataRouteReference(@Nullable com.broadleafcommerce.common.extension.data.DataRouteReference reference)
-
setEnvironment
@Autowired public void setEnvironment(@Nullable org.springframework.core.env.Environment environment)
-
isSandboxPropagationEnabled
public boolean isSandboxPropagationEnabled()
Description copied from interface:TrackableBehaviorUtilWhether or not sandbox propagation is enabled in the system. SeeSandboxPropagationProperties. Default is false.- Specified by:
isSandboxPropagationEnabledin interfaceTrackableBehaviorUtil- Returns:
- Whether or not sandbox propagation is enabled in the system
-
getTrackableBehavior
@NonNull public TrackableBehaviorPackage getTrackableBehavior(@NonNull @NonNull @NonNull Class<?> domainClass)
Description copied from interface:TrackableBehaviorUtilRetrieve a pojo that describes theTrackableBehaviorattributes of a domain class- Specified by:
getTrackableBehaviorin interfaceTrackableBehaviorUtil- Parameters:
domainClass- The domain class to review forTrackableBehavior- Returns:
- Retrieve a pojo that describes the
TrackableBehaviorattributes of a domain class
-
isSandboxRecord
public boolean isSandboxRecord(@NonNull @NonNull @NonNull Trackable domainInstance)Description copied from interface:TrackableBehaviorUtilDetermines whether the givenTrackableis a record in a sandbox. This takes into account whetherdomainInstanceis even sandboxable before checking the tracking level to determine if it's in a sandbox.- Specified by:
isSandboxRecordin interfaceTrackableBehaviorUtil- Parameters:
domainInstance- TheTrackablethat could be a sandbox record- Returns:
- Whether the given
Trackableis a record in a sandbox
-
getTrackableBehavior
@NonNull public TrackableBehaviorPackage getTrackableBehavior(@NonNull @NonNull @NonNull Object domainInstance)
Description copied from interface:TrackableBehaviorUtilRetrieve a pojo that describes theTrackableBehaviorattributes of a domain object- Specified by:
getTrackableBehaviorin interfaceTrackableBehaviorUtil- Parameters:
domainInstance- The domain object to review forTrackableBehavior- Returns:
- Retrieve a pojo that describes the
TrackableBehaviorattributes of a domain object
-
getInheritedBehavior
@NonNull public TrackableBehaviorPackage getInheritedBehavior(@NonNull @NonNull @NonNull TrackableBehaviorInheritable domainInstance)
Description copied from interface:TrackableBehaviorUtilRetrieve a pojo that describes the inheritedTrackableBehaviorattributes of a domain object- Specified by:
getInheritedBehaviorin interfaceTrackableBehaviorUtil- Parameters:
domainInstance- The domain object to review for inheritedTrackableBehavior- Returns:
- Retrieve a pojo that describes the inherited
TrackableBehaviorattributes of a domain object
-
getBehaviorFromExtension
protected Optional<TrackableBehaviorPackage> getBehaviorFromExtension(@NonNull @NonNull @NonNull Class<?> domainClass)
Looks for an extension with which to determine theTrackableBehaviorsfor a domain class. Extensions may be provided via registeringTrackableBehaviorOverride Beansor annotating classes withTrackableExtension.- Parameters:
domainClass- The class for which to determine theTrackableBehaviors- Returns:
- The behaviors from the extension or empty if no extension particular to
domainClass. - See Also:
TrackableBehaviorUtil for more details on extensions,TrackableBehaviorOverride,TrackableExtension
-
determineTrackableBehaviorPackage
protected TrackableBehaviorPackage determineTrackableBehaviorPackage(@NonNull @NonNull @NonNull Class<?> domainClass)
Determines theTrackableBehaviorsif no extensions are found for the domain class. This will determine behaviors based on the implementedTrackableinterfaces ofdomainClass.- Parameters:
domainClass- The class for which to determine theTrackableBehaviors- Returns:
- the
TrackableBehaviorsparticular todomainClass. - See Also:
FullTrackable,CatalogTrackable,ApplicationTrackable,CustomerContextTrackable,SandboxTrackable,TenantTrackable,Trackable
-
currentRouteSupportsCatalog
public boolean currentRouteSupportsCatalog()
Description copied from interface:TrackableBehaviorUtilReports whether the currently active data route supports commonCatalogfunctionality.In the event that data routing is disabled or the current data route is not
CatalogDataRouteSupporting, the value ofNarrowingSupportFallbackProperties.isSupportsCatalog()should be used as a fallback.This can be useful to ensure certain behavior (ex: narrowing) will only apply if the current configuration has the requisite support for it.
Default returns true.
- Specified by:
currentRouteSupportsCatalogin interfaceTrackableBehaviorUtil- Returns:
- true if the current route supports common
Catalogfunctionality, or false otherwise - See Also:
CatalogDataRouteSupporting,NarrowingSupportFallbackProperties.isSupportsCatalog()
-
currentRouteSupportsMarketplace
public boolean currentRouteSupportsMarketplace()
Description copied from interface:TrackableBehaviorUtilReports whether the currently active data route supports common marketplace (ex:MarketplaceApplicationCatalog) functionality.In the event that data routing is disabled or the current data route is not
MarketplaceDataRouteSupporting, the value ofNarrowingSupportFallbackProperties.isSupportsMarketplace()will be used as a fallback.This can be useful to ensure certain behavior (ex: narrowing) will only apply if the current configuration has the requisite support for it.
Default returns true.
- Specified by:
currentRouteSupportsMarketplacein interfaceTrackableBehaviorUtil- Returns:
- true if the currently route supports common marketplace functionality, or false otherwise
- See Also:
MarketplaceDataRouteSupporting,NarrowingSupportFallbackProperties.isSupportsMarketplace()
-
getOverrides
@NonNull protected List<TrackableBehaviorOverride> getOverrides()
-
getReference
@Nullable protected com.broadleafcommerce.common.extension.data.DataRouteReference getReference()
-
getEnvironment
@Nullable protected org.springframework.core.env.Environment getEnvironment()
-
-