public List<ConversationEntry> getConversationEntries() { return new ArrayList<ConversationEntry>( ConversationEntries.instance().getConversationEntries() ); }
public ConversationEntry getCurrentConversationEntry() { if (currentConversationEntry==null) { currentConversationEntry = ConversationEntries.instance().getConversationEntry( getCurrentConversationId() ); } return currentConversationEntry; }
/** * Clean up all state associated with a conversation */ private void destroyConversation(String conversationId, Map<String, Object> session) { Lifecycle.destroyConversationContext(session, conversationId); ConversationEntries.instance().removeConversationEntry(conversationId); }
protected List<ConversationEntry> createConversationEntryList() { ConversationEntries conversationEntries = ConversationEntries.getInstance(); if (conversationEntries==null) { return Collections.EMPTY_LIST; } else { Set<ConversationEntry> orderedEntries = new TreeSet<ConversationEntry>(); orderedEntries.addAll( conversationEntries.getConversationEntries() ); List<ConversationEntry> conversationEntryList = new ArrayList<ConversationEntry>( conversationEntries.size() ); for ( ConversationEntry entry: orderedEntries ) { if ( entry.isDisplayable() && !Session.instance().isInvalid() ) { conversationEntryList.add(entry); } } return conversationEntryList; } }
if ( ConversationEntries.instance().getConversationIds().contains(id) ) ConversationEntry ce = ConversationEntries.instance().updateConversationId(currentConversationId, id); String priorId = currentConversationId; setCurrentConversationId(id);
private ConversationEntry createConversationEntry() { ConversationEntry entry = ConversationEntries.instance() .createConversationEntry( getCurrentConversationId(), getCurrentConversationIdStack() ); if ( !entry.isNested() ) { //if it is a newly created nested //conversation, we already own the //lock entry.lock(); } return entry; }
protected List<ConversationEntry> createConversationEntryStack() ConversationEntries conversationEntries = ConversationEntries.getInstance(); if (conversationEntries==null) List<ConversationEntry> conversationEntryStack = new ArrayList<ConversationEntry>( conversationEntries.size() ); ListIterator<String> ids = idStack.listIterator( idStack.size() ); while ( ids.hasPrevious() ) ConversationEntry entry = conversationEntries.getConversationEntry( ids.previous() ); if ( entry.isDisplayable() && !Session.instance().isInvalid() )
Contexts.sessionContext.set(tempSessionContext); Set<String> conversationIds = ConversationEntries.instance().getConversationIds(); log.debug("destroying conversation contexts: " + conversationIds); for (String conversationId: conversationIds)
ConversationEntries conversationEntries = ConversationEntries.getInstance(); if (conversationEntries!=null) List<ConversationEntry> entries = new ArrayList<ConversationEntry>( conversationEntries.getConversationEntries() ); for (ConversationEntry conversationEntry: entries)
void setDescription(String description) { entries.setDirty(this.description, description); this.description = description; }
private void removeCurrentConversationAndDestroyNestedContexts(Map<String, Object> session) { ConversationEntries conversationEntries = ConversationEntries.getInstance(); if (conversationEntries!=null) { conversationEntries.removeConversationEntry( getCurrentConversationId() ); destroyNestedConversationContexts( session, getCurrentConversationId() ); } }
public ConversationEntry(String id, List<String> stack, ConversationEntries entries) { this.id = id; if (stack==null) throw new IllegalArgumentException("Stack must not be null"); if (id==null) throw new IllegalArgumentException("id must not be null"); this.conversationIdStack = stack; this.startDatetime = new Date(); this.entries = entries; if ( conversationIdStack.size()>1 ) { // get the root conversation entry lock (we want to share the same lock // among all nested conversations in the same conversation stack) lock = entries.getConversationEntry( conversationIdStack.get( conversationIdStack.size()-1 ) ).lock; } else { lock = new ReentrantLock(true); } touch(); }
@Create public void createSelectItems() { ConversationEntries conversationEntries = ConversationEntries.getInstance(); if (conversationEntries==null) { selectItems = Collections.EMPTY_LIST; } else { Set<ConversationEntry> orderedEntries = new TreeSet<ConversationEntry>(); orderedEntries.addAll( conversationEntries.getConversationEntries() ); selectItems = new ArrayList<SelectItem>( conversationEntries.size() ); for ( ConversationEntry entry: orderedEntries ) { if ( entry.isDisplayable() && !Session.instance().isInvalid() ) { selectItems.add( new SelectItem( entry.getId(), entry.getDescription() ) ); } } } }
void setTimeout(int conversationTimeout) { entries.setDirty(this.timeout, timeout); this.timeout = conversationTimeout; }
public String getParentConversationViewId() { ConversationEntry conversationEntry = ConversationEntries.instance().getConversationEntry(getParentConversationId()); return conversationEntry==null ? null : conversationEntry.getViewId(); }
private void endNestedConversations(String id) { for ( ConversationEntry ce: ConversationEntries.instance().getConversationEntries() ) { if ( ce.getConversationIdStack().contains(id) ) { ce.end(); } } }
void setConcurrentRequestTimeout(Integer concurrentRequestTimeout) { entries.setDirty(this.concurrentRequestTimeout, concurrentRequestTimeout); this.concurrentRequestTimeout = concurrentRequestTimeout; }
private void touchConversationStack(List<String> stack) { if ( stack!=null ) { //iterate in reverse order, so that current conversation //sits at top of conversation lists ListIterator<String> iter = stack.listIterator( stack.size() ); while ( iter.hasPrevious() ) { String conversationId = iter.previous(); ConversationEntry conversationEntry = ConversationEntries.instance().getConversationEntry(conversationId); if (conversationEntry!=null) { conversationEntry.touch(); } } } }
private void destroyNestedConversationContexts(Map<String, Object> session, String conversationId) { List<ConversationEntry> entries = new ArrayList<ConversationEntry>( ConversationEntries.instance().getConversationEntries() ); for ( ConversationEntry ce: entries ) { if ( ce.getConversationIdStack().contains(conversationId) ) { String entryConversationId = ce.getId(); log.debug("destroying nested conversation: " + entryConversationId); destroyConversation(entryConversationId, session); } } }
void setViewId(String viewId) { entries.setDirty(this.viewId, viewId); this.viewId = viewId; }