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 *     bstefanescu
011 */
012package org.nuxeo.ecm.automation.core.operations.document;
013
014import org.nuxeo.ecm.automation.core.Constants;
015import org.nuxeo.ecm.automation.core.annotations.Context;
016import org.nuxeo.ecm.automation.core.annotations.Operation;
017import org.nuxeo.ecm.automation.core.annotations.OperationMethod;
018import org.nuxeo.ecm.automation.core.annotations.Param;
019import org.nuxeo.ecm.core.api.CoreSession;
020import org.nuxeo.ecm.core.api.DocumentModelList;
021import org.nuxeo.ecm.core.query.sql.NXQL;
022
023/**
024 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
025 * @deprecated Since 6.0, document query operation logic has been moved. This class is not used/registered anymore into
026 *             the platform as Automation Operation. Replaced by
027 *             {@link org.nuxeo.ecm.automation.core.operations .services.query.DocumentPaginatedQuery}.
028 */
029@Deprecated
030@Operation(id = Query.ID, category = Constants.CAT_FETCH, label = "Query", description = "Perform a query on the repository. The query result "
031        + "will become the input for the next operation.", addToStudio = false, deprecatedSince = "6.0")
032public class Query {
033
034    public static final String ID = "Document.Query";
035
036    @Context
037    protected CoreSession session;
038
039    @Param(name = "query")
040    protected String query;
041
042    @Param(name = "language", required = false, widget = Constants.W_OPTION, values = { NXQL.NXQL, "CMISQL" })
043    protected String lang = NXQL.NXQL;
044
045    @OperationMethod
046    public DocumentModelList run() {
047        return session.query(query, lang, null, 0, 0, false);
048    }
049
050}