001/* 002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Thierry Delprat 016 * Gagnavarslan ehf 017 * Vitalii Siryi 018 */ 019package org.nuxeo.ecm.webdav.backend; 020 021import org.apache.commons.lang.StringUtils; 022import org.nuxeo.ecm.core.api.CoreSession; 023 024public class SearchRootBackend extends SearchVirtualBackend { 025 026 private static final String QUERY = "select * from Workspace where ecm:mixinType != 'HiddenInNavigation' " 027 + "AND ecm:currentLifeCycleState != 'deleted' AND ecm:isProxy = 0 order by ecm:path"; 028 029 public SearchRootBackend(CoreSession session) { 030 super("", "", QUERY, session, new SimpleRealBackendFactory()); 031 } 032 033 @Override 034 public Backend getBackend(String uri) { 035 if (StringUtils.isEmpty(uri) || "/".equals(uri)) { 036 return this; 037 } else { 038 return super.getBackend(uri); 039 } 040 041 } 042 043 @Override 044 public boolean isRoot() { 045 return true; 046 } 047}