This post builds upon a previous post, WebSphere Commerce v7.0 Store Functions, and goes into the checking the status of enabled or disabled store functions within your Java code. For an introduction to store functions, please reference the previously mentioned article.
Traditionally store functions (change flows) were JSP and page layout controls. They allowed you to include or exclude necessary page elements within your JSPs. When they moved the management of the store functions into the marketing database, it allowed for easier use of the store functions within your Java code, thereby allowing you to completely turn on/off features as desired for your storefront.
I’ve created the following methods to be placed within a utility class to determine whether or not your store function is enabled or disabled within your Java code, allowing you to act accordingly. These functions leverage the same logic and utility as the JSTL tag library that is used within yours JSPS, allowing you to leverage the caching component already in place for store functions.
/** * @param storeFunctionName Object. * @return storeFunctionStatusEnabled Object. */ public static Boolean isStoreFunctionEnabled(String storeFunctionName) { Boolean storeFunctionStatusEnabled = false; // Re-Leverage TagHandlerHelper (Flex-Flow Tag Cache, ETC...) storeFunctionStatusEnabled = TagHandlerHelper.isFeatureEnabled(storeFunctionName); return storeFunctionStatusEnabled; } /** * @param storeFunctionName Object. * @return !(storeFunctionStatusEnabled) Object. */ public static Boolean isStoreFunctionDisabled(String storeFunctionName) { Boolean storeFunctionStatusDisabled = false; // Re-Leverage TagHandlerHelper (Flex-Flow Tag Cache, ETC...) storeFunctionStatusDisabled = !(TagHandlerHelper.isFeatureEnabled(storeFunctionName)); return storeFunctionStatusDisabled; }
Drew,
This quite helpful functionality will provide us more flexibility at back-end too as we get at front end where in Business user can enable and disable the functionality they need.