@Override public void sendMessage(Message message, Address[] recipients) throws MessagingException { Contexts.getApplicationContext().set(VAR_NAME, message); }
@SuppressWarnings("unchecked") private static Map<String, String> getSpringComponentNameMap() { if (Contexts.getApplicationContext().get(SPRING_COMPONENT_NAME_MAP) == null) { Contexts.getApplicationContext().set(SPRING_COMPONENT_NAME_MAP, new HashMap<String, String>()); } return (Map<String, String>) Contexts.getApplicationContext().get(SPRING_COMPONENT_NAME_MAP); }
/** * Restores the state of the event context. If the value is stored away, it is restored * It it was not in the map, it was not in the context in the first place so clean * up what we have placed there during this run. * * @param names The list of context keys to restore * @param context The context to target */ private void restoreOriginalValues(String[] names, Context context) { for (String name : names) { if (originalValues.containsKey(name)) { context.set(name, originalValues.get(name)); } else { context.remove(name); } } }
String[] names = Contexts.getConversationContext().getNames(); Object[] values = new Object[names.length]; for (int i=0; i<names.length; i++) values[i] = Contexts.getConversationContext().get(names[i]); Contexts.getConversationContext().remove(names[i]); Contexts.getConversationContext().flush(); Contexts.getConversationContext().set(names[i], values[i]);
/** * Get the most recently rendered message sent using the MockTransport. */ public static MimeMessage getMailMessage() { return (MimeMessage) Contexts.getApplicationContext().get(VAR_NAME); }
/** * @return Map session */ private Map<String, Object> getSessionMap() { // this method could be moved to a utility class Map<String, Object> session = new HashMap<String, Object>(); String[] sessionAttributeNames = Contexts.getSessionContext().getNames(); for (String attributeName : sessionAttributeNames) { session.put(attributeName, Contexts.getSessionContext().get(attributeName)); } return session; }
if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.preDestroyContext." + context.getType().toString()); for ( String name: context.getNames() ) if ( component!=null ) Object object = context.get(name); if (object!=null) //in a portal environment, this is possible if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.postDestroyContext." + context.getType().toString());
/** * Will attempt to authenticate quietly if the user's credentials are set and they haven't * authenticated already. A quiet authentication doesn't throw any exceptions if authentication * fails. * * @return true if the user is logged in, false otherwise */ public boolean tryLogin() { if (!authenticating && getPrincipal() == null && credentials.isSet() && Contexts.isEventContextActive() && !Contexts.getEventContext().isSet(LOGIN_TRIED)) { Contexts.getEventContext().set(LOGIN_TRIED, true); quietLogin(); } return isLoggedIn(); }
public String[] getApplication() { String[] names = org.jboss.seam.contexts.Contexts.getApplicationContext().getNames(); Arrays.sort(names); return names; }
private boolean isExceptionHandlerRedirect() { return Contexts.getConversationContext().isSet("org.jboss.seam.handledException"); }
public static DocumentsListsManager getDocumentListManager() { return (DocumentsListsManager) Contexts.getSessionContext().get("documentsListsManager"); }
/** * Store away the attribute from the event context (if it is set) * * @param names The list of context keys to store away * @param context The context to target */ private void storeOriginalValues(String[] names, Context context) { for (String name : names) { if (context.isSet(name)) { originalValues.put(name, context.get(name)); } } }
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; }
protected static List<String> listAllComponentsNames() { List<String> names = new ArrayList<>(); if (Contexts.isApplicationContextActive()) { for (String name : Contexts.getApplicationContext().getNames()) { if (name.endsWith(".component")) { names.add(name.replace(".component", "")); } } } return names; }
private boolean isExecutingAsynchronousCall() { return Contexts.getEventContext().isSet(AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL); }
public void setSearchFilter(String searchFilter) { Context pageContext = Contexts.getPageContext(); if (pageContext != null) { pageContext.set("searchFilter", searchFilter); } this.searchFilter = searchFilter; }