我想在hyrbis中触发电子邮件。为此,我已在相应的上下文文件中编写了一些代码。
public class AbcCartEmailContext extends AbstractEmailContext<AbcCartEmailProcessModel>
{
private final String myEmail = "tt@gmail.com";
private final String fromEmail = "yy@abc.com";
@Override
public void init(final AbcCartEmailProcessModel businessProcessModel, final EmailPageModel emailPageModel)`{
put(FROM_EMAIL, fromEmail);
put(EMAIL, myEmail);
}
@Override
protected BaseSiteModel getSite(final AbcCartEmailProcessModel businessProcessModel)
{
// YTODO Auto-generated method stub
return ((StoreFrontProcessModel) businessProcessModel).getSite();
}
@Override
protected CustomerModel getCustomer(final AbcCartEmailProcessModel businessProcessModel)
{
return ((StoreFrontCustomerProcessModel) businessProcessModel).getCustomer();
}
@Override
protected LanguageModel getEmailLanguage(final AbcCartEmailProcessModel businessProcessModel)
{
// YTODO Auto-generated method stub
return ((StoreFrontCustomerProcessModel) businessProcessModel).getLanguage();
}
}
现在,当我尝试在方法中使用以下代码行启动邮件时:
final AbcCartEmailProcessModel abcCartEmailProcess = (AbcCartEmailProcessModel) this.businessProcessService
.createProcess("abcCartEmailProcess" + System.currentTimeMillis(), "abcCartEmailProcess");
abcCartEmailProcess.setSite(baseSiteService.getCurrentBaseSite());
abcCartEmailProcess.setLanguage(xyzService.getLanguage(MyConstants.DEFAULT_LANGUAGE));
modelService.save(abcCartEmailProcess);
this.businessProcessService.startProcess(abcCartEmailProcess);
我收到以下错误:
ERROR [TaskExecutor-master-151-ProcessTask [879943539192]] [DefaultProcessContextResolutionStrategy] Failed to lookup BaseSite for BusinessProcess [AbcCartEmailProcessModel (8797633183742)]. Unable to setup session context.
ERROR [TaskExecutor-master-151-ProcessTask [879943539192]] [DefaultProcessContextResolutionStrategy] Failed to lookup BaseSite for BusinessProcess [AbcCartEmailProcessModel (8797633183742)]. Unable to get content catalog.
需要采取哪些措施来消除此错误或触发电子邮件。
答案 0 :(得分:0)
< th class="row-header ${!counter.first ? 'indent-class' : ''}">
正如您所看到的,public class DefaultBaseSiteService extends AbstractBusinessService implements BaseSiteService {
//...
protected BaseSiteModel getCurrentBaseSiteImpl() {
//...
return (BaseSiteModel)this.getSessionService().getAttribute("currentSite");
//...
}
//...
}
的默认实现从会话中检索currentSite(您在此级别不拥有)。
我建议你是否只有一个baseSite(大部分时间)使用简单的灵活搜索baseSiteService.getCurrentBaseSite()
来检索它,或者尝试@ alain.janinm命题它在大多数情况下应该有用。