001/* 002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Thierry Martins 018 */ 019 020package org.nuxeo.ecm.platform.web.common.requestcontroller.service; 021 022import java.io.Serializable; 023 024import org.nuxeo.common.xmap.annotation.XContent; 025import org.nuxeo.common.xmap.annotation.XNode; 026import org.nuxeo.common.xmap.annotation.XObject; 027 028/** 029 * @author <a href="mailto:tm@nuxeo.com">Thierry Martins</a> 030 * @since 6.0 031 */ 032@XObject(value = "header") 033public class NuxeoHeaderDescriptor implements Serializable, Cloneable { 034 035 private static final long serialVersionUID = 1L; 036 037 @XNode("@name") 038 protected String name; 039 040 @XNode("@enabled") 041 protected Boolean enabled = true; 042 043 protected String value; 044 045 public String getValue() { 046 return value; 047 } 048 049 @XContent 050 public void setValue(String value) { 051 if (value != null) { 052 this.value = value.trim(); 053 } 054 } 055 056 public String getName() { 057 return name; 058 } 059 060 public boolean isEnabled() { 061 return enabled; 062 } 063 064 public NuxeoHeaderDescriptor clone() throws CloneNotSupportedException { 065 NuxeoHeaderDescriptor d = new NuxeoHeaderDescriptor(); 066 d.name = name; 067 d.enabled = enabled; 068 d.value = value; 069 return d; 070 } 071 072 public void merge(NuxeoHeaderDescriptor source) { 073 enabled = source.enabled; 074 if (source.value != null) { 075 value = source.value; 076 } 077 } 078 079}