public boolean isSet(String name) { return get(name)!=null; }
public void clear() { additions.clear(); removals.addAll( getNamesFromSession() ); }
boolean longRunning = !isCurrent() || Manager.instance().isLongRunningConversation(); for (String key: getNamesForAllConversationsFromSession()) { Object attribute = session.get(key); if (passivate(attribute) || isAttributeDirty(attribute)) { session.put(key, attribute); session.remove(getKey(name)); Object attribute = entry.getValue(); passivate(attribute); session.put(getKey(entry.getKey()), attribute); for (String name: getNamesFromSession()) { session.remove( getKey(name) ); session.remove(getKey(name));
public static void resumeConversation(ExternalContext externalContext) { ServerConversationContext conversationContext = new ServerConversationContext( externalContext.getSessionMap() ); /*Context conversationContext = Init.instance().isClientSideConversations() ? (Context) new ClientConversationContext() : (Context) new ServerConversationContext( externalContext.getSessionMap() );*/ Contexts.conversationContext.set(conversationContext); Contexts.businessProcessContext.set( new BusinessProcessContext() ); conversationContext.unflush(); }
if (result!=null) return unwrapEntityBean(result); List<String> stack = getIdStack(); if (stack==null) return unwrapEntityBean( session.get( getKey(name) ) ); result = session.get( getKey(name, id) ); return unwrapEntityBean(result); if ( i==0 && isPerNestedConversation(name) )
/** * Destroy a conversation context that is not currently bound to the request, called * due to a timeout. * * @param session the current session, to which both current and destroyed conversation belong * @param conversationId the conversation id of the conversation to be destroyed */ static void destroyConversationContext(Map<String, Object> session, String conversationId) { Context current = getConversationContext(); ServerConversationContext temp = new ServerConversationContext(session, conversationId); conversationContext.set(temp); try { destroy(temp); if ( !Session.instance().isInvalid() ) //its also unnecessary during a session timeout { temp.clear(); temp.flush(); } } finally { conversationContext.set(current); } }
static Map getConversationCache() { Map convCache = new HashMap(); String convId = findConversationId(); if (convId == null) return convCache; Context conversationContext = new ServerConversationContext(sessionMap(), convId); for (String name : conversationContext.getNames() ) { Object value = conversationContext.get(name); convCache.put(name, value); } return convCache; }
private String getKey(String name, String id) { return getPrefix(id) + name; }
@Override public String toString() { return "ConversationContext(" + getId() + ")"; }
public void unflush() { for ( String key: getNamesForAllConversationsFromSession() ) { Object attribute = session.get(key); if ( attribute!=null && attribute instanceof Wrapper ) { ( (Wrapper) attribute ).activate(); } } }
public static void resumeConversation(HttpServletRequest request) { ServerConversationContext conversationContext = new ServerConversationContext( new ServletRequestSessionMap(request) ); Contexts.conversationContext.set(conversationContext); Contexts.businessProcessContext.set( new BusinessProcessContext() ); conversationContext.unflush(); } /**
private Set<String> getNamesForAllConversationsFromSession() { Set<String> results = new HashSet<String>(); List<String> ids = Manager.instance().getCurrentConversationIdStack(); if (ids != null) { for (String conversationId: ids) { String prefix = getPrefix(conversationId); for (String name: session.keySet()) { if (name.startsWith(prefix)) { String shortName = name.substring(prefix.length()); if (!removals.contains(shortName)) { results.add(name); } } } } } return results; }
ServerConversationContext conversationContext = new ServerConversationContext( externalContext.getSessionMap() ); Contexts.conversationContext.set(conversationContext); if (conversationContextFlushed) conversationContext.unflush();
private Set<String> getNamesFromSession() { HashSet<String> results = new HashSet<String>(); String prefix = getPrefix(getId()); for (String name: session.keySet()) { if (name.startsWith(prefix)) { name = name.substring(prefix.length()); if (!removals.contains(name)) { results.add(name); } } } return results; }
public String[] getNames() { Set<String> results = getNamesFromSession(); results.addAll( additions.keySet() ); //after, to override return results.toArray(new String[]{}); }
public Object get(Class clazz) { return get( Component.getComponentName(clazz) ); }