Class IndexableType
- All Implemented Interfaces:
Serializable
Extensible enumeration specifying the type of Indexable being indexed (e.g. PRODUCT, ORDER, CUSTOMER, etc.).
Consumers should extend this class and create public static final members indicating their desired indexable type. A complete example might look like this:
public class ProductIndexableType extends IndexableType {
public static final IndexableType PRODUCT = new ProductIndexableType("PRODUCT", true);
protected ProductIndexableType(String value, boolean translatable) {
super(value, translatable);
}
}
To ensure the IndexableType is initialized properly, additional configuration is required by
using the annotation
@IndexableTypes
on a
Spring @Configuration class.
Using the previous example of a ProductIndexableType, the following configuration would be required:
@IndexableTypes({ProductIndexableType.class})
@Configuration
public class SpringConfigurationClass {}
- Author:
- Kelly Tisdell (ktisdell), cschneider
- See Also:
-
Nested Class Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
IndexableType
(@NonNull String value, boolean translatable, com.broadleafcommerce.data.tracking.core.TrackableBehavior... behaviors) Constructs anIndexableType
from a String.protected
IndexableType
(@NonNull String value, String label, boolean translatable, boolean vendorBehavior, com.broadleafcommerce.data.tracking.core.TrackableBehavior... behaviors) Constructs anIndexableType
from a String with a label.protected
IndexableType
(@NonNull String value, String label, boolean translatable, com.broadleafcommerce.data.tracking.core.TrackableBehavior... behaviors) Constructs anIndexableType
from a String with a label.protected
IndexableType
(@NonNull String value, String label, IndexableType parent, boolean translatable, boolean vendorBehavior, com.broadleafcommerce.data.tracking.core.TrackableBehavior... behaviors) Constructs an instance ofIndexableType
with a parent. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
static IndexableType
fromString
(String stringValue) static Collection<IndexableType>
Get all of the existing indexable types.List<com.broadleafcommerce.data.tracking.core.TrackableBehavior>
The trackable behaviors which apply to objects of this indexable type.final Set<IndexableType>
Returns a set ofIndexableType
instances that have this instance as a parent.static IndexableType
getInstance
(String type) Retrieves an IndexableType based on its String representation.getLabel()
The label representation of the indexable type shown for administration.Some of these enumerated types can have a parent or common type.Recursively finds the highest level ancestor for thisIndexableType
.final com.broadleafcommerce.data.tracking.core.TrackableBehaviorPackage
Produce aTrackableBehaviorPackage
for the behaviors on this indexable type.getType()
The named representation of the indexable type.int
hashCode()
boolean
hasTrackableBehavior
(com.broadleafcommerce.data.tracking.core.TrackableBehavior trackableBehavior) Check whether or not objects of this indexable type exhibit the givenTrackableBehavior
.boolean
Whether or not objects of this indexable type are translatable.boolean
Whether or not objects of this indexable type can be discriminated by vendortoString()
-
Constructor Details
-
IndexableType
protected IndexableType(@NonNull @NonNull String value, boolean translatable, com.broadleafcommerce.data.tracking.core.TrackableBehavior... behaviors) Constructs anIndexableType
from a String. The convention is to use all capital letters with underscores (_) instead of spaces.- Parameters:
value
- the named representation of the typetranslatable
- whether or not objects of this indexable type are translatablebehaviors
- trackable behaviors which apply to objects of this indexable type
-
IndexableType
protected IndexableType(@NonNull @NonNull String value, @Nullable String label, boolean translatable, com.broadleafcommerce.data.tracking.core.TrackableBehavior... behaviors) Constructs anIndexableType
from a String with a label. The convention is to use all capital letters with underscores (_) instead of spaces.- Parameters:
value
- the named representation of the typetranslatable
- whether or not objects of this indexable type are translatablebehaviors
- trackable behaviors which apply to objects of this indexable type
-
IndexableType
protected IndexableType(@NonNull @NonNull String value, @Nullable String label, boolean translatable, boolean vendorBehavior, com.broadleafcommerce.data.tracking.core.TrackableBehavior... behaviors) Constructs anIndexableType
from a String with a label. The convention is to use all capital letters with underscores (_) instead of spaces.- Parameters:
value
- the named representation of the typetranslatable
- whether or not objects of this indexable type are translatablevendorBehavior
- whether or not objects of this indexable type can be vendor discriminatedbehaviors
- trackable behaviors which apply to objects of this indexable type
-
IndexableType
protected IndexableType(@NonNull @NonNull String value, @Nullable String label, @Nullable IndexableType parent, boolean translatable, boolean vendorBehavior, com.broadleafcommerce.data.tracking.core.TrackableBehavior... behaviors) Constructs an instance ofIndexableType
with a parent. The parent may be (and often will be) null. Note that a parent must not also have a parent. The parent is meant to simply be a container or marker for other similar types.IndexableType
s that have children can be thought of like abstract types in that they typically represent a group of other types.For example, imagine that there is a CATALOG type, which could be the parent of PRODUCT and CATEGORY. In this case, PRODUCT and CATEGORY would have a parent of CATALOG, and CATALOG would have no parent. CATALOG would be like an abstract type in that the concrete types are PRODUCT and CATEGORY, for example.
- Parameters:
value
- the named representation of the typeparent
- the parent of this typetranslatable
- whether or not objects of this indexable type are translatablevendorBehavior
- whether or not objects of this indexable type can be vendor discriminatedbehaviors
- trackable behaviors which apply to objects of this indexable type
-
-
Method Details
-
hasTrackableBehavior
public boolean hasTrackableBehavior(com.broadleafcommerce.data.tracking.core.TrackableBehavior trackableBehavior) Check whether or not objects of this indexable type exhibit the givenTrackableBehavior
.- Parameters:
trackableBehavior
- the behavior to check for- Returns:
- whether or not objects of this indexable type exhibit the given behavior
-
getTopLevelAncestor
Recursively finds the highest level ancestor for thisIndexableType
. If thisIndexableType
does not have a parent, then it is the highest level ancestor.- Returns:
- The highest level ancestor of this type; or this type if it has no ancestors.
-
getChildren
Returns a set ofIndexableType
instances that have this instance as a parent. An empty set will be returned if no types have this as a parent.- Returns:
- the direct children of this type
-
getTrackableBehaviorPackage
public final com.broadleafcommerce.data.tracking.core.TrackableBehaviorPackage getTrackableBehaviorPackage()Produce aTrackableBehaviorPackage
for the behaviors on this indexable type.- Returns:
- TrackableBehaviorPackage for the behaviors on this indexable type
-
getInstance
Retrieves an IndexableType based on its String representation.- Parameters:
type
- The type of this indexable (e.g. PRODUCT, ORDER, CUSTOMER, etc)- Returns:
- The IndexableType associated with this type.
- Throws:
IllegalArgumentException
- if the IndexableType is not found.
-
getAllIndexableTypes
Get all of the existing indexable types.- Returns:
- all of the existing indexable types
-
fromString
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getType
The named representation of the indexable type.- Returns:
- The named representation of the indexable type.
-
getLabel
The label representation of the indexable type shown for administration.- Returns:
- The label representation of the indexable type shown for administration.
-
getParent
Some of these enumerated types can have a parent or common type. For example, imagine that there is a CATALOG type, which could be the parent of PRODUCT and CATEGORY. In this case, PRODUCT and CATEGORY would have a parent of CATALOG, and CATALOG would have no parent.- Returns:
- the parent of this type
-
getBehaviors
The trackable behaviors which apply to objects of this indexable type.- Returns:
- trackable behaviors which apply to objects of this indexable type
-
isTranslatable
public boolean isTranslatable()Whether or not objects of this indexable type are translatable.- Returns:
- whether or not objects of this indexable type are translatable
-
isVendorBehavior
public boolean isVendorBehavior()Whether or not objects of this indexable type can be discriminated by vendor- Returns:
- whether or not objects of this indexable type can be discriminated by vendor
-