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 javax.servlet.ServletRequest; 020import javax.ws.rs.core.HttpHeaders; 021 022import org.nuxeo.ecm.core.api.DocumentModel; 023 024/** 025 * Evaluation context that knows about the current document and the HTTP request headers. 026 * 027 * @since 5.7.3 028 * @deprecated The JSON marshalling was migrated to nuxeo-core-io. An enricher system is also available. See 029 * org.nuxeo.ecm.core.io.marshallers.json.enrichers.BreadcrumbJsonEnricher for an example. To migrate an 030 * existing enricher, keep the marshalling code and use it in class implementing 031 * AbstractJsonEnricher<DocumentModel> (the use of contextual parameters is a bit different but 032 * compatible / you have to manage the enricher's parameters yourself). Don't forget to contribute to 033 * service org.nuxeo.ecm.core.io.registry.MarshallerRegistry to register your enricher. 034 */ 035@Deprecated 036public class HeaderDocEvaluationContext implements RestEvaluationContext { 037 038 private DocumentModel doc; 039 040 private HttpHeaders headers; 041 042 private ServletRequest request; 043 044 /** 045 * Creates the evaluation context. 046 * 047 * @param doc 048 * @param headers 049 */ 050 public HeaderDocEvaluationContext(DocumentModel doc, HttpHeaders headers, ServletRequest request) { 051 this.doc = doc; 052 this.headers = headers; 053 this.request = request; 054 } 055 056 @Override 057 public DocumentModel getDocumentModel() { 058 return doc; 059 } 060 061 @Override 062 public HttpHeaders getHeaders() { 063 return headers; 064 } 065 066 @Override 067 public ServletRequest getRequest() { 068 return request; 069 } 070 071}