001/* 002 * (C) Copyright 2014 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-2.1.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 * Anahide Tchertchian 016 */ 017package org.nuxeo.ecm.platform.query.nxql; 018 019import org.nuxeo.ecm.core.api.CoreSession; 020import org.nuxeo.ecm.core.api.IterableQueryResult; 021import org.nuxeo.ecm.core.api.UnrestrictedSessionRunner; 022 023/** 024 * Unrestricted session runner providing API for retrieving the result list. 025 * 026 * @since 6.0 027 */ 028public class CoreQueryAndFetchUnrestrictedSessionRunner extends UnrestrictedSessionRunner { 029 030 protected final String query; 031 032 protected final String language; 033 034 protected IterableQueryResult result; 035 036 public CoreQueryAndFetchUnrestrictedSessionRunner(CoreSession session, String query, String language) { 037 super(session); 038 this.query = query; 039 this.language = language; 040 } 041 042 @Override 043 public void run() { 044 result = session.queryAndFetch(query, language); 045 } 046 047 public IterableQueryResult getResult() { 048 return result; 049 } 050 051}