本文整理汇总了Java中javax.enterprise.context.ConversationScoped类的典型用法代码示例。如果您正苦于以下问题:Java ConversationScoped类的具体用法?Java ConversationScoped怎么用?Java ConversationScoped使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConversationScoped类属于javax.enterprise.context包,在下文中一共展示了ConversationScoped类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startAsynchronous
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
/**
* Does actually not work
*/
@Override
@Asynchronous
public void startAsynchronous(final IWorkflowListener listener)
{
try
{
CdiContextAwareRunnable runnable = new CdiContextAwareRunnable(this.newWorkflowRunnable(listener));
// runnable.addContext(RequestScoped.class);
runnable.addContext(SessionScoped.class);
// runnable.addContext(ApplicationScoped.class);
runnable.addContext(ConversationScoped.class);
runnable.run();
}
catch (WorkflowException e)
{
LOG.error(e.getMessage(), e);
}
}
示例2: isPassivatingScope
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
public boolean isPassivatingScope() {
final CdiEjbBean<?> bean = get(CdiEjbBean.class);
if (bean == null) {
return true;
}
if (ConversationScoped.class == bean.getScope()) {
try {
return !bean.getWebBeansContext().getConversationManager().getConversationBeanReference().isTransient();
} catch (final RuntimeException re) { // conversation not found for instance so act as @RequestScoped
return false;
}
}
return true;
}
示例3: startConversation
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
@Before
public void startConversation() {
final WebBeansContext webBeansContext = WebBeansContext.currentInstance();
webBeansContext.registerService(ConversationService.class, new ConversationService() {
@Override
public String getConversationId() {
return "conversation-test";
}
@Override
public String generateConversationId() {
return "cid_1";
}
});
webBeansContext.getService(ContextsService.class).startContext(ConversationScoped.class, null);
}
示例4: startContexts
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
@Override
public void startContexts()
{
wrapped.startContexts();
if (isManualScopeHandling())
{
for (ExternalContainer externalContainer : CdiTestRunner.getActiveExternalContainers())
{
externalContainer.startScope(Singleton.class);
externalContainer.startScope(ApplicationScoped.class);
externalContainer.startScope(RequestScoped.class);
externalContainer.startScope(SessionScoped.class);
externalContainer.startScope(ConversationScoped.class);
}
}
}
示例5: stopContexts
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
@Override
public void stopContexts()
{
if (isManualScopeHandling())
{
for (ExternalContainer externalContainer : CdiTestRunner.getActiveExternalContainers())
{
externalContainer.stopScope(ConversationScoped.class);
externalContainer.stopScope(SessionScoped.class);
externalContainer.stopScope(RequestScoped.class);
externalContainer.stopScope(ApplicationScoped.class);
externalContainer.stopScope(Singleton.class);
}
}
wrapped.stopContexts();
}
示例6: startContext
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
@Override
public void startContext(Class<? extends Annotation> scopeClass)
{
if (scopeClass.isAssignableFrom(ApplicationScoped.class))
{
startApplicationScope();
}
else if (scopeClass.isAssignableFrom(SessionScoped.class))
{
startSessionScope();
}
else if (scopeClass.isAssignableFrom(RequestScoped.class))
{
startRequestScope();
}
else if (scopeClass.isAssignableFrom(ConversationScoped.class))
{
startConversationScope();
}
}
示例7: stopContext
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
public void stopContext(Class<? extends Annotation> scopeClass)
{
if (scopeClass.isAssignableFrom(ApplicationScoped.class))
{
stopApplicationScope();
}
else if (scopeClass.isAssignableFrom(SessionScoped.class))
{
stopSessionScope();
}
else if (scopeClass.isAssignableFrom(RequestScoped.class))
{
stopRequestScope();
}
else if (scopeClass.isAssignableFrom(ConversationScoped.class))
{
stopConversationScope();
}
}
示例8: startContext
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
@Override
public void startContext(Class<? extends Annotation> scopeClass)
{
if (scopeClass.isAssignableFrom(ApplicationScoped.class))
{
startApplicationScope();
}
else if (scopeClass.isAssignableFrom(SessionScoped.class))
{
startSessionScope();
}
else if (scopeClass.isAssignableFrom(RequestScoped.class))
{
startRequestScope();
}
else if (scopeClass.isAssignableFrom(ConversationScoped.class))
{
startConversationScope(null);
}
}
示例9: stopContext
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
@Override
public void stopContext(Class<? extends Annotation> scopeClass)
{
if (scopeClass.isAssignableFrom(ApplicationScoped.class))
{
stopApplicationScope();
}
else if (scopeClass.isAssignableFrom(SessionScoped.class))
{
stopSessionScope();
}
else if (scopeClass.isAssignableFrom(RequestScoped.class))
{
stopRequestScope();
}
else if (scopeClass.isAssignableFrom(ConversationScoped.class))
{
stopConversationScope();
}
}
示例10: createDeployment
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
@Deployment
public static WebArchive createDeployment() {
String url = SimpleGetApi.class.getName() + "/mp-rest/url=http://localhost:8080";
String url2 = MyConversationScopedApi.class.getName() + "/mp-rest/url=http://localhost:8080";
String scope = SimpleGetApi.class.getName() + "/mp-rest/scope=" + ConversationScoped.class.getName();
JavaArchive jar = ShrinkWrap.create(JavaArchive.class)
.addClasses(SimpleGetApi.class, MyConversationScopedApi.class)
.addAsManifestResource(new StringAsset(url + "\n" + scope + "\n" + url2), "microprofile-config.properties")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
return ShrinkWrap.create(WebArchive.class)
.addAsLibrary(jar)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
示例11: cdiScopeAnnotationsConfigurer
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
@Bean
@ConditionalOnProperty(value = "jsf.scope-configurer.cdi.enabled", havingValue = "true", matchIfMissing = true)
public static BeanFactoryPostProcessor cdiScopeAnnotationsConfigurer(Environment environment) {
CustomScopeAnnotationConfigurer scopeAnnotationConfigurer = new CustomScopeAnnotationConfigurer();
scopeAnnotationConfigurer.setOrder(environment.getProperty("jsf.scope-configurer.cdi.order", Integer.class, Ordered.LOWEST_PRECEDENCE));
scopeAnnotationConfigurer.addMapping(RequestScoped.class, WebApplicationContext.SCOPE_REQUEST);
scopeAnnotationConfigurer.addMapping(SessionScoped.class, WebApplicationContext.SCOPE_SESSION);
scopeAnnotationConfigurer.addMapping(ConversationScoped.class, WebApplicationContext.SCOPE_SESSION);
scopeAnnotationConfigurer.addMapping(ApplicationScoped.class, WebApplicationContext.SCOPE_APPLICATION);
return scopeAnnotationConfigurer;
}
示例12: produce
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
@ExtensionManaged
@Produces
@ConversationScoped
public EntityManager produce()
{
EntityManager entityManager = entityManagerFactory.createEntityManager();
// .. do somthing with entity manager
return entityManager;
}
示例13: getEntityManagerFactory
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
@Produces
@ConversationScoped
@PersistenceUnit
@Default
public EntityManagerFactory getEntityManagerFactory() {
return emf;
}
示例14: create
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
@Produces
@Main
@ConversationScoped
public EntityManager create()
{
return this.emfA.createEntityManager();
}
示例15: getCurrentItem
import javax.enterprise.context.ConversationScoped; //导入依赖的package包/类
/**
* Produces the selected item for the current context
* @return
*/
@Produces @SelectedItem @Named("selectedItem") @ConversationScoped
public Item getCurrentItem() {
if(item == null) {
item = new Item();
}
return item;
}