Search in sources :

Example 6 with PostLoaderDao

use of org.broadleafcommerce.common.persistence.PostLoaderDao in project BroadleafCommerce by BroadleafCommerce.

the class BundleOrderItemImpl method getProductBundle.

@Override
public ProductBundle getProductBundle() {
    if (deproxiedProductBundle == null) {
        PostLoaderDao postLoaderDao = DefaultPostLoaderDao.getPostLoaderDao();
        if (postLoaderDao != null && productBundle.getId() != null) {
            Long id = productBundle.getId();
            deproxiedProductBundle = postLoaderDao.find(ProductBundleImpl.class, id);
        } else if (productBundle instanceof HibernateProxy) {
            deproxiedProductBundle = HibernateUtils.deproxy(productBundle);
        } else {
            deproxiedProductBundle = productBundle;
        }
    }
    return deproxiedProductBundle;
}
Also used : ProductBundleImpl(org.broadleafcommerce.core.catalog.domain.ProductBundleImpl) DefaultPostLoaderDao(org.broadleafcommerce.common.persistence.DefaultPostLoaderDao) PostLoaderDao(org.broadleafcommerce.common.persistence.PostLoaderDao) HibernateProxy(org.hibernate.proxy.HibernateProxy)

Example 7 with PostLoaderDao

use of org.broadleafcommerce.common.persistence.PostLoaderDao in project BroadleafCommerce by BroadleafCommerce.

the class DiscreteOrderItemImpl method getSku.

@Override
public Sku getSku() {
    if (deproxiedSku == null) {
        PostLoaderDao postLoaderDao = DefaultPostLoaderDao.getPostLoaderDao();
        if (postLoaderDao != null && sku.getId() != null) {
            Long id = sku.getId();
            deproxiedSku = postLoaderDao.find(SkuImpl.class, id);
        } else if (sku instanceof HibernateProxy) {
            deproxiedSku = HibernateUtils.deproxy(sku);
        } else {
            deproxiedSku = sku;
        }
    }
    return deproxiedSku;
}
Also used : SkuImpl(org.broadleafcommerce.core.catalog.domain.SkuImpl) DefaultPostLoaderDao(org.broadleafcommerce.common.persistence.DefaultPostLoaderDao) PostLoaderDao(org.broadleafcommerce.common.persistence.PostLoaderDao) HibernateProxy(org.hibernate.proxy.HibernateProxy)

Example 8 with PostLoaderDao

use of org.broadleafcommerce.common.persistence.PostLoaderDao in project BroadleafCommerce by BroadleafCommerce.

the class DiscreteOrderItemImpl method getProduct.

@Override
public Product getProduct() {
    if (deproxiedProduct == null) {
        PostLoaderDao postLoaderDao = DefaultPostLoaderDao.getPostLoaderDao();
        if (product != null && postLoaderDao != null && product.getId() != null) {
            Long id = product.getId();
            deproxiedProduct = postLoaderDao.find(ProductImpl.class, id);
        } else if (product instanceof HibernateProxy) {
            deproxiedProduct = HibernateUtils.deproxy(product);
        } else {
            deproxiedProduct = product;
        }
    }
    return deproxiedProduct;
}
Also used : ProductImpl(org.broadleafcommerce.core.catalog.domain.ProductImpl) DefaultPostLoaderDao(org.broadleafcommerce.common.persistence.DefaultPostLoaderDao) PostLoaderDao(org.broadleafcommerce.common.persistence.PostLoaderDao) HibernateProxy(org.hibernate.proxy.HibernateProxy)

Example 9 with PostLoaderDao

use of org.broadleafcommerce.common.persistence.PostLoaderDao in project BroadleafCommerce by BroadleafCommerce.

the class SkuBundleItemImpl method getBundle.

@Override
public ProductBundle getBundle() {
    // the bundle is lazy loaded).
    if (deproxiedBundle == null) {
        PostLoaderDao postLoaderDao = DefaultPostLoaderDao.getPostLoaderDao();
        Long id = bundle.getId();
        if (postLoaderDao != null && id != null) {
            deproxiedBundle = postLoaderDao.findSandboxEntity(ProductBundleImpl.class, id);
        } else if (bundle instanceof HibernateProxy) {
            deproxiedBundle = HibernateUtils.deproxy(bundle);
        } else {
            deproxiedBundle = bundle;
        }
    }
    if (deproxiedBundle instanceof HibernateProxy) {
        deproxiedBundle = HibernateUtils.deproxy(bundle);
    }
    return deproxiedBundle;
}
Also used : DefaultPostLoaderDao(org.broadleafcommerce.common.persistence.DefaultPostLoaderDao) PostLoaderDao(org.broadleafcommerce.common.persistence.PostLoaderDao) HibernateProxy(org.hibernate.proxy.HibernateProxy) RequiredOverride(org.broadleafcommerce.common.presentation.RequiredOverride)

Example 10 with PostLoaderDao

use of org.broadleafcommerce.common.persistence.PostLoaderDao in project BroadleafCommerce by BroadleafCommerce.

the class SkuBundleItemImpl method getSku.

@Override
public Sku getSku() {
    // the sku is lazy loaded).
    if (deproxiedSku == null) {
        PostLoaderDao postLoaderDao = DefaultPostLoaderDao.getPostLoaderDao();
        Long id = sku.getId();
        if (postLoaderDao != null && id != null) {
            deproxiedSku = postLoaderDao.findSandboxEntity(SkuImpl.class, id);
        } else if (sku instanceof HibernateProxy) {
            deproxiedSku = HibernateUtils.deproxy(sku);
        } else {
            deproxiedSku = sku;
        }
    }
    if (deproxiedSku instanceof HibernateProxy) {
        deproxiedSku = HibernateUtils.deproxy(sku);
    }
    return deproxiedSku;
}
Also used : DefaultPostLoaderDao(org.broadleafcommerce.common.persistence.DefaultPostLoaderDao) PostLoaderDao(org.broadleafcommerce.common.persistence.PostLoaderDao) HibernateProxy(org.hibernate.proxy.HibernateProxy) RequiredOverride(org.broadleafcommerce.common.presentation.RequiredOverride)

Aggregations

DefaultPostLoaderDao (org.broadleafcommerce.common.persistence.DefaultPostLoaderDao)16 PostLoaderDao (org.broadleafcommerce.common.persistence.PostLoaderDao)16 HibernateProxy (org.hibernate.proxy.HibernateProxy)16 AdminPresentationMergeOverride (org.broadleafcommerce.common.presentation.override.AdminPresentationMergeOverride)5 RequiredOverride (org.broadleafcommerce.common.presentation.RequiredOverride)2 SkuImpl (org.broadleafcommerce.core.catalog.domain.SkuImpl)2 CategoryImpl (org.broadleafcommerce.core.catalog.domain.CategoryImpl)1 ProductBundleImpl (org.broadleafcommerce.core.catalog.domain.ProductBundleImpl)1 ProductImpl (org.broadleafcommerce.core.catalog.domain.ProductImpl)1 OfferImpl (org.broadleafcommerce.core.offer.domain.OfferImpl)1