Search in sources :

Example 1 with ItemStatus

use of org.broadleafcommerce.common.extension.ItemStatus in project BroadleafCommerce by BroadleafCommerce.

the class SparseTranslationOverrideStrategy method initializeOverride.

@Override
public StandardCacheItem initializeOverride(Object entity) {
    String key = getCacheKey((Translation) entity);
    String dto = ((Translation) entity).getTranslatedValue();
    StandardCacheItem cacheItem = new StandardCacheItem();
    ItemStatus status = ItemStatus.NORMAL;
    if (extensionManager != null) {
        ExtensionResultHolder<ItemStatus> response = new ExtensionResultHolder<ItemStatus>();
        ExtensionResultStatusType result = extensionManager.buildStatus(entity, response);
        if (ExtensionResultStatusType.NOT_HANDLED != result && response.getResult() != null) {
            status = response.getResult();
        }
    }
    cacheItem.setItemStatus(status);
    cacheItem.setKey(key);
    cacheItem.setCacheItem(dto);
    return cacheItem;
}
Also used : ItemStatus(org.broadleafcommerce.common.extension.ItemStatus) Translation(org.broadleafcommerce.common.i18n.domain.Translation) StandardCacheItem(org.broadleafcommerce.common.extension.StandardCacheItem) ExtensionResultStatusType(org.broadleafcommerce.common.extension.ExtensionResultStatusType) ExtensionResultHolder(org.broadleafcommerce.common.extension.ExtensionResultHolder)

Aggregations

ExtensionResultHolder (org.broadleafcommerce.common.extension.ExtensionResultHolder)1 ExtensionResultStatusType (org.broadleafcommerce.common.extension.ExtensionResultStatusType)1 ItemStatus (org.broadleafcommerce.common.extension.ItemStatus)1 StandardCacheItem (org.broadleafcommerce.common.extension.StandardCacheItem)1 Translation (org.broadleafcommerce.common.i18n.domain.Translation)1