Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.webapp.context
Class NavigationContextBean

java.lang.Object
  extended by org.nuxeo.ecm.webapp.context.NavigationContextBean
All Implemented Interfaces:
Serializable, NavigationContext

@Name(value="navigationContext")
@Scope(value=CONVERSATION)
@Install(precedence=10)
public class NavigationContextBean
extends Object
implements NavigationContext, Serializable

Implementation for the navigationContext component available on the session.

See Also:
Serialized Form

Constructor Summary
NavigationContextBean()
           
 
Method Summary
 DocumentModel factoryChangeableDocument()
          Gets current document for edition.
 DocumentModel factoryCurrentContentRoot()
          Gets the currentContentRootWorkspace and puts it in Page context.
 DocumentModel factoryCurrentDocument()
          Gets the currentDocument and puts it in Page context.
 DocumentModelList factoryCurrentDocumentChildren()
          Gets children of currentDocuments and put it in Page context.
 DocumentModel factoryCurrentDomain()
          Gets the currentDomain and puts it in Page context.
 RepositoryLocation factoryCurrentServerLocation()
          Gets the current ServerLocation and puts it in Page Context.
 DocumentModel factoryCurrentSuperSpace()
          Gets the currentSuperSpace and puts it in Page context.
 DocumentModel factoryCurrentWorkspace()
          Gets the currentWorkspace and puts it in Page context.
 String getActionResult(DocumentModel doc, UserAction action)
          Performs context updates and returns the view associated with the document and action passed.
 DocumentModel getChangeableDocument()
          This is used for documents about to be created, which are not yet persisted thus not all their fields might be valid (like its reference).
 DocumentModel getCurrentContentRoot()
          Gets the current Content Root (Workspaces, Sections, Templates...).
 DocumentModel getCurrentDocument()
          Current Document other than Domain or Workspace.
 DocumentModelList getCurrentDocumentChildren()
          Deprecated. 
 DocumentModelList getCurrentDocumentChildrenPage()
          Deprecated. 
 String getCurrentDocumentFullUrl()
           
 String getCurrentDocumentUrl()
           
 DocumentModel getCurrentDomain()
          Current Domain, if user has read permission on it.
 String getCurrentDomainPath()
          Implementation details: the path to current domain is deduced from the path of current document (hardcoded rule that it'd be the first element).
 DocumentModelList getCurrentPath()
          Returns a list of the DocumentsModels (to build the BreadCrumb for example).
 List<PathElement> getCurrentPathList()
           
 RepositoryLocation getCurrentServerLocation()
           
 DocumentModel getCurrentSuperSpace()
          Returns the currentSuperSpace (Section, Workspace...).
 DocumentModel getCurrentWorkspace()
          Gets the current Workspace.
 CoreSession getOrCreateDocumentManager()
          Returns the current documentManager if any or create a new session to the current location.
 RepositoryLocation getSelectedServerLocation()
          Deprecated. use getCurrentServerLocation() instead
 String goBack()
           
 String goHome()
          go to the root server, the root document or to the dashboard if the latest document are not accessible.
 void init()
          Callback for component initialization.
 void invalidateChildrenProvider()
          Invalidates children provider (temporarily).
 void invalidateCurrentDocument()
          Will trigger reloading of current document data from the server.
 String navigateTo(RepositoryLocation serverLocation, DocumentRef docRef)
          Initializes the context for the given refs and returns the default view for the doc.
 String navigateToDocument(DocumentModel doc)
          Updates the context and returns the view for the given document.
 String navigateToDocument(DocumentModel doc, String viewId)
          Updates context with given document and returns given view.
 String navigateToDocument(DocumentModel docModel, VersionModel versionModel)
           
 String navigateToDocumentWithView(DocumentModel doc, String viewId)
          Alias to navigateToDocument(DocumentModel doc, String viewId) so that JSF EL sees no ambiguity)
 String navigateToId(String documentId)
          Updates the context and returns the view for the given document id.
 String navigateToRef(DocumentRef docRef)
          Updates the context and returns the view for the given document ref.
 String navigateToURL()
          Initializes the context for the given refs and returns the default view for the doc.
 String navigateToURL(String documentUrl)
          Initializes the context for the given refs and returns the default view for the doc.
 void resetCurrentContext()
          Resets all context variables.
 void saveCurrentDocument()
          Saves the current copy of the document to server.
 void selectionChanged()
           
 void setChangeableDocument(DocumentModel changeableDocument)
           
 void setCurrentContentRoot(DocumentModel crDocumentModel)
          Sets the current ContentRoot.
 void setCurrentDocument(DocumentModel documentModel)
           
 void setCurrentDomain(DocumentModel domainDocModel)
           
 void setCurrentServerLocation(RepositoryLocation serverLocation)
          Switches to a new server location by updating the context and updating to the CoreSession (DocumentManager).
 void setCurrentWorkspace(DocumentModel workspaceDocModel)
           
 void updateDocumentContext(DocumentModel doc)
          Updates the current document in the (session) context and resets the other common structures (breadcrumbs, etc).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NavigationContextBean

public NavigationContextBean()
Method Detail

init

@Create
public void init()
Description copied from interface: NavigationContext
Callback for component initialization.

Specified by:
init in interface NavigationContext

getCurrentDocument

@BypassInterceptors
public DocumentModel getCurrentDocument()
Description copied from interface: NavigationContext
Current Document other than Domain or Workspace.

Specified by:
getCurrentDocument in interface NavigationContext

getCurrentDomainPath

public String getCurrentDomainPath()
                            throws ClientException
Implementation details: the path to current domain is deduced from the path of current document (hardcoded rule that it'd be the first element).

If current document is null, then the first document found is used instead.

Specified by:
getCurrentDomainPath in interface NavigationContext
Returns:
the path
Throws:
ClientException

setCurrentDocument

public void setCurrentDocument(DocumentModel documentModel)
                        throws ClientException
Specified by:
setCurrentDocument in interface NavigationContext
Throws:
ClientException

getChangeableDocument

@BypassInterceptors
public DocumentModel getChangeableDocument()
Description copied from interface: NavigationContext
This is used for documents about to be created, which are not yet persisted thus not all their fields might be valid (like its reference).

Specified by:
getChangeableDocument in interface NavigationContext

setChangeableDocument

public void setChangeableDocument(DocumentModel changeableDocument)
Specified by:
setChangeableDocument in interface NavigationContext

getCurrentPath

public DocumentModelList getCurrentPath()
                                 throws ClientException
Description copied from interface: NavigationContext
Returns a list of the DocumentsModels (to build the BreadCrumb for example).

Specified by:
getCurrentPath in interface NavigationContext
Throws:
ClientException

getCurrentSuperSpace

public DocumentModel getCurrentSuperSpace()
                                   throws ClientException
Description copied from interface: NavigationContext
Returns the currentSuperSpace (Section, Workspace...). Uses SuperSpace facet for that.

Specified by:
getCurrentSuperSpace in interface NavigationContext
Throws:
ClientException

getCurrentDocumentChildren

@Deprecated
public DocumentModelList getCurrentDocumentChildren()
                                             throws ClientException
Deprecated. 

Description copied from interface: NavigationContext
Retrieves the documents contained in the current parent.

Specified by:
getCurrentDocumentChildren in interface NavigationContext
Throws:
ClientException

invalidateChildrenProvider

public void invalidateChildrenProvider()
Description copied from interface: NavigationContext
Invalidates children provider (temporarily).

Specified by:
invalidateChildrenProvider in interface NavigationContext

invalidateCurrentDocument

public void invalidateCurrentDocument()
                               throws ClientException
Description copied from interface: NavigationContext
Will trigger reloading of current document data from the server.

Specified by:
invalidateCurrentDocument in interface NavigationContext
Throws:
ClientException

getCurrentDocumentChildrenPage

@Deprecated
public DocumentModelList getCurrentDocumentChildrenPage()
                                                 throws ClientException
Deprecated. 

Specified by:
getCurrentDocumentChildrenPage in interface NavigationContext
Returns:
list of children for the current document composing the current page
Throws:
ClientException

getCurrentDomain

@BypassInterceptors
public DocumentModel getCurrentDomain()
Description copied from interface: NavigationContext
Current Domain, if user has read permission on it. Use

Specified by:
getCurrentDomain in interface NavigationContext
Returns:
the current domain.

setCurrentDomain

public void setCurrentDomain(DocumentModel domainDocModel)
                      throws ClientException
Specified by:
setCurrentDomain in interface NavigationContext
Throws:
ClientException

saveCurrentDocument

public void saveCurrentDocument()
                         throws ClientException
Description copied from interface: NavigationContext
Saves the current copy of the document to server.

Specified by:
saveCurrentDocument in interface NavigationContext
Throws:
ClientException

getCurrentPathList

public List<PathElement> getCurrentPathList()
                                     throws ClientException
Specified by:
getCurrentPathList in interface NavigationContext
Throws:
ClientException

getCurrentServerLocation

public RepositoryLocation getCurrentServerLocation()
Specified by:
getCurrentServerLocation in interface NavigationContext
Returns:
current repository location or null if no server is connected

getSelectedServerLocation

@Deprecated
public RepositoryLocation getSelectedServerLocation()
Deprecated. use getCurrentServerLocation() instead

Specified by:
getSelectedServerLocation in interface NavigationContext
Returns:
current selected repository location or null

setCurrentServerLocation

public void setCurrentServerLocation(RepositoryLocation serverLocation)
                              throws ClientException
Switches to a new server location by updating the context and updating to the CoreSession (DocumentManager).

Specified by:
setCurrentServerLocation in interface NavigationContext
Parameters:
serverLocation - new server location to connect to
Throws:
ClientException

getOrCreateDocumentManager

public CoreSession getOrCreateDocumentManager()
                                       throws ClientException
Returns the current documentManager if any or create a new session to the current location.

Specified by:
getOrCreateDocumentManager in interface NavigationContext
Throws:
ClientException

getCurrentWorkspace

@BypassInterceptors
public DocumentModel getCurrentWorkspace()
Description copied from interface: NavigationContext
Gets the current Workspace.

Specified by:
getCurrentWorkspace in interface NavigationContext

factoryCurrentDocument

@Factory(value="currentDocument",
         scope=EVENT)
public DocumentModel factoryCurrentDocument()
Description copied from interface: NavigationContext
Gets the currentDocument and puts it in Page context.

Specified by:
factoryCurrentDocument in interface NavigationContext

factoryChangeableDocument

@Factory(value="changeableDocument",
         scope=EVENT)
public DocumentModel factoryChangeableDocument()
Description copied from interface: NavigationContext
Gets current document for edition.

Specified by:
factoryChangeableDocument in interface NavigationContext

factoryCurrentDomain

@Factory(value="currentDomain",
         scope=EVENT)
public DocumentModel factoryCurrentDomain()
Description copied from interface: NavigationContext
Gets the currentDomain and puts it in Page context.

Specified by:
factoryCurrentDomain in interface NavigationContext

factoryCurrentWorkspace

@Factory(value="currentWorkspace",
         scope=EVENT)
public DocumentModel factoryCurrentWorkspace()
Description copied from interface: NavigationContext
Gets the currentWorkspace and puts it in Page context.

Specified by:
factoryCurrentWorkspace in interface NavigationContext

factoryCurrentContentRoot

@Factory(value="currentContentRoot",
         scope=EVENT)
public DocumentModel factoryCurrentContentRoot()
Description copied from interface: NavigationContext
Gets the currentContentRootWorkspace and puts it in Page context.

Specified by:
factoryCurrentContentRoot in interface NavigationContext

factoryCurrentServerLocation

public RepositoryLocation factoryCurrentServerLocation()
Description copied from interface: NavigationContext
Gets the current ServerLocation and puts it in Page Context.

Specified by:
factoryCurrentServerLocation in interface NavigationContext

factoryCurrentDocumentChildren

@Factory(value="currentDocumentChildren",
         scope=EVENT)
public DocumentModelList factoryCurrentDocumentChildren()
                                                 throws ClientException
Description copied from interface: NavigationContext
Gets children of currentDocuments and put it in Page context.

Specified by:
factoryCurrentDocumentChildren in interface NavigationContext
Throws:
ClientException

factoryCurrentSuperSpace

@Factory(value="currentSuperSpace",
         scope=EVENT)
public DocumentModel factoryCurrentSuperSpace()
                                       throws ClientException
Description copied from interface: NavigationContext
Gets the currentSuperSpace and puts it in Page context.

Specified by:
factoryCurrentSuperSpace in interface NavigationContext
Throws:
ClientException

setCurrentWorkspace

public void setCurrentWorkspace(DocumentModel workspaceDocModel)
                         throws ClientException
Throws:
ClientException

updateDocumentContext

public void updateDocumentContext(DocumentModel doc)
                           throws ClientException
Description copied from interface: NavigationContext
Updates the current document in the (session) context and resets the other common structures (breadcrumbs, etc).

Specified by:
updateDocumentContext in interface NavigationContext
Parameters:
doc - DocumentModel that will be set as current document
Throws:
ClientException

resetCurrentContext

public void resetCurrentContext()
Description copied from interface: NavigationContext
Resets all context variables.

Specified by:
resetCurrentContext in interface NavigationContext

getActionResult

public String getActionResult(DocumentModel doc,
                              UserAction action)
                       throws ClientException
Description copied from interface: NavigationContext
Performs context updates and returns the view associated with the document and action passed.

Specified by:
getActionResult in interface NavigationContext
Returns:
document view associated with the result
Throws:
ClientException

goHome

public String goHome()
Description copied from interface: NavigationContext
go to the root server, the root document or to the dashboard if the latest document are not accessible.

Specified by:
goHome in interface NavigationContext

goBack

public String goBack()
              throws ClientException
Specified by:
goBack in interface NavigationContext
Throws:
ClientException

navigateToId

public String navigateToId(String documentId)
                    throws ClientException
Description copied from interface: NavigationContext
Updates the context and returns the view for the given document id.

Specified by:
navigateToId in interface NavigationContext
Throws:
ClientException

navigateToRef

public String navigateToRef(DocumentRef docRef)
                     throws ClientException
Description copied from interface: NavigationContext
Updates the context and returns the view for the given document ref.

Specified by:
navigateToRef in interface NavigationContext
Throws:
ClientException

navigateToDocument

public String navigateToDocument(DocumentModel doc)
                          throws ClientException
Description copied from interface: NavigationContext
Updates the context and returns the view for the given document.

Specified by:
navigateToDocument in interface NavigationContext
Throws:
ClientException

navigateToDocument

public String navigateToDocument(DocumentModel doc,
                                 String viewId)
                          throws ClientException
Updates context with given document and returns given view.

The view is supposed to be set on the document type information. If such a view id is not available for the type, use its default vieW.

Specified by:
navigateToDocument in interface NavigationContext
viewId - for the document as defined in its type
Returns:
navigation view for the document
Throws:
ClientException

navigateToDocumentWithView

public String navigateToDocumentWithView(DocumentModel doc,
                                         String viewId)
                                  throws ClientException
Alias to navigateToDocument(DocumentModel doc, String viewId) so that JSF EL sees no ambiguity)

The view is supposed to be set on the document type information. If such a view id is not available for the type, use its default vieW.

Specified by:
navigateToDocumentWithView in interface NavigationContext
viewId - for the document as defined in its type
Returns:
navigation view for the document
Throws:
ClientException

navigateToDocument

public String navigateToDocument(DocumentModel docModel,
                                 VersionModel versionModel)
                          throws ClientException
Specified by:
navigateToDocument in interface NavigationContext
Throws:
ClientException

selectionChanged

public void selectionChanged()
Specified by:
selectionChanged in interface NavigationContext

getCurrentDocumentUrl

public String getCurrentDocumentUrl()
Specified by:
getCurrentDocumentUrl in interface NavigationContext
Returns:
the URL that can be used to refer the current document from outside current context
See Also:
NavigationContext.getCurrentDocumentUrl()

getCurrentDocumentFullUrl

public String getCurrentDocumentFullUrl()
Specified by:
getCurrentDocumentFullUrl in interface NavigationContext
Returns:
the URL that can be used to refer the current document from outside current context
See Also:
NavigationContext.getCurrentDocumentFullUrl()

navigateTo

@Begin(id="#{conversationIdGenerator.currentOrNewMainConversationId}",
       join=true)
public String navigateTo(RepositoryLocation serverLocation,
                                     DocumentRef docRef)
                  throws ClientException
Description copied from interface: NavigationContext
Initializes the context for the given refs and returns the default view for the doc.

Specified by:
navigateTo in interface NavigationContext
Throws:
ClientException

navigateToURL

@Begin(id="#{conversationIdGenerator.currentOrNewMainConversationId}",
       join=true)
public String navigateToURL(String documentUrl)
                     throws ClientException
Description copied from interface: NavigationContext
Initializes the context for the given refs and returns the default view for the doc.

Specified by:
navigateToURL in interface NavigationContext
Throws:
ClientException

navigateToURL

@Begin(id="#{conversationIdGenerator.currentOrNewMainConversationId}",
       join=true)
public String navigateToURL()
                     throws ClientException
Description copied from interface: NavigationContext
Initializes the context for the given refs and returns the default view for the doc.

Takes parameter String docRef from the Request.

Specified by:
navigateToURL in interface NavigationContext
Throws:
ClientException
See Also:
NavigationContext.navigateToURL()

getCurrentContentRoot

public DocumentModel getCurrentContentRoot()
Description copied from interface: NavigationContext
Gets the current Content Root (Workspaces, Sections, Templates...).

Specified by:
getCurrentContentRoot in interface NavigationContext

setCurrentContentRoot

public void setCurrentContentRoot(DocumentModel crDocumentModel)
Description copied from interface: NavigationContext
Sets the current ContentRoot.

Specified by:
setCurrentContentRoot in interface NavigationContext

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.