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 * Thierry Martins 016 */ 017 018package org.nuxeo.ecm.platform.web.common.requestcontroller.service; 019 020import java.io.Serializable; 021 022import org.nuxeo.common.xmap.annotation.XContent; 023import org.nuxeo.common.xmap.annotation.XNode; 024import org.nuxeo.common.xmap.annotation.XObject; 025 026/** 027 * @author <a href="mailto:tm@nuxeo.com">Thierry Martins</a> 028 * @since 6.0 029 */ 030@XObject(value = "header") 031public class NuxeoHeaderDescriptor implements Serializable, Cloneable { 032 033 private static final long serialVersionUID = 1L; 034 035 @XNode("@name") 036 protected String name; 037 038 @XNode("@enabled") 039 protected Boolean enabled = true; 040 041 protected String value; 042 043 public String getValue() { 044 return value; 045 } 046 047 @XContent 048 public void setValue(String value) { 049 if (value != null) { 050 this.value = value.trim(); 051 } 052 } 053 054 public String getName() { 055 return name; 056 } 057 058 public boolean isEnabled() { 059 return enabled; 060 } 061 062 public NuxeoHeaderDescriptor clone() throws CloneNotSupportedException { 063 NuxeoHeaderDescriptor d = new NuxeoHeaderDescriptor(); 064 d.name = name; 065 d.enabled = enabled; 066 d.value = value; 067 return d; 068 } 069 070 public void merge(NuxeoHeaderDescriptor source) { 071 enabled = source.enabled; 072 if (source.value != null) { 073 value = source.value; 074 } 075 } 076 077}