001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 */
011
012package org.nuxeo.ecm.automation.jsf;
013
014import org.jboss.seam.contexts.Contexts;
015import org.nuxeo.ecm.platform.contentview.seam.ContentViewActions;
016import org.nuxeo.ecm.platform.ui.web.api.NavigationContext;
017import org.nuxeo.ecm.platform.ui.web.api.WebActions;
018import org.nuxeo.ecm.platform.ui.web.util.SeamComponentCallHelper;
019import org.nuxeo.ecm.webapp.contentbrowser.DocumentActions;
020import org.nuxeo.ecm.webapp.documentsLists.DocumentsListsManager;
021
022/**
023 * @author <a href="mailto:td@nuxeo.com">Thierry Delprat</a>
024 */
025public class OperationHelper {
026
027    public static boolean isSeamContextAvailable() {
028        return Contexts.isSessionContextActive();
029    }
030
031    public static NavigationContext getNavigationContext() {
032        return (NavigationContext) Contexts.getConversationContext().get("navigationContext");
033    }
034
035    public static DocumentsListsManager getDocumentListManager() {
036        return (DocumentsListsManager) Contexts.getSessionContext().get("documentsListsManager");
037    }
038
039    public static ContentViewActions getContentViewActions() {
040        return (ContentViewActions) Contexts.getConversationContext().get("contentViewActions");
041    }
042
043    public static WebActions getWebActions() {
044        return (WebActions) Contexts.getConversationContext().get("webActions");
045    }
046
047    public static DocumentActions getDocumentActions() {
048        return (DocumentActions) SeamComponentCallHelper.getSeamComponentByName("documentActions");
049    }
050
051}