001/* 002 * (C) Copyright 2013 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 * dmetzler 016 */ 017package org.nuxeo.ecm.automation.io.services.enricher; 018 019import java.io.IOException; 020import java.util.List; 021 022import org.codehaus.jackson.JsonGenerator; 023import org.nuxeo.ecm.automation.jaxrs.io.documents.JsonDocumentListWriter; 024import org.nuxeo.ecm.core.api.CoreSession; 025import org.nuxeo.ecm.core.api.DocumentModel; 026import org.nuxeo.ecm.core.api.impl.DocumentModelListImpl; 027import org.nuxeo.ecm.core.io.marshallers.json.enrichers.BreadcrumbJsonEnricher; 028 029/** 030 * @since 5.7.3 031 * @deprecated This enricher was migrated to {@link BreadcrumbJsonEnricher}. The content enricher service doesn't work 032 * anymore. 033 */ 034@Deprecated 035public class BreadcrumbEnricher extends AbstractContentEnricher { 036 037 @Override 038 public void enrich(JsonGenerator jg, RestEvaluationContext ec) throws IOException { 039 DocumentModel doc = ec.getDocumentModel(); 040 CoreSession session = doc.getCoreSession(); 041 List<DocumentModel> parentDocuments = session.getParentDocuments(doc.getRef()); 042 JsonDocumentListWriter.writeDocuments(jg, new DocumentModelListImpl(parentDocuments), new String[] {}, 043 ec.getRequest()); 044 } 045 046}