001/*
002 * (C) Copyright 2009 Nuxeo SAS (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 *     Olivier Grisel
016 */
017package org.nuxeo.ecm.platform.categorization.service;
018
019import java.util.List;
020
021import org.nuxeo.ecm.core.api.CoreSession;
022import org.nuxeo.ecm.core.api.DocumentModel;
023import org.nuxeo.ecm.core.api.DocumentRef;
024
025/**
026 * Service to automatically suggests values for metadata category fields from the text content of a document.
027 *
028 * @author ogrisel
029 */
030public interface DocumentCategorizationService {
031
032    /**
033     * Run all registered document categorizers on the given documents fetched using the provided session. Note: the
034     * service does not save the documents. This responsibility is left to the caller.
035     *
036     * @param session the Core session used to fetch the document
037     * @param docRefs the list of documents to process
038     * @return the updated documents (unchanged documents are filtered out)
039     */
040    List<DocumentModel> updateCategories(CoreSession session, List<DocumentRef> docRefs);
041
042    /**
043     * Run all registered document categorizers on the given documents. Note: the service does not save the documents.
044     * This responsibility is left to the caller.
045     *
046     * @param documents the list of documents to process
047     * @return the updated documents (unchanged documents are filtered out)
048     */
049    List<DocumentModel> updateCategories(List<DocumentModel> documents);
050
051}