Search in sources :

Example 6 with CoreSession

use of org.nuxeo.ecm.core.api.CoreSession in project nuxeo-drive-server by nuxeo.

the class AbstractFileSystemItemFactory method getDocumentByFileSystemId.

@Deprecated
@Override
public DocumentModel getDocumentByFileSystemId(String id, Principal principal) {
    // Parse id, expecting
    // pattern:fileSystemItemFactoryName#repositoryName#docId
    String[] idFragments = parseFileSystemId(id);
    String repositoryName = idFragments[1];
    String docId = idFragments[2];
    CoreSession session = Framework.getService(FileSystemItemManager.class).getSession(repositoryName, principal);
    return getDocumentById(docId, session);
}
Also used : FileSystemItemManager(org.nuxeo.drive.service.FileSystemItemManager) CloseableCoreSession(org.nuxeo.ecm.core.api.CloseableCoreSession) CoreSession(org.nuxeo.ecm.core.api.CoreSession)

Example 7 with CoreSession

use of org.nuxeo.ecm.core.api.CoreSession in project nuxeo-filesystem-connectors by nuxeo.

the class AbstractBackendFactory method getBackend.

@Override
public Backend getBackend(String path, HttpServletRequest request) {
    if (request == null) {
        throw new NullPointerException("null request");
    }
    Backend backend = (Backend) request.getAttribute(WIRequestFilter.BACKEND_KEY);
    if (backend == null) {
        // create backend from WebEngine session
        WebContext webContext = WebEngine.getActiveContext();
        if (webContext == null) {
            throw new NullPointerException("null WebContext");
        }
        CoreSession session = webContext.getCoreSession();
        if (session == null) {
            throw new NullPointerException("null CoreSession");
        }
        backend = createRootBackend(session);
        request.setAttribute(WIRequestFilter.BACKEND_KEY, backend);
    }
    return backend.getBackend(path);
}
Also used : WebContext(org.nuxeo.ecm.webengine.model.WebContext) CoreSession(org.nuxeo.ecm.core.api.CoreSession)

Aggregations

CoreSession (org.nuxeo.ecm.core.api.CoreSession)7 CloseableCoreSession (org.nuxeo.ecm.core.api.CloseableCoreSession)2 DocumentModel (org.nuxeo.ecm.core.api.DocumentModel)2 DocumentModelList (org.nuxeo.ecm.core.api.DocumentModelList)2 EventContext (org.nuxeo.ecm.core.event.EventContext)2 Serializable (java.io.Serializable)1 HashMap (java.util.HashMap)1 NamingException (javax.naming.NamingException)1 RollbackException (javax.transaction.RollbackException)1 SystemException (javax.transaction.SystemException)1 Transaction (javax.transaction.Transaction)1 FileSystemItemManager (org.nuxeo.drive.service.FileSystemItemManager)1 DocumentRef (org.nuxeo.ecm.core.api.DocumentRef)1 NuxeoException (org.nuxeo.ecm.core.api.NuxeoException)1 RepositoryManager (org.nuxeo.ecm.core.api.repository.RepositoryManager)1 DocumentEventContext (org.nuxeo.ecm.core.event.impl.DocumentEventContext)1 WebContext (org.nuxeo.ecm.webengine.model.WebContext)1 ConfigurationService (org.nuxeo.runtime.services.config.ConfigurationService)1