Package com.github.overengineer.scope.conversation.context

Examples of com.github.overengineer.scope.conversation.context.ConversationContext


     * @param adapter
     * @param maxIdleTimeMillis
     * @return
     */
    public static ConversationContext begin(String name, ConversationAdapter adapter, long maxIdleTimeMillis, int maxInstances) {
        ConversationContext context = adapter.beginConversation(name, maxIdleTimeMillis, maxInstances);
        String id = context.getId();
        adapter.getViewContext().put(name, id);
        adapter.getRequestContext().put(name, id);
        return context;
    }
View Full Code Here


public class DefaultConversationContextTest extends SerializableObjectTest<DefaultConversationContext> {

    @Test
    public void testDefaultConversationContext() throws IOException, ClassNotFoundException {

        ConversationContext context = new DefaultConversationContext("testName", "testId", 5L);
        assertTrue(5L == context.getRemainingTime() || 4L == context.getRemainingTime());
        assertEquals("testName", context.getConversationName());
        assertEquals("testId", context.getId());
        context.put("bean", "beanValue");
        assertEquals("beanValue", context.get("bean"));
        context = SerializationTestingUtil.getSerializedCopy(context);
        assertEquals("testName", context.getConversationName());
        assertEquals("testId", context.getId());
        assertEquals("beanValue", context.get("bean"));
        assertEquals(5L, context.getRemainingTime());

        context.put("bean", null);
        assertNull(context.get("bean"));
    }
View Full Code Here

public class ProgrammaticModelDrivenConversationUtil {

    public static <T extends ProgrammaticModelDrivenConversation<?>> void begin(T controller, long maxIdleTime, int maxInstances) {
        Object model = controller.getModel();
        for (String conversationName : controller.getConversations()) {
            ConversationContext conversationContext = ConversationUtil.begin(conversationName, maxIdleTime, maxInstances);
            conversationContext.put(conversationName, model);
        }
    }
View Full Code Here

        String actionId = conversationAdapter.getActionId();
        String conversationName = conversationConfig.getConversationName();
        String conversationId = conversationAdapter.getRequestContext().get(conversationName);

        if (conversationId != null) {
            ConversationContext conversationContext = conversationAdapter.getConversationContext(conversationName, conversationId);
            if (conversationContext != null) {
                if (conversationConfig.containsAction(actionId)) {
                    if (conversationConfig.isEndAction(actionId)) {
                        this.handleEnding(conversationConfig, conversationAdapter, conversationContext);
                    } else {
View Full Code Here

        if (LOG.isDebugEnabled()) {
            LOG.debug("Beginning new [{}] with max idle time of [{}] seconds for action [{}]", conversationConfig.getConversationName(), maxIdleTime / 1000, conversationAdapter.getActionId());
        }

        ConversationContext newConversationContext = ConversationUtil.begin(conversationConfig.getConversationName(), conversationAdapter, maxIdleTime, conversationConfig.getMaxInstances(actionId));
        conversationAdapter.addPostActionProcessor(this, conversationConfig, newConversationContext.getId());
    }
View Full Code Here

TOP

Related Classes of com.github.overengineer.scope.conversation.context.ConversationContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.