1

我正在处理 Intershop 7 中的业务对象层,并尝试使用相关业务存储库(扩展)创建自定义业务对象A1PromotionBO 。

我已经完成了持久对象层(A1PromotionPO、Mgrs、EDL 模型、自动生成的类、数据库..)。

通过遵循这本 Cookbook - Business Objects ( https://support.intershop.com/kb/index.php/Display/27K270 ),我已经

创建的包 *.a1promotion.capi 包含:

 - interface A1PromotionBO extends BusinessObject
 - interface A1PromotionBORepository extends BusinessObjectRepository
 - interface A1PromotionBORepositoryExtension extends BusinessObjectExtension<RepositoryBO>, A1PromotionBORepository

创建的包 *.a1promotion.internal 包含:

 - class ORMA1PromotionBOImpl extends AbstractExtensibleObjectBO<A1PromotionPO> implements A1PromotionBO
 - class ORMA1PromotionBORepositoryImpl extends AbstractDomainRepositoryBOExtension implements A1PromotionBORepository, ObjectMapper<Object, A1PromotionBO>
 - class A1PromotionBORepositoryExtensionFactory extends AbstractDomainRepositoryBOExtensionFactory

EXTENSION_ID = "A1PromotionBORepository" 定义在接口 A1PromotionBORepositoryExtension 和类 A1PromotionBORepositoryExtensionFactory 中。


现在,返回 A1PromotionBO 集合的管道在创建 A1PromotionBORepository 促销BORepository 时在线失败:

public class GetPromotions extends Pipelet {
    @Inject
    private CurrentApplicationBOProvider applicationBOProvider;

    /** The domain mgr. */
    @Inject
    private DomainMgr domainMgr;

    @Override
    public int execute(PipelineDictionary dict) throws PipeletExecutionException {
        final ApplicationBO applicationBO = applicationBOProvider.get();
        final A1PromotionBORepository promotionBORepository = applicationBO.getRepository(A1PromotionBORepositoryExtensionFactory.EXTENSION_ID);

        final String promotionDomainName = dict.get("PromotionDomain");
        final Domain promotionDomain = domainMgr.getDomainByName(promotionDomainName);
        if (null == promotionDomain) {
            throw new PipeletExecutionException("Mandatory input parameter 'ProductsDomain' not available in pipeline dictionary.");
        }

        final Collection<A1PromotionBO> promotions = (Collection<A1PromotionBO>)promotionBORepository.getAllPromotions();
        dict.put("Promotions", promotions);

        return PIPELET_NEXT;
    }
}

异常的完整堆栈跟踪:

Caused by: com.intershop.component.application.capi.ApplicationBOException: Can not find business object factory with extensionID A1PromotionBORepository in application ApplicationBO(Shop@A1-Site (app=a1Shop.Backoffice))
    at com.intershop.component.application.internal.ApplicationBORepositoriesExtensionImpl.getRepository(ApplicationBORepositoriesExtensionImpl.java:49)
    at com.intershop.component.application.internal.ApplicationBOImpl.getRepository(ApplicationBOImpl.java:222)
    at hr.a1.bo.promotion.pipelet.GetPromotions.execute(GetPromotions.java:44)
    at com.intershop.beehive.core.internal.pipeline.PipeletNode.executeNode(PipeletNode.java:346)
    ... 42 more
4

0 回答 0